syzbot reported the following warning:
WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 setup_new_dl_entity /kernel/sched/deadline.c:594 [inline]
WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 enqueue_dl_entity /kernel/sched/deadline.c:1370 [inline]
WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 enqueue_task_dl+0x1c17/0x2ba0 /kernel/sched/deadline.c:1441
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 6973 Comm: syz-executor366 Not tainted 4.14.133 #28
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack /lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x19c /lib/dump_stack.c:53
panic+0x1f2/0x426 /kernel/panic.c:182
__warn.cold+0x2f/0x36 /kernel/panic.c:546
report_bug+0x216/0x254 /lib/bug.c:186
fixup_bug /arch/x86/kernel/traps.c:177 [inline]
fixup_bug /arch/x86/kernel/traps.c:172 [inline]
do_error_trap+0x1bb/0x310 /arch/x86/kernel/traps.c:295
do_invalid_op+0x1b/0x20 /arch/x86/kernel/traps.c:314
invalid_op+0x1b/0x40 /arch/x86/entry/entry_64.S:960
RIP: 0010:setup_new_dl_entity /kernel/sched/deadline.c:593 [inline]
RIP: 0010:enqueue_dl_entity /kernel/sched/deadline.c:1370 [inline]
RIP: 0010:enqueue_task_dl+0x1c17/0x2ba0 /kernel/sched/deadline.c:1441
RSP: 0018:ffff888098a3fcd8 EFLAGS: 00010002
RAX: 0000000000000000 RBX: ffffffff87ab2780 RCX: 1ffff1101041413a
RDX: 0000000ad48fb497 RSI: ffff8880aee2c518 RDI: ffff8880820a09d0
RBP: ffff888098a3fd48 R08: ffff8880820a09cc R09: ffff8880820a09c0
R10: ffff8880820a073c R11: 0000000000000001 R12: ffff8880820a0700
R13: ffff8880aee2c500 R14: ffff8880820a0978 R15: ffff8880aee2c500
enqueue_task /kernel/sched/core.c:762 [inline]
__sched_setscheduler+0xd17/0x2510 /kernel/sched/core.c:4227
sched_setattr /kernel/sched/core.c:4285 [inline]
SYSC_sched_setattr /kernel/sched/core.c:4456 [inline]
SyS_sched_setattr+0x1f8/0x300 /kernel/sched/core.c:4435
do_syscall_64+0x1e8/0x640 /arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x446749
RSP: 002b:00007ff022092db8 EFLAGS: 00000246 ORIG_RAX: 000000000000013a
RAX: ffffffffffffffda RBX: 00000000006dbc38 RCX: 0000000000446749
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000000
RBP: 00000000006dbc30 R08: 00007ff022093700 R09: 0000000000000000
R10: 00007ff022093700 R11: 0000000000000246 R12: 00000000006dbc3c
R13: 00007ffdbf86bf7f R14: 00007ff0220939c0 R15: 0000000000000000
This happens because dl_boosted flag is currently not initialized by
__dl_clear_params() (unlike the other flags) and setup_new_dl_entity()
finds complains about it.
Initialize dl_boosted to 0.
Reported-by: [email protected]
Signed-off-by: Juri Lelli <[email protected]>
Tested-by: Daniel Wagner <[email protected]>
---
kernel/sched/deadline.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 504d2f51b0d6..f63f337c7147 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2692,6 +2692,7 @@ void __dl_clear_params(struct task_struct *p)
dl_se->dl_bw = 0;
dl_se->dl_density = 0;
+ dl_se->dl_boosted = 0;
dl_se->dl_throttled = 0;
dl_se->dl_yielded = 0;
dl_se->dl_non_contending = 0;
--
2.26.2
Hi Juri,
On Wed, Jun 17, 2020 at 09:29:19AM +0200, Juri Lelli wrote:
> This happens because dl_boosted flag is currently not initialized by
> __dl_clear_params() (unlike the other flags) and setup_new_dl_entity()
> finds complains about it.
>
> Initialize dl_boosted to 0.
>
> Reported-by: [email protected]
> Signed-off-by: Juri Lelli <[email protected]>
> Tested-by: Daniel Wagner <[email protected]>
Well, as it turns I can't trigger a warning on mainline but pretty simple on
RT (5.6.14-rt7-rt):
invalid opcode: 0000 [#1] PREEMPT_RT SMP NOPTI
CPU: 1 PID: 317 Comm: 0d19f76ecda7c30 Not tainted 5.6.14-rt7-rt #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
RIP: 0010:enqueue_task_dl+0x71/0x3b0
Code: 74 28 41 83 fc 20 75 22 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 4c 8d a8 b8 02 00 00 f6 c2 02 75 0c 8b 45 74 85 c0 78 2
RSP: 0018:ffffc90000673ba8 EFLAGS: 00010002
RAX: ffff88807e87a700 RBX: 00000000ffffffff RCX: 0000000000000078
RDX: 0000000000000002 RSI: 0000000000000078 RDI: ffff88807c52bb80
RBP: ffff88800feda700 R08: ffff88807e87a700 R09: ffffffff81e43ea0
R10: 0000000000000000 R11: 000000000000006d R12: 000000000000002e
R13: 0000000000000078 R14: ffff88807c52bb80 R15: ffff88800feda9b8
FS: 000000000175c880(0000) GS:ffff88807c500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fff9cbfa000 CR3: 000000007c4b2000 CR4: 00000000000006e0
Call Trace:
? dequeue_task_fair+0x67/0x2b0
rt_mutex_setprio+0x39f/0x510
? __switch_to_asm+0x34/0x70
task_blocks_on_rt_mutex+0x2a4/0x390
? __switch_to_asm+0x40/0x70
? __switch_to_asm+0x34/0x70
rt_spin_lock_slowlock_locked+0xb2/0x2c0
? _raw_spin_unlock_irq+0x1d/0x50
? finish_task_switch+0xa0/0x2e0
rt_spin_lock_slowlock+0x51/0x80
__local_bh_disable_ip+0x7f/0xa0
hrtimer_cancel_wait_running+0x31/0x70
hrtimer_cancel+0x1f/0x30
futex_wait+0x1e9/0x240
? __hrtimer_init+0xe0/0xe0
do_futex+0x10a/0x1d0
__x64_sys_futex+0x134/0x162
do_syscall_64+0x69/0x110
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x445b89
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 15 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 8
RSP: 002b:00007fff9cbe2498 EFLAGS: 00000206
ORIG_RAX: 00000000000000ca
RAX: ffffffffffffffda RBX: 00000000004004e8 RCX: 0000000000445b89
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00000000004ca3ec
RBP: 00007fff9cbe24e0 R08: 0000000000003fdc R09: 000000000000002d
R10: 00007fff9cbe24b0 R11: 0000000000000206 R12: 0000000000408bb0
R13: 0000000000000000 R14: 00000000004c8018 R15: 00000000004004e8
Modules linked in:
This looks similar to the one reported here:
[PATCH 0/2] Fix SCHED_DEADLINE nested priority inheritance
https://lore.kernel.org/lkml/[email protected]/
Thanks,
Daniel
Hi,
On 17/06/20 22:49, Daniel Wagner wrote:
> Hi Juri,
>
> On Wed, Jun 17, 2020 at 09:29:19AM +0200, Juri Lelli wrote:
> > This happens because dl_boosted flag is currently not initialized by
> > __dl_clear_params() (unlike the other flags) and setup_new_dl_entity()
> > finds complains about it.
> >
> > Initialize dl_boosted to 0.
> >
> > Reported-by: [email protected]
> > Signed-off-by: Juri Lelli <[email protected]>
> > Tested-by: Daniel Wagner <[email protected]>
>
> Well, as it turns I can't trigger a warning on mainline but pretty simple on
> RT (5.6.14-rt7-rt):
>
> invalid opcode: 0000 [#1] PREEMPT_RT SMP NOPTI
> CPU: 1 PID: 317 Comm: 0d19f76ecda7c30 Not tainted 5.6.14-rt7-rt #2
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
> RIP: 0010:enqueue_task_dl+0x71/0x3b0
> Code: 74 28 41 83 fc 20 75 22 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 4c 8d a8 b8 02 00 00 f6 c2 02 75 0c 8b 45 74 85 c0 78 2
> RSP: 0018:ffffc90000673ba8 EFLAGS: 00010002
>
> RAX: ffff88807e87a700 RBX: 00000000ffffffff RCX: 0000000000000078
> RDX: 0000000000000002 RSI: 0000000000000078 RDI: ffff88807c52bb80
> RBP: ffff88800feda700 R08: ffff88807e87a700 R09: ffffffff81e43ea0
> R10: 0000000000000000 R11: 000000000000006d R12: 000000000000002e
> R13: 0000000000000078 R14: ffff88807c52bb80 R15: ffff88800feda9b8
> FS: 000000000175c880(0000) GS:ffff88807c500000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007fff9cbfa000 CR3: 000000007c4b2000 CR4: 00000000000006e0
> Call Trace:
> ? dequeue_task_fair+0x67/0x2b0
> rt_mutex_setprio+0x39f/0x510
> ? __switch_to_asm+0x34/0x70
> task_blocks_on_rt_mutex+0x2a4/0x390
> ? __switch_to_asm+0x40/0x70
> ? __switch_to_asm+0x34/0x70
> rt_spin_lock_slowlock_locked+0xb2/0x2c0
> ? _raw_spin_unlock_irq+0x1d/0x50
> ? finish_task_switch+0xa0/0x2e0
> rt_spin_lock_slowlock+0x51/0x80
> __local_bh_disable_ip+0x7f/0xa0
> hrtimer_cancel_wait_running+0x31/0x70
> hrtimer_cancel+0x1f/0x30
> futex_wait+0x1e9/0x240
> ? __hrtimer_init+0xe0/0xe0
> do_futex+0x10a/0x1d0
> __x64_sys_futex+0x134/0x162
> do_syscall_64+0x69/0x110
> entry_SYSCALL_64_after_hwframe+0x44/0xa9
> RIP: 0033:0x445b89
> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 15 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 8
> RSP: 002b:00007fff9cbe2498 EFLAGS: 00000206
> ORIG_RAX: 00000000000000ca
> RAX: ffffffffffffffda RBX: 00000000004004e8 RCX: 0000000000445b89
> RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00000000004ca3ec
> RBP: 00007fff9cbe24e0 R08: 0000000000003fdc R09: 000000000000002d
> R10: 00007fff9cbe24b0 R11: 0000000000000206 R12: 0000000000408bb0
> R13: 0000000000000000 R14: 00000000004c8018 R15: 00000000004004e8
> Modules linked in:
>
> This looks similar to the one reported here:
>
> [PATCH 0/2] Fix SCHED_DEADLINE nested priority inheritance
> https://lore.kernel.org/lkml/[email protected]/
I will have a look, thanks.
Best,
Juri
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: 5bf857422d6b36b1edff43348054edd3379d069d
Gitweb: https://git.kernel.org/tip/5bf857422d6b36b1edff43348054edd3379d069d
Author: Juri Lelli <[email protected]>
AuthorDate: Wed, 17 Jun 2020 09:29:19 +02:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Mon, 22 Jun 2020 20:51:05 +02:00
sched/deadline: Initialize dl_boosted
syzbot reported the following warning:
WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 setup_new_dl_entity /kernel/sched/deadline.c:594 [inline]
WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 enqueue_dl_entity /kernel/sched/deadline.c:1370 [inline]
WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 enqueue_task_dl+0x1c17/0x2ba0 /kernel/sched/deadline.c:1441
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 6973 Comm: syz-executor366 Not tainted 4.14.133 #28
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack /lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x19c /lib/dump_stack.c:53
panic+0x1f2/0x426 /kernel/panic.c:182
__warn.cold+0x2f/0x36 /kernel/panic.c:546
report_bug+0x216/0x254 /lib/bug.c:186
fixup_bug /arch/x86/kernel/traps.c:177 [inline]
fixup_bug /arch/x86/kernel/traps.c:172 [inline]
do_error_trap+0x1bb/0x310 /arch/x86/kernel/traps.c:295
do_invalid_op+0x1b/0x20 /arch/x86/kernel/traps.c:314
invalid_op+0x1b/0x40 /arch/x86/entry/entry_64.S:960
RIP: 0010:setup_new_dl_entity /kernel/sched/deadline.c:593 [inline]
RIP: 0010:enqueue_dl_entity /kernel/sched/deadline.c:1370 [inline]
RIP: 0010:enqueue_task_dl+0x1c17/0x2ba0 /kernel/sched/deadline.c:1441
RSP: 0018:ffff888098a3fcd8 EFLAGS: 00010002
RAX: 0000000000000000 RBX: ffffffff87ab2780 RCX: 1ffff1101041413a
RDX: 0000000ad48fb497 RSI: ffff8880aee2c518 RDI: ffff8880820a09d0
RBP: ffff888098a3fd48 R08: ffff8880820a09cc R09: ffff8880820a09c0
R10: ffff8880820a073c R11: 0000000000000001 R12: ffff8880820a0700
R13: ffff8880aee2c500 R14: ffff8880820a0978 R15: ffff8880aee2c500
enqueue_task /kernel/sched/core.c:762 [inline]
__sched_setscheduler+0xd17/0x2510 /kernel/sched/core.c:4227
sched_setattr /kernel/sched/core.c:4285 [inline]
SYSC_sched_setattr /kernel/sched/core.c:4456 [inline]
SyS_sched_setattr+0x1f8/0x300 /kernel/sched/core.c:4435
do_syscall_64+0x1e8/0x640 /arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x446749
RSP: 002b:00007ff022092db8 EFLAGS: 00000246 ORIG_RAX: 000000000000013a
RAX: ffffffffffffffda RBX: 00000000006dbc38 RCX: 0000000000446749
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000000
RBP: 00000000006dbc30 R08: 00007ff022093700 R09: 0000000000000000
R10: 00007ff022093700 R11: 0000000000000246 R12: 00000000006dbc3c
R13: 00007ffdbf86bf7f R14: 00007ff0220939c0 R15: 0000000000000000
This happens because dl_boosted flag is currently not initialized by
__dl_clear_params() (unlike the other flags) and setup_new_dl_entity()
finds complains about it.
Initialize dl_boosted to 0.
Fixes: 2d3d891d3344 ("sched/deadline: Add SCHED_DEADLINE inheritance logic")
Reported-by: [email protected]
Signed-off-by: Juri Lelli <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Tested-by: Daniel Wagner <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
kernel/sched/deadline.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 504d2f5..f63f337 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2692,6 +2692,7 @@ void __dl_clear_params(struct task_struct *p)
dl_se->dl_bw = 0;
dl_se->dl_density = 0;
+ dl_se->dl_boosted = 0;
dl_se->dl_throttled = 0;
dl_se->dl_yielded = 0;
dl_se->dl_non_contending = 0;
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: 1863cc11225e3ea2cd005473f9addc52513ab1bc
Gitweb: https://git.kernel.org/tip/1863cc11225e3ea2cd005473f9addc52513ab1bc
Author: Juri Lelli <[email protected]>
AuthorDate: Wed, 17 Jun 2020 09:29:19 +02:00
Committer: Ingo Molnar <[email protected]>
CommitterDate: Tue, 23 Jun 2020 10:42:39 +02:00
sched/deadline: Initialize ->dl_boosted
syzbot reported the following warning triggered via SYSC_sched_setattr():
WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 setup_new_dl_entity /kernel/sched/deadline.c:594 [inline]
WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 enqueue_dl_entity /kernel/sched/deadline.c:1370 [inline]
WARNING: CPU: 0 PID: 6973 at kernel/sched/deadline.c:593 enqueue_task_dl+0x1c17/0x2ba0 /kernel/sched/deadline.c:1441
This happens because the ->dl_boosted flag is currently not initialized by
__dl_clear_params() (unlike the other flags) and setup_new_dl_entity()
rightfully complains about it.
Initialize dl_boosted to 0.
Fixes: 2d3d891d3344 ("sched/deadline: Add SCHED_DEADLINE inheritance logic")
Reported-by: [email protected]
Signed-off-by: Juri Lelli <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Tested-by: Daniel Wagner <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
kernel/sched/deadline.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 504d2f5..f63f337 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2692,6 +2692,7 @@ void __dl_clear_params(struct task_struct *p)
dl_se->dl_bw = 0;
dl_se->dl_density = 0;
+ dl_se->dl_boosted = 0;
dl_se->dl_throttled = 0;
dl_se->dl_yielded = 0;
dl_se->dl_non_contending = 0;