Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4810098yba; Tue, 30 Apr 2019 04:53:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxI6UBze+SlvShI6Wt6FMZkrhNwcoW3xopTcwcyCqDtxPk8XDhh+e7mCiQpi9IG6RIJ84Gs X-Received: by 2002:a17:902:2b89:: with SMTP id l9mr14580254plb.331.1556625205842; Tue, 30 Apr 2019 04:53:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625205; cv=none; d=google.com; s=arc-20160816; b=IRle7nWM2RsrB4c6NdpTsaAExl75SPEn77jhsDvGT9bJVZ+CzBGhFt46LxPRgo695O BUHz3vBx8AF1liDSEg5Rk0TyjtKQkO0pk3gllHtBrGq64F9cXTbMvhR2LIJgRHKZxYT2 OGweepHFhJ9xG7gFgvIMRBZe/pj2sjwOWBgDHtuFGQu4fF1ZGVqXKhVwjysf1heqi3Tn bvwdqhzLw/K0y5bpGa9P2a60nFfsTSNstFLIVOe0srkT1353/kxUL3nF2Na3LOkhoVZG sumKhtZqQcOvUnhm8tRwmxLSIq7sscvRhldcmuiuEYtsWMjANiuntovq6h1NKfc02CGP eM2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=um0f3bHAhUBwlbF5f1kVG2/q/H34FIhRdBfReAxW6Is=; b=GtWTcOiOAtC6fL+uGlRDJ01UJ0BszAQeGT9Yl3kEK3rmJaxdeElMaXMaUIZIw13C/N CEhk1gaG2hdlFnTL9mQKDyfV2kLFs3uFeyWK6dE8QzW1L+wmXCIM/TJbw2QmAgG9KxbR NoDW1dd6IAUgER3bpPrmlz6YVCg7vpDfnGiHgyDdAl+R6d2S+bTrlOdSHmyZ3FGh27kF nY+GrMEkAwh1STKdq6+zGbWlrcVhHPZTs/zJMdPkHd+lq9v2rPh3/6Cjx9GGLsjAgNDo mExSKlLgootURVOitQbztOujisKxbToqqMPX8rM0GnFw+DbCuFFJ4Se8cAvwX265jire icdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QICrzOo5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s123si12853216pfs.215.2019.04.30.04.53.10; Tue, 30 Apr 2019 04:53:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QICrzOo5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731433AbfD3Lvl (ORCPT + 99 others); Tue, 30 Apr 2019 07:51:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:39556 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731423AbfD3Lvi (ORCPT ); Tue, 30 Apr 2019 07:51:38 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AC57021670; Tue, 30 Apr 2019 11:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556625098; bh=RlH34TrqR6+L8TPt7VcRdcG/xgNAd0vIlgQsh/n2KoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QICrzOo5sa3XKcWsoWZHp/woMYHBuGg25vPmSxtRmzqz0djnGTPjOizhnSgfW3Mu5 +gyDvyKTK2qF2WEYnrjVTnUc9km9nDPtptdldATd38lEKO2xRpx9cvsRKNTdlfBc/z i4iP/oTFfXO7qhjCk18zElqLfNjYLxVmaAIZlG80= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, luca abeni , "Peter Zijlstra (Intel)" , Juri Lelli , Linus Torvalds , Thomas Gleixner , "chengjian (D)" , Ingo Molnar Subject: [PATCH 5.0 54/89] sched/deadline: Correctly handle active 0-lag timers Date: Tue, 30 Apr 2019 13:38:45 +0200 Message-Id: <20190430113612.212524332@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113609.741196396@linuxfoundation.org> References: <20190430113609.741196396@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: luca abeni commit 1b02cd6a2d7f3e2a6a5262887d2cb2912083e42f upstream. syzbot reported the following warning: [ ] WARNING: CPU: 4 PID: 17089 at kernel/sched/deadline.c:255 task_non_contending+0xae0/0x1950 line 255 of deadline.c is: WARN_ON(hrtimer_active(&dl_se->inactive_timer)); in task_non_contending(). Unfortunately, in some cases (for example, a deadline task continuosly blocking and waking immediately) it can happen that a task blocks (and task_non_contending() is called) while the 0-lag timer is still active. In this case, the safest thing to do is to immediately decrease the running bandwidth of the task, without trying to re-arm the 0-lag timer. Signed-off-by: luca abeni Signed-off-by: Peter Zijlstra (Intel) Acked-by: Juri Lelli Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: chengjian (D) Link: https://lkml.kernel.org/r/20190325131530.34706-1-luca.abeni@santannapisa.it Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- kernel/sched/deadline.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -252,7 +252,6 @@ static void task_non_contending(struct t if (dl_entity_is_special(dl_se)) return; - WARN_ON(hrtimer_active(&dl_se->inactive_timer)); WARN_ON(dl_se->dl_non_contending); zerolag_time = dl_se->deadline - @@ -269,7 +268,7 @@ static void task_non_contending(struct t * If the "0-lag time" already passed, decrease the active * utilization now, instead of starting a timer */ - if (zerolag_time < 0) { + if ((zerolag_time < 0) || hrtimer_active(&dl_se->inactive_timer)) { if (dl_task(p)) sub_running_bw(dl_se, dl_rq); if (!dl_task(p) || p->state == TASK_DEAD) {