All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Oleksii Kurochko <oleksii.kurochko@gmail.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 00:44:26 +0000	[thread overview]
Message-ID: <17a808cf-e676-4c30-9068-34a9a4d568d7@citrix.com> (raw)
In-Reply-To: <4f085bcbf5b6f1bc42824bfb08724e8a9bbd4918.1743005389.git.oleksii.kurochko@gmail.com>

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.  ARM is the
odd-one-out having a non-64bit arch use a 64bit XEN_ULONG.

~Andrew


  reply	other threads:[~2025-03-27  0:44 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 [this message]
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
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=17a808cf-e676-4c30-9068-34a9a4d568d7@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.