[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJpZYjULGa80tC6LBGZyXfUNk3yG5tyieegvheMg6N13QhoHCQ@mail.gmail.com>
Date: Fri, 1 Nov 2024 14:24:00 -0700
From: Chun-Tse Shao <ctshao@...gle.com>
To: Ian Rogers <irogers@...gle.com>
Cc: linux-kernel@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Ze Gao <zegao2021@...il.com>,
Weilin Wang <weilin.wang@...el.com>, linux-perf-users@...r.kernel.org,
kan.liang@...ux.intel.com
Subject: Re: [PATCH 2/3] perf: Reveal PMU type in fdinfo
Thank you for your review! Here is the link to the v2 patch with
fixes: https://lore.kernel.org/all/20241101211757.824743-2-ctshao@google.com/
On Fri, Nov 1, 2024 at 9:02 AM Ian Rogers <irogers@...gle.com> wrote:
>
> On Thu, Oct 31, 2024 at 3:39 PM Chun-Tse Shao <ctshao@...gle.com> wrote:
> >
> > It gives useful info on knowing which PMUs are reserved by this process.
> > Also add extra attributes which would be useful.
> >
> > ```
> > Testing cycles
> > $ ./perf stat -e cycles &
> > $ cat /proc/`pidof perf`/fdinfo/3
> > pos: 0
> > flags: 02000002
> > mnt_id: 16
> > ino: 3081
> > perf_event-orig_type: 0
>
> nit: I think this should be:
> perf_event-type: 0
> this output was from an earlier version.
Thank you for the correction!
>
> > perf_event-attr.config1: 0
> > perf_event-attr.config2: 0
> > perf_event-attr.config3: 0
> >
> > Testing L1-dcache-load-misses//
> > $ ./perf stat -e L1-dcache-load-misses &
> > $ cat /proc/`pidof perf`/fdinfo/3
> > pos: 0
> > flags: 02000002
> > mnt_id: 16
> > ino: 1072
> > perf_event-attr.type: 3
> > perf_event-attr.config: 65536
> > perf_event-attr.config1: 0
> > perf_event-attr.config2: 0
> > perf_event-attr.config3: 0
> > ```
> >
> > Signed-off-by: Chun-Tse Shao <ctshao@...gle.com>
> > ---
> > kernel/events/core.c | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index cdd09769e6c56..e0891c376fd9d 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -8,6 +8,7 @@
> > * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@....ibm.com>
> > */
> >
> > +#include "linux/seq_file.h"
>
> nit: I think you should use angle < > rather than quotes on the
> include for consistency.
Fixed.
>
> Thanks,
> Ian
>
> > #include <linux/fs.h>
> > #include <linux/mm.h>
> > #include <linux/cpu.h>
> > @@ -6820,6 +6821,17 @@ static int perf_fasync(int fd, struct file *filp, int on)
> > return 0;
> > }
> >
> > +static void perf_show_fdinfo(struct seq_file *m, struct file *f)
> > +{
> > + struct perf_event *event = f->private_data;
> > +
> > + seq_printf(m, "perf_event-attr.type:\t%u\n", event->orig_type);
> > + seq_printf(m, "perf_event-attr.config:\t%llu\n", event->attr.config);
> > + seq_printf(m, "perf_event-attr.config1:\t%llu\n", event->attr.config1);
> > + seq_printf(m, "perf_event-attr.config2:\t%llu\n", event->attr.config2);
> > + seq_printf(m, "perf_event-attr.config3:\t%llu\n", event->attr.config3);
> > +}
> > +
> > static const struct file_operations perf_fops = {
> > .release = perf_release,
> > .read = perf_read,
> > @@ -6828,6 +6840,7 @@ static const struct file_operations perf_fops = {
> > .compat_ioctl = perf_compat_ioctl,
> > .mmap = perf_mmap,
> > .fasync = perf_fasync,
> > + .show_fdinfo = perf_show_fdinfo,
> > };
> >
> > /*
> > --
> > 2.47.0.163.g1226f6d8fa-goog
> >
Powered by blists - more mailing lists