From: Laurent Dufour <ldufour@linux.ibm.com>
To: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
npiggin@gmail.com
Subject: [PATCH 2/2] powerpc/watchdog: ensure watchdog data accesses are protected
Date: Tue, 26 Oct 2021 18:27:40 +0200 [thread overview]
Message-ID: <20211026162740.16283-3-ldufour@linux.ibm.com> (raw)
In-Reply-To: <20211026162740.16283-1-ldufour@linux.ibm.com>
The wd_smp_cpus_pending CPU mask should be accessed under the protection of
the __wd_smp_lock.
This prevents false alarm to be raised when the system is under an heavy
stress. This has been seen while doing LPM on large system with a big
workload.
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
---
arch/powerpc/kernel/watchdog.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c
index bc7411327066..8d7a1a86187e 100644
--- a/arch/powerpc/kernel/watchdog.c
+++ b/arch/powerpc/kernel/watchdog.c
@@ -203,12 +203,13 @@ static void watchdog_smp_panic(int cpu, u64 tb)
static void wd_smp_clear_cpu_pending(int cpu, u64 tb)
{
+ unsigned long flags;
+
+ wd_smp_lock(&flags);
if (!cpumask_test_cpu(cpu, &wd_smp_cpus_pending)) {
if (unlikely(cpumask_test_cpu(cpu, &wd_smp_cpus_stuck))) {
struct pt_regs *regs = get_irq_regs();
- unsigned long flags;
- wd_smp_lock(&flags);
cpumask_clear_cpu(cpu, &wd_smp_cpus_stuck);
wd_smp_unlock(&flags);
@@ -219,22 +220,23 @@ static void wd_smp_clear_cpu_pending(int cpu, u64 tb)
show_regs(regs);
else
dump_stack();
+ return;
}
+
+ wd_smp_unlock(&flags);
return;
}
+
cpumask_clear_cpu(cpu, &wd_smp_cpus_pending);
if (cpumask_empty(&wd_smp_cpus_pending)) {
- unsigned long flags;
-
- wd_smp_lock(&flags);
if (cpumask_empty(&wd_smp_cpus_pending)) {
wd_smp_last_reset_tb = tb;
cpumask_andnot(&wd_smp_cpus_pending,
&wd_cpus_enabled,
&wd_smp_cpus_stuck);
}
- wd_smp_unlock(&flags);
}
+ wd_smp_unlock(&flags);
}
static void watchdog_timer_interrupt(int cpu)
--
2.33.1
next prev parent reply other threads:[~2021-10-26 16:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 16:27 [PATCH 0/2] powerpc prevents deadlock in the watchdog path Laurent Dufour
2021-10-26 16:27 ` [PATCH 1/2] powerpc/watchdog: prevent printk and send IPI while holding the wd lock Laurent Dufour
2021-10-27 3:29 ` Nicholas Piggin
2021-10-27 8:14 ` Laurent Dufour
2021-10-27 8:51 ` Nicholas Piggin
2021-10-27 9:49 ` Nicholas Piggin
2021-10-28 15:45 ` Laurent Dufour
2021-10-26 16:27 ` Laurent Dufour [this message]
2021-10-27 3:48 ` [PATCH 2/2] powerpc/watchdog: ensure watchdog data accesses are protected Nicholas Piggin
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=20211026162740.16283-3-ldufour@linux.ibm.com \
--to=ldufour@linux.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=paulus@samba.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).