Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-10 Thread Peter Zijlstra
/me reminds you of 78 char text wrap. On Wed, Jul 09, 2014 at 07:32:09PM +, Liang, Kan wrote: > > Sure; but what I meant was, check_msr() is broken when ran on such a > > kernel. You need to fix check_msr() to return failure on these 'ignored' > > MSRs, after all they don't function as

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-10 Thread Peter Zijlstra
/me reminds you of 78 char text wrap. On Wed, Jul 09, 2014 at 07:32:09PM +, Liang, Kan wrote: Sure; but what I meant was, check_msr() is broken when ran on such a kernel. You need to fix check_msr() to return failure on these 'ignored' MSRs, after all they don't function as expected,

RE: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Liang, Kan
> > > > > > On Wed, Jul 09, 2014 at 02:32:28PM +, Liang, Kan wrote: > > > > > > > > > > > > > On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: > > > > > > +/* > > > > > > + * Under certain circumstances, access certain MSR may cause #GP. > > > > > > + * The function tests

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
ger.kernel.org; k...@vger.kernel.org > > Subject: Re: [PATCH V4 1/2] perf ignore LBR and extra_regs. > > > > On Wed, Jul 09, 2014 at 02:32:28PM +, Liang, Kan wrote: > > > > > > > > > > On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wr

RE: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Liang, Kan
> -Original Message- > From: Peter Zijlstra [mailto:pet...@infradead.org] > Sent: Wednesday, July 09, 2014 10:58 AM > To: Liang, Kan > Cc: a...@firstfloor.org; linux-kernel@vger.kernel.org; k...@vger.kernel.org > Subject: Re: [PATCH V4 1/2] perf ignore LBR and extra

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Wed, Jul 09, 2014 at 02:32:28PM +, Liang, Kan wrote: > > > > On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: > > > +/* > > > + * Under certain circumstances, access certain MSR may cause #GP. > > > + * The function tests if the input MSR can be safely accessed. > > >

RE: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Liang, Kan
> On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: > > +/* > > + * Under certain circumstances, access certain MSR may cause #GP. > > + * The function tests if the input MSR can be safely accessed. > > + */ > > +static inline bool check_msr(unsigned long msr) { > > + u64

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: > +/* > + * Under certain circumstances, access certain MSR may cause #GP. > + * The function tests if the input MSR can be safely accessed. > + */ > +static inline bool check_msr(unsigned long msr) > +{ > + u64 value; > + >

RE: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Liang, Kan
> > On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: > > --- a/arch/x86/kernel/cpu/perf_event.h > > +++ b/arch/x86/kernel/cpu/perf_event.h > > @@ -464,6 +464,12 @@ struct x86_pmu { > > */ > > struct extra_reg *extra_regs; > > unsigned int er_flags; > > + /* > >

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: > --- a/arch/x86/kernel/cpu/perf_event.h > +++ b/arch/x86/kernel/cpu/perf_event.h > @@ -464,6 +464,12 @@ struct x86_pmu { >*/ > struct extra_reg *extra_regs; > unsigned int er_flags; > + /* > + *

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: > + /* > + * Access LBR MSR may cause #GP under certain circumstances. > + * E.g. KVM doesn't support LBR MSR > + * Check all LBT MSR here. > + * Disable LBR access if any LBR MSRs can not be accessed. > +

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: > diff --git a/arch/x86/kernel/cpu/perf_event.c > b/arch/x86/kernel/cpu/perf_event.c > index 2bdfbff..f0e8022 100644 > --- a/arch/x86/kernel/cpu/perf_event.c > +++ b/arch/x86/kernel/cpu/perf_event.c > @@ -118,6 +118,9 @@ static

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: > diff --git a/arch/x86/kernel/cpu/perf_event.c > b/arch/x86/kernel/cpu/perf_event.c > index 2bdfbff..f0e8022 100644 > --- a/arch/x86/kernel/cpu/perf_event.c > +++ b/arch/x86/kernel/cpu/perf_event.c > @@ -118,6 +118,9 @@ static

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 2bdfbff..f0e8022 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -118,6 +118,9 @@ static int

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 2bdfbff..f0e8022 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -118,6 +118,9 @@ static int

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: + /* + * Access LBR MSR may cause #GP under certain circumstances. + * E.g. KVM doesn't support LBR MSR + * Check all LBT MSR here. + * Disable LBR access if any LBR MSRs can not be accessed. +

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h @@ -464,6 +464,12 @@ struct x86_pmu { */ struct extra_reg *extra_regs; unsigned int er_flags; + /* + * EXTRA REG

RE: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Liang, Kan
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h @@ -464,6 +464,12 @@ struct x86_pmu { */ struct extra_reg *extra_regs; unsigned int er_flags; + /* +* EXTRA REG

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: +/* + * Under certain circumstances, access certain MSR may cause #GP. + * The function tests if the input MSR can be safely accessed. + */ +static inline bool check_msr(unsigned long msr) +{ + u64 value; + + if

RE: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Liang, Kan
On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: +/* + * Under certain circumstances, access certain MSR may cause #GP. + * The function tests if the input MSR can be safely accessed. + */ +static inline bool check_msr(unsigned long msr) { + u64 value; + +

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
On Wed, Jul 09, 2014 at 02:32:28PM +, Liang, Kan wrote: On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: +/* + * Under certain circumstances, access certain MSR may cause #GP. + * The function tests if the input MSR can be safely accessed. + */ +static

RE: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Liang, Kan
-Original Message- From: Peter Zijlstra [mailto:pet...@infradead.org] Sent: Wednesday, July 09, 2014 10:58 AM To: Liang, Kan Cc: a...@firstfloor.org; linux-kernel@vger.kernel.org; k...@vger.kernel.org Subject: Re: [PATCH V4 1/2] perf ignore LBR and extra_regs. On Wed, Jul 09

Re: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Peter Zijlstra
: [PATCH V4 1/2] perf ignore LBR and extra_regs. On Wed, Jul 09, 2014 at 02:32:28PM +, Liang, Kan wrote: On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: +/* + * Under certain circumstances, access certain MSR may cause #GP. + * The function tests

RE: [PATCH V4 1/2] perf ignore LBR and extra_regs.

2014-07-09 Thread Liang, Kan
On Wed, Jul 09, 2014 at 02:32:28PM +, Liang, Kan wrote: On Tue, Jul 08, 2014 at 09:49:40AM -0700, kan.li...@intel.com wrote: +/* + * Under certain circumstances, access certain MSR may cause #GP. + * The function tests if the input MSR can be safely