From nobody Sun Feb 8 05:28:35 2026 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012066.outbound.protection.outlook.com [40.107.200.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D1BC341674 for ; Thu, 22 Jan 2026 14:08:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.200.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769090927; cv=fail; b=Qir7g8y/QdrA87oBANJlhacU1Vc+ODNHH3ftVQNon7UuvQd37dMiO23bDsmPWfn95Ukh6jx3H/AsAd7BPo56eK39rL9YdjUx10aphhH9MuMceVtyZ/Qh2Nn2zotBVWgDFSbiXcYkiMNt19rJGWuwWOyNc+i1vrY7LnN7Le7ErQ4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769090927; c=relaxed/simple; bh=JOdICgIqWt6cLFvM76qplXKLgyVsyIyIyD6aMxKttO0=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=tbeQwB8KotjqoZB2lFijTx39w64/eMIp5KMm7/rOVltHWpCWYF5NucQL2WAv4YmEhUlx2YxHCM5Oewtr96tjIr38VRU1qYeTJigcw/llFwT7n6Z87sSvHsBbIwEjKvM6M0Slzo0KUXYL+oPIeolMa1tr9o9Tzq9mmNc0v8GTuuY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=CjbF1ojG; arc=fail smtp.client-ip=40.107.200.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="CjbF1ojG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lfF4nFIEylbTNLKyV/MXgR5TTHdLf1kYmk/KSuOI/VQX0sdfjbUeInjaWODC8xLa24rHFlGkTVm9WkIJg3EZ2rw76C+nT7gU1k6iA+ddJ1Wif9g2JifJ+nyO8enBCEygbIGTA0Hh2BE6s49ipqHCbF50JiUp7Va/1wnwUmVisKIiRhFMH2y9QW200fjOzWl9ptZgsH4ytcGkXeCsA/Tx0pNAeL4p+QG9RVpgG+zaAl/7FDAHOQ1I7hCGdhiuRew89Ag66TtGp3iaKKWRLa0SAjDzQS1Qewsyp1ttkzqczmMjmR0AiMFZKUte419BgiSuI5VgLuvoDqvid0AkZyoQoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/8ED0V48GOZfYpXcUTu0iRxQrQVTtekyKtwLf3WCO/k=; b=KuR1yWM3pM4Y4qSRnNsNiz8ZCwFGTXh4gxzgbT/Pc7guzS5D0io08RFFuA27oHgWJVq5iDS9UZAh/RM7nvOf5RnI8P7dq1diW8p4JRq0rYBkIJeg6Sx1/CFutzZdV7HFJqHu7e0BWR7lB4GfCQoPxS45RieiUPraQP3/uK8fWksOSnVJvdaN0cvHxttxZXTZW4EX0qQMq9BLPfju4BnNwInPhN6CjIoCQQE96ROwdqOJ8ENhWpw0LXm5wa+5ZuydrUJk1NV7uzU5CmEGlJljhQSk1IqO3B+sn39Auc/yvMCW6bktRpra029H8kRMCNSS9wUCgX0MDMUnqo4EuYT2Uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/8ED0V48GOZfYpXcUTu0iRxQrQVTtekyKtwLf3WCO/k=; b=CjbF1ojGy6AU79dYhs/yudbfFo2tlSFX6SiClXQO4097Bwv5yMdiFphrMHAn8yXcuUAWJ07j75KmbSLqPmJ1zT7NI9XqXJOLgNYCgsX3qpMuce4WPzkBIQvlIGPhMzzdCS1iVgCMMPL03edZikv4h1xmTLvWVP2okoqajkhEBe96aEC7ifpScY6sK5LPeawP2Xl7QIPJzlhHT4jWu3H8t/CmF61FKIu0mQbWbPURyJeAm5gSQCMQOGWIt/1/rhjfFzPtPaT/KqLDM/s0wTuVKJYAF6fSOKvuDGkcvo2ZN4dDrsbLp8Gxz8seiBme5qbM+gN+JhwPLP+1di3uokitpw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV8PR12MB9620.namprd12.prod.outlook.com (2603:10b6:408:2a1::19) by DS7PR12MB6094.namprd12.prod.outlook.com (2603:10b6:8:9d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.11; Thu, 22 Jan 2026 14:08:41 +0000 Received: from LV8PR12MB9620.namprd12.prod.outlook.com ([fe80::1b59:c8a2:4c00:8a2c]) by LV8PR12MB9620.namprd12.prod.outlook.com ([fe80::1b59:c8a2:4c00:8a2c%3]) with mapi id 15.20.9542.010; Thu, 22 Jan 2026 14:08:40 +0000 From: Andrea Righi To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot Cc: Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Tejun Heo , Joel Fernandes , David Vernet , Changwoo Min , Daniel Hodges , sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] sched/deadline: Reset dl_server execution state on stop Date: Thu, 22 Jan 2026 15:08:33 +0100 Message-ID: <20260122140833.1655020-1-arighi@nvidia.com> X-Mailer: git-send-email 2.52.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MR1P264CA0100.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:50::24) To LV8PR12MB9620.namprd12.prod.outlook.com (2603:10b6:408:2a1::19) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV8PR12MB9620:EE_|DS7PR12MB6094:EE_ X-MS-Office365-Filtering-Correlation-Id: 555b31e9-a55f-4b31-03de-08de59bfbe8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?7O3KwA8CIDq1T4x2Dyr0uzHi3K/d8+rjoguKue4q2Ts7DW2w12iXcXE6abdS?= =?us-ascii?Q?nOiNMKx8IAOn07I0vDEDD4x5Z9+QlFMOCLWisqAhT/CCAVoMt61fM4VFmBJu?= =?us-ascii?Q?FejbkL4xladUx5DLUlazeDPV5dsXUmR/GrHkevhHp7BMQp61bB61L8blbOlK?= =?us-ascii?Q?/uA6KHTugHV/sCnIJwGMg82tJnC9NXO1JmsYvbgqw667eWGYXsMRN03mZOye?= =?us-ascii?Q?TTWD8GrzFjeQMflR+tvpENQI/PzE064XEOpVvNwqJlkxNQjyL/F0XPBStdGa?= =?us-ascii?Q?BFI/WC5OnYMWGjEzPqQHf27aW3Zr7MwQMUxSaHIOel+z/61LZYoJyqSEf2B9?= =?us-ascii?Q?qw+k0o+OlKaGFdYKZZgB19IxA0tLDbCjANkgUyJ5zB+APch6n4zGSR7WRSf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Un6KFEGNJ/XLXYsEFbVcCl4NI2D?= =?us-ascii?Q?k4YnTEAzwYrEczH4Foi0SrpEhesmbv/IYs0vF2g5Hp/hq1LJaeAWghtyBEJi?= =?us-ascii?Q?x+Nh/kkPoYF8C+OAlhOIGOi6Piw8A6lAr6gLQTZETZK8B6X+XYAiTFX7251a?= =?us-ascii?Q?EC/vdklxAFQPod677hsWKcbkn0lvqZfF1/JOJi/7oDvWmAXZJxIXvrf5GqS/?= =?us-ascii?Q?KUeZzqsVWslhQxSKNlX/VB/BLXO8kBQzAeYhHHLOT512/weoaMqTsomK00px?= =?us-ascii?Q?gI4/oeZUfSTsRb7AEa8=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV8PR12MB9620.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KuIoFNWUWAGLcErFdcgZKIGf5Ww7w5ni85kykpuFxYf/2suN2bBu3lw4i0yU?= =?us-ascii?Q?U+MvH0CJbH0k5ZKzcRMJG3DBmdskjozYRsc1ePEhVULLIFwMA6I93Eo8NdNn?= =?us-ascii?Q?D+TaOgC+uE/YM9rzZXS6S4avbsCLHzHGWLEs29mvVwIsopEIpQB4Stk/IUY/?= =?us-ascii?Q?rwLCiSmRppjNRBKpBpe++b1Tb0oIAR1uX0r35qKHWMpme5cDCt4VMqwh7P+6?= =?us-ascii?Q?2Q55qvxGC4+/cSPBK/G14FA7x0tJGLS9eh40VxlPqWedrxQX2n1eL4GnXyZF?= =?us-ascii?Q?PkWIdTP+eoVvLh3o0b1/S3ghsJ4rcypcBQ7u218UbHGKSuZibL/vXU+JE0p6?= =?us-ascii?Q?loV6zc4uqr/LjGfHDzzBZplxN4wU0nyKH636pbkGcIkN7aG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U1BbxEC5eM+BiHbq+qORdo7FJ/qho62knMCKzaw+a3R6apxDgZHWbp39Lgw?= =?us-ascii?Q?3ivrHHCQv8v8X5I8St0LtDptHqaFM6antPAuLzahg9mVT6cycmSL0RXHltLZ?= =?us-ascii?Q?bOYK7vdE1sm/kTIpFR4LDtN8rNuzBMcRAdenUTb7/o9R79BtZBJjWU3XW5Za?= =?us-ascii?Q?E/iGMvpv0S4J2vN9/9Rn4iTxjd6m0ym1G8jBL2rfEINxKPAoVAezhFyOBN/w?= =?us-ascii?Q?ivO4ei+jm8mM02SYGtMhsGdrGPrgIEiSHKKlwzGqIj3MYQcuCucgGLyOm0lQ?= =?us-ascii?Q?LHArrlMzRZ41y7u+sK+gYn3c4o/B0p9MgeIEl9wXDAd8jzzfua133X/McB1z?= =?us-ascii?Q?r2rfsxqLfsRCXF7pJTaUqh+7WBJUtxYb2WCdaWltA+0ZP0Byc1T2GjaM/e8v?= =?us-ascii?Q?5k0GQ/27AV9iQrlz/zRejfaflF8FLwpGr+upH8ee0TC0fRaKmmIphkdvCGCr?= =?us-ascii?Q?ybNmIz8m7Q=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 555b31e9-a55f-4b31-03de-08de59bfbe8f X-MS-Exchange-CrossTenant-AuthSource: LV8PR12MB9620.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2026 14:08:40.7193 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ANVSahOgefePptRW9Acfl1gXyM/aqMb/jScMfNm+r9Wn8PE1zoObzW1M4JNHOQ+QTYH6R/B+85VnyOm/5rTyig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6094 Content-Type: text/plain; charset="utf-8" dl_server_stop() can leave a deadline server in an inconsistent internal state across stop/start transitions, causing it to bypass its required deferral phase when restarted. This breaks the scheduler invariant that a restarted server must re-establish eligibility before being allowed to execute. When the server is stopped (e.g., because the associated task blocks), it's expected to transition back to an inactive, initial state. However, dl_server_stop() does not fully reset the execution state. As a result, the server can be logically inactive while still appearing as if it was still running. When the server is restarted via dl_server_start(), the following sequence occurs: 1. dl_server_start() calls enqueue_dl_entity(ENQUEUE_WAKEUP), 2. enqueue_dl_entity() calls update_dl_entity(), 3. update_dl_entity() checks (!dl_se->dl_defer_running) to decide whether to arm the deferral mechanism, 4. because dl_defer_running is stale, the check fails, 5. dl_defer_armed and dl_throttled are not set, 6. enqueue_dl_entity() skips start_dl_timer(), because dl_throttled =3D=3D 0, 7. the server is enqueued via __enqueue_dl_entity(), 8. the scheduler picks the server to run, 9. update_curr_dl_se() detects that the server has exhausted its runtime (or has negative runtime), as it wasn't properly replenished/deferred, 10. the server is throttled (dl_throttled set to 1) and dequeued, 11. the server repeatedly cycles through wakeup and throttling, effectively receiving no usable CPU bandwidth. This results in starvation of the tasks serviced by the deadline server in the presence of competing RT workloads. This issue can be confirmed adding debugging traces, which show that the server skips the deferral timer and is immediately throttled upon execution with negative runtime: DEBUG: dl_server_start: dl_defer_running=3D1 active=3D0 DEBUG: enqueue_dl_entity: flags=3D1 dl_throttled=3D0 dl_defer=3D1 DEBUG: update_dl_entity: dl_defer_running=3D1 DEBUG: enqueue_dl_entity: SKIPPING start_dl_timer! dl_throttled=3D0 ... DEBUG: update_curr_dl_se: THROTTLED runtime=3D-954758 Fix this by properly resetting dl_defer_running in dl_server_stop(), ensuring the server correctly enters the defer phase upon restart. This issue is quite difficult to observe when only the fair server is present, as the required stop/start patterns are relatively rare. However, it becomes easier to trigger with an additional deadline server with more frequent server lifecycle transitions (such as a sched_ext deadline server). This change is a prerequisite for introducing a sched_ext deadline server, as it ensures correct and predictable behavior across server stop/start cycles. Link: https://lore.kernel.org/all/aXEMat4IoNnGYgxw@gpd4/ Signed-off-by: Andrea Righi --- kernel/sched/deadline.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index c509f2e7d69de..214fe62a59723 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1813,6 +1813,7 @@ void dl_server_stop(struct sched_dl_entity *dl_se) hrtimer_try_to_cancel(&dl_se->dl_timer); dl_se->dl_defer_armed =3D 0; dl_se->dl_throttled =3D 0; + dl_se->dl_defer_running =3D 0; dl_se->dl_defer_idle =3D 0; dl_se->dl_server_active =3D 0; } --=20 2.52.0