From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Shawn Anastasio" <sanastasio@raptorengineering.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Bob Eshleman" <bobbyeshleman@gmail.com>,
"Connor Davis" <connojdavis@gmail.com>,
"Oleksii Kurochko" <oleksii.kurochko@gmail.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v1] xen/config.h: Move BITS_PER_* definitions from asm/config.h to xen/config.h
Date: Thu, 27 Mar 2025 12:53:28 +0000 [thread overview]
Message-ID: <f7381aa7-cfc8-4225-b500-374804cbf23d@citrix.com> (raw)
In-Reply-To: <994b9d44-f82f-4eb7-8742-9041ba2caf17@suse.com>
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.
All of this needs purging from the API/ABIs before RISC-V/PPC inherit
the mistakes that are holding x86 and ARM back.
~Andrew
next prev parent reply other threads:[~2025-03-27 12:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 17:47 [PATCH v1] xen/config.h: Move BITS_PER_* definitions from asm/config.h to xen/config.h Oleksii Kurochko
2025-03-27 0:44 ` Andrew Cooper
2025-03-27 8:21 ` Jan Beulich
2025-03-27 12:53 ` Andrew Cooper [this message]
2025-03-27 13:36 ` Jan Beulich
2025-03-27 12:50 ` Oleksii Kurochko
2025-03-27 13:16 ` Jan Beulich
2025-03-27 16:12 ` Oleksii Kurochko
2025-03-27 16:14 ` Jan Beulich
2025-03-27 8:18 ` Jan Beulich
2025-03-27 12:51 ` Oleksii Kurochko
2025-03-27 13:37 ` Jan Beulich
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=f7381aa7-cfc8-4225-b500-374804cbf23d@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=alistair.francis@wdc.com \
--cc=anthony.perard@vates.tech \
--cc=bertrand.marquis@arm.com \
--cc=bobbyeshleman@gmail.com \
--cc=connojdavis@gmail.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=oleksii.kurochko@gmail.com \
--cc=roger.pau@citrix.com \
--cc=sanastasio@raptorengineering.com \
--cc=sstabellini@kernel.org \
--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.