Re: [PATCH] perf tools: fix guest mode monitoring on AMD

From: Stephane Eranian
Date: Mon Feb 27 2012 - 12:52:25 EST


On Mon, Feb 27, 2012 at 6:47 PM, David Ahern <dsahern@xxxxxxxxx> wrote:
> On 2/27/12 10:33 AM, Stephane Eranian wrote:
>>
>> Commit:
>>
>> 1aed267 perf kvm: Do guest-only counting by default
>>
>> introduced a bug on AMD systems whereby simple commands:
>>
>> $ perf stat ls
>> Performance counter stats for 'ls':
>>         Â0 cycles          Â#  Â0.000 GHz
>> Â Â Â Â0.003704596 seconds time elapsed
>>
>> would not count anything anymore. Same results for perf record.
>>
>> I tracked it down to guest mode exclusion being enabled
>> by default leading to attr->exclude_guest = 1. When
>> not operating under any sort of virtualization, this
>> causes the PMU not to count anything.
>>
>> The fix disables guest exclusion by default.
>>
>> Signed-off-by: Stephane Eranian<eranian@xxxxxxxxxx>
>> ---
>>
>> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
>> index 8109a90..c1017b3 100644
>> --- a/tools/perf/util/util.c
>> +++ b/tools/perf/util/util.c
>> @@ -6,7 +6,7 @@
>> Â * XXX We need to find a better place for these things...
>> Â */
>> Âbool perf_host Â= true;
>> -bool perf_guest = false;
>> +bool perf_guest = true;
>
>
> This was recently reverted to false by
> c4a7dca92bbb9881a5d678720f1d0c2153499749
>
> See: https://lkml.org/lkml/2012/2/8/234
>
Yeah, but that causes simple commands such as "perf stat -e cycles ls"
to return 0 count.

So either you get a segfault or you get zero count. There is something
else going on here...



> David
>
>>
>> Âvoid event_attr_init(struct perf_event_attr *attr)
>> Â{
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at Âhttp://www.tux.org/lkml/
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/