Re: [PATCH v4 2/6] perf: Enqueue SIGTRAP always via task_work.
From: Sebastian Andrzej Siewior
Date: Tue Oct 29 2024 - 13:21:41 EST
On 2024-10-28 13:21:39 [+0100], Frederic Weisbecker wrote:
> Ah the perf_pending_task work is pending but perf_pending_task_sync()
> fails to cancel there:
>
> /*
> * If the task is queued to the current task's queue, we
> * obviously can't wait for it to complete. Simply cancel it.
> */
> if (task_work_cancel(current, head)) {
> event->pending_work = 0;
> local_dec(&event->ctx->nr_no_switch_fast);
> return;
> }
>
> And that's because the work is not anymore on the task work
> list in task->task_works. Instead it's in the executing list
> in task_work_run(). It's a blind spot for task_work_cancel()
> if the current task is already running the task works. And it
> does since it's running the fput delayed work.
>
> Something like this untested?
Tested. Not sure if this is a good idea.
Couldn't we take the ->next pointer and add it to current::task_works
instead?
That patch in ZtYyXG4fYbUdoBpk@xxxxxxxxxxxxx gets rid of that
rcuwait_wait_event().
Sebastian