[PATCH RFC 05/12] entry/idle: Enter and exit kernel protection during idle entry and exit
From: Joel Fernandes (Google)
Date: Sat Aug 15 2020 - 17:57:12 EST
Make use of the generic_idle_{enter,exit} helper function added in
earlier patches to enter and exit kernel protection.
On exiting idle, protection will be reenabled.
Signed-off-by: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx>
---
include/linux/entry-common.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index 2ea0e09b00d5..c833f2fda542 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -374,6 +374,9 @@ void noinstr irqentry_exit(struct pt_regs *regs, irqentry_state_t state);
*/
static inline void generic_idle_enter(void)
{
+ /* Entering idle ends the protected kernel region. */
+ sched_core_unsafe_exit();
+
rcu_idle_enter();
}
@@ -383,6 +386,9 @@ static inline void generic_idle_enter(void)
static inline void generic_idle_exit(void)
{
rcu_idle_exit();
+
+ /* Exiting idle (re)starts the protected kernel region. */
+ sched_core_unsafe_enter();
}
#endif
--
2.28.0.220.ged08abb693-goog