Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2267043pxb; Mon, 8 Mar 2021 20:22:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzOtPL4pb3gpJQ6whFYTnT6bG7qmRbF655WeInfvfHdbuTBvl3oa5iCLiLz1TjeQpeCyfU X-Received: by 2002:a17:906:1a44:: with SMTP id j4mr18560466ejf.401.1615263778222; Mon, 08 Mar 2021 20:22:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615263778; cv=none; d=google.com; s=arc-20160816; b=PgGUttb/638u1Y/5wZom3gZ10l7wzD71lx0InyS4Lo1p9m6XlcNL224lquY99ka+s7 UqGa0AGCqg2g7ZfboAK7Yo4wdGbpZBDv+6TOtZ3bpKERxhKk9Rdf0AQrQikpfESZKBMc +Oo5XT4BolblqGwkM/cC07i5sLE6jEV4MD/uOPda9NSQZ7cD4jrKqX8gy7j/Z9UAsDRq WMCI4fHfQ9loVpHFlaL0qw2FGq/wrqFL6rYd0VyoCS9VNxLNYAyaAL8nlLfbigjok3A6 NUPrFb3w/HPcAIUktE+Lp59Tqa7Xk2jkh96YLPMpayaWOYb0OvTyHUYHzgpXniKsWNXh cVyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=+zveBnCsc9DVLr0hQAcKJbHprPhWOSu/ucQhERwqCno=; b=eOb0aYXpVHatD5dLGN+HZV+wr8IhLweztv46FxswkWeuTBXZT4ew080g7YVZjLRlqA wyZ/ifX6YR+p8TUJDdC44EvD0sQVqE0acf24d9NSkH/zop2pcqG0fU95bCTprxCKSL2G nFB2oshEUTMjZWW2guPg9L3nsfVTdAxk4rzR+yON9NIEIxaua9T9LraE+uSZU1iYGg8V AECfAdipcnfyGjhTONauYadIL+J4tBUFB2Z8LfQ/6ogXQFnPtHLORS9p25ITpheTzZTS kDOHh00miDEmiO7GyywYyJPDdbGXNwRtgBq+bzvp6L5j6ODxd7vMk0fcfqo7UrkUUVkN EsYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si8361432eds.451.2021.03.08.20.22.35; Mon, 08 Mar 2021 20:22:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbhCIESi (ORCPT + 99 others); Mon, 8 Mar 2021 23:18:38 -0500 Received: from mail.loongson.cn ([114.242.206.163]:41882 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229980AbhCIESS (ORCPT ); Mon, 8 Mar 2021 23:18:18 -0500 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxKdUG90ZgeDsXAA--.29488S2; Tue, 09 Mar 2021 12:18:14 +0800 (CST) From: Tiezhu Yang To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , David Laight Subject: [PATCH v2] MIPS: Check __clang__ to avoid performance influence with GCC in csum_tcpudp_nofold() Date: Tue, 9 Mar 2021 12:18:13 +0800 Message-Id: <1615263493-10609-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf9AxKdUG90ZgeDsXAA--.29488S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KFWUCFWUJw4DXFWxWw4fGrg_yoW8AF1xpF 4jk3s2qrWvqryUKasxAr429r15Ww4rGr97ZrnIg3Wjvas8Xw15Wry3K3W3WF18J3ykAa4f uFWfWrn5Grs2kaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkq14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1I6r4UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Cr1j6rxdM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY02Avz4vE14v_Gryl 42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJV WUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAK I48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r 4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7VUUhF4JUUUUU== X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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__ + 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