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

Re: [PATCH v2 1/2] xen/pdx: account for frametable_base_pdx in generic pdx_to_page/page_to_pdx


  • To: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 5 May 2026 09:13:03 +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=t+AV+3QmT/PFKL1SK27tSCTKbimpMTh3lGCPVS+KyJU=; b=mPv4nHiNyrzjFopRdfG0/mJVGc9BtJwmTiU7Gyacg6bBBZjQj47DBl3iVWCj0n1Z9+f2X4KtSg2urxPImbM9gYQ0pUrU0ymbd4/+NrB+2SP6VzPx3CIJPU/BwnFgYG6+KwrKHlRQEstlBywdiwkt10pDy2m+o0+6MfDlxgm53p3Yd/qanB5xdqxjlcJzrDDfeiLowEDUoFh0UuBj4FLkufmYLOECfgz3NhTd7HubKv6nztBdLsnLkQSvcOHseaX/ZNeJm9XktEA6Z9019XY01yeyu8LKdSX/jglryixL44BDbUW63grIrki0GvZj9oLSRAJ3ROmzZxIYS4a9K3YYGA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d9tPYAqimQSJIyPCJGvZ5liD+68yhqk/RtsxgcyOffrwFU0zojyJE1+xZguNmI/Up9UnuVzAxL9m70mw7SEfgwd59PYo7igWW4u4uOZ7Rl6eA+S1QHJ3n7SQBp8+VaMgGoxzqN1Ay7lAJXXfr9V58CmAPP4XHNufw3l1m7qNEhYT/1R+w8zGx97QXU9Q/dpKI3QRvYvNYKodlhaQ9qZWAbJZeLL3NeqJcO9p2EtxoQuc3h6F2ayhJojjSIBRehReJotzVDVUtxqvR4ImUPPrD5JfOqlt61Ap33YUEim6Ut7iz5qHPR8dUTHdza8VlsTEa4vGvMbBz1P2IoyqSEUAkQ==
  • 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: xen-devel@xxxxxxxxxxxxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Tue, 05 May 2026 07:13:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, May 05, 2026 at 08:48:15AM +0200, Orzel, Michal wrote:
> 
> 
> On 04-May-26 17:28, Roger Pau Monné wrote:
> > On Thu, Apr 30, 2026 at 02:51:02PM +0200, Michal Orzel wrote:
> >> The generic pdx_to_page() and page_to_pdx() macros in xen/pdx.h assume
> >> the frame table starts at PDX 0, which is only true on x86. ARM
> >> uses a non-zero frametable_base_pdx to offset into the frame table (PPC 
> >> also
> >> defines it).
> >>
> >> Fix the generic macros to subtract/add frametable_base_pdx, defaulting
> >> to 0 when the arch does not define it. This makes the generic macros
> >> correct for all architectures, even though they are only used on x86
> >> today.
> > 
> > Hm, I assume this offset was added because the original mask PDX
> > compression won't (usually) compress the gap between 0 and the start
> > of RAM.  However the newish offset PDX compression should be able to
> > compress from 0 to start of RAM, and hence you don't need to apply
> > an extra PDX offset there?
> > 
> > If that's indeed the case it might be better to integrate
> > frametable_base_pdx into the mask compression algorithm itself, so
> > that on some arches it's a mask plus a decrease.
> The offset is needed regardless of whether compression is used. With
> CONFIG_PDX_NONE (no compression, PDX == MFN), if RAM starts at e.g.
> 0x80000000, the first valid PDX is 0x80000.

OK, so you are doing some (kind of) address space compression (removing
the leading empty range to the first RAM region) even when PDX is
disabled.

> Without frametable_base_pdx
> the frame table would have to be indexed from 0, wasting
> 0x80000 * sizeof(page_info) of memory just to cover the hole before RAM.

But you don't really "waste" memory, just address space?  Oh, maybe
not on ARM as it doesn't use pdx_group_valid?  And so you
unconditionally populate the frametable from PDX 0 to max PDX.

> So frametable_base_pdx is really a frame table indexing offset, not
> something tied to the compression algorithm.

Right, it just seems odd to do that extra subtraction when using
offset compression, as in that case the compression logic itself
should remove that leading gap when RAM doesn't start at 0.

Instead of generalizing and expanding the usage of frametable_base_pdx
it might be better to implement support for pdx_group_valid when
populating the frame table, and switch by default to the offset
compression method that will already remove any leading unpopulated
spaces?

Thanks, Roger.



 


Rackspace

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