[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211025122102.46089-2-frederic@kernel.org>
Date: Mon, 25 Oct 2021 14:20:59 +0200
From: Frederic Weisbecker <frederic@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>,
Ard Biesheuvel <ardb@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Frederic Weisbecker <frederic@...nel.org>,
James Morse <james.morse@....com>,
David Laight <David.Laight@...LAB.COM>,
Quentin Perret <qperret@...gle.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>
Subject: [PATCH 1/4] sched/preempt: Prepare for supporting !CONFIG_GENERIC_ENTRY dynamic preemption
There is no need to force dynamic preemption to depend on the generic
entry code. The latter is convenient but not mandatory. An architecture
that doesn't support it just need to provide a static call on its
kernel IRQ exit preemption path.
Prepare the preempt dynamic code to handle that.
Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
Cc: Mark Rutland <mark.rutland@....com>
Cc: Quentin Perret <qperret@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: James Morse <james.morse@....com>
Cc: Will Deacon <will@...nel.org>
Cc: Ard Biesheuvel <ardb@...nel.org>
Cc: David Laight <David.Laight@...LAB.COM>
---
arch/Kconfig | 1 -
include/linux/entry-common.h | 3 ++-
kernel/sched/core.c | 6 ++++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 8df1c7102643..9af493999d43 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -1255,7 +1255,6 @@ config HAVE_STATIC_CALL_INLINE
config HAVE_PREEMPT_DYNAMIC
bool
depends on HAVE_STATIC_CALL
- depends on GENERIC_ENTRY
help
Select this if the architecture support boot time preempt setting
on top of static calls. It is strongly advised to support inline
diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index 2e2b8d6140ed..81166bbc0f22 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -456,7 +456,8 @@ irqentry_state_t noinstr irqentry_enter(struct pt_regs *regs);
*/
void irqentry_exit_cond_resched(void);
#ifdef CONFIG_PREEMPT_DYNAMIC
-DECLARE_STATIC_CALL(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
+#define __irqentry_exit_cond_resched_func irqentry_exit_cond_resched
+DECLARE_STATIC_CALL(irqentry_exit_cond_resched, __irqentry_exit_cond_resched_func);
#endif
/**
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f2611b9cf503..355722abcd79 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6510,7 +6510,9 @@ EXPORT_STATIC_CALL_TRAMP(preempt_schedule_notrace);
#ifdef CONFIG_PREEMPT_DYNAMIC
+#ifdef CONFIG_GENERIC_ENTRY
#include <linux/entry-common.h>
+#endif
/*
* SC:cond_resched
@@ -6575,7 +6577,7 @@ void sched_dynamic_update(int mode)
static_call_update(might_resched, __cond_resched);
static_call_update(preempt_schedule, __preempt_schedule_func);
static_call_update(preempt_schedule_notrace, __preempt_schedule_notrace_func);
- static_call_update(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
+ static_call_update(irqentry_exit_cond_resched, __irqentry_exit_cond_resched_func);
switch (mode) {
case preempt_dynamic_none:
@@ -6601,7 +6603,7 @@ void sched_dynamic_update(int mode)
static_call_update(might_resched, (void *)&__static_call_return0);
static_call_update(preempt_schedule, __preempt_schedule_func);
static_call_update(preempt_schedule_notrace, __preempt_schedule_notrace_func);
- static_call_update(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
+ static_call_update(irqentry_exit_cond_resched, __irqentry_exit_cond_resched_func);
pr_info("Dynamic Preempt: full\n");
break;
}
--
2.25.1
Powered by blists - more mailing lists