* [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible
@ 2025-07-10 2:58 kernel test robot
2025-07-10 3:18 ` Chen, Yu C
0 siblings, 1 reply; 12+ messages in thread
From: kernel test robot @ 2025-07-10 2:58 UTC (permalink / raw)
To: Ingo Molnar
Cc: oe-lkp, lkp, linux-kernel, x86, Peter Zijlstra, Dietmar Eggemann,
Juri Lelli, Linus Torvalds, Mel Gorman, Sebastian Andrzej Siewior,
Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li, yu.c.chen, oliver.sang
Hello,
kernel test robot noticed "BUG:using_smp_processor_id()in_preemptible" on:
commit: 06ddd17521bf11a3e7f59dafdf5c148f29467d2c ("sched/smp: Always define is_percpu_thread() and scheduler_ipi()")
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git sched/core
[test failed on linux-next/master 835244aba90de290b4b0b1fa92b6734f3ee7b3d9]
in testcase: boot
config: x86_64-randconfig-123-20250702
compiler: gcc-12
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
(please refer to attached dmesg/kmsg for entire log/backtrace)
+----------------------------------------------------------+------------+------------+
| | cac5cefbad | 06ddd17521 |
+----------------------------------------------------------+------------+------------+
| boot_successes | 20 | 0 |
| boot_failures | 0 | 18 |
| BUG:using_smp_processor_id()in_preemptible | 0 | 18 |
| BUG:using__this_cpu_write()in_preemptible[#]code:swapper | 0 | 18 |
| BUG:using__this_cpu_read()in_preemptible | 0 | 18 |
+----------------------------------------------------------+------------+------------+
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202507100448.6b88d6f1-lkp@intel.com
[ 25.232998][ T1] BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
[ 25.233645][ T1] caller is __kvm_is_vmx_supported (arch/x86/include/asm/cpuid/api.h:74 arch/x86/include/asm/cpuid/api.h:113 arch/x86/kvm/vmx/vmx.c:2789)
[ 25.234128][ T1] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.16.0-rc1-00023-g06ddd17521bf #1 PREEMPT(lazy)
[ 25.234931][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 25.235357][ T1] Call Trace:
[ 25.235357][ T1] <TASK>
[ 25.235357][ T1] dump_stack_lvl (lib/dump_stack.c:123 (discriminator 1))
[ 25.235357][ T1] check_preemption_disabled (arch/x86/include/asm/preempt.h:85 lib/smp_processor_id.c:53)
[ 25.235357][ T1] __kvm_is_vmx_supported (arch/x86/include/asm/cpuid/api.h:74 arch/x86/include/asm/cpuid/api.h:113 arch/x86/kvm/vmx/vmx.c:2789)
[ 25.235357][ T1] ? __cpuid (arch/x86/include/asm/paravirt.h:179)
[ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
[ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
[ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
[ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
[ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
[ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
[ 25.235357][ T1] vmx_init (arch/x86/kvm/vmx/vmx.c:2808 arch/x86/kvm/vmx/vmx.c:8653)
[ 25.235357][ T1] vt_init (arch/x86/kvm/vmx/main.c:1072)
[ 25.235357][ T1] ? pi_init_cpu (arch/x86/kvm/vmx/main.c:1067)
[ 25.235357][ T1] do_one_initcall (init/main.c:1273)
[ 25.235357][ T1] ? trace_initcall_level (init/main.c:1264)
[ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
[ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
[ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
[ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
[ 25.235357][ T1] do_initcalls (init/main.c:1334 init/main.c:1351)
[ 25.235357][ T1] kernel_init_freeable (init/main.c:1587)
[ 25.235357][ T1] ? rest_init (init/main.c:1465)
[ 25.235357][ T1] kernel_init (init/main.c:1475)
[ 25.235357][ T1] ? rest_init (init/main.c:1465)
[ 25.235357][ T1] ret_from_fork (arch/x86/kernel/process.c:154)
[ 25.235357][ T1] ? rest_init (init/main.c:1465)
[ 25.235357][ T1] ret_from_fork_asm (arch/x86/entry/entry_64.S:255)
[ 25.235357][ T1] </TASK>
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20250710/202507100448.6b88d6f1-lkp@intel.com
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible
2025-07-10 2:58 [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible kernel test robot
@ 2025-07-10 3:18 ` Chen, Yu C
2025-07-10 6:25 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 12+ messages in thread
From: Chen, Yu C @ 2025-07-10 3:18 UTC (permalink / raw)
To: kernel test robot, Ingo Molnar
Cc: oe-lkp, lkp, linux-kernel, x86, Peter Zijlstra, Dietmar Eggemann,
Juri Lelli, Linus Torvalds, Mel Gorman, Sebastian Andrzej Siewior,
Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li
On 7/10/2025 10:58 AM, kernel test robot wrote:
>
>
> Hello,
>
> kernel test robot noticed "BUG:using_smp_processor_id()in_preemptible" on:
>
> commit: 06ddd17521bf11a3e7f59dafdf5c148f29467d2c ("sched/smp: Always define is_percpu_thread() and scheduler_ipi()")
> https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git sched/core
>
> [test failed on linux-next/master 835244aba90de290b4b0b1fa92b6734f3ee7b3d9]
>
> in testcase: boot
>
> config: x86_64-randconfig-123-20250702
> compiler: gcc-12
> test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
>
> (please refer to attached dmesg/kmsg for entire log/backtrace)
>
>
> +----------------------------------------------------------+------------+------------+
> | | cac5cefbad | 06ddd17521 |
> +----------------------------------------------------------+------------+------------+
> | boot_successes | 20 | 0 |
> | boot_failures | 0 | 18 |
> | BUG:using_smp_processor_id()in_preemptible | 0 | 18 |
> | BUG:using__this_cpu_write()in_preemptible[#]code:swapper | 0 | 18 |
> | BUG:using__this_cpu_read()in_preemptible | 0 | 18 |
> +----------------------------------------------------------+------------+------------+
>
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <oliver.sang@intel.com>
> | Closes: https://lore.kernel.org/oe-lkp/202507100448.6b88d6f1-lkp@intel.com
>
>
> [ 25.232998][ T1] BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
> [ 25.233645][ T1] caller is __kvm_is_vmx_supported (arch/x86/include/asm/cpuid/api.h:74 arch/x86/include/asm/cpuid/api.h:113 arch/x86/kvm/vmx/vmx.c:2789)
> [ 25.234128][ T1] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.16.0-rc1-00023-g06ddd17521bf #1 PREEMPT(lazy)
> [ 25.234931][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
> [ 25.235357][ T1] Call Trace:
> [ 25.235357][ T1] <TASK>
> [ 25.235357][ T1] dump_stack_lvl (lib/dump_stack.c:123 (discriminator 1))
> [ 25.235357][ T1] check_preemption_disabled (arch/x86/include/asm/preempt.h:85 lib/smp_processor_id.c:53)
> [ 25.235357][ T1] __kvm_is_vmx_supported (arch/x86/include/asm/cpuid/api.h:74 arch/x86/include/asm/cpuid/api.h:113 arch/x86/kvm/vmx/vmx.c:2789)
> [ 25.235357][ T1] ? __cpuid (arch/x86/include/asm/paravirt.h:179)
> [ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
> [ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
> [ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
> [ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
> [ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
> [ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
> [ 25.235357][ T1] vmx_init (arch/x86/kvm/vmx/vmx.c:2808 arch/x86/kvm/vmx/vmx.c:8653)
> [ 25.235357][ T1] vt_init (arch/x86/kvm/vmx/main.c:1072)
> [ 25.235357][ T1] ? pi_init_cpu (arch/x86/kvm/vmx/main.c:1067)
> [ 25.235357][ T1] do_one_initcall (init/main.c:1273)
> [ 25.235357][ T1] ? trace_initcall_level (init/main.c:1264)
> [ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
> [ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
> [ 25.235357][ T1] ? __sanitizer_cov_trace_pc (kernel/kcov.c:217)
> [ 25.235357][ T1] ? ftrace_likely_update (arch/x86/include/asm/smap.h:53 kernel/trace/trace_branch.c:223)
> [ 25.235357][ T1] do_initcalls (init/main.c:1334 init/main.c:1351)
> [ 25.235357][ T1] kernel_init_freeable (init/main.c:1587)
> [ 25.235357][ T1] ? rest_init (init/main.c:1465)
> [ 25.235357][ T1] kernel_init (init/main.c:1475)
> [ 25.235357][ T1] ? rest_init (init/main.c:1465)
> [ 25.235357][ T1] ret_from_fork (arch/x86/kernel/process.c:154)
> [ 25.235357][ T1] ? rest_init (init/main.c:1465)
> [ 25.235357][ T1] ret_from_fork_asm (arch/x86/entry/entry_64.S:255)
> [ 25.235357][ T1] </TASK>
>
I took a glance at the warning, before this patch,
is_percpu_thread() always return true when CONFIG_SMP is not set.
After this patch,
is_percpu_thread() checks the current task's CPU affinity.
So debug_smp_processor_id() -> check_preemption_disabled() ->
is_percpu_thread() might not always return true anymore, which caused
the warning.
Actually the issue is in __kvm_is_vmx_supported(), should
we use something like this below:
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 5c5766467a61..9cba7b061892 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -2787,19 +2787,22 @@ static int setup_vmcs_config(struct vmcs_config
*vmcs_conf,
static bool __kvm_is_vmx_supported(void)
{
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
if (!(cpuid_ecx(1) & feature_bit(VMX))) {
pr_err("VMX not supported by CPU %d\n", cpu);
+ put_cpu();
return false;
}
if (!this_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
!this_cpu_has(X86_FEATURE_VMX)) {
pr_err("VMX not enabled (by BIOS) in MSR_IA32_FEAT_CTL
on CPU %d\n", cpu);
+ put_cpu();
return false;
}
+ put_cpu();
return true;
}
thanks,
Chenyu
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible
2025-07-10 3:18 ` Chen, Yu C
@ 2025-07-10 6:25 ` Sebastian Andrzej Siewior
2025-07-10 8:00 ` Chen, Yu C
0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-07-10 6:25 UTC (permalink / raw)
To: Chen, Yu C
Cc: kernel test robot, Ingo Molnar, oe-lkp, lkp, linux-kernel, x86,
Peter Zijlstra, Dietmar Eggemann, Juri Lelli, Linus Torvalds,
Mel Gorman, Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li
On 2025-07-10 11:18:29 [+0800], Chen, Yu C wrote:
> > [ 25.235357][ T1] dump_stack_lvl (lib/dump_stack.c:123 (discriminator 1))
> > [ 25.235357][ T1] check_preemption_disabled (arch/x86/include/asm/preempt.h:85 lib/smp_processor_id.c:53)
> > [ 25.235357][ T1] __kvm_is_vmx_supported (arch/x86/include/asm/cpuid/api.h:74 arch/x86/include/asm/cpuid/api.h:113 arch/x86/kvm/vmx/vmx.c:2789)
> > [ 25.235357][ T1] vmx_init (arch/x86/kvm/vmx/vmx.c:2808 arch/x86/kvm/vmx/vmx.c:8653)
> > [ 25.235357][ T1] vt_init (arch/x86/kvm/vmx/main.c:1072)
…
> I took a glance at the warning, before this patch,
> is_percpu_thread() always return true when CONFIG_SMP is not set.
> After this patch,
> is_percpu_thread() checks the current task's CPU affinity.
> So debug_smp_processor_id() -> check_preemption_disabled() ->
> is_percpu_thread() might not always return true anymore, which caused
> the warning.
>
> Actually the issue is in __kvm_is_vmx_supported(), should
> we use something like this below:
No, it should not. If you look closely you will see that the call chains
is
vmx_init() -> kvm_is_vmx_supported() -> __kvm_is_vmx_supported()
There is a migrate_disable() around __kvm_is_vmx_supported(). So why
does this warning trigger then?
Sebastian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible
2025-07-10 6:25 ` Sebastian Andrzej Siewior
@ 2025-07-10 8:00 ` Chen, Yu C
2025-07-10 8:11 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 12+ messages in thread
From: Chen, Yu C @ 2025-07-10 8:00 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: kernel test robot, Ingo Molnar, oe-lkp, lkp, linux-kernel, x86,
Peter Zijlstra, Dietmar Eggemann, Juri Lelli, Linus Torvalds,
Mel Gorman, Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li
Hi Sebastian,
On 7/10/2025 2:25 PM, Sebastian Andrzej Siewior wrote:
> On 2025-07-10 11:18:29 [+0800], Chen, Yu C wrote:
>>> [ 25.235357][ T1] dump_stack_lvl (lib/dump_stack.c:123 (discriminator 1))
>>> [ 25.235357][ T1] check_preemption_disabled (arch/x86/include/asm/preempt.h:85 lib/smp_processor_id.c:53)
>>> [ 25.235357][ T1] __kvm_is_vmx_supported (arch/x86/include/asm/cpuid/api.h:74 arch/x86/include/asm/cpuid/api.h:113 arch/x86/kvm/vmx/vmx.c:2789)
>>> [ 25.235357][ T1] vmx_init (arch/x86/kvm/vmx/vmx.c:2808 arch/x86/kvm/vmx/vmx.c:8653)
>>> [ 25.235357][ T1] vt_init (arch/x86/kvm/vmx/main.c:1072)
> …
>> I took a glance at the warning, before this patch,
>> is_percpu_thread() always return true when CONFIG_SMP is not set.
>> After this patch,
>> is_percpu_thread() checks the current task's CPU affinity.
>> So debug_smp_processor_id() -> check_preemption_disabled() ->
>> is_percpu_thread() might not always return true anymore, which caused
>> the warning.
>>
>> Actually the issue is in __kvm_is_vmx_supported(), should
>> we use something like this below:
>
> No, it should not. If you look closely you will see that the call chains
> is
> vmx_init() -> kvm_is_vmx_supported() -> __kvm_is_vmx_supported()
>
> There is a migrate_disable() around __kvm_is_vmx_supported(). So why
> does this warning trigger then?
>
migrate_disable() disables the task migration between CPUs by restricting
the task's affinity, but it does not disable the preemption on single
CPUs IMO. The scope of guard(preempt)() in migrate_disable() is just
within the migrate_disable(). debug_smp_processor_id() warns when the
preemption is enabled.
Thanks,
Chenyu
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible
2025-07-10 8:00 ` Chen, Yu C
@ 2025-07-10 8:11 ` Sebastian Andrzej Siewior
2025-07-10 8:27 ` [PATCH] lib/smp_processor_id: Make migration check unconditional of SMP Sebastian Andrzej Siewior
2025-07-10 8:29 ` [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible Chen, Yu C
0 siblings, 2 replies; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-07-10 8:11 UTC (permalink / raw)
To: Chen, Yu C
Cc: kernel test robot, Ingo Molnar, oe-lkp, lkp, linux-kernel, x86,
Peter Zijlstra, Dietmar Eggemann, Juri Lelli, Linus Torvalds,
Mel Gorman, Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li
On 2025-07-10 16:00:46 [+0800], Chen, Yu C wrote:
> migrate_disable() disables the task migration between CPUs by restricting
> the task's affinity, but it does not disable the preemption on single
> CPUs IMO. The scope of guard(preempt)() in migrate_disable() is just
> within the migrate_disable(). debug_smp_processor_id() warns when the
> preemption is enabled.
does migrate_disable() really have no effect on
debug_smp_processor_id()?
> Thanks,
> Chenyu
Sebastian
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] lib/smp_processor_id: Make migration check unconditional of SMP
2025-07-10 8:11 ` Sebastian Andrzej Siewior
@ 2025-07-10 8:27 ` Sebastian Andrzej Siewior
2025-07-10 8:32 ` Chen, Yu C
2025-07-11 12:41 ` [tip: sched/core] " tip-bot2 for Sebastian Andrzej Siewior
2025-07-10 8:29 ` [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible Chen, Yu C
1 sibling, 2 replies; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-07-10 8:27 UTC (permalink / raw)
To: Chen, Yu C, Ingo Molnar
Cc: kernel test robot, oe-lkp, lkp, linux-kernel, x86, Peter Zijlstra,
Dietmar Eggemann, Juri Lelli, Linus Torvalds, Mel Gorman,
Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li
Commit cac5cefbade90 ("sched/smp: Make SMP unconditional")
migrate_disable() even on UP builds.
Commit 06ddd17521bf1 ("sched/smp: Always define is_percpu_thread() and
scheduler_ipi()") made is_percpu_thread() check the affinity mask
instead replying always true for UP mask.
As a consequence smp_processor_id() now complains if invoked within a
migrate_disable() section because is_percpu_thread() checks its mask and
the migration check is left out.
Make migration check unconditional of SMP.
Fixes: cac5cefbade90 ("sched/smp: Make SMP unconditional")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202507100448.6b88d6f1-lkp@intel.com
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
lib/smp_processor_id.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
index a2bb7738c373c..94b3f6b195388 100644
--- a/lib/smp_processor_id.c
+++ b/lib/smp_processor_id.c
@@ -22,10 +22,8 @@ unsigned int check_preemption_disabled(const char *what1, const char *what2)
if (is_percpu_thread())
goto out;
-#ifdef CONFIG_SMP
if (current->migration_disabled)
goto out;
-#endif
/*
* It is valid to assume CPU-locality during early bootup:
--
2.50.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible
2025-07-10 8:11 ` Sebastian Andrzej Siewior
2025-07-10 8:27 ` [PATCH] lib/smp_processor_id: Make migration check unconditional of SMP Sebastian Andrzej Siewior
@ 2025-07-10 8:29 ` Chen, Yu C
2025-07-10 10:47 ` Sebastian Andrzej Siewior
1 sibling, 1 reply; 12+ messages in thread
From: Chen, Yu C @ 2025-07-10 8:29 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: kernel test robot, Ingo Molnar, oe-lkp, lkp, linux-kernel, x86,
Peter Zijlstra, Dietmar Eggemann, Juri Lelli, Linus Torvalds,
Mel Gorman, Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li
On 7/10/2025 4:11 PM, Sebastian Andrzej Siewior wrote:
> On 2025-07-10 16:00:46 [+0800], Chen, Yu C wrote:
>> migrate_disable() disables the task migration between CPUs by restricting
>> the task's affinity, but it does not disable the preemption on single
>> CPUs IMO. The scope of guard(preempt)() in migrate_disable() is just
>> within the migrate_disable(). debug_smp_processor_id() warns when the
>> preemption is enabled.
>
> does migrate_disable() really have no effect on
> debug_smp_processor_id()?
>
I see. So there is still a CONFIG_SMP to check migrate_disbled
in debug_smp_processor_id(), and that was skipped if we do not
have CONFIG_SMP set.
thanks,
Chenyu>> Thanks,
>> Chenyu
> Sebastian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] lib/smp_processor_id: Make migration check unconditional of SMP
2025-07-10 8:27 ` [PATCH] lib/smp_processor_id: Make migration check unconditional of SMP Sebastian Andrzej Siewior
@ 2025-07-10 8:32 ` Chen, Yu C
2025-07-10 10:13 ` Peter Zijlstra
2025-07-11 12:41 ` [tip: sched/core] " tip-bot2 for Sebastian Andrzej Siewior
1 sibling, 1 reply; 12+ messages in thread
From: Chen, Yu C @ 2025-07-10 8:32 UTC (permalink / raw)
To: Sebastian Andrzej Siewior, Ingo Molnar
Cc: kernel test robot, oe-lkp, lkp, linux-kernel, x86, Peter Zijlstra,
Dietmar Eggemann, Juri Lelli, Linus Torvalds, Mel Gorman,
Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li
On 7/10/2025 4:27 PM, Sebastian Andrzej Siewior wrote:
> Commit cac5cefbade90 ("sched/smp: Make SMP unconditional")
> migrate_disable() even on UP builds.
> Commit 06ddd17521bf1 ("sched/smp: Always define is_percpu_thread() and
> scheduler_ipi()") made is_percpu_thread() check the affinity mask
> instead replying always true for UP mask.
>
> As a consequence smp_processor_id() now complains if invoked within a
> migrate_disable() section because is_percpu_thread() checks its mask and
> the migration check is left out.
>
> Make migration check unconditional of SMP.
>
> Fixes: cac5cefbade90 ("sched/smp: Make SMP unconditional")
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202507100448.6b88d6f1-lkp@intel.com
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
From my understanding,
Reviewed-by: Chen Yu <yu.c.chen@intel.com>
thank you for fixing this.
best,
Chenyu
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] lib/smp_processor_id: Make migration check unconditional of SMP
2025-07-10 8:32 ` Chen, Yu C
@ 2025-07-10 10:13 ` Peter Zijlstra
0 siblings, 0 replies; 12+ messages in thread
From: Peter Zijlstra @ 2025-07-10 10:13 UTC (permalink / raw)
To: Chen, Yu C
Cc: Sebastian Andrzej Siewior, Ingo Molnar, kernel test robot, oe-lkp,
lkp, linux-kernel, x86, Dietmar Eggemann, Juri Lelli,
Linus Torvalds, Mel Gorman, Shrikanth Hegde, Steven Rostedt,
Valentin Schneider, Vincent Guittot, aubrey.li
On Thu, Jul 10, 2025 at 04:32:57PM +0800, Chen, Yu C wrote:
> On 7/10/2025 4:27 PM, Sebastian Andrzej Siewior wrote:
> > Commit cac5cefbade90 ("sched/smp: Make SMP unconditional")
> > migrate_disable() even on UP builds.
> > Commit 06ddd17521bf1 ("sched/smp: Always define is_percpu_thread() and
> > scheduler_ipi()") made is_percpu_thread() check the affinity mask
> > instead replying always true for UP mask.
> >
> > As a consequence smp_processor_id() now complains if invoked within a
> > migrate_disable() section because is_percpu_thread() checks its mask and
> > the migration check is left out.
> >
> > Make migration check unconditional of SMP.
> >
> > Fixes: cac5cefbade90 ("sched/smp: Make SMP unconditional")
> > Reported-by: kernel test robot <oliver.sang@intel.com>
> > Closes: https://lore.kernel.org/oe-lkp/202507100448.6b88d6f1-lkp@intel.com
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
>
> From my understanding,
>
> Reviewed-by: Chen Yu <yu.c.chen@intel.com>
Thanks; let me go stick this in a tree somewhere.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible
2025-07-10 8:29 ` [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible Chen, Yu C
@ 2025-07-10 10:47 ` Sebastian Andrzej Siewior
2025-07-10 11:31 ` Chen, Yu C
0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-07-10 10:47 UTC (permalink / raw)
To: Chen, Yu C
Cc: kernel test robot, Ingo Molnar, oe-lkp, lkp, linux-kernel, x86,
Peter Zijlstra, Dietmar Eggemann, Juri Lelli, Linus Torvalds,
Mel Gorman, Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li
On 2025-07-10 16:29:51 [+0800], Chen, Yu C wrote:
> I see. So there is still a CONFIG_SMP to check migrate_disbled
> in debug_smp_processor_id(), and that was skipped if we do not
> have CONFIG_SMP set.
Exactly, sorry for that.
I planned to let you do the figuring out and sending the patch but got
confused midway, had to look it up and then had the patch ready and
decided to send it…
> thanks,
> Chenyu>> Thanks,
Sebastian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible
2025-07-10 10:47 ` Sebastian Andrzej Siewior
@ 2025-07-10 11:31 ` Chen, Yu C
0 siblings, 0 replies; 12+ messages in thread
From: Chen, Yu C @ 2025-07-10 11:31 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: kernel test robot, Ingo Molnar, oe-lkp, lkp, linux-kernel, x86,
Peter Zijlstra, Dietmar Eggemann, Juri Lelli, Linus Torvalds,
Mel Gorman, Shrikanth Hegde, Steven Rostedt, Valentin Schneider,
Vincent Guittot, aubrey.li
On 7/10/2025 6:47 PM, Sebastian Andrzej Siewior wrote:
> On 2025-07-10 16:29:51 [+0800], Chen, Yu C wrote:
>> I see. So there is still a CONFIG_SMP to check migrate_disbled
>> in debug_smp_processor_id(), and that was skipped if we do not
>> have CONFIG_SMP set.
>
> Exactly, sorry for that.
> I planned to let you do the figuring out and sending the patch but got
> confused midway, had to look it up and then had the patch ready and
> decided to send it…
>
No worries! Thanks for the patch. Glad it’s sorted.
thanks,
Chenyu>> thanks,
>> Chenyu>> Thanks,
> Sebastian
^ permalink raw reply [flat|nested] 12+ messages in thread
* [tip: sched/core] lib/smp_processor_id: Make migration check unconditional of SMP
2025-07-10 8:27 ` [PATCH] lib/smp_processor_id: Make migration check unconditional of SMP Sebastian Andrzej Siewior
2025-07-10 8:32 ` Chen, Yu C
@ 2025-07-11 12:41 ` tip-bot2 for Sebastian Andrzej Siewior
1 sibling, 0 replies; 12+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2025-07-11 12:41 UTC (permalink / raw)
To: linux-tip-commits
Cc: kernel test robot, Sebastian Andrzej Siewior,
Peter Zijlstra (Intel), Chen Yu, x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 2885daf47081dd1aaf1a588e9d001eb343df1f90
Gitweb: https://git.kernel.org/tip/2885daf47081dd1aaf1a588e9d001eb343df1f90
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Thu, 10 Jul 2025 10:27:48 +02:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 10 Jul 2025 17:52:13 +02:00
lib/smp_processor_id: Make migration check unconditional of SMP
Commit cac5cefbade90 ("sched/smp: Make SMP unconditional")
migrate_disable() even on UP builds.
Commit 06ddd17521bf1 ("sched/smp: Always define is_percpu_thread() and
scheduler_ipi()") made is_percpu_thread() check the affinity mask
instead replying always true for UP mask.
As a consequence smp_processor_id() now complains if invoked within a
migrate_disable() section because is_percpu_thread() checks its mask and
the migration check is left out.
Make migration check unconditional of SMP.
Fixes: cac5cefbade90 ("sched/smp: Make SMP unconditional")
Closes: https://lore.kernel.org/oe-lkp/202507100448.6b88d6f1-lkp@intel.com
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Chen Yu <yu.c.chen@intel.com>
Link: https://lore.kernel.org/r/20250710082748.-DPO1rjO@linutronix.de
---
lib/smp_processor_id.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
index a2bb773..94b3f6b 100644
--- a/lib/smp_processor_id.c
+++ b/lib/smp_processor_id.c
@@ -22,10 +22,8 @@ unsigned int check_preemption_disabled(const char *what1, const char *what2)
if (is_percpu_thread())
goto out;
-#ifdef CONFIG_SMP
if (current->migration_disabled)
goto out;
-#endif
/*
* It is valid to assume CPU-locality during early bootup:
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-07-11 12:41 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 2:58 [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible kernel test robot
2025-07-10 3:18 ` Chen, Yu C
2025-07-10 6:25 ` Sebastian Andrzej Siewior
2025-07-10 8:00 ` Chen, Yu C
2025-07-10 8:11 ` Sebastian Andrzej Siewior
2025-07-10 8:27 ` [PATCH] lib/smp_processor_id: Make migration check unconditional of SMP Sebastian Andrzej Siewior
2025-07-10 8:32 ` Chen, Yu C
2025-07-10 10:13 ` Peter Zijlstra
2025-07-11 12:41 ` [tip: sched/core] " tip-bot2 for Sebastian Andrzej Siewior
2025-07-10 8:29 ` [tip:sched/core] [sched/smp] 06ddd17521: BUG:using_smp_processor_id()in_preemptible Chen, Yu C
2025-07-10 10:47 ` Sebastian Andrzej Siewior
2025-07-10 11:31 ` Chen, Yu C
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).