[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: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 5 May 2026 12:49:06 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • 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>, Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 05 May 2026 10:49:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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)?

Jan



 


Rackspace

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