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

[PATCH v7 00/11] libs/guest: new CPUID/MSR interface


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Tue, 25 Jan 2022 15:49:24 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=Eru6pzQxOjTbx0wUbPSsxS8IroCkcvtDCCp2Q1k9dPQ=; b=MRMzGuLZ/pAyM8T7qQiioHyflVxogAiluyH3znIssjfa/4MjICOnGjjgmcLCELOeM7/mRby97Fr1rKdULyoEhAGHZ/adft472BTr2xcWlCyGIiSYr2VoTqzEEqt6piZ1Prd6w1XsQCD32sgA0SGVAgdZazkH4R8Vhs4F4RAGwT3i0VT4YkLkSAxKMt7/iJMUsMtZOrzk36h4LwR/VUhdfNr+80jUMRs3OtUjU9MQ98lrffFn11chhyKFNDdpVtYu/kEHzL6DbAcVCsXCPEiGcASNF67iS2XbRbD4iDbZqWF8zalbIPi7j4ie7kZAKXTtXfwJPCQgW9QX9rlartAHTw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kjSGDzYdy7h1ZqIksrKGDsGKrf9qxgLtWF3dG3h/imvmwDCP/EEPItFkFEYIAZJWror3cNyrOiqBinvVlDdXMysJ9JMI30hh6egzCV95DpySyWEyrpRfa5OXuR0XwGy0ip7LmORSiAPDU5u1YM8SNJivbIAG8I1JPA7CPNGMf8WKayK13VVMdOOZKaEqcDeDeaOIp4xBFD7EdCPEX/kDk8kSpSRMr/ymgQSx7S2TdGWGe59UrkFAOGu4s/uZsg5ZmnYyTJOySxIn/srKD1+rF2xaTSfqstaBy6mqqOiV1deHaXM1Mxb1BRTMszDlkwwCPSSEmVuEoArpYX4aFI0tMA==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "Anthony PERARD" <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Tue, 25 Jan 2022 14:49:58 +0000
  • Ironport-data: A9a23:nI60IaNFd6buvNfvrR1UkMFynXyQoLVcMsEvi/4bfWQNrUojhmcGy zYYCG6Ea6veM2GnKtt1YdjjoUpXuJPQn9YySgto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdpJYz/uUGuCJQUNUjMlkfZKhTr6UUsxNbVU8En150Eg+w7RRbrNA2rBVPSvc4 bsenOWHULOV82Yc3rU8sv/rRLtH5ZweiRtA1rAMTakjUGz2zhH5OKk3N6CpR0YUd6EPdgKMq 0Qv+5nilo/R109F5tpICd8XeGVSKlLZFVDmZna7x8FOK/WNz8A/+v9TCRYSVatYoyuYttdwx /NHiZ2fQ1sbNKbsttZESiANRkmSPYUekFPGCX22sMjVxEzaaXr8hf5pCSnaP6VBpLwxWzsXs 6VFdnZdNXhvhMrvqF6/YvNrick5atHiIasUu216zCGfBvEjKXzGa/uRvIUEhmdh7ixINdbBb Mw5awRkVlPRWBFACnIeFIARjfj90xETdBUH8QnI9MLb+VP70whZwLXrdt3PdbSiR8pPmV2Dj nnb5Gm/CRYfXPSPxDzA/n+yi+vnmSLgRJlUBLC+7uRtglCY2ioUEhJ+fVmxrOS9i0W+c8lCM EFS8S0rxZXe72TyEIO7BUfh5ifZ4FhMALK8DtHW9imT24PT4gm/DFQFYTQdWtYtlOEE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IVyAygc+79 YYT0EWMrSZZjIb/KXHCWGDYqodKbK8gceVbInlvhJQpVYAUdAc0+41MHfTLmRGAC19QbYpHp uV4cRK4xKmZHQsd8y+Ql0IRfLKqdHnnI/vJUduPW9t1CC+yReTrJLqGRmR2RkTFxtJ3LcZ6G DA1yj0/L+qvf2XwgLVk0XT85NVst38zcYrPr3FtuElbhHXziq4boVoXLOP+BgzveGU8V4v1O LBph8xVv4Dn0/5TyWQm1/AygPg2DEh5zvJ0lmDm0bupsT/WXYTF9dBrZgxSGqU12MQ+PVHlI 5b1WOQsJRaSTnamj7m2tTOXxZ20mKpvHsZl/IJhXA3a/pSVFZol/1QwKppKuZAIMqjg7pXUN WGTfusrsq+SGnqIEww5QJUsZ+RtndaJGbyfqFNgL3W79FspgEJ86Iv/r1sop4xzuNCd3B63Z W1Dk0RrsA3ciY3V9MLOA5Te7rANoTyKSi8Q156Z26XUZ06Bw==
  • Ironport-sdr: UzYjpcgZNS1eNjFzWHYStGx/MHPN2GIl2c5hC6+TrY8EaOTFgBNcsKnQap5Ybi9/xg7oV7ZGYL i/X2Zy2AM07XAK2uoNps24gjnkPic/mBghF5wIGwYsaX4oA3cioFDt+ovxY8niR/cpR+RDJx42 WQYK0A8efeMa2R4Qnl4U+C66X7B0Ki0rYsK+LVN+J54/5+VSP908rhoe0Xby/85Q929ZTqvBv9 Evt63bPKcD+xn0kV+b0a616o/JoojLu/AcrLdMnlkjKqSEUJYOdrTm/bp603v7YqK+aXb0yyQU 5LISE/KGLWelcnQGDk/me0SU
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hello,

The following series introduces a new CPUID/MSR interface for the
xenguest library. Such interface handles both CPUID and MSRs using the
same opaque object, and provides some helpers for the user to peek or
modify such data without exposing the backing type. This is useful for
future development as CPUID and MSRs are closely related, so it makes
handling those much easier if they are inside the same object (ie: a
change to a CPUID bit might expose or hide an MSR).

In this patch series libxl and other in tree users have been switched to
use the new interface, so it shouldn't result in any functional change
from a user point of view.

Note there are still some missing pieces likely. The way to modify CPUID
data is not ideal, as it requires fetching a leaf and modifying it
directly. We might want some kind of interface in order to set specific
CPUID features more easily, but that's to be discussed, and would be
done as a follow up series.

The addition of a helper to generate compatible policies given two
inputs has been removed from this iteration, sine Andrew Cooper has
posted a patch to set the foundation for that, and further work should
be done against that baseline.

Thanks, Roger.

Jan Beulich (1):
  x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf
    contents

Roger Pau Monne (10):
  libx86: introduce helper to fetch cpuid leaf
  libs/guest: allow fetching a specific CPUID leaf from a cpu policy
  libx86: introduce helper to fetch msr entry
  libs/guest: allow fetching a specific MSR entry from a cpu policy
  libs/guest: make a cpu policy compatible with older Xen versions
  libs/guest: introduce helper set cpu topology in cpu policy
  libs/guest: rework xc_cpuid_xend_policy
  libs/guest: apply a featureset into a cpu policy
  libs/{light,guest}: implement xc_cpuid_apply_policy in libxl
  libs/guest: (re)move xc_cpu_policy_apply_cpuid

 tools/include/libxl.h                    |   6 +-
 tools/include/xenctrl.h                  |  44 --
 tools/include/xenguest.h                 |  26 +
 tools/libs/guest/xg_cpuid_x86.c          | 607 ++++++++---------------
 tools/libs/light/libxl_cpuid.c           | 205 +++++++-
 tools/libs/light/libxl_internal.h        |  26 +
 tools/tests/cpu-policy/test-cpu-policy.c | 326 +++++++++++-
 xen/arch/x86/cpuid.c                     |  55 +-
 xen/include/xen/lib/x86/cpuid.h          |  26 +
 xen/include/xen/lib/x86/msr.h            |  20 +-
 xen/lib/x86/cpuid.c                      |  91 ++++
 xen/lib/x86/msr.c                        |  41 +-
 12 files changed, 925 insertions(+), 548 deletions(-)

-- 
2.34.1




 


Rackspace

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