From: luca abeni <luca.abeni@santannapisa.it>
To: "chengjian (D)" <cj.chengjian@huawei.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Li Bin <huawei.libin@huawei.com>,
"Xiexiuqi (Xie XiuQi)" <xiexiuqi@huawei.com>, <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: WARN ON at kernel/sched/deadline.c task_non_contending
Date: Tue, 12 Mar 2019 08:59:22 +0100 [thread overview]
Message-ID: <20190312085922.13895cae@nowhere> (raw)
In-Reply-To: <dfb46874-3657-71c6-e068-9413ffe3f82e@huawei.com>
Hi all,
On Tue, 12 Mar 2019 10:03:12 +0800
"chengjian (D)" <cj.chengjian@huawei.com> 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.
>
>
>
next prev parent reply other threads:[~2019-03-12 8:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-12 2:03 WARN ON at kernel/sched/deadline.c task_non_contending chengjian (D)
2019-03-12 7:59 ` luca abeni [this message]
2019-03-13 14:49 ` luca abeni
2019-03-15 0:43 ` chengjian (D)
2019-03-15 11:06 ` luca abeni
2019-03-22 14:32 ` Juri Lelli
2019-03-22 14:38 ` luca abeni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190312085922.13895cae@nowhere \
--to=luca.abeni@santannapisa.it \
--cc=cj.chengjian@huawei.com \
--cc=huawei.libin@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=xiexiuqi@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox