Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp497855imn; Wed, 27 Jul 2022 11:53:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s2bav+gd8FriVZOM0tYl3aMo8J6IoFMWSmyeyEwNExJNqBgD6fqMGXzgdmujVporhcAdBv X-Received: by 2002:a05:6402:3514:b0:43b:d87c:7a99 with SMTP id b20-20020a056402351400b0043bd87c7a99mr23520152edd.43.1658948031251; Wed, 27 Jul 2022 11:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658948031; cv=none; d=google.com; s=arc-20160816; b=v8IwV1DOSBB/o/IL6AVONtV7d1orXBwlD9r5PqaIjQffSlv06aVUlGqOsfSBigE8LW 5oIJBvEOpI1F/bpDoJYsaGsX+A134gecoVvaR9buhYMjiLTZx832uZbO2E9tvoXHGIE9 PXTWZ1Sx4/0UiquH9Wlo+vCKAr3H2clesLRAyTx14EHHidCuSc8s1ss88doKrWXt6GZr DIbJ4zrUDNbUuKZFcYzvUTZk9hhuNhPhYBc9vqNQVZbSu4RS2SKSXuwTaflV04jsEsP0 drwQPBRz10OO+JqtBPrk1keYL2OkafwxlfdkxQi0PwkJHWSaEbYwO4UJCULtoP9zDL6y DwKw== 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=pC+vmgz8byQllPH/Twl5cQAzW7D5XW0ctpt+mcep488=; b=PAcKmVbHElYVoZiTRad8nk5PQA8/+nn17YszanaDIL8tZCyPrVF/65TEM9e47zW9r1 QbppcxREtQJIexixE2NuHb48A4dHfOXUtxEWgcdcPjo3rFXmm2WXi37TAJsUm7El1w4o DAckh/Ln9KsIN0W3vmcl2ugPe1bAPHdxSOd8HDGUfYUxLUCG9OW+rgri61b0aYQv6aMW MYWQauUWmxF74/z1Md7vxbK34jbWUkSrlfhxPwx8Ucq20wbf+tRBq4aQP2HRM98b8+lK zvQsnf1vAKW4n/Ln+P+IJP9DtoOGTxJMavhfZ8U9fWdBPFUDS5UIjF4VCFZwdVPtHRyA ijdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0nh48BIi; 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 y12-20020a056402270c00b0043bc6013b81si20966487edd.67.2022.07.27.11.53.26; Wed, 27 Jul 2022 11:53:51 -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=0nh48BIi; 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 S241876AbiG0RWv (ORCPT + 99 others); Wed, 27 Jul 2022 13:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241816AbiG0RUY (ORCPT ); Wed, 27 Jul 2022 13:20:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21B1A5FD1; Wed, 27 Jul 2022 09:45:12 -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 ED54ECE2314; Wed, 27 Jul 2022 16:45:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7732C433C1; Wed, 27 Jul 2022 16:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658940308; bh=avZDDaQpycf6zwWtz0rxv7VLnt+N8pteV3NItPBxSkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0nh48BIiOlRSO2ZD/xX61AgzmFkWCJk5mNP0hoKy9oofFNCymrYHMFBl/h1xGFBQA kOktJ+YzNaHOZxuxI3eWz5TDpSlclw3KQL0Lnw6L2a6x+x3r2RghBrkY4jyGX0p+3d Afq+b9dVWPSPkFKrmzC2hxxaxk+w71T65/+l9ob4= 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.15 137/201] sched/deadline: Fix BUG_ON condition for deboosted tasks Date: Wed, 27 Jul 2022 18:10:41 +0200 Message-Id: <20220727161033.482502962@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161026.977588183@linuxfoundation.org> References: <20220727161026.977588183@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 @@ -1561,7 +1561,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; }