Re: [PATCH v4 01/39] task_work: Fix TWA_NMI_CURRENT error handling
Steven Rostedt <[email protected]> Tue, 22 Apr 2025 12:14:54 -0400
| Newsgroups | org.kernel.vger.linux-toolchains,org.kernel.vger.linux-kernel,org.kernel.vger.linux-perf-users,org.kernel.vger.linux-trace-kernel |
|---|---|
| Message-ID | <[email protected]> |
/me is resurrecting the sframe work On Wed, 22 Jan 2025 13:28:21 +0100 Peter Zijlstra <[email protected]> wrote: > > The error has to be checked before the write to task->task_works. Also > > the try_cmpxchg() loop isn't needed in NMI context. The TWA_NMI_CURRENT > > case really is special, keep things simple by keeping its code all > > together in one place. > > NMIs can nest, consider #DB (which is NMI like) doing task_work_add() > and getting interrupted with NMI doing the same. > I was looking at this patch and was thinking that the trycmpxchg() is still for the race against other CPUs. Another CPU can add a task_work for this task, right? If so, then even though the NMI adding the task work can't be interrupted (considering there's no #DB and such), it still can clobber an update done for this tasks task_work from another CPU. Is this patch still even needed? -- Steve