From nobody Sun May 19 07:11:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1643911896; cv=none; d=zohomail.com; s=zohoarc; b=KkFnQlVHTfvS2rXtkVJe/DuPiOO+OZuVqSMCxijn/+pW3ieiWMFYuj0S+4cOLC78igT4gNQTk6XQ0/qK/sSMXhaNvv8V1+qdWy8dLdXkZfut8UO71PrHq27F+1ysHlJbO6y8FDQnrmR15+A3TmwQXCG+D2ffOeq9Vg5LcfH86ZU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643911896; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=vsi1I/X0zlaQwcUdlRguT9akD1wNNraXwHaDk0LoJkI=; b=QNDnAVysFIHyqw3woowRwdTQi9SOqxpWDX5ucEqEBZOtNu0CsA99TufVHxnYOnJPkfD8mK98UmP7K4u+wFjJ5AzKkBtTjGZtPkil8a0BNEkKeLpSTAhIEXT6H9XAK9+/fbOjmurwYEJXyu7vinXxiL3SPgsXsjnaDVjuVIpOVrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 164391189642032.104115734247785; Thu, 3 Feb 2022 10:11:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.264915.458192 (Exim 4.92) (envelope-from ) id 1nFgZF-0003wr-Us; Thu, 03 Feb 2022 18:10:49 +0000 Received: by outflank-mailman (output) from mailman id 264915.458192; Thu, 03 Feb 2022 18:10:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nFgZF-0003wk-RB; Thu, 03 Feb 2022 18:10:49 +0000 Received: by outflank-mailman (input) for mailman id 264915; Thu, 03 Feb 2022 18:10:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nFgZE-0003we-Hk for xen-devel@lists.xenproject.org; Thu, 03 Feb 2022 18:10:48 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9ae54ff9-851c-11ec-8f75-fffcc8bd4f1a; Thu, 03 Feb 2022 19:10:46 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9ae54ff9-851c-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1643911846; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=so4Am0ORuGtCYnjcacxrQ0MqF+d7F1NVZVzTcDC95c8=; b=LTbFtNUjitkSalaVKmicwcf0VSSng/UD76LRu6pHcFGybgK82BF44Bqp lb2DNLDSCnzbdPy3pJhBRlpbVBQ3djMaBVmKVRkurY7rSm0XgFB1IFbHm sK9PnspVQKVzdXqNm8Gjc92zO9JSRlezkRIYugR2gemnLRnVkcsR16zSX M=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 0cJLhdgVgeTWPX0OBNrZBO+1608NV+oplHmRa+wi/qP9ud14YIyywaTWPwAOcvWAelIwLZnXE2 Xd2v0T8G8Zh55Pdso2Q8IjQPX068wbnh+/kgp0But1JeADBGoxB9RgE13EB1Uxfszfj6w5l5mI OfG6iaw3AVaLEu1q+ig3OidsWSrKEfa3auhEx/yYCUECE/OjvLnOaeSwLQXfGafrGqHjZIQTyp 4/jUVT5UDx+COO7Z0CvQz7CeTd47avSMD2wVD6EKAvrSGH3AvvjY/vNKE0hoCCnpcuI3jyi6qJ wFesTIlidN6EVBGtBXiHl06g X-SBRS: 5.2 X-MesageID: 63439656 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:tWQh4a24BXGfZoB7JvbD5TR2kn2cJEfYwER7XKvMYLTBsI5bp2ECz WAdXT2PP/6MYGH1c9pxPIjj8xkH78Lcy9NqHQo9pC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkS5PE3oHJ9RGQ74nRLlbHILOCanAZqTNMEn9700o5w7Vh2OaEvPDia++zk YKqyyHgEAfNNw5cagr4PIra9XuDFNyr0N8plgRWicJj5TcypFFMZH4rHomjLmOQf2VhNrXSq 9Avbl2O1jixEx8FUrtJm1tgG6EAaua60QOm0hK6V0U+6/TrS+NbPqsTbZIhhUlrZzqhx9Z/w 9FNsLmKRwJyPoD1nbURFD1/HHQrVUFG0OevzXmXtMWSywvNcmf2wuUoB0YzVWEa0r8pWycUr 6VecW1TKEDY7w616OvTpu1Er8IvNsT0eqgYvWlt12rxBvc6W5HTBa7N4Le02R9u3ZwVTKiDO aL1bxJEPB3bch1iHW4VJ5l5lv2likDnfABx/Qf9Sa0fvDGIkV0ZPKLWGPj/d8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HdrOrdr: A9a23:3H3d8qrLIKwxO6Z4e393bNwaV5oleYIsimQD101hICG8cqSj9v xG+85rsyMc6QxhP03I9urwW5VoLUmyyXcX2/h0AV7BZniFhILAFugLhuGOrwEIcxeOj9K1vp 0BT0ERMrPN5CBB/KPH3DU= X-IronPort-AV: E=Sophos;i="5.88,340,1635220800"; d="scan'208";a="63439656" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Anthony PERARD , Juergen Gross Subject: [PATCH] tools/guest: Fix comment regarding CPUID compatibility Date: Thu, 3 Feb 2022 18:10:23 +0000 Message-ID: <20220203181023.1554-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1643911898343100001 It was Xen 4.14 where CPUID data was added to the migration stream, and 4.13 that we need to worry about with regards to compatibility. Xen 4.12 isn't relevant. Expand and correct the commentary. Fixes: 111c8c33a8a1 ("x86/cpuid: do not expand max leaves on restore") Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Anthony PERARD CC: Juergen Gross Roger, this also has a knock-on effect on your CPUID series. The 4.12 had been nagging me for a while before I figured out why. --- tools/libs/guest/xg_cpuid_x86.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x8= 6.c index b9e827ce7eb0..57f81eb0a082 100644 --- a/tools/libs/guest/xg_cpuid_x86.c +++ b/tools/libs/guest/xg_cpuid_x86.c @@ -497,9 +497,19 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t = domid, bool restore, if ( restore ) { /* - * Account for feature which have been disabled by default since X= en 4.13, - * so migrated-in VM's don't risk seeing features disappearing. + * Xen 4.14 introduced support to move the guest's CPUID data in t= he + * migration stream. Previously, the destination side would inven= t a + * policy out of thin air in the hopes that it was ok. + * + * This restore path is used for incoming VMs with no CPUID data + * i.e. originated on Xen 4.13 or earlier. We must invent a policy + * compatible with what Xen 4.13 would have done on the same hardw= are. + * + * Specifically: + * - Clamp max leaves. + * - Re-enable features which have become (possibly) off by defaul= t. */ + p->basic.rdrand =3D test_bit(X86_FEATURE_RDRAND, host_featureset); p->feat.hle =3D test_bit(X86_FEATURE_HLE, host_featureset); p->feat.rtm =3D test_bit(X86_FEATURE_RTM, host_featureset); @@ -509,7 +519,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t d= omid, bool restore, p->feat.mpx =3D test_bit(X86_FEATURE_MPX, host_featureset); } =20 - /* Clamp maximum leaves to the ones supported on 4.12. */ p->basic.max_leaf =3D min(p->basic.max_leaf, 0xdu); p->feat.max_subleaf =3D 0; p->extd.max_leaf =3D min(p->extd.max_leaf, 0x8000001c); --=20 2.11.0