x86/HVM: drop tsc_scaling.setup() hook

This was used by VMX only, and the intended VMCS write can as well
happen from vmx_set_tsc_offset(), invoked (directly or indirectly)
almost immediately after the present call sites of the hook.
vmx_set_tsc_offset() isn't invoked frequently elsewhere, so the extra
VMCS write shouldn't raise performance concerns.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
Jan Beulich committed 2024-01-09 14:07:17 +01:00
1 parent 0b5f149338
commit 48193fe00a
3 files changed
+3 -22

No files matched your search

-6
View File
@@ -1086,9 +1086,6 @@ static int cf_check hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
v->arch.hvm.guest_cr[2] = ctxt.cr2;
hvm_update_guest_cr(v, 2);
if ( hvm_funcs.tsc_scaling.setup )
alternative_vcall(hvm_funcs.tsc_scaling.setup, v);
v->arch.msrs->tsc_aux = ctxt.msr_tsc_aux;
hvm_set_guest_tsc_fixed(v, ctxt.tsc, d->arch.hvm.sync_tsc);
@@ -4033,9 +4030,6 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip)
hvm_set_segment_register(v, x86_seg_gdtr, &reg);
hvm_set_segment_register(v, x86_seg_idtr, &reg);
if ( hvm_funcs.tsc_scaling.setup )
alternative_vcall(hvm_funcs.tsc_scaling.setup, v);
/* Sync AP's TSC with BSP's. */
v->arch.hvm.cache_tsc_offset =
v->domain->vcpu[0]->arch.hvm.cache_tsc_offset;
+3 -13
View File
@@ -1454,20 +1454,13 @@ static void cf_check vmx_handle_cd(struct vcpu *v, unsigned long value)
}
}
static void cf_check vmx_setup_tsc_scaling(struct vcpu *v)
{
if ( v->domain->arch.vtsc )
return;
vmx_vmcs_enter(v);
__vmwrite(TSC_MULTIPLIER, hvm_tsc_scaling_ratio(v->domain));
vmx_vmcs_exit(v);
}
static void cf_check vmx_set_tsc_offset(struct vcpu *v, u64 offset, u64 at_tsc)
{
vmx_vmcs_enter(v);
if ( !v->domain->arch.vtsc && cpu_has_vmx_tsc_scaling )
__vmwrite(TSC_MULTIPLIER, hvm_tsc_scaling_ratio(v->domain));
if ( nestedhvm_vcpu_in_guestmode(v) )
offset += nvmx_get_tsc_offset(v);
@@ -3027,10 +3020,7 @@ const struct hvm_function_table * __init start_vmx(void)
}
if ( cpu_has_vmx_tsc_scaling )
{
vmx_function_table.tsc_scaling.ratio_frac_bits = 48;
vmx_function_table.tsc_scaling.setup = vmx_setup_tsc_scaling;
}
model_specific_lbr = get_model_specific_lbr();
lbr_tsx_fixup_check();
-3
View File
@@ -240,9 +240,6 @@ struct hvm_function_table {
uint8_t ratio_frac_bits;
/* maximum-allowed TSC scaling ratio */
uint64_t max_ratio;
/* Architecture function to setup TSC scaling ratio */
void (*setup)(struct vcpu *v);
} tsc_scaling;
};
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.