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

Re: [PATCH 17/21] libs/guest: introduce helper set cpu topology in cpu policy


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 1 Apr 2021 18:22:07 +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=Z3YUm9V+BOHV9ZbU3NeP5q+b1SrtN2hvM18XgsGk8dE=; b=aPL/0MIr/vlotLlKfae4MMqbgF9VduEyQaIe1rdtfZOhqDvoTewSNuAhaAq+4+MU1tPD44zUlipfZG36HrhVYVFk9bZaG8cR0RwyUtIHMT/keljis7/RQu5V2AKVgfXoQB7D1ITV6/8zK3wIkixxyGVRHoQMLUYIcNTrTRuXHD6uj6hV1LE/V+u6d1PQ0zzIEJ610i7TTuntz+fqUl69EQSgv3ev2+ECUTtH80Oj0y8o9Ck4iFY3IG0nlAOvomvqdq4ovOL+epftzlXHY2RMZUHbKWwp3twxPOYKz5JJWZ1xvR8wl2QPau8i3xLWGDjvQJcaQqCJ4OsTuIxPXIvKjA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U1go8m33G9lXdSVZdnODiF9LjE7z67ilqa2z2S78LHsBBj1IHJjp0tHhWB3LKtxqcVWOmoSBuhhWqymVfBoGNSSGtFj5XSnCojRRrBipaeoVaooHUQcpS6XMO5FNbEDNmBJZU/JGerluqB6WZxON+vERN1UJmkPxq7t5rZwfJUm3Okb2RJtmiQon6srRVRZv7Uo1owTqpXznmVaKbBf4Yj1Mpwwz9BE0tGZ9NsBuNuDnizE1ulsyhrmupSpSizyxXXGdNUwBpqCEmfwALfZsDR9jKC3cz4RJ5FqtmHK5lOJ4osqVla/oZFZO6Qa8Uqo3DNbiXlXgL85KEq5334sULw==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Thu, 01 Apr 2021 17:22:31 +0000
  • Ironport-hdrordr: A9a23:aYU4X6p/Edtu6DJJ8kP2AfgaV5vYL9V00zAX/kB9WHVpW+SFis Gjm+ka3xfoiDAXHEotg8yEJbPoex7h3LR+iLNwAZ6JWg76tGy0aLxz9IeK+UyHJwTS1M54kZ 1hfa93FcHqATFB5/rSzQGkH78br+Wv37uvgY7loUtFbQYvUK146hc8NwDzKDwVeCBjJb4UUK WR/dBGoT3IQwVxUu2eCmMeV+bO4/3n/aiWAiIuPBIs5AmQgT7A0teTfySw5RsQXyhCxr0v6w H+4mnEz56uru2hzVvk33LThq48pPLa1tBBCMaQ4/JlTgnEtwDAXuVccozHhh8ZiqWF6FEmkN 7Dyi1QQPhb2jfqUUye5Tfo0wnk+j4y53Hl0k/wuwqcneXJAAgUJuAEqYVFcgbIy0dIhqAM7I t7m1i3mrASLRTckD/z79LFPisa5nackD4ZvsM4y1l8OLFuEYN5nMgk025+VKokJmbc7rsqFe F/Zfusmcp+QBehQF3y+lV0zMfEZAVKIj62BnIsl+ayyDZskHVw3yIjtbAit0ZFzp47RpVejt 60SZhApfVLRs8SW6p3GP0Md8uxEnDMWhLBKgupUC7aKJ0=
  • Ironport-sdr: dwTyhiCEtVrUGv2P9u7V1L5Cp+o/kLzRHnJ52XNjxw0zwYl3tiQa10x73TrqHBs8GcapBSvBUB C3g9hp7BAJH6wbuYNlYXUUPijUSXxk34q6RIlYkNMVevOh0p4OpA7jITA9Vktwd2ThBnzk5c7e y4jntoV6Ss1X9TU2kDzrOvSvlC2VjhYBEwLuy22uXBLt0LkyoFfOU20PTv8vsd05rpnHiShoo2 5PAVmt0ODuDQrboUAA/DL5acCQEsB1KyizuQstKmi0W1pytfbvhUwrq+qGPV0Cku2PquodpNbx gs4=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23/03/2021 09:58, Roger Pau Monne wrote:
> This logic is pulled out from xc_cpuid_apply_policy and placed into a
> separate helper.
>
> No functional change intended.
>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
>  tools/include/xenctrl.h         |   4 +
>  tools/libs/guest/xg_cpuid_x86.c | 181 +++++++++++++++++---------------
>  2 files changed, 102 insertions(+), 83 deletions(-)
>
> diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
> index 6f7158156fa..9f94e61523e 100644
> --- a/tools/include/xenctrl.h
> +++ b/tools/include/xenctrl.h
> @@ -2631,6 +2631,10 @@ int xc_cpu_policy_calc_compatible(xc_interface *xch,
>  int xc_cpu_policy_make_compatible(xc_interface *xch, xc_cpu_policy_t policy,
>                                    bool hvm);
>  
> +/* Setup the policy topology. */
> +int xc_cpu_policy_topology(xc_interface *xch, xc_cpu_policy_t policy,
> +                           bool hvm);

I'm not sure how I feel about this.  It's repeating the mistake we've
currently got with topology handling.

One part of it needs to be part of "compatible".  We need to run the
below logic, *in this form* as part of magic-ing a policy out of thin
air for the incoming VM with no data.

However, for any non-broken logic, the caller needs to specify the
topology which wishes to be expressed.

Do we want SMT at all?  Do we want 1, 2, 4 or other threads/core.
How many cores per socket?  Its very common these days for
non-power-of-2 numbers.  Our default case ought to be to match the host
topology.

Do we want to support 3 threads/core?  Sure - its weird to think about,
but its semantically equivalent to using non-power-of-2 numbers at other
levels, and would certainly be useful to express for testing purposes.

What about Intel's leaf 0x1f with the SMT > Core > Module > Tile > Die
topology layout?

The answers to these questions also need to fix Xen so that APIC_ID
isn't vcpu_id * 2 (which is horribly broken on non-Intel or Intel
Knight* hardware).  It also needs to change how the MADT is written for
guests, and how the IO-APIC IDs are assigned (matters for the AMD
topology algorithms).

There are further implications.  Should we prohibit creating a 4-vcpu VM
with cores/socket=128?  A regular kernel will demand an IOMMU for this
configuration as we end up with APIC IDs above 255.  OTOH, there are
also virtualisation schemes now to support 32k vcpus without an IOMMU,
which KVM and HyperV now speak.

Fixing our topology problems is a monumental can of worms.  While we
should keep it in mind, we should try not to conflate it with "make
libxl/libxc's CPUID logic more sane, and include MSRs", which is large
enough task on its own.

What I suspect we want in the short term is
xc_cpu_policy_legacy_adjust() or equivalent, which is very clear that it
is a transitional API only, which for now can be used everywhere where
xc_cpuid_apply_policy() is used.  As we pull various logical areas out
of this, we'll adjust the callers appropriately, and eventually delete
this function.

~Andrew




 


Rackspace

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