[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 5 May 2026 08:48:15 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=citrix.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=KgFvu6n7dTdYcri9lLZhZEKLMUEdQbz2ewQ/EV+CiKI=; b=SYM6ImdQPCWffs08TLHhMkZMI/s4cgmy9RM9z4fUReizfrCazWIIKgPqHicmHlbps6bB6eMq2+CaKW5v1GMkAvCQbyC7FTDgFQKRf0ywrL3Ok7lyRjUYDRWa2C7+nH6pu72DNMg01VgbwzBt7Qp/uHQrA97M8NED1jeXwqC6lO+D7RufJyM/l7WMdXQmdBKCTaDe+EA0050JQUY56J1PNQ8Xwth1rDx1dJ+lxpD9em/5UAyG48mYytBmNLRd/Ci6Esy4yQ7O6z2LDJ4TX51NrNpNogK+rQQm5Yz9UyXaffeylTh/GHSAkDyFdNr3UsaxmRWZ60erax9uw1xD5f2trA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P72EIXPXhlpOBhWUt16BkLcX6aW5s7phcrZMctaTLSOINc3gSfGPHjQpuUOELg5JVMV3Ap/fpM3RA0dWMlaTOXjzqBPayVGtQnrBlue+y3uoGrVgJuWbau99WD0E2A1Xh9Dje08Yj0jbhZAuHaLQBPmuZenEMdOcTBReIRt42kLxCkqF94Y2cO054WbZRUIacvdxDZohFAUiSM59AHIRcBMkDfb6+ruQqSnXWQwzwfl8Tb8H4cAT6zfroniP33I0UTy/h0amg+2W3EyhEvMMPjTpm3eXK/wJgJzQYL2s0FxXxYtmt5x6tzE11SqsmPPEC7DP7MncxIrHuxvC2xLN/g==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • 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 06:48:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


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. 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.

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

~Michal





 


Rackspace

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