From: Hui Tang <tanghui20@huawei.com>
To: <mingo@redhat.com>, <peterz@infradead.org>,
<juri.lelli@redhat.com>, <vincent.guittot@linaro.org>
Cc: <linux-kernel@vger.kernel.org>, <tanghui20@huawei.com>,
<judy.chenhui@huawei.com>, <zhangqiao22@huawei.com>
Subject: [PATCH] sched/rt: Fix possible warn when push_rt_task
Date: Sat, 24 Jun 2023 17:21:30 +0800 [thread overview]
Message-ID: <20230624092130.174409-1-tanghui20@huawei.com> (raw)
A warn may be triggered during reboot, as follows:
reboot
->kernel_restart
->machine_restart
->smp_send_stop --- ipi handler set_cpu_online(cpu, false)
balance_callback
-> __balance_callback
->push_rt_task
-> find_lock_lowest_rq --- offline cpu in vec->mask not be cleared
-> find_lowest_rq
-> cpupri_find
-> cpupri_find_fitness
-> __cpupri_find [cpumask_and(..., vec->mask)]
-> set_task_cpu(next_task, lowest_rq->cpu) --- WARN_ON(!oneline(cpu)
So add !cpu_online(lowest_rq->cpu) check before set_task_cpu().
The fix does not completely fix the problem, since cpu_online_mask may
be cleared after check.
Fixes: 4ff9083b8a9a8 ("sched/core: WARN() when migrating to an offline CPU")
Signed-off-by: Hui Tang <tanghui20@huawei.com>
---
kernel/sched/rt.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 00e0e5074115..852ef18b6a50 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2159,6 +2159,9 @@ static int push_rt_task(struct rq *rq, bool pull)
goto retry;
}
+ if (unlikely(!cpu_online(lowest_rq->cpu)))
+ goto out;
+
deactivate_task(rq, next_task, 0);
set_task_cpu(next_task, lowest_rq->cpu);
activate_task(lowest_rq, next_task, 0);
--
2.17.1
next reply other threads:[~2023-06-24 9:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-24 9:21 Hui Tang [this message]
2023-07-03 12:39 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230624092130.174409-1-tanghui20@huawei.com \
--to=tanghui20@huawei.com \
--cc=judy.chenhui@huawei.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=vincent.guittot@linaro.org \
--cc=zhangqiao22@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®