Files
linux/include/asm-generic/thread_info_tif.h
Thomas Gleixner 32034df66b rseq: Switch to TIF_RSEQ if supported
TIF_NOTIFY_RESUME is a multiplexing TIF bit, which is suboptimal especially
with the RSEQ fast path depending on it, but not really handling it.

Define a separate TIF_RSEQ in the generic TIF space and enable the full
separation of fast and slow path for architectures which utilize that.

That avoids the hassle with invocations of resume_user_mode_work() from
hypervisors, which clear TIF_NOTIFY_RESUME. It makes the therefore required
re-evaluation at the end of vcpu_run() a NOOP on architectures which
utilize the generic TIF space and have a separate TIF_RSEQ.

The hypervisor TIF handling does not include the separate TIF_RSEQ as there
is no point in doing so. The guest does neither know nor care about the VMM
host applications RSEQ state. That state is only relevant when the ioctl()
returns to user space.

The fastpath implementation still utilizes TIF_NOTIFY_RESUME for failure
handling, but this only happens within exit_to_user_mode_loop(), so
arguably the hypervisor ioctl() code is long done when this happens.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/20251027084307.903622031@linutronix.de
2025-11-04 08:35:37 +01:00

52 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_GENERIC_THREAD_INFO_TIF_H_
#define _ASM_GENERIC_THREAD_INFO_TIF_H_
#include <vdso/bits.h>
/* Bits 16-31 are reserved for architecture specific purposes */
#define TIF_NOTIFY_RESUME 0 // callback before returning to user
#define _TIF_NOTIFY_RESUME BIT(TIF_NOTIFY_RESUME)
#define TIF_SIGPENDING 1 // signal pending
#define _TIF_SIGPENDING BIT(TIF_SIGPENDING)
#define TIF_NOTIFY_SIGNAL 2 // signal notifications exist
#define _TIF_NOTIFY_SIGNAL BIT(TIF_NOTIFY_SIGNAL)
#define TIF_MEMDIE 3 // is terminating due to OOM killer
#define _TIF_MEMDIE BIT(TIF_MEMDIE)
#define TIF_NEED_RESCHED 4 // rescheduling necessary
#define _TIF_NEED_RESCHED BIT(TIF_NEED_RESCHED)
#ifdef HAVE_TIF_NEED_RESCHED_LAZY
# define TIF_NEED_RESCHED_LAZY 5 // Lazy rescheduling needed
# define _TIF_NEED_RESCHED_LAZY BIT(TIF_NEED_RESCHED_LAZY)
#endif
#ifdef HAVE_TIF_POLLING_NRFLAG
# define TIF_POLLING_NRFLAG 6 // idle is polling for TIF_NEED_RESCHED
# define _TIF_POLLING_NRFLAG BIT(TIF_POLLING_NRFLAG)
#endif
#define TIF_USER_RETURN_NOTIFY 7 // notify kernel of userspace return
#define _TIF_USER_RETURN_NOTIFY BIT(TIF_USER_RETURN_NOTIFY)
#define TIF_UPROBE 8 // breakpointed or singlestepping
#define _TIF_UPROBE BIT(TIF_UPROBE)
#define TIF_PATCH_PENDING 9 // pending live patching update
#define _TIF_PATCH_PENDING BIT(TIF_PATCH_PENDING)
#ifdef HAVE_TIF_RESTORE_SIGMASK
# define TIF_RESTORE_SIGMASK 10 // Restore signal mask in do_signal() */
# define _TIF_RESTORE_SIGMASK BIT(TIF_RESTORE_SIGMASK)
#endif
#define TIF_RSEQ 11 // Run RSEQ fast path
#define _TIF_RSEQ BIT(TIF_RSEQ)
#endif /* _ASM_GENERIC_THREAD_INFO_TIF_H_ */