From: Frederic Weisbecker <frederic@kernel.org>
To: Marco Elver <elver@google.com>
Cc: syzbot <syzbot+3b14b2ed9b3d06dcaa07@syzkaller.appspotmail.com>,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
Thomas Gleixner <tglx@linutronix.de>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Jacob Keller <jacob.e.keller@intel.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: WARNING in timer_wait_running
Date: Thu, 6 Apr 2023 00:19:05 +0200 [thread overview]
Message-ID: <ZC3z2UhQeXENKvrb@lothringen> (raw)
In-Reply-To: <ZC3jDC6R/SGLk5vj@elver.google.com>
On Wed, Apr 05, 2023 at 11:07:24PM +0200, Marco Elver wrote:
> Up-to-date warning:
>
> | WARNING: CPU: 1 PID: 6695 at kernel/time/posix-timers.c:849 timer_wait_running+0x255/0x290 kernel/time/posix-timers.c:849
> | Modules linked in:
> | CPU: 1 PID: 6695 Comm: syz-executor.3 Not tainted 6.3.0-rc3-syzkaller-00338-gda8e7da11e4b #0
> | Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
> | RIP: 0010:timer_wait_running+0x255/0x290 kernel/time/posix-timers.c:849
> | Code: 00 48 c7 c2 80 fe 4e 8a be 06 03 00 00 48 c7 c7 e0 fe 4e 8a c6 05 63 cb ed 0c 01 e8 85 77 ef ff e9 5b fe ff ff e8 2b 7d 0e 00 <0f> 0b e9 b2 fe ff ff e8 0f 8a 5f 00 e9 fe fd ff ff e8 25 8a 5f 00
> | RSP: 0018:ffffc90003ecfd50 EFLAGS: 00010293
> | RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
> | RDX: ffff888020e4ba80 RSI: ffffffff81746785 RDI: ffffffff8a4f0ad8
> | RBP: ffff88807c696d38 R08: 0000000000000001 R09: 0000000000000001
> | R10: fffffbfff1cef98a R11: 0000000000000021 R12: ffffc90003ecfdb0
> | R13: 0000000000000000 R14: ffffffff8a4f0a60 R15: ffffc90003ecfdb0
> | FS: 00007fae387fe700(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
> | CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> | CR2: 00007f0d105821b8 CR3: 000000002a283000 CR4: 00000000003526e0
> | DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> | DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> | Call Trace:
> | <TASK>
> | do_timer_settime.part.0+0x119/0x1d0 kernel/time/posix-timers.c:929
> | do_timer_settime kernel/time/posix-timers.c:938 [inline]
> | __do_sys_timer_settime kernel/time/posix-timers.c:952 [inline]
> | __se_sys_timer_settime kernel/time/posix-timers.c:938 [inline]
> | __x64_sys_timer_settime+0x21d/0x310 kernel/time/posix-timers.c:938
> | do_syscall_x64 arch/x86/entry/common.c:50 [inline]
> | do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
> | entry_SYSCALL_64_after_hwframe+0x63/0xcd
> | RIP: 0033:0x7fae3948c0f9
> | Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
> | RSP: 002b:00007fae387fe168 EFLAGS: 00000246 ORIG_RAX: 00000000000000df
> | RAX: ffffffffffffffda RBX: 00007fae395ac050 RCX: 00007fae3948c0f9
> | RDX: 0000000020000080 RSI: 0000000000000000 RDI: 0000000000000000
> | RBP: 00007fae394e7b39 R08: 0000000000000000 R09: 0000000000000000
> | R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
> | R13: 00007fae396cfb1f R14: 00007fae387fe300 R15: 0000000000022000
> | </TASK>
>
> I've seen this warning in the wild recently, and it's been around since
> 2020 according to syzbot.
>
> The warning was added in ec8f954a40da8 ("posix-timers: Use a callback
> for cancel synchronization on PREEMPT_RT").
>
> Why is it wrong for timer_wait_running to be NULL?
It appears to concern clock_posix_cpu which indeed doesn't implement
->timer_wait_running even though posix_cpu_timer_set() might return
TIMER_RETRY if the timer is about to fire.
Then on RT and if CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y then
timer_wait_running() must busy loop waiting for the task to complete
the task work.
We could arrange for doing the same thing as hrtimer_cancel_wait_running()
but for posix cpu timers, with taking a similar lock within
handle_posix_cpu_timers() that timer_wait_running() could sleep on and
inject its PI into.
Thomas, Anna-Maria, would that make sense?
Thanks.
next prev parent reply other threads:[~2023-04-05 22:19 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 [this message]
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 ` WARNING in timer_wait_running Frederic Weisbecker
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=ZC3z2UhQeXENKvrb@lothringen \
--to=frederic@kernel.org \
--cc=anna-maria@linutronix.de \
--cc=elver@google.com \
--cc=jacob.e.keller@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.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).