Skip to contentSkip to conversation

X86/VPMU: mask off uncore overflow bit on xeon phi knights landing

PATCH In review Luwei Kang 4 participants 8 messages Dec 9, 2016 – Dec 13, 2016

lore
Share & tools
lore

Luwei Kang

author
#0 lore raw

PATCH 1/1 X86/VPMU: mask off uncore overflow bit on xeon phi knights landing

IA32_PERF_GLOBAL_STATUS.OvfUncore (MSR 38EH, bit[61]) is always 0 and writing 1 to IA32_PERF_GLOBAL_OVF_CTRL.ClrOvfUncore (MSR 390H, bit[61]) signals #GP.
Reference "Intel Xeon Phi Procssor x200 Product Family", document number 334646-008.

---
 xen/arch/x86/cpu/vpmu_intel.c | 6 ++++++
 1 file changed, 6 insertions(+)
xen/arch/x86/cpu/vpmu_intel.c +6 -0
index e8049ed..0be78ff 100644
@@ -1058,11 +1058,17 @@ int __init core2_vpmu_init(void)
                              (((1ULL << fixed_pmc_cnt) - 1) << 32) |
                              ((1ULL << arch_pmc_cnt) - 1));
     if ( version > 2 )
+    {
         /*
          * Even though we don't support Uncore counters guests should be
          * able to clear all available overflows.
          */
         global_ovf_ctrl_mask &= ~(1ULL << 61);
+        /* Knight Landing doesn't support overflow bit on uncore counters */
+        if ( current_cpu_data.x86_model == 0x57 )
+            global_ovf_ctrl_mask |= (1ULL << 61);
+
+    }
 
     regs_sz = (sizeof(struct xen_pmu_intel_ctxt) - regs_off) +
               sizeof(uint64_t) * fixed_pmc_cnt +
Signature · 7 lines
1.8.3.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 09.12.16 at 04:17, <[email protected]> wrote:

IA32_PERF_GLOBAL_STATUS.OvfUncore (MSR 38EH, bit[61]) is always 0 and writing 1 to IA32_PERF_GLOBAL_OVF_CTRL.ClrOvfUncore (MSR 390H, bit[61]) signals #GP.
Reference "Intel Xeon Phi Procssor x200 Product Family", document number 334646-008.

I can see this being a necessary workaround, but going over the other errata there are some of quite a bit higher importance to work around (KNL13) or at least check whether we're affected (KNL4, KNL8), if we really care about supporting Xen on this processor model. I'd appreciate other opinions namely from the people on Cc.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 2 lines

From: Jan Beulich [mailto:[email protected]]
Sent: Friday, December 09, 2016 5:43 PM

ing

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines · On 09.12.16 at 04:17, <[email protected]> wrote:

IA32_PERF_GLOBAL_STATUS.OvfUncore (MSR 38EH, bit[61]) is always 0 and writing 1 to IA32_PERF_GLOBAL_OVF_CTRL.ClrOvfUncore (MSR 390H, bit[61]) signals #GP.
Reference "Intel Xeon Phi Procssor x200 Product Family", document number 334646-008.

Quoted 7 lines

I can see this being a necessary workaround, but going over the other errata there are some of quite a bit higher importance to work around (KNL13) or at least check whether we're affected (KNL4, KNL8), if we really care about supporting Xen on this processor model. I'd appreciate other opinions namely from the people on Cc.

I haven't looked at above errata in detail. Luwei, can you plan them accordingly to make sure we have a good support here? If there's any technical issue on workaround, please just raise it up. :-)

Thanks
Kevin

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
In reply to Luwei Kang
Quoted 21 lines · Luwei Kang

IA32_PERF_GLOBAL_STATUS.OvfUncore (MSR 38EH, bit[61]) is always 0 and writing 1 to IA32_PERF_GLOBAL_OVF_CTRL.ClrOvfUncore (MSR 390H, bit[61]) signals #GP.
Reference "Intel Xeon Phi Procssor x200 Product Family", document number 334646-008.

---
 xen/arch/x86/cpu/vpmu_intel.c | 6 ++++++
 1 file changed, 6 insertions(+)
xen/arch/x86/cpu/vpmu_intel.c +1 -0
index e8049ed..0be78ff 100644
@@ -1058,11 +1058,17 @@ int __init core2_vpmu_init(void)
                              (((1ULL << fixed_pmc_cnt) - 1) << 32) |
                              ((1ULL << arch_pmc_cnt) - 1));
     if ( version > 2 )
+    {
         /*

xen/arch/x86/cpu/vpmu_intel.c int __init core2_vpmu_init(void) · line 1072

Quoted 10 lines
xen/arch/x86/cpu/vpmu_intel.c +5 -0
          * Even though we don't support Uncore counters guests should be
          * able to clear all available overflows.
          */
         global_ovf_ctrl_mask &= ~(1ULL << 61);
+        /* Knight Landing doesn't support overflow bit on uncore counters */
+        if ( current_cpu_data.x86_model == 0x57 )
+            global_ovf_ctrl_mask |= (1ULL << 61);
+
+    }
 

I think these types of model-specific changes (or errata) should be done in check_pmc_quirk(). And is_pmc_quirk (along with handle_pmc_quirk()) should be renamed to something more specific to that particular problem. Maybe pmc_underflow_quirk?

-boris

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 28 lines · Luwei Kang
Quoted 27 lines

