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

Re: [PATCH v1] xen/config.h: Move BITS_PER_* definitions from asm/config.h to xen/config.h


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 27 Mar 2025 14:36:25 +0100
  • 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: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 27 Mar 2025 13:36:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.03.2025 13:53, Andrew Cooper wrote:
> On 27/03/2025 8:21 am, Jan Beulich wrote:
>> On 27.03.2025 01:44, Andrew Cooper wrote:
>>> On 26/03/2025 5:47 pm, Oleksii Kurochko wrote:
>>>> diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h
>>>> index d888b2314d..dbbf2fce62 100644
>>>> --- a/xen/include/xen/config.h
>>>> +++ b/xen/include/xen/config.h
>>>> @@ -98,4 +98,13 @@
>>>>  #define ZERO_BLOCK_PTR ((void *)-1L)
>>>>  #endif
>>>>  
>>>> +#define BYTES_PER_LONG  __SIZEOF_LONG__
>>>> +
>>>> +#define BITS_PER_BYTE   __CHAR_BIT__
>>>> +#define BITS_PER_INT    (__SIZEOF_INT__ << 3)
>>>> +#define BITS_PER_LONG   (BYTES_PER_LONG << 3)
>>>> +#define BITS_PER_LLONG  (__SIZEOF_LONG_LONG__ << 3)
>>>> +
>>>> +#define POINTER_ALIGN   __SIZEOF_POINTER__
>>> See how much nicer this is.  This patch possibly wants to wait until
>>> I've fixed the compiler checks to update to the new baseline, or we can
>>> just say that staging is staging and corner case error messages are fine.
>>>
>>> One thing, you have to replace the "<< 3" as you're hard-coding 8 here
>>> and ignoring __CHAR_BIT__.
>>>
>>> I'd suggest keeping the BITS_PER_BYTE on the LHS, e.g:
>>>
>>> #define BITS_PER_INT    (BITS_PER_BYTE * __SIZEOF_INT__)
>>>
>>> which tabulates better.
>>>
>>> I suggest keeping BITS_PER_XEN_ULONG to be arch-local.
>> I agree here despite ...
>>
>>>   ARM is the
>>> odd-one-out having a non-64bit arch use a 64bit XEN_ULONG.
>> ... not agreeing here: x86 is the odd-one-out; I sincerely hope any new ports
>> to 32-bit architectures / flavors will avoid compat layer translation by 
>> making
>> this type a proper 64-bit one. Architectures truly being 32-bit only, with no
>> expectation of a 64-bit flavor ever appearing, would be different.
> 
> I have some very firm opinions about this.
> 
> It is an error that the type xen_ulong exists, anywhere.  The fact it
> wasn't named guest_ulong shows a profound misunderstanding of its
> purpose and usage in the API/ABI.
> 
> Similarly, BITS_PER_XEN_ULONG is buggily named, and should be
> BITS_PER_GUEST_ULONG, as demonstrated by it's singular use in Xen
> (calculating BITS_PER_EVTCHN_WORD(d)).
> 
> ARM declaring that arm32 uses 64-bit xen_ulongs was cutting a corner
> that's going to bite twice as hard when 128bit comes along, and
> RISCV-128 is in progress already.

Yes indeed.

> All of this needs purging from the API/ABIs before RISC-V/PPC inherit
> the mistakes that are holding x86 and ARM back.

I'm curious to learn how you envision to support a 32-bit guest on RV128,
for example. You dislike the compat layer, and you also dislike xen_ulong_t
(I agree its name is potentially misleading). So you must be thinking of
something entirely new to express in particular interfacing structures.

Jan



 


Rackspace

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