From: "David Wang" <00107082@163.com>
To: "Yeoreum Yun" <yeoreum.yun@arm.com>
Cc: peterz@infradead.org, mingo@redhat.com, mingo@kernel.org,
acme@kernel.org, namhyung@kernel.org, leo.yan@arm.com,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] perf/core: fix dangling cgroup pointer in cpuctx
Date: Tue, 3 Jun 2025 22:02:03 +0800 (CST) [thread overview]
Message-ID: <45723708.beca.197361963d8.Coremail.00107082@163.com> (raw)
In-Reply-To: <aD77ih5zOrZyXVit@e129823.arm.com>
At 2025-06-03 21:41:30, "Yeoreum Yun" <yeoreum.yun@arm.com> wrote:
>Hi David,
>
>> >
>> > > But to fix it, isn't following change less aggressive?
>> > > event_sched_out(event, ctx);
>> > > - perf_event_set_state(event, min(event->state, state));
>> > > if (flags & DETACH_GROUP)
>> > > perf_group_detach(event);
>> > > if (flags & DETACH_CHILD)
>> > > perf_child_detach(event);
>> > > list_del_event(event, ctx);
>> > > + perf_event_set_state(event, min(event->state, state));
>> >
>> > If perf_child_detach() is called first and perf_event_set_state() call,
>> > since the parent is removed in perf_child_detatced,
>> > It would be failed to account the total_enable_time which caculating
>> > child_event's enable_time too.
>>
>> Thanks for clarifying this,
>> So the whole point in commit a3c3c6667 is to make perf_event_set_state() happens before perf_child_detach(), right?
>> I feel I got lost somewhere when I rush to this suggestion. But I still don't understand why my patchv1 breaks commit
>> a3c3c6667, really confused.
>
>I explained this in:
> https://lore.kernel.org/all/5d17f1d7.666d.197348b78d1.Coremail.00107082@163.com/
>
>>> If there is specific child cpu event specified in cpu 0.
>>> 1. cpu 0 -> active
>>> 2. scheulded to cpu1 -> inactive
>>> 3. close the cpu event from parent -> inactive close
>>>
>>> Can be failed to count total_enable_time.
>
>
>Consider one event which attached to taskctx with specific cpu.
>In case of your original patch is for only "DETACH_EXIT" case.
>Here what I mean, the event is "closed".
>In this case, based on your patch, it doesn't call the perf_event_set_state()
>before list_del_event(), but perf_event_set_state() is called after list_del_event().
Do you mean in this case, the event is not passed to perf_event_exit_event()?
Because in my mind, as long as a event reach perf_event_exit_event, DETACH_EXIT flag would always be set.
perf_event_exit_event()
---> perf_remove_from_context(event, detach_flags | DETACH_EXIT); <---
---> __perf_remove_from_context
----> perf_event_set_state (DETACH_EXIT is always set in this call path)
----> list_del_event
So I am still confused, even with cpu switch, the DETACH_EXIT flag is still there.
Could you explain it with a callchain?
Thanks
David
>
>Thanks
>
>--
>Sincerely,
>Yeoreum Yun
next prev parent reply other threads:[~2025-06-03 14:03 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 18:40 [PATCH 1/1] perf/core: fix dangling cgroup pointer in cpuctx Yeoreum Yun
2025-06-03 2:01 ` David Wang
2025-06-03 4:46 ` [PATCH " Yeoreum Yun
2025-06-03 5:44 ` David Wang
2025-06-03 6:34 ` Yeoreum Yun
2025-06-03 6:39 ` Yeoreum Yun
2025-06-03 6:47 ` David Wang
2025-06-03 6:42 ` David Wang
2025-06-03 7:16 ` Yeoreum Yun
2025-06-03 7:31 ` David Wang
2025-06-03 8:15 ` David Wang
2025-06-03 6:54 ` David Wang
2025-06-03 9:20 ` Yeoreum Yun
2025-06-03 10:08 ` David Wang
2025-06-03 13:41 ` Yeoreum Yun
2025-06-03 14:02 ` David Wang [this message]
2025-06-03 14:00 ` Leo Yan
2025-06-03 14:44 ` Peter Zijlstra
2025-06-03 15:17 ` Yeoreum Yun
2025-06-04 7:06 ` Peter Zijlstra
2025-06-04 8:03 ` Peter Zijlstra
2025-06-04 10:06 ` Yeoreum Yun
2025-06-04 12:37 ` Peter Zijlstra
2025-06-04 12:54 ` Yeoreum Yun
2025-06-04 10:18 ` Leo Yan
2025-06-04 13:58 ` Peter Zijlstra
2025-06-04 15:17 ` Leo Yan
2025-06-11 9:29 ` [tip: perf/urgent] perf: Add comment to enum perf_event_state tip-bot2 for Peter Zijlstra
2025-06-04 14:16 ` [PATCH 1/1] perf/core: fix dangling cgroup pointer in cpuctx Peter Zijlstra
2025-06-04 15:46 ` Leo Yan
2025-06-04 15:59 ` Peter Zijlstra
2025-06-05 11:29 ` Peter Zijlstra
2025-06-05 12:33 ` Peter Zijlstra
2025-06-05 17:21 ` Leo Yan
2025-06-11 9:29 ` [tip: perf/urgent] perf: Fix cgroup state vs ERROR tip-bot2 for Peter Zijlstra
2025-06-05 11:41 ` [PATCH 1/1] perf/core: fix dangling cgroup pointer in cpuctx Peter Zijlstra
2025-06-03 15:05 ` Yeoreum Yun
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=45723708.beca.197361963d8.Coremail.00107082@163.com \
--to=00107082@163.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=yeoreum.yun@arm.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.