[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210315102346.10227-1-alobakin@pm.me>
Date: Mon, 15 Mar 2021 10:24:02 +0000
From: Alexander Lobakin <alobakin@...me>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: Alexander Lobakin <alobakin@...me>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
"Maciej W. Rozycki" <macro@...am.me.uk>,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
Xuefeng Li <lixuefeng@...ngson.cn>,
David Laight <David.Laight@...LAB.COM>
Subject: Re: [PATCH v2] MIPS: Check __clang__ to avoid performance influence with GCC in csum_tcpudp_nofold()
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
Date: Tue, 9 Mar 2021 12:18:13 +0800
> The asm code in csum_tcpudp_nofold() is performance-critical, I am sorry
> for the poorly considered implementation about the performance influence
> with GCC in the commit 198688edbf77 ("MIPS: Fix inline asm input/output
> type mismatch in checksum.h used with Clang").
>
> With this patch, we can build successfully by both GCC and Clang,
> at the same time, we can avoid the potential performance influence
> with GCC.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
> ---
> arch/mips/include/asm/checksum.h | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h
> index 1e6c135..80eddd4 100644
> --- a/arch/mips/include/asm/checksum.h
> +++ b/arch/mips/include/asm/checksum.h
> @@ -128,9 +128,13 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
>
> static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
> __u32 len, __u8 proto,
> - __wsum sum)
> + __wsum sum_in)
> {
> - unsigned long tmp = (__force unsigned long)sum;
> +#ifdef __clang__
Why not rely on CONFIG_CC_IS_CLANG here?
> + unsigned long sum = (__force unsigned long)sum_in;
> +#else
> + __wsum sum = sum_in;
> +#endif
>
> __asm__(
> " .set push # csum_tcpudp_nofold\n"
> @@ -159,7 +163,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
> " addu %0, $1 \n"
> #endif
> " .set pop"
> - : "=r" (tmp)
> + : "=r" (sum)
> : "0" ((__force unsigned long)daddr),
> "r" ((__force unsigned long)saddr),
> #ifdef __MIPSEL__
> @@ -169,7 +173,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
> #endif
> "r" ((__force unsigned long)sum));
>
> - return (__force __wsum)tmp;
> + return (__force __wsum)sum;
> }
> #define csum_tcpudp_nofold csum_tcpudp_nofold
>
> --
> 2.1.0
Al
Powered by blists - more mailing lists