All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xenproject.org
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>,
	"Jan Beulich" <jbeulich@suse.com>,
	"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>
Subject: Re: [PATCH v1] xen/config.h: Move BITS_PER_* definitions from asm/config.h to xen/config.h
Date: Thu, 27 Mar 2025 13:50:20 +0100	[thread overview]
Message-ID: <c3d6a46c-c372-43f2-81d4-8128ebcb1b2b@gmail.com> (raw)
In-Reply-To: <17a808cf-e676-4c30-9068-34a9a4d568d7@citrix.com>

[-- Attachment #1: Type: text/plain, Size: 1650 bytes --]


On 3/27/25 1:44 AM, 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.

Do you mean this patch:https://lore.kernel.org/xen-devel/20250320153241.43809-3-andrew.cooper3@citrix.com/?

I haven't checked clang but if to look at gcc then these builtin macros was introduced in
024a85aeb6a("c-cppbuiltin.c (builtin_define_type_sizeof): New function.") and it seems like even older then gcc5
contains this patch:
$ git tag --contains 024a85aeb6a912811d917f737eaad39140c2fb0c
   ...
   releases/gcc-4.3.0
   ...

Am I missing something?

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

Thanks. I'll update that and send the new patch version.

~ Oleksii

[-- Attachment #2: Type: text/html, Size: 2454 bytes --]

  parent reply	other threads:[~2025-03-27 12:50 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
2025-03-27 13:36       ` Jan Beulich
2025-03-27 12:50   ` Oleksii Kurochko [this message]
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=c3d6a46c-c372-43f2-81d4-8128ebcb1b2b@gmail.com \
    --to=oleksii.kurochko@gmail.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=alistair.francis@wdc.com \
    --cc=andrew.cooper3@citrix.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=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.