Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Borislav Petkov
On Wed, Apr 23, 2014 at 05:44:30PM +0200, Stephane Eranian wrote: > A comment describing return values where rdmsrl_safe() is defined > would maybe help avoid problems in the future. If it helps, sure. But please as a separate patch and to x86 guys. -- Regards/Gruss, Boris. Sent from a fat

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Borislav Petkov
On Wed, Apr 23, 2014 at 05:14:33PM +0200, Stephane Eranian wrote: > Wouldn't rdmsrl_safe() return 0 on success? Yes. -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Wed, Apr 23, 2014 at 5:35 PM, Borislav Petkov wrote: > On Wed, Apr 23, 2014 at 05:18:29PM +0200, Stephane Eranian wrote: >> On Wed, Apr 23, 2014 at 5:16 PM, Borislav Petkov wrote: >> > On Wed, Apr 23, 2014 at 05:14:33PM +0200, Stephane Eranian wrote: >> >> Wouldn't rdmsrl_safe() return 0 on

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Borislav Petkov
On Wed, Apr 23, 2014 at 05:18:29PM +0200, Stephane Eranian wrote: > On Wed, Apr 23, 2014 at 5:16 PM, Borislav Petkov wrote: > > On Wed, Apr 23, 2014 at 05:14:33PM +0200, Stephane Eranian wrote: > >> Wouldn't rdmsrl_safe() return 0 on success? > > > > Yes. > > > then the if() test is wrong: > if

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Wed, Apr 23, 2014 at 5:16 PM, Borislav Petkov wrote: > On Wed, Apr 23, 2014 at 05:14:33PM +0200, Stephane Eranian wrote: >> Wouldn't rdmsrl_safe() return 0 on success? > > Yes. > then the if() test is wrong: if (!rdmsrl_safe()) return -1; Should be: if (rdmsrl_safe()) return -1; Or am I

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Wed, Apr 23, 2014 at 5:09 PM, Peter Zijlstra wrote: > On Wed, Apr 23, 2014 at 04:49:55PM +0200, Stephane Eranian wrote: >> On your machine, booted with 3.15-rc2, do you have /sys/devices/power? >> If not, and you have at least an SNB, you should have RAPL and that >> RAPL_UNIT MSR. >> >> Proof

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Peter Zijlstra
On Wed, Apr 23, 2014 at 04:49:55PM +0200, Stephane Eranian wrote: > On your machine, booted with 3.15-rc2, do you have /sys/devices/power? > If not, and you have at least an SNB, you should have RAPL and that > RAPL_UNIT MSR. > > Proof is that if you read that MSR using /dev/cpu/msr it works just

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Wed, Apr 23, 2014 at 4:45 PM, Peter Zijlstra wrote: > On Wed, Apr 23, 2014 at 04:31:32PM +0200, Stephane Eranian wrote: >> On Thu, Mar 13, 2014 at 8:36 PM, Venkatesh Srinivas >> wrote: >> > CPUs which should support the RAPL counters according to >> > Family/Model/Stepping may still issue #GP

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Peter Zijlstra
On Wed, Apr 23, 2014 at 04:31:32PM +0200, Stephane Eranian wrote: > On Thu, Mar 13, 2014 at 8:36 PM, Venkatesh Srinivas > wrote: > > CPUs which should support the RAPL counters according to > > Family/Model/Stepping may still issue #GP when attempting to access > > the RAPL MSRs. This may happen

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Thu, Mar 13, 2014 at 8:36 PM, Venkatesh Srinivas wrote: > CPUs which should support the RAPL counters according to > Family/Model/Stepping may still issue #GP when attempting to access > the RAPL MSRs. This may happen when Linux is running under KVM and > we are passing-through host F/M/S

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Thu, Mar 13, 2014 at 8:36 PM, Venkatesh Srinivas venkate...@google.com wrote: CPUs which should support the RAPL counters according to Family/Model/Stepping may still issue #GP when attempting to access the RAPL MSRs. This may happen when Linux is running under KVM and we are

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Peter Zijlstra
On Wed, Apr 23, 2014 at 04:31:32PM +0200, Stephane Eranian wrote: On Thu, Mar 13, 2014 at 8:36 PM, Venkatesh Srinivas venkate...@google.com wrote: CPUs which should support the RAPL counters according to Family/Model/Stepping may still issue #GP when attempting to access the RAPL MSRs.

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Wed, Apr 23, 2014 at 4:45 PM, Peter Zijlstra pet...@infradead.org wrote: On Wed, Apr 23, 2014 at 04:31:32PM +0200, Stephane Eranian wrote: On Thu, Mar 13, 2014 at 8:36 PM, Venkatesh Srinivas venkate...@google.com wrote: CPUs which should support the RAPL counters according to

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Peter Zijlstra
On Wed, Apr 23, 2014 at 04:49:55PM +0200, Stephane Eranian wrote: On your machine, booted with 3.15-rc2, do you have /sys/devices/power? If not, and you have at least an SNB, you should have RAPL and that RAPL_UNIT MSR. Proof is that if you read that MSR using /dev/cpu/msr it works just

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Wed, Apr 23, 2014 at 5:09 PM, Peter Zijlstra pet...@infradead.org wrote: On Wed, Apr 23, 2014 at 04:49:55PM +0200, Stephane Eranian wrote: On your machine, booted with 3.15-rc2, do you have /sys/devices/power? If not, and you have at least an SNB, you should have RAPL and that RAPL_UNIT

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Wed, Apr 23, 2014 at 5:16 PM, Borislav Petkov b...@alien8.de wrote: On Wed, Apr 23, 2014 at 05:14:33PM +0200, Stephane Eranian wrote: Wouldn't rdmsrl_safe() return 0 on success? Yes. then the if() test is wrong: if (!rdmsrl_safe()) return -1; Should be: if (rdmsrl_safe()) return -1;

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Borislav Petkov
On Wed, Apr 23, 2014 at 05:18:29PM +0200, Stephane Eranian wrote: On Wed, Apr 23, 2014 at 5:16 PM, Borislav Petkov b...@alien8.de wrote: On Wed, Apr 23, 2014 at 05:14:33PM +0200, Stephane Eranian wrote: Wouldn't rdmsrl_safe() return 0 on success? Yes. then the if() test is wrong: if

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Stephane Eranian
On Wed, Apr 23, 2014 at 5:35 PM, Borislav Petkov b...@alien8.de wrote: On Wed, Apr 23, 2014 at 05:18:29PM +0200, Stephane Eranian wrote: On Wed, Apr 23, 2014 at 5:16 PM, Borislav Petkov b...@alien8.de wrote: On Wed, Apr 23, 2014 at 05:14:33PM +0200, Stephane Eranian wrote: Wouldn't

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Borislav Petkov
On Wed, Apr 23, 2014 at 05:14:33PM +0200, Stephane Eranian wrote: Wouldn't rdmsrl_safe() return 0 on success? Yes. -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-04-23 Thread Borislav Petkov
On Wed, Apr 23, 2014 at 05:44:30PM +0200, Stephane Eranian wrote: A comment describing return values where rdmsrl_safe() is defined would maybe help avoid problems in the future. If it helps, sure. But please as a separate patch and to x86 guys. -- Regards/Gruss, Boris. Sent from a fat

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Venkatesh Srinivas
On Fri, Mar 14, 2014 at 10:57:58AM -0600, David Ahern wrote: On 3/14/14, 10:17 AM, Andi Kleen wrote: The Intel ISR section for RDMSR seems to say: "Specifying a reserved or unimplemented MSR address in ECX will also cause a general protection exception". From a guest's perspective,

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread David Ahern
On 3/14/14, 10:17 AM, Andi Kleen wrote: The Intel ISR section for RDMSR seems to say: "Specifying a reserved or unimplemented MSR address in ECX will also cause a general protection exception". From a guest's perspective, MSR_RAPL_POWER_UNIT is unimplemented; kvm matches this behavior. MSRs

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Andi Kleen
> The Intel ISR section for RDMSR seems to say: "Specifying a reserved > or unimplemented > MSR address in ECX will also cause a general protection exception". > > From a guest's perspective, MSR_RAPL_POWER_UNIT is unimplemented; kvm matches > this behavior. MSRs are model specific and defined

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Venkatesh Srinivas
On Fri, Mar 14, 2014 at 6:56 AM, Andi Kleen wrote: > On Fri, Mar 14, 2014 at 09:44:29AM +0100, Peter Zijlstra wrote: >> On Thu, Mar 13, 2014 at 12:36:26PM -0700, Venkatesh Srinivas wrote: >> > CPUs which should support the RAPL counters according to >> > Family/Model/Stepping may still issue #GP

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Andi Kleen
On Fri, Mar 14, 2014 at 09:44:29AM +0100, Peter Zijlstra wrote: > On Thu, Mar 13, 2014 at 12:36:26PM -0700, Venkatesh Srinivas wrote: > > CPUs which should support the RAPL counters according to > > Family/Model/Stepping may still issue #GP when attempting to access > > the RAPL MSRs. This may

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Peter Zijlstra
On Thu, Mar 13, 2014 at 12:36:26PM -0700, Venkatesh Srinivas wrote: > CPUs which should support the RAPL counters according to > Family/Model/Stepping may still issue #GP when attempting to access > the RAPL MSRs. This may happen when Linux is running under KVM and > we are passing-through host

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Peter Zijlstra
On Thu, Mar 13, 2014 at 12:36:26PM -0700, Venkatesh Srinivas wrote: CPUs which should support the RAPL counters according to Family/Model/Stepping may still issue #GP when attempting to access the RAPL MSRs. This may happen when Linux is running under KVM and we are passing-through host F/M/S

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Andi Kleen
On Fri, Mar 14, 2014 at 09:44:29AM +0100, Peter Zijlstra wrote: On Thu, Mar 13, 2014 at 12:36:26PM -0700, Venkatesh Srinivas wrote: CPUs which should support the RAPL counters according to Family/Model/Stepping may still issue #GP when attempting to access the RAPL MSRs. This may happen

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Venkatesh Srinivas
On Fri, Mar 14, 2014 at 6:56 AM, Andi Kleen a...@linux.intel.com wrote: On Fri, Mar 14, 2014 at 09:44:29AM +0100, Peter Zijlstra wrote: On Thu, Mar 13, 2014 at 12:36:26PM -0700, Venkatesh Srinivas wrote: CPUs which should support the RAPL counters according to Family/Model/Stepping may still

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Andi Kleen
The Intel ISR section for RDMSR seems to say: Specifying a reserved or unimplemented MSR address in ECX will also cause a general protection exception. From a guest's perspective, MSR_RAPL_POWER_UNIT is unimplemented; kvm matches this behavior. MSRs are model specific and defined per model

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread David Ahern
On 3/14/14, 10:17 AM, Andi Kleen wrote: The Intel ISR section for RDMSR seems to say: Specifying a reserved or unimplemented MSR address in ECX will also cause a general protection exception. From a guest's perspective, MSR_RAPL_POWER_UNIT is unimplemented; kvm matches this behavior. MSRs

