Re: [PATCH] x86/perf: Fix virtualization sanity check

2012-10-10 Thread Konrad Rzeszutek Wilk
On Wed, Oct 10, 2012 at 12:32:50AM +0200, Andre Przywara wrote: > On 10/09/2012 05:51 PM, Konrad Rzeszutek Wilk wrote: > >On Tue, Oct 09, 2012 at 05:38:34PM +0200, Andre Przywara wrote: > >>In check_hw_exists() we try to detect non-emulated MSR accesses > >>by writing an arbitrary value into one

Re: [PATCH] x86/perf: Fix virtualization sanity check

2012-10-10 Thread Konrad Rzeszutek Wilk
On Wed, Oct 10, 2012 at 12:32:50AM +0200, Andre Przywara wrote: On 10/09/2012 05:51 PM, Konrad Rzeszutek Wilk wrote: On Tue, Oct 09, 2012 at 05:38:34PM +0200, Andre Przywara wrote: In check_hw_exists() we try to detect non-emulated MSR accesses by writing an arbitrary value into one of the PMU

Re: [PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Andre Przywara
On 10/09/2012 05:51 PM, Konrad Rzeszutek Wilk wrote: On Tue, Oct 09, 2012 at 05:38:34PM +0200, Andre Przywara wrote: In check_hw_exists() we try to detect non-emulated MSR accesses by writing an arbitrary value into one of the PMU registers and check if it's value after a readout is still the

Re: [PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Konrad Rzeszutek Wilk
On Tue, Oct 09, 2012 at 05:38:34PM +0200, Andre Przywara wrote: > In check_hw_exists() we try to detect non-emulated MSR accesses > by writing an arbitrary value into one of the PMU registers > and check if it's value after a readout is still the same. > This algorithm silently assumes that the

Re: [PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Peter Zijlstra
On Tue, 2012-10-09 at 17:38 +0200, Andre Przywara wrote: > First you need an AMD family 10h/12h CPU. These do not reset the > PERF_CTR registers on a reboot. > Now you boot bare metal Linux, which goes successfully through this > check, but leaves the magic value of 0xabcd in the register. You >

[PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Andre Przywara
In check_hw_exists() we try to detect non-emulated MSR accesses by writing an arbitrary value into one of the PMU registers and check if it's value after a readout is still the same. This algorithm silently assumes that the register does not contain the magic value already, which is wrong in at

[PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Andre Przywara
In check_hw_exists() we try to detect non-emulated MSR accesses by writing an arbitrary value into one of the PMU registers and check if it's value after a readout is still the same. This algorithm silently assumes that the register does not contain the magic value already, which is wrong in at

[PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Andre Przywara
In check_hw_exists() we try to detect non-emulated MSR accesses by writing an arbitrary value into one of the PMU registers and check if it's value after a readout is still the same. This algorithm silently assumes that the register does not contain the magic value already, which is wrong in at

[PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Andre Przywara
In check_hw_exists() we try to detect non-emulated MSR accesses by writing an arbitrary value into one of the PMU registers and check if it's value after a readout is still the same. This algorithm silently assumes that the register does not contain the magic value already, which is wrong in at

Re: [PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Peter Zijlstra
On Tue, 2012-10-09 at 17:38 +0200, Andre Przywara wrote: First you need an AMD family 10h/12h CPU. These do not reset the PERF_CTR registers on a reboot. Now you boot bare metal Linux, which goes successfully through this check, but leaves the magic value of 0xabcd in the register. You don't

Re: [PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Konrad Rzeszutek Wilk
On Tue, Oct 09, 2012 at 05:38:34PM +0200, Andre Przywara wrote: In check_hw_exists() we try to detect non-emulated MSR accesses by writing an arbitrary value into one of the PMU registers and check if it's value after a readout is still the same. This algorithm silently assumes that the

Re: [PATCH] x86/perf: Fix virtualization sanity check

2012-10-09 Thread Andre Przywara
On 10/09/2012 05:51 PM, Konrad Rzeszutek Wilk wrote: On Tue, Oct 09, 2012 at 05:38:34PM +0200, Andre Przywara wrote: In check_hw_exists() we try to detect non-emulated MSR accesses by writing an arbitrary value into one of the PMU registers and check if it's value after a readout is still the