From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Keir Fraser <keir@xen.org>,
David Vrabel <david.vrabel@citrix.com>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH 2/2] x86/crash: Disable the watchdog NMIs on the crashing cpu.
Date: Mon, 18 Nov 2013 11:09:20 +0000 [thread overview]
Message-ID: <5289F560.9020206@citrix.com> (raw)
In-Reply-To: <528A02690200007800103F53@nat28.tlf.novell.com>
On 18/11/13 11:04, Jan Beulich wrote:
>>>> On 18.11.13 at 11:33, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>> On 18/11/13 09:26, Jan Beulich wrote:
>>>>>> On 15.11.13 at 21:32, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>>>> --- a/xen/arch/x86/crash.c
>>>> +++ b/xen/arch/x86/crash.c
>>>> @@ -118,6 +118,7 @@ static void nmi_shootdown_cpus(void)
>>>> unsigned long msecs;
>>>> int i, cpu = smp_processor_id();
>>>>
>>>> + disable_lapic_nmi_watchdog();
>>>> local_irq_disable();
>>>>
>>>> crashing_cpu = cpu;
>>> _If_ you do this here, I wonder why it's being done before
>>> disabling interrupts.
>>>
>>> But then again I wonder whether it wouldn't be better to do
>>> this even earlier (i.e. by passing a flag to watchdog_disable()),
>>> as the NMI watchdog becomes useless with that call being done
>>> from kexec_common_shutdown().
>> Disabling interrupts here is more defensive coding than anything else.
>> It is not expected to be able to get here with interrupts enabled, but
>> in a crash
>>
>> Putting this in watchdog_disable() would result in a race condition.
>> disable_lapic_nmi_watchdog() mutates global state, meaning that it can
>> only possibly run correctly on a single cpu. In an ideal world with
>> plenty of time, the lapic watchdog code could be improved. However,
>> restricting its use until after one_cpu_only() is the easiest fix.
> Just looked at disable_lapic_nmi_watchdog() another time, and I
> don't see the race. What I do see though is that you'd need to
> run this on each CPU for it to have the full intended effect...
>
> Jan
>
disable_lapic_nmi_watchdog() sets nmi_active to -1, which casues
subsequent calls to exit early.
There are possible crash paths where a first cpu will execute
watchdog_disable() but a subsequent cpu will complete the kexec path.
Hooking disable_lapic_nmi_watchdog() off watchdog_disable() will result
in certain paths where the wrong cpu ends up with its MSRs properly
disabled.
~Andrew
disable_lapic_nmi_watchdog()
next prev parent reply other threads:[~2013-11-18 11:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-15 20:32 [PATCH 0/2] Kexec crash path fixes Andrew Cooper
2013-11-15 20:32 ` [PATCH 1/2] common/kexec: Prevent deadlock on reentry to the crash path Andrew Cooper
2013-11-22 14:55 ` Andrew Cooper
2013-11-25 13:28 ` Jan Beulich
2013-11-25 13:30 ` Andrew Cooper
2013-11-25 13:39 ` Jan Beulich
2013-11-25 15:38 ` Andrew Cooper
2013-11-27 10:27 ` David Vrabel
2013-11-15 20:32 ` [PATCH 2/2] x86/crash: Disable the watchdog NMIs on the crashing cpu Andrew Cooper
2013-11-15 21:01 ` David Vrabel
2013-11-15 21:09 ` Andrew Cooper
2013-11-18 9:26 ` Jan Beulich
2013-11-18 10:33 ` Andrew Cooper
2013-11-18 10:35 ` Andrew Cooper
2013-11-18 11:04 ` Jan Beulich
2013-11-18 11:09 ` Andrew Cooper [this message]
2013-11-19 10:53 ` Ian Campbell
2013-11-20 15:08 ` [Patch v2 " Andrew Cooper
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=5289F560.9020206@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=david.vrabel@citrix.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).