mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [to-be-updated] watchdog-softlockup-fix-softlockup_stop_all-hungtask-bug.patch removed from -mm tree
@ 2021-09-16 19:44 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-09-16 19:44 UTC (permalink / raw)
  To: guojinhui, mm-commits, pmladek


The patch titled
     Subject: watchdog/softlockup: fix softlockup_stop_all() hungtask bug
has been removed from the -mm tree.  Its filename was
     watchdog-softlockup-fix-softlockup_stop_all-hungtask-bug.patch

This patch was dropped because an updated version will be merged

------------------------------------------------------
From: Jinhui Guo <guojinhui@huawei.com>
Subject: watchdog/softlockup: fix softlockup_stop_all() hungtask bug

If NR_CPUS equal to 1, it would trigger hungtask, it can be
triggered by follow command:
	echo 0 > /proc/sys/kernel/watchdog
	echo 1 > /proc/sys/kernel/watchdog
The hungtask stack:
	__schedule
	schedule
	schedule_timeout
	__wait_for_common
	softlockup_stop_fn
	lockup_detector_reconfigure
	proc_watchdog_common
	proc_watchdog
	proc_sys_call_handler
	vfs_write
	ksys_write
The watchdog_allowed_mask is completely cleared when the
watchdog is disabled. But the macro for_each_cpu() assume
all masks are "1" when macro NR_CPUS equal to 1. It makes
watchdog_allowed_mask not work at all.

Link: https://lkml.kernel.org/r/20210916175650.1380-1-guojinhui@huawei.com
Fixes: be45bf5395e0 ("watchdog/softlockup: Fix cpu_stop_queue_work() double-queue bug")
Signed-off-by: Jinhui Guo <guojinhui@huawei.com>
Cc: Petr Mladek <pmladek@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/cpumask.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/include/linux/cpumask.h~watchdog-softlockup-fix-softlockup_stop_all-hungtask-bug
+++ a/include/linux/cpumask.h
@@ -175,10 +175,11 @@ static inline int cpumask_any_distribute
 	return cpumask_first(srcp);
 }
 
+/* It should check cpumask in some special case, such as watchdog */
 #define for_each_cpu(cpu, mask)			\
-	for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
+	for ((cpu) = 0; (cpu) < 1 && test_bit(0, cpumask_bits(mask)); (cpu)++)
 #define for_each_cpu_not(cpu, mask)		\
-	for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
+	for ((cpu) = 0; (cpu) < 1 && !test_bit(0, cpumask_bits(mask)); (cpu)++)
 #define for_each_cpu_wrap(cpu, mask, start)	\
 	for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)(start))
 #define for_each_cpu_and(cpu, mask1, mask2)	\
_

Patches currently in -mm which might be from guojinhui@huawei.com are



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-16 19:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 19:44 [to-be-updated] watchdog-softlockup-fix-softlockup_stop_all-hungtask-bug.patch removed from -mm tree akpm

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).