IA32_PERF_GLOBAL_STATUS.OvfUncore (MSR 38EH, bit[61]) is always 0 and writing 1 to IA32_PERF_GLOBAL_OVF_CTRL.ClrOvfUncore (MSR 390H, bit[61]) signals #GP.
Reference "Intel Xeon Phi Procssor x200 Product Family", document number 334646-008.

---
 xen/arch/x86/cpu/vpmu_intel.c | 6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/xen/arch/x86/cpu/vpmu_intel.c index e8049ed..0be78ff 100644

xen/arch/x86/cpu/vpmu_intel.c +3 -0
@@ -1058,11 +1058,17 @@ int __init core2_vpmu_init(void)
                              (((1ULL << fixed_pmc_cnt) - 1) << 32) |
                              ((1ULL << arch_pmc_cnt) - 1));
     if ( version > 2 )
+    {
         /*
          * Even though we don't support Uncore counters guests should be
          * able to clear all available overflows.
          */
         global_ovf_ctrl_mask &= ~(1ULL << 61);
+        /* Knight Landing doesn't support overflow bit on uncore counters */
+        if ( current_cpu_data.x86_model == 0x57 )
Quoted 9 lines

xen/arch/x86/cpu/vpmu_intel.c int __init core2_vpmu_init(void) · line 1072

Quoted 4 lines
xen/arch/x86/cpu/vpmu_intel.c +3 -0
+            global_ovf_ctrl_mask |= (1ULL << 61);
+
+    }
 

I think these types of model-specific changes (or errata) should be done in check_pmc_quirk(). And is_pmc_quirk (along with handle_pmc_quirk()) should be renamed to something more specific to that particular problem.
Maybe pmc_underflow_quirk?

By the way, I think another place may need to do some modify as well.

@@ -868,7 +868,7 @@ static int core2_vpmu_do_interrupt(struct cpu_user_regs *regs)

         if ( is_pmc_quirk )
             handle_pmc_quirk(msr_content);
         core2_vpmu_cxt->global_status |= msr_content;
-        msr_content = ~global_ovf_ctrl_mask;
+        msr_content &= ~global_ovf_ctrl_mask;
         wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, msr_content);
     }

If one counter have overflow all the bit will be clean. I think it need add & with current status.

Hi jan and Andrew,
What is your opinion?

Thanks,
Luwei Kang

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 12.12.16 at 07:51, <[email protected]> wrote:

By the way, I think another place may need to do some modify as well.

(quoted diff) +1 -1
@@ -868,7 +868,7 @@ static int core2_vpmu_do_interrupt(struct cpu_user_regs *regs)
         if ( is_pmc_quirk )
             handle_pmc_quirk(msr_content);
         core2_vpmu_cxt->global_status |= msr_content;
-        msr_content = ~global_ovf_ctrl_mask;
+        msr_content &= ~global_ovf_ctrl_mask;
         wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, msr_content);
     }
 

If one counter have overflow all the bit will be clean. I think it need add & with current status.

Quoted 2 lines

Hi jan and Andrew,
What is your opinion?

I agree, but it looks to be an independent change.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
Quoted 12 lines
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 12.12.16 at 07:51, <[email protected]> wrote:

By the way, I think another place may need to do some modify as well.

(quoted diff) +1 -1
@@ -868,7 +868,7 @@ static int core2_vpmu_do_interrupt(struct cpu_user_regs *regs)
         if ( is_pmc_quirk )
             handle_pmc_quirk(msr_content);
         core2_vpmu_cxt->global_status |= msr_content;
-        msr_content = ~global_ovf_ctrl_mask;
+        msr_content &= ~global_ovf_ctrl_mask;
         wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, msr_content);
     }
 
Quoted 8 lines
Quoted 5 lines

If one counter have overflow all the bit will be clean. I think it need add & with current status.

Hi jan and Andrew,
What is your opinion?

I agree, but it looks to be an independent change.

Hi Jan,
Thanks for your reply. I will submit another patch regarding " msr_content &= ~global_ovf_ctrl_mask;" soon. What is your opinion about this patch? Need any modify?

Thanks,
Luwei Kang

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines · On 12.12.16 at 09:06, <[email protected]> wrote:
Quoted 1 line
Quoted 1 line · On 12.12.16 at 07:51, <[email protected]> wrote:

By the way, I think another place may need to do some modify as well.

(quoted diff) +1 -1
@@ -868,7 +868,7 @@ static int core2_vpmu_do_interrupt(struct cpu_user_regs *regs)
         if ( is_pmc_quirk )
             handle_pmc_quirk(msr_content);
         core2_vpmu_cxt->global_status |= msr_content;
-        msr_content = ~global_ovf_ctrl_mask;
+        msr_content &= ~global_ovf_ctrl_mask;
         wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, msr_content);
     }
 

If one counter have overflow all the bit will be clean. I think it need add & with current status.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Hi jan and Andrew,
What is your opinion?

I agree, but it looks to be an independent change.

Thanks for your reply. I will submit another patch regarding " msr_content &= ~global_ovf_ctrl_mask;" soon. What is your opinion about this patch? Need any modify?

"This" being which one? The one visible above, or the one at the root of this thread? For the one above I've already said "I agree", so I'm not sure what else you ask for. For the one at the root of this thread, I think Boris has pointed out what changes would be wanted.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel