From: sashiko-bot@kernel.org
To: "Thomas Richter" <tmricht@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH] perf/core: Allow list_del during perf_event_overflow()
Date: Mon, 07 Sep 2026 10:39:02 +0000 [thread overview]
Message-ID: <20260907103903.15CF51F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907103219.3006700-1-tmricht@linux.ibm.com>
> A PMU might use perf_sched_cb_inc() and perf_sched_cb_dec()
> interface to get the PMU call back function pmu::sched_task
> invoked at schedule in and schedule out. This is achieved
> by walking along the list anchored by sched_cb_list.
>
> The following scenario might lead to a list corruption.
>
> perf_pmu_sched_task()
> for_each_list_entry(..., &sched_cb_list)
> +--> __perf_pmu_sched_task()
> +--> event->pmu->sched_task())
> +--> PMU_push_sample()
> +--> perf_event_overflow()
> +--> __perf_event_overflow()
> +--> pmu->stop()
> +--> perf_sched_cb_dec()
> remove entry from sched_cb_list
> while list node in use.
>
> This happens when ioctl(fd, PERF_EVENT_IOC_REFRESH, xxx) has been
> invoked and perf_event::event_limit hits zero.
>
> Prevent the list corruption and convert for_each_list_entry()
> to for_each_list_entry_safe().
>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907103219.3006700-1-tmricht@linux.ibm.com?part=1
prev parent reply other threads:[~2026-09-07 10:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 10:32 [PATCH] perf/core: Allow list_del during perf_event_overflow() Thomas Richter
2026-09-07 10:39 ` sashiko-bot [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=20260907103903.15CF51F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tmricht@linux.ibm.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.