From patchwork Thu Feb 3 18:40:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yannick Vignon X-Patchwork-Id: 12734570 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 C1ED9C433F5 for ; Thu, 3 Feb 2022 19:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353655AbiBCTGj (ORCPT ); Thu, 3 Feb 2022 14:06:39 -0500 Received: from mail-vi1eur05on2069.outbound.protection.outlook.com ([40.107.21.69]:13793 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S244261AbiBCTGi (ORCPT ); Thu, 3 Feb 2022 14:06:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XUtTtck3M0/ZKTYpw39C0tRZK3H3CVcrDCWmnZg9cjUNofPNgYIWQHIB4zOmYpqx6cehW82zicMXITL1pTkK9d057tmJfgloaA3W7x3osxM5YYQ/7b3IIiDCx3Y3J49ndM5UGCkj6WaPkcZAqEYiG0Gm1Yk0TQhx5TWCnG/+k5RmSop9joSu76M0/lyV7f7T8X1lb4KPmF+tiKnCl0leGQWmiC4a2g1LBUbJxIKCKzBukhYLOgx4qsa1snfRTo9eNGjQxZpJ0w3i5uaG9eCGDB4E6yrZVlsJhKsWgnqd/AJr9GhQi9wJ1wiR1fdkjo1gfVP/tUbquEdkFyJZnZ8DAw== 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=FwMz116FrNRLAAoMjPwfPg1k9vajaLJ9snnf0dJLeP0=; b=P7HL8ScW0LJjHPDptWAU2e9Y3kWC4a/iftsvCPVcSoPQstcQ4ND5AH6HgsXiCHIZA3TquDRFraNF9pcvI/kALPAtiPTqbmlKOHgT0KumTYIng0ufbRhKJiaQYzgOPgyHYxvYmPSTosFAnaroSpQZwyzQsawXdZtRIyiocDAvaUfKAgeE1yiqYkTquIuGIMkkbybJG+lRD5NvXqN0E/4MWQe/kLbzR5TZd0zlT8+KHV9hu33cfwnt+/pKkUs1qq5W4hiFtmhOcTedZH6sAmcnoa2lH52bReLidV+Nj0V0w5ij8dFBnMuv1f86wAk1nZpMe0NI+JYgKM67rhc6SDr/hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=FwMz116FrNRLAAoMjPwfPg1k9vajaLJ9snnf0dJLeP0=; b=TMq8wI573hWOGjcBo4G4BMxrkX7zf0xIyFxutzdJl6AGLnv5KLUG+JMORMxPriJwK0TaMqgz7R1g5gvKOoryvsSGlsA0MPrinrYUh2/zpE8iKnn8k6axsn2UYTvI04HA/rwwkFDhZ9Ih/GelUYl4etDszB7GG3KNrUQr8PJgRTs= 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 VI1PR04MB5408.eurprd04.prod.outlook.com (2603:10a6:803:cc::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Thu, 3 Feb 2022 19:06:35 +0000 Received: from DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::9484:131d:7309:bd02]) by DU2PR04MB8807.eurprd04.prod.outlook.com ([fe80::9484:131d:7309:bd02%5]) with mapi id 15.20.4951.012; Thu, 3 Feb 2022 19:06:35 +0000 From: Yannick Vignon To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Maxime Coquelin , Eric Dumazet , Antoine Tenart , Alexander Lobakin , Sebastian Andrzej Siewior , Paolo Abeni , Wei Wang , Kumar Kartikeya Dwivedi , Yunsheng Lin , Arnd Bergmann , netdev@vger.kernel.org, Vladimir Oltean , Xiaoliang Yang , mingkai.hu@nxp.com, Joakim Zhang , sebastien.laveze@nxp.com Cc: Yannick Vignon Subject: [PATCH net-next 2/2] net: stmmac: move to threaded IRQ Date: Thu, 3 Feb 2022 19:40:31 +0100 Message-Id: <20220203184031.1074008-2-yannick.vignon@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220203184031.1074008-1-yannick.vignon@oss.nxp.com> References: <20220203184031.1074008-1-yannick.vignon@oss.nxp.com> X-ClientProxiedBy: AM0PR10CA0070.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::23) To DU2PR04MB8807.eurprd04.prod.outlook.com (2603:10a6:10:2e2::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7f71647d-90b8-4522-ee68-08d9e7484c2c X-MS-TrafficTypeDiagnostic: VI1PR04MB5408:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4upHNy/Udttca1h6JHkRTmOApVk3pCi79Q7QSjDOYY7Gf8lpwvROw4UxaF8SRmLmyW9E/IG8niJJzpNR0JpVQb5GFgDz34oPrWPTdIqGaj2XnWxZwDqgkfKrj1KtDx965ZlvUYdWemyRMCk/t2IzLz6ETO/pa8m+cFK7r+aougfBjTeC2kzUAqiX9wQfL/I20HEcJ2uR4vGDPux8wYuliyqezqCU7Kf3DH40Yv2oU8oLdHMhWUgTUvYGKWzMM/GMdSwNoJvZnqavY/wy5TgYgbmtgstJTL6QWtUjKPU4z7ffHXSx31Yd2Bi1U47VUxf3XHP0thh9VKrNOd0d7IAn2oKkgWz8hy5H/AG7ylBqkR7zu40ch6kHvflfJkKG5lx2DLa+K8ZJ4IyFIJCCBh28PRWEnvZSBPKrljcC15NKZNABBsnchsSAouwTC93wa1iJTRD8/U8qMG/rre7NVlQs5/QAMqbZfUZHQ8XZI54dAfxQ0NMfWXkwEWt8GLTgc2cEi41t/IvFiQhVsO6ShFJoC6ywQfnSe2qu6dEtIwvNO5ztXnNYgxaHlsww9ssM4m1RWLAmzN4h+3zygRlPB717o/E6rHa8kAXu/Pnna4gKRiFbenwgJ3/TVxo76PJCcuz4G/5xL85H7dNhQFne/KOCzYAVzoeGlAjWCW0WmRGOO3GHB3O13rmxlO8f/FKjcd+xMbfECV4ZrKJYYPhoxI91p0C0yeRRvJqMy4KN3Iu/5tU= 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:(13230001)(4636009)(366004)(110136005)(8936002)(44832011)(2906002)(316002)(7416002)(66946007)(66556008)(66476007)(921005)(8676002)(4326008)(5660300002)(6512007)(6506007)(38350700002)(1076003)(52116002)(186003)(26005)(83380400001)(2616005)(508600001)(6666004)(86362001)(38100700002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q1eSdFxY3ohfMOP44B7/wxq2uguOI8rV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+ay2FodLn8h7pEvzbTkomG/jG7ZE6FpK3UovpyIAK7qfThrVIWTRSN8cxsErSz6S+7XaMRrK0nWAIBnB/siZgaxF6svKIoX9CFr1OCumcryfLXQXQeYHzIkVjtt9tSNJj4ZfuRMMRo0oqnaO1khGUB0sw+aFNxkaBCeEjVLHDjWt8F8VbhtjrqhZP91F9wJOznbzdIyM0v98ZRv2yBKkahTvI2SFZVTLAgn40SAhFeicJbLBDfYNAfqzqhsTY8LjrlYIyB4aBqID98t0m5GHKHxC85GFOZtpzenhQJNRYuoVle6Vf31a1cYZ3R+HJLZJYT9bCpfZE2h7j4hLkjCXg6fmHdmlAVGoJri2rq25Db+9a396kibNPrXUxGIWne+3+2rWER8eeG7a+1zwjaG8s7x+M+7o2WlG8CMAYWHiyUYra7iudNTJHwf5o8WxBUQ88Clqi6eIFn3tFbjP3fwFFFfwb8iS3mNX/rapjSW3jYAZW/dc96uzNlujD/khH4KIUGcA8pE= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f71647d-90b8-4522-ee68-08d9e7484c2c X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8807.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2022 19:06:35.4448 (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: XCuTL/mOdXMLYVoYorj34djN97kMMYKg7WpvrXbxDv8hipNFstAlTmZAJ7RiOD5athAj0/lfXJdLZ8bhVHiuxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5408 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Yannick Vignon When an IRQ is forced threaded (such as with PREEMPT_RT), 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 explicitly 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 bde76ea2deec..4bfc2cb89456 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3459,8 +3459,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_mac_interrupt, + IRQF_ONESHOT, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc mac MSI %d (error: %d)\n", @@ -3475,9 +3475,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", @@ -3493,9 +3493,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", @@ -3604,8 +3604,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", @@ -3618,8 +3618,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", @@ -3631,8 +3631,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",