linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com,
	irogers@google.com, linux-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	maddy@linux.ibm.com, kjain@linux.ibm.com,
	disgoel@linux.vnet.ibm.com
Subject: Re: [PATCH] tools/perf: Fix return code for lock_contention_prepare
Date: Mon, 6 Jan 2025 13:15:22 -0800	[thread overview]
Message-ID: <Z3xH6kCK9zj5ttZM@google.com> (raw)
In-Reply-To: <20241223135655.8042-1-atrajeev@linux.vnet.ibm.com>

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
> 


  parent reply	other threads:[~2025-01-06 21:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-01-10  9:25   ` Athira Rajeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z3xH6kCK9zj5ttZM@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=disgoel@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kjain@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).