From: Ran Wang <ran.wang_1@nxp.com>
To: Sebastian Siewior <bigeasy@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>
Cc: Jiafei Pan <jiafei.pan@nxp.com>,
linux-rt-users@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>,
Ran Wang <ran.wang_1@nxp.com>
Subject: [PATCH v2] rt: cpufreq: Fix cpu hotplug hang
Date: Tue, 30 Mar 2021 11:15:13 +0800 [thread overview]
Message-ID: <20210330031513.17903-1-ran.wang_1@nxp.com> (raw)
When selecting PREEMPT_RT, cpufreq_driver->stop_cpu(policy) might get
stuck due to irq_work_sync() pending for work on lazy_list, which had
no chance to be served in softirq context sometimes.
The reason of lazy_list was not served is because the nearest activated
timer might have been set to expire after long time (such as 100+ seconds).
Then function run_local_timers() would not call raise_softirq(TIMER_SOFTIRQ)
to handle enqueued irq_work.
This is observed on LX2160ARDB and LS1088ARDB with cpufreq governor of
‘schedutil’ or ‘ondemand’.
Configure related irqwork to run on raw-irq context could fix this issue.
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
---
Change in v2:
- Update commit message to explain root cause more clear.
drivers/cpufreq/cpufreq_governor.c | 2 +-
kernel/sched/cpufreq_schedutil.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index 63f7c219062b..731a7b1434df 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -360,7 +360,7 @@ static struct policy_dbs_info *alloc_policy_dbs_info(struct cpufreq_policy *poli
policy_dbs->policy = policy;
mutex_init(&policy_dbs->update_mutex);
atomic_set(&policy_dbs->work_count, 0);
- init_irq_work(&policy_dbs->irq_work, dbs_irq_work);
+ policy_dbs->irq_work = IRQ_WORK_INIT_HARD(dbs_irq_work);
INIT_WORK(&policy_dbs->work, dbs_work_handler);
/* Set policy_dbs for all CPUs, online+offline */
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 50cbad89f7fa..1d5af87ec92e 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -611,7 +611,7 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)
sg_policy->thread = thread;
kthread_bind_mask(thread, policy->related_cpus);
- init_irq_work(&sg_policy->irq_work, sugov_irq_work);
+ sg_policy->irq_work = IRQ_WORK_INIT_HARD(sugov_irq_work);
mutex_init(&sg_policy->work_lock);
wake_up_process(thread);
--
2.25.1
next reply other threads:[~2021-03-30 3:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 3:15 Ran Wang [this message]
2021-03-30 4:46 ` [PATCH v2] rt: cpufreq: Fix cpu hotplug hang Viresh Kumar
2021-03-30 5:24 ` Ran Wang
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=20210330031513.17903-1-ran.wang_1@nxp.com \
--to=ran.wang_1@nxp.com \
--cc=bigeasy@linutronix.de \
--cc=jiafei.pan@nxp.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=tglx@linutronix.de \
--cc=viresh.kumar@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).