mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@meta.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <song@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Kernel Team <kernel-team@meta.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v4] watchdog: Allow nmi watchdog to use "ref-cycles" event
Date: Fri, 2 Jun 2023 23:15:14 +0000	[thread overview]
Message-ID: <DCF269A8-4C64-4FDE-AFAC-92B6029EA3BA@fb.com> (raw)
In-Reply-To: <20230602224744.GC695361@hirez.programming.kicks-ass.net>



> On Jun 2, 2023, at 3:47 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> 
> On Wed, May 17, 2023 at 05:25:55PM -0700, Song Liu wrote:
>> NMI watchdog permanently consumes one hardware counters per CPU on the
>> system. For systems that use many hardware counters, this causes more
>> aggressive time multiplexing of perf events.
>> 
>> OTOH, some CPUs (mostly Intel) support "ref-cycles" event, which is rarely
>> used. Add kernel cmdline arg nmi_watchdog=ref-cycles to configure the
>> watchdog to use "ref-cycles" event instead of "cycles".
>> 
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Signed-off-by: Song Liu <song@kernel.org>
>> 
>> ---
>> Changes in v4:
>> Fix compile error for !CONFIG_HARDLOCKUP_DETECTOR_PERF. (kernel test bot)
>> 
>> Changes in v3:
>> 
>> Pivot the design to use kernel arg nmi_watchdog=ref-cycles (Peter)
>> ---
>> Documentation/admin-guide/kernel-parameters.txt | 5 +++--
>> include/linux/nmi.h                             | 2 ++
>> kernel/watchdog.c                               | 2 ++
>> kernel/watchdog_hld.c                           | 9 +++++++++
>> 4 files changed, 16 insertions(+), 2 deletions(-)
>> 
>> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
>> index 9e5bab29685f..d378e23dad7c 100644
>> --- a/Documentation/admin-guide/kernel-parameters.txt
>> +++ b/Documentation/admin-guide/kernel-parameters.txt
>> @@ -3593,10 +3593,12 @@
>> Format: [state][,regs][,debounce][,die]
>> 
>> nmi_watchdog= [KNL,BUGS=X86] Debugging features for SMP kernels
>> - Format: [panic,][nopanic,][num]
>> + Format: [panic,][nopanic,][ref-cycles][num]
>> Valid num: 0 or 1
>> 0 - turn hardlockup detector in nmi_watchdog off
>> 1 - turn hardlockup detector in nmi_watchdog on
>> + ref-cycles - configure the watchdog with perf event
>> +             "ref-cycles" instead of "cycles"
>> When panic is specified, panic when an NMI watchdog
>> timeout occurs (or 'nopanic' to not panic on an NMI
>> watchdog, if CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is set)
> 
> I still hate the whole ref-cycles thing, at the very least powerpc also
> has HAVE_HARDLOCKUP_DETECTOR_PERF and they don't have ref-cycles, but
> perhaps them wants to use a different event when the moon is just so...
> 
> What again was wrong with the option of specifying a raw event value and
> falling back to cpu-cycles if that fails?

The same raw event number may mean different events on different hardware. 
So it is more likely to make mistakes in configurations. For example, r300 
means ref-cycles on Intel CPUs, but it also means something else on AMD 
CPUs. I need to be very careful which hosts to run with nmi_watchdog=r300, 
as it may cause surprises. OTOH, nmi_watchdog=ref-cycles won't have this 
issue. Of course, this won't work for powerpc. 

Does this make sense?

Thanks,
Song


  reply	other threads:[~2023-06-02 23:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18  0:25 Song Liu
2023-05-18  6:44 ` Yonghong Song
2023-05-18 20:12   ` Song Liu
2023-05-19 16:59 ` Song Liu
2023-05-25 22:20   ` Song Liu
2023-06-02 22:11     ` Song Liu
2023-06-02 22:47 ` Peter Zijlstra
2023-06-02 23:15   ` Song Liu [this message]
2023-06-08 18:18     ` Song Liu

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=DCF269A8-4C64-4FDE-AFAC-92B6029EA3BA@fb.com \
    --to=songliubraving@meta.com \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=song@kernel.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

all inboxes | Powered by JetHome®