Re: [PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-14 Thread Venkatesh Srinivas
On Fri, Mar 14, 2014 at 10:57:58AM -0600, David Ahern wrote: On 3/14/14, 10:17 AM, Andi Kleen wrote: The Intel ISR section for RDMSR seems to say: Specifying a reserved or unimplemented MSR address in ECX will also cause a general protection exception. From a guest's perspective,

[PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-13 Thread Venkatesh Srinivas
CPUs which should support the RAPL counters according to Family/Model/Stepping may still issue #GP when attempting to access the RAPL MSRs. This may happen when Linux is running under KVM and we are passing-through host F/M/S data, for example. Use rdmsrl_safe to first access the RAPL_POWER_UNIT

[PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-13 Thread Venkatesh Srinivas
CPUs which should support the RAPL counters according to Family/Model/Stepping may still issue #GP when attempting to access the RAPL MSRs. This may happen when Linux is running under KVM and we are passing-through host F/M/S data, for example. Use rdmsrl_safe to first access the RAPL_POWER_UNIT

[PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-06 Thread Venkatesh Srinivas
CPUs which should support the RAPL counters according to Family/Model/Stepping may still issue #GP when attempting to access the RAPL MSRs. This may happen when Linux is running under KVM and we are passing-through host F/M/S data, for example. Use rdmsrl_safe to first access the RAPL_POWER_UNIT

[PATCH] perf/x86/intel: Use rdmsrl_safe when initializing RAPL PMU.

2014-03-06 Thread Venkatesh Srinivas
CPUs which should support the RAPL counters according to Family/Model/Stepping may still issue #GP when attempting to access the RAPL MSRs. This may happen when Linux is running under KVM and we are passing-through host F/M/S data, for example. Use rdmsrl_safe to first access the RAPL_POWER_UNIT