From: Qixuan Wu <qixuan.wu@linux.alibaba.com>
To: chenggang.qin@linux.alibaba.com, alikernel-developer@linux.alibaba.com
Cc: Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@suse.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
stable@vger.kernel.org, Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH] x86/nmi: Enable nested do_nmi() handling for 64-bit kernels
Date: Thu, 12 Apr 2018 19:18:49 +0800 [thread overview]
Message-ID: <5ACF4099.9000104@linux.alibaba.com> (raw)
In-Reply-To: <1523509136-41469-1-git-send-email-chenggang.qin@linux.alibaba.com>
Hi Chenggang,
Have a doubt about the old code.
On 2018/4/12 PM 12:58, chenggang.qin@linux.alibaba.com Wrote:
> From: Andy Lutomirski <luto@kernel.org>
>
> commit: 9d05041679904b12c12421cbcf9cb5f4860a8d7b upstream
>
> 32-bit kernels handle nested NMIs in C. Enable the exact same
> handling on 64-bit kernels as well. This isn't currently
> necessary, but it will become necessary once the asm code starts
> allowing limited nesting.
>
> ......
> -static inline void nmi_nesting_preprocess(struct pt_regs *regs)
> +dotraplinkage notrace void
> +do_nmi(struct pt_regs *regs, long error_code)
> {
> + if (this_cpu_read(nmi_state) != NMI_NOT_RUNNING) {
> + this_cpu_write(nmi_state, NMI_LATCHED);
> + return;
> + }
> + this_cpu_write(nmi_state, NMI_EXECUTING);
> + this_cpu_write(nmi_cr2, read_cr2());
> +nmi_restart:
> +
Here if there are more than 2 NMIs nested, but the nmi_state is always
NMI_LATCHED.
>
> - /* On i386, may loop back to preprocess */
> - nmi_nesting_postprocess();
> + if (unlikely(this_cpu_read(nmi_cr2) != read_cr2()))
> + write_cr2(this_cpu_read(nmi_cr2));
> + if (this_cpu_dec_return(nmi_state))
> + goto nmi_restart;
> }
But here at most re-execute 2 NMIs, so some nmi lost ?
And cr2 is always the first NMI's cr2. CR2 is wrong for the later NMIs.
> void stop_nmi(void)
>
Thanks & Regards
Qixuan Wu.
prev parent reply other threads:[~2018-04-12 11:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-12 4:58 [PATCH] x86/nmi: Enable nested do_nmi() handling for 64-bit kernels chenggang.qin
2018-04-12 5:22 ` Oliver Yang
2018-04-12 5:59 ` Chenggang
2018-04-12 8:15 ` Peter Zijlstra
2018-04-12 11:18 ` Qixuan Wu [this message]
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=5ACF4099.9000104@linux.alibaba.com \
--to=qixuan.wu@linux.alibaba.com \
--cc=alikernel-developer@linux.alibaba.com \
--cc=bp@suse.de \
--cc=chenggang.qin@linux.alibaba.com \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.