lkml.org 
[lkml]   [2017]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch V2 25/29] lockup_detector: Implement init time detection of perf
    Use the init time detection of the perf NMI watchdog to determine whether
    the perf NMI watchdog is functional. If not disable it permanentely. It
    won't come back magically at runtime.

    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Don Zickus <dzickus@redhat.com>
    Cc: Chris Metcalf <cmetcalf@mellanox.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Sebastian Siewior <bigeasy@linutronix.de>
    Cc: Nicholas Piggin <npiggin@gmail.com>
    Cc: Ulrich Obergfell <uobergfe@redhat.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Link: http://lkml.kernel.org/r/20170831073054.997264122@linutronix.de

    ---
    kernel/watchdog.c | 13 ++++++++++++-
    1 file changed, 12 insertions(+), 1 deletion(-)

    --- a/kernel/watchdog.c
    +++ b/kernel/watchdog.c
    @@ -44,6 +44,7 @@ int __read_mostly watchdog_user_enabled
    int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT;
    int __read_mostly soft_watchdog_user_enabled = 1;
    int __read_mostly watchdog_thresh = 10;
    +int __read_mostly nmi_watchdog_available;

    struct cpumask watchdog_allowed_mask __read_mostly;
    static bool softlockup_threads_initialized __read_mostly;
    @@ -114,6 +115,12 @@ void __weak watchdog_nmi_disable(unsigne
    hardlockup_detector_perf_disable();
    }

    +/* Return 0, if a NMI watchdog is available. Error code otherwise */
    +int __weak __init void watchdog_nmi_probe(void)
    +{
    + return hardlockup_detector_perf_init();
    +}
    +
    /**
    * watchdog_nmi_reconfigure - Optional function to reconfigure NMI watchdogs
    * @run: If false stop the watchdogs on all enabled CPUs
    @@ -145,7 +152,7 @@ static void lockup_detector_update_enabl
    watchdog_enabled = 0;
    if (!watchdog_user_enabled)
    return;
    - if (nmi_watchdog_user_enabled)
    + if (nmi_watchdog_available && nmi_watchdog_user_enabled)
    watchdog_enabled |= NMI_WATCHDOG_ENABLED;
    if (soft_watchdog_user_enabled)
    watchdog_enabled |= SOFT_WATCHDOG_ENABLED;
    @@ -692,6 +699,8 @@ int proc_watchdog(struct ctl_table *tabl
    int proc_nmi_watchdog(struct ctl_table *table, int write,
    void __user *buffer, size_t *lenp, loff_t *ppos)
    {
    + if (!nmi_watchdog_available && write)
    + return -ENOTSUPP;
    return proc_watchdog_common(NMI_WATCHDOG_ENABLED,
    table, write, buffer, lenp, ppos);
    }
    @@ -764,5 +773,7 @@ void __init lockup_detector_init(void)
    cpumask_copy(&watchdog_cpumask, cpu_possible_mask);
    #endif

    + if (!watchdog_nmi_probe())
    + nmi_watchdog_available = true;
    softlockup_init_threads();
    }

    \
     
     \ /
      Last update: 2017-09-12 21:51    [W:4.042 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site