Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6472739rwl; Mon, 9 Jan 2023 08:45:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXuXtvGZAu7aC7TB2Xr4L15KF8dYap01PfaTROAKqlv+5OoAtmb6EktV8npGvAW5X+8Ix+rC X-Received: by 2002:a17:902:a5cc:b0:192:f999:1e73 with SMTP id t12-20020a170902a5cc00b00192f9991e73mr16187206plq.51.1673282752981; Mon, 09 Jan 2023 08:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673282752; cv=none; d=google.com; s=arc-20160816; b=rBRdCIZIYA5J21a8vtKtYn6VX2lj9THtnY0Gr4TzrqWKWtWVRVs2EMPFaFpkdGDCvD qC2ML0bGNltbVVhfxyIBFjvnxNOcxug8n/Vio/XPsg6jOFz1+xFvhfIPnhavKcCfMllc xRdmoH0oWCOC+WYUYx9OgE5mM/c1j04ktzdcswPUTo+K4g0gE635PS8GSIKU884jru7S xdzLmWQGhlLnxQZCPbEvos2D9dfvSiVb+8ObtHiguiYb2RhAWnFNALfe+E7o8nqepNii 676PucLu7mGfawKzmgoyOQfpr9Q0YtBlDYsTuNNa1HwC3wkINzsbWAaTPAGJ4pReCiON bHmA== 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=j+Gen2eU0jf9G0iqx+BIbLnHGKCdcFm/8cL1m3LwQjY=; b=b5CDPpyIxtw5QzokgxBz4NWkOhktiaEYHsmBmdNEHlngEp9PJNFmE9Zj+OZn2FqP0p EHFGPrf0ulgPSpIJoKiiBcRmMuVFJYKH0XlJUCTtNvfKuwDlRIjqQyi1zNgId6ljOmTW ecLS+4kclNbHRLJTSQmq/Hxm868YGPbfUFIYa9ji71EvRJD5tfcr4hZWlr4kJQAj2SLy vrOeyfOmP5ZJnUak1yp2hiq5T8dHW4jf3rZ2ok8CBLJGncaaAl/pkE3R9DzrlsNp5hfJ NumvtdwM/CORnoqbND6u9DHnMQHvJ4KkQrWoqXXDmQXd0TwwTJNETmDzNZF+Acp/EWLH qbYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=j59SI0kN; 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 6-20020a170902e9c600b00192b150cf87si8689041plk.153.2023.01.09.08.45.43; Mon, 09 Jan 2023 08:45:52 -0800 (PST) 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=j59SI0kN; 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 S230042AbjAIQUS (ORCPT + 53 others); Mon, 9 Jan 2023 11:20:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbjAIQUN (ORCPT ); Mon, 9 Jan 2023 11:20:13 -0500 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 B3F61192B9 for ; Mon, 9 Jan 2023 08:20:11 -0800 (PST) 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=j+Gen2eU0jf9G0iqx+BIbLnHGKCdcFm/8cL1m3LwQjY=; b=j59SI0kNy2I8DmsJs6em3tvKcX IpwD5QTuYugoFRnG4sd6ob+yPyBeJ07//2wTRA8PTlktw8DTcoPAn2MZZtTB2qBaaRDZkrCy1eZ/4 WrhqyrSecJdAZLLysNtj+834ibt9mX0hJFZB23+hh/KRsZ6Ad8U8vaI0DiySGrSRgsgWPdiI6Oucw EoJz+qLRl37m5UVXZqMEiUQruF2HDZeHojZaOcGRvuRQgJFPK+KxgFNyHq2QhYDqjPuaEC/Y186M5 nNxOkp/yp70xZ7lTWP7dMm0y0Tc+OiE9hnpY4ZNKaNRS+/0ZmNJ2PnwSBHJaiIfl8i79beyfHr5vD EGGY44Zw==; 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 1pEusL-002mH6-34; Mon, 09 Jan 2023 16:19:54 +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)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5DE00300293; Mon, 9 Jan 2023 17:19:59 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 31BE620086EAB; Mon, 9 Jan 2023 17:19:59 +0100 (CET) Date: Mon, 9 Jan 2023 17:19:59 +0100 From: Peter Zijlstra To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org Subject: Re: [PATCH x86/nmi 1/2] x86/nmi: Accumulate NMI-progress evidence in exc_nmi() Message-ID: References: <20230105011537.1774941-1-paulmck@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230105011537.1774941-1-paulmck@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 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, Jan 04, 2023 at 05:15:36PM -0800, Paul E. McKenney wrote: > diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c > index cec0bfa3bc04f..4f1651dc65b3a 100644 > --- a/arch/x86/kernel/nmi.c > +++ b/arch/x86/kernel/nmi.c > @@ -69,6 +69,15 @@ struct nmi_stats { > unsigned int unknown; > unsigned int external; > unsigned int swallow; > + unsigned long recv_jiffies; > + unsigned long idt_seq; > + unsigned long idt_nmi_seq; > + unsigned long idt_ignored; > + atomic_long_t idt_calls; > + unsigned long idt_seq_snap; > + unsigned long idt_nmi_seq_snap; > + unsigned long idt_ignored_snap; > + long idt_calls_snap; > }; Urgh, this is more than a whole cacheline of extra data :/ Can't we make this #ifdef CONFIG_NMI_CHECK_CPU ? > @@ -509,8 +526,15 @@ DEFINE_IDTENTRY_RAW(exc_nmi) > > inc_irq_stat(__nmi_count); > > - if (!ignore_nmis) > + if (IS_ENABLED(CONFIG_NMI_CHECK_CPU) && ignore_nmis) { > + WRITE_ONCE(nsp->idt_ignored, nsp->idt_ignored + 1); > + } else if (!ignore_nmis) { > + WRITE_ONCE(nsp->idt_nmi_seq, nsp->idt_nmi_seq + 1); > + WARN_ON_ONCE(!(nsp->idt_nmi_seq & 0x1)); > default_do_nmi(regs); > + WRITE_ONCE(nsp->idt_nmi_seq, nsp->idt_nmi_seq + 1); > + WARN_ON_ONCE(nsp->idt_nmi_seq & 0x1); > + } > > irqentry_nmi_exit(regs, irq_state); That is not a NO-OP when !CONFIG_NMI_CHECK_CPU :/