Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1434939lql; Tue, 12 Mar 2024 18:28:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdNBBlvPuYYllDJe3UF/7FGJkWOydhmiMLWraZRATdOdtMYkkqvXHowrFcr476l4r5n8IRpQQhkMTLdt0WPoGuGFuWRU1TH3dRQfEoGA== X-Google-Smtp-Source: AGHT+IHv2zXsFMuY2vRirlFer/u5/WwPpACWPo1zz3tT1jIYY4973te7tqxHzhpagEiCNp8fI6b5 X-Received: by 2002:ad4:580e:0:b0:690:e0d9:6732 with SMTP id dd14-20020ad4580e000000b00690e0d96732mr4471532qvb.12.1710293295120; Tue, 12 Mar 2024 18:28:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710293295; cv=pass; d=google.com; s=arc-20160816; b=EGj4dOLRSqV5PpqGz2yw1g4BBpc5OTbvDStEjDg6DhiycMy2MZb9Vlb5UvFS0iieBp +9T4YZBuQXrNavWyIB02cUZ2Zf9meWvxAdiLxyb7wZI/cIHtomRL4nF7Pvh1SvBfq2G3 eOBp1MMVvfT4fnggcxKeJDW2S2kSegHMfE9saIHSN4EZEch20wzqzOMLv91aRv/LouyP KZnvmPryfJ0xp2R4L9SrFLBw87RjbQkYlbGM/LAOheA2Nf3fVClZ09xDlHqwVWQt/pUL 5EWdE/VfhZGR7efxjajSNN+055lPk7bQRIg1xbGToV1d47O+Ncsf5snaolEGEXC7qaeV y7Xg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6ZYANLYuUMfpIZu9pt5liLGvM3ivTsaOwqTCSKV0HFk=; fh=M2d0eEwkotGwrCl/QH/u/fnmeLJn9ZwWPiMveRgwy+8=; b=zNAwec4Afvnx3KFkkl3g0LYKWCCvfjkQ4n14hpcm6FLOX0CfdTTHynhkno5lMN6Ryq JVHrR6lRhE0eiK6PJgYR6N2ktTy+yyftXL+1909+KGhRnqA0FbA7Wr8o33J0GnV2XE/8 t66QYMo9JUjMGKrnxcn7pou3Wc7DEoLKZRJgQ6f23FZXh4nM7jaDpPGE/zqUcQI0MtgV hQ1woB94Wu0pZvxA6eZQDMQTZeyq8tX8Ws+NiyyI6Vl/hnHtj6Or1TCffR2JXmXbT7Rf fXF1YV3gmh6+wfK7svm+5wa6JJuhNAE5nMv5SsO6MzX9hFfVLD/zdhbReecSJnxUS3Y6 ROJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=GjeWV7nG; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-101013-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101013-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jv1-20020a05621429e100b0068f4d4938eesi8377569qvb.615.2024.03.12.18.28.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 18:28:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101013-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=GjeWV7nG; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-101013-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101013-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C6A2F1C21373 for ; Wed, 13 Mar 2024 01:28:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BEDE224E6; Wed, 13 Mar 2024 01:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="GjeWV7nG" Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44A9D210E9 for ; Wed, 13 Mar 2024 01:25:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710293135; cv=none; b=uzlRQw+MIZg7yMB5Ppd4sD7BqeRDP2nRSH8gjHKxdyiX5orS0otE7NV+67cKmBGDf5hb3v2N62jyp4jh4qEriy3pVhpwPblKVcuOppxfxy9M8gDMjW1WFoq+uQutWLLuLKf7KYpSBJVWkIJV4RDDZ85g3CFpybNVAvTAPGAxy6Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710293135; c=relaxed/simple; bh=bEbpzc3o6NPBPhxbWoEkjxbQuHObKOCYacbHoAyzbQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HwgygCLF9j4awAxjbj8GPu+ktaCWF7ZJ2Y3bn4xjM08NYbR/rTyoOWhc3bSHgUJKwIMAqngbDJJ/pVlIilzWNXr6gZIpoOkO5g1ChmyOp/V6jLa1pcnI1MkGNOFtIvftRIV5SA+fcOYlN4l67F9mWMNs7SWGlx9rDBPOQYBYB5E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=GjeWV7nG; arc=none smtp.client-ip=209.85.219.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-690e2d194f6so11214396d6.0 for ; Tue, 12 Mar 2024 18:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1710293132; x=1710897932; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6ZYANLYuUMfpIZu9pt5liLGvM3ivTsaOwqTCSKV0HFk=; b=GjeWV7nG2315toKGqMB98wMglLGQEWI8bPXLZl8V2NpxHHquRPHYwj3Y3pKKyNHhYV zy1hoDGDrUHgOdKpxzBANwXhrLkWkY69wIkCARkjxzhGMSKqs3kjsYNv5O3Fblyjh0IR H+ggZOUhDNgeE7wRdyPrHR0vgwJFcRqWbyqXs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710293132; x=1710897932; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6ZYANLYuUMfpIZu9pt5liLGvM3ivTsaOwqTCSKV0HFk=; b=WPqYNZVIH5psfbikhT8qR0RbSyeUUhoG5L16vZ8KWWkokZTpsKqqLqgUYOv5q0tahq mtn+fNpWRvV6+6MrzVnmzuUxgrsrX9yJTDzYmeeplTL7ojlvfTcfHXxUgX2Zu34ksKRu MXJ1y9Edz4e9Cg9UMo/Efk3do+U9njXuFLJfwUCz/P9iJJjEPl6kJVxgYr9l9z4FTmfr B23JP2pnu9XooDlsV2hgDry9/pXKKrIM4xU7zJLlec+efQV92wLZosCOr3EUDlFKbMdV CrHV2ekJBMoNkhiLwuWpQSbmuOuwPbjyblo6+pv+e25PvPV4BWKzaAd/YWv+WNPIasM3 j9bg== X-Gm-Message-State: AOJu0Yxsa9dAh+Njwo24j7JZ89D+PhYOH3sCKtFO4Fh81BGVxlSwMhRk JpWphFDiuUDQh81mkvLah+tqToHeMKeUjIXZudkZLRZ/I/J5riPd4iRw8FxucvBuYRtOXL+F3y3 l X-Received: by 2002:a0c:eecb:0:b0:690:d6fc:f0e with SMTP id h11-20020a0ceecb000000b00690d6fc0f0emr5943620qvs.11.1710293131938; Tue, 12 Mar 2024 18:25:31 -0700 (PDT) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id u9-20020a05621411a900b00690314356a4sm4162132qvv.80.2024.03.12.18.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 18:25:31 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: Suleiman Souhlal , Youssef Esmat , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , "Joel Fernandes (Google)" Subject: [PATCH v2 13/15] sched/deadline: Make start_dl_timer callers more robust Date: Tue, 12 Mar 2024 21:24:49 -0400 Message-Id: <20240313012451.1693807-14-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240313012451.1693807-1-joel@joelfernandes.org> References: <20240313012451.1693807-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit For whatever reason, if start_dl_timer() returned 0 during replenish (it did not start a new timer), then do not marked dl_defer_armed, because we never really armed. Further, we need to cancel any old timers, This is similar to what dl_check_constrained_dl() does. Add some guardrails for such situations. Signed-off-by: Joel Fernandes (Google) --- kernel/sched/deadline.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index dbba95d364e2..e978e299381c 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -918,7 +918,16 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se) if (!is_dl_boosted(dl_se)) { dl_se->dl_defer_armed = 1; dl_se->dl_throttled = 1; - start_dl_timer(dl_se); + if (!start_dl_timer(dl_se)) { + /* + * If for whatever reason (delays), if a previous timer was + * queued but not serviced, cancel it. + */ + hrtimer_try_to_cancel(&dl_se->dl_timer); + dl_se->dl_defer_armed = 0; + dl_se->dl_throttled = 0; + return; + } } } } @@ -1465,7 +1474,14 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64 hrtimer_try_to_cancel(&dl_se->dl_timer); replenish_dl_new_period(dl_se, dl_se->rq); - start_dl_timer(dl_se); + + /* + * Not being able to start the timer seems problematic. If it could not + * be started for whatever reason, we need to "unthrottle" the DL server + * and queue right away. Otherwise nothing might queue it. That's similar + * to what enqueue_dl_entity() does on start_dl_timer==0. For now, just warn. + */ + WARN_ON_ONCE(!start_dl_timer(dl_se)); return; } -- 2.34.1