All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Yunseong Kim <ysk@kzalloc.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@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>,
	Liang Kan <kan.liang@linux.intel.com>,
	James Clark <james.clark@linaro.org>,
	Collin Funk <collin.funk1@gmail.com>,
	Ravi Bangoria <ravi.bangoria@amd.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf test: Add test case for event group throttling with inactive events
Date: Fri, 15 Aug 2025 13:07:07 -0700	[thread overview]
Message-ID: <aJ-Ta0axsWXH2b6p@google.com> (raw)
In-Reply-To: <a40f008e-d552-4ce2-8279-5a25183b7726@kzalloc.com>

On Fri, Aug 15, 2025 at 05:23:44AM +0900, Yunseong Kim wrote:
> Hi Namhyung,
> 
> Thanks for your reply.
> 
> On 8/15/25 5:06 AM, Namhyung Kim wrote:
> > Hi Yunseong,
> > 
> > On Wed, Aug 13, 2025 at 04:32:52PM +0000, Yunseong Kim wrote:
> >> A recent UBSAN shift-out-of-bounds report was identified when throttling
> >> event groups that included inactive (PERF_EVENT_STATE_OFF) events.
> >> This occurred because pmu->start()/stop() could be called on these events,
> >> potentially leaving event->hw.idx at -1. This leads to undefined behavior
> >> when PMU code later uses this negative index as a shift exponent.
> >>
> >> The issue need to ensuring perf_event_throttle() and
> >> perf_event_unthrottle() skip inactive events entirely.
> >>
> >> Introduce a new perf test suite, "event group throttle", to verify this
> >> fix and prevent regressions.
> > 
> > Thanks for your work!
> > 
> > I'm curious what happens if it runs on unfixed kernels.  I suspect this
> > should be in the selftest so that it can tie with the kernel fix.
> 
> I agree with your point. I believe it's more appropriate for this test to
> be included in "kself test" alongside the kernel fix. I'll modify the
> test case based on Liang's suggestion.
> 
> > By having this in the perf tools test suite, you cannot guarantee if the
> > kernel has the fix.  And it may turn the kernel into an unstable state
> > easily.
> 
> Would it be possible to add this test if it were changed to focus on
> a different aspect?

It depends on how you change it.  Can you please share your idea first?

Thanks,
Namhyung


      reply	other threads:[~2025-08-15 20:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 16:32 [PATCH] perf test: Add test case for event group throttling with inactive events Yunseong Kim
2025-08-14 17:10 ` Liang, Kan
2025-08-14 20:17   ` Yunseong Kim
2025-08-14 20:06 ` Namhyung Kim
2025-08-14 20:23   ` Yunseong Kim
2025-08-15 20:07     ` Namhyung Kim [this message]

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=aJ-Ta0axsWXH2b6p@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=collin.funk1@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --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=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=ysk@kzalloc.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.