Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp553522pxf; Wed, 17 Mar 2021 10:20:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQR3A9Abb4DVffH4nCg9Qn/0NMyFGnykMqg/YXJc1NBuUuy+5nzuziQ1LeRCOesU4plwdN X-Received: by 2002:a17:906:f88a:: with SMTP id lg10mr37259426ejb.39.1616001638774; Wed, 17 Mar 2021 10:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616001638; cv=none; d=google.com; s=arc-20160816; b=HiFmJ2Ek3juEZ6UZEJZT9b5MMlsh8e5GtSA84A+POl5U6olfZzb/S6TSFf+11Mepuq Fr7eQCMyNjkiOgC9p9SIezlehldh4XYz8F7Vein7170a/FiYqOlleIt7XiIjmFAW2Qxm qNnr67GaXp74SSWvl7EO3O7ONS+06+XTGqY/tFfOYtIrENdPOrg5bOY8VX9Pc6aYnFj9 1830DUwQiuiXfvLL1azYc9qdP9AMMNO3MLbvyEZhH08h7M4Ua2o8oGxcWp0eS39slrmd YzrWoPyKMvmchRlK3vNOZXDjT2tdZ5dJ8IEYgEKBsu4cTJKLpul4MUFehuDwO7ozQYGa 7NWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=/2gX9GoQk60MIOwBKCeIHK+f+QVTrgapH5jL9zB2DeU=; b=Y94ziqL1WRSAWLFXky75jfCTgzXp4e6FFVBk1mGNhqgenDc7qCu+V0D6wsC9hA95Qm epFrCD3E24ZZprdkMM4hTQzdHpiRDFbzt1AFT00GuZCx+uFqOiXVBEZj1N+lwtpT7x39 Ruxb7JtMfMmAabr0H3rVxPH/uztKeBJU27zAr8Nht2BK9SYzq3e2jA5bK8+lJAdV9hs8 IR8q0kVtlZiyJZMrZMyWrB4xWU1StGmfIKR+iKqjyZNtUfYo9+7DvHWnS3KA5JoMNQ49 F5e30tYmgYSAiyW5c22c8Zye82pWPpWWGRI9Ade/f+XGsJL7vTX/xSRWj9CaxF4bzrDc rMhA== 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 v12si16852443ejb.425.2021.03.17.10.20.13; Wed, 17 Mar 2021 10:20:38 -0700 (PDT) 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 S231985AbhCQPyg (ORCPT + 99 others); Wed, 17 Mar 2021 11:54:36 -0400 Received: from angie.orcam.me.uk ([157.25.102.26]:37762 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232276AbhCQPyF (ORCPT ); Wed, 17 Mar 2021 11:54:05 -0400 Received: by angie.orcam.me.uk (Postfix, from userid 500) id E4ADF92009C; Wed, 17 Mar 2021 16:35:36 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id D98DE92009B; Wed, 17 Mar 2021 16:35:36 +0100 (CET) Date: Wed, 17 Mar 2021 16:35:36 +0100 (CET) From: "Maciej W. Rozycki" To: Tiezhu Yang cc: David Laight , Thomas Bogendoerfer , "linux-mips@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Xuefeng Li Subject: Re: [PATCH v2] MIPS: Check __clang__ to avoid performance influence with GCC in csum_tcpudp_nofold() In-Reply-To: <5ee86b3b-81d2-790c-f67b-e250f60272fd@loongson.cn> Message-ID: References: <1615263493-10609-1-git-send-email-yangtiezhu@loongson.cn> <913665e71fd44c5d810d006cd179725c@AcuMS.aculab.com> <5ee86b3b-81d2-790c-f67b-e250f60272fd@loongson.cn> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Mar 2021, Tiezhu Yang wrote: > > > The code produced by GCC remains the same between (1), (3) and (4), > > > the last changes looks like better (with less changes based on commit > > > 198688edbf77), so I will send v3 later. > > Aren't those all the same - apart from register selection. I did a quick size check with my MIPS64 config between (1) and (2): text data bss total filename - 6129704 2997475 215280 9342459 vmlinux + 6129752 2997475 215280 9342507 vmlinux so obviously there's more to that and the code snippets quoted did not show the full picture. The size difference is in `tcp_v4_send_reset' AFAICT, maybe elsewhere as well. FAOD the former binary is as at 198688edbf77^ and the latter is as at 198688edbf77, and the command used was `size --format=gnu' to prevent `.rodata' from interfering with the text size. > > Not that I grok the mips opcodes. > > But that code has horridness on its side. It's a 32-bit one's-complement addition. The use of 64-bit operations reduces the number of calculations as any 32-bit carries accumulate in the high 32-bit word allowing one instruction to be saved total compared to the 32-bit variant. Nothing particularly unusual for me here; I've seen worse stuff with x86. > Is this patch necessary? If no, we can ignore it. > If yes, I will send v3 with the above (4) changes. I have also verified this patch directly on top of 198688edbf77 and it does not bring the old `vmlinux' size back (there's no difference in code produced at all here actually), so you need to investigate this further. This is with an older checkout of GCC 11. I've attached a stripped version of my .config that you can use for reference. Maciej