All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Jakub Brnak <jbrnak@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	kan.liang@linux.intel.com, mpetlan@redhat.com,
	tglozar@redhat.com, Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCH v3] perf test probe_vfs_getname: Skip if no suitable line detected
Date: Thu, 10 Apr 2025 13:58:35 -0700	[thread overview]
Message-ID: <Z_gw-xw97c_IWdXw@google.com> (raw)
In-Reply-To: <Z_fWa093x33Wcwrw@jbrnak-thinkpadx1carbongen9.tpbc.csb>

Hello,

On Thu, Apr 10, 2025 at 04:32:11PM +0200, Jakub Brnak wrote:
> On Mon, Mar 24, 2025 at 03:45:23PM +0100, Jakub Brnak wrote:
> > In some cases when calling function add_probe_vfs_getname, line number
> > can't be detected by perf probe -L getname_flags:
> > 
> >   78         atomic_set(&result->refcnt, 1);
> > 
> > 	     // one of the following lines should have line number
> > 	     // but sometimes it does not because of optimization
> > 	     result->uptr = filename;
> >              result->aname = NULL;
> > 
> >   81         audit_getname(result);
> > 
> > To prevent false failures, skip the affected tests
> > if no suitable line numbers can be detected.
> > 
> > Signed-off-by: Jakub Brnak <jbrnak@redhat.com>

Sorry for the long delay.  It looks ok to me.

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

> > ---
> > v3:
> > - ensure POSIX compliance
> > 
> > v2: 
> > https://lore.kernel.org/linux-perf-users/Z9tKat6vvC1XUj0U@google.com/
> > - check if return from add_vfs_getname equals to 1
> > sice it is only option in case of fail 
> > 
> > v1:
> >  https://lore.kernel.org/linux-perf-users/Z8pAep0GJsMFTyEi@google.com/T/#t
> > ---
> >  tools/perf/tests/shell/lib/probe_vfs_getname.sh          | 8 +++++++-
> >  tools/perf/tests/shell/probe_vfs_getname.sh              | 8 +++++++-
> >  .../perf/tests/shell/record+script_probe_vfs_getname.sh  | 8 +++++++-
> >  tools/perf/tests/shell/trace+probe_vfs_getname.sh        | 9 +++++++--
> >  4 files changed, 28 insertions(+), 5 deletions(-)
> > 
> > diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
> > index 5c33ec7a5a63..89f72a4c818c 100644
> > --- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh
> > +++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
> > @@ -19,8 +19,14 @@ add_probe_vfs_getname() {
> >  			result_aname_re="[[:space:]]+([[:digit:]]+)[[:space:]]+result->aname = NULL;"
> >  			line=$(perf probe -L getname_flags 2>&1 | grep -E "$result_aname_re" | sed -r "s/$result_aname_re/\1/")
> >  		fi
> > +
> > +		if [ -z "$line" ] ; then
> > +			echo "Could not find probeable line"
> > +			return 2
> > +		fi
> > +
> >  		perf probe -q       "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
> > -		perf probe $add_probe_verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring"
> > +		perf probe $add_probe_verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring" || return 1
> >  	fi
> >  }
> >  
> > diff --git a/tools/perf/tests/shell/probe_vfs_getname.sh b/tools/perf/tests/shell/probe_vfs_getname.sh
> > index c51a32931af6..0f52654c914a 100755
> > --- a/tools/perf/tests/shell/probe_vfs_getname.sh
> > +++ b/tools/perf/tests/shell/probe_vfs_getname.sh
> > @@ -13,7 +13,13 @@ skip_if_no_perf_probe || exit 2
> >  # shellcheck source=lib/probe_vfs_getname.sh
> >  . "$(dirname $0)"/lib/probe_vfs_getname.sh
> >  
> > -add_probe_vfs_getname || skip_if_no_debuginfo
> > +add_probe_vfs_getname
> >  err=$?
> > +
> > +if [ $err -eq 1 ] ; then
> > +	skip_if_no_debuginfo
> > +	err=$?
> > +fi
> > +
> >  cleanup_probe_vfs_getname
> >  exit $err
> > diff --git a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh
> > index fd5b10d46915..1ad252f0d36e 100755
> > --- a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh
> > +++ b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh
> > @@ -35,8 +35,14 @@ perf_script_filenames() {
> >  	grep -E " +touch +[0-9]+ +\[[0-9]+\] +[0-9]+\.[0-9]+: +probe:vfs_getname[_0-9]*: +\([[:xdigit:]]+\) +pathname=\"${file}\""
> >  }
> >  
> > -add_probe_vfs_getname || skip_if_no_debuginfo
> > +add_probe_vfs_getname
> >  err=$?
> > +
> > +if [ $err -eq 1 ] ; then
> > +        skip_if_no_debuginfo
> > +        err=$?
> > +fi
> > +
> >  if [ $err -ne 0 ] ; then
> >  	exit $err
> >  fi
> > diff --git a/tools/perf/tests/shell/trace+probe_vfs_getname.sh b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
> > index 60fccb62c540..5d5019988d61 100755
> > --- a/tools/perf/tests/shell/trace+probe_vfs_getname.sh
> > +++ b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
> > @@ -25,9 +25,14 @@ trace_open_vfs_getname() {
> >  	grep -E " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch/[0-9]+ open(at)?\((dfd: +CWD, +)?filename: +\"?${file}\"?, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
> >  }
> >  
> > -
> > -add_probe_vfs_getname || skip_if_no_debuginfo
> > +add_probe_vfs_getname
> >  err=$?
> > +
> > +if [ $err -eq 1 ] ; then
> > +        skip_if_no_debuginfo
> > +        err=$?
> > +fi
> > +
> >  if [ $err -ne 0 ] ; then
> >  	exit $err
> >  fi
> > -- 
> > 2.48.1
> > 
> 
> Hi, anyone interested in this patch?
> 
> Thanks,
> Jakub
> 

  reply	other threads:[~2025-04-10 20:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24 14:45 [PATCH v3] perf test probe_vfs_getname: Skip if no suitable line detected Jakub Brnak
2025-04-10 14:32 ` Jakub Brnak
2025-04-10 20:58   ` Namhyung Kim [this message]
2025-04-29 15:02     ` Arnaldo Carvalho de Melo

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=Z_gw-xw97c_IWdXw@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jbrnak@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpetlan@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglozar@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.