x86/cpuid: Move vendor/family/model information from arch_domain to cpuid_policy
PATCH 1/1 x86/cpuid: Move vendor/family/model information from arch_domain to cpuid_policy
Rename the x86 field to x86_family so its name actually reflects its meaning.
No functional change.
---
CC: Jan Beulich <[email protected]>
CC: Tim Deegan <[email protected]>
CC: George Dunlap <[email protected]>
CC: Paul Durrant <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
--- xen/arch/x86/cpuid.c | 11 +++++++---- xen/arch/x86/domain.c | 4 ---- xen/arch/x86/domctl.c | 11 +++++------ xen/arch/x86/hvm/emulate.c | 2 +- xen/arch/x86/hvm/hvm.c | 2 +- xen/arch/x86/hvm/ioreq.c | 5 +++-- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/mm.c | 4 ++-- xen/arch/x86/mm/shadow/common.c | 2 +- xen/arch/x86/traps.c | 2 +- xen/include/asm-x86/cpuid.h | 3 +++ xen/include/asm-x86/domain.h | 5 ----- 13 files changed, 26 insertions(+), 29 deletions(-)
xen/arch/x86/cpuid.c +7 -4
@@ -130,6 +130,10 @@ static void __init calculate_raw_policy(void)for ( i =1 ; i <min (ARRAY_SIZE (p->extd.raw), p->extd.max_leaf +1 -0x80000000ul ); ++i )cpuid_leaf (0x80000000 + i, &p->extd.raw[i]); + + p->x86_vendor = boot_cpu_data.x86_vendor; + p->x86_family = boot_cpu_data.x86; + p->x86_model = boot_cpu_data.x86_model; }static void __init calculate_host_policy (void )
@@ -572,7 +576,7 @@ static void pv_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res) res->d = p->extd.e1d;/* If not emulating AMD, clear the duplicated features in e1d. */ -if ( currd->arch.x86_vendor !=X86_VENDOR_AMD ) +if ( p->x86_vendor !=X86_VENDOR_AMD ) res->d &= ~CPUID_COMMON_1D_FEATURES ;/*
@@ -785,7 +789,7 @@ static void hvm_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res) res->d = p->extd.e1d;/* If not emulating AMD, clear the duplicated features in e1d. */ -if ( d->arch.x86_vendor !=X86_VENDOR_AMD ) +if ( p->x86_vendor !=X86_VENDOR_AMD ) res->d &= ~CPUID_COMMON_1D_FEATURES ;/* fast-forward MSR_APIC_BASE.EN if it hasn't already been clobbered. */ else if (vlapic_hw_disabled (vcpu_vlapic (v)) )
@@ -809,8 +813,7 @@ static void hvm_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res) res->d &= ~cpufeat_mask (X86_FEATURE_PSE36 );/* SYSCALL is hidden outside of long mode on Intel. */ -if ( d->arch.x86_vendor ==X86_VENDOR_INTEL && - !hvm_long_mode_enabled (v)) +if ( p->x86_vendor ==X86_VENDOR_INTEL && !hvm_long_mode_enabled (v) ) res->d &= ~cpufeat_mask (X86_FEATURE_SYSCALL );break ;
xen/arch/x86/domain.c +0 -4
@@ -616,10 +616,6 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, d->arch.cpuids[i].input[1 ] =XEN_CPUID_INPUT_UNUSED ; } - d->arch.x86_vendor = boot_cpu_data.x86_vendor; - d->arch.x86 = boot_cpu_data.x86; - d->arch.x86_model = boot_cpu_data.x86_model; - d->arch.ioport_caps =rangeset_new (d,"I/O Ports" , RANGESETF_prettyprint_hex); rc = -ENOMEM ;
xen/arch/x86/domctl.c +5 -6
@@ -78,12 +78,11 @@ static void update_domain_cpuid_info(struct domain *d,switch ( ctl->input[0 ] ) {case 0 : { -int old_vendor = d->arch.x86_vendor; +int old_vendor = p->x86_vendor; - d->arch.x86_vendor =get_cpu_vendor ( - ctl->ebx, ctl->ecx, ctl->edx, gcv_guest); + p->x86_vendor =get_cpu_vendor (ctl->ebx, ctl->ecx, ctl->edx, gcv_guest); -if (is_hvm_domain (d) && (d->arch.x86_vendor != old_vendor) ) +if (is_hvm_domain (d) && (p->x86_vendor != old_vendor) ) {struct vcpu *v;
@@ -95,7 +94,7 @@ static void update_domain_cpuid_info(struct domain *d, }case 1 : - d->arch.x86 =get_cpu_family (ctl->eax, &d->arch.x86_model,NULL ); + p->x86_family =get_cpu_family (ctl->eax, &p->x86_model,NULL );if (is_pv_domain (d) && ((levelling_caps & LCAP_1cd) == LCAP_1cd) ) {
@@ -216,7 +215,7 @@ static void update_domain_cpuid_info(struct domain *d, ecx |=cpufeat_mask (X86_FEATURE_CMP_LEGACY );/* If not emulating AMD, clear the duplicated features in e1d. */ -if ( d->arch.x86_vendor !=X86_VENDOR_AMD ) +if ( p->x86_vendor !=X86_VENDOR_AMD ) edx &= ~CPUID_COMMON_1D_FEATURES ; switch ( boot_cpu_data.x86_vendor )
xen/arch/x86/hvm/emulate.c +1 -1
@@ -1910,7 +1910,7 @@ void hvm_emulate_init_once( hvmemul_ctxt->validate = validate; hvmemul_ctxt->ctxt.regs = regs; - hvmemul_ctxt->ctxt.vendor = curr->domain->arch.x86_vendor; + hvmemul_ctxt->ctxt.vendor = curr->domain->arch.cpuid->x86_vendor; hvmemul_ctxt->ctxt.force_writeback = true;if ( cpu_has_vmx )
xen/arch/x86/hvm/hvm.c +1 -1
@@ -3619,7 +3619,7 @@ void hvm_ud_intercept(struct cpu_user_regs *regs) {struct vcpu *cur = current;bool should_emulate = - cur->domain->arch.x86_vendor != boot_cpu_data.x86_vendor; + cur->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor;struct hvm_emulate_ctxt ctxt;hvm_emulate_init_once (&ctxt, opt_hvm_fep ?NULL : is_cross_vendor, regs);
xen/arch/x86/hvm/ioreq.c +3 -2
@@ -1140,8 +1140,9 @@ struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d, (p->addr &3 );/* AMD extended configuration space access? */ if (CF8_ADDR_HI (cf8) && - d->arch.x86_vendor ==X86_VENDOR_AMD && - d->arch.x86 >=0x10 && d->arch.x86 <=0x17 ) + d->arch.cpuid->x86_vendor ==X86_VENDOR_AMD && + d->arch.cpuid->x86_family >=0x10 && + d->arch.cpuid->x86_family <=0x17 ) {uint64_t msr_val;
xen/arch/x86/hvm/svm/svm.c +1 -1
@@ -591,7 +591,7 @@ static void svm_update_guest_vendor(struct vcpu *v)u32 bitmap =vmcb_get_exception_intercepts (vmcb);if ( opt_hvm_fep || - (v->domain->arch.x86_vendor != boot_cpu_data.x86_vendor) ) + (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) ) bitmap |= (1U << TRAP_invalid_op);else bitmap &= ~(1U << TRAP_invalid_op);
xen/arch/x86/hvm/vmx/vmx.c +1 -1
@@ -544,7 +544,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)static void vmx_update_guest_vendor (struct vcpu *v) {if ( opt_hvm_fep || - (v->domain->arch.x86_vendor != boot_cpu_data.x86_vendor) ) + (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) ) v->arch.hvm_vmx.exception_bitmap |= (1U << TRAP_invalid_op);else v->arch.hvm_vmx.exception_bitmap &= ~(1U << TRAP_invalid_op);
xen/arch/x86/mm.c +2 -2
@@ -5358,7 +5358,7 @@ int ptwr_do_page_fault(struct vcpu *v, unsigned long addr,struct ptwr_emulate_ctxt ptwr_ctxt = { .ctxt = { .regs = regs, - .vendor = d->arch.x86_vendor, + .vendor = d->arch.cpuid->x86_vendor, .addr_size =is_pv_32bit_domain (d) ?32 :BITS_PER_LONG , .sp_size =is_pv_32bit_domain (d) ?32 :BITS_PER_LONG , .swint_emulate = x86_swint_emulate_none,
@@ -5514,7 +5514,7 @@ int mmio_ro_do_page_fault(struct vcpu *v, unsigned long addr,struct mmio_ro_emulate_ctxt mmio_ro_ctxt = { .cr2 = addr };struct x86_emulate_ctxt ctxt = { .regs = regs, - .vendor = v->domain->arch.x86_vendor, + .vendor = v->domain->arch.cpuid->x86_vendor, .addr_size = addr_size, .sp_size = addr_size, .swint_emulate = x86_swint_emulate_none,
xen/arch/x86/mm/shadow/common.c +1 -1
@@ -330,7 +330,7 @@ const struct x86_emulate_ops *shadow_init_emulation(memset (sh_ctxt,0 ,sizeof (*sh_ctxt)); sh_ctxt->ctxt.regs = regs; - sh_ctxt->ctxt.vendor = v->domain->arch.x86_vendor; + sh_ctxt->ctxt.vendor = v->domain->arch.cpuid->x86_vendor; sh_ctxt->ctxt.swint_emulate = x86_swint_emulate_none;/* Segment cache initialisation. Primed with CS. */
xen/arch/x86/traps.c +1 -1
@@ -2990,7 +2990,7 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)struct domain *currd = curr->domain;struct priv_op_ctxt ctxt = { .ctxt.regs = regs, - .ctxt.vendor = currd->arch.x86_vendor, + .ctxt.vendor = currd->arch.cpuid->x86_vendor, };int rc;unsigned int eflags, ar;
xen/include/asm-x86/cpuid.h +3 -0
@@ -200,6 +200,9 @@ struct cpuid_policy#undef __DECL_BITFIELD#undef _DECL_BITFIELD#undef DECL_BITFIELD + +/* Value calculated from raw data above. */ +uint8_t x86_vendor, x86_family, x86_model; };/* Fill in a featureset bitmap from a CPUID policy. */
xen/include/asm-x86/domain.h +0 -5
@@ -340,11 +340,6 @@ struct arch_domain/* Is PHYSDEVOP_eoi to automatically unmask the event channel? */ bool_t auto_unmask; -/* Values snooped from updates to cpuids[] (below). */ -u8 x86;/* CPU family */ -u8 x86_vendor;/* CPU vendor */ -u8 x86_model;/* CPU model */ -/* * The width of the FIP/FDP register in the FPU that needs to be * saved/restored during a context switch. This is needed because
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 13 lines
-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: 12 January 2017 12:33
To: Xen-devel <[email protected]>
Cc: Andrew Cooper <[email protected]>; Jan Beulich <[email protected]>; Tim (Xen.org) <[email protected]>; George Dunlap <[email protected]>; Paul Durrant <[email protected]>; Boris Ostrovsky <[email protected]>; Suravee Suthikulpanit <[email protected]>; Jun Nakajima <[email protected]>; Kevin Tian <[email protected]>
Subject: [PATCH] x86/cpuid: Move vendor/family/model information fromarch_domaintocpuid_policy
Quoted 5 lines
Rename the x86 field to
x86_familyso its name actually reflects its meaning.No functional change.
Signed-off-by Andrew Cooper <[email protected]>
Quoted 289 lines
---
CC: Jan Beulich <[email protected]>
CC: Tim Deegan <[email protected]>
CC: George Dunlap <[email protected]>
CC: Paul Durrant <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>--- xen/arch/x86/cpuid.c | 11 +++++++---- xen/arch/x86/domain.c | 4 ---- xen/arch/x86/domctl.c | 11 +++++------ xen/arch/x86/hvm/emulate.c | 2 +- xen/arch/x86/hvm/hvm.c | 2 +- xen/arch/x86/hvm/ioreq.c | 5 +++-- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/mm.c | 4 ++-- xen/arch/x86/mm/shadow/common.c | 2 +- xen/arch/x86/traps.c | 2 +- xen/include/asm-x86/cpuid.h | 3 +++ xen/include/asm-x86/domain.h | 5 ----- 13 files changed, 26 insertions(+), 29 deletions(-)xen/arch/x86/cpuid.c +5
-1@@ -130,6 +130,10 @@ static void __init calculate_raw_policy(void)for ( i =1 ; i <min (ARRAY_SIZE (p->extd.raw), p->extd.max_leaf +1 -0x80000000ul ); ++i )cpuid_leaf (0x80000000 + i, &p->extd.raw[i]); + + p->x86_vendor = boot_cpu_data.x86_vendor; + p->x86_family = boot_cpu_data.x86; + p->x86_model = boot_cpu_data.x86_model; }static void __init calculate_host_policy (void )@@ -572,7 +576,7 @@ static void pv_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res) res->d = p->extd.e1d;/* If not emulating AMD, clear the duplicated features in e1d. */ -if ( currd->arch.x86_vendor !=X86_VENDOR_AMD ) +if ( p->x86_vendor !=X86_VENDOR_AMD ) res->d &= ~CPUID_COMMON_1D_FEATURES ;/*xen/arch/x86/cpuid.c +1
-1@@ -785,7 +789,7 @@ static void hvm_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res) res->d = p->extd.e1d;/* If not emulating AMD, clear the duplicated features in e1d. */ -if ( d->arch.x86_vendor !=X86_VENDOR_AMD ) +if ( p->x86_vendor !=X86_VENDOR_AMD ) res->d &= ~CPUID_COMMON_1D_FEATURES ;/* fast-forward MSR_APIC_BASE.EN if it hasn't already been clobbered. */
else if ( vlapic_hw_disabled(vcpu_vlapic(v)) )xen/arch/x86/cpuid.c +1
-2@@ -809,8 +813,7 @@ static void hvm_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res) res->d &= ~cpufeat_mask(X86_FEATURE_PSE36);/* SYSCALL is hidden outside of long mode on Intel. */ -if ( d->arch.x86_vendor ==X86_VENDOR_INTEL && - !hvm_long_mode_enabled (v)) +if ( p->x86_vendor ==X86_VENDOR_INTEL && !hvm_long_mode_enabled (v) ) res->d &= ~cpufeat_mask (X86_FEATURE_SYSCALL );break;xen/arch/x86/domain.c +0
-4@@ -616,10 +616,6 @@ int arch_domain_create(struct domain *d, unsignedint domcr_flags, d->arch.cpuids[i].input[1] = XEN_CPUID_INPUT_UNUSED; } - d->arch.x86_vendor = boot_cpu_data.x86_vendor; - d->arch.x86 = boot_cpu_data.x86; - d->arch.x86_model = boot_cpu_data.x86_model; - d->arch.ioport_caps =rangeset_new (d,"I/O Ports" , RANGESETF_prettyprint_hex);rc = -ENOMEM;xen/arch/x86/domctl.c +3
-4@@ -78,12 +78,11 @@ static void update_domain_cpuid_info(struct domain *d, switch ( ctl->input[0] ) {case 0 : { -int old_vendor = d->arch.x86_vendor; +int old_vendor = p->x86_vendor; - d->arch.x86_vendor =get_cpu_vendor ( - ctl->ebx, ctl->ecx, ctl->edx, gcv_guest); + p->x86_vendor =get_cpu_vendor (ctl->ebx, ctl->ecx, ctl->edx, gcv_guest); -if (is_hvm_domain (d) && (d->arch.x86_vendor != old_vendor) ) +if (is_hvm_domain (d) && (p->x86_vendor != old_vendor) ) {struct vcpu *v;xen/arch/x86/domctl.c +1
-1@@ -95,7 +94,7 @@ static void update_domain_cpuid_info(struct domain *d, }case 1 : - d->arch.x86 =get_cpu_family (ctl->eax, &d->arch.x86_model,NULL ); + p->x86_family =get_cpu_family (ctl->eax, &p->x86_model,NULL );if (is_pv_domain (d) && ((levelling_caps & LCAP_1cd) == LCAP_1cd) ){xen/arch/x86/domctl.c +1
-1@@ -216,7 +215,7 @@ static void update_domain_cpuid_info(struct domain *d, ecx |=cpufeat_mask (X86_FEATURE_CMP_LEGACY );/* If not emulating AMD, clear the duplicated features in e1d. */ -if ( d->arch.x86_vendor !=X86_VENDOR_AMD ) +if ( p->x86_vendor !=X86_VENDOR_AMD ) edx &= ~CPUID_COMMON_1D_FEATURES ;switch ( boot_cpu_data.x86_vendor )
xen/arch/x86/hvm/emulate.c +1
-1@@ -1910,7 +1910,7 @@ void hvm_emulate_init_once( hvmemul_ctxt->validate = validate; hvmemul_ctxt->ctxt.regs = regs; - hvmemul_ctxt->ctxt.vendor = curr->domain->arch.x86_vendor; + hvmemul_ctxt->ctxt.vendor = curr->domain->arch.cpuid->x86_vendor; hvmemul_ctxt->ctxt.force_writeback = true;if ( cpu_has_vmx )xen/arch/x86/hvm/hvm.c +1
-1@@ -3619,7 +3619,7 @@ void hvm_ud_intercept(struct cpu_user_regs *regs) {struct vcpu *cur = current;bool should_emulate = - cur->domain->arch.x86_vendor != boot_cpu_data.x86_vendor; + cur->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor;struct hvm_emulate_ctxt ctxt;hvm_emulate_init_once(&ctxt,
opt_hvm_fep? NULL :is_cross_vendor,
regs);xen/arch/x86/hvm/ioreq.c +3
-2@@ -1140,8 +1140,9 @@ struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d, (p->addr & 3);/* AMD extended configuration space access? */ if (CF8_ADDR_HI (cf8) && - d->arch.x86_vendor ==X86_VENDOR_AMD && - d->arch.x86 >=0x10 && d->arch.x86 <=0x17 ) + d->arch.cpuid->x86_vendor ==X86_VENDOR_AMD && + d->arch.cpuid->x86_family >=0x10 && + d->arch.cpuid->x86_family <=0x17 ) {uint64_t msr_val;xen/arch/x86/hvm/svm/svm.c +1
-1@@ -591,7 +591,7 @@ static void svm_update_guest_vendor(struct vcpu *v)u32 bitmap =vmcb_get_exception_intercepts (vmcb);if ( opt_hvm_fep || - (v->domain->arch.x86_vendor != boot_cpu_data.x86_vendor) ) + (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) ) bitmap |= (1U << TRAP_invalid_op);else bitmap &= ~(1U << TRAP_invalid_op);xen/arch/x86/hvm/vmx/vmx.c +1
-1@@ -544,7 +544,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)static void vmx_update_guest_vendor (struct vcpu *v) {if ( opt_hvm_fep || - (v->domain->arch.x86_vendor != boot_cpu_data.x86_vendor) ) + (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) ) v->arch.hvm_vmx.exception_bitmap |= (1U << TRAP_invalid_op);else v->arch.hvm_vmx.exception_bitmap &= ~(1U << TRAP_invalid_op);xen/arch/x86/mm.c +1
-1@@ -5358,7 +5358,7 @@ int ptwr_do_page_fault(struct vcpu *v, unsignedlong addr, struct ptwr_emulate_ctxt ptwr_ctxt = { .ctxt = { .regs = regs, - .vendor = d->arch.x86_vendor, + .vendor = d->arch.cpuid->x86_vendor, .addr_size =is_pv_32bit_domain (d) ?32 :BITS_PER_LONG , .sp_size =is_pv_32bit_domain (d) ?32 :BITS_PER_LONG ,.swint_emulate =
x86_swint_emulate_none,xen/arch/x86/mm.c +1
-1@@ -5514,7 +5514,7 @@ int mmio_ro_do_page_fault(struct vcpu *v,unsigned long addr, struct mmio_ro_emulate_ctxt mmio_ro_ctxt = { .cr2 = addr };struct x86_emulate_ctxt ctxt = { .regs = regs, - .vendor = v->domain->arch.x86_vendor, + .vendor = v->domain->arch.cpuid->x86_vendor, .addr_size = addr_size, .sp_size = addr_size,.swint_emulate =
x86_swint_emulate_none,xen/arch/x86/mm/shadow/common.c +1
-1@@ -330,7 +330,7 @@ const struct x86_emulate_ops *shadow_init_emulation ( memset(sh_ctxt, 0, sizeof(*sh_ctxt)); sh_ctxt->ctxt.regs = regs; - sh_ctxt->ctxt.vendor = v->domain->arch.x86_vendor; + sh_ctxt->ctxt.vendor = v->domain->arch.cpuid->x86_vendor; sh_ctxt->ctxt.swint_emulate = x86_swint_emulate_none;/* Segment cache initialisation. Primed with CS. */xen/arch/x86/traps.c +1
-1@@ -2990,7 +2990,7 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)struct domain *currd = curr->domain;struct priv_op_ctxt ctxt = { .ctxt.regs = regs, - .ctxt.vendor = currd->arch.x86_vendor, + .ctxt.vendor = currd->arch.cpuid->x86_vendor, };int rc;unsigned int eflags, ar;xen/include/asm-x86/cpuid.h +3
-0@@ -200,6 +200,9 @@ struct cpuid_policy#undef __DECL_BITFIELD#undef _DECL_BITFIELD#undef DECL_BITFIELD + +/* Value calculated from raw data above. */ +uint8_t x86_vendor, x86_family, x86_model; };/* Fill in a featureset bitmap from a CPUID policy. */ xen/include/asm-x86/domain.h +0
-6@@ -340,11 +340,6 @@ struct arch_domain/* Is PHYSDEVOP_eoi to automatically unmask the event channel? */ bool_t auto_unmask; -/* Values snooped from updates to cpuids[] (below). */ -u8 x86;/* CPU family */ -u8 x86_vendor;/* CPU vendor */ -u8 x86_model;/* CPU model */ -/* * The width of the FIP/FDP register in the FPU that needs to be * saved/restored during a context switch. This is needed because --
Quoted 1 line
2.1.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 12.01.17 at 13:32, <[email protected]> wrote:
xen/arch/x86/domctl.c +3
-4@@ -78,12 +78,11 @@ static void update_domain_cpuid_info(struct domain *d,switch ( ctl->input[0 ] ) {case 0 : { -int old_vendor = d->arch.x86_vendor; +int old_vendor = p->x86_vendor; - d->arch.x86_vendor =get_cpu_vendor ( - ctl->ebx, ctl->ecx, ctl->edx, gcv_guest); + p->x86_vendor =get_cpu_vendor (ctl->ebx, ctl->ecx, ctl->edx, gcv_guest); -if (is_hvm_domain (d) && (d->arch.x86_vendor != old_vendor) ) +if (is_hvm_domain (d) && (p->x86_vendor != old_vendor) ) {struct vcpu *v;
xen/arch/x86/domctl.c static void update_domain_cpuid_info(struct domain *d, · line 100
Quoted 8 lines
xen/arch/x86/domctl.c +1
-1@@ -95,7 +94,7 @@ static void update_domain_cpuid_info(struct domain *d, }case 1 : - d->arch.x86 =get_cpu_family (ctl->eax, &d->arch.x86_model,NULL ); + p->x86_family =get_cpu_family (ctl->eax, &p->x86_model,NULL );if (is_pv_domain (d) && ((levelling_caps & LCAP_1cd) == LCAP_1cd) ) {
Considering that the three fields can be calculated from other CPUID data, is it really worthwhile to store these redundant pieces of information, instead of having consumers simply call get_cpu_{vendor,policy}()? All we "gain" by storing them is the risk of them going out of sync.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 26 lines · Jan Beulich
Quoted 26 lines
Quoted 1 line
Quoted 1 line · On 12.01.17 at 13:32, <[email protected]> wrote:
xen/arch/x86/domctl.c +4
-5@@ -78,12 +78,11 @@ static void update_domain_cpuid_info(struct domain *d,switch ( ctl->input[0 ] ) {case 0 : { -int old_vendor = d->arch.x86_vendor; +int old_vendor = p->x86_vendor; - d->arch.x86_vendor =get_cpu_vendor ( - ctl->ebx, ctl->ecx, ctl->edx, gcv_guest); + p->x86_vendor =get_cpu_vendor (ctl->ebx, ctl->ecx, ctl->edx, gcv_guest); -if (is_hvm_domain (d) && (d->arch.x86_vendor != old_vendor) ) +if (is_hvm_domain (d) && (p->x86_vendor != old_vendor) ) {struct vcpu *v;@@ -95,7 +94,7 @@ static void update_domain_cpuid_info(struct domain *d, }case 1 : - d->arch.x86 =get_cpu_family (ctl->eax, &d->arch.x86_model,NULL ); + p->x86_family =get_cpu_family (ctl->eax, &p->x86_model,NULL );
Quoted 7 lines
xen/arch/x86/domctl.c static void update_domain_cpuid_info(struct domain *d, · line 100
Quoted 2 lines
xen/arch/x86/domctl.c +0
-0if (is_pv_domain (d) && ((levelling_caps & LCAP_1cd) == LCAP_1cd) ) {Considering that the three fields can be calculated from other CPUID data, is it really worthwhile to store these redundant pieces of information, instead of having consumers simply call get_cpu_{vendor,policy}()? All we "gain" by storing them is the risk of them going out of sync.
x86_model isn't actually used anywhere. x86_family is only used in hvm_select_ioreq_server() when handling AMD extended config space.
x86_family however is used quite a lot (all paths into x86_emulate(), and the IOREQ infrastructure underneath).
I did make get_cpu_vendor() quite a lot better than it was previously, but it is still searching a loop. For the extra 3 bytes of data, I still think pre-calculating the values is worth it.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 12.01.17 at 15:02, <[email protected]> wrote:
I did make
get_cpu_vendor()quite a lot better than it was previously, but it is still searching a loop. For the extra 3 bytes of data, I still think pre-calculating the values is worth it.
Well, as said, the question isn't the extra amount of data, but the redundancy (and hence risk of going out of sync). Could we meet in the middle and agree on just caching vendor, but not the other two items?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 8 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 12.01.17 at 15:02, <[email protected]> wrote:
I did make
get_cpu_vendor()quite a lot better than it was previously, but it is still searching a loop. For the extra 3 bytes of data, I still think pre-calculating the values is worth it.Well, as said, the question isn't the extra amount of data, but the redundancy (and hence risk of going out of sync). Could we meet in the middle and agree on just caching vendor, but not the other two items?
I was considering that. Family is only used when writing to cf8, and is far less overhead to recalculate than vendor, as it is straight arithmetic on a uint32_t.
I will split the patch in two and go down this route.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel