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

[PATCH v4 00/10] libs/guest: new CPUID/MSR interface

  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 7 May 2021 13:04:12 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-SenderADCheck; bh=8S8wkPmqqUfwri4uoZFuU5pUXK3Oogv3mO3oq70NVKg=; b=j73s6u9Gkp89XRgTVQCTbjHR5kJnw/HgWsbjCWuTPJs2Yw25MnQaT26Eu5NTGSuqrcSrT+S3OpXHfqo7mzP7ryguQ2PImYTh0+9eduo+82YT68CdywqrEr1YVlc4LEa377adsc8bLAn6qtXtZPJ4qeFJdL9Ww9RAaOeCVhdYbUn6BLKT16JPbyH8bpC+M8BbqSVH5BKSop+cWHml88sU+NwD5PkUpS5b0aqjLEHyLf0b5QcwSTqxArMucaHQxnYfdrz+84jOeSw25jjzNzhPPX22RdkEFsk3HDlIgRSd8xfgAbZvF3ET2TRaQ2fqfVp42XS+rWP3lLOzyk7DOUGFnw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l28fDTJbKjJ2KlWpD02o/AJT+ixwbhl0X9ISJ3JA5UOpkCQOCgMPgAWEA46my6X4ih5dFK5ai3t6k/1K+tqBU0BWX4I3mrd7tuqRNNGbL2s2l2MytBUD0c/QWAeisHdBn4PldFdnw2fx6tCk+CDlvGWcy/3+NJ8NbLqlzNRMhVUUcD1CBBZo8JdFIoGjE20Z2cdJKS/pLQJEnZBOcOyIkbM4ARUjh2n65Do15nq4/Xhwkk8XLhHYNij4WfLvECy3ab/5399izj7eC+B8/9VWAaSj2p2Jl6qqtyf88uNRTgLHVCSvKpx4IrafGWxXdrkRHvnTZLAK5gY6Zacz101eDA==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Fri, 07 May 2021 11:06:49 +0000
  • Ironport-hdrordr: A9a23:FhyONqEMk1kBWAXwpLqE78eALOsnbusQ8zAX/mt6Q3VuA6ilfq GV8MjzsCWetN9/Yh4dcLy7VpVoI0m9yXcF2+gs1N6ZNWGN1VdAR7sSjrcKrQeQfhHWx6pw0r phbrg7KPCYNykcsS8i2njbL+od
  • Ironport-sdr: He2XGgQ32VkzG8+ktl4hcypxa6gJfuAEemOd9WiHVDLCbUi5xYQYu+cF+w6w/W7urlwcZoA3EQ FFGLHrumAZRfKHebfzfbPvVjUqo8wXYFHBffiJ391E4KK6nfZN6XVNIziK1VWo/llehloky6ar wt8395SUIjrqC4rYKRikWSw09IJkPrDa02QDAAltqtrJqZRjwpezm7EafU2IZ+DgzkAWo1GWom JpJLysL7B6rJYtkp4wcDFQo6tVbkLijRbREuSJWU8iUVSme11XsoilPhkKtDqGUhy89t9qFBZL ubw=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


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.

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                 |  18 +
 tools/libs/guest/xg_cpuid_x86.c          | 633 ++++++++---------------
 tools/libs/light/libxl_cpuid.c           | 228 +++++++-
 tools/libs/light/libxl_internal.h        |  26 +
 tools/tests/cpu-policy/test-cpu-policy.c | 123 ++++-
 xen/arch/x86/cpuid.c                     |  55 +-
 xen/include/xen/lib/x86/cpuid.h          |  18 +
 xen/include/xen/lib/x86/msr.h            |  19 +-
 xen/lib/x86/cpuid.c                      |  51 ++
 xen/lib/x86/msr.c                        |  41 +-
 12 files changed, 717 insertions(+), 545 deletions(-)




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