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

Re: [PATCH for-4.22 v3] xen/x86: Change stub page allocation/free


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 12 Jun 2026 11:32:59 +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=arcselector10001; 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=JhzS6K78HQdOTEozMfsjrDcsVXUUuNnzKqAv47OEqVU=; b=ErRQWuBnthMi5Mk42uTFfyPrOfLMqNiOrGosFtuMjBirKPmahKl+TufysWRhND9njmfQHolarrELyIJOiwEynRS66TtyWJRyf867BPtmzfrMMXpTYf8LIWDdVrxuPLS7NXeam///ZtjGgAyRWs3pOao/arpgwP/O2JrhXLsPfx7eIZsjhepuCloT7pkse7tPtnJOi9ocj+xhQvrTaEgs+CRQgjHf1JU9BYMKcGPQ7ScU8p4Xn3ek+t8alXqX10WeZ5oaua3ELNCyZn5IZ7Zgk6kaltOmaxFqt/WDPAVV4fiHMvSd+0CR9AQIRF22NISxlZsNT5u2Ltt7vIJjyfAugQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bZuiqfSa0jRIVKicNiq50v0vjbgJcZ6fEUWESMqjMKoz8diLLD66xkaf06Ek67J7UPuE8Bx4BXQhJaL7AzvlUtDp+c3+NGFn/PfhAjdEbewbyTbgzzMEPSh0r1RzN2McFYRuO3OBahMrzb9j14PHM6GiF5oh4Il4COvo4vNDig9omiA7HylKMwTHQM4SRIa4c9yVKm7pGQZcsow4TiGbvQGwRRZ/rvjNV3SDFRqEcTJZQpXuqx0P5m6yQPXNIDHWtfsLze3NlDUFJHPdgs0qUeswsscdR8jzul6lW5a+MVO9cJPFV/G/Vj8NmGvow55/rzEh1/QAqe/fslEUmpUBUw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Oleksii Kurochko <oleskii.kurochko@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 12 Jun 2026 09:33:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Jun 12, 2026 at 11:27:38AM +0200, Jan Beulich wrote:
> On 12.06.2026 10:22, Roger Pau Monne wrote:
> > From: Jason Andryuk <jason.andryuk@xxxxxxx>
> > 
> > Today the inline tracking of the stub page is problematic.  0xcc is used to
> > indicate unused, but it is also a "clear value."  A !CONFIG_PV build or
> > when running with FRED support will not populate the LSTAR/CSTAR stubs at
> > CPU bringup.  If a CPU is then offlined, the stubs page will be freed as
> > its content will be all 0xcc, regardless of the stubs page still begin
> > referenced by other CPUs.
> > 
> > The new approach uses a global, CPU-indexed dynamically allocated array of
> > stub addresses.  However, to handle NUMA aware allocations, we cannot
> > allocate all the memory in advance because of the NUMA dependency.  Take
> > advantage of the fact that Xen will attempt to contiguously pack CPUs on
> > the same NUMA node (see normalise_cpu_order()), and on CPU bringup use the
> > same stubs page the previous CPU did if suitable.  Note the code would
> > still function properly even if CPUs from NUMA nodes are not contiguously
> > packed, it just consumes more memory.
> > 
> > stub pages are no longer freed.  They remain referenced in the global
> 
> Nit: Didn't you mean to s/stub/Stub/ as per Andrew's comment?

Hm, yes, I've fixed the instance below, but not the one here.

> > CPU-indexed array and are re-used if the CPU is re-onlined.
> > 
> > The stubs array doesn't have an explicit lock.  During boot it's accessed
> > single threaded.  During runtime, &cpu_add_remove_lock serializes access.
> > 
> > Fixes: 7a66ac8d1633 ("x86: move syscall trampolines off the stack")
> > Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> > Tested-by: Jason Andryuk <jason.andryuk@xxxxxxx>
> > Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
> 
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Thanks.

I will run a CI pre-commit loop and push it today if it's all fine.

Roger.



 


Rackspace

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