All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing
@ 2016-12-09  3:17 Luwei Kang
  2016-12-09  9:43 ` Jan Beulich
  2016-12-09 14:45 ` Boris Ostrovsky
  0 siblings, 2 replies; 8+ messages in thread
From: Luwei Kang @ 2016-12-09  3:17 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, kevin.tian, Luwei Kang, jun.nakajima, jbeulich

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.

Signed-off-by: Luwei Kang <luwei.kang@intel.com>
---
 xen/arch/x86/cpu/vpmu_intel.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index e8049ed..0be78ff 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -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 +
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing
  2016-12-09  3:17 [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing Luwei Kang
@ 2016-12-09  9:43 ` Jan Beulich
  2016-12-13  5:16   ` Tian, Kevin
  2016-12-09 14:45 ` Boris Ostrovsky
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2016-12-09  9:43 UTC (permalink / raw)
  To: Luwei Kang; +Cc: andrew.cooper3, kevin.tian, jun.nakajima, xen-devel

>>> On 09.12.16 at 04:17, <luwei.kang@intel.com> 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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing
  2016-12-09  3:17 [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing Luwei Kang
  2016-12-09  9:43 ` Jan Beulich
@ 2016-12-09 14:45 ` Boris Ostrovsky
  2016-12-12  6:51   ` Kang, Luwei
  1 sibling, 1 reply; 8+ messages in thread
From: Boris Ostrovsky @ 2016-12-09 14:45 UTC (permalink / raw)
  To: Luwei Kang, xen-devel; +Cc: andrew.cooper3, kevin.tian, jbeulich, jun.nakajima

On 12/08/2016 10:17 PM, Luwei Kang 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.
>
> Signed-off-by: Luwei Kang <luwei.kang@intel.com>
> ---
>  xen/arch/x86/cpu/vpmu_intel.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
> index e8049ed..0be78ff 100644
> --- a/xen/arch/x86/cpu/vpmu_intel.c
> +++ b/xen/arch/x86/cpu/vpmu_intel.c
> @@ -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);
> +
> +    }
>

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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing
  2016-12-09 14:45 ` Boris Ostrovsky
@ 2016-12-12  6:51   ` Kang, Luwei
  2016-12-12  7:48     ` Jan Beulich
  0 siblings, 1 reply; 8+ messages in thread
From: Kang, Luwei @ 2016-12-12  6:51 UTC (permalink / raw)
  To: Boris Ostrovsky, xen-devel
  Cc: andrew.cooper3, Tian, Kevin, jbeulich, Nakajima, Jun

> On 12/08/2016 10:17 PM, Luwei Kang 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.
> >
> > Signed-off-by: Luwei Kang <luwei.kang@intel.com>
> > ---
> >  xen/arch/x86/cpu/vpmu_intel.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/xen/arch/x86/cpu/vpmu_intel.c
> > b/xen/arch/x86/cpu/vpmu_intel.c index e8049ed..0be78ff 100644
> > --- a/xen/arch/x86/cpu/vpmu_intel.c
> > +++ b/xen/arch/x86/cpu/vpmu_intel.c
> > @@ -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);
> > +
> > +    }
> >
> 
> 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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing
  2016-12-12  6:51   ` Kang, Luwei
@ 2016-12-12  7:48     ` Jan Beulich
  2016-12-12  8:06       ` Kang, Luwei
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2016-12-12  7:48 UTC (permalink / raw)
  To: Luwei Kang
  Cc: andrew.cooper3, Kevin Tian, Boris Ostrovsky, Jun Nakajima, xen-devel

>>> On 12.12.16 at 07:51, <luwei.kang@intel.com> wrote:
> 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?

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

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing
  2016-12-12  7:48     ` Jan Beulich
@ 2016-12-12  8:06       ` Kang, Luwei
  2016-12-12  8:15         ` Jan Beulich
  0 siblings, 1 reply; 8+ messages in thread
From: Kang, Luwei @ 2016-12-12  8:06 UTC (permalink / raw)
  To: Jan Beulich
  Cc: andrew.cooper3, Tian, Kevin, Boris Ostrovsky, Nakajima, Jun, xen-devel

> >>> On 12.12.16 at 07:51, <luwei.kang@intel.com> wrote:
> > 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?
> 
> 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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing
  2016-12-12  8:06       ` Kang, Luwei
@ 2016-12-12  8:15         ` Jan Beulich
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2016-12-12  8:15 UTC (permalink / raw)
  To: Luwei Kang
  Cc: andrew.cooper3, Kevin Tian, Boris Ostrovsky, Jun Nakajima, xen-devel

>>> On 12.12.16 at 09:06, <luwei.kang@intel.com> wrote:
>> >>> On 12.12.16 at 07:51, <luwei.kang@intel.com> wrote:
>> > 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?
>> 
>> 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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing
  2016-12-09  9:43 ` Jan Beulich
@ 2016-12-13  5:16   ` Tian, Kevin
  0 siblings, 0 replies; 8+ messages in thread
From: Tian, Kevin @ 2016-12-13  5:16 UTC (permalink / raw)
  To: Jan Beulich, Kang, Luwei; +Cc: andrew.cooper3, Nakajima, Jun, xen-devel

> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Friday, December 09, 2016 5:43 PM
ing
> 
> >>> On 09.12.16 at 04:17, <luwei.kang@intel.com> 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.
> 

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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-12-13  5:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-09  3:17 [PATCH] X86/VPMU: mask off uncore overflow bit on xeon phi knights landing Luwei Kang
2016-12-09  9:43 ` Jan Beulich
2016-12-13  5:16   ` Tian, Kevin
2016-12-09 14:45 ` Boris Ostrovsky
2016-12-12  6:51   ` Kang, Luwei
2016-12-12  7:48     ` Jan Beulich
2016-12-12  8:06       ` Kang, Luwei
2016-12-12  8:15         ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.