Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp475807imn; Wed, 27 Jul 2022 11:15:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1usCi0D9Ak/3TGCuaWjIrkKo7WfgTZm7SrRIWqdA6WZT6olQJuDr8+Muvs4KUp0xzF6PeVq X-Received: by 2002:a05:6402:524d:b0:43c:a8:70 with SMTP id t13-20020a056402524d00b0043c00a80070mr16756537edd.33.1658945709251; Wed, 27 Jul 2022 11:15:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658945709; cv=none; d=google.com; s=arc-20160816; b=BTuhcDpGiRT4jKoFqIOd1N1jvSos+1HBQJrpuIrwsJ5m48P8+EtrLIpjfi0le2Bq/B It/T4USSgAu84OBgNqRGQCq1HRwVIn1w6U1cBBAY9MlmEi1RCEYlcO7MArlEBj5NbJa3 yVkpD9JZ90Pk5I0mq0oEu+Lyhfv/C+XExJ9sk7VwjfhcdQCaw5+s5Ypolwln5mT++nCj rgxV3A8x1lT2HOwhJCL4aJf3pRgLf/zS5iOc+AYfhUdQJ1xFYe4FbhNZbv+7LmWPhYRD NY19zIFN166361yzlxNjzA9lRMtChm0YJ/2ug2wqqu7edVHyEZ3P063yxIBRO67TdPxd o7kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=agyN85VJvpPiBqgr64MkOlLATq8czsERydyBAcIRrWo=; b=KGreUCyPrsjYV3ckSgoD8Zr29mtzfBl9XWMv5GZyU+oc5Dv1sEzrZ/La4IXcOk1UGG UyEr9C0RVCgShS59NFUMg+2G+5Hble6qrzHwPJOXAEEitgwj7SnyOfP9Lf02IJK1qNm1 /51cCF61G7u13wGlqbxixVohMWabE/quiDDrLUe6Ok+G0KIckGdS/1X16TsfLbXYxFKw 0aRz4/z+CaQeps5VRB/yQaPNEKFIqVYORWlCz0LR1ILkyTHXC0YRwqYlanvybkb8nq2D cXIECoqcSVBhSEZR5q+HClSFoTTIgt3wJ5qs11r0a8BMXF3wiHfnK2LuxZtsVjsv+ISz MY9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h8kNwdwT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc7-20020a1709071c0700b0072b7c700b99si19465887ejc.662.2022.07.27.11.14.44; Wed, 27 Jul 2022 11:15:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h8kNwdwT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241078AbiG0Qzm (ORCPT + 99 others); Wed, 27 Jul 2022 12:55:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241060AbiG0QyQ (ORCPT ); Wed, 27 Jul 2022 12:54:16 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 724CD4D4F6; Wed, 27 Jul 2022 09:35:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 99452CE22F9; Wed, 27 Jul 2022 16:35:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75244C4314D; Wed, 27 Jul 2022 16:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939723; bh=UPIv0T6nDo9e/uQ8ZM73NKvPM2cdoZv0Mwp+teEI3Fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h8kNwdwTepu2jRi6oeu0bM9NeYY59vcmascRBnQxavGNN1ObuGppk3+EVTrwwwaQ+ 4gy5paW6KeuaSvKyej/ZmCXHhAMF5UfWQkNEico7xdCgfqOCJSZl65T9vf9wMA0Uu/ easgtGn1uK4ElJu1UqxzGogfdxyQdED5Kxlj4faU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juri Lelli , "Peter Zijlstra (Intel)" Subject: [PATCH 5.10 081/105] sched/deadline: Fix BUG_ON condition for deboosted tasks Date: Wed, 27 Jul 2022 18:11:07 +0200 Message-Id: <20220727161015.341956303@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161012.056867467@linuxfoundation.org> References: <20220727161012.056867467@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Juri Lelli commit ddfc710395cccc61247348df9eb18ea50321cbed upstream. Tasks the are being deboosted from SCHED_DEADLINE might enter enqueue_task_dl() one last time and hit an erroneous BUG_ON condition: since they are not boosted anymore, the if (is_dl_boosted()) branch is not taken, but the else if (!dl_prio) is and inside this one we BUG_ON(!is_dl_boosted), which is of course false (BUG_ON triggered) otherwise we had entered the if branch above. Long story short, the current condition doesn't make sense and always leads to triggering of a BUG. Fix this by only checking enqueue flags, properly: ENQUEUE_REPLENISH has to be present, but additional flags are not a problem. Fixes: 64be6f1f5f71 ("sched/deadline: Don't replenish from a !SCHED_DEADLINE entity") Signed-off-by: Juri Lelli Signed-off-by: Peter Zijlstra (Intel) Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20220714151908.533052-1-juri.lelli@redhat.com Signed-off-by: Greg Kroah-Hartman --- kernel/sched/deadline.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1563,7 +1563,10 @@ static void enqueue_task_dl(struct rq *r * the throttle. */ p->dl.dl_throttled = 0; - BUG_ON(!is_dl_boosted(&p->dl) || flags != ENQUEUE_REPLENISH); + if (!(flags & ENQUEUE_REPLENISH)) + printk_deferred_once("sched: DL de-boosted task PID %d: REPLENISH flag missing\n", + task_pid_nr(p)); + return; }