Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1856271imc; Tue, 12 Mar 2019 02:00:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzO6T+NVVyZfV5O9xmCMt3ikPs9loRk6gl2fqoPVFZ7fAcen03KIjdgBfB2pNwrfFzg7hAK X-Received: by 2002:a17:902:7682:: with SMTP id m2mr39195790pll.311.1552381233164; Tue, 12 Mar 2019 02:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552381233; cv=none; d=google.com; s=arc-20160816; b=pT79deNHSsmjmr4b+GQFw5oZtxJ35Iax+JShT6DQ0xfOq6w/S7RSbAa87ZrsHtsSN5 Yrj4T8x7p0amJHcbpMFpZ8xXVndHPRm7x5MulM67xbnXuTo9wB3aMBYUzyXXWZHOPhN1 dwk0es51Su670jrdqvbwS97sUT6bHPLhkYRglaqM4kXoe3BZqLFgre025Xiotu4ZY5qd V/1uxIW/GRe3AYmrXnUcSUdhy318JTYPeOw8JpAMaiPJH74iLiGO/B454iWdUW0yqmBO bz84jkHA+n8j4z9nhKXP9ETcgl00GnwXpIzH9vYtlCuE4ox92geEX8ZXrw9kZJwhbyzE OfeQ== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=dooDPTbfoZ4NVWuuPO2E8TA2KxRPGklupwQKRbutpY0=; b=IE+pKZJhWZzzgzeVC26eIvgeW4LMPhEQgvIl7GE+fwYTwFOZRFKE6DDzWjLASZvS+U 8JXcIOL5HQAbss3JT7yFegY03KxWdLmDufweqa/jVuP8Zf0tz5+5GCEIjlwPk6i3N9hE OuinHHLYR2/6DZNcpPPmhT8Jji/V98+YcRxfdE9eANUw8SuNJnwLALP7tiXi4EXXKqqe NX0dOxC1JErPXLWHIEpX92UFT5WcPQ5MFYdAJcdUrkQQ5S9e3DaQaA6sf/hlgqp6CarC /8I86TAASh1Bam9dfuJYBz7P7Ax3UOdnWfa//1NUAAm0dzCns+9a8CE0DfoC54zlyr21 vcBA== ARC-Authentication-Results: i=1; mx.google.com; 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 x20si670956plr.16.2019.03.12.02.00.17; Tue, 12 Mar 2019 02:00:33 -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; 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 S1727648AbfCLI7c convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 Mar 2019 04:59:32 -0400 Received: from ms01.santannapisa.it ([193.205.80.98]:52354 "EHLO mail.santannapisa.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbfCLI7b (ORCPT ); Tue, 12 Mar 2019 04:59:31 -0400 X-Greylist: delayed 3601 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 Mar 2019 04:59:30 EDT Received: from [10.1.195.109] (account l.abeni@santannapisa.it HELO nowhere) by santannapisa.it (CommuniGate Pro SMTP 6.1.11) with ESMTPSA id 137197463; Tue, 12 Mar 2019 08:59:27 +0100 Date: Tue, 12 Mar 2019 08:59:22 +0100 From: luca abeni To: "chengjian (D)" Cc: "linux-kernel@vger.kernel.org" , Li Bin , "Xiexiuqi (Xie XiuQi)" , , Peter Zijlstra Subject: Re: WARN ON at kernel/sched/deadline.c task_non_contending Message-ID: <20190312085922.13895cae@nowhere> In-Reply-To: References: Organization: Scuola Superiore S.Anna X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) 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 Hi all, On Tue, 12 Mar 2019 10:03:12 +0800 "chengjian (D)" wrote: > Hi. > > When looking to test SCHED_DEADLINE syzkaller report an warn in > task_non_contending(). I tested the mainline kernel with the C program > and captured the same call trace. [...] > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index 31c050a0d0ce..d73cb033a06d 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -252,7 +252,6 @@ static void task_non_contending(struct > task_struct *p) 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 - > @@ -287,7 +286,9 @@ static void task_non_contending(struct > task_struct *p) } > >         dl_se->dl_non_contending = 1; > -       get_task_struct(p); > + > +       if (!hrtimer_active(&dl_se->inactive_timer)); > +               get_task_struct(p); >         hrtimer_start(timer, ns_to_ktime(zerolag_time), > HRTIMER_MODE_REL); } At a first glance, I think the patch is OK, but I need some more time to look at the details. I'll run some experiments with the reproducer, and I'll let you know my conclusions. > Did I miss something ? > > I saw it directly remove the hrtimer in hrtime_start() if hrtime is > queued, it may be unsafe here when the timer handler is running. This is probably why I added that WARN_ON()... I'll look at a possible solution. Thanks, Luca > > Help ? > > I put the syzkaller log and C demo in attachments. > > Thanks. > > >