mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Aditya Chillara <aditya.chillara@oss.qualcomm.com>
Cc: Daniel Wade <danjwade95@gmail.com>,
	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>,
	Kyle Zeng <kylebot@openai.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] perf: Reject group leaders detached by CPU hot-unplug
Date: Thu, 19 Nov 2026 10:19:42 +0100	[thread overview]
Message-ID: <20261119091942.GP2668804@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <06758809-6748-4f7b-b7e6-c862936a961c@oss.qualcomm.com>

On Thu, Nov 19, 2026 at 02:24:19PM +0530, Aditya Chillara wrote:

>                           task already asleep in poll()   a fresh poll()
>   before your patch       stays asleep                    no data
>   your patch              stays asleep                    EPOLLHUP
>   your patch + wakeup     woken, sees EPOLLHUP            EPOLLHUP
> 
> perf_event_exit_event() kicks perf_poll() with perf_event_wakeup() after
> moving events to EXIT, but this path doesn't, so a task already sleeping
> in poll() is not woken and only sees EPOLLHUP when its timeout runs out.
> 
> Deferring the wakeup to the event's irq_work, as merge_sched_in() does,
> seems enough. Something like this, on top of your patch:
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index c1f3e1f013ec..885b6594139a 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -15350,6 +15350,9 @@ static void __perf_event_exit_context(void *__info)
>  	list_for_each_entry(event, &ctx->event_list, event_entry) {
>  		__perf_remove_from_context(event, cpuctx, ctx,
>  					   (void *)(DETACH_EXIT | DETACH_GROUP));
> +		/* Kick perf_poll() for is_event_hup(). */
> +		event->pending_wakeup = 1;
> +		irq_work_queue(&event->pending_irq);
>  	}
>  	raw_spin_unlock(&ctx->lock);
>  }

Yeah, I suppose that makes sense.

      reply	other threads:[~2026-11-19  9:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  1:47 Daniel Wade
2026-11-19  8:54 ` Aditya Chillara
2026-11-19  9:19   ` Peter Zijlstra [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=20261119091942.GP2668804@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=aditya.chillara@oss.qualcomm.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=danjwade95@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kylebot@openai.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 \
    /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®