linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Hillf Danton <hdanton@sina.com>
Cc: Marco Elver <elver@google.com>,
	syzbot <syzbot+3b14b2ed9b3d06dcaa07@syzkaller.appspotmail.com>,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: WARNING in timer_wait_running
Date: Fri, 7 Apr 2023 16:49:09 +0200	[thread overview]
Message-ID: <ZDAtZWrly6Hzieip@lothringen> (raw)
In-Reply-To: <20230407134620.1034-1-hdanton@sina.com>

On Fri, Apr 07, 2023 at 09:46:20PM +0800, Hillf Danton wrote:
> On 5 Apr 2023 23:07:24 +0200 Marco Elver <elver@google.com>
> > On Mon, Aug 31, 2020 at 10:07AM -0700, syzbot wrote:
> > > Hello,
> > > 
> > > syzbot found the following issue on:
> > > 
> > > HEAD commit:    1127b219 Merge tag 'fallthrough-fixes-5.9-rc3' of git://gi..
> > > git tree:       upstream
> > > console output: https://syzkaller.appspot.com/x/log.txt?x=1501768e900000
> > > kernel config:  https://syzkaller.appspot.com/x/.config?x=978db74cb30aa994
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=3b14b2ed9b3d06dcaa07
> > 
> > Dashboard has recent reports (also below) and reproducer (also attached).
> 
> My 2c, with PREEMPT_RT enabled it simply waits by taking timer->it_lock.
> 
> --- upstream/kernel/time/posix-cpu-timers.c
> +++ y/kernel/time/posix-cpu-timers.c
> @@ -1613,6 +1613,21 @@ static int thread_cpu_timer_create(struc
>  	return posix_cpu_timer_create(timer);
>  }
>  
> +static void posix_cpu_timer_wait_running(struct k_itimer *timer)
> +{
> +#ifdef CONFIG_PREEMPT_RT
> +	int stop = 0;
> +
> +	while (!stop) {
> +		spin_lock(&timer->it_lock);
> +		stop = timer->it.cpu.firing == 0;
> +		spin_unlock(&timer->it_lock);
> +	}

No, because there is a whole lot of preemptible area with timer->it_lock
not held between the time ctmr->firing is set to 1, and the actual handling
of that timer that holds the lock.

So no priority inheritance in that case.

There has to be a lock between the time it is set to 1 and the handling
of the timer.

      parent reply	other threads:[~2023-04-07 14:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 17:07 WARNING in timer_wait_running syzbot
2023-04-05 21:07 ` Marco Elver
2023-04-05 22:19   ` Frederic Weisbecker
2023-04-06 19:37     ` Thomas Gleixner
2023-04-07  8:44       ` Thomas Gleixner
2023-04-07 11:50         ` Frederic Weisbecker
2023-04-07 17:47           ` Thomas Gleixner
2023-04-07 18:36             ` Frederic Weisbecker
2023-04-07 19:27               ` Thomas Gleixner
2023-04-07 21:00                 ` Frederic Weisbecker
2023-04-11 14:31                 ` Marco Elver
2023-04-17 13:37                   ` [PATCH] posix-cpu-timers: Implement the missing timer_wait_running callback Thomas Gleixner
2023-04-17 15:34                     ` Sebastian Andrzej Siewior
2023-04-18  6:00                     ` Marco Elver
2023-04-18 16:44                     ` Frederic Weisbecker
2023-04-19  7:33                       ` Thomas Gleixner
2023-04-19  8:33                     ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-04-20  7:51                     ` tip-bot2 for Thomas Gleixner
2023-04-21 13:43                     ` tip-bot2 for Thomas Gleixner
     [not found] ` <20230407134620.1034-1-hdanton@sina.com>
2023-04-07 14:49   ` Frederic Weisbecker [this message]

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=ZDAtZWrly6Hzieip@lothringen \
    --to=frederic@kernel.org \
    --cc=elver@google.com \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+3b14b2ed9b3d06dcaa07@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).