2012-05-03 14:26:40

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH 07/13] perf evlist: Fix creation of cpu map

Em Fri, Apr 27, 2012 at 09:16:18AM +0900, Namhyung Kim escreveu:
> On Thu, 26 Apr 2012 15:22:55 -0600, David Ahern wrote:
> > On 4/26/12 3:12 PM, Namhyung Kim wrote:
> >> Hmm.. No, I can reproduce it without any of this series. And now I think
> >> that it is not related to the number of cpus. On my 4 core (no
> >> hyperthreading) machine at home, the result was same.
> >>
> >> BTW, did you change sysctl settings?
> >>
> >> $ cat /sys/devices/system/cpu/online
> >> 0-3
> >> $ grep . /proc/sys/kernel/perf_event_*
> >> /proc/sys/kernel/perf_event_max_sample_rate:100000
> >> /proc/sys/kernel/perf_event_mlock_kb:516
> >> /proc/sys/kernel/perf_event_paranoid:1
> >
> > $ grep . /proc/sys/kernel/perf_event_*
> > /proc/sys/kernel/perf_event_max_sample_rate:100000
> > /proc/sys/kernel/perf_event_mlock_kb:516
> > /proc/sys/kernel/perf_event_paranoid:-1
> >
> > That last one is the key. I have it set to not paranoid and usually
> > run perf a non-root user.
> >
>
> That's exactly what I want to see :). On perf_mmap() we have:
>
> if ((locked > lock_limit) && perf_paranoid_tracepoint_raw() &&
> !capable(CAP_IPC_LOCK)) {
> ret = -EPERM;
> goto unlock;
> }
>
> So as long as you set perf_event_paranoid to -1 or run perf test as
> root, you cannot see the failure.

Ok, as root try 'perf top', here I get, with this patch:

[root@sandy ~]# perf top --stdio
Warning:
The sys_perf_event_open() syscall returned with 22 (Invalid argument).
/bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?
[root@sandy ~]#

Skipping this one, will look again later.

- Arnaldo


2012-05-04 04:06:51

by Namhyung Kim

[permalink] [raw]
Subject: Re: [PATCH 07/13] perf evlist: Fix creation of cpu map

Hi,

On Wed, 2 May 2012 15:40:33 -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Apr 27, 2012 at 09:16:18AM +0900, Namhyung Kim escreveu:
>> So as long as you set perf_event_paranoid to -1 or run perf test as
>> root, you cannot see the failure.
>
> Ok, as root try 'perf top', here I get, with this patch:
>
> [root@sandy ~]# perf top --stdio
> Warning:
> The sys_perf_event_open() syscall returned with 22 (Invalid argument).
> /bin/dmesg may provide additional information.
> No CONFIG_PERF_EVENTS=y kernel support configured?
> [root@sandy ~]#
>
> Skipping this one, will look again later.
>
> - Arnaldo

Sorry. It is because perf top depends on an undefined behaviour that
if neither target nor command line argument was specified it'd open
events for all online cpus. In contrast, perf record and perf stat will
show the help message in this case.

This patch makes it clear that we have to prepare a sane target
configuration before opening a perf event fd. So I think we should fix
perf top to set top.target.system_wide to true by default.

Thanks,
Namhyung

2012-05-04 13:37:04

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH 07/13] perf evlist: Fix creation of cpu map

Em Fri, May 04, 2012 at 01:05:48PM +0900, Namhyung Kim escreveu:
> Hi,
>
> On Wed, 2 May 2012 15:40:33 -0300, Arnaldo Carvalho de Melo wrote:
> > Em Fri, Apr 27, 2012 at 09:16:18AM +0900, Namhyung Kim escreveu:
> >> So as long as you set perf_event_paranoid to -1 or run perf test as
> >> root, you cannot see the failure.
> >
> > Ok, as root try 'perf top', here I get, with this patch:
> >
> > [root@sandy ~]# perf top --stdio
> > Warning:
> > The sys_perf_event_open() syscall returned with 22 (Invalid argument).
> > /bin/dmesg may provide additional information.
> > No CONFIG_PERF_EVENTS=y kernel support configured?
> > [root@sandy ~]#
> >
> > Skipping this one, will look again later.
> >
> > - Arnaldo
>
> Sorry. It is because perf top depends on an undefined behaviour that
> if neither target nor command line argument was specified it'd open
> events for all online cpus. In contrast, perf record and perf stat will
> show the help message in this case.
>
> This patch makes it clear that we have to prepare a sane target
> configuration before opening a perf event fd. So I think we should fix
> perf top to set top.target.system_wide to true by default.

So please provide a preparatory patch for top before this one, ok?

- Arnaldo

2012-05-04 14:01:18

by Namhyung Kim

[permalink] [raw]
Subject: Re: [PATCH 07/13] perf evlist: Fix creation of cpu map

Hi,

On Fri, 4 May 2012 10:37:06 -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, May 04, 2012 at 01:05:48PM +0900, Namhyung Kim escreveu:
>> On Wed, 2 May 2012 15:40:33 -0300, Arnaldo Carvalho de Melo wrote:
>> > Em Fri, Apr 27, 2012 at 09:16:18AM +0900, Namhyung Kim escreveu:
>> >> So as long as you set perf_event_paranoid to -1 or run perf test as
>> >> root, you cannot see the failure.
>> >
>> > Ok, as root try 'perf top', here I get, with this patch:
>> >
>> > [root@sandy ~]# perf top --stdio
>> > Warning:
>> > The sys_perf_event_open() syscall returned with 22 (Invalid argument).
>> > /bin/dmesg may provide additional information.
>> > No CONFIG_PERF_EVENTS=y kernel support configured?
>> > [root@sandy ~]#
>> >
>> > Skipping this one, will look again later.
>> >
>> Sorry. It is because perf top depends on an undefined behaviour that
>> if neither target nor command line argument was specified it'd open
>> events for all online cpus. In contrast, perf record and perf stat will
>> show the help message in this case.
>>
>> This patch makes it clear that we have to prepare a sane target
>> configuration before opening a perf event fd. So I think we should fix
>> perf top to set top.target.system_wide to true by default.
>
> So please provide a preparatory patch for top before this one, ok?
>

Okay, will do.

Thanks,
Namhyung