All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Tengda Wu <wutengda@huaweicloud.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@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>,
	James Clark <james.clark@linaro.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/2] perf/core: Disable context fast-swap for sigtrap events
Date: Thu, 26 Nov 2026 12:01:08 +0100	[thread overview]
Message-ID: <20261126110108.GD49833@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <ea0a0fcf-0d96-416c-ba85-e98a8841cfb1@huaweicloud.com>

On Thu, Nov 26, 2026 at 09:59:59AM +0800, Tengda Wu wrote:

> >>>   preempt=none
> >>
> >> That option is no longer available.
> >>
> 
> Uh, I tested on linux-next, base commit: 84abb955b101 (tag: next-20261113).
> That option is still present at that commit.

d3d16750693b ("sched: dynamic: Make PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY")


> > --- a/include/linux/perf_event.h
> > +++ b/include/linux/perf_event.h
> > @@ -1236,6 +1236,7 @@ extern const struct perf_event_attr *per
> >  extern void perf_event_print_debug(void);
> >  extern void perf_pmu_disable(struct pmu *pmu);
> >  extern void perf_pmu_enable(struct pmu *pmu);
> > +extern bool perf_pmu_enabled(struct pmu *pmu);
> >  extern void perf_sched_cb_dec(struct pmu *pmu);
> >  extern void perf_sched_cb_inc(struct pmu *pmu);
> >  extern int perf_event_task_disable(void);
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -1366,6 +1366,12 @@ void perf_pmu_enable(struct pmu *pmu)
> >  		pmu->pmu_enable(pmu);
> >  }
> >  
> > +bool perf_pmu_enabled(struct pmu *pmu)
> > +{
> > +	int *count = &this_cpc(pmu)->pmu_disable_count;
> > +	return *count == 0;
> > +}
> > +
> >  static void perf_assert_pmu_disabled(struct pmu *pmu)
> >  {
> >  	int *count = &this_cpc(pmu)->pmu_disable_count;
> > @@ -10955,7 +10961,7 @@ static int __perf_event_overflow(struct
> >  		 * claim the pending_work before task_work_add() recurses.
> >  		 */
> >  		if (cmpxchg_local(&event->pending_work, 0, 1) == 0) {
> > -			if (!task_work_add(current, &event->pending_task, notify_mode)) {
> > +			if (!task_work_add(event->ctx->task, &event->pending_task, notify_mode)) {
> >  				event->pending_work = pending_id;
> >  				local_inc(&event->ctx->nr_no_switch_fast);
> >  				WARN_ON_ONCE(!atomic_long_inc_not_zero(&event->refcount));
> > @@ -11151,6 +11157,9 @@ static int perf_swevent_match(struct per
> >  				struct perf_sample_data *data,
> >  				struct pt_regs *regs)
> >  {
> > +	if (!perf_pmu_enabled(event->pmu))
> > +		return 0;
> > +
> >  	if (event->attr.type != type)
> >  		return 0;
> >  
> > @@ -11531,6 +11540,9 @@ static int perf_tp_event_match(struct pe
> >  				struct perf_raw_record *raw,
> >  				struct pt_regs *regs)
> >  {
> > +	if (!perf_pmu_enabled(event->pmu))
> > +		return 0;
> > +
> >  	if (event->hw.state & PERF_HES_STOPPED)
> >  		return 0;
> >  	/*
> 
> 
> Hmm, I applied that patch to my local environment and tested it, and
> I no longer see the warning. The issue should be resolved.
> 
> Tested-by: Tengda Wu <wutengda@huaweicloud.com>

Excellent, thank you. Let me write up this one and land them in
perf/urgent.

  reply	other threads:[~2026-11-26 11:01 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  9:50 [PATCH v5 0/2] perf/core: Fix sigtrap task_work races Tengda Wu
2026-11-19  9:51 ` [PATCH v5 1/2] perf/core: Prevent duplicate sigtrap task work enqueue Tengda Wu
2026-11-19  9:59   ` sashiko-bot
2026-11-19 12:09   ` Sebastian Andrzej Siewior
2026-11-20 12:14   ` Peter Zijlstra
2026-11-20 14:16     ` Sebastian Andrzej Siewior
2026-11-20 15:04       ` Peter Zijlstra
2026-11-20 15:10         ` Sebastian Andrzej Siewior
2026-11-20 15:24           ` Peter Zijlstra
2026-11-20 15:44   ` Peter Zijlstra
2026-11-20 15:49     ` Sebastian Andrzej Siewior
2026-11-20 16:01       ` Peter Zijlstra
2026-11-20 16:26         ` Peter Zijlstra
2026-11-20 17:28           ` Sebastian Andrzej Siewior
2026-11-20 17:49             ` Peter Zijlstra
2026-11-23  2:10               ` Tengda Wu
2026-11-23  8:00               ` Sebastian Andrzej Siewior
2026-11-25  8:27                 ` Peter Zijlstra
2026-11-25 10:55                   ` Sebastian Andrzej Siewior
2026-11-25 16:17                     ` Peter Zijlstra
2026-11-25 16:45                       ` Sebastian Andrzej Siewior
2026-11-23  1:17             ` Tengda Wu
2026-11-23  7:54               ` Sebastian Andrzej Siewior
2026-11-19  9:51 ` [PATCH v5 2/2] perf/core: Disable context fast-swap for sigtrap events Tengda Wu
2026-11-19 10:03   ` sashiko-bot
2026-11-19 11:39     ` Tengda Wu
2026-11-19 12:11   ` Sebastian Andrzej Siewior
2026-11-19 12:17     ` Tengda Wu
2026-11-19 13:07       ` Sebastian Andrzej Siewior
2026-11-19 13:19         ` Tengda Wu
2026-11-19 13:48           ` Sebastian Andrzej Siewior
2026-11-20  0:55             ` Tengda Wu
2026-11-20 16:30   ` Peter Zijlstra
2026-11-20 17:06     ` Sebastian Andrzej Siewior
2026-11-20 17:37   ` Peter Zijlstra
2026-11-20 17:46     ` Peter Zijlstra
2026-11-23  3:11       ` Tengda Wu
2026-11-24  8:42         ` Tengda Wu
2026-11-25  9:08           ` Peter Zijlstra
2026-11-25  9:29             ` Tengda Wu
2026-11-25  9:38               ` Peter Zijlstra
2026-11-25 10:03                 ` Tengda Wu
2026-11-25 10:09                   ` Tengda Wu
2026-11-25 13:36                     ` Peter Zijlstra
2026-11-25 16:13                       ` Peter Zijlstra
2026-11-26  1:59                         ` Tengda Wu
2026-11-26 11:01                           ` Peter Zijlstra [this message]
2026-11-26 12:44                         ` [tip: perf/urgent] perf: Fix sigtrap vs fast-switch tip-bot2 for Peter Zijlstra
2026-11-26 12:44                         ` [tip: perf/urgent] perf: Fix sigtrap for software events tip-bot2 for Peter Zijlstra
2026-11-25  9:30             ` [PATCH v5 2/2] perf/core: Disable context fast-swap for sigtrap events Peter Zijlstra

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=20261126110108.GD49833@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --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=wutengda@huaweicloud.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.