Re: [PATCH v2] perf/core: restore __perf_remove_from_context when DETACH_EXIT not set

From: Peter Zijlstra
Date: Tue Jun 03 2025 - 08:51:11 EST


On Tue, Jun 03, 2025 at 06:44:58PM +0800, David Wang wrote:


> (As yeoreum.yun@xxxxxxx 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.

> My suggestion here is to confine the effect of commit a3c3c66670ce only to call chain
> perf_event_exit_event() --> __perf_remove_from_context()
>
>
> (But this v2 version is totally wrong, should be ignored; it breaks commit a3c3c66670ce)

Right. Because we moved that state update earlier because
perf_child_detach() wants up-to-date timestamps.