Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1719681pxb; Mon, 8 Mar 2021 04:54:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNF7W/hx4hDlcqMZL5eG9H1TMETKWqRnob44+J3zGid/wi0qOqGYHZxyNgyn1XAjsETJ8x X-Received: by 2002:a17:906:8904:: with SMTP id fr4mr15276636ejc.136.1615208045046; Mon, 08 Mar 2021 04:54:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615208045; cv=none; d=google.com; s=arc-20160816; b=S5xxLYTV2Cw1nt9YxjRbSqbnhPOvx8qPVkOhcOFIFabaXEomsft9xDlf3r87UyvszB x+K8lO6RRKr1EjM/z8bQ5pNaO+2QlTK02wt1G1XbRqdl0vshry5T/Tq79j80Zikrsj+d d/34enbraFEg/J0QRpctA5OI4IWPFe7V4J+CoAGReIfPCWGOfPPQ0yelWPcWMVDa2Qpp lMhNWOaLaaaQLvOR8Q0sxU/fGtlj8lw2agXhr7f6ZD9cNdPTm0X/NwqIqN1hAt1ixhTb 2gWb2V4+dzt929GnNEz/BpYHpJdQMgRYSiWKAXhFPACV4Dy1LUHjin2eQtAiSmIjQqmx O/6g== 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=tpMh7N7ZWLG311fu/urmf0M+uC8RrHGTN4iZCnBuCFE=; b=qH4AokmJA/PSpZ+snDssOxVtJHOUsicNK8rvpXv3o2Ci32XmypPGy8TKzgu+qHzeQA D5Yp6pN+EpJorBVDD/G1w9wDfUjYMZDryxyVfjkXLZHYXaGon9qtiSH7bbAYoDTvS7T1 91jrektepiCwZ2tP1T5dvD+LcKEWwTV3W1lChDHptu78MxNXRMVF0cgwvKD/UPGktrw4 Ww1kIazO/akYC/mJkxuNRsf4vJBy2R7Ur9FjTWYr3wRqYAGOYrXK1isPPiz9VCHMgEm/ kvZGnoQo9El+IV4occN5METFH4RVNWl013ecBuMLbvGJYDpkTQuTBB2jbDqigHxSZp2K Qjlg== 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 c15si3247413ejd.354.2021.03.08.04.53.42; Mon, 08 Mar 2021 04:54:05 -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 S229446AbhCHMu0 (ORCPT + 99 others); Mon, 8 Mar 2021 07:50:26 -0500 Received: from mail.loongson.cn ([114.242.206.163]:38742 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229818AbhCHMuN (ORCPT ); Mon, 8 Mar 2021 07:50:13 -0500 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxedSBHUZggvkWAA--.28765S2; Mon, 08 Mar 2021 20:50:09 +0800 (CST) From: Tiezhu Yang To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li Subject: [PATCH] MIPS: Check __clang__ to avoid performance influence with GCC in csum_tcpudp_nofold() Date: Mon, 8 Mar 2021 20:50:07 +0800 Message-Id: <1615207807-29972-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf9AxedSBHUZggvkWAA--.28765S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KFWUCFWUGr18uw4DZr45Awb_yoW8Wry3pF 4qkr92grWvqryUG343Ar42g3s8ur48Gr92vrnIg3Wjva98Xw13WryfKw13WFyxJ395Aa4f uFWfWrn8Jrn2kw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkv14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1I6r4UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW5JwCF 04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r 18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vI r41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr 1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUr8nnUUUUU= 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h index 1e6c135..64d353e 100644 --- a/arch/mips/include/asm/checksum.h +++ b/arch/mips/include/asm/checksum.h @@ -130,7 +130,9 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, __u8 proto, __wsum sum) { +#ifdef __clang__ unsigned long tmp = (__force unsigned long)sum; +#endif __asm__( " .set push # csum_tcpudp_nofold\n" @@ -159,7 +161,11 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, " addu %0, $1 \n" #endif " .set pop" +#ifdef __clang__ : "=r" (tmp) +#else + : "=r" (sum) +#endif : "0" ((__force unsigned long)daddr), "r" ((__force unsigned long)saddr), #ifdef __MIPSEL__ @@ -169,7 +175,11 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, #endif "r" ((__force unsigned long)sum)); +#ifdef __clang__ return (__force __wsum)tmp; +#else + return sum; +#endif } #define csum_tcpudp_nofold csum_tcpudp_nofold -- 2.1.0