Re: [PATCH 0/4 v3] perf: Fix leaked sigtrap events

From: Frederic Weisbecker
Date: Sat Jun 01 2024 - 09:35:42 EST


Le Fri, May 31, 2024 at 01:25:26PM -0300, Arnaldo Carvalho de Melo a écrit :
> With Frederic's patchset:
>
> [acme@nine linux]$ b4 am -ctsl --cc-trailers 20240516140936.13694-1-frederic@xxxxxxxxxx
> Grabbing thread from lore.kernel.org/all/20240516140936.13694-1-frederic@xxxxxxxxxx/t.mbox.gz
> Checking for newer revisions
> Grabbing search results from lore.kernel.org
> Analyzing 5 messages in the thread
> Looking for additional code-review trailers on lore.kernel.org
> <SNIP>
> Total patches: 4
> ---
> Cover: ./v3_20240516_frederic_perf_fix_leaked_sigtrap_events.cover
> Link: https://lore.kernel.org/r/20240516140936.13694-1-frederic@xxxxxxxxxx
> Base: not specified
> git am ./v3_20240516_frederic_perf_fix_leaked_sigtrap_events.mbx
> [acme@nine linux]$ git am ./v3_20240516_frederic_perf_fix_leaked_sigtrap_events.mbx
> Applying: task_work: s/task_work_cancel()/task_work_cancel_func()/
> Applying: task_work: Introduce task_work_cancel() again
> Applying: perf: Fix event leak upon exit
> Applying: perf: Fix event leak upon exec and file release
> [acme@nine linux]$
>
> [acme@nine linux]$ git log --oneline -9
> 1f88fa6e3adb (HEAD -> linux-rt-devel-6.10.y-rt-sigtrap-fix-frederic-v3) perf: Fix event leak upon exec and file release
> 44cde14a096c perf: Fix event leak upon exit
> 512f8f5cbaed task_work: Introduce task_work_cancel() again
> e7bee294ec69 task_work: s/task_work_cancel()/task_work_cancel_func()/
> 4de7b8e17201 Revert "perf: Move irq_work_queue() where the event is prepared."
> 5efa195af234 Revert "perf: Enqueue SIGTRAP always via task_work."
> 26ac4dfa180a Revert "perf: Remove perf_swevent_get_recursion_context() from perf_pending_task()."
> c2fb5208a68e Revert "perf: Split __perf_pending_irq() out of perf_pending_irq()"
> 6d20efa57a89 (tag: v6.10-rc1-rt1-rebase, tag: v6.10-rc1-rt1, linux-rt-devel/linux-6.10.y-rt-rebase, linux-rt-devel/linux-6.10.y-rt, linux-rt-devel/for-kbuild-bot/prepare-release, linux-rt-devel/for-kbuild-bot/current-stable) Add localversion for -RT release
> [acme@nine linux]$
>
> The workload that is used to do that, as a reminder, is 'perf test sigtrap'.
>
> [ 121.217475] BUG: scheduling while atomic: perf/7955/0x00000002
> [ 121.217478] BUG: scheduling while atomic: perf/7956/0x00000002
> <SNIP list of modules>
> [ 121.217492] BUG: scheduling while atomic: perf/7954/0x00000002
> <SNIP list of modules>
> [ 121.217570] Preemption disabled at:
> <SNIP>
> [ 121.217571] [<0000000000000000>] 0x0
> <SNIP>
> [ 121.217609] Preemption disabled at:
> <SNIP>
> [ 121.217610] [<0000000000000000>] 0x0

Right because my patchset doesn't fix the pre-existing RT issue where
perf_sigtrap takes a sleeping lock while preemption is disabled. Sebastian
will need to rebase on top of this patchset and then also convert the perf
recursion context to be per task on RT to avoid preemption disablement.

Thanks.