Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2839701rwd; Fri, 2 Jun 2023 15:53:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7NpJ21G3qPRIZ5JTSONRDxrSNlF+3swUqhY1HmqfGClVtPEQ5s8cFS15hiPqSg3yFN3yuQ X-Received: by 2002:a05:6a20:9191:b0:100:60f3:2975 with SMTP id v17-20020a056a20919100b0010060f32975mr24346pzd.4.1685746386318; Fri, 02 Jun 2023 15:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685746386; cv=none; d=google.com; s=arc-20160816; b=id27cs3929q6Uk8zyYb/BNhbnLDLP1Px5b7m/kjGso6j2e8E2xeHQzA2Zq8hpcFf1c eokIwtq7czR7VTNQ8NF2N+RuqJ2GHWq+t3tXPTmfx7LzLhzIdpZgpmutSAk+18SZ8NkU W+sGPkfADRpSpLRYS/TpcaVBAFdctp08fDhaAmomd6/oNgyI8RHsPKhjKAE8/TCR9Iwd GISHU7Kr/35wQZtsNevtqJSbnmV6bUta/pmewwZdfpLSJPZGBAtRsK3Mf+VrQMiG5RxP E38aJZMLS5mLwMJ+oB+U9KbVCvRiSZXulabPDkYu4VYQfgJ6V7Rx1Lr5SecX5bRCvAbX JmFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=D7Rtyb72cdysLbSdHEt6SRIzf41F62vRjWfqA6Qc0qY=; b=M9Ev6yb/xlGJLnFCrl7r7aV26ZG4arVTRkqSxPjWIZVnBNALPGIinNVv/Cws+A9kvR 1gPuwn8XloloW6cHDm+g0cp9ioLxq3t4GTwo+zNs3TtcLcj97MwwwV+tNb7qnZAGctj3 TxcuyxCJMDtySxx3wG+Plb5xyus+ao0xHvJ9jV1V4kijrfdoQjQpVOPPGwUYPLYuY4yS B0ZQG/DXAPRkCtJNkRctfGieEea8+/f+h6sOYpM6kfE0DkdfVKyQ0F8fOklGlRrRtflg mamRIjnlqAl+SlPUCCY1EY4OV4iZxELtahzp4Xk72SkmoqQmyE8B+o8OCzEenTOkVmws r1kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Y0+uR4eq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c195-20020a6335cc000000b0053ef5472637si1601769pga.150.2023.06.02.15.52.52; Fri, 02 Jun 2023 15:53:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Y0+uR4eq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236424AbjFBWr5 (ORCPT + 99 others); Fri, 2 Jun 2023 18:47:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234860AbjFBWr4 (ORCPT ); Fri, 2 Jun 2023 18:47:56 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7DBA1AD for ; Fri, 2 Jun 2023 15:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=D7Rtyb72cdysLbSdHEt6SRIzf41F62vRjWfqA6Qc0qY=; b=Y0+uR4eqNAVDRYyv0I1BrO6KSj BeMQBuXeME3yqAuYR59VialxhjXSE8quz8a+8dLeCWlpr9ykproHq2oWjdGuXo4NWypZuveZp1OL8 DNVjnavmAUwuvtYcaV1oFiMP9mIIEfZgHcyeDZddRWkHgj+4Wv4f/Emug97WyiaqzMIQVJ7nwEPXC 4ZbWeSa5i/0zZgY/uKu98Mx8JvuIDB4bRb8tlVdtGC8ytuvrH3zZRle3BHjX+iyYctnmkeWgKoWUJ Cej+bRrkB80gkQ6TjNwe0BQhIjowCymyHABAnEDhMAYXW/8V+AxQeQPEmKKkb02yJmZASq2pg+uRd 6fxrB1sQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q5DYg-001Tb8-1n; Fri, 02 Jun 2023 22:47:46 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 2FA453002F0; Sat, 3 Jun 2023 00:47:45 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0CE112058125D; Sat, 3 Jun 2023 00:47:45 +0200 (CEST) Date: Sat, 3 Jun 2023 00:47:44 +0200 From: Peter Zijlstra To: Song Liu Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, Andrew Morton Subject: Re: [PATCH v4] watchdog: Allow nmi watchdog to use "ref-cycles" event Message-ID: <20230602224744.GC695361@hirez.programming.kicks-ass.net> References: <20230518002555.1114189-1-song@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230518002555.1114189-1-song@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: Peter Zijlstra > Signed-off-by: Song Liu > > --- > 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?