Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1895796pxb; Mon, 8 Mar 2021 08:54:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5FQLOXp4d1CwTZKQ4psyzC3rpcWZjgGBF1OvMwXdPlh4IzNC0nZSaQEAj0mvfubG1famN X-Received: by 2002:aa7:cf95:: with SMTP id z21mr22549336edx.76.1615222465347; Mon, 08 Mar 2021 08:54:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615222465; cv=none; d=google.com; s=arc-20160816; b=j/INKnYjqeGjhf/NUHTlyrZVKL9JaDthrZRjr9DReXF4mRO3zAIhVaXxgrkqqMtfrW O4iuH8hThNI9FKvz1Q34QwWesj/BK8Z+eeSXn925CkW7ZnOVh68h3VvbswKb2PuU//VZ le5A67o7M61VZlQqi4mtfGJsMYZw03Hjv0OF71RvVG/hcR45nSV3T2aQRNN1xxd6/3TJ Z3a1xdzFHcfebTz0HXob5G3ouspG064zpnL508Zdz7aq/GLFr1hPAIwXQILsxGRyNOAX IaQqXnfevUpWssZ5XOwmHhOmOB/tzrUJJQHW4jMhpZB7PrFCh74R5aNUzdufg8LOnURA ej5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=o81ehGf8IJVZm4OFA+bGwqMvm+hiWGFZEOYHegEUiBs=; b=l6HmBWLqvT1I2Yt/NZ71XfeaXE0CI2+q1Q9HkBYHYiQSDAPqblxL4eCWfQxmsxx033 gcZvANWLIsX5HCFBscpOMdVINnRIpaxZpakAQGvoh0vKt8Oioism3MSTlCuEdr4uFK3+ 4E94pykFiJIHQjErdWp2p7YiUstNn6zYHkYtJOScLsEBami5thMONKIQmVIzBK0Hjs/m Y+/CQfLfATXedeKk0ciGoot6kh7UW8F3wPt2ePuYCKen0bqAB25DVZHXbvULiKjqLb1n qvY+gzZUpsLG9//HymdOcQDBzi9YrrH3cZOJicBhVvTxK/TFA8+vmlXqh35PSclqpPCw An1w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o14si7641439edz.435.2021.03.08.08.54.01; Mon, 08 Mar 2021 08:54:25 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230135AbhCHQwh convert rfc822-to-8bit (ORCPT + 99 others); Mon, 8 Mar 2021 11:52:37 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:42564 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbhCHQw0 (ORCPT ); Mon, 8 Mar 2021 11:52:26 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-282-p8F5T5RLMuythNy9As2n-g-1; Mon, 08 Mar 2021 16:52:23 +0000 X-MC-Unique: p8F5T5RLMuythNy9As2n-g-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 8 Mar 2021 16:52:24 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Mon, 8 Mar 2021 16:52:24 +0000 From: David Laight To: 'Tiezhu Yang' , Thomas Bogendoerfer CC: "linux-mips@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Xuefeng Li Subject: RE: [PATCH] MIPS: Check __clang__ to avoid performance influence with GCC in csum_tcpudp_nofold() Thread-Topic: [PATCH] MIPS: Check __clang__ to avoid performance influence with GCC in csum_tcpudp_nofold() Thread-Index: AQHXFBmyTl3JNAv/2UywLmyfFV7Ivap6TYNg Date: Mon, 8 Mar 2021 16:52:24 +0000 Message-ID: <8d61574e815a4cf098d21eb4d749be0f@AcuMS.aculab.com> References: <1615207807-29972-1-git-send-email-yangtiezhu@loongson.cn> In-Reply-To: <1615207807-29972-1-git-send-email-yangtiezhu@loongson.cn> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tiezhu Yang > Sent: 08 March 2021 12:50 > > 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 What happens if you make the above: #ifdef __clang__ unsigned long tmp = (__force unsigned long)sum; #else __wsum tmp = sum; #endif and then leave the rest of the function the same for both compilers. Maybe do s/sum/sum_in/,s/tmp/sum/ to reduce the changes. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)