All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Lin Liu <lin.liu@citrix.com>, xen-devel@lists.xenproject.org
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>, "Wei Liu" <wl@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v3 1/6] xen: implement byteswap
Date: Tue, 10 May 2022 12:10:07 +0100	[thread overview]
Message-ID: <11269227-ba07-b2b1-c2ef-ea6309980f67@xen.org> (raw)
In-Reply-To: <2699787cd4ba1d71448bbcdf190d927e180e80b9.1652170719.git.lin.liu@citrix.com>

Hi,

On 10/05/2022 11:15, Lin Liu wrote:
> swab() is massively over complicated and can be simplified by builtins.

NIT: "by builtins" -> "by re-implementing using compiler builtins".

> The compilers provide builtin function to swap bytes.
> * gcc:   https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
> * clang: https://clang.llvm.org/docs/LanguageExtensions.html
> This patch simplify swab() with builtins and fallback for old compilers.
> 
> Signed-off-by: Lin Liu <lin.liu@citrix.com>
> ---
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Julien Grall <julien@xen.org>
> Cc: Bertrand Marquis <bertrand.marquis@arm.com>
> Cc: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: George Dunlap <george.dunlap@citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Wei Liu <wl@xen.org>
> Cc: "Roger Pau Monné" <roger.pau@citrix.com>
> Changes in v3:
> - Check __has_builtin instead of GNUC version
> 
> Changes in v2:
> - Add fallback for compilers without __builtin_bswap
> - Implement with plain C instead of macros
> ---
>   xen/arch/arm/include/asm/byteorder.h | 14 ++-----
>   xen/arch/x86/include/asm/byteorder.h | 34 ++---------------
>   xen/include/xen/byteorder.h          | 56 ++++++++++++++++++++++++++++
>   xen/include/xen/byteswap.h           | 44 ++++++++++++++++++++++
>   xen/include/xen/compiler.h           | 12 ++++++
>   5 files changed, 120 insertions(+), 40 deletions(-)
>   create mode 100644 xen/include/xen/byteorder.h
>   create mode 100644 xen/include/xen/byteswap.h
> 
> diff --git a/xen/arch/arm/include/asm/byteorder.h b/xen/arch/arm/include/asm/byteorder.h
> index 9c712c4788..622eeaba07 100644
> --- a/xen/arch/arm/include/asm/byteorder.h
> +++ b/xen/arch/arm/include/asm/byteorder.h
> @@ -1,16 +1,10 @@
>   #ifndef __ASM_ARM_BYTEORDER_H__
>   #define __ASM_ARM_BYTEORDER_H__
>   
> -#define __BYTEORDER_HAS_U64__
> +#ifndef __BYTE_ORDER__
> +   #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
> +#endif
>   
> -#include <xen/byteorder/little_endian.h>
> +#include <xen/byteorder.h>
>   
>   #endif /* __ASM_ARM_BYTEORDER_H__ */
> -/*
> - * Local variables:
> - * mode: C
> - * c-file-style: "BSD"
> - * c-basic-offset: 4
> - * indent-tabs-mode: nil
> - * End:
> - */

This change looks unrelated to this patch. Can you explain it?

Cheers,

-- 
Julien Grall


  parent reply	other threads:[~2022-05-10 11:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 10:15 [PATCH v3 0/6] Implement byteswap and update references Lin Liu
2022-05-10 10:15 ` [PATCH v3 1/6] xen: implement byteswap Lin Liu
2022-05-10 10:50   ` Andrew Cooper
2022-05-10 11:10   ` Julien Grall [this message]
2022-05-10 12:10     ` Lin Liu (刘林)
2022-05-10 16:18       ` Julien Grall
2022-05-10 10:15 ` [PATCH v3 2/6] crypto/vmac: Simplify code with byteswap Lin Liu
2022-05-10 10:51   ` Andrew Cooper
2022-05-10 10:15 ` [PATCH v3 3/6] arm64/find_next_bit: Remove ext2_swab() Lin Liu
2022-05-10 10:52   ` Andrew Cooper
2022-05-10 11:05   ` Julien Grall
2022-05-10 10:15 ` [PATCH v3 4/6] xen: Switch to byteswap Lin Liu
2022-05-10 10:51   ` Julien Grall
2022-05-10 11:09     ` Andrew Cooper
2022-05-10 11:17       ` Julien Grall
2022-05-10 11:34         ` Andrew Cooper
2022-05-10 11:47           ` Julien Grall
2022-05-11  3:12             ` Stefano Stabellini
2022-05-11  8:21               ` Julien Grall
2022-05-11 14:16               ` Bertrand Marquis
2022-05-11  9:56             ` Andrew Cooper
2022-05-11 10:55               ` Julien Grall
2022-05-11  6:30     ` Lin Liu (刘林)
2022-05-11  8:34       ` Julien Grall
2022-05-11 12:11         ` George Dunlap
2022-05-11 12:39           ` Julien Grall
2022-05-11 14:21           ` Bertrand Marquis
2022-05-17 14:59             ` Jan Beulich
2022-05-10 14:32   ` Anthony PERARD
2022-05-10 10:15 ` [PATCH v3 5/6] byteorder: Remove byteorder Lin Liu
2022-05-10 11:09   ` Andrew Cooper
2022-05-10 10:15 ` [PATCH v3 6/6] tools: Remove unnecessary header Lin Liu
2022-05-17 15:01   ` Jan Beulich
2022-05-17 15:18     ` 回复: " Lin Liu (刘林)

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=11269227-ba07-b2b1-c2ef-ea6309980f67@xen.org \
    --to=julien@xen.org \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=lin.liu@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.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.