From: Peter Zijlstra <peterz@infradead.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
rafael@kernel.org, len.brown@intel.com, linux-pm@vger.kernel.org,
sfr@canb.auug.org.au, gor@linux.ibm.com
Subject: Re: next-20211015: suspend to ram on x86-32 broken
Date: Mon, 18 Oct 2021 16:52:10 +0200 [thread overview]
Message-ID: <YW2KGrvvv/vSA+97@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20211018114429.GA13693@duo.ucw.cz>
On Mon, Oct 18, 2021 at 01:44:29PM +0200, Pavel Machek wrote:
> Reverting smp.c hunk is enough to get suspend/resume to work.
Thanks! Queued the below.
---
Subject: sched: Partial revert: "sched: Simplify wake_up_*idle*()"
From: Peter Zijlstra <peterz@infradead.org>
Date: Mon Oct 18 16:41:05 CEST 2021
As reported by syzbot and experienced by Pavel, using cpus_read_lock()
in wake_up_all_idle_cpus() generates lock inversion (against mmap_sem
and possibly others).
Therefore, undo this change and put in a comment :/
Fixes: 8850cb663b5c ("sched: Simplify wake_up_*idle*()")
Reported-by: syzbot+d5b23b18d2f4feae8a67@syzkaller.appspotmail.com
Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
---
kernel/smp.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -1170,14 +1170,23 @@ void wake_up_all_idle_cpus(void)
{
int cpu;
- cpus_read_lock();
+ /*
+ * This really should be cpus_read_lock(), because disabling preemption
+ * over iterating all CPUs is really bad when you have large numbers of
+ * CPUs, giving rise to large latencies.
+ *
+ * Sadly this cannot be, since (ironically) this function is used from
+ * the cpu_latency_qos stuff which in turn is used under all sorts of
+ * locks yielding a hotplug lock inversion :/
+ */
+ preempt_disable();
for_each_online_cpu(cpu) {
- if (cpu == raw_smp_processor_id())
+ if (cpu == smp_processor_id())
continue;
wake_up_if_idle(cpu);
}
- cpus_read_unlock();
+ preempt_enable();
}
EXPORT_SYMBOL_GPL(wake_up_all_idle_cpus);
prev parent reply other threads:[~2021-10-18 14:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211017093905.GA3069@amd>
2021-10-17 10:25 ` next-20211015: suspend to ram on x86-32 broken Pavel Machek
2021-10-18 7:13 ` Pavel Machek
2021-10-18 8:13 ` Pavel Machek
2021-10-18 9:15 ` Peter Zijlstra
2021-10-18 11:44 ` Pavel Machek
2021-10-18 14:52 ` Peter Zijlstra [this message]
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=YW2KGrvvv/vSA+97@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=gor@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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