From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>,
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
Ravi Bangoria <ravi.bangoria@amd.com>,
"linux-perf-users@vger.kernel.org"
<linux-perf-users@vger.kernel.org>,
Disha Goel <disgoel@linux.vnet.ibm.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf test: Skip watchpoint tests if no watchpoints available
Date: Wed, 23 Nov 2022 10:33:26 -0300 [thread overview]
Message-ID: <Y34hJrqCzSE+W+X9@kernel.org> (raw)
In-Reply-To: <CAP-5=fXJf+1V5RF-m3e+AhK0Qg-yaJ1_2HL0CTOvp1xkK-1fDg@mail.gmail.com>
Em Tue, Nov 22, 2022 at 12:57:05PM -0800, Ian Rogers escreveu:
> On Tue, Nov 22, 2022 at 11:19 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
> >
> >
> >
> > Le 21/11/2022 à 11:27, Naveen N. Rao a écrit :
> > > On IBM Power9, perf watchpoint tests fail since no hardware breakpoints
> > > are available. Detect this by checking the error returned by
> > > perf_event_open() and skip the tests in that case.
> > >
> > > Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
> > > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> > > ---
> > > tools/perf/tests/wp.c | 12 +++++++-----
> > > 1 file changed, 7 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/tools/perf/tests/wp.c b/tools/perf/tests/wp.c
> > > index 56455da30341b4..cc8719609b19ea 100644
> > > --- a/tools/perf/tests/wp.c
> > > +++ b/tools/perf/tests/wp.c
> > > @@ -59,8 +59,10 @@ static int __event(int wp_type, void *wp_addr, unsigned long wp_len)
> > > get__perf_event_attr(&attr, wp_type, wp_addr, wp_len);
> > > fd = sys_perf_event_open(&attr, 0, -1, -1,
> > > perf_event_open_cloexec_flag());
> > > - if (fd < 0)
> > > + if (fd < 0) {
> > > + fd = -errno;
> > > pr_debug("failed opening event %x\n", attr.bp_type);
> > > + }
> >
> > Do you really need that ?
> >
> > Can't you directly check errno in the caller ?
>
> errno is very easily clobbered and not clearly set on success - ie,
> it'd be better not to do that.
>
> Acked-by: Ian Rogers <irogers@google.com>
Thanks, applied.
- Arnaldo
next prev parent reply other threads:[~2022-11-23 13:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 10:27 [PATCH] perf test: Skip watchpoint tests if no watchpoints available Naveen N. Rao
2022-11-22 19:18 ` Christophe Leroy
2022-11-22 20:57 ` Ian Rogers
2022-11-23 13:33 ` Arnaldo Carvalho de Melo [this message]
2022-11-23 8:05 ` kajoljain
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=Y34hJrqCzSE+W+X9@kernel.org \
--to=acme@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=disgoel@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=ravi.bangoria@amd.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).