From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 4A8C41D5170 for ; Fri, 23 Jan 2026 16:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769185392; cv=none; b=Ooxq0SCChQVC/TpHPP4TpsKJSutUVewMS7CL4IboCfymV4d/u1+2jQsFRkLk1ju56d7esWwUqPV9VEXcA4AUFOzJoA/L+Cx77EQgjX50ePSUZXXwMXCFRa+Du9LCWtl+MBuvnHdwV6c6iAcAxcSe4pf0r1iiBjNvuC6OhaMdfcA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769185392; c=relaxed/simple; bh=xNV2vEmNjEZVVQBMVDIilSG8KNxp/ZJpdk+NB4L+glE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iJ+QZ6U2VJVaD7MaJ7F5CtiiWq0Oq+4pcHCGxWzp52lG6Y8BVeJahYkoqK6uSDvlCUfsVXiLbin4twbZVAUvBdAGxMUyMOzMrUhYFJaGW3rqSx8GLsSM4NspR1k7vnGxfWgVQUdOsIWT9Fbekn4M4NCjdiNcPfJQ7SOG3KWa7rQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Duagk47D; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=G+siawuk; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Duagk47D"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="G+siawuk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769185390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jUCqHAaLJvABx8RvoKrKk9TVgKHJIlXccCn91vumbBs=; b=Duagk47D9JOHjgJiYuv+dN9W6lZcaZd6sPqu8u6xRXVGBXWqR8pOyeS73L5oSrEmV8rQKa 8vjvSbZXR2eLQJEfubS2Q0fEqGpbIaTmPSROe/q5TFnVmNADJ89JmZIU9KkzLjE7EGMgXf U522Fg7yTyEEd3K/fh7pQScdgClzND8= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-SRiLZeOaOwqOiiEovmi_qA-1; Fri, 23 Jan 2026 11:23:03 -0500 X-MC-Unique: SRiLZeOaOwqOiiEovmi_qA-1 X-Mimecast-MFC-AGG-ID: SRiLZeOaOwqOiiEovmi_qA_1769185382 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-43065ad16a8so1523020f8f.1 for ; Fri, 23 Jan 2026 08:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769185382; x=1769790182; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jUCqHAaLJvABx8RvoKrKk9TVgKHJIlXccCn91vumbBs=; b=G+siawukD3PHC+S4GhvU9DKw8dLQjjogIyAQ+t1GY9oe0BcFS7OWANcO2LrFxFT+eW PUx2eLc1/aqNTFN3pm3/aW82qmcNUrjk3vxrKCOAbaZT/3ypIS9/1jmN0bMydy+iVXnk 0h3ZtsYaYK2C2AqWpu3+s1nqOTds9IoX1KEbD651fJ04pCcOC05v8WlMI2pFfeggvosR bAcPSXq0QSZ9NTmg5Pad2JENS9vG32UpekMqNxnA9HaePALe2vnPvQNSjOpkBZrYuN/l 7VfKUQvgs1bwxIiLNU5GzOLHMKiY+y6cLIjIH5aoAAuQ7sQe8Cr0Jv6ISiOhgvHAWZAa gVUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769185382; x=1769790182; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jUCqHAaLJvABx8RvoKrKk9TVgKHJIlXccCn91vumbBs=; b=K6IUyuur7S3Qdw294rq1Yh7APhFShXYjdTd6/50dX53R5wIvhp/IyhhbDbHEyA1sJz TLuy18qEh3yA3yAvfTugRRqRkpi1tQPAlQkMyset3xzTQ34lOL5/3nbATcZc9ryqsIlM RYipmhBw12TAsY5PAY3OffitREmUR/4nE8w35AnDbJlZAJ4WIZudfc8Q3hsRB6bpjhq1 zPz6OMPkmP+Ucsb0vpCEYlZrjE1W6aDXHpMI3Cg9TAaKaX/OUcs2Adxc3so/6lnQLm8A XW2iyP9+fTsEld7aX+0N30IO0d9PfFhxGgKEgf2fTW3yxyPd6GRD/pqUpJDaEnbLESiU 1GRQ== X-Forwarded-Encrypted: i=1; AJvYcCXzvor6aEaVpBEvl4uohVIIVz4/Y15yFZw+3lktJbNblKr+6w4m4jflfWAz15NUniXBEYNblbyeHyTWgpo=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5vtbDIH1xmd1N3ggTntwDDYintIyDwe6wOLd1NsQMMe8VqFMK /lDz82eJaiv+uU0JKy56buqPT1Sa3k7vtj6qqDWCZ+zY0MLttc9AagHhDjTxc4Ea5hB2YrnPOQd ZbUN+XboUV8oTVmGvGKt89SMAnl8UfTb6486wgkXf3Nc9+3IM/WF2YwkhV4iIlex2Wg== X-Gm-Gg: AZuq6aK0ufZpsq0lVGTp+0A9/1KXh3qwR1eOE/rGitcGr00hgEzafwVlbvc8FRA9WqZ bDnJyczcohWMcGJftvJ3GQH+DNtrqoCAjLpmdE9vfatBAaIECh8XSVPU4faQPuCwx1yMDloalbT Ha6ky8Xhx82IIcsO7TW5hxP0nA9WAjhPhAmtn9cANeZ/jVqXRgcFhmtLhmU6Vt2BQPqR6GJLUHo KjUg0H0n5ID2meNZ0rojoLmYIefpWUrYywkySoJoPzuu/VdbnW1j7R9QTzYxlPWTy/l88eDG9My dHMf0zYrb+YDC1RtClIioQs6xnwdk/i9JbcqmGTrUGpdoPh/LPso6527txayrhAKdorT3PQFb6/ 9+hBKJUaS86TlhTQT98zILZMX5eJqwin2BETdLFGw X-Received: by 2002:a05:6000:2506:b0:430:f7dc:7e8e with SMTP id ffacd0b85a97d-435b15fb2f7mr5719529f8f.34.1769185382457; Fri, 23 Jan 2026 08:23:02 -0800 (PST) X-Received: by 2002:a05:6000:2506:b0:430:f7dc:7e8e with SMTP id ffacd0b85a97d-435b15fb2f7mr5719500f8f.34.1769185382035; Fri, 23 Jan 2026 08:23:02 -0800 (PST) Received: from jlelli-thinkpadt14gen4.remote.csb ([151.29.129.40]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1f7c8efsm8361714f8f.42.2026.01.23.08.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jan 2026 08:23:01 -0800 (PST) Date: Fri, 23 Jan 2026 17:22:59 +0100 From: Juri Lelli To: Andrea Righi Cc: Ingo Molnar , Peter Zijlstra , Vincent Guittot , 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: Re: [PATCH v2] sched/deadline: Reset dl_server execution state on stop Message-ID: References: <20260123161645.2181752-1-arighi@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260123161645.2181752-1-arighi@nvidia.com> Hello, On 23/01/26 17:16, Andrea Righi wrote: > 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 == 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=1 active=0 > DEBUG: enqueue_dl_entity: flags=1 dl_throttled=0 dl_defer=1 > DEBUG: update_dl_entity: dl_defer_running=1 > DEBUG: enqueue_dl_entity: SKIPPING start_dl_timer! dl_throttled=0 > ... > DEBUG: update_curr_dl_se: THROTTLED runtime=-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 > --- Looks good to me! Acked-by: Juri Lelli Thanks, Juri