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

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Tue, 23 Mar 2021 10:58:28 +0100
  • 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=NNH21g3qxXPN6ozUOJ43J5EqhCLkuO9vrTe0vMZLM2o=; b=l7H7eJutsrpHUGues2gtVxWj/3Sq3o7zz3FHLQoqR0FJgO1C9Wl9/SX9IF+18baDylXP3FOcqIsU+hQtmpaESTIwoxyDHjh6yFZHcuBbPhk9lt3f+zpP4zSGTqyPPPvnQS2Xun88RUOPru/djb8tZNOqoY1PJuF6dyrQGzh5pTgc1STpKxOTkmG+ImVyKykx1Dvvs7btZLVo5Ns63DB6xbu+N9iWRCoxiHQUidfJqOQnTYuXxaT8RWbwjGPTWXJr0lZP1njqtGFyLYFNZYw2DR1M1oG/Y1tk3uiO17wE5C2kYkt/e1IVY3bvUEDZzmk4inIWP06TJkhoYvKQDV5qPg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tvz4+P1xVv1L4IUWH9tKQry8Mj0fe6fiNv6tzRPuxr0MCRl5MQQD4cB9G7ITmOyPu+E8rw5ZtOWNmGT7GXOJFaEwsQPmIbHvw+dc0XiOq2oxrrFMRhhJJkQcxQtugl9MWW5I4+3dG5W89B4KTWdPF4ga5lGLVhrxR7kCXCP/Bp72UDA86EXcHIBpUgorVlBPJyH6nvs5y2+yk8vRLBBtFl7rGwpVvHtcKjb9tclE+fpViyCuac/ayqIkk6zuAKRh0Yp2hQ/cKjuhEQkebT/g6YFbt8Wg0Nuy2ZQkvEFsLvgcjVZpC5lonDuCmUjPG6kGQQxRJNj2Kyl8dyZ4aoVfcw==
  • Authentication-results: esa6.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>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Tue, 23 Mar 2021 10:00:02 +0000
  • Ironport-hdrordr: A9a23:3JW5Dq429bT2gATsqQPXwS6EI+orLtY04lQ7vn1ZYSd+NuSFis Gjm+ka3xfoiDAXHEotg8yEJbPoex3h3LZPy800Ma25VAfr/FGpIoZr8Jf4z1TbdBHW3tV2kZ 1te60WMrHNJHBnkMf35xS5Gd48wN+BtJuln/va0m0Fd2FXQotLhj0JbTqzOEtwWQVAGN4FD5 Ka/MVKvH6Nfn4QY8S9CBA+LpX+jvfMk4/rZgNDOg4/5GC1/EmVwZPZMzzd5BcRVDtT3awvmF KlryXV7riu2svLsyP0+HTU6/1t6b7c4/9iIODJtcQPMDXrjW+TFfVccpmPpio8ru3qyHtCqq i1nz4aM85+62zccwiOyHOHsWSQs0dNmgzf4GSVnGf5pojBTC86YvAx+75xSAfT6EYrobhHoc R29l+e3qAnaS/orWDW4tjFUAxSjUykoXYuuv57tQ0hbaIuLJBWtoAR50VTDdMpGz/78pkuFK 1UANjb/+s+SyLWU1np+k1UhPC8VHU6GRmLBmAEp8yuyjBT2FR01VERysAzlmoJnahNB6Vs1q DhCOBFhbtORsgZYeZWH+EaW/a6DWTLXFblLH+SCU6PLtBHB1v977rMpJkl7uCjf5IFiLEono 7abV9evWkuP2rzFMy12oFR+BylehTyYR3djuVlo7RpsLz1Q7TmdQeZTko1rsemq/IDR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WevIVkVz1+5lEvcpfUNOgDPizpioqYyJPs6/A1 D0sQENXe34JOUFBpODJzkcZCT6S0cmPpRm8r3o1ia0qCILCuxtVHp+uu27zqtCWT8zUA3mxYUT ilc0Hly6coFVK6ZVWWBEYB4xMT+vlzRhFyzRPAZquC5WjXBMAzHydrNolB+gzBjSBudAd2XrOX C9c=
  • 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.

There are two functions kind of related that I've left alone:

int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                          uint32_t *nr_features, uint32_t *featureset);

We might want to rename those to also use the xc_cpu_* prefix at least?
Using xc_cpu_policy_* would be wrong here IMO, as such functions don't
use the newly introduced xc_cpu_policy_t object.

Thanks, Roger.

Roger Pau Monne (21):
  libxl: don't ignore the return value from xc_cpuid_apply_policy
  libs/guest: rename xc_get_cpu_policy_size to xc_cpu_policy_get_size
  libs/guest: introduce xc_cpu_policy_t
  libs/guest: introduce helper to fetch a system cpu policy
  libs/guest: introduce helper to fetch a domain cpu policy
  libs/guest: introduce helper to serialize a cpu policy
  tools: switch existing users of xc_get_{system,domain}_cpu_policy
  libs/guest: introduce a helper to apply a cpu policy to a domain
  libs/guest: allow fetching a specific CPUID leaf from a cpu policy
  libs/guest: allow fetching a specific MSR entry from a cpu policy
  libs/guest: allow updating a cpu policy CPUID data
  libs/guest: allow updating a cpu policy MSR data
  libs/guest: switch users of xc_set_domain_cpu_policy
  libs/guest: introduce helper to check cpu policy compatibility
  libs/guest: obtain a compatible cpu policy from two input ones
  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               |   4 +-
 tools/include/xen-tools/libs.h      |   5 +
 tools/include/xenctrl.h             | 107 ++--
 tools/libs/guest/Makefile           |   2 +-
 tools/libs/guest/xg_cpuid_x86.c     | 849 +++++++++++++++++++---------
 tools/libs/guest/xg_sr_common_x86.c |  45 +-
 tools/libs/light/libxl_cpuid.c      | 229 +++++++-
 tools/libs/light/libxl_create.c     |   5 +-
 tools/libs/light/libxl_dom.c        |   2 +-
 tools/libs/light/libxl_internal.h   |  32 +-
 tools/libs/light/libxl_nocpuid.c    |   5 +-
 tools/misc/xen-cpuid.c              |  23 +-
 12 files changed, 960 insertions(+), 348 deletions(-)

-- 
2.30.1




 


Rackspace

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