diff options
| author | Sebastian Andrzej Siewior <[email protected]> | 2024-07-04 19:03:36 +0200 |
|---|---|---|
| committer | Peter Zijlstra <[email protected]> | 2024-07-09 13:26:34 +0200 |
| commit | 466e4d801cd438a1ab2c8a2cce1bef6b65c31bbb (patch) | |
| tree | 4608ba4395cb65142ba8974a900a0b9f85bded78 /include/linux | |
| parent | 058244c683111d44a5de16ac74f19a1754dd7a0c (diff) | |
task_work: Add TWA_NMI_CURRENT as an additional notify mode.
Adding task_work from NMI context requires the following:
- The kasan_record_aux_stack() is not NMU safe and must be avoided.
- Using TWA_RESUME is NMI safe. If the NMI occurs while the CPU is in
userland then it will continue in userland and not invoke the `work'
callback.
Add TWA_NMI_CURRENT as an additional notify mode. In this mode skip
kasan and use irq_work in hardirq-mode to for needed interrupt. Set
TIF_NOTIFY_RESUME within the irq_work callback due to k[ac]san
instrumentation in test_and_set_bit() which does not look NMI safe in
case of a report.
Suggested-by: Peter Zijlstra <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/task_work.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/task_work.h b/include/linux/task_work.h index 26b8a47f41fc..cf5e7e891a77 100644 --- a/include/linux/task_work.h +++ b/include/linux/task_work.h @@ -18,6 +18,7 @@ enum task_work_notify_mode { TWA_RESUME, TWA_SIGNAL, TWA_SIGNAL_NO_IPI, + TWA_NMI_CURRENT, }; static inline bool task_work_pending(struct task_struct *task) |