From patchwork Fri Dec 10 19:35:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yannick Vignon X-Patchwork-Id: 12670897 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 61CEAC433EF for ; Fri, 10 Dec 2021 19:56:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232829AbhLJUAa (ORCPT ); Fri, 10 Dec 2021 15:00:30 -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 S229736AbhLJUAY (ORCPT ); Fri, 10 Dec 2021 15:00:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gwej3014kCV7W7MepJt0eL6qcNzEaQmw06nafIWJzN/9se/nFUSiCg5g68W93ayIUMC3dMv5yA8pnduhuqYl+xtBcaR3AwbuJ+7PPvz4zlMX4bJhGBtHM7TI8RCJqT6TZ+fC1GiDDj+qBvr+ycDDqA6/DWAlfuBDvCHt6elLVWRTZGZPw14hHHuy6UIu/khNZf1S6TFKEFaUXyEKgivlGoejJlibe+N/VBOuuZ+J0sK8GoXonRgT0nnlKQem5g7KTFcF8yRPJgpxSeFf9jmH9LEt0yIph23arsSK/Kuot+QsxBM6e4oRNdu+2rnqT/Q/mdJ81T9Aw/Q/Et1ugg+Y5Q== 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=Fq7y8sbL9EhXCSHB5x/7klkOz+eRU8pYvcWNHQPnaw0=; b=a6MdWH4XaUKD0kfXx/TW2uWvp9gft3+8b1DeckLAaIz1Xiox2sCeGdgFFKywbSvfszt7hBNxyE0oBwjek3VhOwdVZjX9/p18IYQynqP91O3Md4sNfKMaYRLpoyEfYgdB8E3T7ZU8SOgiZWGgyyG/12bWu8Ej8BBQkLgbshMQrYa61sbj3c3WULud/+tBO1sXnE77OkD1v+5HXEyHmd56XSfzmBgzbbMTYuuKdN577kAYVB0o4G5c1aC5oq39I0yjJSHImpAbEFmz7dGIxGZ8rWj+PLKLpdT0OY9q2M3vDjs9axJclT5Ww5MSfDyubMeKtBpKddbTt5B2J1+161i+OA== 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=Fq7y8sbL9EhXCSHB5x/7klkOz+eRU8pYvcWNHQPnaw0=; b=EXutMTB6m3gWuNeBym9rG5p1KpZuLHI/SrmBy2M7cseI+P2FOE+NAxrPw1tRUGneu4mrx7v+95T0v5hfUzlUdwJ5Tpy+Cc+6ETAv2OP8zBp5zzhw5DOZ/tMjnrZ3zpjr0LOANXawiLUOrgONE3r/MStFM2eCnEMtrWqGB1cqlK0= 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:46 +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:46 +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 Subject: [RFC net-next 0/4] net: Improving network scheduling latencies Date: Fri, 10 Dec 2021 20:35:52 +0100 Message-Id: <20211210193556.1349090-1-yannick.vignon@oss.nxp.com> X-Mailer: git-send-email 2.25.1 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:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 47117cb0-876d-4341-5fc4-08d9bc1731f6 X-MS-TrafficTypeDiagnostic: DU2PR04MB8887:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 321ptEZ2Aqq421P243BBcMgfc5ZQnI0BIKQObtfRKg2IEMLePMmoOolmyd3lglOKbwlapDEEmrqmSj99dDxJJSL7balGRLger+oJDecLwRzqxRTW8QId59B4cR4nMR9TnFqllx+f7wzUF35n6aChB94ttWOFOm+ZCrbgh9g/niTESxca+89iQVBO5yUcUvVBJNHPR7QyuIKX277yI7pCFobPbLr3zmzOFEHjXiVsmVUMkyVzk//xmULnhnnPl5tCmDumxJ9XGeCUpgQPbunKIT/IOmvHHqKXg934W3iEeTrl139anFUdrHzh7YdL9wTNh9MlSV41wEyXLtZ57lFrIJbcuWo27YPwRq/EXnVDXF/TAz7oJ12XF10tk1329ZoAAkjxWtNPIq+jbMbB+HcDN07y1bxTWOjI3irYWt6543wU2HMK+en8nQ5GcAolIhHGQCmWIzdL1ePXSxgdfnG9tYmIkNZyfxmt/Kablj2ZiWdAho9Kqo6oDiOyilFEvFXBLbk84yv+vKN08eHDY3E+jMxDNgEyAtie6JjuGD0rAjHMmQzRrX2kn3EGwCyjo2C43BIuSORTeA+aQuUhwYpSNuzRa27mEucnoLJk9IiMOrJZNguTxakOXJbca4NwlWkgAlA2hXimNaC9gcHjnJrtrWr0DMwlWnliWXoetDMpdknji0O1DZcZGFt+mywuAOCxEYBvO1A/UTjCeS8bSrsa+MjrqYMXEu5aVANz6WTPTWU= 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)(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: =?utf-8?q?DtPnrliUcUN/HXPTn5UiKfxujaKa?= =?utf-8?q?9WLylJaNKk/HY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6lVMQ9mN+cHjMGo53cbV+w2lf9PXVJX8V6h99wSa?= =?utf-8?q?TU1jgIj3kSmMD94S8I4JwfNxkbexHzSvlbdylh8c9iacKJT4Af6pBP+IPT7+Hi0TN?= =?utf-8?q?l0ty8DmaHDh8AjcR/a24eafaRdGIoQdi/AbTdsX40zZM2ytZ7ewr1Kl7nwbrKTUJX?= =?utf-8?q?aLHfk/ZKYOXhz58/hoaNHllOHRYhNSeeKXIPUAd5nKCQH7miB7x7IwJq2YRwMykrz?= =?utf-8?q?lAORkMwQyY/iq9Sep/3ibAYb0DytDQZgBsWtYrRHEGRSIuwBZOdwuSb8ce9H5L77k?= =?utf-8?q?sEvJXEpu1/x3CSS57J5end8yU6kfPhS8/EMUUNKo2nPZSkDq8M1RiShBGwEBijy0U?= =?utf-8?q?Tgie2HnM3rTAxHN0BKRIGfBkoHmrTiZWqTht5GttVSb6NanDW1u8N7KzeIItyYXV9?= =?utf-8?q?xDtx/sOH320+XUVpSW6qENpRe5LmYbBg3+zqPP4nqya5r8IcwEQYfmIMgL1DUQP6i?= =?utf-8?q?WmKWNZ7Ow2rIGighG9xEiy8qT+pPRpxLuvorYQMOD8eN4TarQDAifto2B2Ch2Rygv?= =?utf-8?q?ciab8B3s5c9yp7nRStyDshbXerfOBreqsdaf2mh+QhG7lsd6plYDCqLgMpD+m6VQA?= =?utf-8?q?4YluS8Y+Pwm7Xg4JclRzfsax8CWpJja+kaIxe9qF4BIo59XqXvI2grw=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47117cb0-876d-4341-5fc4-08d9bc1731f6 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:45.9599 (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: Pu0bpZikGSRZqEGL9uPYoQE8rgCUMGkYv88IpFdiauHLY81c8LRBLBtDoc12kXvADRqq3VcgLz8fgcuafXWW/Q== 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 I am working on an application to showcase TSN use cases. That application wakes up periodically, reads packet(s) from the network, sends packet(s), then goes back to sleep. Endpoints are synchronized through gPTP, and a 802.1Qbv schedule is in place to ensure packets are sent at a fixed time. Right now, we achieve an overal period of 2ms, which results in 500µs between the time the application is supposed to wake up to the time the last packet is sent. We use an NXP kernel 5.10.x with PREEMPT_RT patches. I've been focusing lately on reducing the period, to see how close a Linux-based system could get to a micro-controller with a "real-time" OS. I've been able to achieve 500µs overall (125µs for the app itself) by using AF_XDP sockets, but this also led to identifying several sources of "scheduling" latencies, which I've tried to resolve with the patches attached. The main culprit so far has been local_bh_disable/local_bh_enable sections running in lower prio tasks, requiring costly context switches along with priority inheritance. I've removed the offending sections without significant problems so far, but I'm not entirely clear though on the reason local_disable/enable were used in those places: is it some simple oversight, an excess of caution, or am I missing something more fundamental in the way those locks are used? Thanks, Yannick Yannick Vignon (4) net: stmmac: remove unnecessary locking around PTP clock reads net: stmmac: do not use __netif_tx_lock_bh when in NAPI threaded mode net: stmmac: move to threaded IRQ net: napi threaded: remove unnecessary locking drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 44 +++++++++++++++++++++++++------------------- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 -- net/core/dev.c | 2 -- 3 files changed, 25 insertions(+), 23 deletions(-)