Skip to content

Commit f6cdaeb

Browse files
committed
Merge tag 'core_urgent_for_v6.3_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core fixes from Borislav Petkov: - Do the delayed RCU wakeup for kthreads in the proper order so that former doesn't get ignored - A noinstr warning fix * tag 'core_urgent_for_v6.3_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up entry: Fix noinstr warning in __enter_from_user_mode()
2 parents 986c637 + b416514 commit f6cdaeb

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

include/linux/context_tracking.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static inline void user_exit_irqoff(void) { }
9696
static inline int exception_enter(void) { return 0; }
9797
static inline void exception_exit(enum ctx_state prev_ctx) { }
9898
static inline int ct_state(void) { return -1; }
99+
static inline int __ct_state(void) { return -1; }
99100
static __always_inline bool context_tracking_guest_enter(void) { return false; }
100101
static inline void context_tracking_guest_exit(void) { }
101102
#define CT_WARN_ON(cond) do { } while (0)

include/linux/context_tracking_state.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ struct context_tracking {
4646

4747
#ifdef CONFIG_CONTEXT_TRACKING
4848
DECLARE_PER_CPU(struct context_tracking, context_tracking);
49+
#endif
4950

51+
#ifdef CONFIG_CONTEXT_TRACKING_USER
5052
static __always_inline int __ct_state(void)
5153
{
5254
return arch_atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_STATE_MASK;

kernel/entry/common.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static __always_inline void __enter_from_user_mode(struct pt_regs *regs)
2121
arch_enter_from_user_mode(regs);
2222
lockdep_hardirqs_off(CALLER_ADDR0);
2323

24-
CT_WARN_ON(ct_state() != CONTEXT_USER);
24+
CT_WARN_ON(__ct_state() != CONTEXT_USER);
2525
user_exit_irqoff();
2626

2727
instrumentation_begin();
@@ -192,13 +192,14 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
192192

193193
static void exit_to_user_mode_prepare(struct pt_regs *regs)
194194
{
195-
unsigned long ti_work = read_thread_flags();
195+
unsigned long ti_work;
196196

197197
lockdep_assert_irqs_disabled();
198198

199199
/* Flush pending rcuog wakeup before the last need_resched() check */
200200
tick_nohz_user_enter_prepare();
201201

202+
ti_work = read_thread_flags();
202203
if (unlikely(ti_work & EXIT_TO_USER_MODE_WORK))
203204
ti_work = exit_to_user_mode_loop(regs, ti_work);
204205

0 commit comments

Comments
 (0)