* [PATCH] tools/perf: Fix return code for lock_contention_prepare
@ 2024-12-23 13:56 Athira Rajeev
2024-12-27 10:48 ` Athira Rajeev
2025-01-06 21:15 ` Namhyung Kim
0 siblings, 2 replies; 4+ messages in thread
From: Athira Rajeev @ 2024-12-23 13:56 UTC (permalink / raw)
To: acme, jolsa, adrian.hunter, irogers, namhyung
Cc: linux-kernel, linux-perf-users, linuxppc-dev, maddy, atrajeev,
kjain, disgoel
perf lock contention returns zero exit value even if the lock contention
BPF setup failed.
# ./perf lock con -b true
libbpf: kernel BTF is missing at '/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?
libbpf: failed to find '.BTF' ELF section in /lib/modules/6.13.0-rc3+/build/vmlinux
libbpf: failed to find valid kernel BTF
libbpf: kernel BTF is missing at '/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?
libbpf: failed to find '.BTF' ELF section in /lib/modules/6.13.0-rc3+/build/vmlinux
libbpf: failed to find valid kernel BTF
libbpf: Error loading vmlinux BTF: -ESRCH
libbpf: failed to load object 'lock_contention_bpf'
libbpf: failed to load BPF skeleton 'lock_contention_bpf': -ESRCH
Failed to load lock-contention BPF skeleton
lock contention BPF setup failed
# echo $?
0
Fix this by saving the return code for lock_contention_prepare
so that command exits with proper return code
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/builtin-lock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 208c482daa56..2226c7dd4ae6 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -2049,7 +2049,8 @@ static int __cmd_contention(int argc, const char **argv)
goto out_delete;
}
- if (lock_contention_prepare(&con) < 0) {
+ err = lock_contention_prepare(&con);
+ if (err < 0) {
pr_err("lock contention BPF setup failed\n");
goto out_delete;
}
--
2.43.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/perf: Fix return code for lock_contention_prepare
2024-12-23 13:56 [PATCH] tools/perf: Fix return code for lock_contention_prepare Athira Rajeev
@ 2024-12-27 10:48 ` Athira Rajeev
2025-01-06 21:15 ` Namhyung Kim
1 sibling, 0 replies; 4+ messages in thread
From: Athira Rajeev @ 2024-12-27 10:48 UTC (permalink / raw)
To: acme, jolsa, adrian.hunter, irogers, namhyung
Cc: linux-kernel, linux-perf-users, linuxppc-dev, maddy, kjain,
disgoel
> On 23 Dec 2024, at 7:26 PM, Athira Rajeev <atrajeev@linux.vnet.ibm.com> wrote:
>
> perf lock contention returns zero exit value even if the lock contention
> BPF setup failed.
>
> # ./perf lock con -b true
> libbpf: kernel BTF is missing at '/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?
> libbpf: failed to find '.BTF' ELF section in /lib/modules/6.13.0-rc3+/build/vmlinux
> libbpf: failed to find valid kernel BTF
> libbpf: kernel BTF is missing at '/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?
> libbpf: failed to find '.BTF' ELF section in /lib/modules/6.13.0-rc3+/build/vmlinux
> libbpf: failed to find valid kernel BTF
> libbpf: Error loading vmlinux BTF: -ESRCH
> libbpf: failed to load object 'lock_contention_bpf'
> libbpf: failed to load BPF skeleton 'lock_contention_bpf': -ESRCH
> Failed to load lock-contention BPF skeleton
> lock contention BPF setup failed
> # echo $?
> 0
>
> Fix this by saving the return code for lock_contention_prepare
> so that command exits with proper return code
>
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Hi,
Looking for review comments on this
Athira
> ---
> tools/perf/builtin-lock.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
> index 208c482daa56..2226c7dd4ae6 100644
> --- a/tools/perf/builtin-lock.c
> +++ b/tools/perf/builtin-lock.c
> @@ -2049,7 +2049,8 @@ static int __cmd_contention(int argc, const char **argv)
> goto out_delete;
> }
>
> - if (lock_contention_prepare(&con) < 0) {
> + err = lock_contention_prepare(&con);
> + if (err < 0) {
> pr_err("lock contention BPF setup failed\n");
> goto out_delete;
> }
> --
> 2.43.5
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/perf: Fix return code for lock_contention_prepare
2024-12-23 13:56 [PATCH] tools/perf: Fix return code for lock_contention_prepare Athira Rajeev
2024-12-27 10:48 ` Athira Rajeev
@ 2025-01-06 21:15 ` Namhyung Kim
2025-01-10 9:25 ` Athira Rajeev
1 sibling, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2025-01-06 21:15 UTC (permalink / raw)
To: Athira Rajeev
Cc: acme, jolsa, adrian.hunter, irogers, linux-kernel,
linux-perf-users, linuxppc-dev, maddy, kjain, disgoel
Hello,
On Mon, Dec 23, 2024 at 07:26:55PM +0530, Athira Rajeev wrote:
> perf lock contention returns zero exit value even if the lock contention
> BPF setup failed.
>
> # ./perf lock con -b true
> libbpf: kernel BTF is missing at '/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?
> libbpf: failed to find '.BTF' ELF section in /lib/modules/6.13.0-rc3+/build/vmlinux
> libbpf: failed to find valid kernel BTF
> libbpf: kernel BTF is missing at '/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?
> libbpf: failed to find '.BTF' ELF section in /lib/modules/6.13.0-rc3+/build/vmlinux
> libbpf: failed to find valid kernel BTF
> libbpf: Error loading vmlinux BTF: -ESRCH
> libbpf: failed to load object 'lock_contention_bpf'
> libbpf: failed to load BPF skeleton 'lock_contention_bpf': -ESRCH
> Failed to load lock-contention BPF skeleton
> lock contention BPF setup failed
> # echo $?
> 0
>
> Fix this by saving the return code for lock_contention_prepare
> so that command exits with proper return code
>
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Thanks for the fix, the change itself looks good but I think we need the
same for setup_output_field() and select_key() as well.
Thanks,
Namhyung
> ---
> tools/perf/builtin-lock.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
> index 208c482daa56..2226c7dd4ae6 100644
> --- a/tools/perf/builtin-lock.c
> +++ b/tools/perf/builtin-lock.c
> @@ -2049,7 +2049,8 @@ static int __cmd_contention(int argc, const char **argv)
> goto out_delete;
> }
>
> - if (lock_contention_prepare(&con) < 0) {
> + err = lock_contention_prepare(&con);
> + if (err < 0) {
> pr_err("lock contention BPF setup failed\n");
> goto out_delete;
> }
> --
> 2.43.5
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/perf: Fix return code for lock_contention_prepare
2025-01-06 21:15 ` Namhyung Kim
@ 2025-01-10 9:25 ` Athira Rajeev
0 siblings, 0 replies; 4+ messages in thread
From: Athira Rajeev @ 2025-01-10 9:25 UTC (permalink / raw)
To: Namhyung Kim
Cc: acme, jolsa, adrian.hunter, irogers, linux-kernel,
linux-perf-users, linuxppc-dev, maddy, kjain, disgoel
> On 7 Jan 2025, at 2:45 AM, Namhyung Kim <namhyung@kernel.org> wrote:
>
> Hello,
>
> On Mon, Dec 23, 2024 at 07:26:55PM +0530, Athira Rajeev wrote:
>> perf lock contention returns zero exit value even if the lock contention
>> BPF setup failed.
>>
>> # ./perf lock con -b true
>> libbpf: kernel BTF is missing at '/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?
>> libbpf: failed to find '.BTF' ELF section in /lib/modules/6.13.0-rc3+/build/vmlinux
>> libbpf: failed to find valid kernel BTF
>> libbpf: kernel BTF is missing at '/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?
>> libbpf: failed to find '.BTF' ELF section in /lib/modules/6.13.0-rc3+/build/vmlinux
>> libbpf: failed to find valid kernel BTF
>> libbpf: Error loading vmlinux BTF: -ESRCH
>> libbpf: failed to load object 'lock_contention_bpf'
>> libbpf: failed to load BPF skeleton 'lock_contention_bpf': -ESRCH
>> Failed to load lock-contention BPF skeleton
>> lock contention BPF setup failed
>> # echo $?
>> 0
>>
>> Fix this by saving the return code for lock_contention_prepare
>> so that command exits with proper return code
>>
>> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
>
> Thanks for the fix, the change itself looks good but I think we need the
> same for setup_output_field() and select_key() as well.
>
> Thanks,
> Namhyung
Hi Namhyung
Thanks for reviewing and pointing out setup_output_field() and select_key()
I will send a V2 with handling return code for these two functions as well
Thanks
Athira
>
>
>> ---
>> tools/perf/builtin-lock.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
>> index 208c482daa56..2226c7dd4ae6 100644
>> --- a/tools/perf/builtin-lock.c
>> +++ b/tools/perf/builtin-lock.c
>> @@ -2049,7 +2049,8 @@ static int (int argc, const char **argv)
>> goto out_delete;
>> }
>>
>> - if (lock_contention_prepare(&con) < 0) {
>> + err = lock_contention_prepare(&con);
>> + if (err < 0) {
>> pr_err("lock contention BPF setup failed\n");
>> goto out_delete;
>> }
>> --
>> 2.43.5
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-10 9:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-23 13:56 [PATCH] tools/perf: Fix return code for lock_contention_prepare Athira Rajeev
2024-12-27 10:48 ` Athira Rajeev
2025-01-06 21:15 ` Namhyung Kim
2025-01-10 9:25 ` Athira Rajeev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).