Re: [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag

2015-02-24 Thread David Ahern
On 2/24/15 4:31 AM, Adrian Hunter wrote: How about this: From: Adrian Hunter Date: Tue, 24 Feb 2015 13:20:59 +0200 Subject: [PATCH] perf tools: Fix probing for PERF_FLAG_FD_CLOEXEC flag Commit f6edb53c4993ffe92ce521fb449d1c146cea6ec2 converted the probe to a CPU wide event first (pid == -1). F

Re: [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag

2015-02-24 Thread Adrian Hunter
On 19/02/15 19:28, Adrian Hunter wrote: > On 19/02/2015 6:22 p.m., David Ahern wrote: >> On 2/19/15 9:17 AM, Adrian Hunter wrote: >>> Yes, I am sorry it is a pain. I don't know why I didn't add a comment >>> to the code :-(. Using -1 for the pid is a workaround to avoid gratuitous >>> jump label ch

Re: [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag

2015-02-19 Thread Adrian Hunter
On 19/02/2015 6:22 p.m., David Ahern wrote: On 2/19/15 9:17 AM, Adrian Hunter wrote: Yes, I am sorry it is a pain. I don't know why I didn't add a comment to the code :-(. Using -1 for the pid is a workaround to avoid gratuitous jump label changes. If pid=0 is used and then a system-wide trace i

Re: [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag

2015-02-19 Thread David Ahern
On 2/19/15 9:17 AM, Adrian Hunter wrote: Yes, I am sorry it is a pain. I don't know why I didn't add a comment to the code :-(. Using -1 for the pid is a workaround to avoid gratuitous jump label changes. If pid=0 is used and then a system-wide trace is done with Intel PT, there will be a jump la

Re: [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag

2015-02-19 Thread Adrian Hunter
On 19/02/2015 4:55 p.m., David Ahern wrote: On 2/19/15 12:06 AM, Adrian Hunter wrote: /* not supported, confirm error related to PERF_FLAG_FD_CLOEXEC */ -fd = sys_perf_event_open(&attr, pid, cpu, -1, 0); +fd = sys_perf_event_open(&attr, 0, cpu, -1, 0); I would prefer to avoid pid

Re: [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag

2015-02-19 Thread David Ahern
On 2/19/15 12:06 AM, Adrian Hunter wrote: /* not supported, confirm error related to PERF_FLAG_FD_CLOEXEC */ - fd = sys_perf_event_open(&attr, pid, cpu, -1, 0); + fd = sys_perf_event_open(&attr, 0, cpu, -1, 0); I would prefer to avoid pid = 0 unless necessary and so just do

Re: [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag

2015-02-18 Thread Adrian Hunter
On 19/02/15 02:01, David Ahern wrote: > Commit f6edb53c4993ffe92ce521fb449d1c146cea6ec2 converted the probe to > a CPU wide event first (pid == -1). For kernels that do not support > the PERF_FLAG_FD_CLOEXEC flag the probe fails with EINVAL. Since this > errno is not handled pid is not reset to 0 a

[PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag

2015-02-18 Thread David Ahern
Commit f6edb53c4993ffe92ce521fb449d1c146cea6ec2 converted the probe to a CPU wide event first (pid == -1). For kernels that do not support the PERF_FLAG_FD_CLOEXEC flag the probe fails with EINVAL. Since this errno is not handled pid is not reset to 0 and the subsequent use of pid = -1 as an argume