From patchwork Fri Dec 10 19:35:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yannick Vignon X-Patchwork-Id: 12670899 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F270C433FE for ; Fri, 10 Dec 2021 19:56:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229736AbhLJUAb (ORCPT ); Fri, 10 Dec 2021 15:00:31 -0500 Received: from mail-am6eur05on2051.outbound.protection.outlook.com ([40.107.22.51]:17409 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S243533AbhLJUAa (ORCPT ); Fri, 10 Dec 2021 15:00:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L+7KPfolRG62C69aFBesIR2ye+IUYeQXjKOode/wB7Q3+tnoywQeJjPAIjVIBggRS/8STwY+7goarzcPUgXFgDIQ/OkrjGoCS3ZLtn4k0Ki8gougj1rwj3h5Kyc7vsOsv/fdQH/Bei+34CUs7OoyXZaXZYPKN0HX0LFhQDBa+oGH1F6sGacOwmXq9HIuMBY1ymyAgzcK5sdUA1N1e3CjEoia+wZK3g4miuwuGVfuHkK5MthOLMitMsnvU/5LZmcwQC9pqm2ppv3zyKmnwQoa4v9lSCYvRXRxYuqrAUAtC99GhEsJYqdG0QRCpRDyqjt+BQiZDMgVlxFCZJKrZdKE8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7dFiGDMGs5F5cassm7niXUFHzYDlU8RiOfoHPNyOdac=; b=J237X0IcvtWi8oRKVN8VKoBhjBsMtzi2qpXmAqDRTejQ/0z5QgQL1L3KVkeFDIleBNwx1FZKlUEzhxX2kPhC0Ek8xLjCAZsxRi+qkK1wH7HCB2MsTwLbYYIYW4m8e5NGLcvL5PdBXUmoFpUVFhCv2EIPBjraiDjmlgq6D4coY/tjvmzw2tj/DLGw5L7KMwiV2zShmDU+N9KwjQ0pCM/Kp1qn6k/UbyhNyHoyySldfImvRV3S/Vbh8IbZv7wlT0vDR9YzWMWNMWRHukIw2Eb9clrVket8HsQGPHqxUTcGJ1axaRxeHC67HhRzXSu6iRMMmlIvdNjNMCQkCxi0AD26oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7dFiGDMGs5F5cassm7niXUFHzYDlU8RiOfoHPNyOdac=; b=F11R/rY/ttwusmj4U595t0bdNNQQ48qQ/qBoouA7ZWx1uluxJAdtlTXeW7o2Op7X8DXXv6C+ckKNqq9r55lrH1klzk8zA5Yju446Pf8EmE91WCqWlbUaIAgCmRkyhs1YuODNgKuCyVHb/hskOmqvV3vmHFIgDPqR93kgKTxCcME= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) by DU2PR04MB8887.eurprd04.prod.outlook.com (2603:10a6:10:2e2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.20; Fri, 10 Dec 2021 19:56:47 +0000 Received: from DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115]) by DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115%6]) with mapi id 15.20.4755.022; Fri, 10 Dec 2021 19:56:47 +0000 From: Yannick Vignon To: Giuseppe Cavallaro , Alexandre Torgue , netdev@vger.kernel.org, Ong Boon Leong , "David S. Miller" , Jakub Kicinski , Jose Abreu , Eric Dumazet , Wei Wang , Alexander Lobakin , Vladimir Oltean , Xiaoliang Yang , mingkai.hu@nxp.com, Joakim Zhang , sebastien.laveze@nxp.com Cc: Yannick Vignon Subject: [RFC net-next 1/4] net: napi threaded: remove unnecessary locking Date: Fri, 10 Dec 2021 20:35:53 +0100 Message-Id: <20211210193556.1349090-2-yannick.vignon@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210193556.1349090-1-yannick.vignon@oss.nxp.com> References: <20211210193556.1349090-1-yannick.vignon@oss.nxp.com> X-ClientProxiedBy: AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) To DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sopdpuats09.ea.freescale.net (81.1.10.98) by AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=) via Frontend Transport; Fri, 10 Dec 2021 19:56:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2f7dc36-2d0b-4470-a75c-08d9bc1732ae X-MS-TrafficTypeDiagnostic: DU2PR04MB8887:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AAp/NsxA81xwkEicc+O5W9CE2NAKA3V/OHk2W3lhPdT0u15bqUfa0F1pHsrd2CaaMkqHTJWT51LoPYGIEW+l1n/uBw54GdB+n8u3N64lUb38TngdxupxacDo5C+Au4xPim/H/9/EWDPrS6V+ocCiZAUdf1btfJzcFwfwmhpdt3ozmnR+nN2swgSvvb47C16p4x/yVZSMBVhwSVxD9ob9FGrTDp1roJFTP0FAL7ajUNsRftYK7E7Rhr9JoU8LD533N9bCqlYrZXRhzzU9V63zcZ5BdMp4ETsVyKGCqX/7YAQKPMEhX5X9f66AWD/6noiJjpDNrAA/ZHuRGHGOLorp7gfHMpksGs8tEOfpHm/SNMy1qXF6iHSjC44A5AXaJxezyrq6mdezWJjgFg/gA9S62N/wOBNSbArkPmUaaQYyZv5t/wuIS5uwl5S1NFylzxRm+1aJ1GNRn+V/eun/e7JMy8FnD68X8F/hIcvIXegMgM6ff5XCc25Ta4YlFc68NmltwTsgxOBu35+zwQWPqsbnKlcw1ikt5XFo6L3p03PW1no/OuDHUj0SALzSpkmJyxaqM9sWeXw2x4gelArttRJUBkp/QDS737XhjFe+3iHIAkE2Rms3maDHGs4q5q7+QKlr0iC9HtTWF/C39w+C55EsKDlLZRnDRHtlPqs9f5vR0n6kfduZRpSJjwLgV3rRkKCGE1RbwgU2AZKP1koNVLJL8fuGj8avOfAaBwjDfuLYDes= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8807.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(44832011)(316002)(186003)(6512007)(110136005)(921005)(38100700002)(1076003)(6506007)(8676002)(5660300002)(8936002)(6666004)(66476007)(52116002)(83380400001)(66556008)(66946007)(86362001)(508600001)(6486002)(26005)(2906002)(2616005)(7416002)(38350700002)(956004);DIR:OUT;S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sVu6pjKfTgvELcYUSybklu2w9w01pX5WF/ZBmMlnJzYJc23NCa+kUaxU+MzXnuB6ZeJU71qmnXyP0V4IYd1icdgA/fyGA9D4W6eiyxEhiabpw08mn7iMzeaYM7PE1Uq5VrutsgkRRZeyrJ0NgwSpWxcNesrFItgerLwu1C5bYMUEOJ+3H27+S71h+Pu6SlEzNGXXqbSXmj5/5Xc/ZryRdcupHDlxz7ivCsaYE02OKyP7+NAOkajqcMKksJrfxlw/M0qSQ5ifxmlTbdkeSvfEyudMuMHZzq++8v9ILCjPSGTk+yKw0OSTYhvRAo2+9wb9Zr3EfYjcdGXy5N0dt0nUWRHeJgRdRstdx1OH9mXX7R1LIr/PjxoxMUnmhDZj9dt3vGxxSEmC9GJ9eBEYVAvZYniHBuS96GXORXmvT2kY8UL4U1QhpWj5uK9ILApk4HVbpFiYUwph8MzVvW1ZVbilHHx+2rEW/XQh8Gp5u6D3k0LxWrIpq8NC6Wqbrh6bY7oAVDqnpB00R6xlsC9TCyxveUlIqLY1Y98WlVWWi2LKjPfhvboPnw0ROg11e3s+T8k74TF4f4ZWZBhHvQDaXcGNRY+EoiS4FMxQDvN8Z1vHzxifF8= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2f7dc36-2d0b-4470-a75c-08d9bc1732ae X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8807.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2021 19:56:47.2014 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: w1jjZLscxr2XVFyiNPwLo9sjNC8g44bIF+upmpcopvpfEBwPtF0HXzafee7f6k3qcY4TSQJrA6UBpfGodCRI9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8887 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC From: Yannick Vignon NAPI polling is normally protected by local_bh_disable()/local_bh_enable() calls, to avoid that code from being executed concurrently due to the softirq design. When NAPI instances are assigned their own dedicated kernel thread however, that concurrent code execution can no longer happen. Removing the lock helps lower latencies when handling real-time traffic (whose processing could still be delayed because of on-going processing of best-effort traffic), and should also have a positive effect on overall performance. Signed-off-by: Yannick Vignon --- net/core/dev.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 15ac064b5562..e35d90e70c75 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -7131,13 +7131,11 @@ static int napi_threaded_poll(void *data) for (;;) { bool repoll = false; - local_bh_disable(); have = netpoll_poll_lock(napi); __napi_poll(napi, &repoll); netpoll_poll_unlock(have); - local_bh_enable(); if (!repoll) break; From patchwork Fri Dec 10 19:35:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yannick Vignon X-Patchwork-Id: 12670901 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4B1AC433EF for ; Fri, 10 Dec 2021 19:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243419AbhLJUAc (ORCPT ); Fri, 10 Dec 2021 15:00:32 -0500 Received: from mail-am6eur05on2051.outbound.protection.outlook.com ([40.107.22.51]:17409 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234616AbhLJUAb (ORCPT ); Fri, 10 Dec 2021 15:00:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UkWnedRJh0zcLCL1IPm0deTFlhf21dJQyppXv0rV6lWtXAjKr1F302/F7C97Rc+0ixKqNyhzen7//mRrbFK5NRUIsRRTN+hgtXwNutWDH8ocl8//PhOMYyXRV5OuXHlByHaH6RzoW04uLjD5GQznuZFZ4VfWw9go7z+tflG+dwDiMz35AeV4HSdgiK1cvyMnphziKZjS6eTi7jH6/tuv0L8rvKXFP0CDn6KDMtI2hbKe3Kez2LqxiPK4kHw7UOhmXf6pwjIHcgCmejPi6anWNuADRjAtu7fXICEvdyU4los9KuUGR39sTL+svMjMDrDE9y11t6qY4xmVOPUtznuBQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=l2EWqiBiCKXySpNbmTT9rqOx4cy2Yp09CWqKbEhp8bg=; b=JpyIizXBUElOeQKCdgHLxvCwlUttyMXMdKOcYu6HqAEtbSWtM8mdRsd0q/q992Qd7SkzNJ5jNGeZahocsQ1Mm0ylXuHx0cDsdMetgyeQBX2gT694Od5MKJ0gAv8ZrUflla3jcgBtlqRIhgYQ238Tw/Jid8tREbC/qLlNWr35et2BVJaqo+Y0/0XgSPhFCeGeK79BBEuQE99hBmgyKWNJW0pusRPTBS/k2YOh+hs2gQJmxV+fPouHz+E0MnkQPKPGI2zVpY/PgRtCBIGZkjPEex5GqwKrBkiW4u+HldIjEhQilIW1q/17j/Uk9EMmsl9P7ZEYD6IPsfvGNv9bdlbSkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l2EWqiBiCKXySpNbmTT9rqOx4cy2Yp09CWqKbEhp8bg=; b=k7yut7TDHg1dBqbztPoz8tjizDbqhkI5C0Y//un9GDqQo0N7IDeIVnSUlfXufiGU1neq57Oq/+Ylk+FuqmY4y6nUlp4a9LDA9GEjSlH/1LThIBaNno/ycM4jqa1ljdiCYvcqcbFB7epwPyuSwi/oPbvzEh6EIamw2V9LQ3z1ffs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) by DU2PR04MB8887.eurprd04.prod.outlook.com (2603:10a6:10:2e2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.20; Fri, 10 Dec 2021 19:56:48 +0000 Received: from DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115]) by DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115%6]) with mapi id 15.20.4755.022; Fri, 10 Dec 2021 19:56:48 +0000 From: Yannick Vignon To: Giuseppe Cavallaro , Alexandre Torgue , netdev@vger.kernel.org, Ong Boon Leong , "David S. Miller" , Jakub Kicinski , Jose Abreu , Eric Dumazet , Wei Wang , Alexander Lobakin , Vladimir Oltean , Xiaoliang Yang , mingkai.hu@nxp.com, Joakim Zhang , sebastien.laveze@nxp.com Cc: Yannick Vignon Subject: [RFC net-next 2/4] net: stmmac: move to threaded IRQ Date: Fri, 10 Dec 2021 20:35:54 +0100 Message-Id: <20211210193556.1349090-3-yannick.vignon@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210193556.1349090-1-yannick.vignon@oss.nxp.com> References: <20211210193556.1349090-1-yannick.vignon@oss.nxp.com> X-ClientProxiedBy: AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) To DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sopdpuats09.ea.freescale.net (81.1.10.98) by AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=) via Frontend Transport; Fri, 10 Dec 2021 19:56:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e68ee64-898a-45d1-59bd-08d9bc173364 X-MS-TrafficTypeDiagnostic: DU2PR04MB8887:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fiSp1nRc28/61Nv+EljxBvdBUwyzdtbV0fQrR+qavymw4bhHQwVEw1M5xBk5OeTICLikhdRyb/ql/hXOcVFrZx0fxacn06ympiI+4YISQzUKcGVSnnSeZGnauAoBLrU+Eh5bK6W4VGWc1ZZFmh/e2kcSBrmfP9tjAlZ0pNTLf4SXyNFUTbwqg3zKRSF2GpzVd9rOn3wzHNmSs5KCWJJkcX80QX0Hzbg1Z0hw2qeUpoQjO5JwkMT98mZQjIf5vw2osqBB8XGzd/N4D73wV3+nqrswJMwsAOYUjWkdF7KZKNCznw3C1FnAgkhF+0tO8bwExv2zBNUXTDFnokbbAADLhFC2lPgykW/mKu1n8Ran8nMljU1zqZfrhok7SbY3h/xjdQtHpJR95hVMNQZ4GO+P/NUjK13djp2aDUfrK9E0agZuM+OentWNNs2EjtKaB+m4w+sCH8fj1dFMjT2C/xVQG5/GVTkSlxaidITiSsVf3Nx7WR8KP7mNGTVlbfFuHw61PmuW5w+xTc8ngdgrV5Uz3OoOyW814TVn37sHOiFVACuseqRb6bCI5BIj6PzQZyU1jatjk5QQVR6Vb21XvsoxufoE9VMBGXukdteH9JOvW8GL1GO019b6l66dGJDD+AnEqESqc7dclIfJHuHcaoEmnzhHCT90aGGrdfSCVJPpre1W4SMX2qmwGB5E4pYH/xdR9ACD3Lws+/+ezDGskcGUqfvpuWZs4XSiZLCDcsrtVis= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8807.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(44832011)(316002)(186003)(6512007)(110136005)(921005)(38100700002)(1076003)(6506007)(8676002)(5660300002)(8936002)(6666004)(66476007)(52116002)(83380400001)(66556008)(66946007)(86362001)(508600001)(6486002)(26005)(2906002)(2616005)(7416002)(38350700002)(956004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3h/mh8IF8zU5Nbh4GL7sUYwP3diq/URouMowhJF2atjxciLBLQfyn3Shw7JuoazfNuWjUWd7/T12hjuIlUszKyelC4VnE9tHKXGubZjivQyqV7h2CZoQ/ZrIl/QZJc1V4GKt69Ntg9QfUA9IYEt/HsW6RTKQdjyOwI7INQO9N+9K+mT59zqTnFyUmjpmFT2cmFMYXoaiTmJNpqFp9W6OcHdlobBS8I95ajJOzl+wzkxtVingHopjNE/qj8KiiIIzz3F6W8U4u5UT8X3IWI7aI2K8tLK4ByDWIE9CdENxRNmLWBUgyC/LYewpfpUz+SvdOOl1rsZxwzpmVkd/HyPYYI3FXQM2ZbaC/6WTGY6MDKBIZ5NMtZmmCsq8xbY6+R7Hz+uSng2hAJwpwS61eAJaJynRsQIEand2vj247YFWdJrIReD4VmhvmxbYtaVpQZ8XH5+Gu94f3N8TNlVecZTS8PR4B96kHj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+SgWH68qv/tsC1eNZ8PKPNHrQlgFBCJabgW029VKsErT5xX6Np4yf4PyltYNiUAIyn+47vqWLztD4= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e68ee64-898a-45d1-59bd-08d9bc173364 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8807.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2021 19:56:48.3334 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l2D1HYD4fz6TFkSZeOalWhIi8ouxQGgNE//kVnxMXpJkJxTRzbm2EjoAVnzta1jp47LLvmtsCMNIiGJCmPGAng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8887 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC From: Yannick Vignon WIP (seems to generate warnings/error on startup) When an IRQ is forced threaded, execution of the handler remains protected by local_bh_disable()/local_bh_enable() calls to keep the semantics of the IRQ context and avoid deadlocks. However, this also creates a contention point where a higher prio interrupt handler gets blocked by a lower prio task already holding the lock. Even though priority inheritance kicks in in such a case, the lower prio task can still execute for an indefinite time. Move the stmmac interrupts to be explicitely threaded, so that high priority traffic can be processed without delay even if another piece of code was already running with BH disabled. Signed-off-by: Yannick Vignon --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 748195697e5a..8bf24902be3c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3460,8 +3460,8 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) /* For common interrupt */ int_name = priv->int_name_mac; sprintf(int_name, "%s:%s", dev->name, "mac"); - ret = request_irq(dev->irq, stmmac_mac_interrupt, - 0, int_name, dev); + ret = request_threaded_irq(dev->irq, NULL, stmmac_interrupt, + IRQF_ONESHOT, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc mac MSI %d (error: %d)\n", @@ -3476,9 +3476,9 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) { int_name = priv->int_name_wol; sprintf(int_name, "%s:%s", dev->name, "wol"); - ret = request_irq(priv->wol_irq, - stmmac_mac_interrupt, - 0, int_name, dev); + ret = request_threaded_irq(priv->wol_irq, + NULL, stmmac_mac_interrupt, + IRQF_ONESHOT, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc wol MSI %d (error: %d)\n", @@ -3494,9 +3494,9 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) if (priv->lpi_irq > 0 && priv->lpi_irq != dev->irq) { int_name = priv->int_name_lpi; sprintf(int_name, "%s:%s", dev->name, "lpi"); - ret = request_irq(priv->lpi_irq, - stmmac_mac_interrupt, - 0, int_name, dev); + ret = request_threaded_irq(priv->lpi_irq, + NULL, stmmac_mac_interrupt, + IRQF_ONESHOT, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc lpi MSI %d (error: %d)\n", @@ -3605,8 +3605,8 @@ static int stmmac_request_irq_single(struct net_device *dev) enum request_irq_err irq_err; int ret; - ret = request_irq(dev->irq, stmmac_interrupt, - IRQF_SHARED, dev->name, dev); + ret = request_threaded_irq(dev->irq, NULL, stmmac_interrupt, + IRQF_SHARED | IRQF_ONESHOT, dev->name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: ERROR: allocating the IRQ %d (error: %d)\n", @@ -3619,8 +3619,8 @@ static int stmmac_request_irq_single(struct net_device *dev) * is used for WoL */ if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) { - ret = request_irq(priv->wol_irq, stmmac_interrupt, - IRQF_SHARED, dev->name, dev); + ret = request_threaded_irq(priv->wol_irq, NULL, stmmac_interrupt, + IRQF_SHARED | IRQF_ONESHOT, dev->name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: ERROR: allocating the WoL IRQ %d (%d)\n", @@ -3632,8 +3632,8 @@ static int stmmac_request_irq_single(struct net_device *dev) /* Request the IRQ lines */ if (priv->lpi_irq > 0 && priv->lpi_irq != dev->irq) { - ret = request_irq(priv->lpi_irq, stmmac_interrupt, - IRQF_SHARED, dev->name, dev); + ret = request_threaded_irq(priv->lpi_irq, NULL, stmmac_interrupt, + IRQF_SHARED | IRQF_ONESHOT, dev->name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: ERROR: allocating the LPI IRQ %d (%d)\n", From patchwork Fri Dec 10 19:35:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yannick Vignon X-Patchwork-Id: 12670903 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92032C433F5 for ; Fri, 10 Dec 2021 19:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243465AbhLJUAi (ORCPT ); Fri, 10 Dec 2021 15:00:38 -0500 Received: from mail-am6eur05on2051.outbound.protection.outlook.com ([40.107.22.51]:17409 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234222AbhLJUAc (ORCPT ); Fri, 10 Dec 2021 15:00:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M4w2tSQeHvPrw/HiwxscJn9YT1CS8KdLK3iJQz/aoX/STGTChRh5sVYtqyiHouOqvn6Le/MqBhz9Vf/Rq57opLeBpsUb6XY6riNLQk9e9UVGXbwhLflxIBO5zIIHM13MzhObqZSptt0YR7LQ+Da6nY1bJMJG2qrcz4LNk8aIJtMMSFzHjq6mPn8Va8L+DAUHt0ncJiXSwywA4Jk25UHKhdXJbRoC8naltrHEtSGPvsFgVSJghukf98z2pVauggiVdS5l6Q0zb/l1eeVmnqMOfKVVSyV20C+ahG9UgmHTvPb+hGmGe+XZLry8GOc3/GOFMuAksLBQPR8VHH5OcS+cHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lL4poCPnDoQ1PP7iT2r5Imsg0xj9+zBvPZq11ZSQ/fU=; b=MjyHj3KdS5HPwnWUg7rqi122OrovGEtbQ9Gi+hQhHN1u13gH/6yQhokJRWhGpaUadutWC4DGuFi3EalUkgOCVW+jYUmo8g1CAv2Izi82oFaRoboKS7BzTNieopmf2PrIH+ZbpHAYBoVjoX7IZOLEnj2Q0ndSC7spKXGxC9/ltRlc6lO9p6vViaGeoThN+FPpvYUpxwNIyZUshu3kWelHvGZGPK+jziSlormS2xsD9zZ7VWE3zDU9wuFHhAc7MA9f5d+2ASDEkTk5A/lqhaNN1wVTbt/zXwAxosdGKI6r6pTVDSv4kNKFzBwDxHkhNK8U954YV/jI0WQWk7ERghaS1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lL4poCPnDoQ1PP7iT2r5Imsg0xj9+zBvPZq11ZSQ/fU=; b=T64Qbh/oF+2JqWteMr7C36i0yOe0c//qA1Y+rrRRGQ4EfVH9XUI/H7PZucylKSYZY3jHEtjvHtpzi4gXVtaXmnEs8X0+Rc6NSLzCPxfxO4YrtpTSvjbiJnyJK2VstQWHxD1vEKOM2wCCLyflEWJM87t57Ujb21vNXD+v0coN28s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) by DU2PR04MB8887.eurprd04.prod.outlook.com (2603:10a6:10:2e2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.20; Fri, 10 Dec 2021 19:56:49 +0000 Received: from DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115]) by DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115%6]) with mapi id 15.20.4755.022; Fri, 10 Dec 2021 19:56:49 +0000 From: Yannick Vignon To: Giuseppe Cavallaro , Alexandre Torgue , netdev@vger.kernel.org, Ong Boon Leong , "David S. Miller" , Jakub Kicinski , Jose Abreu , Eric Dumazet , Wei Wang , Alexander Lobakin , Vladimir Oltean , Xiaoliang Yang , mingkai.hu@nxp.com, Joakim Zhang , sebastien.laveze@nxp.com Cc: Yannick Vignon Subject: [RFC net-next 3/4] net: stmmac: do not use __netif_tx_lock_bh when in NAPI threaded mode Date: Fri, 10 Dec 2021 20:35:55 +0100 Message-Id: <20211210193556.1349090-4-yannick.vignon@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210193556.1349090-1-yannick.vignon@oss.nxp.com> References: <20211210193556.1349090-1-yannick.vignon@oss.nxp.com> X-ClientProxiedBy: AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) To DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sopdpuats09.ea.freescale.net (81.1.10.98) by AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=) via Frontend Transport; Fri, 10 Dec 2021 19:56:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8d97cdea-65da-44ee-3c5f-08d9bc173411 X-MS-TrafficTypeDiagnostic: DU2PR04MB8887:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1nsFJKtUlCzgKCVLGKkGFZw9+P6Yw21Kj1Se5FO/6mSaTtP3EbdfM0zHj8rMtTR+h/HvgxQJjk7e5esOhCDu6pVTk12nHFQp+hBT9tvV3DhvSpwgVzh/ctPMVaEJiZ5dhoA4n7qDVWXXjuoQyMjbMG6+Cs4uJwiIpLhlrimNsoRaUXV71gNGGLb7bK7vNkWGLjty+6AkXh16HO0ZdQcQs/AC4mEyvur/uR81UqkuKrnTvz6NPRFSIL+wtIHNHSihjJhZuS9uBrtRfUo1toiayFSRek2RkjB6qIvK/9pnEsu4rbfYoDhv3N91HckF8WrV93RnJi75JgqCil40heuqfTnqf2c0iL+wAuFTjC6Fw6wNoP1JeOKyeD9KI30O+QfxPkldrGGGW7iBsm6jP3WjQqWrFe/pczdE6SZjq0VtPK5Hvmna2NGss+3mAue5vNiSR9ItxZ7hBMZLSLT8VY+gw0gWWu0Uo7TM0V/iXdle+3sK9HrWVEVJPXO2fjkX2oY3H7La6WNODP+ymrB9K+qn/D5M8WOGg2byM07fCIu3GwelbbuOO8CcGRoPWXEaYpnTRVHiiNk6jcUlAE/Is2gnwzHiWIdUyLXHFXaLyHksWRTPsWZrr5zxDdV7/3f1EmCMrCOcBmToSLRogEY9LL5NDrKclJAxe6MOKG223dn46RDtYfc5pZYky8hbZ44dhuetLzqu/UA26hhk1mPb6sGiIHMJl0NMpWq0YB+1dThTn9RefwwO87uaa+5dQQQEcKPY X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8807.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(44832011)(316002)(186003)(6512007)(110136005)(921005)(38100700002)(1076003)(6506007)(8676002)(5660300002)(8936002)(6666004)(66476007)(52116002)(83380400001)(66556008)(66946007)(86362001)(508600001)(6486002)(26005)(2906002)(2616005)(7416002)(38350700002)(956004)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bDfVqqSv6XaxuJdNctYbYwiZbZ+cF+A12Ou406W8PGwUaxP+lmNjuSEsFlVbCDpznMi/MsnW0ignoKAU2+L+NkzjLp6SBx0EoXlEBQUtkdlABWxA8pVkKmzkyJSJ69bHJdiwHAjCSOmlTyV186hyW0FQKtpTdLGtGPGfo9FwHq5lLfh76ZavloIFToCRK3DUyXca2d+GQFAstE7GSGZlI1M4a+7quXSxQnfVEsSE27PkT8HbBF44QsR/Wu+lAQtrCAmxn4dIhSjA9lozXbOndmtK5g2VChUPQt4bEZtnzIuhPXukkSuOH6DRJsE7oZ+RfxW+22kRI29rvwEI5Ml56YmtcKwy98zoENitXGEC1JlWAMHF3NoCN1DInXi+Zw1kj3PEIDbEjVxYiQeB07HGyD5GA85wQ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COj9Jklw/6iMU0lRTRnrI8kQejYIQnBH2KGvQ53Ae8idbs8au/TBRXZTIlQ2qhpk6s2AXewnvC5GL6DGUpWH9r9XBg9hAnv+WtJ7AVMORSd/9SMRukWQug6gp/vI3V8Pw4g4IBzu9OoMaPCefsj5gcWbqK6zUac6hRNPJELC5Y= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d97cdea-65da-44ee-3c5f-08d9bc173411 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8807.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2021 19:56:49.4734 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s63sFZ8XTtBLgeAvssIOghK/v0s/N0IROfcDaqK2K1ETD92JitfLYnAwNqHhl0sa5KMmYNNQREOY/I1h5HHjsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8887 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC From: Yannick Vignon In threaded mode, a NAPI instance can not execute concurrently in a separate context but only in its assigned kernel thread. Replace the calls to __netif_tx_lock_bh/__netif_tx_unlock_bh by their non-bh version to avoid disabling BH in that case. This prevents high priority traffic from being blocked by another piece of code already running with BH disabled. Signed-off-by: Yannick Vignon --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8bf24902be3c..2190b40fa92e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2481,13 +2481,16 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) * @queue: TX queue index * Description: it reclaims the transmit resources after transmission completes. */ -static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue) +static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue, bool is_threaded) { struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue]; unsigned int bytes_compl = 0, pkts_compl = 0; unsigned int entry, xmits = 0, count = 0; - __netif_tx_lock_bh(netdev_get_tx_queue(priv->dev, queue)); + if (is_threaded) + __netif_tx_lock(netdev_get_tx_queue(priv->dev, queue), smp_processor_id()); + else + __netif_tx_lock_bh(netdev_get_tx_queue(priv->dev, queue)); priv->xstats.tx_clean++; @@ -2646,7 +2649,10 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue) STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]), HRTIMER_MODE_REL); - __netif_tx_unlock_bh(netdev_get_tx_queue(priv->dev, queue)); + if (is_threaded) + __netif_tx_unlock(netdev_get_tx_queue(priv->dev, queue)); + else + __netif_tx_unlock_bh(netdev_get_tx_queue(priv->dev, queue)); /* Combine decisions from TX clean and XSK TX */ return max(count, xmits); @@ -5377,7 +5383,7 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget) priv->xstats.napi_poll++; - work_done = stmmac_tx_clean(priv, budget, chan); + work_done = stmmac_tx_clean(priv, budget, chan, !!napi->thread); work_done = min(work_done, budget); if (work_done < budget && napi_complete_done(napi, work_done)) { @@ -5401,7 +5407,7 @@ static int stmmac_napi_poll_rxtx(struct napi_struct *napi, int budget) priv->xstats.napi_poll++; - tx_done = stmmac_tx_clean(priv, budget, chan); + tx_done = stmmac_tx_clean(priv, budget, chan, !!napi->thread); tx_done = min(tx_done, budget); rx_done = stmmac_rx_zc(priv, budget, chan); From patchwork Fri Dec 10 19:35:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yannick Vignon X-Patchwork-Id: 12670905 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20E15C433EF for ; Fri, 10 Dec 2021 19:57:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243533AbhLJUAk (ORCPT ); Fri, 10 Dec 2021 15:00:40 -0500 Received: from mail-am6eur05on2051.outbound.protection.outlook.com ([40.107.22.51]:17409 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S243387AbhLJUAi (ORCPT ); Fri, 10 Dec 2021 15:00:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KP3K+7+GYxSTy8L6eumKQq0N96KJ0e/fTewEaHCem4Fahto3K3UWy2xd8kdl/oCliQ4kIqXqLCWiMWwXF7hT3K487Pe/MXnrgWQocyXyPWt3LNhHBIyMqJIA2YgAnTD57muEsCsJ3hKNqNbe4YWa9A5Jm8rRhR1eM3DkTJQVBYZoZV+Z3QK8wP4KJnrGw00RNdDFjUUzQb0ogc5pjgqDsuyiE9AtHNDt0NPefgEomlGDgjR49pRJPw4XsbRyD91qCgDQvSa2BJON13/pVEjubnRaDrJvw38EiimFPKtdHQqRdi6m+qEjGxUFG4aopwxZkwHlkmfJFjwbQocX+SEb7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ll0NpqBhyMYSxfad/ZPtqYdVsQQTgZY55WQtDBbPeGo=; b=TqZgmj+pQfoP23EiluSItnX1kq6Oix9ZnQatEK29Sreduu5inJkKUjMrIaJLh/+DBD0NY7GFbEbAK70f38/kjn7V65h4Xj4fNTC5lJNeu0sE84OWFKv9FLT87yRolLp6t4n6K8Dc5TyKbrfVJP8U1mycEx+lgciCMF/7swFBBwHi6lAsn3TByyz9/YuGhkT792vtHZ/koifKipuwLGOc8oQJ4lhUtmkyNR2ccq2PnVysu7Ma5xZZDIb0WUIvAT/1Y7qirhCdYhzkQ8cN6ZrwGidVWtzzKzJf+1Ep3tiYgOG1CNsc6VFr9WCxQI7ieFP2ReMjiyJHzNdFhJwwsKYD1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ll0NpqBhyMYSxfad/ZPtqYdVsQQTgZY55WQtDBbPeGo=; b=eAfGq7DSIQrKX2nT/Ixa/2/C82Wcpomv+XUgg+Bq3eGDbF4F/y27MIbw7DfJIMEde9nScUnU1/RYM5tFworqyAW85A9fRxlQJqfhA/XZSsYop6cj8M+7eeVwCRE/qgNMV2c/hodBUkh9BFCg4h9n+BWzfz0GEjQ1pb9mafdahCY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) by DU2PR04MB8887.eurprd04.prod.outlook.com (2603:10a6:10:2e2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.20; Fri, 10 Dec 2021 19:56:51 +0000 Received: from DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115]) by DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::59d5:83c8:cb6a:a115%6]) with mapi id 15.20.4755.022; Fri, 10 Dec 2021 19:56:50 +0000 From: Yannick Vignon To: Giuseppe Cavallaro , Alexandre Torgue , netdev@vger.kernel.org, Ong Boon Leong , "David S. Miller" , Jakub Kicinski , Jose Abreu , Eric Dumazet , Wei Wang , Alexander Lobakin , Vladimir Oltean , Xiaoliang Yang , mingkai.hu@nxp.com, Joakim Zhang , sebastien.laveze@nxp.com Cc: Yannick Vignon Subject: [RFC net-next 4/4] net: stmmac: remove unnecessary locking around PTP clock reads Date: Fri, 10 Dec 2021 20:35:56 +0100 Message-Id: <20211210193556.1349090-5-yannick.vignon@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210193556.1349090-1-yannick.vignon@oss.nxp.com> References: <20211210193556.1349090-1-yannick.vignon@oss.nxp.com> X-ClientProxiedBy: AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) To DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sopdpuats09.ea.freescale.net (81.1.10.98) by AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=) via Frontend Transport; Fri, 10 Dec 2021 19:56:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f23ea2c7-fa2d-4deb-4da4-08d9bc1734e0 X-MS-TrafficTypeDiagnostic: DU2PR04MB8887:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HLzHEZkkCTCGC1AK/4KEAZ4poOA+Y/1rS1d8N5waMa/feGF1OCaFi3658iamulOsb2m8H/JbrUv6Q+cZs5s+ELLz78elMGSdhaWX1PWCY/B+0ucSOY90MSlwS5s4miDEVXmNXWgZdbdQp3nMQispbZiI6zIxF9Mf12T0pidTli94vFh234aVgyxEyYNAH6sHaq66ekafxEhV3MZswSq8d1hgtH7L9M4HQAoNdz4YSqYM8tUpMIIKobPYttJi5QgtjVwBKdQ/B0dPnsSd1y1PF6Q3azyjI5FAOBMSHeDFzg1j9XN3DEYJ4NfGCr5kjdOyPsCr9qISKNHofyPbhcHBq4+wUnHFQ5yyxNwlZXs0JqMJTn0o8gKLDVuEcfh0//mgZctZLr3pPfcKtGqlh1t+iNiDDw2rBE+19ToIZeA8T9MevDRc3kNG6XfABit/i0nzCtCBM7CF0eLIaTp0+MDrIR7q1J0W1++KYL//K+9UDRCBLY0i033mQBWvDqPoVNaKzmpfKlztJE/C/9PYGne7Sjier94nzEgAOqm5xR2ZHL0i5aEl4Si0SQ8OtV9urZOsgIAJtWJIwMCGIUIjcdrr92PfgrZps5/IbymuTxVuooS1DHiPlA8LTmJZ8BqeJjOZ7EJfyFzSHiBHaGz63gXikJLijoAY0Z5JPYmO4Anu+4l1KQIT29YmwHelWke/hKwBiM64vOeLUvi3xyIT9W7fHRfUYBpEEWyKrotRyZHI1qg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8807.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(4326008)(44832011)(316002)(186003)(6512007)(110136005)(921005)(38100700002)(1076003)(6506007)(8676002)(5660300002)(8936002)(6666004)(66476007)(52116002)(83380400001)(66556008)(66946007)(86362001)(508600001)(6486002)(26005)(2906002)(2616005)(7416002)(38350700002)(956004);DIR:OUT;SF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OsyBhf85DQuXyBivO2WW7DONOnDdMq5B6oHVQm3elZmRq1l6l8QSvsMtHFkNb2Lt3Xi53ftTtdmXN9+uxdcJZmd12oH3699n4Mx/UEjhj4v1sTrty7iZLVBUio07y5X8wBPbsrHfREfrGSL3Rt8/ziePgFxcq0PBnytM0zVEXXPQcpmuyTqeYvOc5BxtJz1uGlUokvRFBrXQDMVzfaLcKFgbdgMgp497OW/UuB4b3mbZI8OUGpVYbPUsgAsg8RUPvecye8yq2XVR1BhlNuOPuOnvCK2il8fC49D+Bk0gph0ZaKOu/AGm2DOUpWHLEBaVNRGbxrMoPr5rMcDhOcCAMy4XV7xWPaDV3Sli5mCmDB1QZr8pIw8Zfz6UWiIBD2j9fSizEDE9Kt1shHCQt8Vf7FC+a6sjWEUnMVknRgp031KPjk0oGAV2ypHDW8M2N13GHKYeMvdwSR0bq5FL6Kupiqaj0h9hi8+96QMByWX17mMler4+Z88tZBLPlvKlMmkeODC2Ngk7kxj+7Ez4SN8B/l/qng9javfyj3COFvhCC9HEVD74xL6tEEgC6boFuQ15cPuNhc+LJxElMpddNn7hnuXCeVQi61fehTzvm2/J4= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f23ea2c7-fa2d-4deb-4da4-08d9bc1734e0 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8807.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2021 19:56:50.8195 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eKf9PCvgTxcIwphpP74myq0VNbBkAaiLqPHLHzk4Q2bmIMJQkPzNgCEf8T6pS2eRlw0gOE7w1QnyPnbPKs5uXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8887 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC From: Yannick Vignon Reading the PTP clock is a simple operation requiring only 2 register reads, while the time can be set atomically through another set of registers. Under a PREEMPT_RT kernel, protecting the reads by a spin_lock is counter-productive: * if the task is preempted in-between the 2 reads, the return time value could become inconsistent, * if the 2nd task preempting the 1st has a higher prio but needs to read time as well, it will require 2 costly context switches, which will pretty much always be more costly than disabling preemption with a real spin_lock. Remove the unneeded locking around the gettime call. Signed-off-by: Yannick Vignon --- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 580cc035536b..8f0dcac23b1e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -137,9 +137,7 @@ static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts) unsigned long flags; u64 ns = 0; - spin_lock_irqsave(&priv->ptp_lock, flags); stmmac_get_systime(priv, priv->ptpaddr, &ns); - spin_unlock_irqrestore(&priv->ptp_lock, flags); *ts = ns_to_timespec64(ns);