mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Oancea Catalin <john3@mailbox.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>,
	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>,
	"James Clark" <james.clark@linaro.org>,
	Thomas Gleixner <tglx@kernel.org>,
	"Borislav Petkov" <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	<linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Dapeng Mi <dapeng1.mi@linux.intel.com>,
	Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH v4 2/4] perf/x86/amd/core: Handle overflows of counters stopped by a throttle
Date: Thu, 3 Dec 2026 19:12:58 +0530	[thread overview]
Message-ID: <af516291-4b1a-4f6e-919b-cfa6d88d2b0d@amd.com> (raw)
In-Reply-To: <20261203113922.77972-3-john3@mailbox.org>

> Since commit 9734e25fbf5a ("perf: Fix the throttle logic for a group")
> a throttle stops the whole event group. perf_event_overflow() can
> therefore stop counters which the NMI handler has not reached yet.
> 
> amd_pmu_v2_handle_irq() tests cpuc->active_mask while it walks the
> counters. It skips a sibling which was stopped that way, also when the
> sibling has overflowed in the same NMI. The overflow is not handled,
> the status bit stays set and the handler warns:
> 
>   New overflows for inactive PMCs: 2
>   WARNING: arch/x86/events/amd/core.c:1031 at amd_pmu_v2_handle_irq+0x86e/0x9a0
> 
> An unprivileged task can trigger this with perf_event_paranoid at its
> default of 2: a group of two sampling events with short periods on the
> task itself, which spins in user space.
> 
> Take a copy of active_mask before the loop and walk the counters which
> were active on entry. The overflow of a counter which was stopped in
> the meantime is then handled like any other.
> 
> The problem was found with syzkaller. An AI coding assistant (Claude
> Code) was used in the analysis and in writing the reproducer and the
> patch.
> 
> Fixes: 9734e25fbf5a ("perf: Fix the throttle logic for a group")
> Signed-off-by: Oancea Catalin <john3@mailbox.org>
> Cc: stable@vger.kernel.org

Reviewed-by: Ravi Bangoria <ravi.bangoria@amd.com>

Thanks,
Ravi

  reply	other threads:[~2026-12-03 13:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 11:39 [PATCH v4 0/4] perf/x86: " Oancea Catalin
2026-12-03 11:39 ` [PATCH v4 1/4] perf/core: Do not account overflows of a throttled event Oancea Catalin
2026-12-03 11:39 ` [PATCH v4 2/4] perf/x86/amd/core: Handle overflows of counters stopped by a throttle Oancea Catalin
2026-12-03 13:42   ` Ravi Bangoria [this message]
2026-12-03 11:39 ` [PATCH v4 3/4] perf/x86: " Oancea Catalin
2026-12-03 11:39 ` [PATCH v4 4/4] perf/x86/intel: " Oancea Catalin

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=af516291-4b1a-4f6e-919b-cfa6d88d2b0d@amd.com \
    --to=ravi.bangoria@amd.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=john3@mailbox.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=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®