* [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems
@ 2025-01-06 9:04 wujing
2025-01-06 9:07 ` kernel test robot
2025-01-06 9:21 ` Peter Zijlstra
0 siblings, 2 replies; 7+ messages in thread
From: wujing @ 2025-01-06 9:04 UTC (permalink / raw)
To: gregkh, sasha.levin
Cc: mingo, peterz, linux-kernel, stable, wujing, QiLiang Yuan
This bug can be reproduced on Kunpeng arm64 and Phytium arm physical machines,
as well as in virtual machine environments, based on the linux-4.19.y stable
branch:
1. Check the number of CPUs on the system:
nproc --all
96
2. Add the parameter isolcpus=0-85 to the grub configuration,
update grub, and reboot.
3. Check the ksmd process:
ps aux | grep -i ksmd
root 502 0.0 0.0 0 0 ? S 10:00 0:00 [ksmd]
ps -o pid,psr,comm -p 502
PID PSR COMMAND
502 0 ksmd
4. Check the kthreadd process:
ps aux | grep -i kthreadd
root 2 0.0 0.0 0 0 ? S 10:00 0:00 [kthreadd]
ps -o pid,psr,comm -p 2
PID PSR COMMAND
2 0 kthreadd
From the output above, it can be seen that both ksmd and kthreadd are still
running on CPU0, which is unreasonable since CPU0 has been isolated.
Signed-off-by: wujing <realwujing@qq.com>
Signed-off-by: QiLiang Yuan <yuanql9@chinatelecom.cn>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0950cabfc1d0..454021ff70a1 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6211,7 +6211,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc));
if (!this_sd)
- return -1;
+ return housekeeping_any_cpu(HK_FLAG_DOMAIN);
/*
* Due to large variance we need a large fuzz factor; hackbench in
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems
2025-01-06 9:04 [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems wujing
@ 2025-01-06 9:07 ` kernel test robot
2025-01-06 9:21 ` Peter Zijlstra
1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-01-06 9:07 UTC (permalink / raw)
To: wujing; +Cc: stable, oe-kbuild-all
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1
Rule: add the tag "Cc: stable@vger.kernel.org" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems
Link: https://lore.kernel.org/stable/tencent_44452B098A632CA84FCB293DA658E7BD4306%40qq.com
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems
2025-01-06 9:04 [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems wujing
2025-01-06 9:07 ` kernel test robot
@ 2025-01-06 9:21 ` Peter Zijlstra
2025-01-06 9:39 ` wujing
2025-01-06 9:48 ` wujing
1 sibling, 2 replies; 7+ messages in thread
From: Peter Zijlstra @ 2025-01-06 9:21 UTC (permalink / raw)
To: wujing; +Cc: gregkh, sasha.levin, mingo, linux-kernel, stable, QiLiang Yuan
Your subject explicitly mentions arm64, however there is absolutely
nothing arm64 specific to this patch, as such the subject is just plain
wrong.
On Mon, Jan 06, 2025 at 05:04:03PM +0800, wujing wrote:
> This bug can be reproduced on Kunpeng arm64 and Phytium arm physical machines,
> as well as in virtual machine environments, based on the linux-4.19.y stable
Development does not happen on stable branches.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems
2025-01-06 9:21 ` Peter Zijlstra
@ 2025-01-06 9:39 ` wujing
2025-01-06 9:48 ` wujing
1 sibling, 0 replies; 7+ messages in thread
From: wujing @ 2025-01-06 9:39 UTC (permalink / raw)
To: peterz
Cc: gregkh, linux-kernel, mingo, realwujing, sasha.levin, stable,
yuanql9
On x86 architecture, we have checked many machines in the cluster, and this
issue does not exist.
> Your subject explicitly mentions arm64, however there is absolutely
> nothing arm64 specific to this patch, as such the subject is just plain
>wrong.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems
2025-01-06 9:21 ` Peter Zijlstra
2025-01-06 9:39 ` wujing
@ 2025-01-06 9:48 ` wujing
1 sibling, 0 replies; 7+ messages in thread
From: wujing @ 2025-01-06 9:48 UTC (permalink / raw)
To: peterz
Cc: gregkh, linux-kernel, mingo, realwujing, sasha.levin, stable,
yuanql9
The reason this issue does not occur on x86 architecture is that x86 does not
use the `select_idle_cpu` function for core selection. Instead, it uses the
`select_idle_smt` function. However, there is still an issue on x86 where
isolated cores are not properly excluded. My other commit,
`sched/fair: Correct CPU selection from isolated domain`, addresses the issue
of isolated cores on x86.
> Your subject explicitly mentions arm64, however there is absolutely
> nothing arm64 specific to this patch, as such the subject is just plain
> wrong.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems
@ 2025-01-06 9:24 wujing
2025-01-06 9:52 ` Greg KH
0 siblings, 1 reply; 7+ messages in thread
From: wujing @ 2025-01-06 9:24 UTC (permalink / raw)
To: gregkh, sasha.levin
Cc: mingo, peterz, linux-kernel, stable, wujing, QiLiang Yuan
This bug can be reproduced on Kunpeng arm64 and Phytium arm physical machines,
as well as in virtual machine environments, based on the linux-4.19.y stable
branch:
1. Check the number of CPUs on the system:
nproc --all
96
2. Add the parameter isolcpus=0-85 to the grub configuration,
update grub, and reboot.
3. Check the ksmd process:
ps aux | grep -i ksmd
root 502 0.0 0.0 0 0 ? S 10:00 0:00 [ksmd]
ps -o pid,psr,comm -p 502
PID PSR COMMAND
502 0 ksmd
4. Check the kthreadd process:
ps aux | grep -i kthreadd
root 2 0.0 0.0 0 0 ? S 10:00 0:00 [kthreadd]
ps -o pid,psr,comm -p 2
PID PSR COMMAND
2 0 kthreadd
From the output above, it can be seen that both ksmd and kthreadd are still
running on CPU0, which is unreasonable since CPU0 has been isolated.
Cc: stable@vger.kernel.org # 4.19.x
Signed-off-by: wujing <realwujing@qq.com>
Signed-off-by: QiLiang Yuan <yuanql9@chinatelecom.cn>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0950cabfc1d0..454021ff70a1 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6211,7 +6211,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc));
if (!this_sd)
- return -1;
+ return housekeeping_any_cpu(HK_FLAG_DOMAIN);
/*
* Due to large variance we need a large fuzz factor; hackbench in
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems
2025-01-06 9:24 wujing
@ 2025-01-06 9:52 ` Greg KH
0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2025-01-06 9:52 UTC (permalink / raw)
To: wujing; +Cc: sasha.levin, mingo, peterz, linux-kernel, stable, QiLiang Yuan
On Mon, Jan 06, 2025 at 05:24:21PM +0800, wujing wrote:
> This bug can be reproduced on Kunpeng arm64 and Phytium arm physical machines,
> as well as in virtual machine environments, based on the linux-4.19.y stable
> branch:
Again, 4.19.y is long end-of-life.
Also, always do your development work on the latest kernel version, this
is documented well in the source tree, right?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-01-06 10:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-06 9:04 [PATCH] sched/fair: Fix ksmd and kthreadd running on isolated CPU0 on arm64 systems wujing
2025-01-06 9:07 ` kernel test robot
2025-01-06 9:21 ` Peter Zijlstra
2025-01-06 9:39 ` wujing
2025-01-06 9:48 ` wujing
-- strict thread matches above, loose matches on Subject: below --
2025-01-06 9:24 wujing
2025-01-06 9:52 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox