* Re: [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT
2021-02-09 16:19 ` Peter Zijlstra
@ 2021-02-09 16:46 ` Mike Galbraith
2021-02-10 13:53 ` [tip: sched/core] sched,x86: Allow !PREEMPT_DYNAMIC tip-bot2 for Peter Zijlstra
2021-02-17 13:17 ` tip-bot2 for Peter Zijlstra
2 siblings, 0 replies; 11+ messages in thread
From: Mike Galbraith @ 2021-02-09 16:46 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: lkml, Michal Hocko, Thomas Gleixner
On Tue, 2021-02-09 at 17:19 +0100, Peter Zijlstra wrote:
> On Tue, Feb 09, 2021 at 05:13:15PM +0100, Peter Zijlstra wrote:
> > On Tue, Feb 09, 2021 at 05:05:14PM +0100, Mike Galbraith wrote:
> >
> > > ld: init/main.o: in function `trace_initcall_start':
> > > /backup/usr/local/src/kernel/linux-tip-rt/./include/trace/events/initcall.h:27: undefined reference to `__SCT__preempt_schedule_notrace'
> >
> > Ooohh... this is because x86 can't build PREEMPT without PREEMPT_DYNAMIC
> > anymore. Maybe I should fix that. Lemme see what that would take.
>
> Does this work?
Yup, worked fine.
-Mike
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip: sched/core] sched,x86: Allow !PREEMPT_DYNAMIC
2021-02-09 16:19 ` Peter Zijlstra
2021-02-09 16:46 ` Mike Galbraith
@ 2021-02-10 13:53 ` tip-bot2 for Peter Zijlstra
2021-02-10 14:18 ` Frederic Weisbecker
2021-02-17 13:17 ` tip-bot2 for Peter Zijlstra
2 siblings, 1 reply; 11+ messages in thread
From: tip-bot2 for Peter Zijlstra @ 2021-02-10 13:53 UTC (permalink / raw)
To: linux-tip-commits
Cc: Mike Galbraith, Peter Zijlstra (Intel), x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 82891be90f3c42dc964fd61b8b2a89de12940c9f
Gitweb: https://git.kernel.org/tip/82891be90f3c42dc964fd61b8b2a89de12940c9f
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Tue, 09 Feb 2021 22:02:33 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 10 Feb 2021 14:44:51 +01:00
sched,x86: Allow !PREEMPT_DYNAMIC
Allow building x86 with PREEMPT_DYNAMIC=n, this is needed for
PREEMPT_RT as it makes no sense to not have full preemption on
PREEMPT_RT.
Fixes: 8c98e8cf723c ("preempt/dynamic: Provide preempt_schedule[_notrace]() static calls")
Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Mike Galbraith <efault@gmx.de>
Link: https://lkml.kernel.org/r/YCK1+JyFNxQnWeXK@hirez.programming.kicks-ass.net
---
arch/x86/include/asm/preempt.h | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h
index 0aa96f8..f8cb8af 100644
--- a/arch/x86/include/asm/preempt.h
+++ b/arch/x86/include/asm/preempt.h
@@ -110,6 +110,13 @@ extern asmlinkage void preempt_schedule_thunk(void);
#define __preempt_schedule_func preempt_schedule_thunk
+extern asmlinkage void preempt_schedule_notrace(void);
+extern asmlinkage void preempt_schedule_notrace_thunk(void);
+
+#define __preempt_schedule_notrace_func preempt_schedule_notrace_thunk
+
+#ifdef CONFIG_PREEMPT_DYNAMIC
+
DECLARE_STATIC_CALL(preempt_schedule, __preempt_schedule_func);
#define __preempt_schedule() \
@@ -118,11 +125,6 @@ do { \
asm volatile ("call " STATIC_CALL_TRAMP_STR(preempt_schedule) : ASM_CALL_CONSTRAINT); \
} while (0)
-extern asmlinkage void preempt_schedule_notrace(void);
-extern asmlinkage void preempt_schedule_notrace_thunk(void);
-
-#define __preempt_schedule_notrace_func preempt_schedule_notrace_thunk
-
DECLARE_STATIC_CALL(preempt_schedule_notrace, __preempt_schedule_notrace_func);
#define __preempt_schedule_notrace() \
@@ -131,6 +133,16 @@ do { \
asm volatile ("call " STATIC_CALL_TRAMP_STR(preempt_schedule_notrace) : ASM_CALL_CONSTRAINT); \
} while (0)
-#endif
+#else /* PREEMPT_DYNAMIC */
+
+#define __preempt_schedule() \
+ asm volatile ("call preempt_schedule_thunk" : ASM_CALL_CONSTRAINT);
+
+#define __preempt_schedule_notrace() \
+ asm volatile ("call preempt_schedule_notrace_thunk" : ASM_CALL_CONSTRAINT);
+
+#endif /* PREEMPT_DYNAMIC */
+
+#endif /* PREEMPTION */
#endif /* __ASM_PREEMPT_H */
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [tip: sched/core] sched,x86: Allow !PREEMPT_DYNAMIC
2021-02-10 13:53 ` [tip: sched/core] sched,x86: Allow !PREEMPT_DYNAMIC tip-bot2 for Peter Zijlstra
@ 2021-02-10 14:18 ` Frederic Weisbecker
2021-02-16 10:38 ` Peter Zijlstra
0 siblings, 1 reply; 11+ messages in thread
From: Frederic Weisbecker @ 2021-02-10 14:18 UTC (permalink / raw)
To: linux-kernel
Cc: linux-tip-commits, Mike Galbraith, Peter Zijlstra (Intel), x86
On Wed, Feb 10, 2021 at 01:53:31PM -0000, tip-bot2 for Peter Zijlstra wrote:
> The following commit has been merged into the sched/core branch of tip:
>
> Commit-ID: 82891be90f3c42dc964fd61b8b2a89de12940c9f
> Gitweb: https://git.kernel.org/tip/82891be90f3c42dc964fd61b8b2a89de12940c9f
> Author: Peter Zijlstra <peterz@infradead.org>
> AuthorDate: Tue, 09 Feb 2021 22:02:33 +01:00
> Committer: Peter Zijlstra <peterz@infradead.org>
> CommitterDate: Wed, 10 Feb 2021 14:44:51 +01:00
>
> sched,x86: Allow !PREEMPT_DYNAMIC
>
> Allow building x86 with PREEMPT_DYNAMIC=n, this is needed for
> PREEMPT_RT as it makes no sense to not have full preemption on
> PREEMPT_RT.
>
> Fixes: 8c98e8cf723c ("preempt/dynamic: Provide preempt_schedule[_notrace]() static calls")
> Reported-by: Mike Galbraith <efault@gmx.de>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Tested-by: Mike Galbraith <efault@gmx.de>
> Link: https://lkml.kernel.org/r/YCK1+JyFNxQnWeXK@hirez.programming.kicks-ass.net
Also should we add something like this?
From 4e1de6d9d8804ea7edc6f8767abea37f5103799a Mon Sep 17 00:00:00 2001
From: Frederic Weisbecker <frederic@kernel.org>
Date: Wed, 10 Feb 2021 15:11:39 +0100
Subject: [PATCH] preempt/dynamic: Make PREEMPT_DYNAMIC optional
In order not to make the small trampoline overhead mandatory for archs
that support HAVE_STATIC_CALL but not HAVE_STATIC_CALL_INLINE, make
PREEMPT_DYNAMIC optional.
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
kernel/Kconfig.preempt | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
index 416017301660..1fe759677907 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/Kconfig.preempt
@@ -40,7 +40,6 @@ config PREEMPT
depends on !ARCH_NO_PREEMPT
select PREEMPTION
select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
- select PREEMPT_DYNAMIC if HAVE_PREEMPT_DYNAMIC
help
This option reduces the latency of the kernel by making
all kernel code (that is not executing in a critical section)
@@ -83,11 +82,13 @@ config PREEMPTION
select PREEMPT_COUNT
config PREEMPT_DYNAMIC
- bool
+ bool "Override preemption flavour at boot time"
+ depends on HAVE_PREEMPT_DYNAMIC && PREEMPT
+ default HAVE_STATIC_CALL_INLINE
help
This option allows to define the preemption model on the kernel
- command line parameter and thus override the default preemption
- model defined during compile time.
+ command line parameter "preempt=" and thus override the default
+ preemption model defined during compile time.
The feature is primarily interesting for Linux distributions which
provide a pre-built kernel binary to reduce the number of kernel
@@ -99,3 +100,5 @@ config PREEMPT_DYNAMIC
Interesting if you want the same pre-built kernel should be used for
both Server and Desktop workloads.
+
+ Say Y if you have CONFIG_HAVE_STATIC_CALL_INLINE.
--
2.25.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [tip: sched/core] sched,x86: Allow !PREEMPT_DYNAMIC
2021-02-10 14:18 ` Frederic Weisbecker
@ 2021-02-16 10:38 ` Peter Zijlstra
0 siblings, 0 replies; 11+ messages in thread
From: Peter Zijlstra @ 2021-02-16 10:38 UTC (permalink / raw)
To: Frederic Weisbecker; +Cc: linux-kernel, linux-tip-commits, Mike Galbraith, x86
On Wed, Feb 10, 2021 at 03:18:38PM +0100, Frederic Weisbecker wrote:
> Also should we add something like this?
I suppose we can do that, but I'd rather have actual numbers to go with
it, I don't think the trampolines are really that terrible.
> From: Frederic Weisbecker <frederic@kernel.org>
> Date: Wed, 10 Feb 2021 15:11:39 +0100
> Subject: [PATCH] preempt/dynamic: Make PREEMPT_DYNAMIC optional
>
> In order not to make the small trampoline overhead mandatory for archs
> that support HAVE_STATIC_CALL but not HAVE_STATIC_CALL_INLINE, make
> PREEMPT_DYNAMIC optional.
>
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> ---
> kernel/Kconfig.preempt | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
> index 416017301660..1fe759677907 100644
> --- a/kernel/Kconfig.preempt
> +++ b/kernel/Kconfig.preempt
> @@ -40,7 +40,6 @@ config PREEMPT
> depends on !ARCH_NO_PREEMPT
> select PREEMPTION
> select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
> - select PREEMPT_DYNAMIC if HAVE_PREEMPT_DYNAMIC
> help
> This option reduces the latency of the kernel by making
> all kernel code (that is not executing in a critical section)
> @@ -83,11 +82,13 @@ config PREEMPTION
> select PREEMPT_COUNT
>
> config PREEMPT_DYNAMIC
> - bool
> + bool "Override preemption flavour at boot time"
> + depends on HAVE_PREEMPT_DYNAMIC && PREEMPT
> + default HAVE_STATIC_CALL_INLINE
> help
> This option allows to define the preemption model on the kernel
> - command line parameter and thus override the default preemption
> - model defined during compile time.
> + command line parameter "preempt=" and thus override the default
> + preemption model defined during compile time.
>
> The feature is primarily interesting for Linux distributions which
> provide a pre-built kernel binary to reduce the number of kernel
> @@ -99,3 +100,5 @@ config PREEMPT_DYNAMIC
>
> Interesting if you want the same pre-built kernel should be used for
> both Server and Desktop workloads.
> +
> + Say Y if you have CONFIG_HAVE_STATIC_CALL_INLINE.
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip: sched/core] sched,x86: Allow !PREEMPT_DYNAMIC
2021-02-09 16:19 ` Peter Zijlstra
2021-02-09 16:46 ` Mike Galbraith
2021-02-10 13:53 ` [tip: sched/core] sched,x86: Allow !PREEMPT_DYNAMIC tip-bot2 for Peter Zijlstra
@ 2021-02-17 13:17 ` tip-bot2 for Peter Zijlstra
2 siblings, 0 replies; 11+ messages in thread
From: tip-bot2 for Peter Zijlstra @ 2021-02-17 13:17 UTC (permalink / raw)
To: linux-tip-commits
Cc: Mike Galbraith, Peter Zijlstra (Intel), Ingo Molnar, x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: c5e6fc08feb2b88dc5dac2f3c817e1c2a4cafda4
Gitweb: https://git.kernel.org/tip/c5e6fc08feb2b88dc5dac2f3c817e1c2a4cafda4
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Tue, 09 Feb 2021 22:02:33 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 17 Feb 2021 14:12:43 +01:00
sched,x86: Allow !PREEMPT_DYNAMIC
Allow building x86 with PREEMPT_DYNAMIC=n, this is needed for
PREEMPT_RT as it makes no sense to not have full preemption on
PREEMPT_RT.
Fixes: 8c98e8cf723c ("preempt/dynamic: Provide preempt_schedule[_notrace]() static calls")
Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Mike Galbraith <efault@gmx.de>
Link: https://lkml.kernel.org/r/YCK1+JyFNxQnWeXK@hirez.programming.kicks-ass.net
---
arch/x86/include/asm/preempt.h | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h
index 0aa96f8..f8cb8af 100644
--- a/arch/x86/include/asm/preempt.h
+++ b/arch/x86/include/asm/preempt.h
@@ -110,6 +110,13 @@ extern asmlinkage void preempt_schedule_thunk(void);
#define __preempt_schedule_func preempt_schedule_thunk
+extern asmlinkage void preempt_schedule_notrace(void);
+extern asmlinkage void preempt_schedule_notrace_thunk(void);
+
+#define __preempt_schedule_notrace_func preempt_schedule_notrace_thunk
+
+#ifdef CONFIG_PREEMPT_DYNAMIC
+
DECLARE_STATIC_CALL(preempt_schedule, __preempt_schedule_func);
#define __preempt_schedule() \
@@ -118,11 +125,6 @@ do { \
asm volatile ("call " STATIC_CALL_TRAMP_STR(preempt_schedule) : ASM_CALL_CONSTRAINT); \
} while (0)
-extern asmlinkage void preempt_schedule_notrace(void);
-extern asmlinkage void preempt_schedule_notrace_thunk(void);
-
-#define __preempt_schedule_notrace_func preempt_schedule_notrace_thunk
-
DECLARE_STATIC_CALL(preempt_schedule_notrace, __preempt_schedule_notrace_func);
#define __preempt_schedule_notrace() \
@@ -131,6 +133,16 @@ do { \
asm volatile ("call " STATIC_CALL_TRAMP_STR(preempt_schedule_notrace) : ASM_CALL_CONSTRAINT); \
} while (0)
-#endif
+#else /* PREEMPT_DYNAMIC */
+
+#define __preempt_schedule() \
+ asm volatile ("call preempt_schedule_thunk" : ASM_CALL_CONSTRAINT);
+
+#define __preempt_schedule_notrace() \
+ asm volatile ("call preempt_schedule_notrace_thunk" : ASM_CALL_CONSTRAINT);
+
+#endif /* PREEMPT_DYNAMIC */
+
+#endif /* PREEMPTION */
#endif /* __ASM_PREEMPT_H */
^ permalink raw reply related [flat|nested] 11+ messages in thread