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

Re: [PATCH v2] x86/vmx: save guest non-register state in hvm_hw_cpu


  • To: Tamas K Lengyel <tamas.lengyel@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 21 Mar 2022 13:16:31 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=xQkfecoMdgagqN1OtqFPPYZXVTztR/dVounJZiIfhJs=; b=Ou6RKdHnUzoaBbQONnAjQR+HaFstQCLnCh10U+aNGJ9qiywHYpXHzwbFGQjcFRfcOTYEIpwoTJd+yHUZhKIuPoFMkvHi4aDPTdESy3VVTlCLZ9XQFj9Uz8YsPK4tYHFAGvpudwEk6WZBLeARFdRsAkkKfvN3cp/auSxAJQJCrAXT0uRl8ei+MG0djlldsM6MxzUzmR4gcZVW6DX9xh06WMJDSKSNteehadrFWAP78XkkiTsS1lGjE2/hFjitHyAdhhbFmvRixOhu4prOr5kViC6UXRKX38XTSgFtN5eOwX1wavRINiL5TTzuvWWWU+FN6y2Gl6jXyxhBtXenI3bb8w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NVeBX9zMGn5PXHYVMUJDW56g/l3qvxTZi1F19M0vHI8iYwujXQU0yjMXuFK7TPYh1PEx5aqu4g5OLbT4tmVksIWIC4sKyTPJ07Hv95ks8k3gofoXTwY6srlN6/9h0V1JBowKQdiKAFQW6P9i4Go+r+1KLenld4acrjE46eeAsDCLw8004p0wW62Zue7nK7jjQrtMFJ/nG/nMBD3sbKkwKeHBSOkbRtxaiXH07msShMN8V/vx1ZiJC4y4gaCUNe8PeuZMDtcBn3pFlDWWkqdRhOetvL4YFY2xBSzTs8f2hfAOpgNZ4QMMmBWuUePq5lnTpib+sED2RzHLgeMXgAT1Mw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 21 Mar 2022 12:16:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.03.2022 16:57, Tamas K Lengyel wrote:
> During VM forking and resetting a failed vmentry has been observed due
> to the guest non-register state going out-of-sync with the guest register
> state. For example, a VM fork reset right after a STI instruction can trigger
> the failed entry. This is due to the guest non-register state not being saved
> from the parent VM, thus the reset operation only copies the register state.
> 
> Fix this by including the guest non-register state in hvm_hw_cpu so that when
> its copied from the parent VM the vCPU state remains in sync.
> 
> SVM is not currently wired-in as VM forking is VMX only and saving 
> non-register
> state during normal save/restore/migration operation hasn't been needed.

Given that it was pointed out that e.g. STI- and MOV-SS-shadow aren't
VMX specific and also aren't impossible to hit with ordinary save /
restore / migrate, I'm not convinced of this argumentation. But of
course fixing VMX alone is better than nothing. However, ...

> @@ -166,6 +167,11 @@ struct hvm_hw_cpu {
>  #define XEN_X86_FPU_INITIALISED         (1U<<_XEN_X86_FPU_INITIALISED)
>      uint32_t flags;
>      uint32_t pad0;
> +
> +    /* non-register state */
> +    uint32_t activity_state;
> +    uint32_t interruptibility_state;
> +    uint64_t pending_dbg;
>  };

... these fields now represent vendor state in a supposedly vendor
independent structure. Besides my wish to see this represented in
field naming (thus at least making provisions for SVM to gain
similar support; perhaps easiest would be to include these in a
sub-structure with a field name of "vmx"), I wonder in how far cross-
vendor migration was taken into consideration. As long as the fields
are zero / ignored, things wouldn't be worse than before your
change, but I think it wants spelling out that the SVM counterpart(s)
may not be added by way of making a VMX/SVM union.

Jan




 


Rackspace

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