From: "Jan Beulich" Subject: Re: [PATCH] x86/nmi: Fix shootdown of pcpus running in VMX non-root mode Date: Mon, 09 Feb 2015 12:56:48 +0000 Message-ID: <54D8BCA0020000780005E324@mail.emea.novell.com> References: <1423481108-31722-1-git-send-email-andrew.cooper3@citrix.com> <20150209114311.GA9644@deinos.phlegethon.org> <54D89F73.7020700@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54D89F73.7020700@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper , Tim Deegan Cc: Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 09.02.15 at 12:52, wrote: > On 09/02/15 11:43, Tim Deegan wrote: >> Hi, >> >> At 11:25 +0000 on 09 Feb (1423477508), Andrew Cooper wrote: >>> In the case of a crash, nmi_shootdown_cpus() patches nmi_crash() into the > IDT >>> of each processor, such that the next NMI it receives will force it into the >>> crash path. >>> >>> c/s 7dd3b06ff "vmx: fix handling of NMI VMEXIT" fixed one issue but >>> inadvertently introduced another. The original use of self_nmi() would > follow >>> vector #2, but a direct call to do_nmi() does not. >>> >>> Introduce a function pointer which should be used in preference to direct >>> do_nmi() calls, which is updated on the crash path to point at > do_nmi_crash() >>> >>> Signed-off-by: Andrew Cooper >>> CC: Jan Beulich >>> CC: Tim Deegan >>> >>> --- >>> >>> This patch very certainly functions correctly (it is in active use now in a >>> customer escalation), but I was wondering how paranoid we should be about >>> interleaved reads/writes and whether an atomic write would be better? >>> Performance is not a issue at all but in a crash senario we don't want to be >>> taking any chances with correctness. >> Yes, atomic updates sound like a good idea. Would it make sense to >> add a _get_gate() or similar so the vmx path can read the actual IDT >> rather than adding a _third_ place where we set what to do on NMI? > > A _get_gate() would return nmi() or nmi_crash() rather than do_nmi() or > do_nmi_crash(). The latter pair is needed as we are already executing > in C context rather than coming straight in from an interrupt. So wouldn't it be possible to get rid of nmi_crash() and have nmi() call *nmi_handler instead of don_nmi (and nmi_handler would really just become an alias of exception_table[2]? Jan