mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Subject: Re: [PATCH x86/nmi 1/2] x86/nmi: Accumulate NMI-progress evidence in exc_nmi()
Date: Mon, 9 Jan 2023 17:19:59 +0100	[thread overview]
Message-ID: <Y7w+r3Nbubin8sNN@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20230105011537.1774941-1-paulmck@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 :/

  parent reply	other threads:[~2023-01-09 16:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05  1:15 Paul E. McKenney
2023-01-05  1:15 ` [PATCH x86/nmi 2/2] x86/nmi: Print reasons why backtrace NMIs are ignored Paul E. McKenney
2023-01-05 10:40   ` Ingo Molnar
2023-01-05 19:24     ` Paul E. McKenney
2023-01-09 16:19 ` Peter Zijlstra [this message]
2023-01-09 16:59   ` [PATCH x86/nmi 1/2] x86/nmi: Accumulate NMI-progress evidence in exc_nmi() Paul E. McKenney

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=Y7w+r3Nbubin8sNN@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@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®