* [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT
@ 2021-02-09 13:45 Mike Galbraith
2021-02-09 15:13 ` Peter Zijlstra
0 siblings, 1 reply; 11+ messages in thread
From: Mike Galbraith @ 2021-02-09 13:45 UTC (permalink / raw)
To: lkml; +Cc: Peter Zijlstra, Michal Hocko
PREEMPT_RT and PREEMPT both needs PREEMPT_DYNAMIC to build, so move
selection of PREEMPT_DYNAMIC to the common denominator, PREEMPTION.
Signed-off-by: Mike Galbraith <efault@gmx.de>
---
kernel/Kconfig.preempt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- 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)
@@ -81,6 +80,7 @@ config PREEMPT_COUNT
config PREEMPTION
bool
select PREEMPT_COUNT
+ select PREEMPT_DYNAMIC if HAVE_PREEMPT_DYNAMIC
config PREEMPT_DYNAMIC
bool
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT
2021-02-09 13:45 [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT Mike Galbraith
@ 2021-02-09 15:13 ` Peter Zijlstra
2021-02-09 16:05 ` Mike Galbraith
0 siblings, 1 reply; 11+ messages in thread
From: Peter Zijlstra @ 2021-02-09 15:13 UTC (permalink / raw)
To: Mike Galbraith; +Cc: lkml, Michal Hocko, Thomas Gleixner
On Tue, Feb 09, 2021 at 02:45:37PM +0100, Mike Galbraith wrote:
>
> PREEMPT_RT and PREEMPT both needs PREEMPT_DYNAMIC to build, so move
> selection of PREEMPT_DYNAMIC to the common denominator, PREEMPTION.
I'm confused, why would you want PREEMPT_DYNAMIC for PREEMPT_RT ?
PREEMPT_RT without full preemption is just plain daft, no?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT
2021-02-09 15:13 ` Peter Zijlstra
@ 2021-02-09 16:05 ` Mike Galbraith
2021-02-09 16:13 ` Peter Zijlstra
0 siblings, 1 reply; 11+ messages in thread
From: Mike Galbraith @ 2021-02-09 16:05 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: lkml, Michal Hocko, Thomas Gleixner
On Tue, 2021-02-09 at 16:13 +0100, Peter Zijlstra wrote:
> On Tue, Feb 09, 2021 at 02:45:37PM +0100, Mike Galbraith wrote:
> >
> > PREEMPT_RT and PREEMPT both needs PREEMPT_DYNAMIC to build, so move
> > selection of PREEMPT_DYNAMIC to the common denominator, PREEMPTION.
>
> I'm confused, why would you want PREEMPT_DYNAMIC for
> PREEMPT_RT ?
>
> PREEMPT_RT without full preemption is just plain daft, no?
If you turn on PREEMPT, PREEMPT_DYNAMIC is selected because
HAVE_PREEMPT_DYNAMIC is true.
homer:..kernel/linux-tip # grep PREEMPT .config
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
CONFIG_PREEMPT=y
CONFIG_PREEMPT_COUNT=y
CONFIG_PREEMPTION=y
CONFIG_PREEMPT_DYNAMIC=y
CONFIG_PREEMPT_RCU=y
CONFIG_HAVE_PREEMPT_DYNAMIC=y
CONFIG_PREEMPT_NOTIFIERS=y
CONFIG_DRM_I915_PREEMPT_TIMEOUT=640
CONFIG_DEBUG_PREEMPT=y
# CONFIG_PREEMPT_TRACER is not set
# CONFIG_PREEMPTIRQ_DELAY_TEST is not set
Now over to tip-rt, with patchlet...
homer:..kernel/linux-tip-rt # grep PREEMPT .config
CONFIG_HAVE_PREEMPT_LAZY=y
CONFIG_PREEMPT_LAZY=y
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_PREEMPT_RT=y
CONFIG_PREEMPT_COUNT=y
CONFIG_PREEMPTION=y
CONFIG_PREEMPT_DYNAMIC=y
CONFIG_PREEMPT_RCU=y
CONFIG_HAVE_PREEMPT_DYNAMIC=y
CONFIG_PREEMPT_NOTIFIERS=y
CONFIG_DRM_I915_PREEMPT_TIMEOUT=640
CONFIG_DEBUG_PREEMPT=y
# CONFIG_PREEMPT_TRACER is not set
# CONFIG_PREEMPTIRQ_DELAY_TEST is not set
...tree builds/runs. Pop patchlet, and...
LD vmlinux.o
MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
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'
ld: init/main.o: in function `trace_initcall_finish':
/backup/usr/local/src/kernel/linux-tip-rt/./include/trace/events/initcall.h:48: undefined reference to `__SCT__preempt_schedule_notrace'
ld: init/main.o: in function `trace_initcall_level':
/backup/usr/local/src/kernel/linux-tip-rt/./include/trace/events/initcall.h:10: undefined reference to `__SCT__preempt_schedule_notrace'
ld: init/main.o:(.static_call_sites+0x4): undefined reference to `__SCK__preempt_schedule_notrace'
ld: init/main.o:(.static_call_sites+0x14): undefined reference to `__SCK__preempt_schedule_notrace'
ld: init/main.o:(.static_call_sites+0x24): undefined reference to `__SCK__preempt_schedule_notrace'
ld: arch/x86/entry/vsyscall/vsyscall_64.o: in function `trace_emulate_vsyscall':
/backup/usr/local/src/kernel/linux-tip-rt/arch/x86/entry/vsyscall/vsyscall_trace.h:10: undefined reference to `__SCT__preempt_schedule_notrace'
ld: arch/x86/entry/vsyscall/vsyscall_64.o:(.static_call_sites+0x4): undefined reference to `__SCK__preempt_schedule_notrace'
ld: arch/x86/events/amd/ibs.o: in function `ibs_eilvt_valid':
/backup/usr/local/src/kernel/linux-tip-rt/arch/x86/events/amd/ibs.c:865: undefined reference to `__SCT__preempt_schedule'
ld: arch/x86/events/amd/ibs.o: in function `force_ibs_eilvt_setup':
/backup/usr/local/src/kernel/linux-tip-rt/arch/x86/events/amd/ibs.c:923: undefined reference to `__SCT__preempt_schedule'
ld: /backup/usr/local/src/kernel/linux-tip-rt/arch/x86/events/amd/ibs.c:943: undefined reference to `__SCT__preempt_schedule'
ld: arch/x86/events/amd/ibs.o: in function `ibs_eilvt_valid':
/backup/usr/local/src/kernel/linux-tip-rt/arch/x86/events/amd/ibs.c:865: undefined reference to `__SCT__preempt_schedule'
...
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT
2021-02-09 16:05 ` Mike Galbraith
@ 2021-02-09 16:13 ` Peter Zijlstra
2021-02-09 16:19 ` Peter Zijlstra
2021-02-09 16:27 ` [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT Mike Galbraith
0 siblings, 2 replies; 11+ messages in thread
From: Peter Zijlstra @ 2021-02-09 16:13 UTC (permalink / raw)
To: Mike Galbraith; +Cc: lkml, Michal Hocko, Thomas Gleixner
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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT
2021-02-09 16:13 ` Peter Zijlstra
@ 2021-02-09 16:19 ` Peter Zijlstra
2021-02-09 16:46 ` Mike Galbraith
` (2 more replies)
2021-02-09 16:27 ` [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT Mike Galbraith
1 sibling, 3 replies; 11+ messages in thread
From: Peter Zijlstra @ 2021-02-09 16:19 UTC (permalink / raw)
To: Mike Galbraith; +Cc: lkml, Michal Hocko, Thomas Gleixner
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?
---
diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h
index 0aa96f824af1..f8cb8af4de5c 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: [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT
2021-02-09 16:13 ` Peter Zijlstra
2021-02-09 16:19 ` Peter Zijlstra
@ 2021-02-09 16:27 ` Mike Galbraith
1 sibling, 0 replies; 11+ messages in thread
From: Mike Galbraith @ 2021-02-09 16:27 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: lkml, Michal Hocko, Thomas Gleixner
On Tue, 2021-02-09 at 17:13 +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.
Uhoh, looks like something a lot worse managed to sneak into master.
While test-driving that tip-rt build, I couldn't help noticing that
evolution is going mad, chewing cpu and being useless enough that I
couldn't reply to you. Unfortunately, it ain't my tip-rt tree, nor is
it virgin tip, the evilness is present in virgin master, but not in
5.10 stable. Hohum, a hunting I shall go I suppose.
-Mike
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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
end of thread, other threads:[~2021-02-17 13:19 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 13:45 [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT Mike Galbraith
2021-02-09 15:13 ` Peter Zijlstra
2021-02-09 16:05 ` Mike Galbraith
2021-02-09 16:13 ` Peter Zijlstra
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-10 14:18 ` Frederic Weisbecker
2021-02-16 10:38 ` Peter Zijlstra
2021-02-17 13:17 ` tip-bot2 for Peter Zijlstra
2021-02-09 16:27 ` [patch] preempt: select PREEMPT_DYNAMIC under PREEMPTION instead of PREEMPT Mike Galbraith
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.