From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F07EC433EF for ; Wed, 13 Jul 2022 11:46:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236150AbiGMLqc (ORCPT ); Wed, 13 Jul 2022 07:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235725AbiGMLq2 (ORCPT ); Wed, 13 Jul 2022 07:46:28 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0BA010273C; Wed, 13 Jul 2022 04:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BYYELStWS2hN6y0lTADUOUo9y3x8GZgQvz5BQe8u10g=; b=eGZTXGFuiXmNipSFTnNbXYluEh 1LFJOQTJIEzwRokS/1RLy+u2v5hbNyVhM844nZB1XkIEiTuPnUMXDD87S0d5hy+ok/KuYzVcoqdRp h0VGOmgymZd2sM0LxJj0T168PXgRz4nSBzBAET+klvgQNwrMFDTdP4A/G9sIBH60eIaHJn0W1Jegt rV6/JRIPfwEEKhhKY98nQIagYlQHor+z7DzT9GFnIkJXf4NJg6a6//06ejEGiv8RaZszCP1Y3f3Dm 4UnOfFAM+uaJ5+fN4A4+m2Eqgbr0rB3DQx74NhCr7ZHtchzMuk9mnhp6Soao7V/fJoxD7iKMBlDbW LOR54l8w==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBaoo-0088q2-9R; Wed, 13 Jul 2022 11:46:14 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 84AF3300110; Wed, 13 Jul 2022 13:46:11 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 45DBD20D74F04; Wed, 13 Jul 2022 13:46:11 +0200 (CEST) Date: Wed, 13 Jul 2022 13:46:11 +0200 From: Peter Zijlstra To: Juri Lelli Cc: LKML , linux-rt-users , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Subject: Re: [PATCH] sched/deadline: Fix BUG_ON condition for deboosted tasks Message-ID: References: <20220713075014.411739-1-juri.lelli@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220713075014.411739-1-juri.lelli@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 13, 2022 at 09:50:14AM +0200, Juri Lelli wrote: > 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: 2279f540ea7d ("sched/deadline: Fix priority inheritance with multiple scheduling classes") > Signed-off-by: Juri Lelli > --- > kernel/sched/deadline.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index 5867e186c39a..0447d46f4718 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -1703,7 +1703,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) > * the throttle. > */ > p->dl.dl_throttled = 0; > - BUG_ON(!is_dl_boosted(&p->dl) || flags != ENQUEUE_REPLENISH); > + BUG_ON(!(flags & ENQUEUE_REPLENISH)); While there, can we perhaps make it less fatal?