From: "Roger Pau Monné" <roger.pau@citrix.com>
To: "Orzel, Michal" <michal.orzel@amd.com>
Cc: Jan Beulich <jbeulich@suse.com>,
xen-devel@lists.xenproject.org,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Anthony PERARD <anthony.perard@vates.tech>,
Timothy Pearson <tpearson@raptorengineering.com>,
Teddy Astie <teddy.astie@vates.tech>
Subject: Re: [PATCH v2 1/2] xen/pdx: account for frametable_base_pdx in generic pdx_to_page/page_to_pdx
Date: Tue, 5 May 2026 14:15:52 +0200 [thread overview]
Message-ID: <afnfeLeYypvBiEze@macbook.local> (raw)
In-Reply-To: <e8218607-26d8-4517-8634-df3c365e5bb2@amd.com>
On Tue, May 05, 2026 at 01:46:51PM +0200, Orzel, Michal wrote:
>
>
> On 05-May-26 12:49, Jan Beulich wrote:
> > On 05.05.2026 12:46, Orzel, Michal wrote:
> >> On 05-May-26 12:40, Jan Beulich wrote:
> >>> On 05.05.2026 09:35, Orzel, Michal wrote:
> >>>> On 05-May-26 09:13, Roger Pau Monné wrote:
> >>>>> 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.
> >>>> With pdx_group_valid (which this series adds) we wouldn't waste
> >>>> physical memory for the leading gap. But we'd still waste virtual address
> >>>> space and the FRAMETABLE_NR check (max_pdx > FRAMETABLE_NR) becomes tighter
> >>>> because the full range from PDX 0 must fit. For example with RAM starting at 5TB
> >>>> the virtual offset before the first usable entry would be ~70GB — more than the
> >>>> entire 32GB FRAMETABLE_SIZE on ARM64.
> >>>
> >>> Yet still - this is exactly one of the situations offset compression means
> >>> to cover. I'm entirely with Roger as to it being undesirable to build a
> >>> special case variant of "offset compression" into "no compression".
> >> In this case, if you don't want to generalize the macros, how should we proceed
> >> on Arm if we still need the offset to cover the PDX_NONE variant that we also
> >> use? In v1 I just created a local override but Julien wanted to generalize the
> >> macros instead. The discussion about switching the default on Arm from mask to
> >> offset that is not even selectable on Arm needs to wait for the new release cycle.
> >
> > I'm not convinced of that. If you need offset by default, why not enable it by
> > default (right now, and potentially even as a backport if there's any bug that
> > is being fixed)?
> As said before, we also need offset when using just PDX grouping and no compression.
But you don't really mean no compression? The offset itself that you
subtract is a transformation, and hence a compression, as the physical
and PDX address spaces are no longer identity mapped? Maybe those
systems should have never worked with PDX_NONE, and instead required
a PDX compression in place (one that would remove the offset from 0 to
the first RAM range).
It's an incomplete conversion IMO, as ARM applies it to the
frametable, but not the direct map.
Thanks, Roger.
next prev parent reply other threads:[~2026-05-05 12:16 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 12:51 [PATCH v2 0/2] xen/arm: Improve frametable allocation Michal Orzel
2026-04-30 12:51 ` [PATCH v2 1/2] xen/pdx: account for frametable_base_pdx in generic pdx_to_page/page_to_pdx Michal Orzel
2026-05-01 9:41 ` Luca Fancellu
2026-05-01 17:08 ` Stefano Stabellini
2026-05-04 15:28 ` Roger Pau Monné
2026-05-05 6:48 ` Orzel, Michal
2026-05-05 7:13 ` Roger Pau Monné
2026-05-05 7:35 ` Orzel, Michal
2026-05-05 8:34 ` Roger Pau Monné
2026-05-05 10:40 ` Jan Beulich
2026-05-05 10:46 ` Orzel, Michal
2026-05-05 10:49 ` Jan Beulich
2026-05-05 11:46 ` Orzel, Michal
2026-05-05 12:15 ` Roger Pau Monné [this message]
2026-05-05 14:38 ` Orzel, Michal
2026-05-05 13:00 ` Jan Beulich
2026-05-05 14:44 ` Orzel, Michal
2026-05-05 15:20 ` Roger Pau Monné
2026-05-05 13:05 ` Jan Beulich
2026-05-05 14:52 ` Orzel, Michal
2026-05-05 16:11 ` Jan Beulich
2026-05-06 7:01 ` Orzel, Michal
2026-04-30 12:51 ` [PATCH v2 2/2] xen/arm: skip holes in physical address space when setting up frametable Michal Orzel
2026-05-01 15:00 ` Luca Fancellu
2026-05-01 17:08 ` Stefano Stabellini
2026-05-04 14:46 ` Orzel, Michal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=afnfeLeYypvBiEze@macbook.local \
--to=roger.pau@citrix.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=bertrand.marquis@arm.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=teddy.astie@vates.tech \
--cc=tpearson@raptorengineering.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.