Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10986009rwr; Fri, 12 May 2023 16:47:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6eLzKXr6BzhQwb944AHfIuokYNgMGSqhiVOlaT+/ZfKPEVmgu0d7fbJ8FHjgQtPmhZ3I+0 X-Received: by 2002:a05:6a20:8426:b0:101:90e:c0cb with SMTP id c38-20020a056a20842600b00101090ec0cbmr20750812pzd.59.1683935269325; Fri, 12 May 2023 16:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683935269; cv=none; d=google.com; s=arc-20160816; b=LNWKaS9A3nRznxQcpneQgyWXZ5qD9CouN10uII4clR7qbNUxn/LHppc73zg0XxqJ1X l3xuHlyrciCu9yapk7euzqlftXERvssowbHuRX/+ykPIU5y7HzWvbnWufANjNpbUOJgo DAdDQQrkziun2xbZb+CQNM5ay0MmZiJKfr+aJMjv/rOKP5GMCwfj/HD3Lx6irSAA5NsR 2D5jQnSNnRqrBqWgczK1fZEJABC81K1gGcLpjjYyPLtw2Rwa43T7CXnft7LFRHH/xS5h CKsMTBEql6W0NyF0pOTmnCfAJSGj15d9264hH9gBJnPKwm5QrL997WJ2JJZEMhV4sN+C x0/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=pSeUFFQaXCnILYTBq9GLKt7nYaYQsmnA/VrSBnO8jBQ=; b=krsiCJta2iKQsb+cIZhchjRVoId8xCdzLdEZKQyO1cp+jmIBVBPjFc9t9yA/ZGbPoP pgC3bNS0kZ3CdzBMhsA/lhLlZzIdMJS20SV/x1eSj4YY9K3L94IiP36dV1/z/xM0Io7n Przo0kDUXILcoEw+V+PSoQjX9QmSl8+H6S9R2/fECP5kQoap6E8QAX0C0Rauuy03hCfj RMlNwCzwkJ4CKapH+IKVuPpivkM/cfWej6cZzkte0GyZltbqY1VDaed1iR158xVD23xI N4S1ppgLllrWPRcVJg5RHd163EInWVHWQ4jlDdVAOJOIzLAzvrSrHmBt9Xlcg8wraO8l 8qFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=dXTIYgUn; 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 d70-20020a633649000000b0053070f4df43si5756592pga.450.2023.05.12.16.47.37; Fri, 12 May 2023 16:47:49 -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=@linux-foundation.org header.s=korg header.b=dXTIYgUn; 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 S240586AbjELXlA (ORCPT + 99 others); Fri, 12 May 2023 19:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjELXk7 (ORCPT ); Fri, 12 May 2023 19:40:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B13E19AD for ; Fri, 12 May 2023 16:40:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C68F561919 for ; Fri, 12 May 2023 23:40:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06390C433D2; Fri, 12 May 2023 23:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1683934857; bh=Crwt2cgtC/p3F/oUx8J189h37ihPXCFKmATi9X0z6ro=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dXTIYgUn6w2aR4H6KEPPKEKII8eUKoPiq7dt9eFPokRrVGGg/10bJqXgeO1dx7Eah kMUkhRhPclGabHDC2Gj+7yWxWjuUvzcWAKIVowjOj4aIuYBb+PDTm6QGTFRBBYo/Lq ovGBW9fYnHspX60XQQhSBB9D/1lMU3bTq47JoAmI= Date: Fri, 12 May 2023 16:40:56 -0700 From: Andrew Morton To: Song Liu Cc: , , Peter Zijlstra Subject: Re: [PATCH] watchdog: Prefer use "ref-cycles" for NMI watchdog Message-Id: <20230512164056.8f1e4e23032f7f7f5cb69df0@linux-foundation.org> In-Reply-To: <20230509221700.859865-1-song@kernel.org> References: <20230509221700.859865-1-song@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,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 Tue, 9 May 2023 15:17:00 -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. Try use "ref-cycles" for the watchdog. If the CPU supports it, so > that one more hardware counter is available to the user. If the CPU doesn't > support "ref-cycles", fall back to "cycles". > > The downside of this change is that users of "ref-cycles" need to disable > nmi_watchdog. > > ... > > @@ -286,6 +286,12 @@ int __init hardlockup_detector_perf_init(void) > { > int ret = hardlockup_detector_event_create(); > > + if (ret) { If we get here, hardlockup_detector_event_create() has sent a scary pr_debug message. > + /* Failed to create "ref-cycles", try "cycles" instead */ > + wd_hw_attr.config = PERF_COUNT_HW_CPU_CYCLES; > + ret = hardlockup_detector_event_create(); So it would be good to emit a followup message here telling users that things are OK. Or tell the user we're retrying with a different counter, etc. > + /* Failed to create "ref-cycles", try "cycles" instead */ > + wd_hw_attr.config = PERF_COUNT_HW_CPU_CYCLES; > + ret = hardlockup_detector_event_create(); > + } > + > if (ret) { > pr_info("Perf NMI watchdog permanently disabled\n"); > } else { > -- > 2.34.1