From patchwork Wed Aug 29 08:30:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10579675 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAD3B17DB for ; Wed, 29 Aug 2018 08:35:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D45D52A648 for ; Wed, 29 Aug 2018 08:35:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C52042A74C; Wed, 29 Aug 2018 08:35:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2C3212A648 for ; Wed, 29 Aug 2018 08:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iyz0/X/1Eu5g906/4zvyItL5Ud+TSVHad6yK5OEDB1s=; b=IrIkrk8WYgfcu2 TMhJwYJfq/r0IIJ9yq4RI/FSAl7zk/ZSQW8xO8TU3No2wjBynOL9KMda5OsTGDNU0ad3Vghi6ssFi Xa/YZ/Ce6ERQ5rjZLQWv5jrgLjARJNSKXaLTk2UqA+/ij3fuCA0poH6psXQzzKGtX5CN0gWDOr0SC qBNYwKD2ZzWtKWNa25kFB/KjmdIoVmA3mNQs8IgE4X+lqq7FhfOwznkbcrq5hd7hitpLAU6/wbHxJ T+FFuyz0WrTEqBqwMtdQ8Vt/yoRJw06rrUimGken71RuzobStg8q49mldkoMNPvWEQZ5IPco9ikZw d7tifKdhaZTrAFyE/xUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuvwz-0007A6-U1; Wed, 29 Aug 2018 08:35:42 +0000 Received: from mail-co1nam05on061b.outbound.protection.outlook.com ([2a01:111:f400:fe50::61b] helo=NAM05-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuvv5-00056J-TV for linux-arm-kernel@lists.infradead.org; Wed, 29 Aug 2018 08:34:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ssSYEkoUjeRD2907CRxsnGJWrPIgq8vvZI3n7lRvDkk=; b=nuSZWYmU7xerEJTMJbjWqIapm4Zc5NDd+Pg5AeY84pcMrV/izrnxOAyOOMcPai4tO39CCW7GKNiPOxMhRWTDg3LGVAIdW9vI9/2Jy3yE7wDd8Su5Ahf9mXCmnTsq0DXXXA+v951sv6/IZLQK+IIp1JST1fo5XPtXWwui71y2NhA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by BLUPR0301MB1571.namprd03.prod.outlook.com (2a01:111:e400:52a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.14; Wed, 29 Aug 2018 08:33:26 +0000 Date: Wed, 29 Aug 2018 16:30:21 +0800 From: Jisheng Zhang To: , "David S. Miller" Subject: [PATCH 5/5] net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe Message-ID: <20180829163021.70ce99ab@xhacker.debian> In-Reply-To: <20180829162456.2bd69796@xhacker.debian> References: <20180829162456.2bd69796@xhacker.debian> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Originating-IP: [124.74.246.114] X-ClientProxiedBy: TYAPR04CA0004.apcprd04.prod.outlook.com (2603:1096:404:15::16) To BLUPR0301MB1571.namprd03.prod.outlook.com (2a01:111:e400:52a9::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c07545e-34ab-4c17-3c45-08d60d8a18db X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0301MB1571; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB1571; 3:JALAq0nJFJmsx+XnA+bRySjdqSm9wFBJowbf7koxHe+R5XQbhxPR+cHNGcOtpZe6RyYdkkrvgNHiaOIihOuW3yDWJBzivGc0CwTcgL0aISwc10PuW+ydcKm1sTJMzAgtJFQgWlwTpXpD0/4CFCobvYuY6E2axc22+eqDwzChtrULECF3hx7svD7JGgQze+XunS7hWANoKCnOJZGvpj+TrxDWdne1QwaqnV2cxMSTJvhZ2JdqnVV+GkHWbNMahlcR; 25:MKzkG86o01JVckeRJ7Oo94+5t08S3m2JAsg8IuZTvR73ns77uH2luSg7+nkBBV5AlOu6rcyI+XmX/b6U3mKikdnMEPRIq9ziP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Em3J7e; 4:TOZFexnI+z2Q2yhNlQtfnAcigjfK8GO0XkWSPKYJsWPi+n3acwN/t8j148s+d2ofmqLTG4+JXYQUwFiY0JptbqFym45OgJ9gVWdM+F2QnA3olGeCtTGWV7qIXtRg2mVn7HD/vviHoLCELijFflYKeTY9qiUWdfrnxqM+FZW+ywCDu6qpsgWfJTmvSydnGtZGsS2IbWJV9jyZ9CZmxJV9vc1zTjVApQIomU1jpiCow9snf5onGw0cK0MzxADLvUmW4iGJ8LzvdPNHDTTIkSBBNQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699016); SRVR:BLUPR0301MB1571; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0301MB1571; X-Forefront-PRVS: 077929D941 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(136003)(39860400002)(346002)(396003)(376002)(199004)(189003)(8676002)(55016002)(105586002)(68736007)(106356001)(14444005)(305945005)(7736002)(72206003)(4326008)(25786009)(478600001)(2906002)(9686003)(33896004)(97736004)(52116002)(7696005)(76176011)(1076002)(110136005)(54906003)(53936002)(316002)(23726003)(86362001)(6506007)(386003)(476003)(3846002)(6116002)(8936002)(47776003)(8746002)(66066001)(26005)(486006)(81166006)(81156014)(186003)(446003)(16526019)(956004)(6666003)(50226002)(5660300001)(50466002)(11346002)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB1571; H:xhacker.debian; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-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FLixgO9m1k4rIVTgDuEG4DTcDIJnEBLXC6pdUA==; 5:980CC0cHHGJQverQ6kpbqKqT5v66YJI/XXTPcZX+koPDuvbG5PfVeFT/axmZk2HG47hqa3xO3tDIPRFnaZ0Og3myuxuKaXuR28JsCH3TswnaLIbelwwVbD/AhWCO+2EMwmXRTgoLJbEblV4fyYXAYWKzE76ihdJKvMVJxkRVioo=; 7:PaWb3tum8ocHyVuE6qTM+sPuL+XtG5KgvGXWNQBgSuX9z3756qa9stHXJdL+K/5UD6NGDMoGViTwexsMbB50f3q694q796o2Hv42WLwWdHPXBQqrDvvZyK9bcu9jApI3GgAyU6bECB1AWHNaV+2vFflx7FDIgy6IL+MOp4I1zTXjoGny9VyoStGi3XWXpDtrjig+rOAg/RAFon04AFoB4XVefEN4TPVYhWKGNeWjRzaQnrXi3PdEDEKWUYSBNs3m SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2018 08:33:26.4734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c07545e-34ab-4c17-3c45-08d60d8a18db X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0301MB1571 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180829_013344_247166_A548D153 X-CRM114-Status: UNSURE ( 8.83 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Gregory CLEMENT , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andrew Lunn Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In the loop of mvneta_tx_done_gbe(), we call the smp_processor_id() each time, move the call out of the loop to optimize the code a bit. Before the patch, the loop looks like(under arm64): ldr x1, [x29,#120] ... ldr w24, [x1,#36] ... bl 0 <_raw_spin_lock> str w24, [x27,#132] ... After the patch, the loop looks like(under arm64): ... bl 0 <_raw_spin_lock> str w23, [x28,#132] ... where w23 is loaded so be ready before the loop. From another side, mvneta_tx_done_gbe() is called from mvneta_poll() which is in non-preemptible context, so it's safe to call the smp_processor_id() function once. Signed-off-by: Jisheng Zhang Reviewed-by: Gregory CLEMENT --- drivers/net/ethernet/marvell/mvneta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 7d98f7828a30..62e81e267e13 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -2507,12 +2507,13 @@ static void mvneta_tx_done_gbe(struct mvneta_port *pp, u32 cause_tx_done) { struct mvneta_tx_queue *txq; struct netdev_queue *nq; + int cpu = smp_processor_id(); while (cause_tx_done) { txq = mvneta_tx_done_policy(pp, cause_tx_done); nq = netdev_get_tx_queue(pp->dev, txq->id); - __netif_tx_lock(nq, smp_processor_id()); + __netif_tx_lock(nq, cpu); if (txq->count) mvneta_txq_done(pp, txq);