[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/2] x86/vmx: Calculate model-specific LBRs once at start of day
On 09.01.2023 13:08, Andrew Cooper wrote: > There is no point repeating this calculation at runtime, especially as it is > in the fallback path of the WRSMR/RDMSR handlers. > > Move the infrastructure higher in vmx.c to avoid forward declarations, > renaming last_branch_msr_get() to get_model_specific_lbr() to highlight that > these are model-specific only. > > No practical change. > > Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> with one nit: > --- a/xen/arch/x86/hvm/vmx/vmx.c > +++ b/xen/arch/x86/hvm/vmx/vmx.c > @@ -396,6 +396,142 @@ void vmx_pi_hooks_deassign(struct domain *d) > domain_unpause(d); > } > > +static const struct lbr_info { > + u32 base, count; > +} p4_lbr[] = { > + { MSR_P4_LER_FROM_LIP, 1 }, > + { MSR_P4_LER_TO_LIP, 1 }, > + { MSR_P4_LASTBRANCH_TOS, 1 }, > + { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO }, > + { MSR_P4_LASTBRANCH_0_TO_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO }, > + { 0, 0 } > +}, c2_lbr[] = { > + { MSR_IA32_LASTINTFROMIP, 1 }, > + { MSR_IA32_LASTINTTOIP, 1 }, > + { MSR_C2_LASTBRANCH_TOS, 1 }, > + { MSR_C2_LASTBRANCH_0_FROM_IP, NUM_MSR_C2_LASTBRANCH_FROM_TO }, > + { MSR_C2_LASTBRANCH_0_TO_IP, NUM_MSR_C2_LASTBRANCH_FROM_TO }, > + { 0, 0 } > +}, nh_lbr[] = { > + { MSR_IA32_LASTINTFROMIP, 1 }, > + { MSR_IA32_LASTINTTOIP, 1 }, > + { MSR_NHL_LBR_SELECT, 1 }, > + { MSR_NHL_LASTBRANCH_TOS, 1 }, > + { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO }, > + { MSR_P4_LASTBRANCH_0_TO_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO }, > + { 0, 0 } > +}, sk_lbr[] = { > + { MSR_IA32_LASTINTFROMIP, 1 }, > + { MSR_IA32_LASTINTTOIP, 1 }, > + { MSR_NHL_LBR_SELECT, 1 }, > + { MSR_NHL_LASTBRANCH_TOS, 1 }, > + { MSR_SKL_LASTBRANCH_0_FROM_IP, NUM_MSR_SKL_LASTBRANCH }, > + { MSR_SKL_LASTBRANCH_0_TO_IP, NUM_MSR_SKL_LASTBRANCH }, > + { MSR_SKL_LASTBRANCH_0_INFO, NUM_MSR_SKL_LASTBRANCH }, > + { 0, 0 } > +}, at_lbr[] = { > + { MSR_IA32_LASTINTFROMIP, 1 }, > + { MSR_IA32_LASTINTTOIP, 1 }, > + { MSR_C2_LASTBRANCH_TOS, 1 }, > + { MSR_C2_LASTBRANCH_0_FROM_IP, NUM_MSR_ATOM_LASTBRANCH_FROM_TO }, > + { MSR_C2_LASTBRANCH_0_TO_IP, NUM_MSR_ATOM_LASTBRANCH_FROM_TO }, > + { 0, 0 } > +}, sm_lbr[] = { > + { MSR_IA32_LASTINTFROMIP, 1 }, > + { MSR_IA32_LASTINTTOIP, 1 }, > + { MSR_SM_LBR_SELECT, 1 }, > + { MSR_SM_LASTBRANCH_TOS, 1 }, > + { MSR_C2_LASTBRANCH_0_FROM_IP, NUM_MSR_ATOM_LASTBRANCH_FROM_TO }, > + { MSR_C2_LASTBRANCH_0_TO_IP, NUM_MSR_ATOM_LASTBRANCH_FROM_TO }, > + { 0, 0 } > +}, gm_lbr[] = { > + { MSR_IA32_LASTINTFROMIP, 1 }, > + { MSR_IA32_LASTINTTOIP, 1 }, > + { MSR_SM_LBR_SELECT, 1 }, > + { MSR_SM_LASTBRANCH_TOS, 1 }, > + { MSR_GM_LASTBRANCH_0_FROM_IP, NUM_MSR_GM_LASTBRANCH_FROM_TO }, > + { MSR_GM_LASTBRANCH_0_TO_IP, NUM_MSR_GM_LASTBRANCH_FROM_TO }, > + { 0, 0 } > +}; > +static const struct lbr_info * __ro_after_init model_specific_lbr; > + > +static const struct __init lbr_info *get_model_specific_lbr(void) Please move __init: static const struct lbr_info *__init get_model_specific_lbr(void) Jan
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |