[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH] x86/hvm: Include interruptibility state in hvm_hw_cpu


  • To: Tamas K Lengyel <tamas.k.lengyel@xxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Thu, 17 Mar 2022 06:09:38 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wN7koKXZBXPWqPTLF/mnwgFdVLMxZ59WtsUHzv8TZV4=; b=UA1fWIUf5s2Krewk5WLlbsw4jprRNIOs3DbPTmWOyf3SzyuWjkKXcdzOCSjzztAd8YKk0asBfWIhMdK5nt/8uRt7iNu3LP8rXekRZQGmmSy/GWhGYmFcXw3yZNH1rodmcH7nJ4hqxxFZzddPRhaFJpR7VB9HUi1R4hv3wEuTzDxW0CSB9+WR2JZmsF/hZjzaaLABkcrCsHp5lkJc4A1RUEThldMzccHtooL5Cbzxg7r48+3KdjOT6VQkF1TCMcoeIW1+lpBedX7v7Z6pgTz1rhGkHDIZEhTz0xLtJhFSQ9TOc7ZUPi+KG+JB3FnYCcuyF1S1MrkTMRTn33tYV8nXfA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jcWc3JrjhN2hBV7FKdzrh4l1yVlX7EsS14qUCGG1QgD/hcxW187+FbCOKxtcmSqGuoAk2/dVJn0zFm3N3CCpOTdqihlodbHNsvsmHnvrgeg/Hg8YXPr7/Zc7Dt4xROMs8F/wUyPax5X6fy9j7OzK9+VbrOec/zCRhS8khnL3b8gSm9TyMzOlZ1275ShhCyjeRn0Jy3VpjlbGRdtZqjvdxl8VS8JDvBgIqUCwkk5FWXkvmZ3ZPx/eQ/WYRZjENIvO8brrGyp2EjL1F2U2Bb3IfDc51BzQ8RYsSFzB9xQ3SUrkIGix4MySeTcBmrvVtMu2sOvXg1x08URg6Ew1olmXOA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com;
  • Cc: "Lengyel, Tamas" <tamas.lengyel@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Beulich, Jan" <JBeulich@xxxxxxxx>, "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, Pau Monné, Roger <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>
  • Delivery-date: Thu, 17 Mar 2022 06:09:52 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.6.401.20
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYNK72F/eE81SIoUqvccI09xMIhKy+fRzggABTaICABE+GoA==
  • Thread-topic: [PATCH] x86/hvm: Include interruptibility state in hvm_hw_cpu

> From: Tamas K Lengyel <tamas.k.lengyel@xxxxxxxxx>
> Sent: Monday, March 14, 2022 8:14 PM
> 
> On Mon, Mar 14, 2022 at 3:22 AM Tian, Kevin <kevin.tian@xxxxxxxxx> wrote:
> >
> > > From: Lengyel, Tamas <tamas.lengyel@xxxxxxxxx>
> > > Sent: Friday, March 11, 2022 2:45 AM
> > >
> > > During VM fork resetting a failed vmentry has been observed when the
> reset
> > > is performed immediately after a STI instruction executed. This is due to
> > > the guest interruptibility state in the VMCS being modified by STI but the
> > > subsequent reset removes the IF bit from FLAGS, causing the failed
> vmentry.
> >
> > I didn't get the rationale here. Before this patch the interruptibility 
> > state is
> > not saved/restored thus I suppose after reset it will be cleared thus 
> > aligned
> > with RFLAGS.IF=0. Can you elaborate a bit how exactly above problem is
> > caused?
> 
> The problem is that the interruptibility state is not cleared and thus
> isn't aligned with RFLAGS.IF=0 after RFLAGS is reset. They go out of
> sync leading to the failed vmentry. The interruptibility state needs
> to be included in the hvm hw cpu struct for it to get re-aligned
> during reset to avoid the failed vmentry.

I'm still confused here. The interruptibility state should have bit 0 as 1
after a STI instruction is executed (RFLAGS.IF=1). Saving/restoring it
still doesn't match RFLAGS.IF=0 after vm fork reset. So I didn't understand
how this patch actually fixes the problem.

Also if there is a real problem shouldn't we just reset the interruptbility
state to match RFLAGS.IF=0?

> 
> >
> > >
> > > Include the interruptibility state information in the public hvm_hw_cpu
> struct
> > > so that the CPU can be safely saved/restored.
> > >
> > > Signed-off-by: Tamas K Lengyel <tamas.lengyel@xxxxxxxxx>
> > > ---
> > >  xen/arch/x86/hvm/hvm.c                 |  9 +++++----
> > >  xen/arch/x86/hvm/vmx/vmx.c             |  4 ++++
> > >  xen/arch/x86/include/asm/hvm/hvm.h     | 26
> >
> > Why is this change only applied to vmx instead of svm?
> 
> VM forking is implemented only for vmx, thus this change is only
> relevant where a VM would be immediately reset after a STI

but the ops is generic and SVM already has the related callbacks.

> instruction. Normal VM save/restore/migration doesn't attempt to
> capture a VM state immediately after STI thus it's not relevant for
> SVM.
> 

Can you elaborate why save/restore/migration won't happen
right after STI while it does for vm fork?

Thanks
Kevin

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.