watchdog/hardlockup: in watchdog_hardlockup_check() use cpumask_copy()
authorDouglas Anderson <dianders@chromium.org>
Sat, 27 May 2023 01:41:34 +0000 (18:41 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 19 Jun 2023 23:25:27 +0000 (16:25 -0700)
In the patch ("watchdog/hardlockup: add a "cpu" param to
watchdog_hardlockup_check()") we started using a cpumask to keep track of
which CPUs to backtrace.  When setting up this cpumask, it's better to use
cpumask_copy() than to just copy the structure directly.  Fix this.

Link: https://lkml.kernel.org/r/20230526184139.4.Iccee2d1ea19114dafb6553a854ea4d8ab2a3f25b@changeid
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Suggested-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/watchdog.c

index 32dac80..85f4839 100644 (file)
@@ -154,7 +154,9 @@ void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs)
         */
        if (is_hardlockup(cpu)) {
                unsigned int this_cpu = smp_processor_id();
-               struct cpumask backtrace_mask = *cpu_online_mask;
+               struct cpumask backtrace_mask;
+
+               cpumask_copy(&backtrace_mask, cpu_online_mask);
 
                /* Only print hardlockups once. */
                if (per_cpu(watchdog_hardlockup_warned, cpu))