Linux Perf Users
 help / color / mirror / Atom feed
From: Yeoreum Yun <yeoreum.yun@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: David Wang <00107082@163.com>,
	mingo@redhat.com, acme@kernel.org, namhyung@kernel.org,
	mingo@kernel.org, leo.yan@arm.com,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] perf/core: restore __perf_remove_from_context when DETACH_EXIT not set
Date: Tue, 3 Jun 2025 14:22:37 +0100	[thread overview]
Message-ID: <aD73Hf6Q7rjfCFAC@e129823.arm.com> (raw)
In-Reply-To: <20250603125440.GA35970@noisy.programming.kicks-ass.net>

Hi Peter,

> On Tue, Jun 03, 2025 at 02:50:56PM +0200, Peter Zijlstra wrote:
> > On Tue, Jun 03, 2025 at 06:44:58PM +0800, David Wang wrote:
> >
> >
> > > (As yeoreum.yun@arm.com pointed out,  the change in perf_remove_from_context() made
> > > perf_event_set_state() happened before list_del_event(), resulting in perf_cgroup_event_disable()
> > > not called.)
> >
> > Aah, d'0h. Let me see what we should do there.
>
> Does this help? This way event_sched_out() will call
> perf_cgroup_event_disable().
>
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index f34c99f8ce8f..adbb0372825f 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -2494,9 +2494,9 @@ __perf_remove_from_context(struct perf_event *event,
>  	if (flags & DETACH_REVOKE)
>  		state = PERF_EVENT_STATE_REVOKED;
>  	if (flags & DETACH_DEAD) {
> -		event->pending_disable = 1;
>  		state = PERF_EVENT_STATE_DEAD;
>  	}
> +	event->pending_disable = 1;

I think it would break if event->state is "PERF_EVENT_STATE_ERROR".

TBH, there is the patch to solve this problem:
  https://lore.kernel.org/all/20250602184049.4010919-1-yeoreum.yun@arm.com/

Does it have a problem?

Thanks.

--
Sincerely,
Yeoreum Yun

  parent reply	other threads:[~2025-06-03 13:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-03  3:26 [PATCH] perf/core: restore __perf_remove_from_context when DETACH_EXIT not set David Wang
2025-06-03  8:33 ` [PATCH v2] " David Wang
2025-06-03  9:13   ` Peter Zijlstra
2025-06-03 10:44     ` David Wang
2025-06-03 12:50       ` Peter Zijlstra
2025-06-03 12:54         ` Peter Zijlstra
2025-06-03 13:03           ` David Wang
2025-06-03 13:49             ` David Wang
2025-06-03 13:22           ` Yeoreum Yun [this message]
2025-06-03 14:08             ` 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=aD73Hf6Q7rjfCFAC@e129823.arm.com \
    --to=yeoreum.yun@arm.com \
    --cc=00107082@163.com \
    --cc=acme@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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