From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: NMI deferral on i386 Date: Wed, 23 May 2007 11:03:40 +0100 Message-ID: References: <4651CA2F.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4651CA2F.76E4.0078.0@novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Well, this sounds fine to me. If you port it I'll apply it. I would prefer it as a separate patch from the rest of the MCA/MCE changes really, but if that's a pain then don't worry about it. -- Keir On 21/5/07 15:34, "Jan Beulich" wrote: > The idea is to always check values read from %ds and %es against > __HYPERVISOR_DS, > and only store into the current frame (all normal handlers) or the outer-most > one (NMI and MCE) if the value read is different. That way, any NMI or MCE > occurring during frame setup will store selectors not saved so far on behalf > of > the interrupted handler, with that interrupted handler either having managed > to read the guest selector (in which case it can store it regardless of > whether > NMI/MCE kicked in between the read and the store) or finding __HYPERVISOR_DS > already in the register, in which case it'll know not to store (as the nested > handler would have done the store). > > For the restore portion this makes use of the fact that there's exactly one > such code sequence, and by moving the selector restore part past all other > restores (including all stack pointer adjustments) the NMI/MCE handlers can > safely detect whether any selector would have been restored already (by > range checking EIP) and move EIP back to the beginning of the selector > restore sequence without having to play with the stack pointer itself or any > other gpr.