linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>,
	linux-kernel-next@vger.kernel.org,
	linux-perf-users@vger.kernel.org, hca@linux.ibm.com,
	egorenar@linux.ibm.com, gor@linux.ibm.com, svens@linux.ibm.com,
	sumanthk@linux.ibm.com
Subject: Re: [PATCH] tools/perf: Fix perf tool build error in util/pfm.c
Date: Wed, 8 Feb 2023 11:07:35 -0300	[thread overview]
Message-ID: <Y+Osp+SY+1WTHvwR@kernel.org> (raw)
In-Reply-To: <Y+OnKl9wYcbFvHLY@kernel.org>

Em Wed, Feb 08, 2023 at 10:44:10AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Feb 08, 2023 at 10:40:57AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Feb 07, 2023 at 09:58:48PM -0800, Ian Rogers escreveu:
> > > On Tue, Feb 7, 2023 at 7:02 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > > >
> > > > Em Tue, Feb 07, 2023 at 03:04:47PM +0100, Thomas Richter escreveu:
> > > > > I have downloaded linux-next and build the perf tool using
> > > > >
> > > > >  # make LIBPFM4=1
> > > > >
> > > > > to have libpfm4 support built into perf. The build fails:
> > > > >
> > > > >  # make LIBPFM4=1
> > > >
> > > > Ian,
> > > >
> > > >         Can you please take a look? Should we go this way or have some
> > > > feature test to check how that function signature should look?
> > > >
> > > > - Arnaldo
> > > 
> > > Tested-by: Ian Rogers <irogers@google.com>
> > > 
> > > Wrt tests, there is make_with_libpfm4 in tools/perf/tests/make.

I realized I hadn't libbpf-devel installed on the machine I run 'make -C
tools/perf build-test' :-\ Fixed.

- Arnaldo

> > I meant if we should support older versions or state that to build with
> > libbpf we need to have the version with this new signature.
> 
> I see, the signature change wasn't in libpfm, nevermind, testing now.
> 
> - Arnaldo
>  
> > I'll apply and test build it here.
> > 
> > - Arnaldo
> >  
> > > Thanks,
> > > Ian
> > > 
> > > > > ....
> > > > > INSTALL libbpf_headers
> > > > >   CC      util/pfm.o
> > > > > util/pfm.c: In function ‘print_libpfm_event’:
> > > > > util/pfm.c:189:9: error: too many arguments to function ‘print_cb->print_event’
> > > > >   189 |         print_cb->print_event(print_state,
> > > > >       |         ^~~~~~~~
> > > > > util/pfm.c:220:25: error: too many arguments to function ‘print_cb->print_event’
> > > > >   220 |                         print_cb->print_event(print_state,
> > > > >
> > > > > The build error is caused by
> > > > > commit d9dc8874d6ce ("perf pmu-events: Remove now unused event and metric variables")
> > > > > which changes the function prototype of
> > > > >   struct print_callbacks {
> > > > >       ...
> > > > >       void (*print_event)(...);  --> last two parameters removed.
> > > > >   };
> > > > >
> > > > > but does not adjust the usage of this function prototype in util/pfm.c.
> > > > > In file util/pfm.c function print_event() is still invoked with 13 parameters
> > > > > instead of 11. The compile fails.
> > > > >
> > > > > When I adjust the file util/pfm.c as in this patch, the build works file.
> > > > > Please check this patch for correctness, I have just fixed the compile
> > > > > issue.
> > > > >
> > > > > Fixes d9dc8874d6ce ("perf pmu-events: Remove now unused event and metric variables")
> > > > > Cc: irogers@google.com
> > > > > Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> > > > > ---
> > > > >  tools/perf/util/pfm.c | 6 ++----
> > > > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/tools/perf/util/pfm.c b/tools/perf/util/pfm.c
> > > > > index ac3227ba769c..b59ba825ddc9 100644
> > > > > --- a/tools/perf/util/pfm.c
> > > > > +++ b/tools/perf/util/pfm.c
> > > > > @@ -193,8 +193,7 @@ print_libpfm_event(const struct print_callbacks *print_cb, void *print_state,
> > > > >                       /*scale_unit=*/NULL,
> > > > >                       /*deprecated=*/NULL, "PFM event",
> > > > >                       info->desc, /*long_desc=*/NULL,
> > > > > -                     /*encoding_desc=*/buf->buf,
> > > > > -                     /*metric_name=*/NULL, /*metric_expr=*/NULL);
> > > > > +                     /*encoding_desc=*/buf->buf);
> > > > >
> > > > >       pfm_for_each_event_attr(j, info) {
> > > > >               pfm_event_attr_info_t ainfo;
> > > > > @@ -224,8 +223,7 @@ print_libpfm_event(const struct print_callbacks *print_cb, void *print_state,
> > > > >                                       /*scale_unit=*/NULL,
> > > > >                                       /*deprecated=*/NULL, "PFM event",
> > > > >                                       ainfo.desc, /*long_desc=*/NULL,
> > > > > -                                     /*encoding_desc=*/buf->buf,
> > > > > -                                     /*metric_name=*/NULL, /*metric_expr=*/NULL);
> > > > > +                                     /*encoding_desc=*/buf->buf);
> > > > >               }
> > > > >       }
> > > > >  }
> > > > > --
> > > > > 2.39.1
> > > > >
> > > >
> > > > --
> > > >
> > > > - Arnaldo
> > 
> > -- 
> > 
> > - Arnaldo
> 
> -- 
> 
> - Arnaldo

-- 

- Arnaldo

  reply	other threads:[~2023-02-08 14:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 14:04 [PATCH] tools/perf: Fix perf tool build error in util/pfm.c Thomas Richter
2023-02-07 15:02 ` Arnaldo Carvalho de Melo
2023-02-08  5:58   ` Ian Rogers
2023-02-08 13:40     ` Arnaldo Carvalho de Melo
2023-02-08 13:44       ` Arnaldo Carvalho de Melo
2023-02-08 14:07         ` Arnaldo Carvalho de Melo [this message]
2023-02-15 14:17           ` PING " Thomas Richter
2023-02-15 16:26             ` Arnaldo Carvalho de Melo
2023-02-15 20:28               ` Stephen Rothwell

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=Y+Osp+SY+1WTHvwR@kernel.org \
    --to=acme@kernel.org \
    --cc=egorenar@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=irogers@google.com \
    --cc=linux-kernel-next@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sumanthk@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    --cc=tmricht@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).