From nobody Tue May 7 10:09:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1561417732; cv=none; d=zoho.com; s=zohoarc; b=i19XxOuiujazzTdpSQURKQlBaQrF+1UGFWJU4gOqRwAUDYxnHwWIQ9KlK3Apb3Wn4N8ONdPj6sL3cUS6hrEyR03Dw22Td82AjsZ11/MhHGx9ndVf2f9ay6lCEkuDDofAADFB9+2BbH5/LmkppWWtNRae5K0AX19giK0oytdX7II= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561417732; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=yUBEZia5gsuqxQ69vNng00iBJBoO065TVcwKIsFBCF0=; b=TzfE/UmdFFckXETUoTAcj5PUtb/iF/JeajVs0xNyNdb1g8GmOQOkTTWRHZstEvqcmb7Uv8LEjjqSTw6sB4tx6uhG6/Eufe1raIOfiHe5T+9ao0aAKf+b4QZstrx8ig/x9p7p+l8VLaSiSYI7TNYotRwVyYqXxVbZw8OXnLjvWOA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 156141773242581.14616889793831; Mon, 24 Jun 2019 16:08:52 -0700 (PDT) Received: from localhost ([::1]:55352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfY4m-0004l0-7o for importer@patchew.org; Mon, 24 Jun 2019 19:08:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43602) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfY3Z-0003if-09 for qemu-devel@nongnu.org; Mon, 24 Jun 2019 19:07:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfY3X-0005dB-1G for qemu-devel@nongnu.org; Mon, 24 Jun 2019 19:07:24 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:47672) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hfY3V-0004N8-2p for qemu-devel@nongnu.org; Mon, 24 Jun 2019 19:07:21 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5OMxd9U036398; Mon, 24 Jun 2019 23:05:25 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2t9cyq8vyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2019 23:05:24 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5ON4mh6024774; Mon, 24 Jun 2019 23:05:24 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2t9p6tuhge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2019 23:05:23 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5ON5MpY000353; Mon, 24 Jun 2019 23:05:22 GMT Received: from Lirans-MBP.Home (/109.64.216.174) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 24 Jun 2019 16:05:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=yUBEZia5gsuqxQ69vNng00iBJBoO065TVcwKIsFBCF0=; b=4AMs/1XWaPckBZwOgJMgOaZLtE4WpFsA1IdegEGmRkTmLPVc1A15OUIGzAXsG4Yb91un DsH9ZfYASvGkFQE2EiAyZpOuGO5XWuKdo78FtW6aBAgMB5MdnaK0sN6Gq5dM7q7yw7Cj 1HwzJ5nPjfR7mW1ZziRBnpqNbnJ9AKbyN/98mV6NbzNHB73u8EdsI9xEv4/uVU6zImXo 1mNG7AEAdKHE/d1X78v6ifGBLWdohL4bICiyv0g+F6niWlOEDoHs0lmHmzuR6s6nNIx1 /4T2CfFO9OgL/1ExHspeu1K/+t/NfrFezB719qL/OUaJnLnatLQJucvsRLIJNoESnBCs Zg== From: Liran Alon To: qemu-devel@nongnu.org Date: Tue, 25 Jun 2019 02:05:14 +0300 Message-Id: <20190624230514.53326-1-liran.alon@oracle.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9298 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=991 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240181 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9298 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240181 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [PATCH] target/i386: kvm: Fix when nested state is needed for migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, Liran Alon , Karl Heubaum , kvm@vger.kernel.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When vCPU is in VMX operation and enters SMM mode, it temporarily exits VMX operation but KVM maintained nested-state still stores the VMXON region physical address, i.e. even when the vCPU is in SMM mode then (nested_state->hdr.vmx.vmxon_pa !=3D -1ull). Therefore, there is no need to explicitly check for KVM_STATE_NESTED_SMM_VMXON to determine if it is necessary to save nested-state as part of migration stream. In addition, destination must enable eVMCS if it is enabled on source as specified by the KVM_STATE_NESTED_EVMCS flag, even if the VMXON region is not set. Thus, change the code to require saving nested-state as part of migration stream in case it is set. Reviewed-by: Karl Heubaum Signed-off-by: Liran Alon --- target/i386/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/machine.c b/target/i386/machine.c index 851b249d1a39..e7d72faf9e24 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -999,7 +999,7 @@ static bool vmx_nested_state_needed(void *opaque) =20 return ((nested_state->format =3D=3D KVM_STATE_NESTED_FORMAT_VMX) && ((nested_state->hdr.vmx.vmxon_pa !=3D -1ull) || - (nested_state->hdr.vmx.smm.flags & KVM_STATE_NESTED_SMM_VMXON= ))); + (nested_state->flags & KVM_STATE_NESTED_EVMCS))); } =20 static const VMStateDescription vmstate_vmx_nested_state =3D { --=20 2.20.1