1. 24 Jun, 2023 5 commits
  2. 19 Jun, 2023 15 commits
    • Petr Mladek's avatar
      watchdog/hardlockup: define HARDLOCKUP_DETECTOR_ARCH · 7ca8fe94
      Petr Mladek authored
      The HAVE_ prefix means that the code could be enabled. Add another
      variable for HAVE_HARDLOCKUP_DETECTOR_ARCH without this prefix.
      It will be set when it should be built. It will make it compatible
      with the other hardlockup detectors.
      
      The change allows to clean up dependencies of PPC_WATCHDOG
      and HAVE_HARDLOCKUP_DETECTOR_PERF definitions for powerpc.
      
      As a result HAVE_HARDLOCKUP_DETECTOR_PERF has the same dependencies
      on arm, x86, powerpc architectures.
      
      Link: https://lkml.kernel.org/r/20230616150618.6073-7-pmladek@suse.comSigned-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      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: default avatarAndrew Morton <akpm@linux-foundation.org>
      7ca8fe94
    • Petr Mladek's avatar
      watchdog/sparc64: define HARDLOCKUP_DETECTOR_SPARC64 · 47f4cb43
      Petr Mladek authored
      The HAVE_ prefix means that the code could be enabled. Add another
      variable for HAVE_HARDLOCKUP_DETECTOR_SPARC64 without this prefix.
      It will be set when it should be built. It will make it compatible
      with the other hardlockup detectors.
      
      Before, it is far from obvious that the SPARC64 variant is actually used:
      
      $> make ARCH=sparc64 defconfig
      $> grep HARDLOCKUP_DETECTOR .config
      CONFIG_HAVE_HARDLOCKUP_DETECTOR_BUDDY=y
      CONFIG_HAVE_HARDLOCKUP_DETECTOR_SPARC64=y
      
      After, it is more clear:
      
      $> make ARCH=sparc64 defconfig
      $> grep HARDLOCKUP_DETECTOR .config
      CONFIG_HAVE_HARDLOCKUP_DETECTOR_BUDDY=y
      CONFIG_HAVE_HARDLOCKUP_DETECTOR_SPARC64=y
      CONFIG_HARDLOCKUP_DETECTOR_SPARC64=y
      
      Link: https://lkml.kernel.org/r/20230616150618.6073-6-pmladek@suse.comSigned-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      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: default avatarAndrew Morton <akpm@linux-foundation.org>
      47f4cb43
    • Petr Mladek's avatar
      watchdog/hardlockup: make HAVE_NMI_WATCHDOG sparc64-specific · a5fcc236
      Petr Mladek authored
      There are several hardlockup detector implementations and several Kconfig
      values which allow selection and build of the preferred one.
      
      CONFIG_HARDLOCKUP_DETECTOR was introduced by the commit 23637d47
      ("lockup_detector: Introduce CONFIG_HARDLOCKUP_DETECTOR") in v2.6.36.
      It was a preparation step for introducing the new generic perf hardlockup
      detector.
      
      The existing arch-specific variants did not support the to-be-created
      generic build configurations, sysctl interface, etc. This distinction
      was made explicit by the commit 4a7863cc ("x86, nmi_watchdog:
      Remove ARCH_HAS_NMI_WATCHDOG and rely on CONFIG_HARDLOCKUP_DETECTOR")
      in v2.6.38.
      
      CONFIG_HAVE_NMI_WATCHDOG was introduced by the commit d314d74c
      ("nmi watchdog: do not use cpp symbol in Kconfig") in v3.4-rc1. It replaced
      the above mentioned ARCH_HAS_NMI_WATCHDOG. At that time, it was still used
      by three architectures, namely blackfin, mn10300, and sparc.
      
      The support for blackfin and mn10300 architectures has been completely
      dropped some time ago. And sparc is the only architecture with the historic
      NMI watchdog at the moment.
      
      And the old sparc implementation is really special. It is always built on
      sparc64. It used to be always enabled until the commit 7a5c8b57
      ("sparc: implement watchdog_nmi_enable and watchdog_nmi_disable") added
      in v4.10-rc1.
      
      There are only few locations where the sparc64 NMI watchdog interacts
      with the generic hardlockup detectors code:
      
        + implements arch_touch_nmi_watchdog() which is called from the generic
          touch_nmi_watchdog()
      
        + implements watchdog_hardlockup_enable()/disable() to support
          /proc/sys/kernel/nmi_watchdog
      
        + is always preferred over other generic watchdogs, see
          CONFIG_HARDLOCKUP_DETECTOR
      
        + includes asm/nmi.h into linux/nmi.h because some sparc-specific
          functions are needed in sparc-specific code which includes
          only linux/nmi.h.
      
      The situation became more complicated after the commit 05a4a952
      ("kernel/watchdog: split up config options") and commit 2104180a
      ("powerpc/64s: implement arch-specific hardlockup watchdog") in v4.13-rc1.
      They introduced HAVE_HARDLOCKUP_DETECTOR_ARCH. It was used for powerpc
      specific hardlockup detector. It was compatible with the perf one
      regarding the general boot, sysctl, and programming interfaces.
      
      HAVE_HARDLOCKUP_DETECTOR_ARCH was defined as a superset of
      HAVE_NMI_WATCHDOG. It made some sense because all arch-specific
      detectors had some common requirements, namely:
      
        + implemented arch_touch_nmi_watchdog()
        + included asm/nmi.h into linux/nmi.h
        + defined the default value for /proc/sys/kernel/nmi_watchdog
      
      But it actually has made things pretty complicated when the generic
      buddy hardlockup detector was added. Before the generic perf detector
      was newer supported together with an arch-specific one. But the buddy
      detector could work on any SMP system. It means that an architecture
      could support both the arch-specific and buddy detector.
      
      As a result, there are few tricky dependencies. For example,
      CONFIG_HARDLOCKUP_DETECTOR depends on:
      
        ((HAVE_HARDLOCKUP_DETECTOR_PERF || HAVE_HARDLOCKUP_DETECTOR_BUDDY) && !HAVE_NMI_WATCHDOG) || HAVE_HARDLOCKUP_DETECTOR_ARCH
      
      The problem is that the very special sparc implementation is defined as:
      
        HAVE_NMI_WATCHDOG && !HAVE_HARDLOCKUP_DETECTOR_ARCH
      
      Another problem is that the meaning of HAVE_NMI_WATCHDOG is far from clear
      without reading understanding the history.
      
      Make the logic less tricky and more self-explanatory by making
      HAVE_NMI_WATCHDOG specific for the sparc64 implementation. And rename it to
      HAVE_HARDLOCKUP_DETECTOR_SPARC64.
      
      Note that HARDLOCKUP_DETECTOR_PREFER_BUDDY, HARDLOCKUP_DETECTOR_PERF,
      and HARDLOCKUP_DETECTOR_BUDDY may conflict only with
      HAVE_HARDLOCKUP_DETECTOR_ARCH. They depend on HARDLOCKUP_DETECTOR
      and it is not longer enabled when HAVE_NMI_WATCHDOG is set.
      
      Link: https://lkml.kernel.org/r/20230616150618.6073-5-pmladek@suse.comSigned-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      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: default avatarAndrew Morton <akpm@linux-foundation.org>
      a5fcc236
    • Petr Mladek's avatar
      watchdog/hardlockup: declare arch_touch_nmi_watchdog() only in linux/nmi.h · 0c68bda6
      Petr Mladek authored
      arch_touch_nmi_watchdog() needs a different implementation for various
      hardlockup detector implementations. And it does nothing when
      any hardlockup detector is not built at all.
      
      arch_touch_nmi_watchdog() is declared via linux/nmi.h. And it must be
      defined as an empty function when there is no hardlockup detector.
      It is done directly in this header file for the perf and buddy detectors.
      And it is done in the included asm/linux.h for arch specific detectors.
      
      The reason probably is that the arch specific variants build the code
      using another conditions. For example, powerpc64/sparc64 builds the code
      when CONFIG_PPC_WATCHDOG is enabled.
      
      Another reason might be that these architectures define more functions
      in asm/nmi.h anyway.
      
      However the generic code actually knows when the function will be
      implemented. It happens when some full featured or the sparc64-specific
      hardlockup detector is built.
      
      In particular, CONFIG_HARDLOCKUP_DETECTOR can be enabled only when
      a generic or arch-specific full featured hardlockup detector is available.
      The only exception is sparc64 which can be built even when the global
      HARDLOCKUP_DETECTOR switch is disabled.
      
      The information about sparc64 is a bit complicated. The hardlockup
      detector is built there when CONFIG_HAVE_NMI_WATCHDOG is set and
      CONFIG_HAVE_HARDLOCKUP_DETECTOR_ARCH is not set.
      
      People might wonder whether this change really makes things easier.
      The motivation is:
      
        + The current logic in linux/nmi.h is far from obvious.
          For example, arch_touch_nmi_watchdog() is defined as {} when
          neither CONFIG_HARDLOCKUP_DETECTOR_COUNTS_HRTIMER nor
          CONFIG_HAVE_NMI_WATCHDOG is defined.
      
        + The change synchronizes the checks in lib/Kconfig.debug and
          in the generic code.
      
        + It is a step that will help cleaning HAVE_NMI_WATCHDOG related
          checks.
      
      The change should not change the existing behavior.
      
      Link: https://lkml.kernel.org/r/20230616150618.6073-4-pmladek@suse.comSigned-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      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: default avatarAndrew Morton <akpm@linux-foundation.org>
      0c68bda6
    • Petr Mladek's avatar
      watchdog/hardlockup: make the config checks more straightforward · 1356d0b9
      Petr Mladek authored
      There are four possible variants of hardlockup detectors:
      
        + buddy: available when SMP is set.
      
        + perf: available when HAVE_HARDLOCKUP_DETECTOR_PERF is set.
      
        + arch-specific: available when HAVE_HARDLOCKUP_DETECTOR_ARCH is set.
      
        + sparc64 special variant: available when HAVE_NMI_WATCHDOG is set
      	and HAVE_HARDLOCKUP_DETECTOR_ARCH is not set.
      
      The check for the sparc64 variant is more complicated because
      HAVE_NMI_WATCHDOG is used to #ifdef code used by both arch-specific
      and sparc64 specific variant. Therefore it is automatically
      selected with HAVE_HARDLOCKUP_DETECTOR_ARCH.
      
      This complexity is partly hidden in HAVE_HARDLOCKUP_DETECTOR_NON_ARCH.
      It reduces the size of some checks but it makes them harder to follow.
      
      Finally, the other temporary variable HARDLOCKUP_DETECTOR_NON_ARCH
      is used to re-compute HARDLOCKUP_DETECTOR_PERF/BUDDY when the global
      HARDLOCKUP_DETECTOR switch is enabled/disabled.
      
      Make the logic more straightforward by the following changes:
      
        + Better explain the role of HAVE_HARDLOCKUP_DETECTOR_ARCH and
          HAVE_NMI_WATCHDOG in comments.
      
        + Add HAVE_HARDLOCKUP_DETECTOR_BUDDY so that there is separate
          HAVE_* for all four hardlockup detector variants.
      
          Use it in the other conditions instead of SMP. It makes it
          clear that it is about the buddy detector.
      
        + Open code HAVE_HARDLOCKUP_DETECTOR_NON_ARCH in HARDLOCKUP_DETECTOR
          and HARDLOCKUP_DETECTOR_PREFER_BUDDY. It helps to understand
          the conditions between the four hardlockup detector variants.
      
        + Define the exact conditions when HARDLOCKUP_DETECTOR_PERF/BUDDY
          can be enabled. It explains the dependency on the other
          hardlockup detector variants.
      
          Also it allows to remove HARDLOCKUP_DETECTOR_NON_ARCH by using "imply".
          It triggers re-evaluating HARDLOCKUP_DETECTOR_PERF/BUDDY when
          the global HARDLOCKUP_DETECTOR switch is changed.
      
        + Add dependency on HARDLOCKUP_DETECTOR so that the affected variables
          disappear when the hardlockup detectors are disabled.
      
          Another nice side effect is that HARDLOCKUP_DETECTOR_PREFER_BUDDY
          value is not preserved when the global switch is disabled.
          The user has to make the decision again when it gets re-enabled.
      
      Link: https://lkml.kernel.org/r/20230616150618.6073-3-pmladek@suse.comSigned-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      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: default avatarAndrew Morton <akpm@linux-foundation.org>
      1356d0b9
    • Petr Mladek's avatar
      watchdog/hardlockup: sort hardlockup detector related config values a logical way · 4917a25f
      Petr Mladek authored
      Patch series "watchdog/hardlockup: Cleanup configuration of hardlockup
      detectors", v2.
      
      Clean up watchdog Kconfig after introducing the buddy detector.
      
      
      This patch (of 6):
      
      There are four possible variants of hardlockup detectors:
      
        + buddy: available when SMP is set.
      
        + perf: available when HAVE_HARDLOCKUP_DETECTOR_PERF is set.
      
        + arch-specific: available when HAVE_HARDLOCKUP_DETECTOR_ARCH is set.
      
        + sparc64 special variant: available when HAVE_NMI_WATCHDOG is set
      	and HAVE_HARDLOCKUP_DETECTOR_ARCH is not set.
      
      Only one hardlockup detector can be compiled in. The selection is done
      using quite complex dependencies between several CONFIG variables.
      The following patches will try to make it more straightforward.
      
      As a first step, reorder the definitions of the various CONFIG variables.
      The logical order is:
      
         1. HAVE_* variables define available variants. They are typically
            defined in the arch/ config files.
      
         2. HARDLOCKUP_DETECTOR y/n variable defines whether the hardlockup
            detector is enabled at all.
      
         3. HARDLOCKUP_DETECTOR_PREFER_BUDDY y/n variable defines whether
            the buddy detector should be preferred over the perf one.
            Note that the arch specific variants are always preferred when
            available.
      
         4. HARDLOCKUP_DETECTOR_PERF/BUDDY variables define whether the given
            detector is enabled in the end.
      
         5. HAVE_HARDLOCKUP_DETECTOR_NON_ARCH and HARDLOCKUP_DETECTOR_NON_ARCH
            are temporary variables that are going to be removed in
            a followup patch.
      
      This is a preparation step for further cleanup. It will change the logic
      without shuffling the definitions.
      
      This change temporary breaks the C-like ordering where the variables are
      declared or defined before they are used. It is not really needed for
      Kconfig. Also the following patches will rework the logic so that
      the ordering will be C-like in the end.
      
      The patch just shuffles the definitions. It should not change the existing
      behavior.
      
      Link: https://lkml.kernel.org/r/20230616150618.6073-1-pmladek@suse.com
      Link: https://lkml.kernel.org/r/20230616150618.6073-2-pmladek@suse.comSigned-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      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: default avatarAndrew Morton <akpm@linux-foundation.org>
      4917a25f
    • Douglas Anderson's avatar
      watchdog/hardlockup: move SMP barriers from common code to buddy code · 28168eca
      Douglas Anderson authored
      It's been suggested that since the SMP barriers are only potentially
      useful for the buddy hardlockup detector, not the perf hardlockup
      detector, that the barriers belong in the buddy code.  Let's move them and
      add clearer comments about why they're needed.
      
      Link: https://lkml.kernel.org/r/20230526184139.9.I5ab0a0eeb0bd52fb23f901d298c72fa5c396e22b@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarPetr 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      28168eca
    • Douglas Anderson's avatar
      watchdog/buddy: simplify the dependency for HARDLOCKUP_DETECTOR_PREFER_BUDDY · 7ece48b7
      Douglas Anderson authored
      The dependency for HARDLOCKUP_DETECTOR_PREFER_BUDDY was more complicated
      than it needed to be.  If the "perf" detector is available and we have SMP
      then we have a choice, so enable the config based on just those two config
      items.
      
      Link: https://lkml.kernel.org/r/20230526184139.8.I49d5b483336b65b8acb1e5066548a05260caf809@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarPetr 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      7ece48b7
    • Douglas Anderson's avatar
      watchdog/buddy: don't copy the cpumask in watchdog_next_cpu() · 813efda2
      Douglas Anderson authored
      There's no reason to make a copy of the "watchdog_cpus" locally in
      watchdog_next_cpu().  Making a copy wouldn't make things any more race
      free and we're just reading the value so there's no need for a copy.
      
      Link: https://lkml.kernel.org/r/20230526184139.7.If466f9a2b50884cbf6a1d8ad05525a2c17069407@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarPetr 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      813efda2
    • Douglas Anderson's avatar
      watchdog/buddy: cleanup how watchdog_buddy_check_hardlockup() is called · d3b62ace
      Douglas Anderson authored
      In the patch ("watchdog/hardlockup: detect hard lockups using secondary
      (buddy) CPUs"), we added a call from the common watchdog.c file into the
      buddy.  That call could be done more cleanly.  Specifically:
      
      1. If we move the call into watchdog_hardlockup_kick() then it keeps
         watchdog_timer_fn() simpler.
      2. We don't need to pass an "unsigned long" to the buddy for the timer
         count. In the patch ("watchdog/hardlockup: add a "cpu" param to
         watchdog_hardlockup_check()") the count was changed to "atomic_t"
         which is backed by an int, so we should match types.
      
      Link: https://lkml.kernel.org/r/20230526184139.6.I006c7d958a1ea5c4e1e4dc44a25596d9bb5fd3ba@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarPetr 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      d3b62ace
    • Douglas Anderson's avatar
      watchdog/hardlockup: remove softlockup comment in touch_nmi_watchdog() · 05e7b558
      Douglas Anderson authored
      In the patch ("watchdog/hardlockup: add comments to touch_nmi_watchdog()")
      we adjusted some comments for touch_nmi_watchdog().  The comment about the
      softlockup had a typo and were also felt to be too obvious.  Remove it.
      
      Link: https://lkml.kernel.org/r/20230526184139.5.Ia593afc9eb12082d55ea6681dc2c5a89677f20a8@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarPetr 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      05e7b558
    • Douglas Anderson's avatar
      watchdog/hardlockup: in watchdog_hardlockup_check() use cpumask_copy() · 7a71d8e6
      Douglas Anderson authored
      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@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarPetr 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      7a71d8e6
    • Douglas Anderson's avatar
      watchdog/hardlockup: don't use raw_cpu_ptr() in watchdog_hardlockup_kick() · 2711e4ad
      Douglas Anderson authored
      In the patch ("watchdog/hardlockup: add a "cpu" param to
      watchdog_hardlockup_check()") there was no reason to use raw_cpu_ptr(). 
      Using this_cpu_ptr() works fine.
      
      Link: https://lkml.kernel.org/r/20230526184139.3.I660e103077dcc23bb29aaf2be09cb234e0495b2d@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarPetr 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      2711e4ad
    • Douglas Anderson's avatar
      watchdog/hardlockup: HAVE_NMI_WATCHDOG must implement watchdog_hardlockup_probe() · 6426e8d1
      Douglas Anderson authored
      Right now there is one arch (sparc64) that selects HAVE_NMI_WATCHDOG
      without selecting HAVE_HARDLOCKUP_DETECTOR_ARCH.  Because of that one
      architecture, we have some special case code in the watchdog core to
      handle the fact that watchdog_hardlockup_probe() isn't implemented.
      
      Let's implement watchdog_hardlockup_probe() for sparc64 and get rid of the
      special case.
      
      As a side effect of doing this, code inspection tells us that we could fix
      a minor bug where the system won't properly realize that NMI watchdogs are
      disabled.  Specifically, on powerpc if CONFIG_PPC_WATCHDOG is turned off
      the arch might still select CONFIG_HAVE_HARDLOCKUP_DETECTOR_ARCH which
      selects CONFIG_HAVE_NMI_WATCHDOG.  Since CONFIG_PPC_WATCHDOG was off then
      nothing will override the "weak" watchdog_hardlockup_probe() and we'll
      fallback to looking at CONFIG_HAVE_NMI_WATCHDOG.
      
      Link: https://lkml.kernel.org/r/20230526184139.2.Ic6ebbf307ca0efe91f08ce2c1eb4a037ba6b0700@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarPetr 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      6426e8d1
    • Douglas Anderson's avatar
      watchdog/hardlockup: keep kernel.nmi_watchdog sysctl as 0444 if probe fails · 9ec272c5
      Douglas Anderson authored
      Patch series "watchdog: Cleanup / fixes after buddy series v5 reviews".
      
      This patch series attempts to finish resolving the feedback received
      from Petr Mladek on the v5 series I posted.
      
      Probably the only thing that wasn't fully as clean as Petr requested was
      the Kconfig stuff.  I couldn't find a better way to express it without a
      more major overhaul.  In the very least, I renamed "NON_ARCH" to
      "PERF_OR_BUDDY" in the hopes that will make it marginally better.
      
      Nothing in this series is terribly critical and even the bugfixes are
      small.  However, it does cleanup a few things that were pointed out in
      review.
      
      
      This patch (of 10):
      
      The permissions for the kernel.nmi_watchdog sysctl have always been set at
      compile time despite the fact that a watchdog can fail to probe.  Let's
      fix this and set the permissions based on whether the hardlockup detector
      actually probed.
      
      Link: https://lkml.kernel.org/r/20230527014153.2793931-1-dianders@chromium.org
      Link: https://lkml.kernel.org/r/20230526184139.1.I0d75971cc52a7283f495aac0bd5c3041aadc734e@changeid
      Fixes: a994a314 ("watchdog/hardlockup/perf: Implement init time detection of perf")
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reported-by: default avatarPetr Mladek <pmladek@suse.com>
      Closes: https://lore.kernel.org/r/ZHCn4hNxFpY5-9Ki@alleyReviewed-by: default avatarPetr 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      9ec272c5
  3. 10 Jun, 2023 20 commits