Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp251787imw; Thu, 14 Jul 2022 00:41:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uBI8O07GFg15ZILGXJSHK5p87JUURUJZRbsR+iBOqpIR+iD9GMAil2+1YlSnfZGdJHVPcC X-Received: by 2002:a17:907:7245:b0:726:a909:902e with SMTP id ds5-20020a170907724500b00726a909902emr7457779ejc.308.1657784482681; Thu, 14 Jul 2022 00:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657784482; cv=none; d=google.com; s=arc-20160816; b=gxZR5u9jbhbcjopGGU/0YsIgyVleonQkOkj5hiDaj+tPyUEUKsVc1CS9T695oawq7j 26dXPcQ3I91pAcq5R3d5oOGkXUXim/J/1AymFg3RQs8Ne7nZPRoFdOJvQJejoexdHWNi k5ExdyerUYPIEZntAoiLJRa0k2TydkysTYTUHyrqz0qVDx4Zv5ymO3YOWEmK/Vcoreni BeqcTpCE+7Otai3va8YSaZE5j2iFd5EkHQfXIPbthPtBaBmPmOKOOVHyKR/XYdfzwBDa tAOyV5kXuwRm2MaWelQiy+L7k95K0nY+NtSjJRssE57jxOz1JH0J9MElxkuYRlixWNP8 U5/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=550DnVq2EPGtnDKY2qpgJkb609RpXGjFmRJ5BQ0wADQ=; b=gf8tOcfquKUI6OE4HrUjad2Lux+cQYQJaubm/inT0OMv9tda+0JXy+FV5zUxI/USXJ /5FTxjIupppP/H4pbhTKt73HRJALUdcs0LQcoQYVFKndNvC20YrLVs2aBK3YLbURtKZH kN0z1eaWbT2I+anywBug78G9fOzTD+5b1OVj1uYUmLkiBsm5evQEBXA2ppZDdELwH+np qnWqUYHNO9IsBrdoEaXnsbZXOif9bf9X7nrwPt6lY326WUxnm8b2SfmjvsUEYnRzId3l NzJBAx2TMrRwIX6jn6LUYuILBOYBq+ylOv5Bas7YsRGE4O4UW4MZcYU211rR/FXSyCVJ Lvdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P+xLCBec; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a0564020f0900b00435a9115e94si1274237eda.38.2022.07.14.00.40.58; Thu, 14 Jul 2022 00:41:22 -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=@redhat.com header.s=mimecast20190719 header.b=P+xLCBec; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229928AbiGNH2S (ORCPT + 99 others); Thu, 14 Jul 2022 03:28:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbiGNH2Q (ORCPT ); Thu, 14 Jul 2022 03:28:16 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B3D1C1A828 for ; Thu, 14 Jul 2022 00:28:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657783694; 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=550DnVq2EPGtnDKY2qpgJkb609RpXGjFmRJ5BQ0wADQ=; b=P+xLCBecwV1KC1JADtA9/PxknsssNbIW9Q3zNe/2fiRMwD674+3jtzjKbGfTl68MQdo27L ycQi9b9kHBK0CnG++k7SxnnEUyh2WMqSaZXC8ej+KBorFhHImfHB19qBBpcD1w28IE49TL ifl3mhsZO8/oFoj+lvrGSBfYhzrQzA8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-427-3Hdg676JOoS_vO6uj_Zvjw-1; Thu, 14 Jul 2022 03:28:13 -0400 X-MC-Unique: 3Hdg676JOoS_vO6uj_Zvjw-1 Received: by mail-wm1-f71.google.com with SMTP id c17-20020a7bc011000000b003a2bfaf8d3dso285179wmb.0 for ; Thu, 14 Jul 2022 00:28:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=550DnVq2EPGtnDKY2qpgJkb609RpXGjFmRJ5BQ0wADQ=; b=XUs1q8WinLxs0tEkmVvZ+UX+V6FRsNJKFoIaC6OH+/oVhw30jELasewTkAcyh0drHW SRxqZqs5gmFHA4pcsW9OHOoq00tX8EtgzF7HEESQvISDpXVICKpbsSgo/PrUzTJRMHlQ KAJGD+VPRewD+kbVoSc2gfS3zy2r3we92EsN62lD+ImjMSkxER6jCgK1yHxQ9hRZHIR6 H7JoDrWsTzqYo/giZoxANnrMV3QaUZjkdhexkvkbqUGkj6yKz/PQdsZd00TSXVTRIjHI joGJIH+mkcBNYf1Jo3JexFBuqiYJmXIhFuK78DOZmkhz/6DetlXAf6tuolbXXC7ry0R2 bOJg== X-Gm-Message-State: AJIora+uu1vKzDeo33AIRr6chsm1ZM03cj7hqoSzYw/7xiYgielZhIVw mh60oCJlK3u3xeclO+EhHo9xjVvY2MDs+CVVu8WUHRwDG4n9aaaInK6JSkoYpCPuUpJWAOUGbe5 xwmfYcDz3Hv+QKma0G7yehpc0 X-Received: by 2002:a05:6000:184f:b0:21d:a1fb:4581 with SMTP id c15-20020a056000184f00b0021da1fb4581mr7101580wri.651.1657783692019; Thu, 14 Jul 2022 00:28:12 -0700 (PDT) X-Received: by 2002:a05:6000:184f:b0:21d:a1fb:4581 with SMTP id c15-20020a056000184f00b0021da1fb4581mr7101549wri.651.1657783691723; Thu, 14 Jul 2022 00:28:11 -0700 (PDT) Received: from localhost.localdomain ([151.29.54.26]) by smtp.gmail.com with ESMTPSA id r3-20020adfe683000000b0021004d7d75asm705037wrm.84.2022.07.14.00.28.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 00:28:11 -0700 (PDT) Date: Thu, 14 Jul 2022 09:28:08 +0200 From: Juri Lelli To: "Srivatsa S. Bhat" Cc: LKML , linux-rt-users , Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Sharan Turlapati , bordoloih@vmware.com, ankitja@vmware.com, Keerthana K , Anish Swaminathan , Srivatsa Bhat Subject: Re: [PATCH] sched/deadline: Fix BUG_ON condition for deboosted tasks Message-ID: References: <20220713075014.411739-1-juri.lelli@redhat.com> <806a86d3-5204-145e-af46-023bf0142aa8@csail.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <806a86d3-5204-145e-af46-023bf0142aa8@csail.mit.edu> X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Hi, On 13/07/22 14:31, Srivatsa S. Bhat wrote: > > Hi Juri, > > On 7/13/22 12:50 AM, 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") > > It looks like this problem goes further back than the above commit > (which was merged in v5.10). > > Even the oldest LTS kernel (4.9) has code like this: > > if (... && p->dl.dl_boosted && ...)) { > /* code */ > > } else if (!dl_prio(p->normal_prio)) { > > BUG_ON(!p->dl.dl_boosted || flags != ENQUEUE_REPLENISH); > return; > } > > And we have observed crashes in the 4.19 kernel series too (CC'ed > Ankit Jain and Him Kalyan who have reproduced this issue). > > I believe commit 64be6f1f5f71 ("sched/deadline: Don't replenish from a > !SCHED_DEADLINE entity") introduced the problem, which dates back to > v3.18. > > Would you mind updating the Fixes: tag and adding a CC: stable tag as > well, when you respin the patch, please? I think you are right. Will do. Thanks for taking a look! Best, Juri