linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf evsel: Fix missing inherit + sample read check
@ 2024-10-09  6:22 Namhyung Kim
  2024-10-11  8:02 ` Ben Gainey
  2024-10-16 17:12 ` Namhyung Kim
  0 siblings, 2 replies; 5+ messages in thread
From: Namhyung Kim @ 2024-10-09  6:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ian Rogers, Kan Liang
  Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
	linux-perf-users, Ben Gainey

It should not clear the inherit bit simply because the kernel doesn't
support the sample read with it.  IOW the inherit bit should be kept
when the sample read is not requested for the event.

Fixes: 90035d3cd876cb71 ("tools/perf: Allow inherit + PERF_SAMPLE_READ when opening events")
Cc: Ben Gainey <ben.gainey@arm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/evsel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d8fd493af01458b7..507f526ccbbcfc36 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2112,7 +2112,8 @@ static int __evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus,
 
 static void evsel__disable_missing_features(struct evsel *evsel)
 {
-	if (perf_missing_features.inherit_sample_read)
+	if (perf_missing_features.inherit_sample_read && evsel->core.attr.inherit &&
+	    (evsel->core.attr.sample_type & PERF_SAMPLE_READ))
 		evsel->core.attr.inherit = 0;
 	if (perf_missing_features.branch_counters)
 		evsel->core.attr.branch_sample_type &= ~PERF_SAMPLE_BRANCH_COUNTERS;
-- 
2.47.0.rc0.187.ge670bccf7e-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf evsel: Fix missing inherit + sample read check
  2024-10-09  6:22 [PATCH] perf evsel: Fix missing inherit + sample read check Namhyung Kim
@ 2024-10-11  8:02 ` Ben Gainey
  2024-10-11 16:39   ` Namhyung Kim
  2024-10-16 17:12 ` Namhyung Kim
  1 sibling, 1 reply; 5+ messages in thread
From: Ben Gainey @ 2024-10-11  8:02 UTC (permalink / raw)
  To: namhyung@kernel.org, acme@kernel.org, irogers@google.com,
	kan.liang@linux.intel.com
  Cc: jolsa@kernel.org, peterz@infradead.org, adrian.hunter@intel.com,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	mingo@kernel.org

On Tue, 2024-10-08 at 23:22 -0700, Namhyung Kim wrote:
> It should not clear the inherit bit simply because the kernel doesn't
> support the sample read with it.  IOW the inherit bit should be kept
> when the sample read is not requested for the event.


Ah, sorry. Good spot.

Thanks
Ben



> 
> Fixes: 90035d3cd876cb71 ("tools/perf: Allow inherit +
> PERF_SAMPLE_READ when opening events")
> Cc: Ben Gainey <ben.gainey@arm.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/util/evsel.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index d8fd493af01458b7..507f526ccbbcfc36 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -2112,7 +2112,8 @@ static int __evsel__prepare_open(struct evsel
> *evsel, struct perf_cpu_map *cpus,
>  
>  static void evsel__disable_missing_features(struct evsel *evsel)
>  {
> - if (perf_missing_features.inherit_sample_read)
> + if (perf_missing_features.inherit_sample_read && evsel-
> >core.attr.inherit &&
> +     (evsel->core.attr.sample_type & PERF_SAMPLE_READ))
>   evsel->core.attr.inherit = 0;
>   if (perf_missing_features.branch_counters)
>   evsel->core.attr.branch_sample_type &=
> ~PERF_SAMPLE_BRANCH_COUNTERS;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf evsel: Fix missing inherit + sample read check
  2024-10-11  8:02 ` Ben Gainey
@ 2024-10-11 16:39   ` Namhyung Kim
  2024-10-11 16:45     ` Ben Gainey
  0 siblings, 1 reply; 5+ messages in thread
From: Namhyung Kim @ 2024-10-11 16:39 UTC (permalink / raw)
  To: Ben Gainey
  Cc: acme@kernel.org, irogers@google.com, kan.liang@linux.intel.com,
	jolsa@kernel.org, peterz@infradead.org, adrian.hunter@intel.com,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	mingo@kernel.org

On Fri, Oct 11, 2024 at 08:02:04AM +0000, Ben Gainey wrote:
> On Tue, 2024-10-08 at 23:22 -0700, Namhyung Kim wrote:
> > It should not clear the inherit bit simply because the kernel doesn't
> > support the sample read with it.  IOW the inherit bit should be kept
> > when the sample read is not requested for the event.
> 
> 
> Ah, sorry. Good spot.

Thanks for the review, can I translate it your Acked-by?

Thanks,
Namhyung
 
> > 
> > Fixes: 90035d3cd876cb71 ("tools/perf: Allow inherit +
> > PERF_SAMPLE_READ when opening events")
> > Cc: Ben Gainey <ben.gainey@arm.com>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/util/evsel.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> > index d8fd493af01458b7..507f526ccbbcfc36 100644
> > --- a/tools/perf/util/evsel.c
> > +++ b/tools/perf/util/evsel.c
> > @@ -2112,7 +2112,8 @@ static int __evsel__prepare_open(struct evsel
> > *evsel, struct perf_cpu_map *cpus,
> >  
> >  static void evsel__disable_missing_features(struct evsel *evsel)
> >  {
> > - if (perf_missing_features.inherit_sample_read)
> > + if (perf_missing_features.inherit_sample_read && evsel-
> > >core.attr.inherit &&
> > +     (evsel->core.attr.sample_type & PERF_SAMPLE_READ))
> >   evsel->core.attr.inherit = 0;
> >   if (perf_missing_features.branch_counters)
> >   evsel->core.attr.branch_sample_type &=
> > ~PERF_SAMPLE_BRANCH_COUNTERS;
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf evsel: Fix missing inherit + sample read check
  2024-10-11 16:39   ` Namhyung Kim
@ 2024-10-11 16:45     ` Ben Gainey
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Gainey @ 2024-10-11 16:45 UTC (permalink / raw)
  To: namhyung@kernel.org
  Cc: mingo@kernel.org, peterz@infradead.org, acme@kernel.org,
	linux-kernel@vger.kernel.org, kan.liang@linux.intel.com,
	adrian.hunter@intel.com, linux-perf-users@vger.kernel.org,
	jolsa@kernel.org, irogers@google.com

On Fri, 2024-10-11 at 09:39 -0700, Namhyung Kim wrote:
> On Fri, Oct 11, 2024 at 08:02:04AM +0000, Ben Gainey wrote:
> > On Tue, 2024-10-08 at 23:22 -0700, Namhyung Kim wrote:
> > > It should not clear the inherit bit simply because the kernel
> > > doesn't
> > > support the sample read with it.  IOW the inherit bit should be
> > > kept
> > > when the sample read is not requested for the event.
> > 
> > 
> > Ah, sorry. Good spot.
> 
> Thanks for the review, can I translate it your Acked-by?
> 

Yes, of course

Acked-by: Ben Gainey <ben.gainey@arm.com>

:-)


> Thanks,
> Namhyung
>  
> > > 
> > > Fixes: 90035d3cd876cb71 ("tools/perf: Allow inherit +
> > > PERF_SAMPLE_READ when opening events")
> > > Cc: Ben Gainey <ben.gainey@arm.com>
> > > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > > ---
> > >  tools/perf/util/evsel.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> > > index d8fd493af01458b7..507f526ccbbcfc36 100644
> > > --- a/tools/perf/util/evsel.c
> > > +++ b/tools/perf/util/evsel.c
> > > @@ -2112,7 +2112,8 @@ static int __evsel__prepare_open(struct
> > > evsel
> > > *evsel, struct perf_cpu_map *cpus,
> > >  
> > >  static void evsel__disable_missing_features(struct evsel *evsel)
> > >  {
> > > - if (perf_missing_features.inherit_sample_read)
> > > + if (perf_missing_features.inherit_sample_read && evsel-
> > > > core.attr.inherit &&
> > > +     (evsel->core.attr.sample_type & PERF_SAMPLE_READ))
> > >   evsel->core.attr.inherit = 0;
> > >   if (perf_missing_features.branch_counters)
> > >   evsel->core.attr.branch_sample_type &=
> > > ~PERF_SAMPLE_BRANCH_COUNTERS;
> > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf evsel: Fix missing inherit + sample read check
  2024-10-09  6:22 [PATCH] perf evsel: Fix missing inherit + sample read check Namhyung Kim
  2024-10-11  8:02 ` Ben Gainey
@ 2024-10-16 17:12 ` Namhyung Kim
  1 sibling, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2024-10-16 17:12 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ian Rogers, Kan Liang, Namhyung Kim
  Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
	linux-perf-users, Ben Gainey

On Tue, 08 Oct 2024 23:22:50 -0700, Namhyung Kim wrote:

> It should not clear the inherit bit simply because the kernel doesn't
> support the sample read with it.  IOW the inherit bit should be kept
> when the sample read is not requested for the event.
> 
> 

Applied to perf-tools-next, thanks!

Best regards,
Namhyung


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-16 17:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09  6:22 [PATCH] perf evsel: Fix missing inherit + sample read check Namhyung Kim
2024-10-11  8:02 ` Ben Gainey
2024-10-11 16:39   ` Namhyung Kim
2024-10-11 16:45     ` Ben Gainey
2024-10-16 17:12 ` Namhyung Kim

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).