From patchwork Fri Aug 31 08:11:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10583305 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 79AB213AC for ; Fri, 31 Aug 2018 08:15:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6881F2B9C7 for ; Fri, 31 Aug 2018 08:15:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A7B72B9CE; Fri, 31 Aug 2018 08:15:03 +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 D5EAE2B9C7 for ; Fri, 31 Aug 2018 08:15:01 +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=efGUH4FTAFHi+ZLP2gE3pgQJryiY5RLdz2o4zC9H00U=; b=DEKWcqMOgZe4IM H1ovBbK1JLKfHxt+OK2AHcOc8RJqRrWn+AldzJSaAGAQuguiqD/iQsYPqGyQ4ToCEqsuX06/5UaNe x6IjOYFf7dWdZ8qt+gPMsaGbOrmoNpKwYbWC44A9pLaRE7SXnikhBhySqZ/wfTc2JLnDGd73WGCeK pW8CiRyUfF1EOryPcl70O5rQkmJOvwXcawz5VhVC4dfzaGtqBjiz3R6NkhXxYvCJgX1Wk4O249Ej8 x8jq4PPcerZvmXcGcgHd3D/7dDPJl/D1c7UMkG6PfXixLnRceYCdoUke+dnQ7jUTymNbl48QRboNz O9x6Es+uRw8VREnvOZoA==; 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 1fveZx-0005Lz-3Q; Fri, 31 Aug 2018 08:14:53 +0000 Received: from mail-eopbgr680044.outbound.protection.outlook.com ([40.107.68.44] helo=NAM04-BN3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fveZe-0005Cg-KH for linux-arm-kernel@lists.infradead.org; Fri, 31 Aug 2018 08:14:50 +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=HFn8rgeC1vgsMFnOwppdlgQ10jgxRC9rr9awKFyZhsY=; b=QDubzUykpuixDTLy9EnPBdNntAjUGoiRsflkbUFdA8N1FvD6lftZmEuAAoMOYMV4YRRR9sIKC+Ik5ycUkVU9u7VQT5o2xdxHE6FBwLLzgFbaWGhQafXV4QOsA5ebzSMW49eLi0u6gm4l43buRnBHXFqk//8NNmvdsyDIMu5T57o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by CY1PR0301MB1578.namprd03.prod.outlook.com (2a01:111:e400:529c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.15; Fri, 31 Aug 2018 08:14:18 +0000 Date: Fri, 31 Aug 2018 16:11:09 +0800 From: Jisheng Zhang To: , "David S. Miller" , Andrew Lunn , Gregory CLEMENT Subject: [PATCH net-next v2 3/3] net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe Message-ID: <20180831161109.23db0901@xhacker.debian> In-Reply-To: <20180831160810.2539ef4c@xhacker.debian> References: <20180831160810.2539ef4c@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: OSAPR01CA0172.jpnprd01.prod.outlook.com (2603:1096:604:c::16) To CY1PR0301MB1578.namprd03.prod.outlook.com (2a01:111:e400:529c::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84e9e948-e200-42f3-c6dd-08d60f19c0f2 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:CY1PR0301MB1578; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 3:DlIc0YFZsDBMpbAsB8g6yqNuREw2NFjhpWSAl5bdtA4Etcqj7eDgaPfBwbscFeJ/muoXt6ovSB9jdclISOyVMuzSXjtn1gUOfy6hYgbCmnFTEWL+szWRmYbFoSxzb6a7D37iDDVhK6Xn1sMYJlGTiBoEYr5j2nuYeUeTBEJWPFUyc4IjYxyw/BoWPKgt97J9s55DCA3msGnlVaLrJEQKWQYVLi31sxWunyT7jVHdX+UQ6vHfIwZPn83on85o6Is6; 25:6EeIkQbBa6aEkXuBrUGCpcMo4iNtqvGMTxW6eGPIxROLYMmz/qafDpFCEsZ2HxkP6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MZXcVhBTAR3eWcpX; 4:OzAhYZvf0dhQONxrdgtlosHxCsgyimCW8yW8JVIkVT4wahILwr3a5BhiNzHbU3zFjHNNoUqfitaqt8dNcGrlEbBC+xSSQ+nmsvbOl+bDz4LMohkrJ8Rrr+O40fXhgjHRhKNb6ixnM+tQQzxDavhCVg2HvjhCAOTVzPXSmYqPVFoXN4enhYTe5zsH9q/D40L6RvhHDINucUboA9auIxEmr5/UeHX9mYNKTL3bD20Z+ndgvWeR90Mvvc7DPg6FykSM+7KddznZFLRnpTPYLoTb2A== 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)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699016); SRVR:CY1PR0301MB1578; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1578; X-Forefront-PRVS: 07817FCC2D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(396003)(39850400004)(376002)(346002)(366004)(189003)(199004)(53936002)(55016002)(956004)(476003)(11346002)(9686003)(486006)(386003)(47776003)(106356001)(105586002)(97736004)(7736002)(6506007)(66066001)(4326008)(33896004)(81166006)(25786009)(5660300001)(2906002)(8936002)(26005)(50226002)(81156014)(8746002)(72206003)(14444005)(16526019)(316002)(1076002)(7696005)(52116002)(50466002)(110136005)(6116002)(6666003)(3846002)(86362001)(23726003)(186003)(68736007)(76176011)(8676002)(305945005)(446003)(478600001)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1578; H:xhacker.debian; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender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80HL/yHd6u10YSHhpRz6Ee418WqUustyiwIduykp0Ru0g2EtAKaxpQEpSN5c6Nkhp1ufMnyputR+geE7yQFz8ITu5e9pt0it83T4yUovQ+lPb+fNneYNGtTy1r4erePzDjPuYrEtczgoDRFYnB6okRgnWwUXkq+nlpQTVFU1fYTyDtjrz/Uc5OXG27rq3raB9hB7xoN9wnfOK4gw== X-Microsoft-Antispam-Message-Info: YmczNd/kPny1tyzI7ZPOzgdnKa0XZNP+CIYe+3TNVyde3t54KNUzO7gk9wBkkOjx7wTMkT5B4HQea/HzzaiL14xxmVVA82OJIpXziiuKjIIFxQMgg5z4RjrZmbtbFApMTnWnRClHWb08MzFuMT79hW+trRtEDPMqltrtha5z9OohDH8UKLaktOagYO9snPO7hculXTgo26PcBye9o8Ju8EXYI0+/DXJczj/Cn7buoyEf8ViAIDlgHjLUoO1UBwLCctqVGPxhXy6Q+8N+XX6+op6CN8eEHguP8eHyIZ9rw+oJME2YSTMFcwQmE803U/R8beoIStCEF+Lc0X0+Xyq27ao3IjrtgJTvQGXMIAmWbmY= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 6:1TWmNJl9r+pd4wq1xhgsk+CPMhEu14DquXEWazO5BJu/QLbTTWnp8E3rMDTVNICyyCP6Cok1rPvzIA4sUihggMUY1XgBw50E92pM34XrcKk85wLmmKGLp04MZsEpnfB1inE/BKGTnC/uDHQAMNGi6bHNQ5fI4TijzzCjYDz3aSvUEUexjqq/b7Y8jqj8bF0ogaBxtA7Ch5NikB3POELHTCzveRgBnZBqdiaI299kYkNipEmCxMGShYcL63v7cNDnC2Mw6vpWwe/Ff4lXG/Y8votEcHb+AzNtP3+yXt24+nEWxhO7zjxq7cn1q+PxHnX9crKQldmlM4rt5Lm8ev/asysI6E/9KHq5TS4pDscYd11bC9j1i87y/GzXeN2jiFg6vXLA3fmRZJ6M7pfA++Ey9ll54ZWbS1ACuZMRwFO01+vY24lBQDk19RY1Y/ha0qlUYh37ZCWplpKv6FU25CGtnQ==; 5:Cz5Y4dXF/dYszrqLNWHPL9KJzX0oOIYhMgexryvALdI66obvRqwX8bseHmnosLtSr5qTpwcJPNnZvZf1XdnW3tYXPm9SyYK3ghTlyz7192eg+/N25BRz/s+QbrblZqLXxXVpJpT/dnsXLMmDNuLpZ79Jy33ysveUeiZWCOTSa28=; 7:AsyznVvcqC34oIP3abXiuLAuU2+Url+EGL1mJ6eDK1vqiOgt1tNt7IY4t5BdDhIWgqfNa6CviYOzO6Qp5IRhKOpQh3f18sEyqozGdIytnyDgOH1bgaZ62NOgKtaHo61iwqDLPbFQzDmknKlgS/J/XQi8Ucosw3dHQwZ6SBMT22gsZjfd0IQ0dyAA17iXkiBxZf+woDr7R8vS6XkhiFtlm02vxD0BOMpMZ338BvUnrW4vZWyEd+sOgppYm2zQH3hj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2018 08:14:18.5692 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84e9e948-e200-42f3-c6dd-08d60f19c0f2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1578 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180831_011434_822519_5849224D X-CRM114-Status: UNSURE ( 9.51 ) 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, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 bcd20ebb2ebd..fe3edb3c2bf4 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);