Skip to content

Commit b1fcf9b

Browse files
committed
rcu: Provide __rcu_is_watching()
Same as rcu_is_watching() but without the preempt_disable/enable() pair inside the function. It is merked noinstr so it ends up in the non-instrumentable text section. This is useful for non-preemptible code especially in the low level entry section. Using rcu_is_watching() there results in a call to the preempt_schedule_notrace() thunk which triggers noinstr section warnings in objtool. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 8ae0ae6 commit b1fcf9b

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

include/linux/rcutiny.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ static inline void rcu_scheduler_starting(void) { }
8686
static inline void rcu_end_inkernel_boot(void) { }
8787
static inline bool rcu_inkernel_boot_has_ended(void) { return true; }
8888
static inline bool rcu_is_watching(void) { return true; }
89+
static inline bool __rcu_is_watching(void) { return true; }
8990
static inline void rcu_momentary_dyntick_idle(void) { }
9091
static inline void kfree_rcu_scheduler_running(void) { }
9192
static inline bool rcu_gp_might_be_stalled(void) { return false; }

include/linux/rcutree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ extern int rcu_scheduler_active __read_mostly;
5858
void rcu_end_inkernel_boot(void);
5959
bool rcu_inkernel_boot_has_ended(void);
6060
bool rcu_is_watching(void);
61+
bool __rcu_is_watching(void);
6162
#ifndef CONFIG_PREEMPTION
6263
void rcu_all_qs(void);
6364
#endif

kernel/rcu/tree.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,11 @@ static void rcu_disable_urgency_upon_qs(struct rcu_data *rdp)
985985
}
986986
}
987987

988+
noinstr bool __rcu_is_watching(void)
989+
{
990+
return !rcu_dynticks_curr_cpu_in_eqs();
991+
}
992+
988993
/**
989994
* rcu_is_watching - see if RCU thinks that the current CPU is not idle
990995
*

0 commit comments

Comments
 (0)