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

Re: [PATCH v5] x86/vmx: add hvm functions to get/set non-register state


  • To: "Lengyel, Tamas" <tamas.lengyel@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 27 Apr 2022 09:07:34 +0200
  • 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=Lb9B0eYhSQb3LyWAZxhNXx7pYUyYE2DyU1ePw2QmiEM=; b=iW7bN/4HTa5cCqPFbAHtraUdlIaykvuStFQTOr7ISczZmPz8TAq9p+xBDt2NHotuWQlgmX2cO2LW9IFJFMFlGZHMfBpHesGYmydGf9I/9jhfmln7whpcPP3Io4R5083LNFcW+Xp/TCE+gSuZTFZl1dSd+FRuihqI2OYkuM8NhJaVpCv6jaUp52nbkItpEkFSJrCu6QkyrmXEFg/ngHU47zZKsyziH6RXimR+eRI0u57Z7EEZ9CXbkzXItWN+0hIRD43h2puUPj5nOD1/Xy+OESAjnQDZqjsYW/TWO/LZzztSRDMy2Bou8qPz0Jq+MM90qVde3+5c1ksp8Z7gJP9fVA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BVFQfXfJ5f+/jtXeS3nr1n0oLLokXF7mgH/8glcxfQoYbVBVyrQzQ9MbTQLx/LX2+t8BPB96WSXytv7/UrG9hIK97iMjJ5HGD5EpQH7JhopAdEyKpfogyoE697m0p7MDs+soS2vaf6mmYQss9IrV5e8ZDcU1JHb/Opo/XA+aVDKC2uqOLiaRZNjKBvFFqx2iKXkxU9n+luDrc6FUbyf5VZ2f0yPJ8E8qbOJdF8SrShym/2BMGfdZ92tYYsh2WUU97l0baY+MZEDlqaVRCRnfnnp7AiE3oEML+2p00Tmv6qNy/KVQRvNMo0P3Av86lYAKUo9zdlczW6qp+HW8gsIWTw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>, "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, Pau Monné, Roger <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Delivery-date: Wed, 27 Apr 2022 07:07:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.04.2022 05:46, Tian, Kevin wrote:
>> From: Lengyel, Tamas <tamas.lengyel@xxxxxxxxx>
>> Sent: Friday, March 25, 2022 9:33 PM
>>
>> 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 adding a new pair of hvm functions to get/set the guest
>> non-register state so that the overall vCPU state remains in sync.
>>
>> Signed-off-by: Tamas K Lengyel <tamas.lengyel@xxxxxxxxx>
> 
> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
with ...

>> @@ -863,6 +892,17 @@ static inline void hvm_set_reg(struct vcpu *v,
>> unsigned int reg, uint64_t val)
>>      ASSERT_UNREACHABLE();
>>  }
>>
>> +static inline void hvm_get_nonreg_state(struct vcpu *v,
>> +                                        struct hvm_vcpu_nonreg_state *nrs)
>> +{
>> +    ASSERT_UNREACHABLE();
>> +}
>> +static inline void hvm_set_nonreg_state(struct vcpu *v,
>> +                                        struct hvm_vcpu_nonreg_state *nrs)
>> +{
>> +    ASSERT_UNREACHABLE();
>> +}

... these unnecessary stubs dropped (they should be introduced only
once actually needed, i.e. when a caller appears in a file which is
also built when !CONFIG_HVM), and ...

>> --- a/xen/arch/x86/mm/mem_sharing.c
>> +++ b/xen/arch/x86/mm/mem_sharing.c
>> @@ -1643,6 +1643,13 @@ static int bring_up_vcpus(struct domain *cd,
>> struct domain *d)
>>      return 0;
>>  }
>>
>> +static void copy_vcpu_nonreg_state(struct vcpu *d_vcpu, struct vcpu
>> *cd_vcpu)
>> +{
>> +    struct hvm_vcpu_nonreg_state nrs = {};
>> +    hvm_get_nonreg_state(d_vcpu, &nrs);

... this missing blank line inserted between these two lines. I'll
make both adjustments while committing.

Jan




 


Rackspace

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