summaryrefslogtreecommitdiff
path: root/include/linux/thread_info.h
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2022-01-26 09:40:24 +0100
committerThomas Zimmermann <tzimmermann@suse.de>2022-01-26 09:40:24 +0100
commit48ee4835b73c48590d05a54730dc8037ebd39d3b (patch)
tree84180182d393033da452823cb974880a368e1766 /include/linux/thread_info.h
parent5ec1cebd59300ddd26dbaa96c17c508764eef911 (diff)
parente783362eb54cd99b2cac8b3a9aeac942e6f6ac07 (diff)
Merge drm/drm-fixes into drm-misc-fixes
Backmerging drm/drm-fixes into drm-misc-fixes for v5.17-rc1. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'include/linux/thread_info.h')
-rw-r--r--include/linux/thread_info.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index ad0c4e041030..73a6f34b3847 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -118,6 +118,15 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
return test_bit(flag, (unsigned long *)&ti->flags);
}
+/*
+ * This may be used in noinstr code, and needs to be __always_inline to prevent
+ * inadvertent instrumentation.
+ */
+static __always_inline unsigned long read_ti_thread_flags(struct thread_info *ti)
+{
+ return READ_ONCE(ti->flags);
+}
+
#define set_thread_flag(flag) \
set_ti_thread_flag(current_thread_info(), flag)
#define clear_thread_flag(flag) \
@@ -130,6 +139,11 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
test_and_clear_ti_thread_flag(current_thread_info(), flag)
#define test_thread_flag(flag) \
test_ti_thread_flag(current_thread_info(), flag)
+#define read_thread_flags() \
+ read_ti_thread_flags(current_thread_info())
+
+#define read_task_thread_flags(t) \
+ read_ti_thread_flags(task_thread_info(t))
#ifdef CONFIG_GENERIC_ENTRY
#define set_syscall_work(fl) \