frequent lockups in 3.18rc4
Subsystems (8)
I'm not sure how long this goes back (3.17 was fine afair) but I'm seeing these several times a day lately..
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c129:25570]
irq event stamp: 74224 hardirqs last enabled at (74223): [<ffffffff9c875664>] restore_args+0x0/0x30 hardirqs last disabled at (74224): [<ffffffff9c8759aa>] apic_timer_interrupt+0x6a/0x80 softirqs last enabled at (74222): [<ffffffff9c07f43a>] __do_softirq+0x26a/0x6f0 softirqs last disabled at (74209): [<ffffffff9c07fb4d>] irq_exit+0x13d/0x170 CPU: 3 PID: 25570 Comm: trinity-c129 Not tainted 3.18.0-rc4+ #83 [loadavg: 198.04 186.66 181.58 24/442 26708] task: ffff880213442f00 ti: ffff8801ea714000 task.ti: ffff8801ea714000 RIP: 0010:[<ffffffff9c11e98a>] [<ffffffff9c11e98a>] generic_exec_single+0xea/0x1d0 RSP: 0018:ffff8801ea717a08 EFLAGS: 00000202 RAX: ffff880213442f00 RBX: ffffffff9c875664 RCX: 0000000000000006 RDX: 0000000000001370 RSI: ffff880213443790 RDI: ffff880213442f00 RBP: ffff8801ea717a68 R08: ffff880242b56690 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801ea717978 R13: ffff880213442f00 R14: ffff8801ea714000 R15: ffff880213442f00 FS: 00007f240994e700(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000004 CR3: 000000019a017000 CR4: 00000000001407e0 DR0: 00007fb3367e0000 DR1: 00007f82542ab000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffffffff9ce4c620 0000000000000000 ffffffff9c048b20 ffff8801ea717b18 0000000000000003 0000000052e0da3d ffffffff9cc7ef3c 0000000000000002 ffffffff9c048b20 ffff8801ea717b18 0000000000000001 0000000000000003 Call Trace: [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c11ead6>] smp_call_function_single+0x66/0x110 [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c11f021>] smp_call_function_many+0x2f1/0x390 [<ffffffff9c049300>] flush_tlb_mm_range+0xe0/0x370 [<ffffffff9c1d95a2>] tlb_flush_mmu_tlbonly+0x42/0x50 [<ffffffff9c1d9cb5>] tlb_finish_mmu+0x45/0x50 [<ffffffff9c1daf59>] zap_page_range_single+0x119/0x170 [<ffffffff9c1db140>] unmap_mapping_range+0x140/0x1b0 [<ffffffff9c1c7edd>] shmem_fallocate+0x43d/0x540 [<ffffffff9c0b111b>] ? preempt_count_sub+0xab/0x100 [<ffffffff9c0cdac7>] ? prepare_to_wait+0x27/0x80 [<ffffffff9c2287f3>] ? __sb_start_write+0x103/0x1d0 [<ffffffff9c223aba>] do_fallocate+0x12a/0x1c0 [<ffffffff9c1f0bd3>] SyS_madvise+0x3d3/0x890 [<ffffffff9c1a40d2>] ? context_tracking_user_exit+0x52/0x260 [<ffffffff9c013ebd>] ? syscall_trace_enter_phase2+0x10d/0x3d0 [<ffffffff9c874c89>] tracesys_phase2+0xd4/0xd9 Code: 63 c7 48 89 de 48 89 df 48 c7 c2 c0 50 1d 00 48 03 14 c5 40 b9 f2 9c e8 d5 ea 2b 00 84 c0 74 0b e9 bc 00 00 00 0f 1f 40 00 f3 90 <f6> 43 18 01 75 f8 31 c0 48 8b 4d c8 65 48 33 0c 25 28 00 00 00 Kernel panic - not syncing: softlockup: hung tasks
I've got a local hack to dump loadavg on traces, and as you can see in that example, the machine was really busy, but we were at least making progress before the trace spewed, and the machine rebooted. (I have reboot-on-lockup sysctl set, without it, the machine just wedges indefinitely shortly after the spew).
The trace doesn't really enlighten me as to what we should be doing to prevent this though.
ideas?
I can try to bisect it, but it takes hours before it happens, so it might take days to complete, and the next few weeks are complicated timewise..
Dave
Quoted 2 lines · Dave Jones
I'm not sure how long this goes back (3.17 was fine afair) but I'm seeing these several times a day lately..
Hmm. I don't see what would have changed in this area since v3.17. There's a TLB range fix in mm/memory.c, but for the life of me I can't see how that would possibly matter the way x86 does TLB flushing (if the range fix does something bad and the range goes too large, x86 will just end up doing a full TLB invalidate instead).
Plus, judging by the fact that there's a stale "leave_mm+0x210/0x210" (wouldn't that be the *next* function, namely do_flush_tlb_all()) pointer on the stack, I suspect that whole range-flushing doesn't even trigger, and we are flushing everything.
But since you say "several times a day", just for fun, can you test the follow-up patch to that one-liner fix that Will Deacon posted today (Subject: "[PATCH] mmu_gather: move minimal range calculations into generic code"). That does some further cleanup in this area.
I don't see any changes to the x86 IPI or TLB flush handling, but maybe I'm missing something, so I'm adding the x86 maintainers to the cc.
Quoted 9 lines
I've got a local hack to dump loadavg on traces, and as you can see in that example, the machine was really busy, but we were at least making progress before the trace spewed, and the machine rebooted. (I have reboot-on-lockup sysctl set, without it, the machine just wedges indefinitely shortly after the spew).
The trace doesn't really enlighten me as to what we should be doing to prevent this though.
ideas?
I can't say I have any ideas except to point at the TLB range patch, and quite frankly, I don't see how that would matter.
If Will's patch doesn't make a difference, what about reverting that ce9ec37bddb6? Although it really *is* a "obvious bugfix", and I really don't see why any of this would be noticeable on x86 (it triggered issues on ARM64, but that was because ARM64 cared much more about the exact range).
Quoted 3 lines
I can try to bisect it, but it takes hours before it happens, so it might take days to complete, and the next few weeks are complicated timewise..
Hmm. Even narrowing it down a bit might help, ie if you could get say four bisections in over a day, and see if that at least says "ok, it's likely one of these pulls".
But yeah, I can see it being painful, so maybe a quick check of the TLB ones, even if I can't for the life see why they would possibly matter.
Linus
---
Quoted 24 lines
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c129:25570]
irq event stamp: 74224 hardirqs last enabled at (74223): [<ffffffff9c875664>] restore_args+0x0/0x30 hardirqs last disabled at (74224): [<ffffffff9c8759aa>] apic_timer_interrupt+0x6a/0x80 softirqs last enabled at (74222): [<ffffffff9c07f43a>] __do_softirq+0x26a/0x6f0 softirqs last disabled at (74209): [<ffffffff9c07fb4d>] irq_exit+0x13d/0x170 CPU: 3 PID: 25570 Comm: trinity-c129 Not tainted 3.18.0-rc4+ #83 [loadavg: 198.04 186.66 181.58 24/442 26708] RIP: 0010:[<ffffffff9c11e98a>] [<ffffffff9c11e98a>] generic_exec_single+0xea/0x1d0 Call Trace: [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c11ead6>] smp_call_function_single+0x66/0x110 [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c11f021>] smp_call_function_many+0x2f1/0x390 [<ffffffff9c049300>] flush_tlb_mm_range+0xe0/0x370 [<ffffffff9c1d95a2>] tlb_flush_mmu_tlbonly+0x42/0x50 [<ffffffff9c1d9cb5>] tlb_finish_mmu+0x45/0x50 [<ffffffff9c1daf59>] zap_page_range_single+0x119/0x170 [<ffffffff9c1db140>] unmap_mapping_range+0x140/0x1b0 [<ffffffff9c1c7edd>] shmem_fallocate+0x43d/0x540 [<ffffffff9c223aba>] do_fallocate+0x12a/0x1c0 [<ffffffff9c1f0bd3>] SyS_madvise+0x3d3/0x890 [<ffffffff9c874c89>] tracesys_phase2+0xd4/0xd9 Kernel panic - not syncing: softlockup: hung tasks
Quoted 9 lines · Linus Torvalds
Plus, judging by the fact that there's a stale "
leave_mm+0x210/0x210" (wouldn't that be the *next* function, namelydo_flush_tlb_all()) pointer on the stack, I suspect that whole range-flushing doesn't even trigger, and we are flushing everything.But since you say "several times a day", just for fun, can you test the follow-up patch to that one-liner fix that Will Deacon posted today (Subject: "[PATCH]
mmu_gather: move minimal range calculations into generic code"). That does some further cleanup in this area.
I'll give it a shot. Should know by the morning if it changes anything.
Quoted 5 lines
Quoted 4 lines
The trace doesn't really enlighten me as to what we should be doing to prevent this though.
ideas?
Quoted 8 lines
I can't say I have any ideas except to point at the TLB range patch, and quite frankly, I don't see how that would matter.
If Will's patch doesn't make a difference, what about reverting that
ce9ec37bddb6? Although it really *is* a "obvious bugfix", and I really don't see why any of this would be noticeable on x86 (it triggered issues on ARM64, but that was because ARM64 cared much more about the exact range).
Digging through the serial console logs, there was one other trace variant, which is even less informative..
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c104:19168]
irq event stamp: 223186 hardirqs last enabled at (223185): [<ffffffff941a4092>] context_tracking_user_exit+0x52/0x260 hardirqs last disabled at (223186): [<ffffffff948756aa>] apic_timer_interrupt+0x6a/0x80 softirqs last enabled at (187030): [<ffffffff9407f43a>] __do_softirq+0x26a/0x6f0 softirqs last disabled at (187017): [<ffffffff9407fb4d>] irq_exit+0x13d/0x170 CPU: 3 PID: 19168 Comm: trinity-c104 Not tainted 3.18.0-rc4+ #82 [loadavg: 99.30 85.88 82.88 9/303 19302] task: ffff88023f8b4680 ti: ffff880157418000 task.ti: ffff880157418000 RIP: 0010:[<ffffffff941a4094>] [<ffffffff941a4094>] context_tracking_user_exit+0x54/0x260 RSP: 0018:ffff88015741bee8 EFLAGS: 00000246 RAX: ffff88023f8b4680 RBX: ffffffff940b111b RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff88023f8b4680 RBP: ffff88015741bef8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: ffff88015741bf58 R14: ffff88023f8b4ae8 R15: ffff88023f8b4b18 FS: 00007f9a0789b740(0000) GS:ffff880244e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000003dfa1b7c90 CR3: 0000000165f3c000 CR4: 00000000001407e0 DR0: 00000000ffffffbf DR1: 00007f2c0c3d9000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: 0000000000080000 ffff88015741c000 ffff88015741bf78 ffffffff94013d35 ffff88015741bf28 ffffffff940d865d 0000000000004b02 0000000000000000 00007f9a071bb000 ffffffff943d816b 0000000000000000 0000000000000000 Call Trace: [<ffffffff94013d35>] syscall_trace_enter_phase1+0x125/0x1a0 [<ffffffff940d865d>] ? trace_hardirqs_on_caller+0x16d/0x210 [<ffffffff943d816b>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff9487487f>] tracesys+0x14/0x4a Code: fa e8 51 0a f3 ff 48 c7 c7 26 52 cd 94 e8 f5 21 24 00 65 8b 04 25 f4 f8 1c 00 83 f8 01 74 28 f6 c7 02 74 13 e8 6e 46 f3 ff 53 9d <5b> 41 5c 5d c3 0f 1f 80 00 00 00 00 53 9d e8 19 0a f3 ff eb eb
It looks like I've been seeing these since 3.18-rc1 though, but for those, the machine crashed before the trace even made it over usb-serial, leaving just the "NMI watchdog" line.
Quoted 11 lines
Quoted 3 lines
I can try to bisect it, but it takes hours before it happens, so it might take days to complete, and the next few weeks are complicated timewise..
Hmm. Even narrowing it down a bit might help, ie if you could get say four bisections in over a day, and see if that at least says "ok, it's likely one of these pulls".
But yeah, I can see it being painful, so maybe a quick check of the TLB ones, even if I can't for the life see why they would possibly matter.
Assuming the NMI watchdog traces I saw in rc1 are the same problem, I'll see if I can bisect between .17 and .18rc1 on Monday, and see if that yields anything interesting.
Dave
Quoted 8 lines · Linus Torvalds
Quoted 2 lines · Dave Jones
I'm not sure how long this goes back (3.17 was fine afair) but I'm seeing these several times a day lately..
Plus, judging by the fact that there's a stale "
leave_mm+0x210/0x210" (wouldn't that be the *next* function, namelydo_flush_tlb_all()) pointer on the stack, I suspect that whole range-flushing doesn't even trigger, and we are flushing everything.
This stale entry is not relevant here because the thing is stuck in generic_exec_single().
Quoted 10 lines
Quoted 10 lines
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c129:25570]
RIP: 0010:[<ffffffff9c11e98a>] [<ffffffff9c11e98a>] generic_exec_single+0xea/0x1d0 Call Trace: [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c11ead6>] smp_call_function_single+0x66/0x110 [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c11f021>] smp_call_function_many+0x2f1/0x390 [<ffffffff9c049300>] flush_tlb_mm_range+0xe0/0x370
flush_tlb_mm_range()
.....
out:
if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids)
flush_tlb_others(mm_cpumask(mm), mm, start, end);
which calls
smp_call_function_many() via native_flush_tlb_others()
which is either inlined or not on the stack the invocation of smp_call_function_many() is a tail call.
So from smp_call_function_many() we end up via smp_call_function_single() in generic_exec_single().
So the only ways to get stuck there are:
csd_lock(csd);
and
csd_lock_wait(csd);The called function is flush_tlb_func() and I really can't see why that would get stuck at all.
So this looks more like a smp function call fuckup.
I assume Dave is running that stuff on KVM. So it might be worth while to look at the IPI magic there.
Thanks,
tglx
Quoted 4 lines · Thomas Gleixner
So this looks more like a smp function call fuckup.
I assume Dave is running that stuff on KVM. So it might be worth while to look at the IPI magic there.
no, bare metal.
Dave
Quoted 8 lines · Dave Jones
Quoted 4 lines · Thomas Gleixner
So this looks more like a smp function call fuckup.
I assume Dave is running that stuff on KVM. So it might be worth while to look at the IPI magic there.
no, bare metal.
Ok, but that does not change the fact that we are stuck in smp_function_call land.
Enabling softlockup_all_cpu_backtrace will probably not help much as we will end up waiting for csd_lock again :(
Is the machine still accesible when this happens? If yes, we might enable a few trace points and functions and read out the trace buffer. If not, we could just panic the machine and dump the trace buffer over serial.
Sigh
tglx
Quoted 3 lines · Thomas Gleixner
This stale entry is not relevant here because the thing is stuck in
generic_exec_single().
That wasn't really my argument. The fact that "do_flush_tlb_all()" was left over on the stack frame implies that we're not doing the range-flush, and if it was some odd bug with a negative range or something like that (due to the fix in commit ce9ec37bddb6), I'd expect the lockup to be due to a hung do_kernel_range_flush() or something. But the range flushing never even happens.
Quoted 8 lines
So from
smp_call_function_many()we end up viasmp_call_function_single()ingeneric_exec_single().So the only ways to get stuck there are:
csd_lock(csd); and csd_lock_wait(csd);
Judging by the code disassembly, it's the "csd_lock_wait(csd)" at the end. The disassembly looks like
29: f3 90 pause
2b:* f6 43 18 01 testb $0x1,0x18(%rbx) <-- trapping instruction
2f: 75 f8 jne 0x29 31: 31 c0 xor %eax,%eax
and that "xor %eax,%eax" seems to be part of the "return 0" immediately afterwards.
But that's not entirely conclusive, it's just a strong hint.
It does sound like there might be some IPI issue. I just don't see *any* changes in this area since 3.17. Some unrelated APIC change? I don't see that either. As you noted, there are KVM changes, but apparently that isn't involved either.
Linus
Quoted 14 lines · Thomas Gleixner
Quoted 8 lines · Dave Jones
Quoted 4 lines · Thomas Gleixner
So this looks more like a smp function call fuckup.
I assume Dave is running that stuff on KVM. So it might be worth while to look at the IPI magic there.
no, bare metal.
Ok, but that does not change the fact that we are stuck in
smp_function_callland.
Quoted 7 lines
Enabling
softlockup_all_cpu_backtracewill probably not help much as we will end up waiting forcsd_lockagain :(Is the machine still accesible when this happens? If yes, we might enable a few trace points and functions and read out the trace buffer. If not, we could just panic the machine and dump the trace buffer over serial.
No, it wedges solid. Even though it says something like "CPU3 locked up", aparently all cores also get stuck.
9 times out of 10 it doesn't stay alive long enough to even get the full trace out over usb-serial.
Dave
Quoted 4 lines · Linus Torvalds
But since you say "several times a day", just for fun, can you test the follow-up patch to that one-liner fix that Will Deacon posted today (Subject: "[PATCH]
mmu_gather: move minimal range calculations into generic code"). That does some further cleanup in this area.
A few hours ago it hit the NMI watchdog again with that patch applied. Incomplete trace, but it looks different based on what did make it over. Different RIP at least.
[65155.054155] NMI watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [trinity-c127:12559] [65155.054573] irq event stamp: 296752 [65155.054589] hardirqs last enabled at (296751): [<ffffffff9d87403d>] _raw_spin_unlock_irqrestore+0x5d/0x80 [65155.054625] hardirqs last disabled at (296752): [<ffffffff9d875cea>] apic_timer_interrupt+0x6a/0x80 [65155.054657] softirqs last enabled at (296188): [<ffffffff9d259943>] bdi_queue_work+0x83/0x270 [65155.054688] softirqs last disabled at (296184): [<ffffffff9d259920>] bdi_queue_work+0x60/0x270 [65155.054721] CPU: 1 PID: 12559 Comm: trinity-c127 Not tainted 3.18.0-rc4+ #84 [loadavg: 209.68 187.90 185.33 34/431 17515] [65155.054795] task: ffff88023f664680 ti: ffff8801649f0000 task.ti: ffff8801649f0000 [65155.054820] RIP: 0010:[<ffffffff9d87403f>] [<ffffffff9d87403f>] _raw_spin_unlock_irqrestore+0x5f/0x80 [65155.054852] RSP: 0018:ffff8801649f3be8 EFLAGS: 00000292 [65155.054872] RAX: ffff88023f664680 RBX: 0000000000000007 RCX: 0000000000000007 [65155.054895] RDX: 00000000000029e0 RSI: ffff88023f664ea0 RDI: ffff88023f664680 [65155.054919] RBP: ffff8801649f3bf8 R08: 0000000000000000 R09: 0000000000000000 [65155.055956] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [65155.056985] R13: ffff8801649f3b58 R14: ffffffff9d3e7d0e R15: 00000000000003e0 [65155.058037] FS: 00007f0dc957c700(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [65155.059083] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [65155.060121] CR2: 00007f0dc958e000 CR3: 000000022f31e000 CR4: 00000000001407e0 [65155.061152] DR0: 00007f54162bc000 DR1: 00007feb92c3d000 DR2: 0000000000000000 [65155.062180] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [65155.063202] Stack:
And that's all she wrote.
Quoted 5 lines
If Will's patch doesn't make a difference, what about reverting that
ce9ec37bddb6? Although it really *is* a "obvious bugfix", and I really don't see why any of this would be noticeable on x86 (it triggered issues on ARM64, but that was because ARM64 cared much more about the exact range).
I'll try that next, and check in on it tomorrow.
Dave
Quoted 35 lines · Dave Jones
Quoted 4 lines · Linus Torvalds
But since you say "several times a day", just for fun, can you test the follow-up patch to that one-liner fix that Will Deacon posted today (Subject: "[PATCH]
mmu_gather: move minimal range calculations into generic code"). That does some further cleanup in this area.A few hours ago it hit the NMI watchdog again with that patch applied. Incomplete trace, but it looks different based on what did make it over. Different RIP at least.
[65155.054155] NMI watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [trinity-c127:12559] [65155.054573] irq event stamp: 296752 [65155.054589] hardirqs last enabled at (296751): [<ffffffff9d87403d>] _raw_spin_unlock_irqrestore+0x5d/0x80 [65155.054625] hardirqs last disabled at (296752): [<ffffffff9d875cea>] apic_timer_interrupt+0x6a/0x80 [65155.054657] softirqs last enabled at (296188): [<ffffffff9d259943>] bdi_queue_work+0x83/0x270 [65155.054688] softirqs last disabled at (296184): [<ffffffff9d259920>] bdi_queue_work+0x60/0x270 [65155.054721] CPU: 1 PID: 12559 Comm: trinity-c127 Not tainted 3.18.0-rc4+ #84 [loadavg: 209.68 187.90 185.33 34/431 17515] [65155.054795] task: ffff88023f664680 ti: ffff8801649f0000 task.ti: ffff8801649f0000 [65155.054820] RIP: 0010:[<ffffffff9d87403f>] [<ffffffff9d87403f>] _raw_spin_unlock_irqrestore+0x5f/0x80 [65155.054852] RSP: 0018:ffff8801649f3be8 EFLAGS: 00000292 [65155.054872] RAX: ffff88023f664680 RBX: 0000000000000007 RCX: 0000000000000007 [65155.054895] RDX: 00000000000029e0 RSI: ffff88023f664ea0 RDI: ffff88023f664680 [65155.054919] RBP: ffff8801649f3bf8 R08: 0000000000000000 R09: 0000000000000000 [65155.055956] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [65155.056985] R13: ffff8801649f3b58 R14: ffffffff9d3e7d0e R15: 00000000000003e0 [65155.058037] FS: 00007f0dc957c700(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [65155.059083] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [65155.060121] CR2: 00007f0dc958e000 CR3: 000000022f31e000 CR4: 00000000001407e0 [65155.061152] DR0: 00007f54162bc000 DR1: 00007feb92c3d000 DR2: 0000000000000000 [65155.062180] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [65155.063202] Stack:And that's all she wrote.
Quoted 7 lines
Quoted 5 lines
If Will's patch doesn't make a difference, what about reverting that
ce9ec37bddb6? Although it really *is* a "obvious bugfix", and I really don't see why any of this would be noticeable on x86 (it triggered issues on ARM64, but that was because ARM64 cared much more about the exact range).I'll try that next, and check in on it tomorrow.
No luck. Died even faster this time.
[ 772.459481] NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [modprobe:31400] [ 772.459858] irq event stamp: 3362 [ 772.459872] hardirqs last enabled at (3361): [<ffffffff941a437c>] context_tracking_user_enter+0x9c/0x2c0 [ 772.459907] hardirqs last disabled at (3362): [<ffffffff94875bea>] apic_timer_interrupt+0x6a/0x80 [ 772.459937] softirqs last enabled at (0): [<ffffffff940764d5>] copy_process.part.26+0x635/0x1d80 [ 772.459968] softirqs last disabled at (0): [< (null)>] (null) [ 772.459996] CPU: 3 PID: 31400 Comm: modprobe Not tainted 3.18.0-rc4+ #85 [loadavg: 207.70 163.33 92.64 11/433 31547] [ 772.460086] task: ffff88022f0b2f00 ti: ffff88019a944000 task.ti: ffff88019a944000 [ 772.460110] RIP: 0010:[<ffffffff941a437e>] [<ffffffff941a437e>] context_tracking_user_enter+0x9e/0x2c0 [ 772.460142] RSP: 0018:ffff88019a947f00 EFLAGS: 00000282 [ 772.460161] RAX: ffff88022f0b2f00 RBX: 0000000000000000 RCX: 0000000000000000 [ 772.460184] RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff88022f0b2f00 [ 772.460207] RBP: ffff88019a947f10 R08: 0000000000000000 R09: 0000000000000000 [ 772.460229] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88019a947e90 [ 772.460252] R13: ffffffff940f6d04 R14: ffff88019a947ec0 R15: ffff8802447cd640 [ 772.460294] FS: 00007f3b71ee4700(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 [ 772.460362] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 772.460391] CR2: 00007fffdad5af58 CR3: 000000011608e000 CR4: 00000000001407e0 [ 772.460424] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 772.460447] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 772.460470] Stack: [ 772.460480] ffff88019a947f58 00000000006233a8 ffff88019a947f40 ffffffff9401429d [ 772.460512] 00000000006233a8 000000000041d68a 00000000006233a8 0000000000000000 [ 772.460543] 00000000006233a0 ffffffff94874fa4 000000001008feff 000507d93d73a434 [ 772.460574] Call Trace: [ 772.461576] [<ffffffff9401429d>] syscall_trace_leave+0xad/0x2e0 [ 772.462572] [<ffffffff94874fa4>] int_check_syscall_exit_work+0x34/0x3d [ 772.463575] Code: f8 1c 00 84 c0 75 46 48 c7 c7 51 53 cd 94 e8 aa 23 24 00 65 c7 04 25 f4 f8 1c 00 01 00 00 00 f6 c7 02 74 19 e8 84 43 f3 ff 53 9d <5b> 41 5c 5d c3 0f 1f 44 00 00 c3 0f 1f 80 00 00 00 00 53 9d e8 [ 772.465797] Kernel panic - not syncing: softlockup: hung tasks [ 772.466821] CPU: 3 PID: 31400 Comm: modprobe Tainted: G L 3.18.0-rc4+ #85 [loadavg: 207.70 163.33 92.64 11/433 31547] [ 772.468915] ffff88022f0b2f00 00000000de65d5f5 ffff880244603dc8 ffffffff94869e01 [ 772.470031] 0000000000000000 ffffffff94c7599b ffff880244603e48 ffffffff94866b21 [ 772.471085] ffff880200000008 ffff880244603e58 ffff880244603df8 00000000de65d5f5 [ 772.472141] Call Trace: [ 772.473183] <IRQ> [<ffffffff94869e01>] dump_stack+0x4f/0x7c [ 772.474253] [<ffffffff94866b21>] panic+0xcf/0x202 [ 772.475346] [<ffffffff94154d1e>] watchdog_timer_fn+0x27e/0x290 [ 772.476414] [<ffffffff94106297>] __run_hrtimer+0xe7/0x740 [ 772.477475] [<ffffffff94106b64>] ? hrtimer_interrupt+0x94/0x270 [ 772.478555] [<ffffffff94154aa0>] ? watchdog+0x40/0x40 [ 772.479627] [<ffffffff94106be7>] hrtimer_interrupt+0x117/0x270 [ 772.480703] [<ffffffff940303db>] local_apic_timer_interrupt+0x3b/0x70 [ 772.481777] [<ffffffff948777f3>] smp_apic_timer_interrupt+0x43/0x60 [ 772.482856] [<ffffffff94875bef>] apic_timer_interrupt+0x6f/0x80 [ 772.483915] <EOI> [<ffffffff941a437e>] ? context_tracking_user_enter+0x9e/0x2c0 [ 772.484972] [<ffffffff9401429d>] syscall_trace_leave+0xad/0x2e0 [ 772.486042] [<ffffffff94874fa4>] int_check_syscall_exit_work+0x34/0x3d [ 772.487187] Kernel Offset: 0x13000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
Dave
Quoted 4 lines · Dave Jones
Quoted 2 lines
I'll try that next, and check in on it tomorrow.
No luck. Died even faster this time.
Yeah, and your other lockups haven't even been TLB related. Not that they look like anything else *either*.
I have no ideas left. I'd go for a bisection - rather than try random things, at least bisection will get us a smaller set of suspects if you can go through a few cycles of it. Even if you decide that you want to run for most of a day before you are convinced it's all good, a couple of days should get you a handful of bisection points (that's assuming you hit a couple of bad ones too that turn bad in a shorter while). And 4 or five bisections should get us from 11k commits down to the ~600 commit range. That would be a huge improvement.
Linus
Quoted 10 lines · Linus Torvalds
Quoted 4 lines · Dave Jones
Quoted 2 lines
I'll try that next, and check in on it tomorrow.
No luck. Died even faster this time.
Yeah, and your other lockups haven't even been TLB related. Not that they look like anything else *either*.
I have no ideas left. I'd go for a bisection
Before starting a bisection you could try and disable transparent_hugepages. There are strange bugs, that were introduced during this merge-window, in this area. See: https://lkml.org/lkml/2014/11/4/144
https://lkml.org/lkml/2014/11/4/904
http://thread.gmane.org/gmane.linux.kernel.mm/124451
Signature · 1 line
Markus
Quoted 18 lines · Dave Jones
Quoted 17 lines · Thomas Gleixner
Quoted 8 lines · Dave Jones
Quoted 4 lines · Thomas Gleixner
So this looks more like a smp function call fuckup.
I assume Dave is running that stuff on KVM. So it might be worth while to look at the IPI magic there.
no, bare metal.
Ok, but that does not change the fact that we are stuck in
smp_function_callland.Enabling
softlockup_all_cpu_backtracewill probably not help much as we will end up waiting forcsd_lockagain :(
Quoted 7 lines
Quoted 4 lines
Is the machine still accesible when this happens? If yes, we might enable a few trace points and functions and read out the trace buffer. If not, we could just panic the machine and dump the trace buffer over serial.
No, it wedges solid. Even though it says something like "CPU3 locked up", aparently all cores also get stuck.
Does not surprise me. Once the smp function call machinery is wedged...
Quoted 2 lines
9 times out of 10 it doesn't stay alive long enough to even get the full trace out over usb-serial.
usb-serial is definitely not the best tool for stuff like this. I wonder whether netconsole might give us some more info.
Last time I looked into something like that on my laptop I had to resort to a crash kernel to get anything useful out of the box.
Thanks,
tglx
Quoted 6 lines · Markus Trippelsdorf
Before starting a bisection you could try and disable
transparent_hugepages. There are strange bugs, that were introduced during this merge-window, in this area. See: https://lkml.org/lkml/2014/11/4/144
https://lkml.org/lkml/2014/11/4/904
http://thread.gmane.org/gmane.linux.kernel.mm/124451
Those look different, and hopefully should be fixed by commit 1d5bfe1ffb5b ("mm, compaction: prevent infinite loop in compact_zone"). Which admittedly isn't in -rc4 (it went in on Thursday), but I think Dave tends to run git-of-the-day rather than last rc, so he probably already had it.
I *think* that if it was the infinite compaction problem, you'd have the soft-lockup reports showing that. Dave's are in random places. Which is odd.
Linus
Quoted 26 lines · Dave Jones
I'm not sure how long this goes back (3.17 was fine afair) but I'm seeing these several times a day lately..
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c129:25570]
irq event stamp: 74224 hardirqs last enabled at (74223): [<ffffffff9c875664>] restore_args+0x0/0x30 hardirqs last disabled at (74224): [<ffffffff9c8759aa>] apic_timer_interrupt+0x6a/0x80 softirqs last enabled at (74222): [<ffffffff9c07f43a>] __do_softirq+0x26a/0x6f0 softirqs last disabled at (74209): [<ffffffff9c07fb4d>] irq_exit+0x13d/0x170 CPU: 3 PID: 25570 Comm: trinity-c129 Not tainted 3.18.0-rc4+ #83 [loadavg: 198.04 186.66 181.58 24/442 26708] task: ffff880213442f00 ti: ffff8801ea714000 task.ti: ffff8801ea714000 RIP: 0010:[<ffffffff9c11e98a>] [<ffffffff9c11e98a>] generic_exec_single+0xea/0x1d0 RSP: 0018:ffff8801ea717a08 EFLAGS: 00000202 RAX: ffff880213442f00 RBX: ffffffff9c875664 RCX: 0000000000000006 RDX: 0000000000001370 RSI: ffff880213443790 RDI: ffff880213442f00 RBP: ffff8801ea717a68 R08: ffff880242b56690 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801ea717978 R13: ffff880213442f00 R14: ffff8801ea714000 R15: ffff880213442f00 FS: 00007f240994e700(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000004 CR3: 000000019a017000 CR4: 00000000001407e0 DR0: 00007fb3367e0000 DR1: 00007f82542ab000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffffffff9ce4c620 0000000000000000 ffffffff9c048b20 ffff8801ea717b18
Quoted 8 lines
0000000000000003 0000000052e0da3d ffffffff9cc7ef3c 0000000000000002 ffffffff9c048b20 ffff8801ea717b18 0000000000000001 0000000000000003 Call Trace: [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c11ead6>] smp_call_function_single+0x66/0x110 [<ffffffff9c048b20>] ? leave_mm+0x210/0x210 [<ffffffff9c11f021>] smp_call_function_many+0x2f1/0x390
Hi Dave,
When I usually see stuff like this, it is because another cpu is blocking the IPI from smp_call_function_many from finishing, so this cpu waits forever.
The problem usually becomes obvious with a dump of all cpus at the time the lockup is detected.
Can you try adding 'softlockup_all_cpu_backtrace=1' to the kernel commandline? That should dump all the cpus to see if anything stands out.
Though I don't normally see it traverse down to smp_call_function_single.
Anyway something to try.
Cheers,
Don
Quoted 38 lines
[<ffffffff9c049300>] flush_tlb_mm_range+0xe0/0x370 [<ffffffff9c1d95a2>] tlb_flush_mmu_tlbonly+0x42/0x50 [<ffffffff9c1d9cb5>] tlb_finish_mmu+0x45/0x50 [<ffffffff9c1daf59>] zap_page_range_single+0x119/0x170 [<ffffffff9c1db140>] unmap_mapping_range+0x140/0x1b0 [<ffffffff9c1c7edd>] shmem_fallocate+0x43d/0x540 [<ffffffff9c0b111b>] ? preempt_count_sub+0xab/0x100 [<ffffffff9c0cdac7>] ? prepare_to_wait+0x27/0x80 [<ffffffff9c2287f3>] ? __sb_start_write+0x103/0x1d0 [<ffffffff9c223aba>] do_fallocate+0x12a/0x1c0 [<ffffffff9c1f0bd3>] SyS_madvise+0x3d3/0x890 [<ffffffff9c1a40d2>] ? context_tracking_user_exit+0x52/0x260 [<ffffffff9c013ebd>] ? syscall_trace_enter_phase2+0x10d/0x3d0 [<ffffffff9c874c89>] tracesys_phase2+0xd4/0xd9 Code: 63 c7 48 89 de 48 89 df 48 c7 c2 c0 50 1d 00 48 03 14 c5 40 b9 f2 9c e8 d5 ea 2b 00 84 c0 74 0b e9 bc 00 00 00 0f 1f 40 00 f3 90 <f6> 43 18 01 75 f8 31 c0 48 8b 4d c8 65 48 33 0c 25 28 00 00 00 Kernel panic - not syncing: softlockup: hung tasksI've got a local hack to dump loadavg on traces, and as you can see in that example, the machine was really busy, but we were at least making progress before the trace spewed, and the machine rebooted. (I have reboot-on-lockup sysctl set, without it, the machine just wedges indefinitely shortly after the spew).
The trace doesn't really enlighten me as to what we should be doing to prevent this though.
ideas?
I can try to bisect it, but it takes hours before it happens, so it might take days to complete, and the next few weeks are complicated timewise..Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 7 lines · Linus Torvalds
Quoted 3 lines
Quoted 1 line
I'll try that next, and check in on it tomorrow.
No luck. Died even faster this time.
Yeah, and your other lockups haven't even been TLB related. Not that they look like anything else *either*.
Quoted 8 lines
I have no ideas left. I'd go for a bisection - rather than try random things, at least bisection will get us a smaller set of suspects if you can go through a few cycles of it. Even if you decide that you want to run for most of a day before you are convinced it's all good, a couple of days should get you a handful of bisection points (that's assuming you hit a couple of bad ones too that turn bad in a shorter while). And 4 or five bisections should get us from 11k commits down to the ~600 commit range. That would be a huge improvement.
Great start to the week: I decided to confirm my recollection that .17 was ok, only to hit this within 10 minutes.
Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 3 CPU: 3 PID: 17176 Comm: trinity-c95 Not tainted 3.17.0+ #87 0000000000000000 00000000f3a61725 ffff880244606bf0 ffffffff9583e9fa ffffffff95c67918 ffff880244606c78 ffffffff9583bcc0 0000000000000010 ffff880244606c88 ffff880244606c20 00000000f3a61725 0000000000000000 Call Trace: <NMI> [<ffffffff9583e9fa>] dump_stack+0x4e/0x7a [<ffffffff9583bcc0>] panic+0xd4/0x207 [<ffffffff95150908>] watchdog_overflow_callback+0x118/0x120 [<ffffffff95193dbe>] __perf_event_overflow+0xae/0x340 [<ffffffff95192230>] ? perf_event_task_disable+0xa0/0xa0 [<ffffffff9501a7bf>] ? x86_perf_event_set_period+0xbf/0x150 [<ffffffff95194be4>] perf_event_overflow+0x14/0x20 [<ffffffff95020676>] intel_pmu_handle_irq+0x206/0x410 [<ffffffff9501966b>] perf_event_nmi_handler+0x2b/0x50 [<ffffffff95007bb2>] nmi_handle+0xd2/0x390 [<ffffffff95007ae5>] ? nmi_handle+0x5/0x390 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff950080a2>] default_do_nmi+0x72/0x1c0 [<ffffffff950082a8>] do_nmi+0xb8/0x100 [<ffffffff9584b9aa>] end_repeat_nmi+0x1e/0x2e [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 <<EOE>> <IRQ> [<ffffffff95101685>] lock_hrtimer_base.isra.18+0x25/0x50 [<ffffffff951019d3>] hrtimer_try_to_cancel+0x33/0x1f0 [<ffffffff95101baa>] hrtimer_cancel+0x1a/0x30 [<ffffffff95113557>] tick_nohz_restart+0x17/0x90 [<ffffffff95114533>] __tick_nohz_full_check+0xc3/0x100 [<ffffffff9511457e>] nohz_full_kick_work_func+0xe/0x10 [<ffffffff95188894>] irq_work_run_list+0x44/0x70 [<ffffffff951888ea>] irq_work_run+0x2a/0x50 [<ffffffff9510109b>] update_process_times+0x5b/0x70 [<ffffffff95113325>] tick_sched_handle.isra.20+0x25/0x60 [<ffffffff95113801>] tick_sched_timer+0x41/0x60 [<ffffffff95102281>] __run_hrtimer+0x81/0x480 [<ffffffff951137c0>] ? tick_sched_do_timer+0xb0/0xb0 [<ffffffff95102977>] hrtimer_interrupt+0x117/0x270 [<ffffffff950346d7>] local_apic_timer_interrupt+0x37/0x60 [<ffffffff9584c44f>] smp_apic_timer_interrupt+0x3f/0x50 [<ffffffff9584a86f>] apic_timer_interrupt+0x6f/0x80 <EOI> [<ffffffff950d3f3a>] ? lock_release_holdtime.part.28+0x9a/0x160 [<ffffffff950ef3b7>] ? rcu_is_watching+0x27/0x60 [<ffffffff9508cb75>] kill_pid_info+0xf5/0x130 [<ffffffff9508ca85>] ? kill_pid_info+0x5/0x130 [<ffffffff9508ccd3>] SYSC_kill+0x103/0x330 [<ffffffff9508cc7c>] ? SYSC_kill+0xac/0x330 [<ffffffff9519b592>] ? context_tracking_user_exit+0x52/0x1a0 [<ffffffff950d6f1d>] ? trace_hardirqs_on_caller+0x16d/0x210 [<ffffffff950d6fcd>] ? trace_hardirqs_on+0xd/0x10 [<ffffffff950137ad>] ? syscall_trace_enter+0x14d/0x330 [<ffffffff9508f44e>] SyS_kill+0xe/0x10 [<ffffffff95849b24>] tracesys+0xdd/0xe2
Kernel Offset: 0x14000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
It could a completely different cause for lockup, but seeing this now has me wondering if perhaps it's something unrelated to the kernel. I have recollection of running late .17rc's for days without incident, and I'm pretty sure .17 was ok too. But a few weeks ago I did upgrade that test box to the Fedora 21 beta. Which means I have a new gcc. I'm not sure I really trust 4.9.1 yet, so maybe I'll see if I can get 4.8 back on there and see if that's any better.
Dave
Quoted 8 lines · Dave Jones
It could a completely different cause for lockup, but seeing this now has me wondering if perhaps it's something unrelated to the kernel. I have recollection of running late .17rc's for days without incident, and I'm pretty sure .17 was ok too. But a few weeks ago I did upgrade that test box to the Fedora 21 beta. Which means I have a new gcc. I'm not sure I really trust 4.9.1 yet, so maybe I'll see if I can get 4.8 back on there and see if that's any better.
I'm not sure if I should be relieved or horrified.
Horrified, I think.
It really would be a wonderful thing to have some kind of "compiler bisection" with mixed object files to see exactly which file it miscompiles (and by "miscompiles" it might just be a kernel bug where we are missing a barrier or something, and older gcc's just happened to not show it - so it could still easily be a kernel problem).
Linus
Quoted 3 lines · Linus Torvalds
Judging by the code disassembly, it's the "
csd_lock_wait(csd)" at the end.
Btw, looking at this, I grew really suspicious of this code in csd_unlock():
WARN_ON((csd->flags & CSD_FLAG_WAIT) && !(csd->flags & CSD_FLAG_LOCK));
because that makes no sense at all. It basically removes a sanity check, yet that sanity check makes a hell of a lot of sense. Unlocking a CSD that is not locked is *wrong*.
The crazy code code comes from commit c84a83e2aaab ("smp: don't warn about csd->flags having CSD_FLAG_LOCK cleared for !wait") by Jens, but the explanation and the code is pure crap.
There is no way in hell that it is ever correct to unlock an entry that isn't locked, so that whole CSD_FLAG_WAIT thing is buggy as hell.
The explanation in commit c84a83e2aaab says that "blk-mq reuses the request potentially immediately" and claims that that is somehow ok, but that's utter BS. Even if you don't ever wait for it, the CSD lock bit fundamentally also protects the "csd->llist" pointer. So what that commit actually does is to just remove a safety check, and do so in a very unsafe manner. And apparently block-mq re-uses something THAT IS STILL ACTIVELY IN USE. That's just horrible.
Now, I think we might do this differently, by doing the "csd_unlock()" after we have loaded everything from the csd, but *before* actually calling the callback function. That would seem to be equivalent (interrupts are disabled, so this will not result in the func() possibly called twice), more efficient, _and_ not remove a useful check.
Hmm? Completely untested patch attached. Jens, does this still work for you?
Am I missing something?
Linus
kernel/smp.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
kernel/smp.c +5 -6
@@ -19,7 +19,6 @@enum {CSD_FLAG_LOCK =0x01 , -CSD_FLAG_WAIT =0x02 , };struct call_function_data {
@@ -126,7 +125,7 @@ static void csd_lock(struct call_single_data *csd)static void csd_unlock (struct call_single_data *csd) { -WARN_ON ((csd->flags &CSD_FLAG_WAIT ) && !(csd->flags &CSD_FLAG_LOCK )); +WARN_ON (!(csd->flags &CSD_FLAG_LOCK ));/* * ensure we're all done before releasing data:
@@ -173,9 +172,6 @@ static int generic_exec_single(int cpu, struct call_single_data *csd, csd->func = func; csd->info = info; -if (wait) - csd->flags |=CSD_FLAG_WAIT ; -/* * The list addition should be visible before sending the IPI * handler locks the list to pull the entry off it because of
@@ -250,8 +246,11 @@ static void flush_smp_call_function_queue(bool warn_cpu_offline) }llist_for_each_entry_safe (csd, csd_next, entry, llist) { - csd->func (csd->info); +smp_call_func_t func = csd->func; +void *info = csd->info;csd_unlock (csd); + +func (info); }/*
Quoted 36 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
Judging by the code disassembly, it's the "
csd_lock_wait(csd)" at the end.Btw, looking at this, I grew really suspicious of this code in
csd_unlock():WARN_ON((csd->flags & CSD_FLAG_WAIT) && !(csd->flags & CSD_FLAG_LOCK));because that makes no sense at all. It basically removes a sanity check, yet that sanity check makes a hell of a lot of sense. Unlocking a CSD that is not locked is *wrong*.
The crazy code code comes from commit
c84a83e2aaab("smp: don't warn aboutcsd->flagshavingCSD_FLAG_LOCKcleared for !wait") by Jens, but the explanation and the code is pure crap.There is no way in hell that it is ever correct to unlock an entry that isn't locked, so that whole
CSD_FLAG_WAITthing is buggy as hell.The explanation in commit
c84a83e2aaabsays that "blk-mq reuses the request potentially immediately" and claims that that is somehow ok, but that's utter BS. Even if you don't ever wait for it, the CSD lock bit fundamentally also protects the "csd->llist" pointer. So what that commit actually does is to just remove a safety check, and do so in a very unsafe manner. And apparently block-mq re-uses something THAT IS STILL ACTIVELY IN USE. That's just horrible.Now, I think we might do this differently, by doing the "
csd_unlock()" after we have loaded everything from the csd, but *before* actually calling the callback function. That would seem to be equivalent (interrupts are disabled, so this will not result in thefunc()possibly called twice), more efficient, _and_ not remove a useful check.
Quoted 3 lines
Hmm? Completely untested patch attached. Jens, does this still work for you?
Am I missing something?
Yes. :)
Quoted 30 lines
kernel/smp.c +1
-5@@ -19,7 +19,6 @@enum {CSD_FLAG_LOCK =0x01 , -CSD_FLAG_WAIT =0x02 , };struct call_function_data {@@ -126,7 +125,7 @@ static void csd_lock(struct call_single_data *csd)static void csd_unlock (struct call_single_data *csd) { -WARN_ON ((csd->flags &CSD_FLAG_WAIT ) && !(csd->flags &CSD_FLAG_LOCK )); +WARN_ON (!(csd->flags &CSD_FLAG_LOCK ));/* * ensure we're all done before releasing data: @@ -173,9 +172,6 @@ static int generic_exec_single(int cpu, struct call_single_data *csd, csd->func = func; csd->info = info; -if (wait) - csd->flags |=CSD_FLAG_WAIT ; -/* * The list addition should be visible before sending the IPI * handler locks the list to pull the entry off it because of
kernel/smp.c static void flush_smp_call_function_queue(bool warn_cpu_offline) · line 253
Quoted 9 lines
kernel/smp.c +4
-1@@ -250,8 +246,11 @@ static void flush_smp_call_function_queue(bool warn_cpu_offline) }llist_for_each_entry_safe (csd, csd_next, entry, llist) { - csd->func (csd->info); +smp_call_func_t func = csd->func; +void *info = csd->info;csd_unlock (csd); + +func (info);
No, that won't work for synchronous calls:
CPU 0 CPU 1
csd_lock(csd);
queue_csd();
ipi();
func = csd->func;
info = csd->info;
csd_unlock(csd);
csd_lock_wait();
func(info);The csd_lock_wait() side will succeed and therefor assume that the call has been completed while the function has not been called at all. Interesting explosions to follow.
The proper solution is to revert that commit and properly analyze the problem which Jens was trying to solve and work from there.
Thanks,
tglx
Quoted 22 lines · Thomas Gleixner
Review
Quoted 7 lines · Linus Torvalds
(quoted diff) +4
-1llist_for_each_entry_safe(csd, csd_next, entry, llist) { - csd->func(csd->info); + smp_call_func_t func = csd->func; + void *info = csd->info; csd_unlock(csd); + + func(info);No, that won't work for synchronous calls:
CPU 0 CPU 1 csd_lock(csd); queue_csd(); ipi(); func = csd->func; info = csd->info; csd_unlock(csd); csd_lock_wait(); func(info);
Quoted 6 lines
The
csd_lock_wait()side will succeed and therefor assume that the call has been completed while the function has not been called at all. Interesting explosions to follow.The proper solution is to revert that commit and properly analyze the problem which Jens was trying to solve and work from there.
So a combo of both (Jens and yours) might do the trick. Patch below.
I think what Jens was trying to solve is:
CPU 0 CPU 1
csd_lock(csd);
queue_csd();
ipi();
csd->func(csd->info);
wait_for_completion(csd);
complete(csd);
reuse_csd(csd);
csd_unlock(csd);Thanks,
tglx
kernel/smp.c +18 -3
@@ -126,7 +126,7 @@ static void csd_lock(struct call_single_static void csd_unlock (struct call_single_data *csd) { -WARN_ON ((csd->flags &CSD_FLAG_WAIT ) && !(csd->flags &CSD_FLAG_LOCK )); +WARN_ON (!(csd->flags &CSD_FLAG_LOCK ));/* * ensure we're all done before releasing data:
@@ -250,8 +250,23 @@ static void flush_smp_call_function_queu }llist_for_each_entry_safe (csd, csd_next, entry, llist) { - csd->func (csd->info); -csd_unlock (csd); + +/* +* For synchronous calls we are not allowed to unlock +* before the callback returned. For the async case +* its the responsibility of the caller to keep +* csd->info consistent while the callback runs. +*/ +if (csd->flags &CSD_FLAG_WAIT ) { + csd->func (csd->info); +csd_unlock (csd); + }else { +smp_call_func_t func = csd->func; +void *info = csd->info; + +csd_unlock (csd); +func (info); + } }/*
Quoted 34 lines · Thomas Gleixner
Quoted 22 lines · Thomas Gleixner
kernel/smp.c static void flush_smp_call_function_queu · line 268
Quoted 7 lines · Linus Torvalds
kernel/smp.c +4
-1llist_for_each_entry_safe (csd, csd_next, entry, llist) { - csd->func (csd->info); +smp_call_func_t func = csd->func; +void *info = csd->info;csd_unlock (csd); + +func (info);No, that won't work for synchronous calls:
CPU 0 CPU 1 csd_lock(csd); queue_csd(); ipi(); func = csd->func; info = csd->info; csd_unlock(csd); csd_lock_wait(); func(info);Quoted 6 lines
The
csd_lock_wait()side will succeed and therefor assume that the call has been completed while the function has not been called at all. Interesting explosions to follow.The proper solution is to revert that commit and properly analyze the problem which Jens was trying to solve and work from there.
So a combo of both (Jens and yours) might do the trick. Patch below.
I think what Jens was trying to solve is:
Quoted 10 lines
CPU 0 CPU 1
csd_lock(csd);
queue_csd();
ipi();
csd->func(csd->info);
wait_for_completion(csd);
complete(csd);
reuse_csd(csd);
csd_unlock(csd);Maybe... The above looks ok to me from a functional point of view, but now I can't convince myself that the blk-mq use case is correct.
I'll try and backout the original patch and reproduce the issue, that should jog my memory and give me full understanding of what the issue I faced back then was.
Signature · 1 line
Jens Axboe
Quoted 21 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
Judging by the code disassembly, it's the "
csd_lock_wait(csd)" at the end.Btw, looking at this, I grew really suspicious of this code in
csd_unlock():WARN_ON((csd->flags & CSD_FLAG_WAIT) && !(csd->flags & CSD_FLAG_LOCK));because that makes no sense at all. It basically removes a sanity check, yet that sanity check makes a hell of a lot of sense. Unlocking a CSD that is not locked is *wrong*.
The crazy code code comes from commit
c84a83e2aaab("smp: don't warn aboutcsd->flagshavingCSD_FLAG_LOCKcleared for !wait") by Jens, but the explanation and the code is pure crap.There is no way in hell that it is ever correct to unlock an entry that isn't locked, so that whole
CSD_FLAG_WAITthing is buggy as hell.
Quoted 7 lines
The explanation in commit
c84a83e2aaabsays that "blk-mq reuses the request potentially immediately" and claims that that is somehow ok, but that's utter BS. Even if you don't ever wait for it, the CSD lock bit fundamentally also protects the "csd->llist" pointer. So what that commit actually does is to just remove a safety check, and do so in a very unsafe manner. And apparently block-mq re-uses something THAT IS STILL ACTIVELY IN USE. That's just horrible.
I agree that this description is probably utter crap. And now I do actually remember the issue at hand. The resource here is the tag, that decides what request we'll use, and subsequently what call_single_data storage is used. When this was originally done, blk-mq cleared the request from the function callback, instead of doing it at allocation time. The assumption here was cache hotness. That in turn also cleared ->csd, which meant that the flags got zeroed and csd_unlock() was naturally unhappy. THAT was the reuse case, not that the request would get reused before we had finished the IPI fn callback since that would obviously create other badness. Now I'm not sure what made me create that patch, which in retrospect is a bad hammer for this problem.
blk-mq doesn't do the init-at-finish time anymore, so it should not be hit by the issue. But if we do bring that back, then it would still work fine with Thomas' patch, since we unlock prior to running the callback.
Signature · 1 line
Jens Axboe
Quoted 30 lines · Jens Axboe
Quoted 21 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
Judging by the code disassembly, it's the "
csd_lock_wait(csd)" at the end.Btw, looking at this, I grew really suspicious of this code in
csd_unlock():WARN_ON((csd->flags & CSD_FLAG_WAIT) && !(csd->flags & CSD_FLAG_LOCK));because that makes no sense at all. It basically removes a sanity check, yet that sanity check makes a hell of a lot of sense. Unlocking a CSD that is not locked is *wrong*.
The crazy code code comes from commit
c84a83e2aaab("smp: don't warn aboutcsd->flagshavingCSD_FLAG_LOCKcleared for !wait") by Jens, but the explanation and the code is pure crap.There is no way in hell that it is ever correct to unlock an entry that isn't locked, so that whole
CSD_FLAG_WAITthing is buggy as hell.Quoted 7 lines
The explanation in commit
c84a83e2aaabsays that "blk-mq reuses the request potentially immediately" and claims that that is somehow ok, but that's utter BS. Even if you don't ever wait for it, the CSD lock bit fundamentally also protects the "csd->llist" pointer. So what that commit actually does is to just remove a safety check, and do so in a very unsafe manner. And apparently block-mq re-uses something THAT IS STILL ACTIVELY IN USE. That's just horrible.
Quoted 8 lines
I agree that this description is probably utter crap. And now I do actually remember the issue at hand. The resource here is the tag, that decides what request we'll use, and subsequently what
call_single_datastorage is used. When this was originally done, blk-mq cleared the request from the function callback, instead of doing it at allocation time. The assumption here was cache hotness. That in turn also cleared ->csd, which meant that the flags got zeroed andcsd_unlock()was naturally unhappy.
So that's exactly what I described in my other reply.
csd_lock(csd);
queue_csd();
ipi();
csd->func(csd->info);
wait_for_completion(csd);
complete(csd);
reuse_csd(csd);
csd_unlock(csd);When you call complete() nothing can rely on csd anymore, except for the smp core code ....
Quoted 4 lines
THAT was the reuse case, not that the request would get reused before we had finished the IPI fn callback since that would obviously create other badness. Now I'm not sure what made me create that patch, which in retrospect is a bad hammer for this problem.
Performance blindness?
Quoted 3 lines
blk-mq doesn't do the init-at-finish time anymore, so it should not be hit by the issue. But if we do bring that back, then it would still work fine with Thomas' patch, since we unlock prior to running the callback.
So if blk-mq is not relying on that, then we really should back out that stuff for 3.18 and tag it for stable.
Treating sync and async function calls differently makes sense, because any async caller which cannot deal with the unlock before call scheme is broken by definition already today. But that's material for next.
Thanks,
tglx
Quoted 2 lines · Thomas Gleixner
Quoted 2 lines
No, that won't work for synchronous calls:\
Right you are.
Quoted 1 line
So a combo of both (Jens and yours) might do the trick. Patch below.
Yeah, I guess that would work. The important part is that *if* somebody really reuses the csd, we'd better have a release barrier (which csd_unlock() does, although badly - but this probably isn't that performance-critical) *before* we call the function, because otherwise there's no real serialization for the reuse.
Of course, most of these things are presumably always per-cpu data structures, so the whole worry about "csd" being accessed from different CPU's probably doesn't even exist, and this all works fine as-is anyway, even in the presense of odd memory ordering issues.
Judging from Jens' later email, it looks like we simply don't need this code at all any more, though, and we could just revert the commit.
NOTE! I don't think this actually has anything to do with the actual problem that Dave saw. I just reacted to that WARN_ON() when I was looking at the code, and it made me go "that looks extremely suspicious".
Particularly on x86, with strong memory ordering, I don't think that any random accesses to 'csd' after the call to 'csd->func()' could actually matter. I just felt very nervous about the claim that somebody can reuse the csd immediately, that smelled bad to me from a *conceptual* standpoint, even if I suspect it works perfectly fine in practice.
Anyway, I've found *another* race condition, which (again) doesn't actually seem to be an issue on x86.
In particular, "csd_lock()" does things pretty well, in that it does a smp_mb() after setting the lock bit, so certainly nothing afterwards will leak out of that locked region.
But look at csd_lock_wait(). It just does
while (csd->flags & CSD_FLAG_LOCK)
cpu_relax();and basically there's no memory barriers there. Now, on x86, this is a non-issue, since all reads act as an acquire, but at least in *theory* we have this completely unordered read going on. So any subsequent memory oeprations (ie after the return from generic_exec_single() could in theory see data from *before* the read.
So that whole kernel/smp.c locking looks rather dubious. The smp_mb() in csd_lock() is overkill (a "smp_store_release()" should be sufficient), and I think that the read of csd->flags in csd_unlock() should be a smp_load_acquire().
Again, none of this has anything to do with Dave's problem. The memory ordering issues really cannot be an issue on x86, I'm just saying that there's code there that makes me a bit uncomfortable.
Linus
Quoted 8 lines · Linus Torvalds
Quoted 1 line · Thomas Gleixner
So a combo of both (Jens and yours) might do the trick. Patch below.
Yeah, I guess that would work. The important part is that *if* somebody really reuses the csd, we'd better have a release barrier (which
csd_unlock()does, although badly - but this probably isn't that performance-critical) *before* we call the function, because otherwise there's no real serialization for the reuse.
Indeed.
Quoted 8 lines
Of course, most of these things are presumably always per-cpu data structures, so the whole worry about "csd" being accessed from different CPU's probably doesn't even exist, and this all works fine as-is anyway, even in the presense of odd memory ordering issues.
Judging from Jens' later email, it looks like we simply don't need this code at all any more, though, and we could just revert the commit.
Right. Reverting it is the proper solution for now. Though we should really think about the async seperation later. It makes a lot of sense.
Quoted 4 lines
NOTE! I don't think this actually has anything to do with the actual problem that Dave saw. I just reacted to that
WARN_ON()when I was looking at the code, and it made me go "that looks extremely suspicious".
One thing I was looking into today is the increased use of irq_work which uses IPIs as well. Not sure whether that's related, but I it's not from my radar yet.
But the possible compiler wreckage (or exposed kernel wreckage) is frightening in several aspects ...
Quoted 16 lines
Particularly on x86, with strong memory ordering, I don't think that any random accesses to 'csd' after the call to '
csd->func()' could actually matter. I just felt very nervous about the claim that somebody can reuse the csd immediately, that smelled bad to me from a *conceptual* standpoint, even if I suspect it works perfectly fine in practice.Anyway, I've found *another* race condition, which (again) doesn't actually seem to be an issue on x86.
In particular, "
csd_lock()" does things pretty well, in that it does asmp_mb()after setting the lock bit, so certainly nothing afterwards will leak out of that locked region.But look at
csd_lock_wait(). It just does
Quoted 8 lines
while (csd->flags & CSD_FLAG_LOCK) cpu_relax();and basically there's no memory barriers there. Now, on x86, this is a non-issue, since all reads act as an acquire, but at least in *theory* we have this completely unordered read going on. So any subsequent memory oeprations (ie after the return from
generic_exec_single()could in theory see data from *before* the read.
True.
Quoted 8 lines
So that whole
kernel/smp.clocking looks rather dubious. Thesmp_mb()incsd_lock()is overkill (a "smp_store_release()" should be sufficient), and I think that the read ofcsd->flagsincsd_unlock()should be asmp_load_acquire().Again, none of this has anything to do with Dave's problem. The memory ordering issues really cannot be an issue on x86, I'm just saying that there's code there that makes me a bit uncomfortable.
Right you are and we should fix it asap.
Thanks,
tglx
Quoted 12 lines · Linus Torvalds
Quoted 8 lines · Dave Jones
It could a completely different cause for lockup, but seeing this now has me wondering if perhaps it's something unrelated to the kernel. I have recollection of running late .17rc's for days without incident, and I'm pretty sure .17 was ok too. But a few weeks ago I did upgrade that test box to the Fedora 21 beta. Which means I have a new gcc. I'm not sure I really trust 4.9.1 yet, so maybe I'll see if I can get 4.8 back on there and see if that's any better.
I'm not sure if I should be relieved or horrified.
Quoted 7 lines
Horrified, I think.
It really would be a wonderful thing to have some kind of "compiler bisection" with mixed object files to see exactly which file it miscompiles (and by "miscompiles" it might just be a kernel bug where we are missing a barrier or something, and older gcc's just happened to not show it - so it could still easily be a kernel problem).
After wasting countless hours rolling back to Fedora 20 and gcc 4.8.1, I saw the exact same trace on 3.17, so now I don't know what to think.
So it's great that it's not a regression vs .17, but otoh, who knows how far back this goes. This looks like a nightmarish bisect case, and I've no idea why it's now happening so often.
I'll give Don's softlockup_all_cpu_backtrace=1 idea a try on 3.18rc5 and see if that shines any more light on this.
Deeply puzzling.
Dave
Quoted 3 lines · Dave Jones
After wasting countless hours rolling back to Fedora 20 and gcc 4.8.1, I saw the exact same trace on 3.17, so now I don't know what to think.
Uhhuh.
Has anything else changed? New trinity tests? If it has happened in as little as ten minutes, and you don't recall having seen this until about a week ago, it does sound like something changed.
But yeah, try the softlockup_all_cpu_backtrace, maybe there's a pattern somewhere..
Linus
Quoted 51 lines · Thomas Gleixner
Quoted 30 lines · Jens Axboe
Quoted 21 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
Judging by the code disassembly, it's the "
csd_lock_wait(csd)" at the end.Btw, looking at this, I grew really suspicious of this code in
csd_unlock():WARN_ON((csd->flags & CSD_FLAG_WAIT) && !(csd->flags & CSD_FLAG_LOCK));because that makes no sense at all. It basically removes a sanity check, yet that sanity check makes a hell of a lot of sense. Unlocking a CSD that is not locked is *wrong*.
The crazy code code comes from commit
c84a83e2aaab("smp: don't warn aboutcsd->flagshavingCSD_FLAG_LOCKcleared for !wait") by Jens, but the explanation and the code is pure crap.There is no way in hell that it is ever correct to unlock an entry that isn't locked, so that whole
CSD_FLAG_WAITthing is buggy as hell.Quoted 7 lines
The explanation in commit
c84a83e2aaabsays that "blk-mq reuses the request potentially immediately" and claims that that is somehow ok, but that's utter BS. Even if you don't ever wait for it, the CSD lock bit fundamentally also protects the "csd->llist" pointer. So what that commit actually does is to just remove a safety check, and do so in a very unsafe manner. And apparently block-mq re-uses something THAT IS STILL ACTIVELY IN USE. That's just horrible.Quoted 8 lines
I agree that this description is probably utter crap. And now I do actually remember the issue at hand. The resource here is the tag, that decides what request we'll use, and subsequently what
call_single_datastorage is used. When this was originally done, blk-mq cleared the request from the function callback, instead of doing it at allocation time. The assumption here was cache hotness. That in turn also cleared ->csd, which meant that the flags got zeroed andcsd_unlock()was naturally unhappy.So that's exactly what I described in my other reply.
csd_lock(csd); queue_csd(); ipi(); csd->func(csd->info); wait_for_completion(csd); complete(csd); reuse_csd(csd); csd_unlock(csd);
Quoted 2 lines
When you call
complete()nothing can rely on csd anymore, except for the smp core code ....
Right, and I didn't. It was the core use of csd->flags afterwards that complained. blk-mq merely cleared ->flags in csd->func(), which (granted) was a bit weird. So it was just storing to csd (before unlock), but in an inappropriate way. It would obviously have broken a sync invocation, but the block layer never does that.
Quoted 6 lines
Quoted 4 lines
THAT was the reuse case, not that the request would get reused before we had finished the IPI fn callback since that would obviously create other badness. Now I'm not sure what made me create that patch, which in retrospect is a bad hammer for this problem.
Performance blindness?
Possibly...
Quoted 6 lines
Quoted 3 lines
blk-mq doesn't do the init-at-finish time anymore, so it should not be hit by the issue. But if we do bring that back, then it would still work fine with Thomas' patch, since we unlock prior to running the callback.
So if blk-mq is not relying on that, then we really should back out that stuff for 3.18 and tag it for stable.
Yeah, I'd be fine with doing that. I don't recall at the top of my head when when we stopped doing the clear at free time, but it was relatively early. OK, so checked, and 3.15 does init at free time, and 3.16 and later does it at allocation time. So the revert can only safely be applied to 3.16 and later...
Quoted 4 lines
Treating sync and async function calls differently makes sense, because any async caller which cannot deal with the unlock before call scheme is broken by definition already today. But that's material for next.
Agree.
Signature · 1 line
Jens Axboe
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Dave Jones
After wasting countless hours rolling back to Fedora 20 and gcc 4.8.1, I saw the exact same trace on 3.17, so now I don't know what to think.
Uhhuh.
Has anything else changed? New trinity tests? If it has happened in as little as ten minutes, and you don't recall having seen this until about a week ago, it does sound like something changed.
Looking at the trinity commits over the last month or so, there's a few new things, but nothing that sounds like it would trip up a bug like this. "generate random ascii strings" and "mess with fcntl's after opening fd's on startup" being the stand-outs. Everything else is pretty much cleanups and code-motion. There was a lot of work on the code that tracks mmaps about a month ago, but that shouldn't have had any visible runtime differences.
<runs git diff>
hm, something I changed not that long ago, which I didn't commit yet, was that it now runs more child processes than it used to (was 64, now 256) I've been running like that for a while though. I want to say that was before .17, but I'm not 100% sure.
So it could be that I'm just generating a lot more load now. I could drop that back down and see if it 'goes away' or at least happens less, but it strikes me that there's something here that needs fixing regardless.
Dave
Quoted 5 lines · Dave Jones
So it could be that I'm just generating a lot more load now. I could drop that back down and see if it 'goes away' or at least happens less, but it strikes me that there's something here that needs fixing regardless.
Oh, absolutely. It's more a question of "maybe what changed can give us a clue".
But if it' something like "more load", that's not going to help pinpoint, and you might be better off just doing the all-cpu-backtrace thing and hope that gives some pattern to appreciate..
Linus
Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Dave Jones
So it could be that I'm just generating a lot more load now. I could drop that back down and see if it 'goes away' or at least happens less, but it strikes me that there's something here that needs fixing regardless.
Quoted 5 lines
Oh, absolutely. It's more a question of "maybe what changed can give us a clue".
But if it' something like "more load", that's not going to help pinpoint, and you might be better off just doing the all-cpu-backtrace thing and hope that gives some pattern to appreciate..
Here's the first hit. Curiously, one cpu is missing.
NMI watchdog: BUG: soft lockup - CPU#1 stuck for 23s! [trinity-c180:17837]
Modules linked in: dlci snd_seq_dummy fuse tun rfcomm bnep hidp scsi_transport_iscsi af_key llc2 can_raw nfnetlink can_bcm sctp libcrc32c nfc caif_socket caif af_802154 ieee802154 phonet af_rxrpc bluetooth can pppoe pppox ppp_generic slhc irda crc_ccitt rds rose x25 atm netrom appletalk ipx p8023 psnap p8022 llc ax25 cfg80211 rfkill coretemp hwmon x86_pkg_temp_thermal kvm_intel kvm snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic crct10dif_pclmul crc32c_intel ghash_clmulni_intel microcode serio_raw pcspkr usb_debug snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm e1000e snd_timer ptp shpchp snd pps_core soundcore nfsd auth_rpcgss oid_registry nfs_acl lockd grace sunrpc irq event stamp: 2258092 hardirqs last enabled at (2258091): [<ffffffffa91a58b5>] get_page_from_freelist+0x555/0xaa0 hardirqs last disabled at (2258092): [<ffffffffa985396a>] apic_timer_interrupt+0x6a/0x80 softirqs last enabled at (2244380): [<ffffffffa907b87f>] __do_softirq+0x24f/0x6f0 softirqs last disabled at (2244377): [<ffffffffa907c0dd>] irq_exit+0x13d/0x160 CPU: 1 PID: 17837 Comm: trinity-c180 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 35/402 20526] task: ffff8801575e4680 ti: ffff880202434000 task.ti: ffff880202434000 RIP: 0010:[<ffffffffa91a0db0>] [<ffffffffa91a0db0>] bad_range+0x0/0x90 RSP: 0018:ffff8802024377a0 EFLAGS: 00000246 RAX: ffff8801575e4680 RBX: 0000000000000007 RCX: 0000000000000006 RDX: 0000000000002a20 RSI: ffffea0000887fc0 RDI: ffff88024d64c740 RBP: ffff880202437898 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000020 R14: 00000000001d8608 R15: 00000000001d8668 FS: 00007fd3b8960740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fd3b5ea0777 CR3: 00000001027cd000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffffffffa91a58c4 00000000000009e4 ffff8801575e4680 0000000000000001 ffff88024d64dd08 0000010000000000 0000000000000000 ffff8802024377f8 0000000000000000 ffff88024d64dd00 ffffffffa90ac411 ffffffff00000003 Call Trace: [<ffffffffa91a58c4>] ? get_page_from_freelist+0x564/0xaa0 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa91a6030>] __alloc_pages_nodemask+0x230/0xd20 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa90d1e45>] ? mark_held_locks+0x75/0xa0 [<ffffffffa91f400e>] alloc_pages_vma+0xee/0x1b0 [<ffffffffa91b643e>] ? shmem_alloc_page+0x6e/0xc0 [<ffffffffa91b643e>] shmem_alloc_page+0x6e/0xc0 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa90ac58b>] ? preempt_count_sub+0x7b/0x100 [<ffffffffa93dcc46>] ? __percpu_counter_add+0x86/0xb0 [<ffffffffa91d50d6>] ? __vm_enough_memory+0x66/0x1c0 [<ffffffffa919ad65>] ? find_get_entry+0x5/0x230 [<ffffffffa933b10c>] ? cap_vm_enough_memory+0x4c/0x60 [<ffffffffa91b8ff0>] shmem_getpage_gfp+0x630/0xa40 [<ffffffffa90cee01>] ? match_held_lock+0x111/0x160 [<ffffffffa91b9442>] shmem_write_begin+0x42/0x70 [<ffffffffa919a684>] generic_perform_write+0xd4/0x1f0 [<ffffffffa919d5d2>] __generic_file_write_iter+0x162/0x350 [<ffffffffa92154a0>] ? new_sync_read+0xd0/0xd0 [<ffffffffa919d7ff>] generic_file_write_iter+0x3f/0xb0 [<ffffffffa919d7c0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffffa92155e8>] do_iter_readv_writev+0x78/0xc0 [<ffffffffa9216e18>] do_readv_writev+0xd8/0x2a0 [<ffffffffa919d7c0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffffa90cf426>] ? lock_release_holdtime.part.28+0xe6/0x160 [<ffffffffa919d7c0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa90ac58b>] ? preempt_count_sub+0x7b/0x100 [<ffffffffa90e782e>] ? rcu_read_lock_held+0x6e/0x80 [<ffffffffa921706c>] vfs_writev+0x3c/0x50 [<ffffffffa92171dc>] SyS_writev+0x5c/0x100 [<ffffffffa9852c49>] tracesys_phase2+0xd4/0xd9 Code: 09 48 83 f2 01 83 e2 01 eb a3 90 48 c7 c7 a0 8c e4 a9 e8 44 e1 f2 ff 85 c0 75 d2 eb c1 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 <0f> 1f 44 00 00 48 b8 00 00 00 00 00 16 00 00 55 4c 8b 47 68 48 sending NMI to other CPUs: NMI backtrace for cpu 2 CPU: 2 PID: 15913 Comm: trinity-c141 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 35/402 20526] task: ffff880223229780 ti: ffff8801afca0000 task.ti: ffff8801afca0000 RIP: 0010:[<ffffffffa9116dbe>] [<ffffffffa9116dbe>] generic_exec_single+0xee/0x1a0 RSP: 0018:ffff8801afca3928 EFLAGS: 00000202 RAX: ffff8802443d9d00 RBX: ffff8801afca3930 RCX: ffff8802443d9dc0 RDX: ffff8802443d4d80 RSI: ffff8801afca3930 RDI: ffff8801afca3930 RBP: ffff8801afca3988 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000001 R14: ffff8801afca3a48 R15: ffffffffa9045bb0 FS: 00007fd3b8960740(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000008 CR3: 000000022f8bd000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff8801afca3a08 ffff8802443d9dc0 ffffffffa9045bb0 ffff8801afca3a48 0000000000000003 000000007b19adc3 0000000000000001 00000000ffffffff 0000000000000001 ffffffffa9045bb0 ffff8801afca3a48 0000000000000001 Call Trace: [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9116f3a>] smp_call_function_single+0x6a/0xe0 [<ffffffffa93b2e1f>] ? cpumask_next_and+0x4f/0xb0 [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9117679>] smp_call_function_many+0x2b9/0x320 [<ffffffffa9046370>] flush_tlb_mm_range+0xe0/0x370 [<ffffffffa91cc762>] tlb_flush_mmu_tlbonly+0x42/0x50 [<ffffffffa91cdd28>] unmap_single_vma+0x6b8/0x900 [<ffffffffa91ce06c>] zap_page_range_single+0xfc/0x160 [<ffffffffa91ce254>] unmap_mapping_range+0x134/0x190 [<ffffffffa91bb9dd>] shmem_fallocate+0x4fd/0x520 [<ffffffffa90c7c77>] ? prepare_to_wait+0x27/0x90 [<ffffffffa9213bc2>] do_fallocate+0x132/0x1d0 [<ffffffffa91e3228>] SyS_madvise+0x398/0x870 [<ffffffffa983f6c0>] ? rcu_read_lock_sched_held+0x4e/0x6a [<ffffffffa9013877>] ? syscall_trace_enter_phase2+0xa7/0x2b0 [<ffffffffa9852c49>] tracesys_phase2+0xd4/0xd9 Code: 48 89 de 48 03 14 c5 60 74 f1 a9 48 89 df e8 0a fa 2a 00 84 c0 75 46 45 85 ed 74 11 f6 43 18 01 74 0b 0f 1f 00 f3 90 f6 43 18 01 <75> f8 31 c0 48 8b 4d c8 65 48 33 0c 25 28 00 00 00 0f 85 8e 00 NMI backtrace for cpu 0 INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 37.091 msecs CPU: 0 PID: 15851 Comm: trinity-c80 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 36/402 20526] task: ffff8801874e8000 ti: ffff88022baec000 task.ti: ffff88022baec000 RIP: 0010:[<ffffffffa90ac450>] [<ffffffffa90ac450>] preempt_count_add+0x0/0xc0 RSP: 0000:ffff880244003c30 EFLAGS: 00000092 RAX: 0000000000000001 RBX: ffffffffa9edb560 RCX: 0000000000000001 RDX: 0000000000000001 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffff880244003c48 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: ffff8801874e88c8 [23543.271956] NMI backtrace for cpu 3 INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 100.612 msecs CPU: 3 PID: 0 Comm: swapper/3 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 37/402 20526] task: ffff880242b5c680 ti: ffff880242b78000 task.ti: ffff880242b78000 RIP: 0010:[<ffffffffa94251b5>] [<ffffffffa94251b5>] intel_idle+0xd5/0x180 RSP: 0018:ffff880242b7bdf8 EFLAGS: 00000046 RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffff880242b7bfd8 RDI: 0000000000000003 RBP: ffff880242b7be28 R08: 000000008baf8f3d R09: 0000000000000000 R10: 0000000000000000 R11: ffff880242b5cea0 R12: 0000000000000005 R13: 0000000000000032 R14: 0000000000000004 R15: ffff880242b78000 FS: 0000000000000000(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000b1c9ac CR3: 0000000029e11000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: 0000000342b7be28 afc453cb003f4590 ffffe8ffff402200 0000000000000005 ffffffffa9eaa0c0 0000000000000003 ffff880242b7be78 ffffffffa96bbb45 0000156cc07cf6e3 ffffffffa9eaa290 0000000000000096 ffffffffa9f197b0 Call Trace: [<ffffffffa96bbb45>] cpuidle_enter_state+0x55/0x300 [<ffffffffa96bbea7>] cpuidle_enter+0x17/0x20 [<ffffffffa90c88f5>] cpu_startup_entry+0x4e5/0x630 [<ffffffffa902d523>] start_secondary+0x1a3/0x220 Code: 31 d2 65 48 8b 34 25 08 ba 00 00 48 8d 86 38 c0 ff ff 48 89 d1 0f 01 c8 48 8b 86 38 c0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <65> 48 8b 0c 25 08 ba 00 00 f0 80 a1 3a c0 ff ff df 0f ae f0 48
INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 125.739 msecs
Quoted 2 lines · Dave Jones
Here's the first hit. Curiously, one cpu is missing.
That might be the CPU3 that isn't responding to IPIs due to some bug..
Quoted 2 lines
NMI watchdog: BUG: soft lockup - CPU#1 stuck for 23s! [trinity-c180:17837]
RIP: 0010:[<ffffffffa91a0db0>] [<ffffffffa91a0db0>] bad_range+0x0/0x90
Hmm. Something looping in the page allocator? Not waiting for a lock, but livelocked? I'm not seeing anything here that should trigger the NMI watchdog at all.
Can the NMI watchdog get confused somehow?
Quoted 5 lines
Call Trace: [<ffffffffa91a6030>] __alloc_pages_nodemask+0x230/0xd20 [<ffffffffa91f400e>] alloc_pages_vma+0xee/0x1b0 [<ffffffffa91b643e>] shmem_alloc_page+0x6e/0xc0 [<ffffffffa91b8ff0>] shmem_getpage_gfp+0x630/0xa40
Quoted 8 lines
[<ffffffffa91b9442>] shmem_write_begin+0x42/0x70 [<ffffffffa919a684>] generic_perform_write+0xd4/0x1f0 [<ffffffffa919d5d2>] __generic_file_write_iter+0x162/0x350 [<ffffffffa919d7ff>] generic_file_write_iter+0x3f/0xb0 [<ffffffffa92155e8>] do_iter_readv_writev+0x78/0xc0 [<ffffffffa9216e18>] do_readv_writev+0xd8/0x2a0 [<ffffffffa90cf426>] ? lock_release_holdtime.part.28+0xe6/0x160 [<ffffffffa921706c>] vfs_writev+0x3c/0x50
And CPU2 is in that TLB flusher again:
Quoted 11 lines
NMI backtrace for cpu 2
RIP: 0010:[<ffffffffa9116dbe>] [<ffffffffa9116dbe>] generic_exec_single+0xee/0x1a0 Call Trace: [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9116f3a>] smp_call_function_single+0x6a/0xe0 [<ffffffffa9117679>] smp_call_function_many+0x2b9/0x320 [<ffffffffa9046370>] flush_tlb_mm_range+0xe0/0x370 [<ffffffffa91cc762>] tlb_flush_mmu_tlbonly+0x42/0x50 [<ffffffffa91cdd28>] unmap_single_vma+0x6b8/0x900 [<ffffffffa91ce06c>] zap_page_range_single+0xfc/0x160 [<ffffffffa91ce254>] unmap_mapping_range+0x134/0x190
.. and the code line implies that it's in that csd_lock_wait() loop, again consistent with waiting for some other CPU. Presumably the missing CPU3.
Quoted 7 lines
NMI backtrace for cpu 0
RIP: 0010:[<ffffffffa90ac450>] [<ffffffffa90ac450>] preempt_count_add+0x0/0xc0 Call Trace: [<ffffffffa96bbb45>] cpuidle_enter_state+0x55/0x300 [<ffffffffa96bbea7>] cpuidle_enter+0x17/0x20 [<ffffffffa90c88f5>] cpu_startup_entry+0x4e5/0x630 [<ffffffffa902d523>] start_secondary+0x1a3/0x220
And CPU0 is just in the idle loop (that RIP is literally the instruction after the "mwait" according to the code line).
Quoted 1 line
INFO: NMI handler (
arch_trigger_all_cpu_backtrace_handler) took too long to run: 125.739 msecs
.. and that's us giving up on CPU3.
So it does look like CPU3 is the problem, but sadly, CPU3 is apparently not listening, and doesn't even react to the NMI, much less a TLB flush IPI.
Not reacting to NMI could be:
(a) some APIC state issue
(b) we're already stuck in a loop in the previous NMI handler
(c) what?
Anybody?
Linus
Quoted 1 line · Dave Jones
Here's the first hit. Curiously, one cpu is missing.
I don't think so
Quoted 5 lines
NMI watchdog: BUG: soft lockup - CPU#1 stuck for 23s! [trinity-c180:17837]
irq event stamp: 2258092 hardirqs last enabled at (2258091): [<ffffffffa91a58b5>] get_page_from_freelist+0x555/0xaa0 hardirqs last disabled at (2258092): [<ffffffffa985396a>] apic_timer_interrupt+0x6a/0x80
So that means we are in the timer interrupt and handling watchdog_timer_fn.
Quoted 3 lines
CPU: 1 PID: 17837 Comm: trinity-c180 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 35/402 20526] task: ffff8801575e4680 ti: ffff880202434000 task.ti: ffff880202434000 RIP: 0010:[<ffffffffa91a0db0>] [<ffffffffa91a0db0>] bad_range+0x0/0x90
So the softlockup tells us, that the high priority watchdog thread was not able to touch the watchdog timestamp. That means this task was hogging the CPU for 20+ seconds. I have no idea how that happens in that call chain.
Call Trace: [<ffffffffa91a58c4>] ? get_page_from_freelist+0x564/0xaa0 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa91a6030>] __alloc_pages_nodemask+0x230/0xd20 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa90d1e45>] ? mark_held_locks+0x75/0xa0 [<ffffffffa91f400e>] alloc_pages_vma+0xee/0x1b0 [<ffffffffa91b643e>] ? shmem_alloc_page+0x6e/0xc0 [<ffffffffa91b643e>] shmem_alloc_page+0x6e/0xc0 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa90ac58b>] ? preempt_count_sub+0x7b/0x100 [<ffffffffa93dcc46>] ? __percpu_counter_add+0x86/0xb0 [<ffffffffa91d50d6>] ? __vm_enough_memory+0x66/0x1c0 [<ffffffffa919ad65>] ? find_get_entry+0x5/0x230 [<ffffffffa933b10c>] ? cap_vm_enough_memory+0x4c/0x60 [<ffffffffa91b8ff0>] shmem_getpage_gfp+0x630/0xa40 [<ffffffffa90cee01>] ? match_held_lock+0x111/0x160 [<ffffffffa91b9442>] shmem_write_begin+0x42/0x70 [<ffffffffa919a684>] generic_perform_write+0xd4/0x1f0 [<ffffffffa919d5d2>] __generic_file_write_iter+0x162/0x350 [<ffffffffa92154a0>] ? new_sync_read+0xd0/0xd0 [<ffffffffa919d7ff>] generic_file_write_iter+0x3f/0xb0 [<ffffffffa919d7c0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffffa92155e8>] do_iter_readv_writev+0x78/0xc0 [<ffffffffa9216e18>] do_readv_writev+0xd8/0x2a0 [<ffffffffa919d7c0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffffa90cf426>] ? lock_release_holdtime.part.28+0xe6/0x160 [<ffffffffa919d7c0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa90ac58b>] ? preempt_count_sub+0x7b/0x100 [<ffffffffa90e782e>] ? rcu_read_lock_held+0x6e/0x80 [<ffffffffa921706c>] vfs_writev+0x3c/0x50 [<ffffffffa92171dc>] SyS_writev+0x5c/0x100 [<ffffffffa9852c49>] tracesys_phase2+0xd4/0xd9
But this gets pages for a write into shmem and the other one below does a madvise on a shmem map. Coincidence?
Quoted 1 line
sending NMI to other CPUs:
So here we kick the other cpus
Quoted 14 lines
NMI backtrace for cpu 2
CPU: 2 PID: 15913 Comm: trinity-c141 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 35/402 20526] task: ffff880223229780 ti: ffff8801afca0000 task.ti: ffff8801afca0000 RIP: 0010:[<ffffffffa9116dbe>] [<ffffffffa9116dbe>] generic_exec_single+0xee/0x1a0 [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9116f3a>] smp_call_function_single+0x6a/0xe0 [<ffffffffa93b2e1f>] ? cpumask_next_and+0x4f/0xb0 [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9117679>] smp_call_function_many+0x2b9/0x320 [<ffffffffa9046370>] flush_tlb_mm_range+0xe0/0x370 [<ffffffffa91cc762>] tlb_flush_mmu_tlbonly+0x42/0x50 [<ffffffffa91cdd28>] unmap_single_vma+0x6b8/0x900 [<ffffffffa91ce06c>] zap_page_range_single+0xfc/0x160
Quoted 8 lines
[<ffffffffa91ce254>] unmap_mapping_range+0x134/0x190 [<ffffffffa91bb9dd>] shmem_fallocate+0x4fd/0x520 [<ffffffffa90c7c77>] ? prepare_to_wait+0x27/0x90 [<ffffffffa9213bc2>] do_fallocate+0x132/0x1d0 [<ffffffffa91e3228>] SyS_madvise+0x398/0x870 [<ffffffffa983f6c0>] ? rcu_read_lock_sched_held+0x4e/0x6a [<ffffffffa9013877>] ? syscall_trace_enter_phase2+0xa7/0x2b0 [<ffffffffa9852c49>] tracesys_phase2+0xd4/0xd9
We've seen that before
Quoted 2 lines
NMI backtrace for cpu 0
INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 37.091 msecs
So it complains that the backtrace handler took 37 msec, which is indeed long for just dumping a stack trace.
Quoted 8 lines
CPU: 0 PID: 15851 Comm: trinity-c80 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 36/402 20526] task: ffff8801874e8000 ti: ffff88022baec000 task.ti: ffff88022baec000 RIP: 0010:[<ffffffffa90ac450>] [<ffffffffa90ac450>] preempt_count_add+0x0/0xc0 RSP: 0000:ffff880244003c30 EFLAGS: 00000092 RAX: 0000000000000001 RBX: ffffffffa9edb560 RCX: 0000000000000001 RDX: 0000000000000001 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffff880244003c48 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: ffff8801874e88c8 [23543.271956] NMI backtrace for cpu 3
So here we mangle CPU3 in and lose the backtrace for cpu0, which might be the real interesting one ....
Quoted 1 line
INFO: NMI handler (
arch_trigger_all_cpu_backtrace_handler) took too long to run: 100.612 msecs
This one takes 100ms.
Quoted 3 lines
CPU: 3 PID: 0 Comm: swapper/3 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 37/402 20526] task: ffff880242b5c680 ti: ffff880242b78000 task.ti: ffff880242b78000 RIP: 0010:[<ffffffffa94251b5>] [<ffffffffa94251b5>] intel_idle+0xd5/0x180
So that one is simply idle.
Quoted 2 lines
INFO: NMI handler (
arch_trigger_all_cpu_backtrace_handler) took too long to run: 125.739 msecs
And we get another backtrace handler taking too long. Of course we cannot tell which of the 3 complaints comes from which cpu, because the printk lacks a cpuid.
Thanks,
tglx
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Dave Jones
Here's the first hit. Curiously, one cpu is missing.
That might be the CPU3 that isn't responding to IPIs due to some bug..
Quoted 8 lines
Quoted 2 lines
NMI watchdog: BUG: soft lockup - CPU#1 stuck for 23s! [trinity-c180:17837]
RIP: 0010:[<ffffffffa91a0db0>] [<ffffffffa91a0db0>] bad_range+0x0/0x90Hmm. Something looping in the page allocator? Not waiting for a lock, but livelocked? I'm not seeing anything here that should trigger the NMI watchdog at all.
Can the NMI watchdog get confused somehow?
That's the soft lockup detector which runs from the timer interrupt not from NMI.
Quoted 2 lines
So it does look like CPU3 is the problem, but sadly, CPU3 is apparently not listening, and doesn't even react to the NMI, much less
As I said in the other mail. It gets the NMI and reacts on it. It's just mangled into the CPU0 backtrace.
Thanks,
tglx
Quoted 16 lines · Thomas Gleixner
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Dave Jones
Here's the first hit. Curiously, one cpu is missing.
That might be the CPU3 that isn't responding to IPIs due to some bug..
Quoted 8 lines
Quoted 2 lines
NMI watchdog: BUG: soft lockup - CPU#1 stuck for 23s! [trinity-c180:17837]
RIP: 0010:[<ffffffffa91a0db0>] [<ffffffffa91a0db0>] bad_range+0x0/0x90Hmm. Something looping in the page allocator? Not waiting for a lock, but livelocked? I'm not seeing anything here that should trigger the NMI watchdog at all.
Can the NMI watchdog get confused somehow?
Quoted 8 lines
That's the soft lockup detector which runs from the timer interrupt not from NMI.
Quoted 2 lines
So it does look like CPU3 is the problem, but sadly, CPU3 is apparently not listening, and doesn't even react to the NMI, much less
As I said in the other mail. It gets the NMI and reacts on it. It's just mangled into the CPU0 backtrace.
I was going to reply about both points too. :-) Though the mangling looks odd because we have spin_locks serializing the output for each cpu.
Another thing I wanted to ask DaveJ, did you recently turn on CONFIG_PREEMPT? That would explain why you are seeing the softlockups now. If you disable CONFIG_PREEMPT does the softlockups disappear.
Cheers,
Don
Quoted 6 lines · Don Zickus
I was going to reply about both points too. :-) Though the mangling looks odd because we have
spin_locksserializing the output for each cpu.Another thing I wanted to ask DaveJ, did you recently turn on
CONFIG_PREEMPT? That would explain why you are seeing the softlockups now. If you disableCONFIG_PREEMPTdoes the softlockups disappear.
I've had it on on my test box forever. I'll add trying turning to off to the list of things to try.
Dave
Quoted 105 lines · Thomas Gleixner
Quoted 1 line · Dave Jones
Here's the first hit. Curiously, one cpu is missing.
I don't think so
Quoted 5 lines
NMI watchdog: BUG: soft lockup - CPU#1 stuck for 23s! [trinity-c180:17837]
irq event stamp: 2258092 hardirqs last enabled at (2258091): [<ffffffffa91a58b5>] get_page_from_freelist+0x555/0xaa0 hardirqs last disabled at (2258092): [<ffffffffa985396a>] apic_timer_interrupt+0x6a/0x80So that means we are in the timer interrupt and handling
watchdog_timer_fn.Quoted 3 lines
CPU: 1 PID: 17837 Comm: trinity-c180 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 35/402 20526] task: ffff8801575e4680 ti: ffff880202434000 task.ti: ffff880202434000 RIP: 0010:[<ffffffffa91a0db0>] [<ffffffffa91a0db0>] bad_range+0x0/0x90So the softlockup tells us, that the high priority watchdog thread was not able to touch the watchdog timestamp. That means this task was hogging the CPU for 20+ seconds. I have no idea how that happens in that call chain.
Call Trace: [<ffffffffa91a58c4>] ? get_page_from_freelist+0x564/0xaa0 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa91a6030>] __alloc_pages_nodemask+0x230/0xd20 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa90d1e45>] ? mark_held_locks+0x75/0xa0 [<ffffffffa91f400e>] alloc_pages_vma+0xee/0x1b0 [<ffffffffa91b643e>] ? shmem_alloc_page+0x6e/0xc0 [<ffffffffa91b643e>] shmem_alloc_page+0x6e/0xc0 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa90ac58b>] ? preempt_count_sub+0x7b/0x100 [<ffffffffa93dcc46>] ? __percpu_counter_add+0x86/0xb0 [<ffffffffa91d50d6>] ? __vm_enough_memory+0x66/0x1c0 [<ffffffffa919ad65>] ? find_get_entry+0x5/0x230 [<ffffffffa933b10c>] ? cap_vm_enough_memory+0x4c/0x60 [<ffffffffa91b8ff0>] shmem_getpage_gfp+0x630/0xa40 [<ffffffffa90cee01>] ? match_held_lock+0x111/0x160 [<ffffffffa91b9442>] shmem_write_begin+0x42/0x70 [<ffffffffa919a684>] generic_perform_write+0xd4/0x1f0 [<ffffffffa919d5d2>] __generic_file_write_iter+0x162/0x350 [<ffffffffa92154a0>] ? new_sync_read+0xd0/0xd0 [<ffffffffa919d7ff>] generic_file_write_iter+0x3f/0xb0 [<ffffffffa919d7c0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffffa92155e8>] do_iter_readv_writev+0x78/0xc0 [<ffffffffa9216e18>] do_readv_writev+0xd8/0x2a0 [<ffffffffa919d7c0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffffa90cf426>] ? lock_release_holdtime.part.28+0xe6/0x160 [<ffffffffa919d7c0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffffa90ac411>] ? get_parent_ip+0x11/0x50 [<ffffffffa90ac58b>] ? preempt_count_sub+0x7b/0x100 [<ffffffffa90e782e>] ? rcu_read_lock_held+0x6e/0x80 [<ffffffffa921706c>] vfs_writev+0x3c/0x50 [<ffffffffa92171dc>] SyS_writev+0x5c/0x100 [<ffffffffa9852c49>] tracesys_phase2+0xd4/0xd9But this gets pages for a write into shmem and the other one below does a madvise on a shmem map. Coincidence?
Quoted 1 line
sending NMI to other CPUs:
So here we kick the other cpus
Quoted 14 lines
NMI backtrace for cpu 2
CPU: 2 PID: 15913 Comm: trinity-c141 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 35/402 20526] task: ffff880223229780 ti: ffff8801afca0000 task.ti: ffff8801afca0000 RIP: 0010:[<ffffffffa9116dbe>] [<ffffffffa9116dbe>] generic_exec_single+0xee/0x1a0 [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9116f3a>] smp_call_function_single+0x6a/0xe0 [<ffffffffa93b2e1f>] ? cpumask_next_and+0x4f/0xb0 [<ffffffffa9045bb0>] ? do_flush_tlb_all+0x60/0x60 [<ffffffffa9117679>] smp_call_function_many+0x2b9/0x320 [<ffffffffa9046370>] flush_tlb_mm_range+0xe0/0x370 [<ffffffffa91cc762>] tlb_flush_mmu_tlbonly+0x42/0x50 [<ffffffffa91cdd28>] unmap_single_vma+0x6b8/0x900 [<ffffffffa91ce06c>] zap_page_range_single+0xfc/0x160Quoted 8 lines
[<ffffffffa91ce254>] unmap_mapping_range+0x134/0x190 [<ffffffffa91bb9dd>] shmem_fallocate+0x4fd/0x520 [<ffffffffa90c7c77>] ? prepare_to_wait+0x27/0x90 [<ffffffffa9213bc2>] do_fallocate+0x132/0x1d0 [<ffffffffa91e3228>] SyS_madvise+0x398/0x870 [<ffffffffa983f6c0>] ? rcu_read_lock_sched_held+0x4e/0x6a [<ffffffffa9013877>] ? syscall_trace_enter_phase2+0xa7/0x2b0 [<ffffffffa9852c49>] tracesys_phase2+0xd4/0xd9We've seen that before
Quoted 2 lines
NMI backtrace for cpu 0
INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 37.091 msecsSo it complains that the backtrace handler took 37 msec, which is indeed long for just dumping a stack trace.
Quoted 8 lines
CPU: 0 PID: 15851 Comm: trinity-c80 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 36/402 20526] task: ffff8801874e8000 ti: ffff88022baec000 task.ti: ffff88022baec000 RIP: 0010:[<ffffffffa90ac450>] [<ffffffffa90ac450>] preempt_count_add+0x0/0xc0 RSP: 0000:ffff880244003c30 EFLAGS: 00000092 RAX: 0000000000000001 RBX: ffffffffa9edb560 RCX: 0000000000000001 RDX: 0000000000000001 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffff880244003c48 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: ffff8801874e88c8 [23543.271956] NMI backtrace for cpu 3
Quoted 2 lines
So here we mangle CPU3 in and lose the backtrace for cpu0, which might be the real interesting one ....
Dave,
Can you provide another dump? The hope is we get something not mangled?
The other option we have done in RHEL is panic the system and let kdump capture the memory. Then we can analyze the vmcore for the stack trace cpu0 stored in memory to get a rough idea where it might be if the cpu isn't responding very well.
Cheers,
Don
Quoted 29 lines
Quoted 2 lines
INFO: NMI handler (
arch_trigger_all_cpu_backtrace_handler) took too long to run: 100.612 msecsThis one takes 100ms.
Quoted 3 lines
CPU: 3 PID: 0 Comm: swapper/3 Not tainted 3.18.0-rc5+ #90 [loadavg: 199.00 178.81 173.92 37/402 20526] task: ffff880242b5c680 ti: ffff880242b78000 task.ti: ffff880242b78000 RIP: 0010:[<ffffffffa94251b5>] [<ffffffffa94251b5>] intel_idle+0xd5/0x180So that one is simply idle.
Quoted 2 lines
INFO: NMI handler (
arch_trigger_all_cpu_backtrace_handler) took too long to run: 125.739 msecsAnd we get another backtrace handler taking too long. Of course we cannot tell which of the 3 complaints comes from which cpu, because the printk lacks a cpuid.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 4 lines · Don Zickus
Quoted 2 lines
So here we mangle CPU3 in and lose the backtrace for cpu0, which might be the real interesting one ....
Can you provide another dump? The hope is we get something not mangled?
Working on it..
Quoted 4 lines
The other option we have done in RHEL is panic the system and let kdump capture the memory. Then we can analyze the vmcore for the stack trace cpu0 stored in memory to get a rough idea where it might be if the cpu isn't responding very well.
I don't know if it's because of the debug options I typically run with, or that I'm perpetually cursed, but I've never managed to get kdump to do anything useful. (The last time I tried it was actively harmful in that not only did it fail to dump anything, it wedged the machine so it didn't reboot after panic).
Unless there's some magic step missing from the documentation at
http://fedoraproject.org/wiki/How_to_use_kdump_to_debug_kernel_crashes
then I'm not optimistic it'll be useful.
Dave
Quoted 1 line · Don Zickus
Can you provide another dump? The hope is we get something not mangled?
Ok, here's another instance.
This time around, we got all 4 cpu traces.
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 21s! [trinity-c42:31480]
CPU: 2 PID: 31480 Comm: trinity-c42 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 9/411 32140] task: ffff88023fda4680 ti: ffff880101ee0000 task.ti: ffff880101ee0000 RIP: 0010:[<ffffffff8a1798b4>] [<ffffffff8a1798b4>] context_tracking_user_enter+0xa4/0x190 RSP: 0018:ffff880101ee3f00 EFLAGS: 00000282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff8802445d1258 RDX: 0000000000000001 RSI: ffffffff8aac2c64 RDI: ffffffff8aa94505 RBP: ffff880101ee3f10 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff880101ee3ec0 R13: ffffffff8a38c577 R14: ffff880101ee3e70 R15: ffffffff8aa9ee99 FS: 00007f706c089740(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000001bf67f000 CR4: 00000000001407e0 DR0: 00007f0b19510000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff880101ee3f58 00007f706bcd0000 ffff880101ee3f40 ffffffff8a012fc5 0000000000000000 0000000000007c1b 00007f706bcd0000 00007f706bcd0068 0000000000000000 ffffffff8a7d8624 000000001008feff 0000000000000000 Call Trace: [<ffffffff8a012fc5>] syscall_trace_leave+0xa5/0x160 [<ffffffff8a7d8624>] int_check_syscall_exit_work+0x34/0x3d Code: 75 4d 48 c7 c7 64 2c ac 8a e8 e9 2c 21 00 65 c7 04 25 54 f7 1c 00 01 00 00 00 41 f7 c4 00 02 00 00 74 1c e8 8f 44 fd ff 41 54 9d <5b> 41 5c 5d c3 0f 1f 80 00 00 00 00 f3 c3 66 0f 1f 44 00 00 41 sending NMI to other CPUs: NMI backtrace for cpu 0 CPU: 0 PID: 27716 Comm: kworker/0:1 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 9/411 32140] Workqueue: events nohz_kick_work_fn task: ffff88017c358000 ti: ffff8801d7124000 task.ti: ffff8801d7124000 RIP: 0010:[<ffffffff8a0ffb52>] [<ffffffff8a0ffb52>] smp_call_function_many+0x1b2/0x320 RSP: 0018:ffff8801d7127cb8 EFLAGS: 00000202 RAX: 0000000000000002 RBX: ffff8802441d4dc0 RCX: 0000000000000038 RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff8802445d84e8 RBP: ffff8801d7127d08 R08: ffff880243c3aa80 R09: 0000000000000000 R10: ffff880243c3aa80 R11: 0000000000000000 R12: ffffffff8a0fa2c0 R13: 0000000000000000 R14: 0000000000000002 R15: 0000000000000002 FS: 0000000000000000(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f70688ff000 CR3: 000000000ac11000 CR4: 00000000001407f0 DR0: 00007f0b19510000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff8801d7127d28 0000000000000246 00000000d7127ce8 00000000001d4d80 ffff880206b99780 ffff88017f6ccc30 ffff8802441d3640 ffff8802441d9e00 ffffffff8ac4e340 0000000000000000 ffff8801d7127d18 ffffffff8a0fa3f5 Call Trace: [<ffffffff8a0fa3f5>] tick_nohz_full_kick_all+0x35/0x70 [<ffffffff8a0ec8fe>] nohz_kick_work_fn+0xe/0x10 [<ffffffff8a08e61d>] process_one_work+0x1fd/0x590 [<ffffffff8a08e597>] ? process_one_work+0x177/0x590 [<ffffffff8a0c112e>] ? put_lock_stats.isra.23+0xe/0x30 [<ffffffff8a08eacb>] worker_thread+0x11b/0x490 [<ffffffff8a08e9b0>] ? process_one_work+0x590/0x590 [<ffffffff8a0942e9>] kthread+0xf9/0x110 [<ffffffff8a0c112e>] ? put_lock_stats.isra.23+0xe/0x30 [<ffffffff8a0941f0>] ? kthread_create_on_node+0x250/0x250 [<ffffffff8a7d82ac>] ret_from_fork+0x7c/0xb0 [<ffffffff8a0941f0>] ? kthread_create_on_node+0x250/0x250 Code: a5 c1 00 49 89 c7 41 89 c6 7d 7e 49 63 c7 48 8b 3b 48 03 3c c5 e0 6b d1 8a 0f b7 57 18 f6 c2 01 74 12 0f 1f 80 00 00 00 00 f3 90 <0f> b7 57 18 f6 c2 01 75 f5 83 ca 01 66 89 57 18 0f ae f0 48 8b NMI backtrace for cpu 1 INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 34.478 msecs CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 10/411 32140] task: ffff880242b5de00 ti: ffff880242b64000 task.ti: ffff880242b64000 RIP: 0010:[<ffffffff8a3e14a5>] [<ffffffff8a3e14a5>] intel_idle+0xd5/0x180 RSP: 0018:ffff880242b67df8 EFLAGS: 00000046 RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffff880242b67fd8 RDI: 0000000000000001 RBP: ffff880242b67e28 R08: 000000008baf93be R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 R13: 0000000000000032 R14: 0000000000000004 R15: ffff880242b64000 FS: 0000000000000000(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fcd3a34d000 CR3: 000000000ac11000 CR4: 00000000001407e0 DR0: 00007f0b19510000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: 0000000142b67e28 84d4d6ff01c7f4fd ffffe8ffff002200 0000000000000005 ffffffff8acaa080 0000000000000001 ffff880242b67e78 ffffffff8a666075 000011f1e9f6e882 ffffffff8acaa250 ffff880242b64000 ffffffff8ad18f30 Call Trace: [<ffffffff8a666075>] cpuidle_enter_state+0x55/0x1c0 [<ffffffff8a666297>] cpuidle_enter+0x17/0x20 [<ffffffff8a0bb323>] cpu_startup_entry+0x433/0x4e0 [<ffffffff8a02b763>] start_secondary+0x1a3/0x220 Code: 31 d2 65 48 8b 34 25 08 ba 00 00 48 8d 86 38 c0 ff ff 48 89 d1 0f 01 c8 48 8b 86 38 c0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <65> 48 8b 0c 25 08 ba 00 00 f0 80 a1 3a c0 ff ff df 0f ae f0 48 NMI backtrace for cpu 3 INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 62.461 msecs CPU: 3 PID: 0 Comm: swapper/3 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 10/411 32140] task: ffff880242b5c680 ti: ffff880242b78000 task.ti: ffff880242b78000 RIP: 0010:[<ffffffff8a3e14a5>] [<ffffffff8a3e14a5>] intel_idle+0xd5/0x180 RSP: 0018:ffff880242b7bdf8 EFLAGS: 00000046 RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffff880242b7bfd8 RDI: ffffffff8ac11000 RBP: ffff880242b7be28 R08: 000000008baf93be R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 R13: 0000000000000032 R14: 0000000000000004 R15: ffff880242b78000 FS: 0000000000000000(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000000ac11000 CR4: 00000000001407e0 DR0: 00007f0b19510000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: 0000000342b7be28 43db433bbd06c740 ffffe8ffff402200 0000000000000005 ffffffff8acaa080 0000000000000003 ffff880242b7be78 ffffffff8a666075 000011f1d69aaf37 ffffffff8acaa250 ffff880242b78000 ffffffff8ad18f30 Call Trace: [<ffffffff8a666075>] cpuidle_enter_state+0x55/0x1c0 [<ffffffff8a666297>] cpuidle_enter+0x17/0x20 [<ffffffff8a0bb323>] cpu_startup_entry+0x433/0x4e0 [<ffffffff8a02b763>] start_secondary+0x1a3/0x220 Code: 31 d2 65 48 8b 34 25 08 ba 00 00 48 8d 86 38 c0 ff ff 48 89 d1 0f 01 c8 48 8b 86 38 c0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <65> 48 8b 0c 25 08 ba 00 00 f0 80 a1 3a c0 ff ff df 0f ae f0 48
INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 89.635 msecs
Quoted 7 lines · Dave Jones
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 21s! [trinity-c42:31480]
CPU: 2 PID: 31480 Comm: trinity-c42 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 9/411 32140] RIP: 0010:[<ffffffff8a1798b4>] [<ffffffff8a1798b4>] context_tracking_user_enter+0xa4/0x190 Call Trace: [<ffffffff8a012fc5>] syscall_trace_leave+0xa5/0x160 [<ffffffff8a7d8624>] int_check_syscall_exit_work+0x34/0x3d
Hmm, if we are getting soft-lockups here, maybe it suggest too much exit-work.
Some TIF_NOHZ loop, perhaps? You have nohz on, don't you?
That makes me wonder: does the problem go away if you disable NOHZ?
Quoted 10 lines
CPU: 0 PID: 27716 Comm: kworker/0:1 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 9/411 32140] Workqueue: events nohz_kick_work_fn RIP: 0010:[<ffffffff8a0ffb52>] [<ffffffff8a0ffb52>] smp_call_function_many+0x1b2/0x320 Call Trace: [<ffffffff8a0fa3f5>] tick_nohz_full_kick_all+0x35/0x70 [<ffffffff8a0ec8fe>] nohz_kick_work_fn+0xe/0x10 [<ffffffff8a08e61d>] process_one_work+0x1fd/0x590 [<ffffffff8a08eacb>] worker_thread+0x11b/0x490 [<ffffffff8a0942e9>] kthread+0xf9/0x110 [<ffffffff8a7d82ac>] ret_from_fork+0x7c/0xb0
Yeah, there's certainly some NOHZ work going on on CPU0 too.
Quoted 7 lines
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 10/411 32140] RIP: 0010:[<ffffffff8a3e14a5>] [<ffffffff8a3e14a5>] intel_idle+0xd5/0x180 Call Trace: [<ffffffff8a666075>] cpuidle_enter_state+0x55/0x1c0 [<ffffffff8a666297>] cpuidle_enter+0x17/0x20 [<ffffffff8a0bb323>] cpu_startup_entry+0x433/0x4e0 [<ffffffff8a02b763>] start_secondary+0x1a3/0x220
Nothing.
Quoted 6 lines
CPU: 3 PID: 0 Comm: swapper/3 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 10/411 32140] RIP: 0010:[<ffffffff8a3e14a5>] [<ffffffff8a3e14a5>] intel_idle+0xd5/0x180 [<ffffffff8a666075>] cpuidle_enter_state+0x55/0x1c0 [<ffffffff8a666297>] cpuidle_enter+0x17/0x20 [<ffffffff8a0bb323>] cpu_startup_entry+0x433/0x4e0 [<ffffffff8a02b763>] start_secondary+0x1a3/0x220
Nothing.
Hmm. NOHZ?
Linus
Quoted 9 lines · Linus Torvalds
Quoted 7 lines · Dave Jones
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 21s! [trinity-c42:31480]
CPU: 2 PID: 31480 Comm: trinity-c42 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 9/411 32140] RIP: 0010:[<ffffffff8a1798b4>] [<ffffffff8a1798b4>] context_tracking_user_enter+0xa4/0x190 Call Trace: [<ffffffff8a012fc5>] syscall_trace_leave+0xa5/0x160 [<ffffffff8a7d8624>] int_check_syscall_exit_work+0x34/0x3d
Quoted 3 lines
Hmm, if we are getting soft-lockups here, maybe it suggest too much exit-work.
Some
TIF_NOHZloop, perhaps? You have nohz on, don't you?
I do.
Quoted 1 line
That makes me wonder: does the problem go away if you disable NOHZ?
I'll give it a try, and see what falls out overnight.
Dave
Quoted 5 lines · Linus Torvalds
Hmm, if we are getting soft-lockups here, maybe it suggest too much exit-work.
Some
TIF_NOHZloop, perhaps? You have nohz on, don't you?That makes me wonder: does the problem go away if you disable NOHZ?
Does nohz=off do enough ? I couldn't convince myself after looking at dmesg, and still seeing dynticks stuff in there.
I'll do a rebuild with all the CONFIG_NO_HZ stuff off, though it also changes some other config stuff wrt timers.
Dave
Quoted 20 lines · Dave Jones
Quoted 4 lines · Don Zickus
Quoted 2 lines
So here we mangle CPU3 in and lose the backtrace for cpu0, which might be the real interesting one ....
Can you provide another dump? The hope is we get something not mangled?
Working on it..
Quoted 4 lines
The other option we have done in RHEL is panic the system and let kdump capture the memory. Then we can analyze the vmcore for the stack trace cpu0 stored in memory to get a rough idea where it might be if the cpu isn't responding very well.
I don't know if it's because of the debug options I typically run with, or that I'm perpetually cursed, but I've never managed to get kdump to do anything useful. (The last time I tried it was actively harmful in that not only did it fail to dump anything, it wedged the machine so it didn't reboot after panic).
Quoted 3 lines
Unless there's some magic step missing from the documentation at
http://fedoraproject.org/wiki/How_to_use_kdump_to_debug_kernel_crashes
then I'm not optimistic it'll be useful.
Well, I don't know when the last time you ran it, but I know the RH kexec folks have started pursuing a Fedora-first package patch rule a couple of years ago to ensure Fedora had a working kexec/kdump solution.
As for the wedging part, it was a common problem to have the kernel hang while trying to boot the second kernel (and before console output happened). So the problem makes sense and is unfortunate. I would encourage you to try again. :-)
Though, it is transitioning to have the app built into the kernel to deal with the whole secure boot thing, so that might be another can of worms.
I cc'd Vivek and he can let us know how well it works with F21.
Cheers,
Don
Quoted 9 lines · Linus Torvalds
Quoted 7 lines · Dave Jones
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 21s! [trinity-c42:31480]
CPU: 2 PID: 31480 Comm: trinity-c42 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 9/411 32140] RIP: 0010:[<ffffffff8a1798b4>] [<ffffffff8a1798b4>] context_tracking_user_enter+0xa4/0x190 Call Trace: [<ffffffff8a012fc5>] syscall_trace_leave+0xa5/0x160 [<ffffffff8a7d8624>] int_check_syscall_exit_work+0x34/0x3d
Quoted 5 lines
Hmm, if we are getting soft-lockups here, maybe it suggest too much exit-work.
Some
TIF_NOHZloop, perhaps? You have nohz on, don't you?That makes me wonder: does the problem go away if you disable NOHZ?
Aparently not.
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c75:25175]
CPU: 3 PID: 25175 Comm: trinity-c75 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] task: ffff8800364e44d0 ti: ffff880192d2c000 task.ti: ffff880192d2c000 RIP: 0010:[<ffffffff94175be7>] [<ffffffff94175be7>] context_tracking_user_exit+0x57/0x120 RSP: 0018:ffff880192d2fee8 EFLAGS: 00000246 RAX: 0000000000000000 RBX: 0000000100000046 RCX: 000000336ee35b47 RDX: 0000000000000001 RSI: ffffffff94ac1e84 RDI: ffffffff94a93725 RBP: ffff880192d2fef8 R08: 00007f9b74d0b740 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: ffffffff940d8503 R13: ffff880192d2fe98 R14: ffffffff943884e7 R15: ffff880192d2fe48 FS: 00007f9b74d0b740(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000336f1b7740 CR3: 0000000229a95000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff880192d30000 0000000000080000 ffff880192d2ff78 ffffffff94012c25 00007f9b747a5000 00007f9b747a5068 0000000000000000 0000000000000000 0000000000000000 ffffffff9437b3be 0000000000000000 0000000000000000 Call Trace: [<ffffffff94012c25>] syscall_trace_enter_phase1+0x125/0x1a0 [<ffffffff9437b3be>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff947d41bf>] tracesys+0x14/0x4a Code: 42 fd ff 48 c7 c7 7a 1e ac 94 e8 25 29 21 00 65 8b 04 25 34 f7 1c 00 83 f8 01 74 28 f6 c7 02 74 13 0f 1f 00 e8 bb 43 fd ff 53 9d <5b> 41 5c 5d c3 0f 1f 40 00 53 9d e8 89 42 fd ff eb ee 0f 1f 80 sending NMI to other CPUs: NMI backtrace for cpu 1 CPU: 1 PID: 25164 Comm: trinity-c64 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] task: ffff88011600dbc0 ti: ffff8801a99a4000 task.ti: ffff8801a99a4000 RIP: 0010:[<ffffffff940fb71e>] [<ffffffff940fb71e>] generic_exec_single+0xee/0x1a0 RSP: 0018:ffff8801a99a7d18 EFLAGS: 00000202 RAX: 0000000000000000 RBX: ffff8801a99a7d20 RCX: 0000000000000038 RDX: 00000000000000ff RSI: 0000000000000008 RDI: 0000000000000000 RBP: ffff8801a99a7d78 R08: ffff880242b57ce0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000003 R13: 0000000000000001 R14: ffff880083c28948 R15: ffffffff94166aa0 FS: 00007f9b74d0b740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000001 CR3: 00000001d8611000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff8801a99a7d28 0000000000000000 ffffffff94166aa0 ffff880083c28948 0000000000000003 00000000e38f9aac ffff880083c28948 00000000ffffffff 0000000000000003 ffffffff94166aa0 ffff880083c28948 0000000000000001 Call Trace: [<ffffffff94166aa0>] ? perf_swevent_add+0x120/0x120 [<ffffffff94166aa0>] ? perf_swevent_add+0x120/0x120 [<ffffffff940fb89a>] smp_call_function_single+0x6a/0xe0 [<ffffffff940a172b>] ? preempt_count_sub+0x7b/0x100 [<ffffffff941671aa>] perf_event_read+0xca/0xd0 [<ffffffff94167240>] perf_event_read_value+0x90/0xe0 [<ffffffff941689c6>] perf_read+0x226/0x370 [<ffffffff942fbfb7>] ? security_file_permission+0x87/0xa0 [<ffffffff941eafff>] vfs_read+0x9f/0x180 [<ffffffff941ebbd8>] SyS_read+0x58/0xd0 [<ffffffff947d42c9>] tracesys_phase2+0xd4/0xd9 Code: 48 89 de 48 03 14 c5 20 65 d1 94 48 89 df e8 8a 4b 28 00 84 c0 75 46 45 85 ed 74 11 f6 43 18 01 74 0b 0f 1f 00 f3 90 f6 43 18 01 <75> f8 31 c0 48 8b 4d c8 65 48 33 0c 25 28 00 00 00 0f 85 8e 00 NMI backtrace for cpu 0 INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 35.055 msecs CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 11/410 27945] task: ffffffff94c164c0 ti: ffffffff94c00000 task.ti: ffffffff94c00000 RIP: 0010:[<ffffffff943dd415>] [<ffffffff943dd415>] intel_idle+0xd5/0x180 RSP: 0018:ffffffff94c03e28 EFLAGS: 00000046 RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff94c03fd8 RDI: 0000000000000000 RBP: ffffffff94c03e58 R08: 000000008baf8b86 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 R13: 0000000000000032 R14: 0000000000000004 R15: ffffffff94c00000 FS: 0000000000000000(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f162e060000 CR3: 0000000014c11000 CR4: 00000000001407f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: 0000000094c03e58 5955c5b31ad5e8cf ffffe8fffee031a8 0000000000000005 ffffffff94ca9dc0 0000000000000000 ffffffff94c03ea8 ffffffff94661f05 00001cb7dcf6fd93 ffffffff94ca9f90 ffffffff94c00000 ffffffff94d18870 Call[31557.908912] NMI backtrace for cpu 2 INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 68.178 msecs CPU: 2 PID: 0 Comm: swapper/2 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 10/410 27945] task: ffff880242b596f0 ti: ffff880242b6c000 task.ti: ffff880242b6c000 RIP: 0010:[<ffffffff943dd415>] [<ffffffff943dd415>] intel_idle+0xd5/0x180 RSP: 0018:ffff880242b6fdf8 EFLAGS: 00000046 RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffff880242b6ffd8 RDI: 0000000000000002 RBP: ffff880242b6fe28 R08: 000000008baf8b86 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 R13: 0000000000000032 R14: 0000000000000004 R15: ffff880242b6c000 FS: 0000000000000000(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 0000000014c11000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: 0000000242b6fe28 da97aa9b9f42090a ffffe8ffff2031a8 0000000000000005 ffffffff94ca9dc0 0000000000000002 ffff880242b6fe78 ffffffff94661f05 00001cb7dcdd1af6 ffffffff94ca9f90 ffff880242b6c000 ffffffff94d18870 Call Trace: [<ffffffff94661f05>] cpuidle_enter_state+0x55/0x1c0 [<ffffffff94662127>] cpuidle_enter+0x17/0x20 [<ffffffff940b94a3>] cpu_startup_entry+0x423/0x4d0 [<ffffffff9402b763>] start_secondary+0x1a3/0x220 Code: 31 d2 65 48 8b 34 25 08 ba 00 00 48 8d 86 38 c0 ff ff 48 89 d1 0f 01 c8 48 8b 86 38 c0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <65> 48 8b 0c 25 08 ba 00 00 f0 80 a1 3a c0 ff ff df 0f ae f0 48
INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 95.994 msecs
<tangent>
Also, today I learned we can reach the perf_event_read code from read(). Given I had /proc/sys/kernel/perf_event_paranoid set to 1, I'm not sure how this is even possible. The only user of perf_fops is perf_event_open syscall _after_ it's checked that sysctl.
Oh, there's an ioctl path to perf too. Though trinity doesn't know anything about it, so I find it surprising if it managed to pull the right combination of entropy to make that do the right thing. Still, that ioctl path probably needs to also be checking that sysctl shouldn't it ?
Dave
Quoted 15 lines · Don Zickus
Quoted 14 lines · Dave Jones
Quoted 4 lines · Don Zickus
Quoted 2 lines
So here we mangle CPU3 in and lose the backtrace for cpu0, which might be the real interesting one ....
Can you provide another dump? The hope is we get something not mangled?
Working on it..
Quoted 4 lines
The other option we have done in RHEL is panic the system and let kdump capture the memory. Then we can analyze the vmcore for the stack trace cpu0 stored in memory to get a rough idea where it might be if the cpu isn't responding very well.
Quoted 5 lines
Quoted 5 lines
I don't know if it's because of the debug options I typically run with, or that I'm perpetually cursed, but I've never managed to get kdump to do anything useful. (The last time I tried it was actively harmful in that not only did it fail to dump anything, it wedged the machine so it didn't reboot after panic).
Hi Dave Jones,
Not being able to capture the dump I can understand but having wedged the machine so that it does not reboot after dump failure sounds bad. So you could not get machine to boot even after a power cycle? Would you remember what was failing. I am curious to know what did kdump do to make machine unbootable.
Quoted 4 lines
Quoted 4 lines
Unless there's some magic step missing from the documentation at
http://fedoraproject.org/wiki/How_to_use_kdump_to_debug_kernel_crashes
then I'm not optimistic it'll be useful.
I had a quick look at it and it basically looks fine. In fedora ideally it is just two steps process.
- Reserve memory using crashkernel. Say crashkernel=160M
- systemctl start kdump
- Crash the system or wait for it to crash.
So despite your bad experience in the past, I would encourage you to give it a try.
Quoted 4 lines
Well, I don't know when the last time you ran it, but I know the RH kexec folks have started pursuing a Fedora-first package patch rule a couple of years ago to ensure Fedora had a working kexec/kdump solution.
Yep, now we are putting everything in fedora first so it should be much better. Hard to say the same thing about driver authors. Sometimes they might have a driver working in rhel and not necessarily upstream. I am not sure if you ran into one of those issues.
Also recently I have seen issues with graphics drivers too.
Quoted 8 lines
As for the wedging part, it was a common problem to have the kernel hang while trying to boot the second kernel (and before console output happened). So the problem makes sense and is unfortunate. I would encourage you to try again. :-)
Though, it is transitioning to have the app built into the kernel to deal with the whole secure boot thing, so that might be another can of worms.
I doubt that secureboot bits will contribute to the failure.
Thanks
Vivek
Quoted 5 lines · Vivek Goyal
Not being able to capture the dump I can understand but having wedged the machine so that it does not reboot after dump failure sounds bad. So you could not get machine to boot even after a power cycle? Would you remember what was failing. I am curious to know what did kdump do to make machine unbootable.
Power cycling was fine, because then it booted into the non-kdump kernel. The issue was when I caused that kernel to panic, it would just sit there wedged, with no indication it even tried to switch to the kdump kernel.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Unless there's some magic step missing from the documentation at
http://fedoraproject.org/wiki/How_to_use_kdump_to_debug_kernel_crashes
then I'm not optimistic it'll be useful.I had a quick look at it and it basically looks fine. In fedora ideally it is just two steps process.
Quoted 6 lines
- Reserve memory using crashkernel. Say crashkernel=160M
- systemctl start kdump
- Crash the system or wait for it to crash.So despite your bad experience in the past, I would encourage you to give it a try.
'the past' here, is two weeks ago, on Fedora 21.
But, since then, I've reinstalled that box with Fedora 20 because I didn't trust gcc 4.9, and on f20 things are actually even worse.
Right now it doesn't even create the image correctly:
dracut: *** Stripping files done ***
dracut: *** Store current command line parameters ***
dracut: *** Creating image file ***
dracut: *** Creating image file done ***
kdumpctl: cat: write error: Broken pipe
kdumpctl: kexec: failed to load kdump kernel
kdumpctl: Starting kdump: [FAILED]
It works if I run a Fedora kernel, but not with a self-built one. And there's zero information as to what I'm doing wrong.
I saw something similar on F21, got past it somehow a few weeks ago, but I can't remember what I had to do. Unfortunatly that was still fruitless as it didn't actually dump anything, leading to my frustration with the state of kdump.
I'll try again when I put F21 back on that machine, but I'm not particularly optimistic tbh.
Dave
Quoted 11 lines · Dave Jones
Quoted 5 lines · Vivek Goyal
Not being able to capture the dump I can understand but having wedged the machine so that it does not reboot after dump failure sounds bad. So you could not get machine to boot even after a power cycle? Would you remember what was failing. I am curious to know what did kdump do to make machine unbootable.
Power cycling was fine, because then it booted into the non-kdump kernel. The issue was when I caused that kernel to panic, it would just sit there wedged, with no indication it even tried to switch to the kdump kernel.
I have seen the cases where we fail to boot in second kernel and often failure can happen very early without any information on graphic console. I have to always hook up a serial console to get an idea what went wrong that early. It is not an idea situation but at the same time don't know how to improve it.
I am wondering may be in some cases we panic in second kernel and sit there. Probably we should append a kernel command line automatically say "panic=1" so that it reboots itself if second kernel panics.
By any chance, have you enabled "CONFIG_RANDOMIZE_BASE"? If yes, please disable that as currently kexec/kdump stuff does not work with it. And it hangs very early in the boot process and I had to hook serial console to get following message on console.
arch/x86/boot/compressed/misc.cerror("32-bit relocation outside of kernel!\n");
I noticed that error() halts in a while loop after error message. May be there can be some way for it to try to reboot instead of halting in while loop.
Quoted 22 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Unless there's some magic step missing from the documentation at
http://fedoraproject.org/wiki/How_to_use_kdump_to_debug_kernel_crashes
then I'm not optimistic it'll be useful.I had a quick look at it and it basically looks fine. In fedora ideally it is just two steps process.
Quoted 6 lines
- Reserve memory using crashkernel. Say crashkernel=160M
- systemctl start kdump
- Crash the system or wait for it to crash.So despite your bad experience in the past, I would encourage you to give it a try.
'the past' here, is two weeks ago, on Fedora 21.
But, since then, I've reinstalled that box with Fedora 20 because I didn't trust gcc 4.9, and on f20 things are actually even worse.
Right now it doesn't even create the image correctly:
Quoted 7 lines
dracut: *** Stripping files done ***
dracut: *** Store current command line parameters ***
dracut: *** Creating image file ***
dracut: *** Creating image file done ***
kdumpctl: cat: write error: Broken pipe
kdumpctl: kexec: failed to load kdump kernel
kdumpctl: Starting kdump: [FAILED]
Hmmm..., can you please enable debugging in kdumpctl using "set -x" and do "touch /etc/kdump.conf; kdumpctl restart" and give debug output to me.
Quoted 3 lines
It works if I run a Fedora kernel, but not with a self-built one. And there's zero information as to what I'm doing wrong.
I just tested F20 kdump on my box and it worked fine for me.
So for you second kernel hangs and there is no info on console? Is there any possibility to hook up serial console, enable early printk and see if soemthing shows up there.
Apart from this, if you run into kdump issues in fedora, please cc kexec fedora mailing list too so that we are aware of it.
https://lists.fedoraproject.org/mailman/listinfo/kexec
Thanks
Vivek
Quoted 6 lines · Dave Jones
Quoted 2 lines · Linus Torvalds
That makes me wonder: does the problem go away if you disable NOHZ?
Aparently not.
Quoted 7 lines
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c75:25175]
CPU: 3 PID: 25175 Comm: trinity-c75 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] RIP: 0010:[<ffffffff94175be7>] [<ffffffff94175be7>] context_tracking_user_exit+0x57/0x120 Call Trace: [<ffffffff94012c25>] syscall_trace_enter_phase1+0x125/0x1a0 [<ffffffff9437b3be>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff947d41bf>] tracesys+0x14/0x4a
Ok, that's just crazy. This is the system call *entry* portion.
Last time it was the system call exit side, which at least made some sense, because the "return to user space" thing actually has loops in it to handle all events before we return to user space.
But the whole 'tracesys' part is only entered once, at the very beginning of a system call. There's no loop over the work. That whole call trace implies that the lockup happened just after we entered the system call path from _user_ space.
And in fact, exactly like last time, the code line implies that the timer interrupt happened on the return from the instruction, and indeed in both cases the code looked like this (the registers differed, but the "restore flags, start popping saved regs" was the exact same):
26: 53 push %rbx
27: 9d popfq
28:* 5b pop %rbx <-- trapping instruction 29: 41 5c pop %r12
in both cases, the timer interrupt happened right after the "popfq", but in both cases the value in the register that was used to restore eflags was invalid. Here %rbx was 0x0000000100000046 (which is a valid eflags value, but not the one we've actually restored!), and in your previous oops (where it was %r12) it was completely invalid.
So it hasn't actually done the "push %rbx; popfq" part - there must be a label at the return part, and context_tracking_user_exit() never actually did the local_irq_save/restore at all. Which means that it took one of the early exits instead:
if (!context_tracking_is_enabled())
return;
if (in_interrupt())
return;So not only does this happen at early system call entry time, the function that is claimed to lock up doesn't actually *do* anything.
Ho humm..
Oh, and to make matters worse, the only way this call chain can happen is this in syscall_trace_enter_phase1():
if (work & _TIF_NOHZ) {
user_exit();
work &= ~TIF_NOHZ;
}so there's still some NOHZ confusion there. It looks like TIF_NOHZ gets set regardless of whether NOHZ is enabled or not..
I'm adding Frederic explicitly to the cc too, because this is just fishy. I am starting to blame context tracking, because it has now shown up twice in different guises, and TIF_NOHZ seems to be implicated.
Quoted 8 lines
CPU: 1 PID: 25164 Comm: trinity-c64 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] RIP: 0010:[<ffffffff940fb71e>] [<ffffffff940fb71e>] generic_exec_single+0xee/0x1a0 Call Trace: [<ffffffff940fb89a>] smp_call_function_single+0x6a/0xe0 [<ffffffff941671aa>] perf_event_read+0xca/0xd0 [<ffffffff94167240>] perf_event_read_value+0x90/0xe0 [<ffffffff941689c6>] perf_read+0x226/0x370 [<ffffffff941eafff>] vfs_read+0x9f/0x180
Hmm.. We've certainly seen a lot of smp_call, for various different reasons in your traces..
I'm wondering if the smp-call ended up corrupting something on CPU3. Because even _with_ TIF_NOHZ confusion, I don't see how system call *entry* could cause a watchdog event. There are no loops, there are no locks I see, there is just *nothing* there I can see.
Let's add Andy L to the cc too, in case he hasn't seen this. He's been changing the lowlevel asm code, including very much this whole "syscall_trace_enter_phase1" thing. Maybe he sees something I don't.
Andy?
Quoted 4 lines
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 11/410 27945] RIP: 0010:[<ffffffff943dd415>] [<ffffffff943dd415>] intel_idle+0xd5/0x180 CPU: 2 PID: 0 Comm: swapper/2 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 10/410 27945] RIP: 0010:[<ffffffff943dd415>] [<ffffffff943dd415>] intel_idle+0xd5/0x180
Nothing there.
Quoted 10 lines
Also, today I learned we can reach the
perf_event_readcode fromread(). Given I had/proc/sys/kernel/perf_event_paranoidset to 1, I'm not sure how this is even possible. The only user ofperf_fopsisperf_event_opensyscall _after_ it's checked that sysctl.Oh, there's an ioctl path to perf too. Though trinity doesn't know anything about it, so I find it surprising if it managed to pull the right combination of entropy to make that do the right thing. Still, that ioctl path probably needs to also be checking that sysctl shouldn't it ?
Hmm. Perf people are already mostly on the list. Peter/Ingo/Arnaldo?
Linus
Quoted 11 lines · Linus Torvalds
So it hasn't actually done the "push %rbx; popfq" part - there must be a label at the return part, and
context_tracking_user_exit()never actually did the local_irq_save/restore at all. Which means that it took one of the early exits instead:if (!context_tracking_is_enabled()) return; if (in_interrupt()) return;
Ho humm. Interesting. Neither of those should possibly have happened.
We "know" that "context_tracking_is_enabled()" must be true, because the only way we get to context_tracking_user_exit() in the first place is through "user_exit()", which does:
if (context_tracking_is_enabled())
context_tracking_user_exit();and we know we shouldn't be in_interrupt(), because the backtrace is the system call entry path, for chrissake!
So we definitely have some corruption going on. A few possibilities:
- either the register contents are corrupted (%rbx in your dump said
"0x0000000100000046", but the eflags we restored was 0x246)
- in_interrupt() is wrong, and we've had some irq_count() corruption.
I'd expect that to result in "scheduling while atomic" messages, though, especially if it goes on long enough that you get a watchdog event..
- there is something rotten in the land ofcontext_tracking_is_enabled(), which uses a static key.
- I have misread the whole trace, and am a moron. But your earlier
report really had some very similar things, just in context_tracking_user_enter() instead of exit.
In your previous oops, the registers that was allegedly used to restore %eflags was %r12:
28: 41 54 push %r12
2a: 9d popfq
2b:* 5b pop %rbx <-- trapping instruction 2c: 41 5c pop %r12
2e: 5d pop %rbp
2f: c3 retq
but:
R12: ffff880101ee3ec0
EFLAGS: 00000282
so again, it looks like we never actually did that "popfq" instruction, and it would have exited through the (same) early exits.
But what an odd coincidence that it ended up in both of your reports being *exactly* at that instruction after the "popf". If it had actually *taken* the popf, I'd not be so surprised ("ok, popf enabled interrupts, and there was an interrupt pending"), but since everything seems to say that it came there through some control flow that did *not* go through the popf, that's just a very odd coincidence.
And both context_tracking_user_enter() and exit() have that exact same issue with the early returns. They shouldn't have happened in the first place.
Linus
Quoted 68 lines · Linus Torvalds
Quoted 11 lines · Linus Torvalds
So it hasn't actually done the "push %rbx; popfq" part - there must be a label at the return part, and
context_tracking_user_exit()never actually did the local_irq_save/restore at all. Which means that it took one of the early exits instead:if (!context_tracking_is_enabled()) return; if (in_interrupt()) return;Ho humm. Interesting. Neither of those should possibly have happened.
We "know" that "
context_tracking_is_enabled()" must be true, because the only way we get tocontext_tracking_user_exit()in the first place is through "user_exit()", which does:if (context_tracking_is_enabled()) context_tracking_user_exit();and we know we shouldn't be
in_interrupt(), because the backtrace is the system call entry path, for chrissake!So we definitely have some corruption going on. A few possibilities:
- either the register contents are corrupted (%rbx in your dump said
"0x0000000100000046", but the eflags we restored was0x246)-
in_interrupt()is wrong, and we've had someirq_count()corruption.
I'd expect that to result in "scheduling while atomic" messages, though, especially if it goes on long enough that you get a watchdog event..- there is something rotten in the land of
context_tracking_is_enabled(), which uses a static key.- I have misread the whole trace, and am a moron. But your earlier
report really had some very similar things, just incontext_tracking_user_enter()instead of exit.In your previous oops, the registers that was allegedly used to restore %eflags was %r12:
28: 41 54 push %r12
2a: 9d popfq2b:* 5b pop %rbx <-- trapping instruction 2c: 41 5c pop %r122e: 5d pop %rbp
2f: c3 retqbut:
R12:
ffff880101ee3ec0
EFLAGS: 00000282so again, it looks like we never actually did that "popfq" instruction, and it would have exited through the (same) early exits.
But what an odd coincidence that it ended up in both of your reports being *exactly* at that instruction after the "popf". If it had actually *taken* the popf, I'd not be so surprised ("ok, popf enabled interrupts, and there was an interrupt pending"), but since everything seems to say that it came there through some control flow that did *not* go through the popf, that's just a very odd coincidence.
Quoted 3 lines
And both
context_tracking_user_enter()andexit()have that exact same issue with the early returns. They shouldn't have happened in the first place.
I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
With that in mind, about eveything can happen. Some parts of the context tracking code really aren't fault-safe (or more generally exception safe). That's because context tracking itself tracks exceptions.
So for example if we enter a syscall, we go to context_tracking_user_exit() then vtime_user_enter() which _takes a lock_ with write_seqlock().
If an exception occurs before we unlock the seqlock (it's possible for example account_user_time() -> task_group_account_field()-> cpuacct_account_field() accesses dynamically allocated per cpu area which can fault) then
the fault calls exception_enter() then user_exit() which does all the same again and deadlocks.
I can certainly fix that with a few recursion protection.
Now we just need to determine if the current case has the same cause.
Quoted 69 lines · Frederic Weisbecker
Quoted 68 lines · Linus Torvalds
Quoted 11 lines · Linus Torvalds
So it hasn't actually done the "push %rbx; popfq" part - there must be a label at the return part, and
context_tracking_user_exit()never actually did the local_irq_save/restore at all. Which means that it took one of the early exits instead:if (!context_tracking_is_enabled()) return; if (in_interrupt()) return;Ho humm. Interesting. Neither of those should possibly have happened.
We "know" that "
context_tracking_is_enabled()" must be true, because the only way we get tocontext_tracking_user_exit()in the first place is through "user_exit()", which does:if (context_tracking_is_enabled()) context_tracking_user_exit();and we know we shouldn't be
in_interrupt(), because the backtrace is the system call entry path, for chrissake!So we definitely have some corruption going on. A few possibilities:
- either the register contents are corrupted (%rbx in your dump said
"0x0000000100000046", but the eflags we restored was0x246)-
in_interrupt()is wrong, and we've had someirq_count()corruption.
I'd expect that to result in "scheduling while atomic" messages, though, especially if it goes on long enough that you get a watchdog event..- there is something rotten in the land of
context_tracking_is_enabled(), which uses a static key.- I have misread the whole trace, and am a moron. But your earlier
report really had some very similar things, just incontext_tracking_user_enter()instead of exit.In your previous oops, the registers that was allegedly used to restore %eflags was %r12:
28: 41 54 push %r12
2a: 9d popfq2b:* 5b pop %rbx <-- trapping instruction 2c: 41 5c pop %r122e: 5d pop %rbp
2f: c3 retqbut:
R12:
ffff880101ee3ec0
EFLAGS: 00000282so again, it looks like we never actually did that "popfq" instruction, and it would have exited through the (same) early exits.
But what an odd coincidence that it ended up in both of your reports being *exactly* at that instruction after the "popf". If it had actually *taken* the popf, I'd not be so surprised ("ok, popf enabled interrupts, and there was an interrupt pending"), but since everything seems to say that it came there through some control flow that did *not* go through the popf, that's just a very odd coincidence.
Quoted 8 lines
Quoted 3 lines
And both
context_tracking_user_enter()andexit()have that exact same issue with the early returns. They shouldn't have happened in the first place.I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
Wait, what? If something like kernel_stack ends with an unmapped pmd, we are well and truly screwed.
--Andy
Quoted 17 lines · Linus Torvalds
Quoted 6 lines · Dave Jones
Quoted 2 lines · Linus Torvalds
That makes me wonder: does the problem go away if you disable NOHZ?
Aparently not.
Quoted 7 lines
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c75:25175]
CPU: 3 PID: 25175 Comm: trinity-c75 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] RIP: 0010:[<ffffffff94175be7>] [<ffffffff94175be7>] context_tracking_user_exit+0x57/0x120 Call Trace: [<ffffffff94012c25>] syscall_trace_enter_phase1+0x125/0x1a0 [<ffffffff9437b3be>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff947d41bf>] tracesys+0x14/0x4aOk, that's just crazy. This is the system call *entry* portion.
Quoted 8 lines
Last time it was the system call exit side, which at least made some sense, because the "return to user space" thing actually has loops in it to handle all events before we return to user space.
But the whole 'tracesys' part is only entered once, at the very beginning of a system call. There's no loop over the work. That whole call trace implies that the lockup happened just after we entered the system call path from _user_ space.
I suspect that the regression was triggered by the seccomp pull, since that reworked a lot of this code.
Quoted 11 lines
And in fact, exactly like last time, the code line implies that the timer interrupt happened on the return from the instruction, and indeed in both cases the code looked like this (the registers differed, but the "restore flags, start popping saved regs" was the exact same):
26: 53 push %rbx
27: 9d popfq28:* 5b pop %rbx <-- trapping instruction 29: 41 5c pop %r12
Just to make sure I understand: it says "NMI watchdog", but this trace is from a timer interrupt, not NMI, right?
Quoted 31 lines
in both cases, the timer interrupt happened right after the "popfq", but in both cases the value in the register that was used to restore eflags was invalid. Here %rbx was
0x0000000100000046(which is a valid eflags value, but not the one we've actually restored!), and in your previous oops (where it was %r12) it was completely invalid.So it hasn't actually done the "push %rbx; popfq" part - there must be a label at the return part, and
context_tracking_user_exit()never actually did the local_irq_save/restore at all. Which means that it took one of the early exits instead:if (!context_tracking_is_enabled()) return; if (in_interrupt()) return;So not only does this happen at early system call entry time, the function that is claimed to lock up doesn't actually *do* anything.
Ho humm..
Oh, and to make matters worse, the only way this call chain can happen is this in
syscall_trace_enter_phase1():if (work & _TIF_NOHZ) { user_exit(); work &= ~TIF_NOHZ; }
Quoted 7 lines
so there's still some NOHZ confusion there. It looks like
TIF_NOHZgets set regardless of whether NOHZ is enabled or not..I'm adding Frederic explicitly to the cc too, because this is just fishy. I am starting to blame context tracking, because it has now shown up twice in different guises, and
TIF_NOHZseems to be implicated.
Is it possible that we've managed to return to userspace with interrupts off somehow? A loop in userspace that somehow has interrupts off can cause all kinds of fun lockups.
I don't understand the logic of what enables TIF_NOHZ. That being said in the new 3.18 code, if TIF_NOHZ is set, we use part of the fast path instead of the full syscall slow path, which means that we meander differently through the asm than we used to (we do syscall_trace_enter_phase1, then a fast path syscall, then we get to sysret_careful, which does this:
/*
* We have a signal, or exit tracing or single-step.
* These all wind up with the iret return path anyway,
* so just join that path right now.
*/
FIXUP_TOP_OF_STACK %r11, -ARGOFFSET
jmp int_check_syscall_exit_work
In 3.17, I don't think that code would run with context tracking on, although I don't immediately see any bugs here.
Quoted 10 lines
Quoted 9 lines
CPU: 1 PID: 25164 Comm: trinity-c64 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] RIP: 0010:[<ffffffff940fb71e>] [<ffffffff940fb71e>] generic_exec_single+0xee/0x1a0 Call Trace: [<ffffffff940fb89a>] smp_call_function_single+0x6a/0xe0 [<ffffffff941671aa>] perf_event_read+0xca/0xd0 [<ffffffff94167240>] perf_event_read_value+0x90/0xe0 [<ffffffff941689c6>] perf_read+0x226/0x370 [<ffffffff941eafff>] vfs_read+0x9f/0x180
Quoted 8 lines
Hmm.. We've certainly seen a lot of
smp_call, for various different reasons in your traces..I'm wondering if the smp-call ended up corrupting something on CPU3. Because even _with_
TIF_NOHZconfusion, I don't see how system call *entry* could cause a watchdog event. There are no loops, there are no locks I see, there is just *nothing* there I can see.
If we ever landed in userspace with interrupts off, this could happen quite easily. It should be straightforward to add an assertion for that, in trinity or in the kernel.
--Andy
Quoted 27 lines
Let's add Andy L to the cc too, in case he hasn't seen this. He's been changing the lowlevel asm code, including very much this whole "
syscall_trace_enter_phase1" thing. Maybe he sees something I don't.Andy?
Quoted 4 lines
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 11/410 27945] RIP: 0010:[<ffffffff943dd415>] [<ffffffff943dd415>] intel_idle+0xd5/0x180 CPU: 2 PID: 0 Comm: swapper/2 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 10/410 27945] RIP: 0010:[<ffffffff943dd415>] [<ffffffff943dd415>] intel_idle+0xd5/0x180Nothing there.
Quoted 10 lines
Also, today I learned we can reach the
perf_event_readcode fromread(). Given I had/proc/sys/kernel/perf_event_paranoidset to 1, I'm not sure how this is even possible. The only user ofperf_fopsisperf_event_opensyscall _after_ it's checked that sysctl.Oh, there's an ioctl path to perf too. Though trinity doesn't know anything about it, so I find it surprising if it managed to pull the right combination of entropy to make that do the right thing. Still, that ioctl path probably needs to also be checking that sysctl shouldn't it ?
Hmm. Perf people are already mostly on the list. Peter/Ingo/Arnaldo?
Linus
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 3 lines · Andy Lutomirski
I suspect that the regression was triggered by the seccomp pull, since that reworked a lot of this code.
Note that it turns out that Dave can apparently see the same problems with 3.17, so it's not actually a regression. So it may have been going on for a while.
Quoted 2 lines
Just to make sure I understand: it says "NMI watchdog", but this trace is from a timer interrupt, not NMI, right?
Yeah. The kernel/watchdog.c code always says "NMI watchdog", but it's actually just a regular tiemr function: watchdog_timer_fn() started with hrtimer_start().
Quoted 3 lines
Is it possible that we've managed to return to userspace with interrupts off somehow? A loop in userspace that somehow has interrupts off can cause all kinds of fun lockups.
That sounds unlikely, but if there is some stack corruption going on.
However, it wouldn't even explain things, because even if interrupts had been disabled in user space, and even if that popf got executed, this wouldn't be where they got enabled. That would be the :"sti" in the system call entry path (hidden behind the ENABLE_INTERRUPTS macro).
Of course, maybe Dave has paravirtualization enabled (what a crock _that_ is), and there is something wrong with that whole code.
Quoted 1 line
I don't understand the logic of what enables
TIF_NOHZ.
Yeah, that makes two of us. But..
Quoted 2 lines
In 3.17, I don't think that code would run with context tracking on, although I don't immediately see any bugs here.
See above: the problem apparently isn't new. Although it is possible that we have two different issues going on..
Linus
Quoted 10 lines · Dave Jones
Quoted 9 lines · Linus Torvalds
Quoted 7 lines · Dave Jones
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 21s! [trinity-c42:31480]
CPU: 2 PID: 31480 Comm: trinity-c42 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 9/411 32140] RIP: 0010:[<ffffffff8a1798b4>] [<ffffffff8a1798b4>] context_tracking_user_enter+0xa4/0x190 Call Trace: [<ffffffff8a012fc5>] syscall_trace_leave+0xa5/0x160 [<ffffffff8a7d8624>] int_check_syscall_exit_work+0x34/0x3d
Quoted 7 lines
Quoted 5 lines
Hmm, if we are getting soft-lockups here, maybe it suggest too much exit-work.
Some
TIF_NOHZloop, perhaps? You have nohz on, don't you?That makes me wonder: does the problem go away if you disable NOHZ?
Aparently not.
TIF_NOHZ is not the same thing as NOHZ. Can you try a kernel with CONFIG_CONTEXT_TRACKING=n? Doing that may involve fiddling with RCU settings a bit. The normal no HZ idle stuff has nothing to do with TIF_NOHZ, and you either have TIF_NOHZ set or you have some kind of thread_info corruption going on here.
Hmm. This isn't a stack overflow, is it? That could cause all of these problems quite easily, although I'd expect other symptoms, too.
Quoted 5 lines
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c75:25175]
CPU: 3 PID: 25175 Comm: trinity-c75 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] task: ffff8800364e44d0 ti: ffff880192d2c000 task.ti: ffff880192d2c000 RIP: 0010:[<ffffffff94175be7>] [<ffffffff94175be7>] context_tracking_user_exit+0x57/0x120
This RIP should be impossible if context tracking is off.
Quoted 2 lines
RSP: 0018:ffff880192d2fee8 EFLAGS: 00000246
RAX: 0000000000000000 RBX: 0000000100000046 RCX:000000336ee35b47
^^^^^^^^^
That is a strange coincidence. Where did 0x46 | (1<<32) come from? That's a sensible interrupts-disabled flags value with the high part set to 0x1. Those high bits are undefined, but they ought to all be zero.
Quoted 42 lines
RDX: 0000000000000001 RSI: ffffffff94ac1e84 RDI: ffffffff94a93725 RBP: ffff880192d2fef8 R08: 00007f9b74d0b740 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: ffffffff940d8503 R13: ffff880192d2fe98 R14: ffffffff943884e7 R15: ffff880192d2fe48 FS: 00007f9b74d0b740(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000336f1b7740 CR3: 0000000229a95000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff880192d30000 0000000000080000 ffff880192d2ff78 ffffffff94012c25 00007f9b747a5000 00007f9b747a5068 0000000000000000 0000000000000000 0000000000000000 ffffffff9437b3be 0000000000000000 0000000000000000 Call Trace: [<ffffffff94012c25>] syscall_trace_enter_phase1+0x125/0x1a0 [<ffffffff9437b3be>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff947d41bf>] tracesys+0x14/0x4a Code: 42 fd ff 48 c7 c7 7a 1e ac 94 e8 25 29 21 00 65 8b 04 25 34 f7 1c 00 83 f8 01 74 28 f6 c7 02 74 13 0f 1f 00 e8 bb 43 fd ff 53 9d <5b> 41 5c 5d c3 0f 1f 40 00 53 9d e8 89 42 fd ff eb ee 0f 1f 80 sending NMI to other CPUs: NMI backtrace for cpu 1 CPU: 1 PID: 25164 Comm: trinity-c64 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] task: ffff88011600dbc0 ti: ffff8801a99a4000 task.ti: ffff8801a99a4000 RIP: 0010:[<ffffffff940fb71e>] [<ffffffff940fb71e>] generic_exec_single+0xee/0x1a0 RSP: 0018:ffff8801a99a7d18 EFLAGS: 00000202 RAX: 0000000000000000 RBX: ffff8801a99a7d20 RCX: 0000000000000038 RDX: 00000000000000ff RSI: 0000000000000008 RDI: 0000000000000000 RBP: ffff8801a99a7d78 R08: ffff880242b57ce0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000003 R13: 0000000000000001 R14: ffff880083c28948 R15: ffffffff94166aa0 FS: 00007f9b74d0b740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000001 CR3: 00000001d8611000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff8801a99a7d28 0000000000000000 ffffffff94166aa0 ffff880083c28948 0000000000000003 00000000e38f9aac ffff880083c28948 00000000ffffffff 0000000000000003 ffffffff94166aa0 ffff880083c28948 0000000000000001 Call Trace: [<ffffffff94166aa0>] ? perf_swevent_add+0x120/0x120 [<ffffffff94166aa0>] ? perf_swevent_add+0x120/0x120 [<ffffffff940fb89a>] smp_call_function_single+0x6a/0xe0
Quoted 8 lines
[<ffffffff940a172b>] ? preempt_count_sub+0x7b/0x100 [<ffffffff941671aa>] perf_event_read+0xca/0xd0 [<ffffffff94167240>] perf_event_read_value+0x90/0xe0 [<ffffffff941689c6>] perf_read+0x226/0x370 [<ffffffff942fbfb7>] ? security_file_permission+0x87/0xa0 [<ffffffff941eafff>] vfs_read+0x9f/0x180 [<ffffffff941ebbd8>] SyS_read+0x58/0xd0 [<ffffffff947d42c9>] tracesys_phase2+0xd4/0xd9
Riddle me this: what are we doing in tracesys_phase2? This is a full slow-path syscall. TIF_NOHZ doesn't cause that, I think. I'd love to see the value of ti->flags here. Is trinity using ptrace?
Um. There's a bug. Patch coming after lunch. No clue whether it will help here.
--Andy
Quoted 65 lines
Code: 48 89 de 48 03 14 c5 20 65 d1 94 48 89 df e8 8a 4b 28 00 84 c0 75 46 45 85 ed 74 11 f6 43 18 01 74 0b 0f 1f 00 f3 90 f6 43 18 01 <75> f8 31 c0 48 8b 4d c8 65 48 33 0c 25 28 00 00 00 0f 85 8e 00 NMI backtrace for cpu 0 INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 35.055 msecs CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 11/410 27945] task: ffffffff94c164c0 ti: ffffffff94c00000 task.ti: ffffffff94c00000 RIP: 0010:[<ffffffff943dd415>] [<ffffffff943dd415>] intel_idle+0xd5/0x180 RSP: 0018:ffffffff94c03e28 EFLAGS: 00000046 RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff94c03fd8 RDI: 0000000000000000 RBP: ffffffff94c03e58 R08: 000000008baf8b86 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 R13: 0000000000000032 R14: 0000000000000004 R15: ffffffff94c00000 FS: 0000000000000000(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f162e060000 CR3: 0000000014c11000 CR4: 00000000001407f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: 0000000094c03e58 5955c5b31ad5e8cf ffffe8fffee031a8 0000000000000005 ffffffff94ca9dc0 0000000000000000 ffffffff94c03ea8 ffffffff94661f05 00001cb7dcf6fd93 ffffffff94ca9f90 ffffffff94c00000 ffffffff94d18870 Call[31557.908912] NMI backtrace for cpu 2 INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 68.178 msecs CPU: 2 PID: 0 Comm: swapper/2 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 10/410 27945] task: ffff880242b596f0 ti: ffff880242b6c000 task.ti: ffff880242b6c000 RIP: 0010:[<ffffffff943dd415>] [<ffffffff943dd415>] intel_idle+0xd5/0x180 RSP: 0018:ffff880242b6fdf8 EFLAGS: 00000046 RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffff880242b6ffd8 RDI: 0000000000000002 RBP: ffff880242b6fe28 R08: 000000008baf8b86 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 R13: 0000000000000032 R14: 0000000000000004 R15: ffff880242b6c000 FS: 0000000000000000(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 0000000014c11000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: 0000000242b6fe28 da97aa9b9f42090a ffffe8ffff2031a8 0000000000000005 ffffffff94ca9dc0 0000000000000002 ffff880242b6fe78 ffffffff94661f05 00001cb7dcdd1af6 ffffffff94ca9f90 ffff880242b6c000 ffffffff94d18870 Call Trace: [<ffffffff94661f05>] cpuidle_enter_state+0x55/0x1c0 [<ffffffff94662127>] cpuidle_enter+0x17/0x20 [<ffffffff940b94a3>] cpu_startup_entry+0x423/0x4d0 [<ffffffff9402b763>] start_secondary+0x1a3/0x220 Code: 31 d2 65 48 8b 34 25 08 ba 00 00 48 8d 86 38 c0 ff ff 48 89 d1 0f 01 c8 48 8b 86 38 c0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <65> 48 8b 0c 25 08 ba 00 00 f0 80 a1 3a c0 ff ff df 0f ae f0 48INFO: NMI handler (
arch_trigger_all_cpu_backtrace_handler) took too long to run: 95.994 msecs<tangent>
Also, today I learned we can reach the
perf_event_readcode fromread(). Given I had/proc/sys/kernel/perf_event_paranoidset to 1, I'm not sure how this is even possible. The only user ofperf_fopsisperf_event_opensyscall _after_ it's checked that sysctl.Oh, there's an ioctl path to perf too. Though trinity doesn't know anything about it, so I find it surprising if it managed to pull the right combination of entropy to make that do the right thing. Still, that ioctl path probably needs to also be checking that sysctl shouldn't it ?
Dave
Quoted 5 lines · Andy Lutomirski
TIF_NOHZis not the same thing as NOHZ. Can you try a kernel withCONFIG_CONTEXT_TRACKING=n? Doing that may involve fiddling with RCU settings a bit. The normal no HZ idle stuff has nothing to do withTIF_NOHZ, and you either haveTIF_NOHZset or you have some kind ofthread_infocorruption going on here.
I'll try that next.
Quoted 8 lines
Quoted 2 lines
RSP: 0018:ffff880192d2fee8 EFLAGS: 00000246
RAX: 0000000000000000 RBX: 0000000100000046 RCX:000000336ee35b47^^^^^^^^^That is a strange coincidence. Where did
0x46| (1<<32) come from? That's a sensible interrupts-disabled flags value with the high part set to0x1. Those high bits are undefined, but they ought to all be zero.
This box is usually pretty solid, but it's been in service as a 24/7 fuzzing box for over a year now, so it's not outside the realm of possibility that this could all be a hardware fault if some memory has gone bad or the like. Unless we find something obvious in the next few days, I'll try running memtest over the weekend (though I've seen situations where that doesn't stress hardware enough to manifest a problem, so it might not be entirely conclusive unless it actually finds a fault).
I wish I had a second identical box to see if it would be reproducible.
Quoted 9 lines
Quoted 5 lines
[<ffffffff941689c6>] perf_read+0x226/0x370 [<ffffffff942fbfb7>] ? security_file_permission+0x87/0xa0 [<ffffffff941eafff>] vfs_read+0x9f/0x180 [<ffffffff941ebbd8>] SyS_read+0x58/0xd0 [<ffffffff947d42c9>] tracesys_phase2+0xd4/0xd9Riddle me this: what are we doing in
tracesys_phase2? This is a full slow-path syscall.TIF_NOHZdoesn't cause that, I think. I'd love to see the value ofti->flagshere. Is trinity using ptrace?
That's one of the few syscalls we actually blacklist (mostly because it requires some more thinking: just passing it crap can get the fuzzer into a confused state where it thinks child processes are dead, when they aren't etc). So it shouldn't be calling ptrace ever.
Dave
PATCH 1/1 x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
In reply to Andy LutomirskiTIF_NOHZ is 19 (i.e. _TIF_SYSCALL_TRACE | _TIF_NOTIFY_RESUME | _TIF_SINGLESTEP), not (1<<19).
This code is involved in Dave's trinity lockup, but I don't see why it would cause any of the problems he's seeing, except inadvertently by causing a different path through entry_64.S's syscall handling.
--- arch/x86/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/ptrace.c +1 -1
@@ -1484,7 +1484,7 @@ unsigned long syscall_trace_enter_phase1(struct pt_regs *regs, u32 arch)*/ if (work & _TIF_NOHZ) {user_exit (); - work &= ~TIF_NOHZ ; + work &= ~_TIF_NOHZ; }#ifdef CONFIG_SECCOMP
Signature · 1 line
1.9.3
Quoted 4 lines · Frederic Weisbecker
I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
This is complete nonsense. pcpu allocations are populated right away. Otherwise no single line of kernel code which uses dynamically allocated per cpu storage would be safe.
Thanks,
tglx
Borislav Petkov
maintainerQuoted 4 lines · Dave Jones
This box is usually pretty solid, but it's been in service as a 24/7 fuzzing box for over a year now, so it's not outside the realm of possibility that this could all be a hardware fault if some memory has gone bad or the like.
You could grep old logs for "Hardware Error" and the usual suspects coming from MCE/EDAC. Also /var/log/mcelog or something like that, depending on what's running on that box.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Re: [PATCH] x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
In reply to Andy LutomirskiQuoted 6 lines · Andy Lutomirski
TIF_NOHZis 19 (i.e._TIF_SYSCALL_TRACE|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP), not (1<<19).This code is involved in Dave's trinity lockup, but I don't see why it would cause any of the problems he's seeing, except inadvertently by causing a different path through entry_64.S's syscall handling.
Right, while it is wrong it does not explain the wreckage on 3.17, which does not have that code.
Thanks,
tglx
Quoted 6 lines · Linus Torvalds
Quoted 3 lines
Is it possible that we've managed to return to userspace with interrupts off somehow? A loop in userspace that somehow has interrupts off can cause all kinds of fun lockups.
That sounds unlikely, but if there is some stack corruption going on.
Quoted 8 lines
However, it wouldn't even explain things, because even if interrupts had been disabled in user space, and even if that popf got executed, this wouldn't be where they got enabled. That would be the :"sti" in the system call entry path (hidden behind the
ENABLE_INTERRUPTSmacro).Of course, maybe Dave has paravirtualization enabled (what a crock _that_ is), and there is something wrong with that whole code.
I've had HYPERVISOR_GUEST disabled for a while, which also disables the paravirt code afaics.
Dave
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines · Frederic Weisbecker
I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
This is complete nonsense. pcpu allocations are populated right away. Otherwise no single line of kernel code which uses dynamically allocated per cpu storage would be safe.
Note this isn't faulting because part of the allocation is swapped. No it's all reserved in the physical memory, but it's a lazy allocation. Part of it isn't yet addressed in the P[UGM?]D. That's what vmalloc_fault() is for.
So it's a non-blocking/sleeping fault which is why it's probably fine most of the time except on code that isn't fault-safe. And I suspect that most people assume that kernel data won't fault so probably some other places have similar issues.
That's a long standing issue. We even had to convert the perf callchain allocation to ad-hoc kmalloc() based per cpu allocation to get over vmalloc faults. At that time, NMIs couldn't handle faults and many callchains were populated in NMIs. We had serious crashes because of per cpu memory faults.
I think that lazy adressing is there for allocation performance reasons. But still having faultable per cpu memory is insame IMHO.
Quoted 9 lines · Borislav Petkov
Quoted 4 lines · Dave Jones
This box is usually pretty solid, but it's been in service as a 24/7 fuzzing box for over a year now, so it's not outside the realm of possibility that this could all be a hardware fault if some memory has gone bad or the like.
You could grep old logs for "Hardware Error" and the usual suspects coming from MCE/EDAC. Also
/var/log/mcelogor something like that, depending on what's running on that box.
Nothing, but it wouldn't be the first time I'd seen a hardware fault that didn't raise an MCE.
Dave
Quoted 20 lines · Frederic Weisbecker
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines · Frederic Weisbecker
I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
This is complete nonsense. pcpu allocations are populated right away. Otherwise no single line of kernel code which uses dynamically allocated per cpu storage would be safe.
Note this isn't faulting because part of the allocation is swapped. No it's all reserved in the physical memory, but it's a lazy allocation. Part of it isn't yet addressed in the P[UGM?]D. That's what
vmalloc_fault()is for.So it's a non-blocking/sleeping fault which is why it's probably fine most of the time except on code that isn't fault-safe. And I suspect that most people assume that kernel data won't fault so probably some other places have similar issues.
Quoted 4 lines
That's a long standing issue. We even had to convert the perf callchain allocation to ad-hoc
kmalloc()based per cpu allocation to get over vmalloc faults. At that time, NMIs couldn't handle faults and many callchains were populated in NMIs. We had serious crashes because of per cpu memory faults.
Is there seriously more than 512GB of per-cpu virtual space or whatever's needed to exceed a single pgd on x86_64?
And there are definitely placed that access per-cpu data in contexts in which a non-IST fault is not allowed. Maybe not dynamic per-cpu data, though.
--Andy
Quoted 4 lines
I think that lazy adressing is there for allocation performance reasons. But still having faultable per cpu memory is insame IMHO.
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 75 lines · Andy Lutomirski
Quoted 73 lines · Frederic Weisbecker
Quoted 71 lines · Linus Torvalds
Quoted 11 lines · Linus Torvalds
So it hasn't actually done the "push %rbx; popfq" part - there must be a label at the return part, and
context_tracking_user_exit()never actually did the local_irq_save/restore at all. Which means that it took one of the early exits instead:if (!context_tracking_is_enabled()) return; if (in_interrupt()) return;Ho humm. Interesting. Neither of those should possibly have happened.
We "know" that "
context_tracking_is_enabled()" must be true, because the only way we get tocontext_tracking_user_exit()in the first place is through "user_exit()", which does:if (context_tracking_is_enabled()) context_tracking_user_exit();and we know we shouldn't be
in_interrupt(), because the backtrace is the system call entry path, for chrissake!So we definitely have some corruption going on. A few possibilities:
- either the register contents are corrupted (%rbx in your dump said
"0x0000000100000046", but the eflags we restored was0x246)-
in_interrupt()is wrong, and we've had someirq_count()corruption.
I'd expect that to result in "scheduling while atomic" messages, though, especially if it goes on long enough that you get a watchdog event..- there is something rotten in the land of
context_tracking_is_enabled(), which uses a static key.- I have misread the whole trace, and am a moron. But your earlier
report really had some very similar things, just incontext_tracking_user_enter()instead of exit.In your previous oops, the registers that was allegedly used to restore %eflags was %r12:
28: 41 54 push %r12
2a: 9d popfq2b:* 5b pop %rbx <-- trapping instruction 2c: 41 5c pop %r122e: 5d pop %rbp
2f: c3 retqbut:
R12:
ffff880101ee3ec0
EFLAGS: 00000282so again, it looks like we never actually did that "popfq" instruction, and it would have exited through the (same) early exits.
But what an odd coincidence that it ended up in both of your reports being *exactly* at that instruction after the "popf". If it had actually *taken* the popf, I'd not be so surprised ("ok, popf enabled interrupts, and there was an interrupt pending"), but since everything seems to say that it came there through some control flow that did *not* go through the popf, that's just a very odd coincidence.
And both
context_tracking_user_enter()andexit()have that exact same issue with the early returns. They shouldn't have happened in the first place.
Quoted 7 lines
Quoted 4 lines
I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
Wait, what? If something like
kernel_stackends with an unmapped pmd, we are well and truly screwed.
Note that's non-sleeping faults. So probably most places are fine except a few of them that really don't want exception to mess up some state. I can imagine some entry code that really don't want that.
Is kernel stack allocated by vmalloc or alloc_percpu()?
Quoted 81 lines · Frederic Weisbecker
Quoted 80 lines · Andy Lutomirski
Quoted 77 lines · Frederic Weisbecker
Quoted 68 lines · Linus Torvalds
Quoted 11 lines · Linus Torvalds
So it hasn't actually done the "push %rbx; popfq" part - there must be a label at the return part, and
context_tracking_user_exit()never actually did the local_irq_save/restore at all. Which means that it took one of the early exits instead:if (!context_tracking_is_enabled()) return; if (in_interrupt()) return;Ho humm. Interesting. Neither of those should possibly have happened.
We "know" that "
context_tracking_is_enabled()" must be true, because the only way we get tocontext_tracking_user_exit()in the first place is through "user_exit()", which does:if (context_tracking_is_enabled()) context_tracking_user_exit();and we know we shouldn't be
in_interrupt(), because the backtrace is the system call entry path, for chrissake!So we definitely have some corruption going on. A few possibilities:
- either the register contents are corrupted (%rbx in your dump said
"0x0000000100000046", but the eflags we restored was0x246)-
in_interrupt()is wrong, and we've had someirq_count()corruption.
I'd expect that to result in "scheduling while atomic" messages, though, especially if it goes on long enough that you get a watchdog event..- there is something rotten in the land of
context_tracking_is_enabled(), which uses a static key.- I have misread the whole trace, and am a moron. But your earlier
report really had some very similar things, just incontext_tracking_user_enter()instead of exit.In your previous oops, the registers that was allegedly used to restore %eflags was %r12:
28: 41 54 push %r12
2a: 9d popfq2b:* 5b pop %rbx <-- trapping instruction 2c: 41 5c pop %r122e: 5d pop %rbp
2f: c3 retqbut:
R12:
ffff880101ee3ec0
EFLAGS: 00000282so again, it looks like we never actually did that "popfq" instruction, and it would have exited through the (same) early exits.
But what an odd coincidence that it ended up in both of your reports being *exactly* at that instruction after the "popf". If it had actually *taken* the popf, I'd not be so surprised ("ok, popf enabled interrupts, and there was an interrupt pending"), but since everything seems to say that it came there through some control flow that did *not* go through the popf, that's just a very odd coincidence.
Quoted 3 lines
And both
context_tracking_user_enter()andexit()have that exact same issue with the early returns. They shouldn't have happened in the first place.I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
Quoted 6 lines
Quoted 2 lines
Wait, what? If something like
kernel_stackends with an unmapped pmd, we are well and truly screwed.Note that's non-sleeping faults. So probably most places are fine except a few of them that really don't want exception to mess up some state. I can imagine some entry code that really don't want that.
Any non-IST fault at all on the kernel_stack reference in system_call is instant root on non-SMAP systems and instant double-fault or more challenging root on SMAP systems. The issue is that rsp is user-controlled, so the CPU cannot deliver a non-IST fault safely.
Quoted 2 lines
Is kernel stack allocated by vmalloc or
alloc_percpu()?
DEFINE_PER_CPU(unsigned long, kernel_stack)
Note that I'm talking about kernel_stack, not the kernel stack itself. The actual stack is regular linearly-mapped memory, although I plan on trying to change that, complete with all kinds of care to avoid double faults.
--Andy
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 21 lines · Andy Lutomirski
Quoted 20 lines · Frederic Weisbecker
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines · Frederic Weisbecker
I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
This is complete nonsense. pcpu allocations are populated right away. Otherwise no single line of kernel code which uses dynamically allocated per cpu storage would be safe.
Note this isn't faulting because part of the allocation is swapped. No it's all reserved in the physical memory, but it's a lazy allocation. Part of it isn't yet addressed in the P[UGM?]D. That's what
vmalloc_fault()is for.So it's a non-blocking/sleeping fault which is why it's probably fine most of the time except on code that isn't fault-safe. And I suspect that most people assume that kernel data won't fault so probably some other places have similar issues.
Quoted 7 lines
Quoted 4 lines
That's a long standing issue. We even had to convert the perf callchain allocation to ad-hoc
kmalloc()based per cpu allocation to get over vmalloc faults. At that time, NMIs couldn't handle faults and many callchains were populated in NMIs. We had serious crashes because of per cpu memory faults.Is there seriously more than 512GB of per-cpu virtual space or whatever's needed to exceed a single pgd on
x86_64?
No idea, I'm clueless about -mm details.
Quoted 4 lines
And there are definitely placed that access per-cpu data in contexts in which a non-IST fault is not allowed. Maybe not dynamic per-cpu data, though.
It probably happens to be fine because the code that accesses first the related data is fault-safe. Or maybe not and some state is silently messed up somewhere.
This doesn't leave a comfortable feeling.
Quoted 7 lines · Frederic Weisbecker
Quoted 6 lines · Thomas Gleixner
Quoted 4 lines · Frederic Weisbecker
I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
Quoted 8 lines
Quoted 3 lines
This is complete nonsense. pcpu allocations are populated right away. Otherwise no single line of kernel code which uses dynamically allocated per cpu storage would be safe.
Note this isn't faulting because part of the allocation is swapped. No it's all reserved in the physical memory, but it's a lazy allocation. Part of it isn't yet addressed in the P[UGM?]D. That's what
vmalloc_fault()is for.
Sorry, I can't follow your argumentation here.
pcpu_alloc()
....area_found:
....
/* clear the areas and return address relative to base address */
for_each_possible_cpu(cpu)
memset((void *)pcpu_chunk_addr(chunk, cpu, 0) + off, 0, size);How would that memset fail to establish the mapping, which is btw. already established via:
pcpu_populate_chunk()
already before that memset?
Are we talking about different per cpu allocators here or am I missing something completely non obvious?
Thanks,
tglx
Quoted 9 lines · Andy Lutomirski
Quoted 3 lines · Frederic Weisbecker
Note that's non-sleeping faults. So probably most places are fine except a few of them that really don't want exception to mess up some state. I can imagine some entry code that really don't want that.
Any non-IST fault at all on the
kernel_stackreference insystem_callis instant root on non-SMAP systems and instant double-fault or more challenging root on SMAP systems. The issue is that rsp is user-controlled, so the CPU cannot deliver a non-IST fault safely.
Heh.
Quoted 6 lines
Quoted 2 lines
Is kernel stack allocated by vmalloc or
alloc_percpu()?
DEFINE_PER_CPU(unsigned long, kernel_stack)Note that I'm talking about
kernel_stack, not the kernel stack itself.
Ah. Note, static allocation like DEFINE_PER_CPU() is probably fine. The issue is on dynamic allocations: alloc_percpu().
Quoted 3 lines
The actual stack is regular linearly-mapped memory, although I plan on trying to change that, complete with all kinds of care to avoid double faults.
If you do so, you must really ensure that the resulting memory will never fault.
Quoted 32 lines · Thomas Gleixner
Quoted 7 lines · Frederic Weisbecker
Quoted 6 lines · Thomas Gleixner
Quoted 4 lines · Frederic Weisbecker
I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
Quoted 8 lines
Quoted 3 lines
This is complete nonsense. pcpu allocations are populated right away. Otherwise no single line of kernel code which uses dynamically allocated per cpu storage would be safe.
Note this isn't faulting because part of the allocation is swapped. No it's all reserved in the physical memory, but it's a lazy allocation. Part of it isn't yet addressed in the P[UGM?]D. That's what
vmalloc_fault()is for.Sorry, I can't follow your argumentation here.
pcpu_alloc()
....area_found:.... /* clear the areas and return address relative to base address */ for_each_possible_cpu(cpu) memset((void *)pcpu_chunk_addr(chunk, cpu, 0) + off, 0, size);How would that memset fail to establish the mapping, which is btw. already established via:
Quoted 6 lines
pcpu_populate_chunk()already before that memset?
Are we talking about different per cpu allocators here or am I missing something completely non obvious?
That's the same allocator yeah. So if the whole memory is dereferenced, faults shouldn't happen indeed.
Maybe that was a bug a few years ago but not anymore.
I'm surprised because I got a report from Dave that very much suggested
a vmalloc fault. See the discussion "Deadlock in vtime_account_user() vs itself across a page fault":
http://marc.info/?l=linux-kernel&m=141047612120263&w=2
Is it possible that, somehow, some part isn't zeroed by pcpu_alloc()? After all it's allocated with vzalloc() so that part could be skipped. The memset(0) is passed the whole size though so it looks like the whole is dereferenced.
(cc'ing Tejun just in case).
Now if faults on percpu memory don't happen anymore, perhaps we are accessing some other vmalloc'ed area. In the above report from Dave, the fault happened somewhere in account_user_time().
Quoted 4 lines
Thanks,
tglx
Quoted 29 lines · Thomas Gleixner
Quoted 7 lines · Frederic Weisbecker
Quoted 6 lines · Thomas Gleixner
Quoted 4 lines · Frederic Weisbecker
I got a report lately involving context tracking. Not sure if it's the same here but the issue was that context tracking uses per cpu data and per cpu allocation use vmalloc and vmalloc'ed area can fault due to lazy paging.
Quoted 8 lines
Quoted 3 lines
This is complete nonsense. pcpu allocations are populated right away. Otherwise no single line of kernel code which uses dynamically allocated per cpu storage would be safe.
Note this isn't faulting because part of the allocation is swapped. No it's all reserved in the physical memory, but it's a lazy allocation. Part of it isn't yet addressed in the P[UGM?]D. That's what
vmalloc_fault()is for.Sorry, I can't follow your argumentation here.
pcpu_alloc()
....area_found:.... /* clear the areas and return address relative to base address */ for_each_possible_cpu(cpu) memset((void *)pcpu_chunk_addr(chunk, cpu, 0) + off, 0, size);
Quoted 6 lines
How would that memset fail to establish the mapping, which is btw. already established via:
pcpu_populate_chunk()already before that memset?
I think that this will map them into init_mm->pgd and current->active_mm->pgd, but it won't necessarily map them into the rest of the pgds.
At the risk of suggesting something awful, if we preallocated all 256 or whatever kernel pmd pages at boot, this whole problem would go away forever. It would only waste slightly under 1 MB of RAM (less on extremely large systems).
--Andy
Quoted 15 lines · Andy Lutomirski
Quoted 14 lines · Thomas Gleixner
Sorry, I can't follow your argumentation here.
pcpu_alloc()
....area_found:.... /* clear the areas and return address relative to base address */ for_each_possible_cpu(cpu) memset((void *)pcpu_chunk_addr(chunk, cpu, 0) + off, 0, size);How would that memset fail to establish the mapping, which is btw. already established via:
Quoted 7 lines
Quoted 3 lines
pcpu_populate_chunk()already before that memset?
I think that this will map them into
init_mm->pgdandcurrent->active_mm->pgd, but it won't necessarily map them into the rest of the pgds.
And why would mapping them into the kernel mapping, i.e. init_mm not be sufficient?
We are talking about kernel memory and not some random user space mapping.
Thanks,
tglx
Quoted 19 lines · Thomas Gleixner
Quoted 17 lines · Andy Lutomirski
Quoted 16 lines · Thomas Gleixner
Sorry, I can't follow your argumentation here.
pcpu_alloc()
....area_found:.... /* clear the areas and return address relative to base address */ for_each_possible_cpu(cpu) memset((void *)pcpu_chunk_addr(chunk, cpu, 0) + off, 0, size);How would that memset fail to establish the mapping, which is btw. already established via:
pcpu_populate_chunk()
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
already before that memset?
I think that this will map them into
init_mm->pgdandcurrent->active_mm->pgd, but it won't necessarily map them into the rest of the pgds.And why would mapping them into the kernel mapping, i.e.
init_mmnot be sufficient?
Because the kernel can run with any pgd loaded into cr3, and we rely on vmalloc_fault to lazily populate pgds in all the non-init pgds as needed. But this only happens if the first TLB-missing reference to the pgd in question with any given cr3 value happens from a safe context.
This is why I think that the grsec kernels will crash on very large memory systems. They don't seem to get this right for the kernel stack, and a page fault trying to access the stack is a big no-no.
--Andy
Quoted 7 lines
We are talking about kernel memory and not some random user space mapping.
Thanks,
tglx
Quoted 4 lines · Andy Lutomirski
This is why I think that the grsec kernels will crash on very large memory systems. They don't seem to get this right for the kernel stack, and a page fault trying to access the stack is a big no-no.
For something like a stack, that's trivial, you could just probe it before the actual task switch.
So I wouldn't worry about the kernel stack itself (although I think vmallocing it isn't likely worth it), I'd worry more about some other random dynamic percpu allocation. Although they arguably shouldn't happen for low-level code that cannot handle the dynamic pgd-population. And they generally don't.
It's really tracing that tends to be a special case not because of any particular low-level code issue, but because instrumenting itself recursively tends to be a bad idea.
Linus
Quoted 8 lines · Linus Torvalds
Quoted 4 lines · Andy Lutomirski
This is why I think that the grsec kernels will crash on very large memory systems. They don't seem to get this right for the kernel stack, and a page fault trying to access the stack is a big no-no.
For something like a stack, that's trivial, you could just probe it before the actual task switch.
I thought so for a while, too, but now I disagree. On PGE hardware, it seems entirely possible that the new stack would be in the TLB even if it's not visible via cr3. Then, as soon as the TLB entry expires, we double-fault.
Quoted 3 lines
So I wouldn't worry about the kernel stack itself (although I think vmallocing it isn't likely worth it),
I don't want vmalloc to avoid low-order allocations -- I want it to have guard pages. The fact that a user-triggerable stack overflow is basically root right now and doesn't reliably OOPS scares me.
Quoted 4 lines
I'd worry more about some other
random dynamic percpu allocation. Although they arguably shouldn't happen for low-level code that cannot handle the dynamic pgd-population. And they generally don't.
This issue ought to be limited to nokprobes code, and I doubt that any of that code touches dynamic per-cpu things.
Quoted 6 lines
It's really tracing that tends to be a special case not because of any particular low-level code issue, but because instrumenting itself recursively tends to be a bad idea.
Linus
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 5 lines · Andy Lutomirski
I thought so for a while, too, but now I disagree. On PGE hardware, it seems entirely possible that the new stack would be in the TLB even if it's not visible via cr3. Then, as soon as the TLB entry expires, we double-fault.
Ahh. Good point.
Quoted 3 lines
I don't want vmalloc to avoid low-order allocations -- I want it to have guard pages. The fact that a user-triggerable stack overflow is basically root right now and doesn't reliably OOPS scares me.
Well, if you do that, you would have to make the double-fault handler aware of the stack issue anyway, and then you could just do teh same PGD repopulation that a page fault does and return (for the case where you didn't overflow the stack, just had the page tables unpopulated - obviously an actual stack overflow should do something more drastic).
Linus
Quoted 13 lines · Linus Torvalds
Quoted 5 lines · Andy Lutomirski
I thought so for a while, too, but now I disagree. On PGE hardware, it seems entirely possible that the new stack would be in the TLB even if it's not visible via cr3. Then, as soon as the TLB entry expires, we double-fault.
Ahh. Good point.
Quoted 3 lines
I don't want vmalloc to avoid low-order allocations -- I want it to have guard pages. The fact that a user-triggerable stack overflow is basically root right now and doesn't reliably OOPS scares me.
Quoted 5 lines
Well, if you do that, you would have to make the double-fault handler aware of the stack issue anyway, and then you could just do teh same PGD repopulation that a page fault does and return (for the case where you didn't overflow the stack, just had the page tables unpopulated - obviously an actual stack overflow should do something more drastic).
And you were calling me crazy? :)
We could be restarting just about anything if that happens. Except that if we double-faulted on a trap gate entry instead of an interrupt gate entry, then we can't restart, and, unless we can somehow decode the error code usefully (it's woefully undocumented), int 0x80 and int3 might be impossible to handle correctly if it double-faults. And please don't suggest moving int 0x80 to an IST stack :)
The SDM specifically says that you must not try to recover after a double-fault. We do, however, recover from a double-fault in the specific case of an iret failure during espfix64 processing (and I even have a nice test case for it), but I think that hpa had a long conversation with one of the microcode architects before he was okay with that.
--Andy
Quoted 2 lines · Andy Lutomirski
And you were calling me crazy? :)
Hey, I'm crazy like a fox.
Quoted 6 lines
We could be restarting just about anything if that happens. Except that if we double-faulted on a trap gate entry instead of an interrupt gate entry, then we can't restart, and, unless we can somehow decode the error code usefully (it's woefully undocumented), int
0x80and int3 might be impossible to handle correctly if it double-faults. And please don't suggest moving int0x80to an IST stack :)
No, no. So tell me if this won't work:
- when forking a new process, make sure we allocate the vmalloc stack
*before* we copy the vm
- this should guarantee that all new processes will at least have its
*own* stack always in its page tables, since vmalloc always fills in the page table of the current page tables of the thread doing the vmalloc.
HOWEVER, that leaves the task switch *to* that process, and making sure that the stack pointer is ok in between the "switch %rsp" and "switch %cr3".
So then we make the rule be: switch %cr3 *before* switching %rsp, and only in between those places can we get in trouble. Yes/no?
And that small section is all with interrupts disabled, and nothing should take an exception. The C code might take a double fault on a regular access to the old stack (the *new* stack is guaranteed to be mapped, but the old stack is not), but that should be very similar to what we already do with "iret". So we can just fill in the page tables and return.
For safety, add a percpu counter that is cleared before the %cr3 setting, to make sure that we only do a *single* double-fault, but it really sounds pretty safe. No?
The only deadly thing would be NMI, but that's an IST anyway, so not an issue. No other traps should be able to happen except the double page table miss.
But hey, maybe I'm not crazy like a fox. Maybe I'm just plain crazy, and I missed something else.
And no, I don't think the above is necessarily a *good* idea. But it doesn't seem really overly complicated either.
Linus
Quoted 15 lines · Linus Torvalds
Quoted 2 lines · Andy Lutomirski
And you were calling me crazy? :)
Hey, I'm crazy like a fox.
Quoted 6 lines
We could be restarting just about anything if that happens. Except that if we double-faulted on a trap gate entry instead of an interrupt gate entry, then we can't restart, and, unless we can somehow decode the error code usefully (it's woefully undocumented), int
0x80and int3 might be impossible to handle correctly if it double-faults. And please don't suggest moving int0x80to an IST stack :)No, no. So tell me if this won't work:
Quoted 7 lines
- when forking a new process, make sure we allocate the vmalloc stack
*before* we copy the vm- this should guarantee that all new processes will at least have its
*own* stack always in its page tables, since vmalloc always fills in the page table of the current page tables of the thread doing the vmalloc.
This gets interesting for kernel threads that don't really have an mm in the first place, though.
Quoted 8 lines
HOWEVER, that leaves the task switch *to* that process, and making sure that the stack pointer is ok in between the "switch %rsp" and "switch %cr3".
So then we make the rule be: switch %cr3 *before* switching %rsp, and only in between those places can we get in trouble. Yes/no?
Kernel threads aside, sure. And we do it in this order anyway, I think.
Quoted 6 lines
And that small section is all with interrupts disabled, and nothing should take an exception. The C code might take a double fault on a regular access to the old stack (the *new* stack is guaranteed to be mapped, but the old stack is not), but that should be very similar to what we already do with "iret". So we can just fill in the page tables and return.
Unless we try to dump the stack from an NMI or something, but that should be fine regardless.
Quoted 4 lines
For safety, add a percpu counter that is cleared before the %cr3 setting, to make sure that we only do a *single* double-fault, but it really sounds pretty safe. No?
I wouldn't be surprised if that's just as expensive as just fixing up the pgd in the first place. The fixup is just:
if (unlikely(pte_none(mm->pgd[pgd_address(rsp)]))) fix it;
or something like that.
Quoted 7 lines
The only deadly thing would be NMI, but that's an IST anyway, so not an issue. No other traps should be able to happen except the double page table miss.
But hey, maybe I'm not crazy like a fox. Maybe I'm just plain crazy, and I missed something else.
I actually kind of like it, other than the kernel thread issue.
We should arguably ditch lazy mm for kernel threads in favor of PCID, but that's a different story. Or we could beg Intel to give us separate kernel and user page table hierarchies.
--Andy
Quoted 5 lines
And no, I don't think the above is necessarily a *good* idea. But it doesn't seem really overly complicated either.
Linus
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 21 lines · Don Zickus
Quoted 20 lines · Dave Jones
Quoted 4 lines · Don Zickus
Quoted 2 lines
So here we mangle CPU3 in and lose the backtrace for cpu0, which might be the real interesting one ....
Can you provide another dump? The hope is we get something not mangled?
Working on it..
Quoted 4 lines
The other option we have done in RHEL is panic the system and let kdump capture the memory. Then we can analyze the vmcore for the stack trace cpu0 stored in memory to get a rough idea where it might be if the cpu isn't responding very well.
I don't know if it's because of the debug options I typically run with, or that I'm perpetually cursed, but I've never managed to get kdump to do anything useful. (The last time I tried it was actively harmful in that not only did it fail to dump anything, it wedged the machine so it didn't reboot after panic).
Quoted 7 lines
Quoted 3 lines
Unless there's some magic step missing from the documentation at
http://fedoraproject.org/wiki/How_to_use_kdump_to_debug_kernel_crashes
then I'm not optimistic it'll be useful.Well, I don't know when the last time you ran it, but I know the RH kexec folks have started pursuing a Fedora-first package patch rule a couple of years ago to ensure Fedora had a working kexec/kdump solution.
It started from Fedora 17, I think for Fedora pre F17 kdump support is very limited, it is becoming better.
Quoted 5 lines
As for the wedging part, it was a common problem to have the kernel hang while trying to boot the second kernel (and before console output happened). So the problem makes sense and is unfortunate. I would encourage you to try again. :-)
In fedora we will have more such issues than RHEL because the kernel is updated frequestly. There's ocasinaly new problems in upstream kernel, such as kaslr feature in X86.
Problem for Fedora is it is not by default enabled, so user need explictly specify kerenl cmdline for crashkernel reservation and enable kdump serivce.
There's very few bugs reported from Fedora user. So I guess it is not well tested in Fedora community. Since Dave bring up this issue I think it's at least a good news to us that someone is using it. We can address the problem case by case then.
Probably a good way to get more testing is to add kdump anaconda addon by default at installation phase so user can choose to enable kdump or not.
Thanks
Dave
Borislav Petkov
maintainerQuoted 2 lines · Dave Jones
Nothing, but it wouldn't be the first time I'd seen a hardware fault that didn't raise an MCE.
And maybe it tried but it didn't manage to come out due to hard wedging. :-)
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Hello,
Quoted 7 lines · Frederic Weisbecker
Quoted 2 lines
Are we talking about different per cpu allocators here or am I missing something completely non obvious?
That's the same allocator yeah. So if the whole memory is dereferenced, faults shouldn't happen indeed.
Maybe that was a bug a few years ago but not anymore.
It has been always like that tho. Percpu memory given out is always populated and cleared.
Quoted 2 lines
Is it possible that, somehow, some part isn't zeroed by
pcpu_alloc()? After all it's allocated withvzalloc()so that part could be skipped. The memset(0)
The vzalloc call is for the internal allocation bitmap not the actual percpu memory area. The actual address areas for percpu memory are obtained using pcpu_get_vm_areas() call and later get populated using map_kernel_range_noflush() (flush is performed after mapping is complete).
Trying to remember what happens with vmalloc_fault(). Ah okay, so when a new PUD gets created for vmalloc area, we don't go through all PGDs and update them. The PGD entries get faulted in lazily. Percpu memory allocator clearing or not clearing the allocated area doesn't have anything to do with it. The memory area is always fully populated in the kernel page table. It's just that the population happened while a different PGD was active and this PGD hasn't been populated with the new PUD yet.
So, yeap, vmalloc_fault() can always happen when accessing vmalloc areas and the only way to avoid that would be removing lazy PGD population - going through all PGDs and populating new PUDs immediately.
Thanks.
Signature · 1 line
tejun
Quoted 6 lines · Dave Jones
Quoted 4 lines · Linus Torvalds
Hmm, if we are getting soft-lockups here, maybe it suggest too much exit-work.
Some
TIF_NOHZloop, perhaps? You have nohz on, don't you?
Quoted 7 lines
Quoted 1 line
That makes me wonder: does the problem go away if you disable NOHZ?
Does nohz=off do enough ? I couldn't convince myself after looking at dmesg, and still seeing dynticks stuff in there.
I'll do a rebuild with all the
CONFIG_NO_HZstuff off, though it also changes some other config stuff wrt timers.
You also need to disable context tracking. So you need to deactive also CONFIG_RCU_USER_QS and CONFIG_CONTEXT_TRACKING_FORCE and eventually make sure nothing else is turning on CONFIG_CONTEXT_TRACKING.
You can keep CONFIG_NO_HZ_IDLE though, just not CONFIG_NO_HZ_FULL.
Quoted 58 lines · Dave Jones
Quoted 9 lines · Linus Torvalds
Quoted 7 lines · Dave Jones
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 21s! [trinity-c42:31480]
CPU: 2 PID: 31480 Comm: trinity-c42 Not tainted 3.18.0-rc5+ #91 [loadavg: 174.61 150.35 148.64 9/411 32140] RIP: 0010:[<ffffffff8a1798b4>] [<ffffffff8a1798b4>] context_tracking_user_enter+0xa4/0x190 Call Trace: [<ffffffff8a012fc5>] syscall_trace_leave+0xa5/0x160 [<ffffffff8a7d8624>] int_check_syscall_exit_work+0x34/0x3dQuoted 5 lines
Hmm, if we are getting soft-lockups here, maybe it suggest too much exit-work.
Some
TIF_NOHZloop, perhaps? You have nohz on, don't you?That makes me wonder: does the problem go away if you disable NOHZ?
Aparently not.
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [trinity-c75:25175]
CPU: 3 PID: 25175 Comm: trinity-c75 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] task: ffff8800364e44d0 ti: ffff880192d2c000 task.ti: ffff880192d2c000 RIP: 0010:[<ffffffff94175be7>] [<ffffffff94175be7>] context_tracking_user_exit+0x57/0x120 RSP: 0018:ffff880192d2fee8 EFLAGS: 00000246 RAX: 0000000000000000 RBX: 0000000100000046 RCX: 000000336ee35b47 RDX: 0000000000000001 RSI: ffffffff94ac1e84 RDI: ffffffff94a93725 RBP: ffff880192d2fef8 R08: 00007f9b74d0b740 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: ffffffff940d8503 R13: ffff880192d2fe98 R14: ffffffff943884e7 R15: ffff880192d2fe48 FS: 00007f9b74d0b740(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000336f1b7740 CR3: 0000000229a95000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff880192d30000 0000000000080000 ffff880192d2ff78 ffffffff94012c25 00007f9b747a5000 00007f9b747a5068 0000000000000000 0000000000000000 0000000000000000 ffffffff9437b3be 0000000000000000 0000000000000000 Call Trace: [<ffffffff94012c25>] syscall_trace_enter_phase1+0x125/0x1a0 [<ffffffff9437b3be>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff947d41bf>] tracesys+0x14/0x4a Code: 42 fd ff 48 c7 c7 7a 1e ac 94 e8 25 29 21 00 65 8b 04 25 34 f7 1c 00 83 f8 01 74 28 f6 c7 02 74 13 0f 1f 00 e8 bb 43 fd ff 53 9d <5b> 41 5c 5d c3 0f 1f 40 00 53 9d e8 89 42 fd ff eb ee 0f 1f 80 sending NMI to other CPUs: NMI backtrace for cpu 1 CPU: 1 PID: 25164 Comm: trinity-c64 Not tainted 3.18.0-rc5+ #92 [loadavg: 168.72 151.72 150.38 9/410 27945] task: ffff88011600dbc0 ti: ffff8801a99a4000 task.ti: ffff8801a99a4000 RIP: 0010:[<ffffffff940fb71e>] [<ffffffff940fb71e>] generic_exec_single+0xee/0x1a0 RSP: 0018:ffff8801a99a7d18 EFLAGS: 00000202 RAX: 0000000000000000 RBX: ffff8801a99a7d20 RCX: 0000000000000038 RDX: 00000000000000ff RSI: 0000000000000008 RDI: 0000000000000000 RBP: ffff8801a99a7d78 R08: ffff880242b57ce0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000003 R13: 0000000000000001 R14: ffff880083c28948 R15: ffffffff94166aa0 FS: 00007f9b74d0b740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000001 CR3: 00000001d8611000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
Quoted 8 lines
Stack: ffff8801a99a7d28 0000000000000000 ffffffff94166aa0 ffff880083c28948 0000000000000003 00000000e38f9aac ffff880083c28948 00000000ffffffff 0000000000000003 ffffffff94166aa0 ffff880083c28948 0000000000000001 Call Trace: [<ffffffff94166aa0>] ? perf_swevent_add+0x120/0x120 [<ffffffff94166aa0>] ? perf_swevent_add+0x120/0x120 [<ffffffff940fb89a>] smp_call_function_single+0x6a/0xe0
One thing that happens a lot in your crashes is a CPU sending IPIs. Maybe stuck polling on csd->lock or something. But's it's not the CPU that soft lockups. At least not the first that gets reported.
Quoted 8 lines
[<
ffffffff940a172b>] ?preempt_count_sub+0x7b/0x100[<ffffffff941671aa>] perf_event_read+0xca/0xd0 [<ffffffff94167240>] perf_event_read_value+0x90/0xe0 [<ffffffff941689c6>] perf_read+0x226/0x370 [<ffffffff942fbfb7>] ? security_file_permission+0x87/0xa0 [<ffffffff941eafff>] vfs_read+0x9f/0x180 [<ffffffff941ebbd8>] SyS_read+0x58/0xd0 [<ffffffff947d42c9>] tracesys_phase2+0xd4/0xd9
Quoted 39 lines · Dave Jones
Quoted 7 lines · Linus Torvalds
Quoted 3 lines
Quoted 1 line
I'll try that next, and check in on it tomorrow.
No luck. Died even faster this time.
Yeah, and your other lockups haven't even been TLB related. Not that they look like anything else *either*.
Quoted 8 lines
I have no ideas left. I'd go for a bisection - rather than try random things, at least bisection will get us a smaller set of suspects if you can go through a few cycles of it. Even if you decide that you want to run for most of a day before you are convinced it's all good, a couple of days should get you a handful of bisection points (that's assuming you hit a couple of bad ones too that turn bad in a shorter while). And 4 or five bisections should get us from 11k commits down to the ~600 commit range. That would be a huge improvement.
Great start to the week: I decided to confirm my recollection that .17 was ok, only to hit this within 10 minutes.
Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 3 CPU: 3 PID: 17176 Comm: trinity-c95 Not tainted 3.17.0+ #87 0000000000000000 00000000f3a61725 ffff880244606bf0 ffffffff9583e9fa ffffffff95c67918 ffff880244606c78 ffffffff9583bcc0 0000000000000010 ffff880244606c88 ffff880244606c20 00000000f3a61725 0000000000000000 Call Trace: <NMI> [<ffffffff9583e9fa>] dump_stack+0x4e/0x7a [<ffffffff9583bcc0>] panic+0xd4/0x207 [<ffffffff95150908>] watchdog_overflow_callback+0x118/0x120 [<ffffffff95193dbe>] __perf_event_overflow+0xae/0x340 [<ffffffff95192230>] ? perf_event_task_disable+0xa0/0xa0 [<ffffffff9501a7bf>] ? x86_perf_event_set_period+0xbf/0x150 [<ffffffff95194be4>] perf_event_overflow+0x14/0x20 [<ffffffff95020676>] intel_pmu_handle_irq+0x206/0x410 [<ffffffff9501966b>] perf_event_nmi_handler+0x2b/0x50 [<ffffffff95007bb2>] nmi_handle+0xd2/0x390 [<ffffffff95007ae5>] ? nmi_handle+0x5/0x390 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90
Quoted 8 lines
[<ffffffff950080a2>] default_do_nmi+0x72/0x1c0 [<ffffffff950082a8>] do_nmi+0xb8/0x100 [<ffffffff9584b9aa>] end_repeat_nmi+0x1e/0x2e [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 <<EOE>> <IRQ> [<ffffffff95101685>] lock_hrtimer_base.isra.18+0x25/0x50 [<ffffffff951019d3>] hrtimer_try_to_cancel+0x33/0x1f0
Ah that one got fixed in the merge window and in -stable, right?
Quoted 44 lines
[<ffffffff95101baa>] hrtimer_cancel+0x1a/0x30 [<ffffffff95113557>] tick_nohz_restart+0x17/0x90 [<ffffffff95114533>] __tick_nohz_full_check+0xc3/0x100 [<ffffffff9511457e>] nohz_full_kick_work_func+0xe/0x10 [<ffffffff95188894>] irq_work_run_list+0x44/0x70 [<ffffffff951888ea>] irq_work_run+0x2a/0x50 [<ffffffff9510109b>] update_process_times+0x5b/0x70 [<ffffffff95113325>] tick_sched_handle.isra.20+0x25/0x60 [<ffffffff95113801>] tick_sched_timer+0x41/0x60 [<ffffffff95102281>] __run_hrtimer+0x81/0x480 [<ffffffff951137c0>] ? tick_sched_do_timer+0xb0/0xb0 [<ffffffff95102977>] hrtimer_interrupt+0x117/0x270 [<ffffffff950346d7>] local_apic_timer_interrupt+0x37/0x60 [<ffffffff9584c44f>] smp_apic_timer_interrupt+0x3f/0x50 [<ffffffff9584a86f>] apic_timer_interrupt+0x6f/0x80 <EOI> [<ffffffff950d3f3a>] ? lock_release_holdtime.part.28+0x9a/0x160 [<ffffffff950ef3b7>] ? rcu_is_watching+0x27/0x60 [<ffffffff9508cb75>] kill_pid_info+0xf5/0x130 [<ffffffff9508ca85>] ? kill_pid_info+0x5/0x130 [<ffffffff9508ccd3>] SYSC_kill+0x103/0x330 [<ffffffff9508cc7c>] ? SYSC_kill+0xac/0x330 [<ffffffff9519b592>] ? context_tracking_user_exit+0x52/0x1a0 [<ffffffff950d6f1d>] ? trace_hardirqs_on_caller+0x16d/0x210 [<ffffffff950d6fcd>] ? trace_hardirqs_on+0xd/0x10 [<ffffffff950137ad>] ? syscall_trace_enter+0x14d/0x330 [<ffffffff9508f44e>] SyS_kill+0xe/0x10 [<ffffffff95849b24>] tracesys+0xdd/0xe2Kernel Offset:
0x14000000from0xffffffff81000000(relocation range: 0xffffffff80000000-0xffffffffbfffffff)It could a completely different cause for lockup, but seeing this now has me wondering if perhaps it's something unrelated to the kernel. I have recollection of running late .17rc's for days without incident, and I'm pretty sure .17 was ok too. But a few weeks ago I did upgrade that test box to the Fedora 21 beta. Which means I have a new gcc. I'm not sure I really trust 4.9.1 yet, so maybe I'll see if I can get 4.8 back on there and see if that's any better.
Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 5 lines · Andy Lutomirski
TIF_NOHZis not the same thing as NOHZ. Can you try a kernel withCONFIG_CONTEXT_TRACKING=n? Doing that may involve fiddling with RCU settings a bit. The normal no HZ idle stuff has nothing to do withTIF_NOHZ, and you either haveTIF_NOHZset or you have some kind ofthread_infocorruption going on here.
Disabling CONTEXT_TRACKING didn't change the problem. Unfortunatly the full trace didn't make it over usb-serial this time. Grr.
Here's what came over serial..
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [trinity-c35:11634]
CPU: 2 PID: 11634 Comm: trinity-c35 Not tainted 3.18.0-rc5+ #94 [loadavg: 164.79 157.30 155.90 37/409 11893] task: ffff88014e0d96f0 ti: ffff880220eb4000 task.ti: ffff880220eb4000 RIP: 0010:[<ffffffff88379605>] [<ffffffff88379605>] copy_user_enhanced_fast_string+0x5/0x10 RSP: 0018:ffff880220eb7ef0 EFLAGS: 00010283 RAX: ffff880220eb4000 RBX: ffffffff887dac64 RCX: 0000000000006a18 RDX: 000000000000e02f RSI: 00007f766f466620 RDI: ffff88016f6a7617 RBP: ffff880220eb7f78 R08: 8000000000000063 R09: 0000000000000004 R10: 0000000000000010 R11: 0000000000000000 R12: ffffffff880bf50d R13: 0000000000000001 R14: ffff880220eb4000 R15: 0000000000000001 FS: 00007f766f459740(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f766f461000 CR3: 000000018b00e000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffffffff882f4225 ffff880183db5a00 0000000001743440 00007f766f0fb000 fffffffffffffeff 0000000000000000 0000000000008d79 00007f766f45f000 ffffffff8837adae 00ff880220eb7f38 000000003203f1ac 0000000000000001 Call Trace: [<ffffffff882f4225>] ? SyS_add_key+0xd5/0x240 [<ffffffff8837adae>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff887da092>] system_call_fastpath+0x12/0x17 Code: 48 ff c6 48 ff c7 ff c9 75 f2 89 d1 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 31 c0 0f 1f 00 c3 0f 1f 80 00 00 00 00 0f 1f 00 89 d1 <f3> a4 31 c0 0f 1f 00 c3 90 90 90 0f 1f 00 83 fa 08 0f 82 95 00
sending NMI to other CPUs:
Here's a crappy phonecam pic of the screen.
http://codemonkey.org.uk/junk/IMG_4311.jpg
There's a bit of trace missing between the above and what was on the screen, so we missed some CPUs.
Dave
Quoted 84 lines · Dave Jones
Quoted 35 lines · Dave Jones
Quoted 4 lines · Linus Torvalds
But since you say "several times a day", just for fun, can you test the follow-up patch to that one-liner fix that Will Deacon posted today (Subject: "[PATCH]
mmu_gather: move minimal range calculations into generic code"). That does some further cleanup in this area.A few hours ago it hit the NMI watchdog again with that patch applied. Incomplete trace, but it looks different based on what did make it over. Different RIP at least.
[65155.054155] NMI watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [trinity-c127:12559] [65155.054573] irq event stamp: 296752 [65155.054589] hardirqs last enabled at (296751): [<ffffffff9d87403d>] _raw_spin_unlock_irqrestore+0x5d/0x80 [65155.054625] hardirqs last disabled at (296752): [<ffffffff9d875cea>] apic_timer_interrupt+0x6a/0x80 [65155.054657] softirqs last enabled at (296188): [<ffffffff9d259943>] bdi_queue_work+0x83/0x270 [65155.054688] softirqs last disabled at (296184): [<ffffffff9d259920>] bdi_queue_work+0x60/0x270 [65155.054721] CPU: 1 PID: 12559 Comm: trinity-c127 Not tainted 3.18.0-rc4+ #84 [loadavg: 209.68 187.90 185.33 34/431 17515] [65155.054795] task: ffff88023f664680 ti: ffff8801649f0000 task.ti: ffff8801649f0000 [65155.054820] RIP: 0010:[<ffffffff9d87403f>] [<ffffffff9d87403f>] _raw_spin_unlock_irqrestore+0x5f/0x80 [65155.054852] RSP: 0018:ffff8801649f3be8 EFLAGS: 00000292 [65155.054872] RAX: ffff88023f664680 RBX: 0000000000000007 RCX: 0000000000000007 [65155.054895] RDX: 00000000000029e0 RSI: ffff88023f664ea0 RDI: ffff88023f664680 [65155.054919] RBP: ffff8801649f3bf8 R08: 0000000000000000 R09: 0000000000000000 [65155.055956] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [65155.056985] R13: ffff8801649f3b58 R14: ffffffff9d3e7d0e R15: 00000000000003e0 [65155.058037] FS: 00007f0dc957c700(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [65155.059083] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [65155.060121] CR2: 00007f0dc958e000 CR3: 000000022f31e000 CR4: 00000000001407e0 [65155.061152] DR0: 00007f54162bc000 DR1: 00007feb92c3d000 DR2: 0000000000000000 [65155.062180] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [65155.063202] Stack:And that's all she wrote.
Quoted 7 lines
Quoted 5 lines
If Will's patch doesn't make a difference, what about reverting that
ce9ec37bddb6? Although it really *is* a "obvious bugfix", and I really don't see why any of this would be noticeable on x86 (it triggered issues on ARM64, but that was because ARM64 cared much more about the exact range).I'll try that next, and check in on it tomorrow.
No luck. Died even faster this time.
[ 772.459481] NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [modprobe:31400] [ 772.459858] irq event stamp: 3362 [ 772.459872] hardirqs last enabled at (3361): [<ffffffff941a437c>] context_tracking_user_enter+0x9c/0x2c0 [ 772.459907] hardirqs last disabled at (3362): [<ffffffff94875bea>] apic_timer_interrupt+0x6a/0x80 [ 772.459937] softirqs last enabled at (0): [<ffffffff940764d5>] copy_process.part.26+0x635/0x1d80 [ 772.459968] softirqs last disabled at (0): [< (null)>] (null) [ 772.459996] CPU: 3 PID: 31400 Comm: modprobe Not tainted 3.18.0-rc4+ #85 [loadavg: 207.70 163.33 92.64 11/433 31547] [ 772.460086] task: ffff88022f0b2f00 ti: ffff88019a944000 task.ti: ffff88019a944000 [ 772.460110] RIP: 0010:[<ffffffff941a437e>] [<ffffffff941a437e>] context_tracking_user_enter+0x9e/0x2c0 [ 772.460142] RSP: 0018:ffff88019a947f00 EFLAGS: 00000282 [ 772.460161] RAX: ffff88022f0b2f00 RBX: 0000000000000000 RCX: 0000000000000000 [ 772.460184] RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff88022f0b2f00 [ 772.460207] RBP: ffff88019a947f10 R08: 0000000000000000 R09: 0000000000000000 [ 772.460229] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88019a947e90 [ 772.460252] R13: ffffffff940f6d04 R14: ffff88019a947ec0 R15: ffff8802447cd640 [ 772.460294] FS: 00007f3b71ee4700(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 [ 772.460362] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 772.460391] CR2: 00007fffdad5af58 CR3: 000000011608e000 CR4: 00000000001407e0 [ 772.460424] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 772.460447] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 772.460470] Stack: [ 772.460480] ffff88019a947f58 00000000006233a8 ffff88019a947f40 ffffffff9401429d [ 772.460512] 00000000006233a8 000000000041d68a 00000000006233a8 0000000000000000 [ 772.460543] 00000000006233a0 ffffffff94874fa4 000000001008feff 000507d93d73a434 [ 772.460574] Call Trace: [ 772.461576] [<ffffffff9401429d>] syscall_trace_leave+0xad/0x2e0 [ 772.462572] [<ffffffff94874fa4>] int_check_syscall_exit_work+0x34/0x3d [ 772.463575] Code: f8 1c 00 84 c0 75 46 48 c7 c7 51 53 cd 94 e8 aa 23 24 00 65 c7 04 25 f4 f8 1c 00 01 00 00 00 f6 c7 02 74 19 e8 84 43 f3 ff 53 9d <5b> 41 5c 5d c3 0f 1f 44 00 00 c3 0f 1f 80 00 00 00 00 53 9d e8 [ 772.465797] Kernel panic - not syncing: softlockup: hung tasks [ 772.466821] CPU: 3 PID: 31400 Comm: modprobe Tainted: G L 3.18.0-rc4+ #85 [loadavg: 207.70 163.33 92.64 11/433 31547] [ 772.468915] ffff88022f0b2f00 00000000de65d5f5 ffff880244603dc8 ffffffff94869e01 [ 772.470031] 0000000000000000 ffffffff94c7599b ffff880244603e48 ffffffff94866b21 [ 772.471085] ffff880200000008 ffff880244603e58 ffff880244603df8 00000000de65d5f5 [ 772.472141] Call Trace: [ 772.473183] <IRQ> [<ffffffff94869e01>] dump_stack+0x4f/0x7c [ 772.474253] [<ffffffff94866b21>] panic+0xcf/0x202 [ 772.475346] [<ffffffff94154d1e>] watchdog_timer_fn+0x27e/0x290 [ 772.476414] [<ffffffff94106297>] __run_hrtimer+0xe7/0x740
Quoted 8 lines
[ 772.477475] [<ffffffff94106b64>] ? hrtimer_interrupt+0x94/0x270 [ 772.478555] [<ffffffff94154aa0>] ? watchdog+0x40/0x40 [ 772.479627] [<ffffffff94106be7>] hrtimer_interrupt+0x117/0x270 [ 772.480703] [<ffffffff940303db>] local_apic_timer_interrupt+0x3b/0x70 [ 772.481777] [<ffffffff948777f3>] smp_apic_timer_interrupt+0x43/0x60 [ 772.482856] [<ffffffff94875bef>] apic_timer_interrupt+0x6f/0x80 [ 772.483915] <EOI> [<ffffffff941a437e>] ? context_tracking_user_enter+0x9e/0x2c0 [ 772.484972] [<ffffffff9401429d>] syscall_trace_leave+0xad/0x2e0
It looks like we are looping somewhere around syscall_trace_leave(). Maybe the TIF WORK_SYSCALL_EXIT flags aren't cleared properly after some of them got processed. Or something keeps setting a TIF_WORK_SYSCALL_EXIT flag after they get cleared and we loop endlessly to jump to int_check_syscall_exit_work().
Andi did some work there lately. Cc'ing him.
Quoted 11 lines
[ 772.486042] [<ffffffff94874fa4>] int_check_syscall_exit_work+0x34/0x3d [ 772.487187] Kernel Offset: 0x13000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 8 lines · Vivek Goyal
I am wondering may be in some cases we panic in second kernel and sit there. Probably we should append a kernel command line automatically say "panic=1" so that it reboots itself if second kernel panics.
By any chance, have you enabled "
CONFIG_RANDOMIZE_BASE"? If yes, please disable that as currently kexec/kdump stuff does not work with it. And it hangs very early in the boot process and I had to hook serial console to get following message on console.
I did have that enabled. (Perhaps the kconfig should conflict?)
After rebuilding without it, this..
Quoted 7 lines
Quoted 7 lines
dracut: *** Stripping files done ***
dracut: *** Store current command line parameters ***
dracut: *** Creating image file ***
dracut: *** Creating image file done ***
kdumpctl: cat: write error: Broken pipe
kdumpctl: kexec: failed to load kdump kernel
kdumpctl: Starting kdump: [FAILED]
went away. It generated the image, and things looked good. I did echo c > /proc/sysrq-trigger and got this..
SysRq : Trigger a crash
BUG: sleeping function called from invalid context at arch/x86/mm/fault.c:1192
in_atomic(): 0, irqs_disabled(): 0, pid: 8860, name: bash
3 locks held by bash/8860:
#0: (sb_writers#5){......}, at: [<ffffffff811eac13>] vfs_write+0x1b3/0x1f0
#1: (rcu_read_lock){......}, at: [<ffffffff8144a435>] __handle_sysrq+0x5/0x1b0
#2: (&mm->mmap_sem){......}, at: [<ffffffff8103cb20>] __do_page_fault+0x140/0x600Preemption disabled at:[<ffffffff817ca332>] printk+0x5c/0x72
CPU: 1 PID: 8860 Comm: bash Not tainted 3.18.0-rc5+ #95 [loadavg: 0.54 0.24 0.09 2/143 8909] 00000000000004a8 00000000e1f75c1b ffff880236473c28 ffffffff817ce5c7 0000000000000000 0000000000000000 ffff880236473c58 ffffffff8109af8a ffff880236473c58 0000000000000029 0000000000000000 ffff880236473d88 Call Trace: [<ffffffff817ce5c7>] dump_stack+0x4f/0x7c [<ffffffff8109af8a>] __might_sleep+0x12a/0x190 [<ffffffff8103cb3b>] __do_page_fault+0x15b/0x600 [<ffffffff811613b2>] ? irq_work_queue+0x62/0xd0 [<ffffffff8137ad7d>] ? trace_hardirqs_off_thunk+0x3a/0x3f [<ffffffff8103cfec>] do_page_fault+0xc/0x10 [<ffffffff817dbcf2>] page_fault+0x22/0x30 [<ffffffff817ca332>] ? printk+0x5c/0x72 [<ffffffff81449ce6>] ? sysrq_handle_crash+0x16/0x20 [<ffffffff8144a567>] __handle_sysrq+0x137/0x1b0 [<ffffffff8144a435>] ? __handle_sysrq+0x5/0x1b0 [<ffffffff8144aa4a>] write_sysrq_trigger+0x4a/0x50 [<ffffffff81259f2d>] proc_reg_write+0x3d/0x80 [<ffffffff811eab1a>] vfs_write+0xba/0x1f0 [<ffffffff811eb628>] SyS_write+0x58/0xd0 [<ffffffff817da052>] system_call_fastpath+0x12/0x17 Oops: 0002 [#1] PREEMPT SMP DEBUG_PAGEALLOC CPU: 1 PID: 8860 Comm: bash Not tainted 3.18.0-rc5+ #95 [loadavg: 0.54 0.24 0.09 1/143 8909] task: ffff8800a1a60000 ti: ffff880236470000 task.ti: ffff880236470000 RIP: 0010:[<ffffffff81449ce6>] [<ffffffff81449ce6>] sysrq_handle_crash+0x16/0x20 RSP: 0018:ffff880236473e38 EFLAGS: 00010246 RAX: 000000000000000f RBX: ffffffff81cb4a00 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff817ca332 RDI: 0000000000000063 RBP: ffff880236473e38 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000358 R11: 0000000000000357 R12: 0000000000000063 R13: 0000000000000000 R14: 0000000000000007 R15: 0000000000000000 FS: 00007fc652f4e740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000023a3b2000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Stack: ffff880236473e78 ffffffff8144a567 ffffffff8144a435 0000000000000002 0000000000000002 00007fc652f51000 0000000000000002 ffff880236473f48 ffff880236473ea8 ffffffff8144aa4a 0000000000000002 00007fc652f51000 Call Trace: [<ffffffff8144a567>] __handle_sysrq+0x137/0x1b0 [<ffffffff8144a435>] ? __handle_sysrq+0x5/0x1b0 [<ffffffff8144aa4a>] write_sysrq_trigger+0x4a/0x50 [<ffffffff81259f2d>] proc_reg_write+0x3d/0x80 [<ffffffff811eab1a>] vfs_write+0xba/0x1f0 [<ffffffff811eb628>] SyS_write+0x58/0xd0 [<ffffffff817da052>] system_call_fastpath+0x12/0x17 Code: 01 f4 45 39 a5 b4 00 00 00 75 e2 4c 89 ef e8 d2 f7 ff ff eb d8 0f 1f 44 00 00 55 c7 05 08 b7 7e 00 01 00 00 00 48 89 e5 0f ae f8 <c6> 04 25 00 00 00 00 01 5d c3 0f 1f 44 00 00 55 31 c0 48 89 e5 RIP [<ffffffff81449ce6>] sysrq_handle_crash+0x16/0x20 RSP <ffff880236473e38>
CR2: 0000000000000000
Which, asides from the sleeping while atomic thing which isn't important, does what I expected. Shortly later, it rebooted.
And then /var/crash was empty.
Dave
Quoted 30 lines · Frederic Weisbecker
Quoted 21 lines
Great start to the week: I decided to confirm my recollection that .17 was ok, only to hit this within 10 minutes.
Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 3 CPU: 3 PID: 17176 Comm: trinity-c95 Not tainted 3.17.0+ #87 0000000000000000 00000000f3a61725 ffff880244606bf0 ffffffff9583e9fa ffffffff95c67918 ffff880244606c78 ffffffff9583bcc0 0000000000000010 ffff880244606c88 ffff880244606c20 00000000f3a61725 0000000000000000 Call Trace: <NMI> [<ffffffff9583e9fa>] dump_stack+0x4e/0x7a [<ffffffff9583bcc0>] panic+0xd4/0x207 [<ffffffff95150908>] watchdog_overflow_callback+0x118/0x120 [<ffffffff95193dbe>] __perf_event_overflow+0xae/0x340 [<ffffffff95192230>] ? perf_event_task_disable+0xa0/0xa0 [<ffffffff9501a7bf>] ? x86_perf_event_set_period+0xbf/0x150 [<ffffffff95194be4>] perf_event_overflow+0x14/0x20 [<ffffffff95020676>] intel_pmu_handle_irq+0x206/0x410 [<ffffffff9501966b>] perf_event_nmi_handler+0x2b/0x50 [<ffffffff95007bb2>] nmi_handle+0xd2/0x390 [<ffffffff95007ae5>] ? nmi_handle+0x5/0x390 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90Quoted 8 lines
[<ffffffff950080a2>] default_do_nmi+0x72/0x1c0 [<ffffffff950082a8>] do_nmi+0xb8/0x100 [<ffffffff9584b9aa>] end_repeat_nmi+0x1e/0x2e [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 <<EOE>> <IRQ> [<ffffffff95101685>] lock_hrtimer_base.isra.18+0x25/0x50 [<ffffffff951019d3>] hrtimer_try_to_cancel+0x33/0x1f0
Quoted 1 line
Ah that one got fixed in the merge window and in -stable, right?
If that's true, that changes everything, and this might be more bisectable. I did the test above on 3.17, but perhaps I should try a run on 3.17.3
Dave
Quoted 32 lines · Dave Jones
Quoted 30 lines · Frederic Weisbecker
Quoted 29 lines
Great start to the week: I decided to confirm my recollection that .17 was ok, only to hit this within 10 minutes.
Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 3 CPU: 3 PID: 17176 Comm: trinity-c95 Not tainted 3.17.0+ #87 0000000000000000 00000000f3a61725 ffff880244606bf0 ffffffff9583e9fa ffffffff95c67918 ffff880244606c78 ffffffff9583bcc0 0000000000000010 ffff880244606c88 ffff880244606c20 00000000f3a61725 0000000000000000 Call Trace: <NMI> [<ffffffff9583e9fa>] dump_stack+0x4e/0x7a [<ffffffff9583bcc0>] panic+0xd4/0x207 [<ffffffff95150908>] watchdog_overflow_callback+0x118/0x120 [<ffffffff95193dbe>] __perf_event_overflow+0xae/0x340 [<ffffffff95192230>] ? perf_event_task_disable+0xa0/0xa0 [<ffffffff9501a7bf>] ? x86_perf_event_set_period+0xbf/0x150 [<ffffffff95194be4>] perf_event_overflow+0x14/0x20 [<ffffffff95020676>] intel_pmu_handle_irq+0x206/0x410 [<ffffffff9501966b>] perf_event_nmi_handler+0x2b/0x50 [<ffffffff95007bb2>] nmi_handle+0xd2/0x390 [<ffffffff95007ae5>] ? nmi_handle+0x5/0x390 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff950080a2>] default_do_nmi+0x72/0x1c0 [<ffffffff950082a8>] do_nmi+0xb8/0x100 [<ffffffff9584b9aa>] end_repeat_nmi+0x1e/0x2e [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 [<ffffffff958489b0>] ? _raw_spin_lock_irqsave+0x80/0x90 <<EOE>> <IRQ> [<ffffffff95101685>] lock_hrtimer_base.isra.18+0x25/0x50 [<ffffffff951019d3>] hrtimer_try_to_cancel+0x33/0x1f0
Quoted 5 lines
Quoted 1 line
Ah that one got fixed in the merge window and in -stable, right?
If that's true, that changes everything, and this might be more bisectable. I did the test above on 3.17, but perhaps I should try a run on 3.17.3
It might not be easier to bisect because stable is a seperate branch than the next -rc1. And that above got fixed in -rc1, perhaps in the same merge window where the new different issues were introduced. So you'll probably need to shutdown the above issue in order to bisect the others.
What you can do is to bisect and then before every build apply the patches that fix the above issue in -stable, those that I just enumerated to gregkh in our discussion with him. There are only 4. Just try to apply all of them before each build, unless they are already.
I could give you a much simpler hack but I fear it may chaoticly apply depending if the real fixes are applied, halfway or not at all, all that with unpredictable results. So lets rather stick to what we know to work.
Quoted 6 lines · Dave Jones
Quoted 4 lines · Vivek Goyal
I am wondering may be in some cases we panic in second kernel and sit there. Probably we should append a kernel command line automatically say "panic=1" so that it reboots itself if second kernel panics.
Quoted 6 lines
Quoted 4 lines
By any chance, have you enabled "
CONFIG_RANDOMIZE_BASE"? If yes, please disable that as currently kexec/kdump stuff does not work with it. And it hangs very early in the boot process and I had to hook serial console to get following message on console.I did have that enabled. (Perhaps the kconfig should conflict?)
Hi Dave,
Actually kexec/kdump allows booting into a different kernel than running kernel. So one could have KEXEC and CONFIG_RANDOMIZE_BASE enabled in the kernel at the same time but still booting into a kernel with CONFIG_RANDOMIZE_BASE=n and that should work. CONFIG_RANDOMIZE_BASE is only a problem if it is enabled in second kernel.So kconfig conflict might not be a good fit here.
Quoted 74 lines
After rebuilding without it, this..
Quoted 7 lines
Quoted 7 lines
dracut: *** Stripping files done ***
dracut: *** Store current command line parameters ***
dracut: *** Creating image file ***
dracut: *** Creating image file done ***
kdumpctl: cat: write error: Broken pipe
kdumpctl: kexec: failed to load kdump kernel
kdumpctl: Starting kdump: [FAILED]went away. It generated the image, and things looked good. I did echo c >
/proc/sysrq-triggerand got this..SysRq : Trigger a crash
BUG: sleeping function called from invalid context at arch/x86/mm/fault.c:1192 in_atomic(): 0, irqs_disabled(): 0, pid: 8860, name: bash 3 locks held by bash/8860: #0: (sb_writers#5){......}, at: [<ffffffff811eac13>] vfs_write+0x1b3/0x1f0 #1: (rcu_read_lock){......}, at: [<ffffffff8144a435>] __handle_sysrq+0x5/0x1b0 #2: (&mm->mmap_sem){......}, at: [<ffffffff8103cb20>] __do_page_fault+0x140/0x600Preemption disabled at:[<ffffffff817ca332>]
printk+0x5c/0x72CPU: 1 PID: 8860 Comm: bash Not tainted 3.18.0-rc5+ #95 [loadavg: 0.54 0.24 0.09 2/143 8909] 00000000000004a8 00000000e1f75c1b ffff880236473c28 ffffffff817ce5c7 0000000000000000 0000000000000000 ffff880236473c58 ffffffff8109af8a ffff880236473c58 0000000000000029 0000000000000000 ffff880236473d88 Call Trace: [<ffffffff817ce5c7>] dump_stack+0x4f/0x7c [<ffffffff8109af8a>] __might_sleep+0x12a/0x190 [<ffffffff8103cb3b>] __do_page_fault+0x15b/0x600 [<ffffffff811613b2>] ? irq_work_queue+0x62/0xd0 [<ffffffff8137ad7d>] ? trace_hardirqs_off_thunk+0x3a/0x3f [<ffffffff8103cfec>] do_page_fault+0xc/0x10 [<ffffffff817dbcf2>] page_fault+0x22/0x30 [<ffffffff817ca332>] ? printk+0x5c/0x72 [<ffffffff81449ce6>] ? sysrq_handle_crash+0x16/0x20 [<ffffffff8144a567>] __handle_sysrq+0x137/0x1b0 [<ffffffff8144a435>] ? __handle_sysrq+0x5/0x1b0 [<ffffffff8144aa4a>] write_sysrq_trigger+0x4a/0x50 [<ffffffff81259f2d>] proc_reg_write+0x3d/0x80 [<ffffffff811eab1a>] vfs_write+0xba/0x1f0 [<ffffffff811eb628>] SyS_write+0x58/0xd0 [<ffffffff817da052>] system_call_fastpath+0x12/0x17 Oops: 0002 [#1] PREEMPT SMP DEBUG_PAGEALLOC CPU: 1 PID: 8860 Comm: bash Not tainted 3.18.0-rc5+ #95 [loadavg: 0.54 0.24 0.09 1/143 8909] task: ffff8800a1a60000 ti: ffff880236470000 task.ti: ffff880236470000 RIP: 0010:[<ffffffff81449ce6>] [<ffffffff81449ce6>] sysrq_handle_crash+0x16/0x20 RSP: 0018:ffff880236473e38 EFLAGS: 00010246 RAX: 000000000000000f RBX: ffffffff81cb4a00 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff817ca332 RDI: 0000000000000063 RBP: ffff880236473e38 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000358 R11: 0000000000000357 R12: 0000000000000063 R13: 0000000000000000 R14: 0000000000000007 R15: 0000000000000000 FS: 00007fc652f4e740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000023a3b2000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Stack: ffff880236473e78 ffffffff8144a567 ffffffff8144a435 0000000000000002 0000000000000002 00007fc652f51000 0000000000000002 ffff880236473f48 ffff880236473ea8 ffffffff8144aa4a 0000000000000002 00007fc652f51000 Call Trace: [<ffffffff8144a567>] __handle_sysrq+0x137/0x1b0 [<ffffffff8144a435>] ? __handle_sysrq+0x5/0x1b0 [<ffffffff8144aa4a>] write_sysrq_trigger+0x4a/0x50 [<ffffffff81259f2d>] proc_reg_write+0x3d/0x80 [<ffffffff811eab1a>] vfs_write+0xba/0x1f0 [<ffffffff811eb628>] SyS_write+0x58/0xd0 [<ffffffff817da052>] system_call_fastpath+0x12/0x17 Code: 01 f4 45 39 a5 b4 00 00 00 75 e2 4c 89 ef e8 d2 f7 ff ff eb d8 0f 1f 44 00 00 55 c7 05 08 b7 7e 00 01 00 00 00 48 89 e5 0f ae f8 <c6> 04 25 00 00 00 00 01 5d c3 0f 1f 44 00 00 55 31 c0 48 89 e5 RIP [<ffffffff81449ce6>] sysrq_handle_crash+0x16/0x20 RSP <ffff880236473e38>
Quoted 6 lines
CR2: 0000000000000000
Which, asides from the sleeping while atomic thing which isn't important, does what I expected. Shortly later, it rebooted.
And then
/var/crashwas empty.
These messages came from first kernel. I think we have failed very early in second kernel boot.
Can we try following and retry and see if some additional messages show up on console and help us narrow down the problem.
- Enable verbose boot messages. CONFIG_X86_VERBOSE_BOOTUP=y
- Enable early printk in second kernel. (earlyprintk=ttyS0,115200).
You can either enable early printk in first kernel and reboot. That way second kernel will automatically have it enabled. Or you can edit "/etc/sysconfig/kdump" and append earlyprintk=<> to KDUMP_COMMANDLINE_APPEND. You will need to restart kdump service after this.
- Enable some debug output during runtime from kexec purgatory. For that one needs to pass additional arguments to /sbin/kexec. You can edit /etc/sysconfig/kdump file and modify "KEXEC_ARGS" to pass additional arguments to /sbin/kexec during kernel load. I use following for my serial console.
KEXEC_ARGS="--console-serial --serial=0x3f8 --serial-baud=115200"
You will need to restart kdump service.
I hope above give us some information to work with and figure out where did we fail while booting into second kernel.
Thanks
Vivek
Quoted 6 lines · Dave Jones
Quoted 4 lines · Vivek Goyal
I am wondering may be in some cases we panic in second kernel and sit there. Probably we should append a kernel command line automatically say "panic=1" so that it reboots itself if second kernel panics.
Quoted 6 lines
Quoted 4 lines
By any chance, have you enabled "
CONFIG_RANDOMIZE_BASE"? If yes, please disable that as currently kexec/kdump stuff does not work with it. And it hangs very early in the boot process and I had to hook serial console to get following message on console.I did have that enabled. (Perhaps the kconfig should conflict?)
Hi Dave,
Can you please also send me your kernel config file. I will try that on my machine and see if I can reproduce the problem on my machine.
Thanks
Vivek
Quoted 18 lines · Vivek Goyal
Can we try following and retry and see if some additional messages show up on console and help us narrow down the problem.
- Enable verbose boot messages.
CONFIG_X86_VERBOSE_BOOTUP=y- Enable early printk in second kernel. (earlyprintk=ttyS0,115200).
You can either enable early printk in first kernel and reboot. That way second kernel will automatically have it enabled. Or you can edit "
/etc/sysconfig/kdump" and append earlyprintk=<> toKDUMP_COMMANDLINE_APPEND. You will need to restart kdump service after this.- Enable some debug output during runtime from kexec purgatory. For that one needs to pass additional arguments to
/sbin/kexec. You can edit/etc/sysconfig/kdumpfile and modify "KEXEC_ARGS" to pass additional arguments to/sbin/kexecduring kernel load. I use following for my serial console.
Quoted 3 lines
KEXEC_ARGS="--console-serial --serial=0x3f8 --serial-baud=115200"You will need to restart kdump service.
The only serial port on this machine is usb serial, which doesn't have io ports.
Quoted 1 line
From my reading of the kexec man page, it doesn't look like I can tell
it to use ttyUSB0.
And because it relies on usb being initialized, this probably isn't going to help too much with early boot.
earlyprintk=tty0 didn't show anything extra after the sysrq-c oops. likewise, =ttyUSB0
I'm going to try bisecting the problem I'm debugging again, so I'm not going to dig into this much more today.
Dave
Quoted 7 lines · Dave Jones
Disabling
CONTEXT_TRACKINGdidn't change the problem. Unfortunatly the full trace didn't make it over usb-serial this time. Grr.Here's what came over serial..
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [trinity-c35:11634]
Quoted 8 lines
RIP: 0010:[<ffffffff88379605>] [<ffffffff88379605>] copy_user_enhanced_fast_string+0x5/0x10 RAX: ffff880220eb4000 RBX: ffffffff887dac64 RCX: 0000000000006a18 RDX: 000000000000e02f RSI: 00007f766f466620 RDI: ffff88016f6a7617 RBP: ffff880220eb7f78 R08: 8000000000000063 R09: 0000000000000004 Call Trace: [<ffffffff882f4225>] ? SyS_add_key+0xd5/0x240 [<ffffffff8837adae>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff887da092>] system_call_fastpath+0x12/0x17
Ok, that's just about half-way in a ~57kB memory copy (you can see it in the register state: %rdx contains the original size of the key payload, rcx contains the current remaining size: 57kB total, 27kB left).
And it's holding absolutely zero locks, and not even doing anything odd. It wasn't doing anything particularly odd before either, although the kmalloc() of a 64kB area might just have caused a fair amount of VM work, of course.
You know what? I'm seriously starting to think that these bugs aren't actually real. Or rather, I don't think it's really a true softlockup, because most of them seem to happen in totally harmless code.
So I'm wondering whether the real issue might not be just this:
[loadavg: 164.79 157.30 155.90 37/409 11893]
together with possibly a scheduler issue and/or a bug in the smpboot thread logic (that the watchdog uses) or similar.
That's *especially* true if it turns out that the 3.17 problem you saw was actually a perf bug that has already been fixed and is in stable. We've been looking at kernel/smp.c changes, and looking for x86 IPI or APIC changes, and found some harmlessly (at least on x86) suspicious code and this exercise might be worth it for that reason, but what if it's really just a scheduler regression.
There's been a *lot* more scheduler changes since 3.17 than the small things we've looked at for x86 entry or IPI handling. And the scheduler changes have been about things like overloaded scheduling groups etc, and I could easily imaging that some bug *there* ends up causing the watchdog process not to schedule.
Hmm? Scheduler people?
Linus
Quoted 11 lines · Linus Torvalds
You know what? I'm seriously starting to think that these bugs aren't actually real. Or rather, I don't think it's really a true softlockup, because most of them seem to happen in totally harmless code.
So I'm wondering whether the real issue might not be just this:
[loadavg: 164.79 157.30 155.90 37/409 11893]together with possibly a scheduler issue and/or a bug in the smpboot thread logic (that the watchdog uses) or similar.
Quoted 6 lines
That's *especially* true if it turns out that the 3.17 problem you saw was actually a perf bug that has already been fixed and is in stable. We've been looking at
kernel/smp.cchanges, and looking for x86 IPI or APIC changes, and found some harmlessly (at least on x86) suspicious code and this exercise might be worth it for that reason, but what if it's really just a scheduler regression.
I started a run against 3.17 with the perf fixes. If that survives today, I'll start a bisection tomorrow.
Quoted 5 lines
There's been a *lot* more scheduler changes since 3.17 than the small things we've looked at for x86 entry or IPI handling. And the scheduler changes have been about things like overloaded scheduling groups etc, and I could easily imaging that some bug *there* ends up causing the watchdog process not to schedule.
One other data point: I put another box into service for testing, but it's considerably slower (a ~6 year old Xeon vs the Haswell). Maybe it's just because it's so much slower that it'll take longer, (or slow enough that the bug is masked) but that machine hasn't had a problem yet in almost a day of runtime.
Dave
Re: [PATCH] x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
In reply to Thomas GleixnerQuoted 3 lines · Thomas Gleixner
Right, while it is wrong it does not explain the wreckage on 3.17, which does not have that code.
Thomas, I'm currently going off the assumption that I'll see this from the x86 trees, and I can ignore the patch. It doesn't seem like this is a particularly pressing bug.
If it's *not* going to show up as a pull request, holler, and I'll just apply it.
Linus
Quoted 22 lines · Linus Torvalds
Quoted 7 lines · Dave Jones
Disabling
CONTEXT_TRACKINGdidn't change the problem. Unfortunatly the full trace didn't make it over usb-serial this time. Grr.Here's what came over serial..
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [trinity-c35:11634]
Quoted 8 lines
RIP: 0010:[<ffffffff88379605>] [<ffffffff88379605>] copy_user_enhanced_fast_string+0x5/0x10 RAX: ffff880220eb4000 RBX: ffffffff887dac64 RCX: 0000000000006a18 RDX: 000000000000e02f RSI: 00007f766f466620 RDI: ffff88016f6a7617 RBP: ffff880220eb7f78 R08: 8000000000000063 R09: 0000000000000004 Call Trace: [<ffffffff882f4225>] ? SyS_add_key+0xd5/0x240 [<ffffffff8837adae>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff887da092>] system_call_fastpath+0x12/0x17Ok, that's just about half-way in a ~57kB memory copy (you can see it in the register state: %rdx contains the original size of the key payload, rcx contains the current remaining size: 57kB total, 27kB left).
Quoted 4 lines
And it's holding absolutely zero locks, and not even doing anything odd. It wasn't doing anything particularly odd before either, although the
kmalloc()of a 64kB area might just have caused a fair amount of VM work, of course.
Just for clarification, softlockups are processes hogging the cpu (thus blocking the high priority per-cpu watchdog thread).
Hardlockups on the other hand are cpus with interrupts disabled for too long (thus blocking the timer interrupt).
The might coincide with your scheduler theory below. Don't know.
Cheers,
Don
Quoted 28 lines
You know what? I'm seriously starting to think that these bugs aren't actually real. Or rather, I don't think it's really a true softlockup, because most of them seem to happen in totally harmless code.
So I'm wondering whether the real issue might not be just this:
[loadavg: 164.79 157.30 155.90 37/409 11893]together with possibly a scheduler issue and/or a bug in the smpboot thread logic (that the watchdog uses) or similar.
That's *especially* true if it turns out that the 3.17 problem you saw was actually a perf bug that has already been fixed and is in stable. We've been looking at
kernel/smp.cchanges, and looking for x86 IPI or APIC changes, and found some harmlessly (at least on x86) suspicious code and this exercise might be worth it for that reason, but what if it's really just a scheduler regression.There's been a *lot* more scheduler changes since 3.17 than the small things we've looked at for x86 entry or IPI handling. And the scheduler changes have been about things like overloaded scheduling groups etc, and I could easily imaging that some bug *there* ends up causing the watchdog process not to schedule.
Hmm? Scheduler people?
Linus
Quoted 3 lines · Don Zickus
Just for clarification, softlockups are processes hogging the cpu (thus blocking the high priority per-cpu watchdog thread).
Right. And there is no actual sign of any CPU hogging going on. There's a single system call with a small payload (I think it's safe to call 64kB small these days), no hugely contended CPU-spinning locking, nada.
Linus
Quoted 21 lines · Tejun Heo
Quoted 7 lines · Frederic Weisbecker
Quoted 2 lines
Are we talking about different per cpu allocators here or am I missing something completely non obvious?
That's the same allocator yeah. So if the whole memory is dereferenced, faults shouldn't happen indeed.
Maybe that was a bug a few years ago but not anymore.
It has been always like that tho. Percpu memory given out is always populated and cleared.
Quoted 2 lines
Is it possible that, somehow, some part isn't zeroed by
pcpu_alloc()? After all it's allocated withvzalloc()so that part could be skipped. The memset(0)The vzalloc call is for the internal allocation bitmap not the actual percpu memory area. The actual address areas for percpu memory are obtained using
pcpu_get_vm_areas()call and later get populated usingmap_kernel_range_noflush()(flush is performed after mapping is complete).
Quoted 8 lines
Trying to remember what happens with
vmalloc_fault(). Ah okay, so when a new PUD gets created for vmalloc area, we don't go through all PGDs and update them. The PGD entries get faulted in lazily. Percpu memory allocator clearing or not clearing the allocated area doesn't have anything to do with it. The memory area is always fully populated in the kernel page table. It's just that the population happened while a different PGD was active and this PGD hasn't been populated with the new PUD yet.
It's completely undocumented behaviour, whether it has been that way for ever or not. And I agree with Fredric, that it is insane. Actuallu it's beyond insane, really.
Quoted 4 lines
So, yeap,
vmalloc_fault()can always happen when accessing vmalloc areas and the only way to avoid that would be removing lazy PGD population - going through all PGDs and populating new PUDs immediately.
There is no requirement to go through ALL PGDs and populate that stuff immediately.
Lets look at the two types of allocations
1) Kernel percpu allocations
2) Per process/task percpu allocations
Of course we do not have a way to distinguish those, but we really should have one.
#1 Kernel percpu allocations usually happen in the context of driver
bringup, subsystem initialization, interrupt setup etc.
So this is functionality which is not a hotpath and usually requires some form of synchronization versus the rest of the system anyway.
The per cpu population stuff is serialized with a mutex anyway, so what's wrong to have a globaly visible percpu sequence counter, which is incremented whenever a new allocation is populated or torn down?
We can make that sequence counter a per cpu variable as well to avoid the issues of a global variable (preferrably that's a compile/boot time allocated percpu variable to avoid the obvious circulus vitiosus)
Now after that increment the allocation side needs to wait for a scheduling cycle on all cpus (we have mechanisms for that)
So in the scheduler if the same task gets reselected you check that sequence count and update the PGD if different. If a task switch happens then you also need to check the sequence count and act accordingly.
If we make the sequence counter a percpu variable as outlined above the overhead of checking this is just noise versus the other nonsense we do in schedule().
#2 That's process related statistics and instrumentation stuff.
Now that just needs a immediate population on the process->mm->pgd aside of the init_mm.pgd, but that's really not a big deal.
Of course that does not solve the issues we have with the current infrastructure retroactively, but it allows us to avoid fuckups like the one Frederic was talking about that perf invented its own kmalloc based 'percpu' replacement just to workaround the shortcoming in a particular place.
What really frightens me is the potential and well hidden fuckup potential which lurks around the corner and the hard to debug once in a while fallout which might be caused by this.
Thanks,
tglx
tip-bot for Andy Lutomirski
merge bot[tip:x86/urgent] x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
In reply to Andy Lutomirskix86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
Commit-ID: b5e212a3051b65e426a513901d9c7001681c7215 Gitweb: http://git.kernel.org/tip/b5e212a3051b65e426a513901d9c7001681c7215 Author: Andy Lutomirski <[email protected]> AuthorDate: Wed, 19 Nov 2014 13:56:19 -0800 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 20 Nov 2014 23:01:53 +0100
x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
TIF_NOHZ is 19 (i.e. _TIF_SYSCALL_TRACE | _TIF_NOTIFY_RESUME | _TIF_SINGLESTEP), not (1<<19).
This code is involved in Dave's trinity lockup, but I don't see why it would cause any of the problems he's seeing, except inadvertently by causing a different path through entry_64.S's syscall handling.
--- arch/x86/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/ptrace.c +1 -1
@@ -1484,7 +1484,7 @@ unsigned long syscall_trace_enter_phase1(struct pt_regs *regs, u32 arch)*/ if (work & _TIF_NOHZ) {user_exit (); - work &= ~TIF_NOHZ ; + work &= ~_TIF_NOHZ; }#ifdef CONFIG_SECCOMP
Quoted 72 lines · Thomas Gleixner
Quoted 21 lines · Tejun Heo
Quoted 7 lines · Frederic Weisbecker
Quoted 2 lines
Are we talking about different per cpu allocators here or am I missing something completely non obvious?
That's the same allocator yeah. So if the whole memory is dereferenced, faults shouldn't happen indeed.
Maybe that was a bug a few years ago but not anymore.
It has been always like that tho. Percpu memory given out is always populated and cleared.
Quoted 2 lines
Is it possible that, somehow, some part isn't zeroed by
pcpu_alloc()? After all it's allocated withvzalloc()so that part could be skipped. The memset(0)The vzalloc call is for the internal allocation bitmap not the actual percpu memory area. The actual address areas for percpu memory are obtained using
pcpu_get_vm_areas()call and later get populated usingmap_kernel_range_noflush()(flush is performed after mapping is complete).Quoted 8 lines
Trying to remember what happens with
vmalloc_fault(). Ah okay, so when a new PUD gets created for vmalloc area, we don't go through all PGDs and update them. The PGD entries get faulted in lazily. Percpu memory allocator clearing or not clearing the allocated area doesn't have anything to do with it. The memory area is always fully populated in the kernel page table. It's just that the population happened while a different PGD was active and this PGD hasn't been populated with the new PUD yet.It's completely undocumented behaviour, whether it has been that way for ever or not. And I agree with Fredric, that it is insane. Actuallu it's beyond insane, really.
Quoted 4 lines
So, yeap,
vmalloc_fault()can always happen when accessing vmalloc areas and the only way to avoid that would be removing lazy PGD population - going through all PGDs and populating new PUDs immediately.There is no requirement to go through ALL PGDs and populate that stuff immediately.
Lets look at the two types of allocations
1) Kernel percpu allocations
2) Per process/task percpu allocations
Of course we do not have a way to distinguish those, but we really should have one.
#1 Kernel percpu allocations usually happen in the context of driver
bringup, subsystem initialization, interrupt setup etc.So this is functionality which is not a hotpath and usually requires some form of synchronization versus the rest of the system anyway.
The per cpu population stuff is serialized with a mutex anyway, so what's wrong to have a globaly visible percpu sequence counter, which is incremented whenever a new allocation is populated or torn down?
We can make that sequence counter a per cpu variable as well to avoid the issues of a global variable (preferrably that's a compile/boot time allocated percpu variable to avoid the obvious circulus vitiosus)
Now after that increment the allocation side needs to wait for a scheduling cycle on all cpus (we have mechanisms for that)
Quoted 8 lines
So in the scheduler if the same task gets reselected you check that sequence count and update the PGD if different. If a task switch happens then you also need to check the sequence count and act accordingly.
If we make the sequence counter a percpu variable as outlined above the overhead of checking this is just noise versus the other nonsense we do in
schedule().
This seems like a reasonable idea, but I'd suggest a minor change:
rather than using a sequence number, track the number of kernel pgds. That number should rarely change, and it's only one byte long. That means that we can easily stick it in mm_context_t without making it any bigger.
The count for init_mm could be copied into cpu_tlbstate, which is always hot on context switch.
Quoted 13 lines
#2 That's process related statistics and instrumentation stuff.
Now that just needs a immediate population on the
process->mm->pgdaside of the init_mm.pgd, but that's really not a big deal.Of course that does not solve the issues we have with the current infrastructure retroactively, but it allows us to avoid fuckups like the one Frederic was talking about that perf invented its own kmalloc based 'percpu' replacement just to workaround the shortcoming in a particular place.
Quoted 3 lines
What really frightens me is the potential and well hidden fuckup potential which lurks around the corner and the hard to debug once in a while fallout which might be caused by this.
The annoying part of this is that pgd allocation is *so* rare that bugs here can probably go unnoticed for a long time.
--Andy
Re: [PATCH] x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
In reply to Linus TorvaldsQuoted 11 lines · Linus Torvalds
Quoted 3 lines · Thomas Gleixner
Right, while it is wrong it does not explain the wreckage on 3.17, which does not have that code.
Thomas, I'm currently going off the assumption that I'll see this from the x86 trees, and I can ignore the patch. It doesn't seem like this is a particularly pressing bug.
If it's *not* going to show up as a pull request, holler, and I'll just apply it.
I'll send out a updated pul request for the one Ingo sent earlier today in a second.
Thanks,
tglx
Quoted 3 lines · Thomas Gleixner
It's completely undocumented behaviour, whether it has been that way for ever or not. And I agree with Fredric, that it is insane. Actuallu it's beyond insane, really.
This is exactly the same for any address in the vmalloc space.
..
Quoted 4 lines
So in the scheduler if the same task gets reselected you check that sequence count and update the PGD if different. If a task switch happens then you also need to check the sequence count and act accordingly.
That isn't enough tho. What if the percpu allocated pointer gets passed to another CPU without task switching? You'd at least need to send IPIs to all CPUs so that all the active PGDs get updated synchronously.
Quoted 3 lines
What really frightens me is the potential and well hidden fuckup potential which lurks around the corner and the hard to debug once in a while fallout which might be caused by this.
Lazy vmalloc population through fault is something we accepted as reasonable as it works fine for most of the kernel. If the lazy loading can be improved so that it doesn't depend on faulting, great. For the time being, we can make percpu accessors complain when called from nmi handlers so that the problematic ones can be easily identified.
Thanks.
Signature · 1 line
tejun
Quoted 6 lines · Tejun Heo
Quoted 3 lines · Thomas Gleixner
It's completely undocumented behaviour, whether it has been that way for ever or not. And I agree with Fredric, that it is insane. Actuallu it's beyond insane, really.
This is exactly the same for any address in the vmalloc space.
I know, but I really was not aware of the fact that dynamically allocated percpu stuff is vmalloc based and therefor exposed to the same issues.
The normal vmalloc space simply does not have the problems which are generated by percpu allocations which have no documented access restrictions.
You created a special case and that special case is clever but not very well thought out considering the use cases of percpu variables and the completely undocumented limitations you introduced silently.
Just admit it and dont try to educate me about trivial vmalloc properties.
Quoted 10 lines
..
Quoted 4 lines
So in the scheduler if the same task gets reselected you check that sequence count and update the PGD if different. If a task switch happens then you also need to check the sequence count and act accordingly.
That isn't enough tho. What if the percpu allocated pointer gets passed to another CPU without task switching? You'd at least need to send IPIs to all CPUs so that all the active PGDs get updated synchronously.
You obviously did not even take the time to carefully read what I wrote:
"Now after that increment the allocation side needs to wait for a
scheduling cycle on all cpus (we have mechanisms for that)"
That's exactly stating what you claim to be 'not enough'.
Quoted 6 lines
Quoted 3 lines
What really frightens me is the potential and well hidden fuckup potential which lurks around the corner and the hard to debug once in a while fallout which might be caused by this.
Lazy vmalloc population through fault is something we accepted as reasonable as it works fine for most of the kernel.
Emphasis on most.
I'm well aware about the lazy vmalloc population, but I was definitely not aware about the implications chosen by the dynamic percpu allocator. I do not care about random discussion threads on LKML or random slides you produced for a conference. All I care about is that I cannot find a single word of documentation about that in the source tree. Neither in the percpu implementation nor in Documentation/
Quoted 3 lines
For the time being, we can make percpu accessors complain when called from nmi handlers so that the problematic ones can be easily identified.
You should have done that in the very first place instead of letting other people run into issues which you should have thought of from the very beginning.
Thanks,
tglx
Hello,
Quoted 16 lines · Thomas Gleixner
Quoted 6 lines · Tejun Heo
Quoted 3 lines · Thomas Gleixner
It's completely undocumented behaviour, whether it has been that way for ever or not. And I agree with Fredric, that it is insane. Actuallu it's beyond insane, really.
This is exactly the same for any address in the vmalloc space.
I know, but I really was not aware of the fact that dynamically allocated percpu stuff is vmalloc based and therefor exposed to the same issues.
The normal vmalloc space simply does not have the problems which are generated by percpu allocations which have no documented access restrictions.
Quoted 6 lines
You created a special case and that special case is clever but not very well thought out considering the use cases of percpu variables and the completely undocumented limitations you introduced silently.
Just admit it and dont try to educate me about trivial vmalloc properties.
Why are you always so overly dramatic? How is this productive? Sure, this could have been better but I missed it at the beginning and this is the first time I hear about this issue. Shits happen and we fix them.
Quoted 5 lines
Quoted 4 lines
That isn't enough tho. What if the percpu allocated pointer gets passed to another CPU without task switching? You'd at least need to send IPIs to all CPUs so that all the active PGDs get updated synchronously.
Quoted 7 lines
You obviously did not even take the time to carefully read what I wrote:
"Now after that increment the allocation side needs to wait for a
scheduling cycle on all cpus (we have mechanisms for that)"That's exactly stating what you claim to be 'not enough'.
Missed that. Sorry.
Quoted 7 lines
Quoted 3 lines
For the time being, we can make percpu accessors complain when called from nmi handlers so that the problematic ones can be easily identified.
You should have done that in the very first place instead of letting other people run into issues which you should have thought of from the very beginning.
Sure, it would have been better if I noticed that from the get-go, but I couldn't think of the NMI case that time and neither did anybody who reviewed the code. It'd be awesome if we could have avoided it but it didn't go that way, so let's fix it. Can we please stay technical?
So, for now, all we need is adding nmi check in percpu accessors, right?
Signature · 1 line
tejun
Quoted 54 lines · Tejun Heo
Hello,
Quoted 16 lines · Thomas Gleixner
Quoted 6 lines · Tejun Heo
Quoted 3 lines · Thomas Gleixner
It's completely undocumented behaviour, whether it has been that way for ever or not. And I agree with Fredric, that it is insane. Actuallu it's beyond insane, really.
This is exactly the same for any address in the vmalloc space.
I know, but I really was not aware of the fact that dynamically allocated percpu stuff is vmalloc based and therefor exposed to the same issues.
The normal vmalloc space simply does not have the problems which are generated by percpu allocations which have no documented access restrictions.
Quoted 6 lines
You created a special case and that special case is clever but not very well thought out considering the use cases of percpu variables and the completely undocumented limitations you introduced silently.
Just admit it and dont try to educate me about trivial vmalloc properties.
Why are you always so overly dramatic? How is this productive? Sure, this could have been better but I missed it at the beginning and this is the first time I hear about this issue. Shits happen and we fix them.
Quoted 5 lines
Quoted 4 lines
That isn't enough tho. What if the percpu allocated pointer gets passed to another CPU without task switching? You'd at least need to send IPIs to all CPUs so that all the active PGDs get updated synchronously.
Quoted 7 lines
You obviously did not even take the time to carefully read what I wrote:
"Now after that increment the allocation side needs to wait for a
scheduling cycle on all cpus (we have mechanisms for that)"That's exactly stating what you claim to be 'not enough'.
Missed that. Sorry.
Quoted 7 lines
Quoted 3 lines
For the time being, we can make percpu accessors complain when called from nmi handlers so that the problematic ones can be easily identified.
You should have done that in the very first place instead of letting other people run into issues which you should have thought of from the very beginning.
Quoted 8 lines
Sure, it would have been better if I noticed that from the get-go, but I couldn't think of the NMI case that time and neither did anybody who reviewed the code. It'd be awesome if we could have avoided it but it didn't go that way, so let's fix it. Can we please stay technical?
So, for now, all we need is adding nmi check in percpu accessors, right?
What's the issue with nmi? Page faults are supposed to nest correctly inside nmi, right?
--Andy
Quoted 3 lines · Andy Lutomirski
What's the issue with nmi? Page faults are supposed to nest correctly inside nmi, right?
They should, now, yes. There used to be issues with the whole "that re-enables NMI".
Which reminds me. We never took your patches that use ljmp to handle the return-to-kernel mode. You did them for performance reasons, but I think the bigger deal was that it would have cleaned up that whole special case.
Or did they have other problems? The ones to return to user space were admittedly more fun, but just a tad too crazy (and not _quite_ in the "crazy like a fox" camp ;)
Linus
Quoted 6 lines · Andy Lutomirski
Quoted 3 lines
So, for now, all we need is adding nmi check in percpu accessors, right?
What's the issue with nmi? Page faults are supposed to nest correctly inside nmi, right?
Thought they couldn't. Looking at the trace that Frederic linked, it looks like straight-out tracing function recursion due to an unexpected fault while holding a lock. I don't think this can be annotated from percpu accessor side. There's nothing special about the context. :(
Does this matter for anybody other than tracers? Ultimately, the solution would be removing the vmalloc area faulting as Thomas suggested.
Thanks.
Signature · 1 line
tejun
Quoted 5 lines · Tejun Heo
Quoted 4 lines · Andy Lutomirski
Quoted 3 lines
So, for now, all we need is adding nmi check in percpu accessors, right?
Quoted 8 lines
Quoted 2 lines
What's the issue with nmi? Page faults are supposed to nest correctly inside nmi, right?
Thought they couldn't. Looking at the trace that Frederic linked, it looks like straight-out tracing function recursion due to an unexpected fault while holding a lock. I don't think this can be annotated from percpu accessor side. There's nothing special about the context. :(
That doesn't appear to have anything to with nmi though, right?
Wouldn't this issue be fixed by moving the vmalloc_fault check into do_page_fault before exception_enter?
--Andy
Tejun,
Quoted 17 lines · Tejun Heo
Quoted 16 lines · Thomas Gleixner
Quoted 6 lines · Tejun Heo
Quoted 3 lines · Thomas Gleixner
It's completely undocumented behaviour, whether it has been that way for ever or not. And I agree with Fredric, that it is insane. Actuallu it's beyond insane, really.
This is exactly the same for any address in the vmalloc space.
I know, but I really was not aware of the fact that dynamically allocated percpu stuff is vmalloc based and therefor exposed to the same issues.
The normal vmalloc space simply does not have the problems which are generated by percpu allocations which have no documented access restrictions.
Quoted 8 lines
Quoted 6 lines
You created a special case and that special case is clever but not very well thought out considering the use cases of percpu variables and the completely undocumented limitations you introduced silently.
Just admit it and dont try to educate me about trivial vmalloc properties.
Why are you always so overly dramatic?
This has nothing to do with dramatic. It's a matter of fact that I do not need an education on the basic properties of the vmalloc space.
I just refuse to accept that you try to tell me that I should be aware of this:
Quoted 1 line
Quoted 1 line
Quoted 1 line
This is exactly the same for any address in the vmalloc space.
What I was not aware of and even was not aware of after staring into that code fore quite some time is the fact that the whole percpu business is vmalloc based and therefor exposed to the same limitations as the vmalloc space in general.
I'm not a mm expert and without the slightest piece of documentation except for the chunk allocator, which is completely irrelevant in this context, there is not a single word of explanation about the design and the resulting limitations of that in the kernel tree.
So, I'm overly dramatic, because I tell you that I'm well aware of the general vmalloc approach, which is btw. well documented?
Quoted 1 line
How is this productive?
It's obviously very productive, because I'm AFAICT the first person who did not take your design decisions as granted and sacrosanct.
Quoted 2 lines
Sure, this could have been better but I missed it at the beginning and this is the first time I hear about this issue.
So the issues Frederic talked about in that very thread about recursive faults and the need that perf had to emulate percpu stuff in order to work around them have never been communicated to you?
I that's the case then that's not your problem, but a serious problem in our overall process.
Quoted 1 line
Shits happen and we fix them.
I have no problem with that and I'm not trying to put blame on you.
As you might have noticed I spent quite some time to think about a possibile solution and also clearly stated that it's perhaps not solving the issue at hand (while it's not complex to implement) it might be too complex backport. The response I get from you is:
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
That isn't enough tho. What if the percpu allocated pointer gets passed to another CPU without task switching? You'd at least need to send IPIs to all CPUs so that all the active PGDs get updated synchronously.
You obviously did not even take the time to carefully read what I wrote:
Quoted 6 lines
Quoted 4 lines
"Now after that increment the allocation side needs to wait for a
scheduling cycle on all cpus (we have mechanisms for that)"That's exactly stating what you claim to be 'not enough'.
Missed that. Sorry.
Apology accepted.
Quoted 2 lines
So, for now, all we need is adding nmi check in percpu accessors, right?
s/all we need/all we can do/
I think is the proper technical expression for that.
Thanks,
tglx
Steven Rostedt
reviewerQuoted 5 lines · Tejun Heo
Quoted 4 lines · Andy Lutomirski
Quoted 3 lines
So, for now, all we need is adding nmi check in percpu accessors, right?
Quoted 8 lines
Quoted 2 lines
What's the issue with nmi? Page faults are supposed to nest correctly inside nmi, right?
Thought they couldn't. Looking at the trace that Frederic linked, it looks like straight-out tracing function recursion due to an unexpected fault while holding a lock. I don't think this can be annotated from percpu accessor side. There's nothing special about the context. :(
There use to be issues with page faults in NMI. One was that the iretq from the page fault handler would re-enable NMIs, and if another NMI triggered then it would stomp all over the stack of the initial NMI. But my tripple copy of the NMI stack frame solved that. You can read all about it here:
http://lwn.net/Articles/484932/
The second bug was that if an NMI triggered right after a page fault, and it had a page fault, the content of the cr2 register (faulting address) would be lost for the page fault that was preempted by the NMI. This too was solved by using (queue irony) using per_cpu variables.
Now I'm hoping that kernel boot time per_cpu variables never take any faults, otherwise we are all f*cked!
Quoted 4 lines
Does this matter for anybody other than tracers? Ultimately, the solution would be removing the vmalloc area faulting as Thomas suggested.
I don't know, but per_cpu variables are rather special and used all over the place. Most other vmalloc code isn't as used as per_cpu is.
-- Steve
Quoted 10 lines · Linus Torvalds
[...]
That's *especially* true if it turns out that the 3.17 problem you saw was actually a perf bug that has already been fixed and is in stable. We've been looking at
kernel/smp.cchanges, and looking for x86 IPI or APIC changes, and found some harmlessly (at least on x86) suspicious code and this exercise might be worth it for that reason, but what if it's really just a scheduler regression.
Quoted 7 lines
There's been a *lot* more scheduler changes since 3.17 than the small things we've looked at for x86 entry or IPI handling. And the scheduler changes have been about things like overloaded scheduling groups etc, and I could easily imaging that some bug *there* ends up causing the watchdog process not to schedule.
Hmm? Scheduler people?
Hm, that's a possibility, yes.
The watchdog threads are pretty simple beasts though, using SCHED_FIFO:
kernel/watchdog.c: watchdog_set_prio(SCHED_FIFO, MAX_RT_PRIO - 1);
which is typically only affected by less than 10% of scheduler changes - but it's entirely possible still.
It might make sense to disable the softlockup detector altogether and just see whether trinity finishes/wedges, whether a login over the console is still possible - etc.
The softlockup messages in themselves are only analytical, unless CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1 is used.
Interesting bug.
Thanks,
Ingo
Quoted 20 lines · Dave Jones
Quoted 18 lines · Vivek Goyal
Can we try following and retry and see if some additional messages show up on console and help us narrow down the problem.
- Enable verbose boot messages.
CONFIG_X86_VERBOSE_BOOTUP=y- Enable early printk in second kernel. (earlyprintk=ttyS0,115200).
You can either enable early printk in first kernel and reboot. That way second kernel will automatically have it enabled. Or you can edit "
/etc/sysconfig/kdump" and append earlyprintk=<> toKDUMP_COMMANDLINE_APPEND. You will need to restart kdump service after this.- Enable some debug output during runtime from kexec purgatory. For that one needs to pass additional arguments to
/sbin/kexec. You can edit/etc/sysconfig/kdumpfile and modify "KEXEC_ARGS" to pass additional arguments to/sbin/kexecduring kernel load. I use following for my serial console.
Quoted 8 lines
Quoted 3 lines
KEXEC_ARGS="--console-serial --serial=0x3f8 --serial-baud=115200"You will need to restart kdump service.
The only serial port on this machine is usb serial, which doesn't have io ports.
From my reading of the kexec man page, it doesn't look like I can tell it to use ttyUSB0.
Enabling ttyUSB0 still need hacks in dracut/kdump module to pack the usb serial ko to initramfs and load it early. We can work on it in Fedora because it may benefit to some late problems.
Quoted 6 lines
And because it relies on usb being initialized, this probably isn't going to help too much with early boot.
earlyprintk=tty0 didn't show anything extra after the sysrq-c oops. likewise, =ttyUSB0
earlyprintk=vga instead of tty0?
earlyprintk=efi in case efi boot.
earlyprintk=dbgp sometimes also helps but it's a little hard to setup because we need a usb debugger. My nokia n900 works well as a debugger. But to find a usable usb debug port in native host might fail, so this is my last try for earlyprintk :(
Quoted 4 lines
I'm going to try bisecting the problem I'm debugging again, so I'm not going to dig into this much more today.
Another case what I know about kdump kernel issue is nouveau sometimes does not work So if this is the case you can try add "rd.driver.blacklist=nouveau" to field KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump. Or just add "nomodeset" in 1st kernel grub cmdline so that 2nd kernel will reuse it to avoid load drm modules and also earlyprintk=vga probably could show something.
Thanks
Dave
Quoted 10 lines · Thomas Gleixner
Quoted 2 lines · Tejun Heo
Sure, this could have been better but I missed it at the beginning and this is the first time I hear about this issue.
So the issues Frederic talked about in that very thread about recursive faults and the need that perf had to emulate percpu stuff in order to work around them have never been communicated to you?
I that's the case then that's not your problem, but a serious problem in our overall process.
So when the issue arised 4 years ago, it was a problem only for NMIs. Like Linus says: "what happens in NMI stays in NMI". Ok no that's not quite what he says :-) But NMIs happen to be a corner case for about everything and it's sometimes better to fix things from NMI itself, or have an NMI special case rather than grow the whole infrastructure in complexity to support this very corner case.
Not saying that's the only valid approach to take wrt. NMIs but those vmalloc faults seemed to be well established and generally known (except perhaps for percpu) and NMI was the only corner case, and we are used to that, so fixing the issue for NMIs only felt like the right direction when we fixed the callchain thing with other perf developers.
I certainly should have talked to Tejun about that but it took a bit of time for me to realize that randomly faultable memory is a dangerous behaviour.
Add to that a bit of the "take the infrastrusture as granted" problem when you're not well experienced enough...
Anyway, I really hope we fix that, that's a bomb waiting to explode.
Quoted 3 lines · Ingo Molnar
It might make sense to disable the softlockup detector altogether and just see whether trinity finishes/wedges, whether a login over the console is still possible - etc.
I can give that a try later.
Quoted 2 lines
The softlockup messages in themselves are only analytical, unless
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1is used.
Hm, I don't recall why I had that set. That should make things easier to debug if the machine stays alive a little longer rather than panicing. At least it might make sure that I get the full traces over usb-serial.
Additionally, it might make ftrace an option.
The last thing I tested was 3.17 plus the perf fixes Frederic pointed out yesterday. It's survived 20 hours of runtime, so I'm back to believing that this is a recent (ie, post 3.17 bug).
Running into the weekend though, so I'm not going to get to bisecting until Monday probably. So maybe I'll try your idea at the top of this mail in my over-the-weekend run.
Dave
Hello, Frederic.
On Fri, Nov 21, 2014 at 03:13:35PM +0100, Frederic Weisbecker wrote:
...
Quoted 6 lines
So when the issue arised 4 years ago, it was a problem only for NMIs. Like Linus says: "what happens in NMI stays in NMI". Ok no that's not quite what he says :-) But NMIs happen to be a corner case for about everything and it's sometimes better to fix things from NMI itself, or have an NMI special case rather than grow the whole infrastructure in complexity to support this very corner case.
I'm not familiar with the innards of fault handling, so can you please help me understand what may actually break? Here are what I currently understand.
* Static percpu areas wouldn't trigger fault lazily. Note that this is not necessarily because the first percpu chunk which contains the static area is embedded inside the kernel linear mapping. Depending on the memory layout and boot param, percpu allocator may choose to map the first chunk in vmalloc space too; however, this still works out fine because at that point there are no other page tables and the PUD entries covering the first chunk is faulted in before other pages tables are copied from the kernel one.
* NMI used to be a problem because vmalloc fault handler couldn't safely nest inside NMI handler but this has been fixed since and it should work fine from NMI handlers now.
* Function tracers are problematic because they may end up nesting inside themselves through triggering a vmalloc fault while accessing dynamic percpu memory area. This may lead to recursive locking and other surprises.
Are there other cases where the lazy vmalloc faults can break things?
Thanks.
Signature · 1 line
tejun
Hello, Andy.
Quoted 1 line · Andy Lutomirski
That doesn't appear to have anything to with nmi though, right?
I thought that was the main offender but, apparently, not any more.
Quoted 2 lines
Wouldn't this issue be fixed by moving the
vmalloc_faultcheck intodo_page_faultbeforeexception_enter?
Can you please elaborate why that'd fix the issue? I'm not intimiately familiar with the fault handling so it'd be great if you can give me some pointers in terms of where to look at.
Thanks.
Signature · 1 line
tejun
Quoted 6 lines · Tejun Heo
Hello, Andy.
Quoted 1 line · Andy Lutomirski
That doesn't appear to have anything to with nmi though, right?
Quoted 8 lines
I thought that was the main offender but, apparently, not any more.
Quoted 2 lines
Wouldn't this issue be fixed by moving the
vmalloc_faultcheck intodo_page_faultbeforeexception_enter?Can you please elaborate why that'd fix the issue? I'm not intimiately familiar with the fault handling so it'd be great if you can give me some pointers in terms of where to look at.
do_page_fault is called directly from asm. It does:
prev_state = exception_enter();
__do_page_fault(regs, error_code, address);
exception_exit(prev_state);The vmalloc fixup is in __do_page_fault.
exception_enter does various accounting and tracing things, and I think that the recursion in stack trace I saw was in exception_enter.
If you move the vmalloc fixup before exception_enter() and return if the fault was from vmalloc, then you can't recurse. You need to be careful not to touch anything that uses RCU before exception_enter, though.
--Andy
Quoted 5 lines
Thanks.
--
tejun
Quoted 5 lines · Andy Lutomirski
If you move the vmalloc fixup before
exception_enter()and return if the fault was from vmalloc, then you can't recurse. You need to be careful not to touch anything that uses RCU beforeexception_enter, though.
This is probably the right thing to do anyway.
The vmalloc fixup is purely about filling in hardware structures, so there really shouldn't be any need for RCU or anything else. It should probably be done first, before *anything* else (like the whole kmemcheck/kmmio fault etc handling)
That said, the whole vmalloc_fault fixup routine does some odd things, over and beyond just filling in the page tables. So I'm not 100% sure that is safe as-is. The 32-bit version looks fine, but the x86-64 version is very very dubious.
The x86-64 version does crazy things like:
- uses "current->active_mm", which is very dubious
- flush lazy mmu mode
- walk down further in the page tables
and those are just bugs, imnsho. Get rid of that crap. The 32-bit code does it right.
(The 64-bit mode also has a "WARN_ON_ONCE(in_nmi())", which I guess is good - but it's good because the 64-bit version is written the way it is).
Linus
Steven Rostedt
reviewerQuoted 9 lines · Tejun Heo
* Static percpu areas wouldn't trigger fault lazily. Note that this is not necessarily because the first percpu chunk which contains the static area is embedded inside the kernel linear mapping. Depending on the memory layout and boot param, percpu allocator may choose to map the first chunk in vmalloc space too; however, this still works out fine because at that point there are no other page tables and the PUD entries covering the first chunk is faulted in before other pages tables are copied from the kernel one.
That sounds correct.
Quoted 4 lines
* NMI used to be a problem because vmalloc fault handler couldn't safely nest inside NMI handler but this has been fixed since and it should work fine from NMI handlers now.
Right. Of course "should work fine" does not excatly mean "will work fine".
Quoted 5 lines
* Function tracers are problematic because they may end up nesting inside themselves through triggering a vmalloc fault while accessing dynamic percpu memory area. This may lead to recursive locking and other surprises.
The function tracer infrastructure now has a recursive check that happens rather early in the call. Unless the registered OPS specifically states it handles recursions (FTRACE_OPS_FL_RECUSION_SAFE), ftrace will add the necessary recursion checks. If a registered OPS lies about being recusion safe, well we can't stop suicide.
Looking at kernel/trace/trace_functions.c: function_trace_call() which is registered with RECURSION_SAFE, I see that the recursion check is done before the per_cpu_ptr() call to the dynamically allocated per_cpu data.
It looks OK, but...
Oh! but if we trace the page fault handler, and we fault here too we just nuked the cr2 register. Not good.
-- Steve
Quoted 2 lines
Are there other cases where the lazy vmalloc faults can break things?
Steven Rostedt
reviewerQuoted 4 lines · Linus Torvalds
(The 64-bit mode also has a "WARN_ON_ONCE(in_nmi())", which I guess is good - but it's good because the 64-bit version is written the way it is).
Actually, in_nmi() is now safe for vmalloc faults. In fact, it handles the clobbering of the cr2 register just fine. I wrote tests to test this, and submitted patches to get rid of that warn on. But that never went through.
https://lkml.org/lkml/2013/10/15/894
-- Steve
Steven Rostedt
reviewerQuoted 8 lines · On Fri, 21 Nov 2014 12:01:51 -0500 Steven Rostedt <[email protected]> wrote:
Looking at
kernel/trace/trace_functions.c:function_trace_call()which is registered withRECURSION_SAFE, I see that the recursion check is done before theper_cpu_ptr()call to the dynamically allocatedper_cpudata.It looks OK, but...
Oh! but if we trace the page fault handler, and we fault here too we just nuked the cr2 register. Not good.
Ah! Looking at the code, I see that do_page_fault (called from assembly) is marked notrace. And the first thing it does is:
unsigned long address = read_cr2();
And uses that. Thus if the function tracer were to fault on exception_enter() or __do_page_fautt(), the address wont be clobbered.
-- Steve
Quoted 3 lines · Steven Rostedt
Actually,
in_nmi()is now safe for vmalloc faults. In fact, it handles the clobbering of the cr2 register just fine.
That's not what I object to and find incorrect wrt NMI.
Compare the simple and correct 32-bit code to the complex and incorrect 64-bit code.
In particular, look at how the 32-bit code relies *entirely* on hardware state.
Then look at where the 64-bit code does not.
Linus
Quoted 5 lines · Linus Torvalds
Quoted 3 lines · Steven Rostedt
Actually,
in_nmi()is now safe for vmalloc faults. In fact, it handles the clobbering of the cr2 register just fine.
Quoted 8 lines
That's not what I object to and find incorrect wrt NMI.
Compare the simple and correct 32-bit code to the complex and incorrect 64-bit code.
In particular, look at how the 32-bit code relies *entirely* on hardware state.
Then look at where the 64-bit code does not.
Both mystify me. Why does the 32-bit version walk down the hierarchy at all instead of just touching the top level?
And why does the 64-bit version assert that the leaves of the tables match? It's already asserted that it's walking down pgd pointers that are *exactly the same pointers*, so of course the stuff they point to is the same.
--Andy
Steven Rostedt
reviewerQuoted 6 lines · On Fri, 21 Nov 2014 09:19:02 -0800 Linus Torvalds…
Quoted 3 lines · Steven Rostedt
Actually,
in_nmi()is now safe for vmalloc faults. In fact, it handles the clobbering of the cr2 register just fine.That's not what I object to and find incorrect wrt NMI.
I was commenting about the WARN_ON() itself.
Quoted 7 lines
Compare the simple and correct 32-bit code to the complex and incorrect 64-bit code.
In particular, look at how the 32-bit code relies *entirely* on hardware state.
Then look at where the 64-bit code does not.
I see. You have issues with the use of current->active_mm instead of just doing a read_cr3() (and I'm sure other things).
Doing a series of git blame, 64 bit has been like that since 2005 (start of git).
Looks to me we have more work to do with the merging of 64 bit and 32 bit. Perhaps 64 bit can become more like 32 bit.
-- Steve
Quoted 3 lines · Andy Lutomirski
Both mystify me. Why does the 32-bit version walk down the hierarchy at all instead of just touching the top level?
Quite frankly, I think it's just due to historical reasons, and should be removed.
But the historical reasons are that with the aliasing of the PUD and PMD entries in the PGD, it's all fairly confusing. So I think we only used to do the top level, but then when we expanded from two levels to three, that "top level" became the pmd, and then when we expanded from three to four, the pmd was actually two levels down. So it's all basically mindless work.
So I do think we could simplify and unify things.
In 32-bit mode, we actually have two different cases:
- in PAE, there's the magic top-level 4-entry PGD that always *has*
to be present (the P bit isn't actually checked by hardware)
As a result, in PAE mode, the top PGD entries always exist, and
are always prepopulated, and for the kernel area (including obviously the vmalloc space) always points to the init_pgd[] entry.
Ergo, in PAE mode, I don't think we should ever hit this case in
the first place.
- in non-PAE mode, we should just copy the top-level entry, and return.
And in 64-bit more, we only have the "copy the top-level entry" case.
So I think we should
(a) remove the 32-bit vs 64-bit difference, because that's not actually valid
(b) make it a PAE vs non-PAE difference
(c) the PAE case is a no-op
(d) the non-PAE case would look something like this:
static noinline int vmalloc_fault(unsigned long address)
{
unsigned index;
pgd_t *pgd_dst, pgd_entry;
/* Make sure we are in vmalloc area: */
if (!(address >= VMALLOC_START && address < VMALLOC_END))
return -1;
index = pgd_index(address);
pgd_entry = init_mm.pgd[index];
if (!pgd_present(pgd_entry))
return -1;
pgd_dst = __va(PAGE_MASK & read_cr3());
if (pgd_present(pgd_dst[index]))
return -1;
ACCESS_ONCE(pgd_dst[index]) = pgd_entry;
return 0;
}
NOKPROBE_SYMBOL(vmalloc_fault);and it's done.
Would anybody be willing to actually *test* something like the above? The above may compile, but that's all the "testing" it got.
Linus
Quoted 3 lines · Steven Rostedt
I see. You have issues with the use of
current->active_mminstead of just doing aread_cr3()(and I'm sure other things).
Yes. And I have this memory of it actually mattering, where we'd get get the page fault, but see that the (wrong) page table is already populated, and say "ti wasn't a vmalloc fault", and then go down the oops path.
Of course, the context switch itself has changed completely over the years, but I think it would still be true with NMI. "active_mm" may point to a different page table than the one the CPU is actually using, and then the whole thing is bogus.
Linus
Quoted 66 lines · Linus Torvalds
Quoted 3 lines · Andy Lutomirski
Both mystify me. Why does the 32-bit version walk down the hierarchy at all instead of just touching the top level?
Quite frankly, I think it's just due to historical reasons, and should be removed.
But the historical reasons are that with the aliasing of the PUD and PMD entries in the PGD, it's all fairly confusing. So I think we only used to do the top level, but then when we expanded from two levels to three, that "top level" became the pmd, and then when we expanded from three to four, the pmd was actually two levels down. So it's all basically mindless work.
So I do think we could simplify and unify things.
In 32-bit mode, we actually have two different cases:
- in PAE, there's the magic top-level 4-entry PGD that always *has*
to be present (the P bit isn't actually checked by hardware)As a result, in PAE mode, the top PGD entries always exist, and
are always prepopulated, and for the kernel area (including obviously the vmalloc space) always points to the init_pgd[] entry.Ergo, in PAE mode, I don't think we should ever hit this case in
the first place.- in non-PAE mode, we should just copy the top-level entry, and return.
And in 64-bit more, we only have the "copy the top-level entry" case.
So I think we should
(a) remove the 32-bit vs 64-bit difference, because that's not actually valid
(b) make it a PAE vs non-PAE difference
(c) the PAE case is a no-op
(d) the non-PAE case would look something like this:
static noinline int vmalloc_fault(unsigned long address) { unsigned index; pgd_t *pgd_dst, pgd_entry; /* Make sure we are in vmalloc area: */ if (!(address >= VMALLOC_START && address < VMALLOC_END)) return -1; index = pgd_index(address); pgd_entry = init_mm.pgd[index]; if (!pgd_present(pgd_entry)) return -1; pgd_dst = __va(PAGE_MASK & read_cr3()); if (pgd_present(pgd_dst[index])) return -1; ACCESS_ONCE(pgd_dst[index]) = pgd_entry; return 0; } NOKPROBE_SYMBOL(vmalloc_fault);
Quoted 5 lines
and it's done.
Would anybody be willing to actually *test* something like the above? The above may compile, but that's all the "testing" it got.
I'd be happy to test it (i.e. boot it and try to use my computer), but I have nowhere near enough RAM to do it right.
Is there any easy way to get the vmalloc code to randomize enough bits to exercise this?
--Andy
Quoted 11 lines · Linus Torvalds
(d) the non-PAE case would look something like this:
static noinline int vmalloc_fault(unsigned long address) { unsigned index; pgd_t *pgd_dst, pgd_entry; /* Make sure we are in vmalloc area: */ if (!(address >= VMALLOC_START && address < VMALLOC_END)) return -1;
Side note: I think this is just unnecessary confusion, and generates big constants for no good reason.
The thing is, the kernel PGD's should always be in sync. In fact, at PGD allocation time, we just do
clone_pgd_range(.. KERNEL_PGD_BOUNDARY, KERNEL_PGD_PTRS);
and it might actually be better to structure this to be that exact same thing.
So instead of checking the address, we could just do
index = pgd_index(address);
if (index < KERNEL_PGD_BOUNDARY)
return -1;which actually matches our initialization sequence much better anyway. And avoids those random big constants.
Also, it turns out that this:
if (pgd_present(pgd_dst[index]))
generates a crazy big constant because of bad compiler issues (the "pgd_present()" thing only checks the low bit, but it does so on pgd_flags(), which does "native_pgd_val(pgd) & PTE_FLAGS_MASK", so you have an insane extra "and" with the constant 0xffffc00000000fff, just to then "and" it again with "1". It doesn't do that with the first pgd_present() check, oddly enough.
WTF, gcc?
Anyway, even more importantly, because of the whole issue with nesting page tables, it's probably best to actually avoid all the "pgd_present()" etc helpers, because those might be hardcoded to 1 etc. So avoid the whole issue by just accessign the raw data.
Simplify, simplify, simplify. The actual code generation for this all should be maybe 20 instructions.
Here's the simplified end result. Again, this is TOTALLY UNTESTED. I compiled it and verified that the code generation looks like what I'd have expected, but that's literally it.
static noinline int vmalloc_fault(unsigned long address)
{
pgd_t *pgd_dst;
pgdval_t pgd_entry;
unsigned index = pgd_index(address); if (index < KERNEL_PGD_BOUNDARY)
return -1;
pgd_entry = init_mm.pgd[index].pgd;
if (!pgd_entry)
return -1;
pgd_dst = __va(PAGE_MASK & read_cr3());
pgd_dst += index;
if (pgd_dst->pgd)
return -1;
ACCESS_ONCE(pgd_dst->pgd) = pgd_entry;
return 0; }
NOKPROBE_SYMBOL(vmalloc_fault);
Hmm? Does anybody see anything fundamentally wrong with this?
Linus
Steven Rostedt
reviewerQuoted 6 lines · On Fri, 21 Nov 2014 11:06:41 -0800 Linus Torvalds…
static noinline int vmalloc_fault(unsigned long address)
{
pgd_t *pgd_dst;
pgdval_t pgd_entry;
unsigned index = pgd_index(address);Quoted 6 lines
if (index < KERNEL_PGD_BOUNDARY)
return -1;
pgd_entry = init_mm.pgd[index].pgd;
if (!pgd_entry)
return -1;Should we at least check to see if it is present?
if (!(pgd_entry & 1)) return -1;
?
-- Steve
Quoted 15 lines
pgd_dst = __va(PAGE_MASK & read_cr3()); pgd_dst += index; if (pgd_dst->pgd) return -1; ACCESS_ONCE(pgd_dst->pgd) = pgd_entry; return 0;}
NOKPROBE_SYMBOL(vmalloc_fault);Hmm? Does anybody see anything fundamentally wrong with this?
Linus
Quoted 5 lines · Steven Rostedt
Should we at least check to see if it is present?
if (!(pgd_entry & 1)) return -1;
Maybe. But what other entry could there be?
But yes, returning -1 is "safe", since it basically says "I'm not doing a vmalloc thing, oops if this is a bad access". So that kind of argues for being as aggressive as possible in returning 1.
So for the first one (!pgd_entry), instead of returning -1 only for a completely empty entry, returning it for any non-present case is probably right.
And for the second one (where we check whether there is anything at all in the destination), returning -1 for "anything but zero" is probably the right thing to do.
But in the end, if you have a corrupted top-level kernel page table, it sounds to me like you're just royally screwed anyway. So I don't think it matters *that* much.
So I kind of agree, but it wouldn't be my primary worry. My primary worry is actually paravirt doing something insane.
Linus
Quoted 3 lines · Linus Torvalds
So I kind of agree, but it wouldn't be my primary worry. My primary worry is actually paravirt doing something insane.
Btw, on that tangent, does anybody actually care about paravirt any more?
I'd love to start moving away from it. It makes a lot of the low-level code completely impossible to follow due to the random indirection through "native" vs "paravirt op table". Not just the page table handling, it's all over.
Anybody who seriously does virtualization uses hw virtualization that is much better than it used to be. And the non-serious users aren't that performance-sensitive by definition.
I note that the Fedora kernel config seems to include paravirt by default, so you get a lot of the crazy overheads..
Linus
Quoted 10 lines · Linus Torvalds
Here's the simplified end result. Again, this is TOTALLY UNTESTED. I compiled it and verified that the code generation looks like what I'd have expected, but that's literally it.
static noinline int vmalloc_fault(unsigned long address) { pgd_t *pgd_dst; pgdval_t pgd_entry; unsigned index = pgd_index(address);
Quoted 14 lines
if (index < KERNEL_PGD_BOUNDARY)
return -1;
pgd_entry = init_mm.pgd[index].pgd;
if (!pgd_entry)
return -1;
pgd_dst = __va(PAGE_MASK & read_cr3());
pgd_dst += index;
if (pgd_dst->pgd)
return -1;
ACCESS_ONCE(pgd_dst->pgd) = pgd_entry;This will break paravirt. set_pgd/set_pmd are paravirt functions.
But I'm fine with breaking it, then you just need to change CONFIG_PARAVIRT to 'def_bool n'
Thanks,
tglx
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
So I kind of agree, but it wouldn't be my primary worry. My primary worry is actually paravirt doing something insane.
Btw, on that tangent, does anybody actually care about paravirt any more?
Amazon, for better or for worse.
Quoted 11 lines
I'd love to start moving away from it. It makes a lot of the low-level code completely impossible to follow due to the random indirection through "native" vs "paravirt op table". Not just the page table handling, it's all over.
Anybody who seriously does virtualization uses hw virtualization that is much better than it used to be. And the non-serious users aren't that performance-sensitive by definition.
I note that the Fedora kernel config seems to include paravirt by default, so you get a lot of the crazy overheads..
I think that there is a move toward deprecating Xen PV in favor of PVH, but we're not there yet.
--Andy
Quoted 2 lines · Thomas Gleixner
This will break paravirt. set_pgd/set_pmd are paravirt functions.
I suspect we could use "set_pgd()" here instead of the direct access. I didn't want to walk through all the levels to see exactly which random op I needed to use.
Linus
Quoted 6 lines · Linus Torvalds
Anybody who seriously does virtualization uses hw virtualization that is much better than it used to be. And the non-serious users aren't that performance-sensitive by definition.
I note that the Fedora kernel config seems to include paravirt by default, so you get a lot of the crazy overheads..
I'm not sure how many people actually use paravirt these days, but the reason Fedora has it enabled still at least is probably because..
config KVM_GUEST
bool "KVM Guest support (including kvmclock)" depends on PARAVIRT
But tbh I've not looked at this stuff since it first got merged. Will a full-virt system kvm boot a guest without KVM_GUEST enabled ? (ie, is this just an optimisation for the paravirt case?)
I'm not a heavy virt user, so I don't even remember how a lot of this stuff is supposed to work.
Dave
Quoted 13 lines · Dave Jones
Quoted 6 lines · Linus Torvalds
Anybody who seriously does virtualization uses hw virtualization that is much better than it used to be. And the non-serious users aren't that performance-sensitive by definition.
I note that the Fedora kernel config seems to include paravirt by default, so you get a lot of the crazy overheads..
I'm not sure how many people actually use paravirt these days, but the reason Fedora has it enabled still at least is probably because..
Quoted 8 lines
config
KVM_GUEST
bool "KVM Guest support (including kvmclock)" depends on PARAVIRTBut tbh I've not looked at this stuff since it first got merged. Will a full-virt system kvm boot a guest without
KVM_GUESTenabled ? (ie, is this just an optimisation for the paravirt case?)
It will boot just fine, although there may be some timing glitches.
I think we should have PARAVIRT_LITE that's just enough for KVM. That probably involves some apic changes and nothing else.
--Andy
Quoted 5 lines
I'm not a heavy virt user, so I don't even remember how a lot of this stuff is supposed to work.
Dave
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 22 lines · Andy Lutomirski
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
So I kind of agree, but it wouldn't be my primary worry. My primary worry is actually paravirt doing something insane.
Btw, on that tangent, does anybody actually care about paravirt any more?
Amazon, for better or for worse.
Quoted 9 lines
I'd love to start moving away from it. It makes a lot of the low-level code completely impossible to follow due to the random indirection through "native" vs "paravirt op table". Not just the page table handling, it's all over.
Anybody who seriously does virtualization uses hw virtualization that is much better than it used to be. And the non-serious users aren't that performance-sensitive by definition.
Quoted 5 lines
Quoted 2 lines
I note that the Fedora kernel config seems to include paravirt by default, so you get a lot of the crazy overheads..
I think that there is a move toward deprecating Xen PV in favor of PVH, but we're not there yet.
A move where? The Xen stuff in Fedora is ... not paid attention to very much. If there's something we should be looking at turning off (or on), we're happy to take suggestions.
josh
Quoted 26 lines · Josh Boyer
Quoted 25 lines · Andy Lutomirski
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
So I kind of agree, but it wouldn't be my primary worry. My primary worry is actually paravirt doing something insane.
Btw, on that tangent, does anybody actually care about paravirt any more?
Amazon, for better or for worse.
Quoted 11 lines
I'd love to start moving away from it. It makes a lot of the low-level code completely impossible to follow due to the random indirection through "native" vs "paravirt op table". Not just the page table handling, it's all over.
Anybody who seriously does virtualization uses hw virtualization that is much better than it used to be. And the non-serious users aren't that performance-sensitive by definition.
I note that the Fedora kernel config seems to include paravirt by default, so you get a lot of the crazy overheads..
Quoted 6 lines
Quoted 2 lines
I think that there is a move toward deprecating Xen PV in favor of PVH, but we're not there yet.
A move where? The Xen stuff in Fedora is ... not paid attention to very much. If there's something we should be looking at turning off (or on), we're happy to take suggestions.
A move in the Xen project. As I understand it, Xen wants to deprecate PV in favor of PVH, but PVH is still experimental.
I think that dropping PARAVIRT in Fedora might be a bad idea for several more releases, since that's likely to break the EC2 images.
--Andy
Quoted 2 lines
josh
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 7 lines · Linus Torvalds
Quoted 2 lines · Thomas Gleixner
This will break paravirt. set_pgd/set_pmd are paravirt functions.
I suspect we could use "
set_pgd()" here instead of the direct access. I didn't want to walk through all the levels to see exactly which random op I needed to use.
I don't think that works on 32bit. See the magic in vmalloc_sync_one().
Thanks,
tglx
Quoted 30 lines · Andy Lutomirski
Quoted 29 lines · Josh Boyer
Quoted 27 lines · Andy Lutomirski
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
So I kind of agree, but it wouldn't be my primary worry. My primary worry is actually paravirt doing something insane.
Btw, on that tangent, does anybody actually care about paravirt any more?
Amazon, for better or for worse.
Quoted 11 lines
I'd love to start moving away from it. It makes a lot of the low-level code completely impossible to follow due to the random indirection through "native" vs "paravirt op table". Not just the page table handling, it's all over.
Anybody who seriously does virtualization uses hw virtualization that is much better than it used to be. And the non-serious users aren't that performance-sensitive by definition.
I note that the Fedora kernel config seems to include paravirt by default, so you get a lot of the crazy overheads..
I think that there is a move toward deprecating Xen PV in favor of PVH, but we're not there yet.
Quoted 6 lines
Quoted 3 lines
A move where? The Xen stuff in Fedora is ... not paid attention to very much. If there's something we should be looking at turning off (or on), we're happy to take suggestions.
A move in the Xen project. As I understand it, Xen wants to deprecate PV in favor of PVH, but PVH is still experimental.
OK.
Quoted 2 lines
I think that dropping PARAVIRT in Fedora might be a bad idea for several more releases, since that's likely to break the EC2 images.
Yes, that's essentially the only reason we haven't looked at disabling Xen completely for a while now, so <sad trombone>.
josh
Quoted 3 lines · Thomas Gleixner
I don't think that works on 32bit. See the magic in
vmalloc_sync_one().
Heh. I guess we could just add a wrapper around this crap, and make it very clear that the paravirt case is a horrible horrible hack.
Something like
#define set_one_pgd_entry(entry,pgdp) (pgdp)->pgd = (entry)
for the regular case, and then for paravirt we do something very explicitly horrid, like
#ifdef CONFIG_PARAVIRT
#ifdef CONFIG_X86_32
// The pmd is the top-level page directory on non-PAE x86, nested
inside pgd/pud
#define set_one_pgd_entry(entry,pgdp) set_pmd((pmd_t *)(pgdp),
(pmd_t) { entry } )
#else
#define set_one_pgd_entry(entry, pgdp) do { set_pgd(pgdp, (pgd_t) {
entry }); arch_flush_lazy_mmu_mode(); } while (0)
#endif
because on x86-64, there seems to be that whole lazy_mode pv_ops craziness (which I'm not at all convinced is needed here, but that's what the current code does).
Linus
Quoted 23 lines · Linus Torvalds
Quoted 3 lines · Thomas Gleixner
I don't think that works on 32bit. See the magic in
vmalloc_sync_one().Heh. I guess we could just add a wrapper around this crap, and make it very clear that the paravirt case is a horrible horrible hack.
Something like
#define set_one_pgd_entry(entry,pgdp) (pgdp)->pgd = (entry)for the regular case, and then for paravirt we do something very explicitly horrid, like
#ifdef CONFIG_PARAVIRT #ifdef CONFIG_X86_32 // The pmd is the top-level page directory on non-PAE x86, nested inside pgd/pud #define set_one_pgd_entry(entry,pgdp) set_pmd((pmd_t *)(pgdp), (pmd_t) { entry } ) #else #define set_one_pgd_entry(entry, pgdp) do { set_pgd(pgdp, (pgd_t) {
Quoted 6 lines
entry });
arch_flush_lazy_mmu_mode(); } while (0)
#endifbecause on x86-64, there seems to be that whole
lazy_modepv_opscraziness (which I'm not at all convinced is needed here, but that's what the current code does).
I'm fine with that. I just think it's not horrid enough, but that can be fixed easily :)
Thanks,
tglx
Quoted 27 lines · Steven Rostedt
Quoted 9 lines · Tejun Heo
* Static percpu areas wouldn't trigger fault lazily. Note that this is not necessarily because the first percpu chunk which contains the static area is embedded inside the kernel linear mapping. Depending on the memory layout and boot param, percpu allocator may choose to map the first chunk in vmalloc space too; however, this still works out fine because at that point there are no other page tables and the PUD entries covering the first chunk is faulted in before other pages tables are copied from the kernel one.
That sounds correct.
Quoted 4 lines
* NMI used to be a problem because vmalloc fault handler couldn't safely nest inside NMI handler but this has been fixed since and it should work fine from NMI handlers now.
Right. Of course "should work fine" does not excatly mean "will work fine".
Quoted 5 lines
* Function tracers are problematic because they may end up nesting inside themselves through triggering a vmalloc fault while accessing dynamic percpu memory area. This may lead to recursive locking and other surprises.
Quoted 5 lines
The function tracer infrastructure now has a recursive check that happens rather early in the call. Unless the registered OPS specifically states it handles recursions (
FTRACE_OPS_FL_RECUSION_SAFE), ftrace will add the necessary recursion checks. If a registered OPS lies about being recusion safe, well we can't stop suicide.
Same if the recursion state is based on per cpu memory.
Quoted 9 lines
Looking at
kernel/trace/trace_functions.c:function_trace_call()which is registered withRECURSION_SAFE, I see that the recursion check is done before theper_cpu_ptr()call to the dynamically allocatedper_cpudata.It looks OK, but...
Oh! but if we trace the page fault handler, and we fault here too we just nuked the cr2 register. Not good.
If we fault in the page fault handler, we double fault and apparently recovering from that isn't quite expected anyway.
Quoted 41 lines · Frederic Weisbecker
Quoted 27 lines · Steven Rostedt
Quoted 9 lines · Tejun Heo
* Static percpu areas wouldn't trigger fault lazily. Note that this is not necessarily because the first percpu chunk which contains the static area is embedded inside the kernel linear mapping. Depending on the memory layout and boot param, percpu allocator may choose to map the first chunk in vmalloc space too; however, this still works out fine because at that point there are no other page tables and the PUD entries covering the first chunk is faulted in before other pages tables are copied from the kernel one.
That sounds correct.
Quoted 4 lines
* NMI used to be a problem because vmalloc fault handler couldn't safely nest inside NMI handler but this has been fixed since and it should work fine from NMI handlers now.
Right. Of course "should work fine" does not excatly mean "will work fine".
Quoted 5 lines
* Function tracers are problematic because they may end up nesting inside themselves through triggering a vmalloc fault while accessing dynamic percpu memory area. This may lead to recursive locking and other surprises.
Quoted 5 lines
The function tracer infrastructure now has a recursive check that happens rather early in the call. Unless the registered OPS specifically states it handles recursions (
FTRACE_OPS_FL_RECUSION_SAFE), ftrace will add the necessary recursion checks. If a registered OPS lies about being recusion safe, well we can't stop suicide.Same if the recursion state is based on per cpu memory.
Quoted 5 lines
Looking at
kernel/trace/trace_functions.c:function_trace_call()which is registered withRECURSION_SAFE, I see that the recursion check is done before theper_cpu_ptr()call to the dynamically allocatedper_cpudata.
Quoted 7 lines
Quoted 4 lines
It looks OK, but...
Oh! but if we trace the page fault handler, and we fault here too we just nuked the cr2 register. Not good.
If we fault in the page fault handler, we double fault and apparently recovering from that isn't quite expected anyway.
Not quite. We only double fault if we fault while pushing the hardware part of the state onto the stack. That happens even before the entry asm gets run.
Otherwise if we have a page fault inside do_page_fault, it's just a nested page fault.
--Andy
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 28 lines · Tejun Heo
Hello, Frederic.
On Fri, Nov 21, 2014 at 03:13:35PM +0100, Frederic Weisbecker wrote:
...Quoted 6 lines
So when the issue arised 4 years ago, it was a problem only for NMIs. Like Linus says: "what happens in NMI stays in NMI". Ok no that's not quite what he says :-) But NMIs happen to be a corner case for about everything and it's sometimes better to fix things from NMI itself, or have an NMI special case rather than grow the whole infrastructure in complexity to support this very corner case.
I'm not familiar with the innards of fault handling, so can you please help me understand what may actually break? Here are what I currently understand.
* Static percpu areas wouldn't trigger fault lazily. Note that this is not necessarily because the first percpu chunk which contains the static area is embedded inside the kernel linear mapping. Depending on the memory layout and boot param, percpu allocator may choose to map the first chunk in vmalloc space too; however, this still works out fine because at that point there are no other page tables and the PUD entries covering the first chunk is faulted in before other pages tables are copied from the kernel one.
* NMI used to be a problem because vmalloc fault handler couldn't safely nest inside NMI handler but this has been fixed since and it should work fine from NMI handlers now.
Quoted 6 lines
* Function tracers are problematic because they may end up nesting inside themselves through triggering a vmalloc fault while accessing dynamic percpu memory area. This may lead to recursive locking and other surprises.
Are there other cases where the lazy vmalloc faults can break things?
I fear that enumerating and fix the existing issues won't be enough. We can't find all the code sites out there which rely on not being faulted.
The best would be to fix that from the percpu allocator itself, or vmalloc.
Quoted 50 lines · Andy Lutomirski
Quoted 41 lines · Frederic Weisbecker
Quoted 27 lines · Steven Rostedt
Quoted 9 lines · Tejun Heo
* Static percpu areas wouldn't trigger fault lazily. Note that this is not necessarily because the first percpu chunk which contains the static area is embedded inside the kernel linear mapping. Depending on the memory layout and boot param, percpu allocator may choose to map the first chunk in vmalloc space too; however, this still works out fine because at that point there are no other page tables and the PUD entries covering the first chunk is faulted in before other pages tables are copied from the kernel one.
That sounds correct.
Quoted 4 lines
* NMI used to be a problem because vmalloc fault handler couldn't safely nest inside NMI handler but this has been fixed since and it should work fine from NMI handlers now.
Right. Of course "should work fine" does not excatly mean "will work fine".
Quoted 5 lines
* Function tracers are problematic because they may end up nesting inside themselves through triggering a vmalloc fault while accessing dynamic percpu memory area. This may lead to recursive locking and other surprises.
Quoted 5 lines
The function tracer infrastructure now has a recursive check that happens rather early in the call. Unless the registered OPS specifically states it handles recursions (
FTRACE_OPS_FL_RECUSION_SAFE), ftrace will add the necessary recursion checks. If a registered OPS lies about being recusion safe, well we can't stop suicide.Same if the recursion state is based on per cpu memory.
Quoted 5 lines
Looking at
kernel/trace/trace_functions.c:function_trace_call()which is registered withRECURSION_SAFE, I see that the recursion check is done before theper_cpu_ptr()call to the dynamically allocatedper_cpudata.Quoted 7 lines
Quoted 4 lines
It looks OK, but...
Oh! but if we trace the page fault handler, and we fault here too we just nuked the cr2 register. Not good.
If we fault in the page fault handler, we double fault and apparently recovering from that isn't quite expected anyway.
Quoted 6 lines
Not quite. We only double fault if we fault while pushing the hardware part of the state onto the stack. That happens even before the entry asm gets run.
Otherwise if we have a page fault inside
do_page_fault, it's just a nested page fault.
Oh ok!
But we still have the cr2 issue that Steve talked about.
Quoted 7 lines
--Andy
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 24 lines · Andy Lutomirski
Quoted 6 lines · Tejun Heo
Hello, Andy.
Quoted 1 line · Andy Lutomirski
That doesn't appear to have anything to with nmi though, right?
Quoted 8 lines
I thought that was the main offender but, apparently, not any more.
Quoted 2 lines
Wouldn't this issue be fixed by moving the
vmalloc_faultcheck intodo_page_faultbeforeexception_enter?Can you please elaborate why that'd fix the issue? I'm not intimiately familiar with the fault handling so it'd be great if you can give me some pointers in terms of where to look at.
do_page_faultis called directly from asm. It does:prev_state = exception_enter(); __do_page_fault(regs, error_code, address); exception_exit(prev_state);The vmalloc fixup is in
__do_page_fault.
Quoted 7 lines
exception_enterdoes various accounting and tracing things, and I think that the recursion in stack trace I saw was inexception_enter.If you move the vmalloc fixup before
exception_enter()and return if the fault was from vmalloc, then you can't recurse. You need to be careful not to touch anything that uses RCU beforeexception_enter, though.
That fixes the exception_enter() recursion but surely more issues with per cpu memory faults are lurking somewhere now or in the future.
I'm going to add recursion protection to user_exit()/user_enter() anyway.
Quoted 24 lines · Thomas Gleixner
Quoted 23 lines · Linus Torvalds
Here's the simplified end result. Again, this is TOTALLY UNTESTED. I compiled it and verified that the code generation looks like what I'd have expected, but that's literally it.
static noinline int vmalloc_fault(unsigned long address) { pgd_t *pgd_dst; pgdval_t pgd_entry; unsigned index = pgd_index(address);if (index < KERNEL_PGD_BOUNDARY) return -1; pgd_entry = init_mm.pgd[index].pgd; if (!pgd_entry) return -1; pgd_dst = __va(PAGE_MASK & read_cr3()); pgd_dst += index; if (pgd_dst->pgd) return -1;
Quoted 6 lines
Quoted 1 line
ACCESS_ONCE(pgd_dst->pgd) = pgd_entry;This will break paravirt. set_pgd/set_pmd are paravirt functions.
But I'm fine with breaking it, then you just need to change
CONFIG_PARAVIRTto 'def_booln'
That is not very nice.
Quoted 24 lines · Thomas Gleixner
Quoted 23 lines · Linus Torvalds
Here's the simplified end result. Again, this is TOTALLY UNTESTED. I compiled it and verified that the code generation looks like what I'd have expected, but that's literally it.
static noinline int vmalloc_fault(unsigned long address) { pgd_t *pgd_dst; pgdval_t pgd_entry; unsigned index = pgd_index(address);if (index < KERNEL_PGD_BOUNDARY) return -1; pgd_entry = init_mm.pgd[index].pgd; if (!pgd_entry) return -1; pgd_dst = __va(PAGE_MASK & read_cr3()); pgd_dst += index; if (pgd_dst->pgd) return -1;
Quoted 6 lines
Quoted 1 line
ACCESS_ONCE(pgd_dst->pgd) = pgd_entry;This will break paravirt. set_pgd/set_pmd are paravirt functions.
But I'm fine with breaking it, then you just need to change
CONFIG_PARAVIRTto 'def_booln'
That is not very nice.
Steven Rostedt
reviewerOn Fri, 21 Nov 2014 22:50:41 +0100
Frederic Weisbecker <[email protected]> wrote:
\
Quoted 7 lines
Quoted 2 lines
Otherwise if we have a page fault inside
do_page_fault, it's just a nested page fault.Oh ok!
But we still have the cr2 issue that Steve talked about.
Nope, as I looked at the code, I noticed that do_page_fault isn't traced which is the wrapper for __do_page_fault which is. And do_page_fault() saves off the cr2 before calling anything else.
So we are ok in this respect as well.
-- Steve
Quoted 3 lines · Thomas Gleixner
I'm fine with that. I just think it's not horrid enough, but that can be fixed easily :)
Oh, I think it's plenty horrid.
Anyway, here's an actual patch. As usual, it has seen absolutely no actual testing, but I did try to make sure it compiles and seems to do the right thing on:
- x86-32 no-PAE
- x86-32 no-PAE with PARAVIRT
- x86-32 PAE
- x86-64
also, I just removed the noise that is "vmalloc_sync_all()", since it's just all garbage and nothing actually uses it. Yeah, it's used by "register_die_notifier()", which makes no sense what-so-ever. Whatever. It's gone.
Can somebody actually *test* this? In particular, in any kind of real paravirt environment? Or, any comments even without testing?
I *really* am not proud of the mess wrt the whole
#ifdef CONFIG_PARAVIRT
#ifdef CONFIG_X86_32
...but I think that from a long-term perspective, we're actually better off with this kind of really ugly - but very explcit - hack that very clearly shows what is going on.
The old code that actually "walked" the page tables was more "portable", but was somewhat misleading about what was actually going on.
Comments?
Linus
arch/x86/mm/fault.c | 243 +++++++++++++--------------------------------------- 1 file changed, 58 insertions(+), 185 deletions(-)
arch/x86/mm/fault.c +58 -185
@@ -42,6 +42,64 @@ enum x86_pf_error_code { };/* +* Handle a possible vmalloc fault. We just copy the +* top-level page table entry if necessary. +* +* With PAE, the top-most pgd entry is always shared, +* and that's where the vmalloc area is. So PAE had +* better never have any vmalloc faults. +* +* NOTE! This on purpose does *NOT* use pgd_present() +* and such generic accessor functions, because +* the pgd may contain a folded pud/pmd, and is thus +* always "present". We access the actual hardware +* state directly, except for the final "set_pgd()" +* that may go through a paravirtualization layer. +* +* Also note the disgusting hackery for the whole +* paravirtualization case. Since PAE isn't an issue, +* we know that the pmd is the top level, and we just +* short-circuit it all. +* +* We *seriously* need to get rid of the crazy +* paravirtualization crud. +*/ +static nokprobe_inline int vmalloc_fault(unsigned long address) +{ +#ifdef CONFIG_X86_PAE +return -1 ; +#else +pgd_t *pgd_dst, pgd_entry; +unsigned index =pgd_index (address); + +if (index <KERNEL_PGD_BOUNDARY ) +return -1 ; + + pgd_entry = init_mm.pgd[index]; +if (!(pgd_entry.pgd &1 )) +return -1 ; + + pgd_dst =__va (PAGE_MASK &read_cr3 ()); + pgd_dst += index; + +if (pgd_dst->pgd) +return -1 ; + +#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_X86_32 +set_pmd ((pmd_t *)pgd_dst, (pmd_t ){(pud_t ){pgd_entry}}); +#else +set_pgd (pgd_dst, pgd_entry); +arch_flush_lazy_mmu_mode ();// WTF? +#endif +#else + *pgd_dst = pgd_entry; +#endif +return 0 ; +#endif +} + +/* * Returns 0 if mmiotrace is disabled, or if the fault is not * handled by mmiotrace: */
@@ -189,110 +247,6 @@ DEFINE_SPINLOCK(pgd_lock);LIST_HEAD (pgd_list);#ifdef CONFIG_X86_32 -static inline pmd_t *vmalloc_sync_one (pgd_t *pgd,unsigned long address) -{ -unsigned index =pgd_index (address); -pgd_t *pgd_k; -pud_t *pud, *pud_k; -pmd_t *pmd, *pmd_k; - - pgd += index; - pgd_k = init_mm.pgd + index; - -if (!pgd_present (*pgd_k)) -return NULL ; - -/* -* set_pgd(pgd, *pgd_k); here would be useless on PAE -* and redundant with the set_pmd() on non-PAE. As would -* set_pud. -*/ - pud =pud_offset (pgd, address); - pud_k =pud_offset (pgd_k, address); -if (!pud_present (*pud_k)) -return NULL ; - - pmd =pmd_offset (pud, address); - pmd_k =pmd_offset (pud_k, address); -if (!pmd_present (*pmd_k)) -return NULL ; - -if (!pmd_present (*pmd)) -set_pmd (pmd, *pmd_k); -else -BUG_ON (pmd_page (*pmd) !=pmd_page (*pmd_k)); - -return pmd_k; -} - -void vmalloc_sync_all (void ) -{ -unsigned long address; - -if (SHARED_KERNEL_PMD ) -return ; - -for (address =VMALLOC_START &PMD_MASK ; - address >=TASK_SIZE && address <FIXADDR_TOP ; - address +=PMD_SIZE ) { -struct page *page; - -spin_lock (&pgd_lock); -list_for_each_entry (page, &pgd_list, lru) { -spinlock_t *pgt_lock; -pmd_t *ret; - -/* the pgt_lock only for Xen */ - pgt_lock = &pgd_page_get_mm (page)->page_table_lock; - -spin_lock (pgt_lock); - ret =vmalloc_sync_one (page_address (page), address); -spin_unlock (pgt_lock); - -if (!ret) -break ; - } -spin_unlock (&pgd_lock); - } -} - -/* -* 32-bit: -* -* Handle a fault on the vmalloc or module mapping area -*/ -static noinline int vmalloc_fault(unsigned long address) -{ -unsigned long pgd_paddr; -pmd_t *pmd_k; -pte_t *pte_k; - -/* Make sure we are in vmalloc area: */ -if (!(address >=VMALLOC_START && address <VMALLOC_END )) -return -1 ; - -WARN_ON_ONCE (in_nmi ()); - -/* -* Synchronize this task's top level page-table -* with the 'reference' page table. -* -* Do _not_ use "current" here. We might be inside -* an interrupt in the middle of a task switch.. -*/ - pgd_paddr =read_cr3 (); - pmd_k =vmalloc_sync_one (__va (pgd_paddr), address); -if (!pmd_k) -return -1 ; - - pte_k =pte_offset_kernel (pmd_k, address); -if (!pte_present (*pte_k)) -return -1 ; - -return 0 ; -} -NOKPROBE_SYMBOL (vmalloc_fault); -/* * Did it hit the DOS screen memory VA from vm86 mode? */
@@ -347,87 +301,6 @@ out:#else /* CONFIG_X86_64: */ -void vmalloc_sync_all (void ) -{ -sync_global_pgds (VMALLOC_START &PGDIR_MASK ,VMALLOC_END ,0 ); -} - -/* -* 64-bit: -* -* Handle a fault on the vmalloc area -* -* This assumes no large pages in there. -*/ -static noinline int vmalloc_fault(unsigned long address) -{ -pgd_t *pgd, *pgd_ref; -pud_t *pud, *pud_ref; -pmd_t *pmd, *pmd_ref; -pte_t *pte, *pte_ref; - -/* Make sure we are in vmalloc area: */ -if (!(address >=VMALLOC_START && address <VMALLOC_END )) -return -1 ; - -WARN_ON_ONCE (in_nmi ()); - -/* -* Copy kernel mappings over when needed. This can also -* happen within a race in page table update. In the later -* case just flush: -*/ - pgd =pgd_offset (current->active_mm, address); - pgd_ref =pgd_offset_k (address); -if (pgd_none (*pgd_ref)) -return -1 ; - -if (pgd_none (*pgd)) { -set_pgd (pgd, *pgd_ref); -arch_flush_lazy_mmu_mode (); - }else { -BUG_ON (pgd_page_vaddr (*pgd) !=pgd_page_vaddr (*pgd_ref)); - } - -/* -* Below here mismatches are bugs because these lower tables -* are shared: -*/ - - pud =pud_offset (pgd, address); - pud_ref =pud_offset (pgd_ref, address); -if (pud_none (*pud_ref)) -return -1 ; - -if (pud_none (*pud) ||pud_page_vaddr (*pud) !=pud_page_vaddr (*pud_ref)) -BUG (); - - pmd =pmd_offset (pud, address); - pmd_ref =pmd_offset (pud_ref, address); -if (pmd_none (*pmd_ref)) -return -1 ; - -if (pmd_none (*pmd) ||pmd_page (*pmd) !=pmd_page (*pmd_ref)) -BUG (); - - pte_ref =pte_offset_kernel (pmd_ref, address); -if (!pte_present (*pte_ref)) -return -1 ; - - pte =pte_offset_kernel (pmd, address); - -/* -* Don't use pte_page here, because the mappings can point -* outside mem_map, and the NUMA hash lookup cannot handle -* that: -*/ -if (!pte_present (*pte) ||pte_pfn (*pte) !=pte_pfn (*pte_ref)) -BUG (); - -return 0 ; -} -NOKPROBE_SYMBOL (vmalloc_fault); -#ifdef CONFIG_CPU_SUP_AMD static const char errata93_warning[] =KERN_ERR
Quoted 29 lines · Linus Torvalds
Quoted 3 lines · Thomas Gleixner
I'm fine with that. I just think it's not horrid enough, but that can be fixed easily :)
Oh, I think it's plenty horrid.
Anyway, here's an actual patch. As usual, it has seen absolutely no actual testing, but I did try to make sure it compiles and seems to do the right thing on:
- x86-32 no-PAE
- x86-32 no-PAE with PARAVIRT
- x86-32 PAE
- x86-64also, I just removed the noise that is "
vmalloc_sync_all()", since it's just all garbage and nothing actually uses it. Yeah, it's used by "register_die_notifier()", which makes no sense what-so-ever. Whatever. It's gone.Can somebody actually *test* this? In particular, in any kind of real paravirt environment? Or, any comments even without testing?
I *really* am not proud of the mess wrt the whole
#ifdef CONFIG_PARAVIRT #ifdef CONFIG_X86_32 ...
Quoted 7 lines
but I think that from a long-term perspective, we're actually better off with this kind of really ugly - but very explcit - hack that very clearly shows what is going on.
The old code that actually "walked" the page tables was more "portable", but was somewhat misleading about what was actually going on.
At the risk of going deeper down the rabbit hole, I grepped for pgd_list. I found:
__set_pmd_pte in pageattr.c. It appears to be completely incorrect. Unless I've misunderstood, other than the very first line, it will either do nothing at all or crash when it falls off the end of the page tables that it's pointlessly trying to update.
sync_global_pgds: OK, I guess -- this is for hot-add of memory, right?
But if we teach the context switch code to check that the kernel
stack is okay, that can be removed, I think. (We absolutely MUST keep the static per-cpu stuff populated everywhere before running user code, but that's never in hot-added memory.)
xen_mm_pin_all and xen_mm_unpin_all: I have no clue. I wonder how that works with SHARED_KERNEL_PMD.
Anyone want to attack these? It would be kind of nice to remove pgd_list entirely. (I realize that doing so precludes the use of bloody enormous 512GB kernel pages, but any attempt to use *those* is so completely screwed without a major reworking of all of this (or perhaps stop_machine) that keeping pgd_list around just for that is probably a mistake.)
--Andy
Quoted 5 lines · Andy Lutomirski
Quoted 3 lines · Linus Torvalds
Anyway, here's an actual patch. As usual, it has seen absolutely no actual testing,
.. ok, it boots and works fine as far as I can tell on x86-64 with no paravirt anywhere.
Quoted 2 lines
At the risk of going deeper down the rabbit hole, I grepped for
pgd_list. I found:
Ugh.
Quoted 4 lines
__set_pmd_pteinpageattr.c. It appears to be completely incorrect. Unless I've misunderstood, other than the very first line, it will either do nothing at all or crash when it falls off the end of the page tables that it's pointlessly trying to update.
I think you found a rats nest.
I can't make heads nor tails of the logic. The !SHARED_KERNEL_PMD test doesn't seem very sensible, since that's also the conditional for adding anything to the list in the first place.
So I agree that the code doesn't make much sense. Although maybe it's there just because that way the loop goes away at compile-time under most circumstances. So maybe even that part does make sense.
And the "walk down to the pmd level" part actually looks ok. Remember:
this is on x86-32 only, and you have two cases: non-PAE where the pmd/pud offset thing does nothing at all, and it just ends up converting a "pgd_t *" to a "pmd_t *". And for PAE, the top pud level always exists, and the pmd is folded, so despite what looks like walking two levels, it really just walks the one level - the force-allocated PGD entries.
So it won't "fall off the end of the page tables" like you imply. It will just walk to the pmd level. And there it will populate all the page tables with the same pmd.
So I think it works.
Linus
Hello, Frederic.
Quoted 3 lines · Frederic Weisbecker
I fear that enumerating and fix the existing issues won't be enough. We can't find all the code sites out there which rely on not being faulted.
Oh, sure but that can take some time so adding documentation in the mean time probably isn't a bad idea.
Quoted 2 lines
The best would be to fix that from the percpu allocator itself, or vmalloc.
I don't think there's much percpu allocator itself can do. The ability to grow dynamically comes from being able to allocate relatively consistent layout among areas for different CPUs and pretty much requires vmalloc area and it'd generally be a good idea to take out the vmalloc fault anyway.
Thanks.
Signature · 1 line
tejun
Quoted 6 lines · Tejun Heo
I don't think there's much percpu allocator itself can do. The ability to grow dynamically comes from being able to allocate relatively consistent layout among areas for different CPUs and pretty much requires vmalloc area and it'd generally be a good idea to take out the vmalloc fault anyway.
Why do you guys worry so much about the vmalloc fault?
This started because of a very different issue: putting the actual stack in vmalloc space. Then it can cause nasty triple faults etc.
But the normal vmalloc fault? Who cares, really? If that causes problems, they are bugs. Fix them.
Linus
Quoted 8 lines · Linus Torvalds
Quoted 6 lines · Tejun Heo
I don't think there's much percpu allocator itself can do. The ability to grow dynamically comes from being able to allocate relatively consistent layout among areas for different CPUs and pretty much requires vmalloc area and it'd generally be a good idea to take out the vmalloc fault anyway.
Quoted 7 lines
Why do you guys worry so much about the vmalloc fault?
This started because of a very different issue: putting the actual stack in vmalloc space. Then it can cause nasty triple faults etc.
But the normal vmalloc fault? Who cares, really? If that causes problems, they are bugs. Fix them.
Because of this in system_call_after_swapgs:
movq %rsp,PER_CPU_VAR(old_rsp)
movq PER_CPU_VAR(kernel_stack),%rsp
It occurs to me that, if we really want to change that, we could have an array of syscall trampolines, one per CPU, that have the CPU number hardcoded. But I really don't think that's worth it.
Other than that, with your fix, vmalloc faults are no big deal :)
--Andy
Quoted 25 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Thomas Gleixner
Quoted 23 lines · Linus Torvalds
Here's the simplified end result. Again, this is TOTALLY UNTESTED. I compiled it and verified that the code generation looks like what I'd have expected, but that's literally it.
static noinline int vmalloc_fault(unsigned long address) { pgd_t *pgd_dst; pgdval_t pgd_entry; unsigned index = pgd_index(address);if (index < KERNEL_PGD_BOUNDARY) return -1; pgd_entry = init_mm.pgd[index].pgd; if (!pgd_entry) return -1; pgd_dst = __va(PAGE_MASK & read_cr3()); pgd_dst += index; if (pgd_dst->pgd) return -1;
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
ACCESS_ONCE(pgd_dst->pgd) = pgd_entry;This will break paravirt. set_pgd/set_pmd are paravirt functions.
But I'm fine with breaking it, then you just need to change
CONFIG_PARAVIRTto 'def_booln'That is not very nice.
Maybe not nice, but sensible.
Thanks,
tglx
Quoted 25 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Thomas Gleixner
Quoted 23 lines · Linus Torvalds
Here's the simplified end result. Again, this is TOTALLY UNTESTED. I compiled it and verified that the code generation looks like what I'd have expected, but that's literally it.
static noinline int vmalloc_fault(unsigned long address) { pgd_t *pgd_dst; pgdval_t pgd_entry; unsigned index = pgd_index(address);if (index < KERNEL_PGD_BOUNDARY) return -1; pgd_entry = init_mm.pgd[index].pgd; if (!pgd_entry) return -1; pgd_dst = __va(PAGE_MASK & read_cr3()); pgd_dst += index; if (pgd_dst->pgd) return -1;
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
ACCESS_ONCE(pgd_dst->pgd) = pgd_entry;This will break paravirt. set_pgd/set_pmd are paravirt functions.
But I'm fine with breaking it, then you just need to change
CONFIG_PARAVIRTto 'def_booln'That is not very nice.
Maybe not nice, but sensible.
Thanks,
tglx
Quoted 8 lines · Josh Boyer
Quoted 7 lines · Andy Lutomirski
Quoted 6 lines · Josh Boyer
Quoted 5 lines · Andy Lutomirski
Quoted 3 lines · Linus Torvalds
Quoted 1 line · Linus Torvalds
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
So I kind of agree, but it wouldn't be my primary worry. My primary worry is actually paravirt doing something insane.
Btw, on that tangent, does anybody actually care about paravirt any more?
Amazon, for better or for worse.
And distros: Oracle and Novell.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
I'd love to start moving away from it. It makes a lot of the low-level code completely impossible to follow due to the random indirection through "native" vs "paravirt op table". Not just the page table handling, it's all over.
Anybody who seriously does virtualization uses hw virtualization that is much better than it used to be. And the non-serious users aren't that performance-sensitive by definition.
I would point out that the PV paravirt spinlock gives an huge boost for virtualization guests (this is for both KVM and Xen).
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I note that the Fedora kernel config seems to include paravirt by default, so you get a lot of the crazy overheads..
Not that much. We ran benchmarks and it was in i-cache overhead - and the numbers came out to be sub-1% percent.
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
I think that there is a move toward deprecating Xen PV in favor of PVH, but we're not there yet.
A move where? The Xen stuff in Fedora is ... not paid attention to very much. If there's something we should be looking at turning off (or on), we're happy to take suggestions.
A move in the Xen project. As I understand it, Xen wants to deprecate PV in favor of PVH, but PVH is still experimental.
Quoted 7 lines
OK.
Quoted 2 lines
I think that dropping PARAVIRT in Fedora might be a bad idea for several more releases, since that's likely to break the EC2 images.
Yes, that's essentially the only reason we haven't looked at disabling Xen completely for a while now, so <sad trombone>.
Heh. Didn't know you could play on a trombone!
As I had mentioned in the past - if there are Xen related bugs on Fedora please CC me on them. Or perhaps CC [email protected] if that is possible.
And as Andy has mentioned - we are moving towards using PVH as a way to not use the PV MMU ops. But that is still off (<sad trombone played from YouTube>).
Quoted 7 lines
josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 50 lines · Konrad Rzeszutek Wilk
Quoted 8 lines · Josh Boyer
Quoted 7 lines · Andy Lutomirski
Quoted 6 lines · Josh Boyer
Quoted 5 lines · Andy Lutomirski
Quoted 3 lines · Linus Torvalds
Quoted 1 line · Linus Torvalds
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
So I kind of agree, but it wouldn't be my primary worry. My primary worry is actually paravirt doing something insane.
Btw, on that tangent, does anybody actually care about paravirt any more?
Amazon, for better or for worse.
And distros: Oracle and Novell.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
I'd love to start moving away from it. It makes a lot of the low-level code completely impossible to follow due to the random indirection through "native" vs "paravirt op table". Not just the page table handling, it's all over.
Anybody who seriously does virtualization uses hw virtualization that is much better than it used to be. And the non-serious users aren't that performance-sensitive by definition.
I would point out that the PV paravirt spinlock gives an huge boost for virtualization guests (this is for both KVM and Xen).
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I note that the Fedora kernel config seems to include paravirt by default, so you get a lot of the crazy overheads..
Not that much. We ran benchmarks and it was in i-cache overhead - and the numbers came out to be sub-1% percent.
Quoted 13 lines
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
I think that there is a move toward deprecating Xen PV in favor of PVH, but we're not there yet.
A move where? The Xen stuff in Fedora is ... not paid attention to very much. If there's something we should be looking at turning off (or on), we're happy to take suggestions.
A move in the Xen project. As I understand it, Xen wants to deprecate PV in favor of PVH, but PVH is still experimental.
OK.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I think that dropping PARAVIRT in Fedora might be a bad idea for several more releases, since that's likely to break the EC2 images.
Yes, that's essentially the only reason we haven't looked at disabling Xen completely for a while now, so <sad trombone>.
Heh. Didn't know you could play on a trombone!
It's sad because I can't really play the trombone and it sounds horrible.
Quoted 3 lines
As I had mentioned in the past - if there are Xen related bugs on Fedora please CC me on them. Or perhaps CC [email protected] if that is possible.
Indeed, you have been massively helpful. My comment on it being not well paid attention to was a reflection on the distro maintainers, not you. You've been great once we notice the Xen issue, but that takes a while on our part and it isn't the best of user experiences :\.
Quoted 3 lines
And as Andy has mentioned - we are moving towards using PVH as a way to not use the PV MMU ops. But that is still off (<sad trombone played from YouTube>).
OK. I'll try and do better at keeping up with things.
josh
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · Josh Boyer
Quoted 4 lines · Andy Lutomirski
Quoted 3 lines · Josh Boyer
Quoted 2 lines · Andy Lutomirski
On Fri, Nov 21, 2014 at 11:46 AM, Linus Torvalds
<[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines · Linus Torvalds
So I kind of agree, but it wouldn't be my primary worry. My primary worry is actually paravirt doing something insane.
Btw, on that tangent, does anybody actually care about paravirt any more?
Funny, during testing some patches related to Xen I hit the lockup issue. It looked a little bit different, but a variation of your patch solved my problem. The difference to the original report might be due to the rather low system load during my test, so the system was still responsive when the first lockup messages appeared. I could see the hanging cpus were spinning in pmd_lock() called during __handle_mm_fault().
I could reproduce the issue within a few minutes reliably without the patch below. With it the machine survived 12 hours and is still running.
WHY my test would trigger the problem so fast I have no idea. I saw it on a rather huge machine only (128GB memory, 120 cpus), that's quite understandable. My test remapped some pages via the hypervisor and removed those mappings again. Perhaps the TLB flushing involved in these operations is triggering the problem.
arch/x86/mm/fault.c +1 -1
@@ -377,7 +377,7 @@ static noinline int vmalloc_fault(unsigned long address)* happen within a race in page table update. In the later * case just flush: */ - pgd =pgd_offset (current->active_mm, address); + pgd = (pgd_t *)__va (read_cr3 ()) +pgd_index (address); pgd_ref =pgd_offset_k (address);if (pgd_none (*pgd_ref))return -1 ;
Juergen
Hi Dave,
Quoted 37 lines · Dave Jones
Quoted 5 lines · Andy Lutomirski
TIF_NOHZis not the same thing as NOHZ. Can you try a kernel withCONFIG_CONTEXT_TRACKING=n? Doing that may involve fiddling with RCU settings a bit. The normal no HZ idle stuff has nothing to do withTIF_NOHZ, and you either haveTIF_NOHZset or you have some kind ofthread_infocorruption going on here.Disabling
CONTEXT_TRACKINGdidn't change the problem. Unfortunatly the full trace didn't make it over usb-serial this time. Grr.Here's what came over serial..
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [trinity-c35:11634]
CPU: 2 PID: 11634 Comm: trinity-c35 Not tainted 3.18.0-rc5+ #94 [loadavg: 164.79 157.30 155.90 37/409 11893] task: ffff88014e0d96f0 ti: ffff880220eb4000 task.ti: ffff880220eb4000 RIP: 0010:[<ffffffff88379605>] [<ffffffff88379605>] copy_user_enhanced_fast_string+0x5/0x10 RSP: 0018:ffff880220eb7ef0 EFLAGS: 00010283 RAX: ffff880220eb4000 RBX: ffffffff887dac64 RCX: 0000000000006a18 RDX: 000000000000e02f RSI: 00007f766f466620 RDI: ffff88016f6a7617 RBP: ffff880220eb7f78 R08: 8000000000000063 R09: 0000000000000004 R10: 0000000000000010 R11: 0000000000000000 R12: ffffffff880bf50d R13: 0000000000000001 R14: ffff880220eb4000 R15: 0000000000000001 FS: 00007f766f459740(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f766f461000 CR3: 000000018b00e000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffffffff882f4225 ffff880183db5a00 0000000001743440 00007f766f0fb000 fffffffffffffeff 0000000000000000 0000000000008d79 00007f766f45f000 ffffffff8837adae 00ff880220eb7f38 000000003203f1ac 0000000000000001 Call Trace: [<ffffffff882f4225>] ? SyS_add_key+0xd5/0x240 [<ffffffff8837adae>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff887da092>] system_call_fastpath+0x12/0x17 Code: 48 ff c6 48 ff c7 ff c9 75 f2 89 d1 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 31 c0 0f 1f 00 c3 0f 1f 80 00 00 00 00 0f 1f 00 89 d1 <f3> a4 31 c0 0f 1f 00 c3 90 90 90 0f 1f 00 83 fa 08 0f 82 95 00
Quoted 7 lines
sending NMI to other CPUs:
Here's a crappy phonecam pic of the screen.
http://codemonkey.org.uk/junk/IMG_4311.jpg
There's a bit of trace missing between the above and what was on the screen, so we missed some CPUs.
I'm not sure if this is useful, but I've been seeing trinity lockups on arm64 as well. Sometimes they happen a few times a day, sometimes it takes a few days (I just saw my first one on -rc6, for example).
However, I have a little bit more trace than you do and *every single time* the lockup has involved an execve to a virtual file system.
E.g.:
[child1:10700] [212] execve(name="/sys/fs/ext4/features/batched_discard", argv=0x91796a0, envp=0x911a9c0)
(I've seen cases with /proc too)
The child doing the execve then doesn't return an error from the syscall, and instead seems to disappear from the face of the planet, sometimes with the tasklist_lock held for write, which causes a lockup shortly afterwards.
I'm running under KVM with two virtual CPUs. When the machine is wedged, one CPU is sitting in idle and the other seems to be kicking around do_wait and pid_vnr, but it's difficult to really see what's going on.
I tried increasing the likelihood of execve syscalls in trinity, but it didn't seem to help with reproducing this issue.
Will
Quoted 7 lines · Jürgen Groß
Funny, during testing some patches related to Xen I hit the lockup issue. It looked a little bit different, but a variation of your patch solved my problem.
I could reproduce the issue within a few minutes reliably without the patch below. With it the machine survived 12 hours and is still running.
Do you have a backtrace for the failure case? I have no problem applying this part of the patch (I really don't understand why x86-64 hadn't gotten the proper code from 32-bit), but I'd like to see (and document) where the fault happens for this.
Since you can apparently reproduce this fairly easily with a broken kernel, getting a backtrace shouldn't be too hard?
Linus
Quoted 8 lines · Linus Torvalds
I have no ideas left. I'd go for a bisection - rather than try random things, at least bisection will get us a smaller set of suspects if you can go through a few cycles of it. Even if you decide that you want to run for most of a day before you are convinced it's all good, a couple of days should get you a handful of bisection points (that's assuming you hit a couple of bad ones too that turn bad in a shorter while). And 4 or five bisections should get us from 11k commits down to the ~600 commit range. That would be a huge improvement.
There's 8 bisections remaining. The log so far:
git bisect start
# good: [bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9] Linux 3.17
git bisect good bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9
# bad: [f114040e3ea6e07372334ade75d1ee0775c355e1] Linux 3.18-rc1
git bisect bad f114040e3ea6e07372334ade75d1ee0775c355e1
# bad: [f114040e3ea6e07372334ade75d1ee0775c355e1] Linux 3.18-rc1
git bisect bad f114040e3ea6e07372334ade75d1ee0775c355e1
# bad: [35a9ad8af0bb0fa3525e6d0d20e32551d226f38e] Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
git bisect bad 35a9ad8af0bb0fa3525e6d0d20e32551d226f38e
# bad: [35a9ad8af0bb0fa3525e6d0d20e32551d226f38e] Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
git bisect bad 35a9ad8af0bb0fa3525e6d0d20e32551d226f38e
# bad: [683a52a10148e929fb4844f9237f059a47c0b01b] Merge tag 'tty-3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect bad 683a52a10148e929fb4844f9237f059a47c0b01b
# bad: [683a52a10148e929fb4844f9237f059a47c0b01b] Merge tag 'tty-3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect bad 683a52a10148e929fb4844f9237f059a47c0b01b
# bad: [76272ab3f348d303eb31a5a061601ca8e0f9c5ce] staging: rtl8821ae: remove driver
git bisect bad 76272ab3f348d303eb31a5a061601ca8e0f9c5ce
# bad: [e988e1f3f975a9d6013c6356c5b9369540c091f9] staging: comedi: ni_at_a2150: range check board index
git bisect bad e988e1f3f975a9d6013c6356c5b9369540c091f9
# bad: [bd8107b2b2dc9fb1113bfe1a9cf2533ee19c57ee] Staging: bcm: Bcmchar.c: Renamed variable: "RxCntrlMsgBitMask" -> "rx_cntrl_msg_bit_mask" git bisect bad bd8107b2b2dc9fb1113bfe1a9cf2533ee19c57ee
# bad: [91ed283ab563727932d6cf92b74dd15226635870] staging: rtl8188eu: Remove unused function rtw_IOL_append_WD_cmd() git bisect bad 91ed283ab563727932d6cf92b74dd15226635870
The reason I'm checking in at this point, is that I'm starting to see different bugs at this point, so I don't know if I can call this good or bad, unless someone has a fix for what I'm seeing now.
Reminiscent of a bug a couple releases ago. Processes about to exit, but stuck in the kernel continuously faulting..
http://codemonkey.org.uk/junk/weird-hang.txt
The one I'm thinking of got fixed way before 3.17 though.
Does that trace ring a bell of something else I could try on top of each bisection point ?
I rebooted and restarted my test at the current bisection point, hopefully it'll show up as 'bad' before the bug above happens again.
Dave
Quoted 4 lines · Dave Jones
The reason I'm checking in at this point, is that I'm starting to see different bugs at this point, so I don't know if I can call this good or bad, unless someone has a fix for what I'm seeing now.
Hmm. The three last "bad" biisects are all just 3.17-rc1 plus staging fixes.
Quoted 4 lines
Reminiscent of a bug a couple releases ago. Processes about to exit, but stuck in the kernel continuously faulting..
http://codemonkey.org.uk/junk/weird-hang.txt
The one I'm thinking of got fixed way before 3.17 though.
Well, the staging tree was based on that 3.17-rc1 tree, so it may well have the bug without the fix.
You have also marked 3.18-rc1 bad *twice*, along with the network merge, and the tty merge. That's just odd. But it doesn't make the bisect wrong, it just means that you fat-fingered thing and marked the same thing bad a couple of times.
Nothing to worry about, unless it's a sign of early Parkinsons...
Quoted 2 lines
Does that trace ring a bell of something else I could try on top of each bisection point ?
Hmm.
Smells somewhat like the "pipe/page fault oddness" bug you reported.
That one caused endless page faults on fault_in_pages_writeable() because of a page table entry that the VM thought was present, but the CPU thought was missing.
That caused the whole "pte_protnone()" thing, and trying to get rid of the PTE_NUMA bit, but those patches have *not* been merged. And you were ever able to reproduce it., so we left it as pending.
But if you actually really think that the bisect log you posted is real and true and actually is the bug you're chasing, I have bad news for you: do a "gitk --bisect", and you'll see that all the remaining commits are just to staging drivers.
So that would either imply you have some staging driver (unlikely), or more likely that 3.17 really already has the problem, it's just that it needs some particular code alignment or phase of the moon or something to trigger.
Linus
Quoted 6 lines · Linus Torvalds
You have also marked 3.18-rc1 bad *twice*, along with the network merge, and the tty merge. That's just odd. But it doesn't make the bisect wrong, it just means that you fat-fingered thing and marked the same thing bad a couple of times.
Nothing to worry about, unless it's a sign of early Parkinsons...
Intentional on my part, without realizing the first one was recorded. First time, it printed the usual bisect text, but then complained my tree was dirty (which it was). I unapplied the stuff I had, and did the bisect command a 2nd time..
Quoted 7 lines
Quoted 2 lines
Does that trace ring a bell of something else I could try on top of each bisection point ?
Hmm.
Smells somewhat like the "pipe/page fault oddness" bug you reported.
Quoted 7 lines
That one caused endless page faults on
fault_in_pages_writeable()because of a page table entry that the VM thought was present, but the CPU thought was missing.That caused the whole "
pte_protnone()" thing, and trying to get rid of thePTE_NUMAbit, but those patches have *not* been merged. And you were ever able to reproduce it., so we left it as pending.
ah, yeah, now it comes back to me.
Quoted 9 lines
But if you actually really think that the bisect log you posted is real and true and actually is the bug you're chasing, I have bad news for you: do a "gitk --bisect", and you'll see that all the remaining commits are just to staging drivers.
So that would either imply you have some staging driver (unlikely), or more likely that 3.17 really already has the problem, it's just that it needs some particular code alignment or phase of the moon or something to trigger.
Maybe I'll try 3.17 + perf fix for an even longer runtime. Like over thanksgiving or something.
If some of the bisection points so far had been 'good', I would go back and re-check, but every step of the way I've been able to reproduce it.
Dave
Quoted 43 lines · Linus Torvalds
Quoted 4 lines · Dave Jones
The reason I'm checking in at this point, is that I'm starting to see different bugs at this point, so I don't know if I can call this good or bad, unless someone has a fix for what I'm seeing now.
Hmm. The three last "bad" biisects are all just 3.17-rc1 plus staging fixes.
Quoted 4 lines
Reminiscent of a bug a couple releases ago. Processes about to exit, but stuck in the kernel continuously faulting..
http://codemonkey.org.uk/junk/weird-hang.txt
The one I'm thinking of got fixed way before 3.17 though.Well, the staging tree was based on that 3.17-rc1 tree, so it may well have the bug without the fix.
You have also marked 3.18-rc1 bad *twice*, along with the network merge, and the tty merge. That's just odd. But it doesn't make the bisect wrong, it just means that you fat-fingered thing and marked the same thing bad a couple of times.
Nothing to worry about, unless it's a sign of early Parkinsons...
Quoted 2 lines
Does that trace ring a bell of something else I could try on top of each bisection point ?
Hmm.
Smells somewhat like the "pipe/page fault oddness" bug you reported.
That one caused endless page faults on
fault_in_pages_writeable()because of a page table entry that the VM thought was present, but the CPU thought was missing.That caused the whole "
pte_protnone()" thing, and trying to get rid of thePTE_NUMAbit, but those patches have *not* been merged. And you were ever able to reproduce it., so we left it as pending.But if you actually really think that the bisect log you posted is real and true and actually is the bug you're chasing, I have bad news for you: do a "gitk --bisect", and you'll see that all the remaining commits are just to staging drivers.
Quoted 4 lines
So that would either imply you have some staging driver (unlikely), or more likely that 3.17 really already has the problem, it's just that it needs some particular code alignment or phase of the moon or something to trigger.
I COULD trigger it with 3.17. Took much longer, but I've seen it once. And from Xen hypervisor data it was clear it was the same bug (cpu spinning in pmd_lock()).
Juergen
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Jürgen Groß
I COULD trigger it with 3.17. Took much longer, but I've seen it once. And from Xen hypervisor data it was clear it was the same bug (cpu spinning in
pmd_lock()).
Quoted 8 lines
I'm still hoping you can give a back trace. I'd like to know what access it is that can trigger this, and preferably what the call chain to it was...
I do believe it happened in 3.17, I just want to understand the but more - not just apply the fix..
Most of Dave's lockup back traces did not have the whole page fault in them, so while Dave has seen this too, there might be different symptoms...
Before giving 3.17 a multi-day workout, I'll try rc6 with Jürgen's patch to see if that makes any difference at all for me.
Dave
Quoted 10 lines · Linus Torvalds
Quoted 4 lines · On Nov 25, 2014 8:39 PM, "Jürgen Groß" <[email protected]…
I COULD trigger it with 3.17. Took much longer, but I've seen it once. And from Xen hypervisor data it was clear it was the same bug (cpu spinning in
pmd_lock()).I'm still hoping you can give a back trace. I'd like to know what access it is that can trigger this, and preferably what the call chain to it was...
Working on it. Triggering it via sysrq(l) isn't working: machine hung up. I'll try a dump, but this might take some time due to the machine size...
If this isn't working I can always modify the hypervisor to show me more of the kernel stack in that situation. This will be a pure dump, but it should be possible to extract the back trace from that.
Quoted 3 lines
I do believe it happened in 3.17, I just want to understand the but more
- not just apply the fix..
Sure.
Quoted 3 lines
Most of Dave's lockup back traces did not have the whole page fault in them, so while Dave has seen this too, there might be different symptoms...
Stay tuned... :-)
Juergen
Quoted 4 lines · Juergen Gross
Working on it. Triggering it via sysrq(l) isn't working: machine hung up. I'll try a dump, but this might take some time due to the machine size...
Actually, in that patch that did this:
- pgd = pgd_offset(current->active_mm, address);
+ pgd = (pgd_t *)__va(read_cr3()) + pgd_index(address);
make the code do:
pgd = (pgd_t *)__va(read_cr3()) + pgd_index(address);
WARN_ON(pdg != pgd_offset(current->active_mm, address));and now you should get a nice backtrace for exactly when it happens, but it's on a working kernel, so nothing will lock up.
Hmm?
And leave it running for a while, and see if the trace is always the same, or if there are variations on it...
Thanks,
Linus
Quoted 3 lines · Linus Torvalds
And leave it running for a while, and see if the trace is always the same, or if there are variations on it...
Amusing.
Lookie here:
http://lists.xenproject.org/archives/html/xen-changelog/2005-08/msg00310.html
That's from 2005.
Anyway, I don't see why the cr3 issue matters, *unless* there is some situation where the scheduler can run with interrupts enabled. And why this is Xen-related, I have no idea.
The Xen patches seem to have lost that
/* On Xen the line below does not always work. Needs investigating! */
line when backporting the 2.6.29 patches to Xen. And clearly nobody investigated.
So please do get me back-traces, and we'll investigate. Better late than never. But it does sound Xen-specific - although it's possible that Xen just triggers some timing (and has apparently been able to trigger it since 2005) that DaveJ now triggers on his one machine.
So DaveJ, even though this does appear Xen-centric (Xentric?) and you're running on bare hardware, maybe you could do the same thing in that x86-64 vmalloc_fault(). The timing with Jürgen is kind of intriguing - if 3.18-rc made it happen much more often for him, maybe it really is very timing-sensitive, and you actually are seeing a non-Xen version of the same thing...
Linus
Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
And leave it running for a while, and see if the trace is always the same, or if there are variations on it...
Quoted 7 lines
Amusing.
Lookie here:
http://lists.xenproject.org/archives/html/xen-changelog/2005-08/msg00310.htmlThat's from 2005.
:-)
Quoted 9 lines
Anyway, I don't see why the cr3 issue matters, *unless* there is some situation where the scheduler can run with interrupts enabled. And why this is Xen-related, I have no idea.
The Xen patches seem to have lost that
/* On Xen the line below does not always work. Needs investigating! */
Quoted 7 lines
line when backporting the 2.6.29 patches to Xen. And clearly nobody investigated.
So please do get me back-traces, and we'll investigate. Better late than never. But it does sound Xen-specific - although it's possible that Xen just triggers some timing (and has apparently been able to trigger it since 2005) that DaveJ now triggers on his one machine.
Yeah, this sounds plausible.
I'm working on the back traces right now, hope to have them soon.
Juergen
Quoted 10 lines
So DaveJ, even though this does appear Xen-centric (Xentric?) and you're running on bare hardware, maybe you could do the same thing in that x86-64
vmalloc_fault(). The timing with Jürgen is kind of intriguing - if 3.18-rc made it happen much more often for him, maybe it really is very timing-sensitive, and you actually are seeing a non-Xen version of the same thing...Linus
Quoted 30 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
And leave it running for a while, and see if the trace is always the same, or if there are variations on it...
Amusing.
Lookie here:
http://lists.xenproject.org/archives/html/xen-changelog/2005-08/msg00310.htmlThat's from 2005.
Anyway, I don't see why the cr3 issue matters, *unless* there is some situation where the scheduler can run with interrupts enabled. And why this is Xen-related, I have no idea.
The Xen patches seem to have lost that
/* On Xen the line below does not always work. Needs investigating! */
line when backporting the 2.6.29 patches to Xen. And clearly nobody investigated.
So please do get me back-traces, and we'll investigate. Better late than never. But it does sound Xen-specific - although it's possible that Xen just triggers some timing (and has apparently been able to trigger it since 2005) that DaveJ now triggers on his one machine.
Quoted 6 lines
So DaveJ, even though this does appear Xen-centric (Xentric?) and you're running on bare hardware, maybe you could do the same thing in that x86-64
vmalloc_fault(). The timing with Jürgen is kind of intriguing - if 3.18-rc made it happen much more often for him, maybe it really is very timing-sensitive, and you actually are seeing a non-Xen version of the same thing...
Very interesting: I've updated my test-machine yesterday to the newest Xen version after I've got rid of the lockups to avoid another problem I was seeing. With this version I don't get the lockups any more even with the unmodified 3.18-rc kernel.
Digging deeper I found something making me believe I've seen another issue than Dave which just looked similar on the surface. :-(
My Xen problem was related to an error in freeing grant pages (pages mapped in from another domain). One detail in the handling of such mappings is interesting: the "private" member of the page structure is used to hold the machine frame number of the mapped memory page. Another usage of this "private" member is in the pgd handling of Xen (see xen_pgd_alloc() and xen_get_user_pgd()) to hold the pgd of the user address space (kernel and user are in separate address spaces on Xen). So with an error in the grant page handling I could imagine a pgd's private member could be clobbered leading to effects like the one I've observed. And this could have been the problem in 2005, too.
And why is my patch working? I think it's just because cr3 is always written with a page aligned value while the clobbered "private" member of the Xen pgd is not page aligned resulting in a different pointer. I'm still using the wrong page for the user's pgd, but this seems not to lead to fatal errors when nearly nothing is running on the machine. I've seen Xen messages occasionally indicating there was something wrong with the page table handling of the kernel (pages used as page tables not known to Xen as such).
I hope this all makes sense.
And just for the records: with the actual Xen version (tweaked to show the grant page error again) I see different lockups with the following backtrace:
[ 1122.256305] NMI watchdog: BUG: soft lockup - CPU#94 stuck for 23s! [systemd-udevd:1179]
[ 1122.303427] Modules linked in: xen_blkfront msr bridge stp llc iscsi_ibft ipmi_devintf nls_utf8 x86_pkg_temp_thermal intel_powerclamp nls_cp437 coretemp crct10dif_pclmul vfat crc32_pclmul fat crc32c_intel ghash_clmulni_intel snd_pcm aesni_intel aes_x86_64 snd_timer lrw be2iscsi be2net gf128mul libiscsi snd glue_helper joydev vxlan soundcore scsi_transport_iscsi ablk_helper iTCO_wdt ixgbe igb mdio ip6_udp_tunnel iTCO_vendor_support efivars evdev iscsi_boot_sysfs udp_tunnel cryptd dca pcspkr sb_edac e1000e edac_core lpc_ich i2c_i801 ptp mfd_core pps_core shpchp tpm_infineon ipmi_si tpm_tis ipmi_msghandler tpm button xenfs xen_privcmd xen_acpi_processor processor thermal_sys xen_pciback xen_netback xen_blkback xen_gntalloc xen_gntdev xen_evtchn dm_mod efivarfs crc32c_generic btrfs xor raid6_pq hid_generic
[ 1122.303450] usbhid hid sd_mod mgag200 ehci_pci i2c_algo_bit ehci_hcd drm_kms_helper ttm usbcore drm megaraid_sas usb_common sg scsi_mod autofs4
[ 1122.303456] CPU: 94 PID: 1179 Comm: systemd-udevd Tainted: G
L 3.18.0-rc5+ #304
[ 1122.303458] Hardware name: FUJITSU PRIMEQUEST 2800E/SB, BIOS PRIMEQUEST 2000 Series BIOS Version 01.59 07/24/2014
[ 1122.303459] task: ffff881f17b56ce0 ti: ffff881f0fff0000 task.ti: ffff881f0fff0000
[ 1122.303460] RIP: e030:[<ffffffff814fcf5e>] [<ffffffff814fcf5e>] _raw_spin_lock+0x1e/0x30
[ 1122.303462] RSP: e02b:ffff881f0fff3ce8 EFLAGS: 00000282
[ 1122.303463] RAX: 000000000000ba43 RBX: 00003ffffffff000 RCX: 0000000000000190
[ 1122.303464] RDX: 0000000000000190 RSI: 000000190ba43067 RDI: ffffea000157c350
[ 1122.303465] RBP: ffff880000000c70 R08: 0000000000000000 R09: 0000000000000000
[ 1122.303466] R10: 000000000001b688 R11: ffff881fdf24ad80 R12: ffffea0000000000
[ 1122.303466] R13: ffff88006237cc70 R14: 0000000000000000 R15: 00007f70f438e000
[ 1122.303470] FS: 00007f70f5c49880(0000) GS:ffff881f4c5c0000(0000) knlGS:ffff881f4c5c0000
[ 1122.303471] CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1122.303472] CR2: 00007f70f5c68000 CR3: 0000001f111b7000 CR4: 0000000000042660
[ 1122.303473] Stack:
[ 1122.303474] ffffffff81155850 ffff881fdf24ad80 00007f70f438f000 ffff881f138ae5d8
[ 1122.303476] ffff881f08ead400 ffff881f0fff3fd8 0000000000000000 ffff881eff0cbd08
[ 1122.303477] ffff881f18b57d08 ffffea000157c320 ffffea006ccc5ec8 ffff881f0fc00800
[ 1122.303479] Call Trace:
[ 1122.303481] [<ffffffff81155850>] ? copy_page_range+0x460/0xa10
[ 1122.303484] [<ffffffff8105d727>] ? copy_process.part.27+0x13e7/0x1b10
[ 1122.303486] [<ffffffff81435f41>] ? netlink_insert+0x91/0xb0
[ 1122.303488] [<ffffffff813f85c9>] ? release_sock+0x19/0x160
[ 1122.303490] [<ffffffff8105dff8>] ? do_fork+0xc8/0x320
[ 1122.303492] [<ffffffff814fd779>] ? stub_clone+0x69/0x90
[ 1122.303493] [<ffffffff814fd42d>] ? system_call_fastpath+0x16/0x1b
[ 1122.303494] Code: 90 0f b7 17 66 39 d0 75 f6 eb e8 66 90 b8 00 00 01 00 f0 0f c1 07 89 c2 c1 ea 10 66 39 c2 89 d1 75 01 c3 0f b7 07 66 39 d0 74 f7 <f3> 90 0f b7 07 66 39 c8 75 f6 c3 0f 1f 80 00 00 00 00 65 81 04But if my assumptions above are correct this is meaningless, as using an arbitrary memory page as pgd might result in anything...
Juergen
Quoted 6 lines · Linus Torvalds
So DaveJ, even though this does appear Xen-centric (Xentric?) and you're running on bare hardware, maybe you could do the same thing in that x86-64
vmalloc_fault(). The timing with Jürgen is kind of intriguing - if 3.18-rc made it happen much more often for him, maybe it really is very timing-sensitive, and you actually are seeing a non-Xen version of the same thing...
I did try your WARN variant (after fixing the typo)
Woke up to the below trace. Looks like a different issue.
Nnngh.
Dave
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [trinity-c149:24766]
CPU: 2 PID: 24766 Comm: trinity-c149 Not tainted 3.18.0-rc6+ #98 [loadavg: 156.09 150.24 148.56 21/402 26750] task: ffff8802285b96f0 ti: ffff8802260e0000 task.ti: ffff8802260e0000 RIP: 0010:[<ffffffff8104658c>] [<ffffffff8104658c>] kernel_map_pages+0xbc/0x120 RSP: 0018:ffff8802260e3768 EFLAGS: 00000202 RAX: 00000000001407e0 RBX: ffffffff817e0c24 RCX: 0000000000140760 RDX: 0000000000000202 RSI: ffff8800000006b0 RDI: 0000000000000001 RBP: ffff8802260e37c8 R08: 8000000000000063 R09: ffff880000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff880200000001 R13: 0000000000010000 R14: 0000000001b60000 R15: 0000000000000000 FS: 00007fb8ef71d740(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000018b87f0 CR3: 00000002277fe000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 00007f60b71b4000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff880123cd7000 ffff8802260e3768 0000000000000000 0000000000000003 0000000000000000 0000000100000001 0000000000123cd6 0000000000000000 0000000000000000 00000000ade00558 ffff8802445d7638 0000000000000001 Call Trace: [<ffffffff81185ebf>] get_page_from_freelist+0x49f/0xaa0 [<ffffffff810a7431>] ? get_parent_ip+0x11/0x50 [<ffffffff811866ee>] __alloc_pages_nodemask+0x22e/0xb60 [<ffffffff810ad5c5>] ? local_clock+0x25/0x30 [<ffffffff810c6e7c>] ? __lock_acquire.isra.31+0x22c/0x9f0 [<ffffffff813775e0>] ? __radix_tree_preload+0x60/0xf0 [<ffffffff810a7431>] ? get_parent_ip+0x11/0x50 [<ffffffff810c546d>] ? lock_release_holdtime.part.24+0x9d/0x160 [<ffffffff811d093e>] alloc_pages_vma+0xee/0x1b0 [<ffffffff81194f0e>] ? shmem_alloc_page+0x6e/0xc0 [<ffffffff810c6e7c>] ? __lock_acquire.isra.31+0x22c/0x9f0 [<ffffffff81194f0e>] shmem_alloc_page+0x6e/0xc0 [<ffffffff810a7431>] ? get_parent_ip+0x11/0x50 [<ffffffff810a75ab>] ? preempt_count_sub+0x7b/0x100 [<ffffffff8139ac66>] ? __percpu_counter_add+0x86/0xb0 [<ffffffff811b2396>] ? __vm_enough_memory+0x66/0x1c0 [<ffffffff8117cac5>] ? find_get_entry+0x5/0x120 [<ffffffff81300937>] ? cap_vm_enough_memory+0x47/0x50 [<ffffffff81197880>] shmem_getpage_gfp+0x4d0/0x7e0 [<ffffffff81197bd2>] shmem_write_begin+0x42/0x70 [<ffffffff8117c2d4>] generic_perform_write+0xd4/0x1f0 [<ffffffff8117eac2>] __generic_file_write_iter+0x162/0x350 [<ffffffff811f0070>] ? new_sync_read+0xd0/0xd0 [<ffffffff8117ecef>] generic_file_write_iter+0x3f/0xb0 [<ffffffff8117ecb0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffff811f01b8>] do_iter_readv_writev+0x78/0xc0 [<ffffffff811f19e8>] do_readv_writev+0xd8/0x2a0 [<ffffffff8117ecb0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffff8117ecb0>] ? __generic_file_write_iter+0x350/0x350 [<ffffffff810c54b6>] ? lock_release_holdtime.part.24+0xe6/0x160 [<ffffffff810a7431>] ? get_parent_ip+0x11/0x50 [<ffffffff810a75ab>] ? preempt_count_sub+0x7b/0x100 [<ffffffff817df36b>] ? _raw_spin_unlock_irq+0x3b/0x60 [<ffffffff811f1c3c>] vfs_writev+0x3c/0x50 [<ffffffff811f1dac>] SyS_writev+0x5c/0x100 [<ffffffff817e0249>] tracesys_phase2+0xd4/0xd9 Code: 65 48 33 04 25 28 00 00 00 75 75 48 83 c4 50 5b 41 5c 5d c3 0f 1f 00 9c 5a fa 0f 20 e0 48 89 c1 80 e1 7f 0f 22 e1 0f 22 e0 52 9d <eb> cf 66 90 49 bc 00 00 00 00 00 88 ff ff 48 63 f6 49 01 fc 48
sending NMI to other CPUs:
<nothing further on console, accidentally had panic=1 set>
Quoted 2 lines · Dave Jones
Woke up to the below trace. Looks like a different issue.
Yeah, apparently the Xen issue was really just a Xen bug.
Quoted 2 lines
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [trinity-c149:24766]
RIP: 0010:[<ffffffff8104658c>] [<ffffffff8104658c>] kernel_map_pages+0xbc/0x120
Well, this one at least makes some amount of sense. The "Code:" line says it's
1b: 9c pushfq 1c: 5a pop %rdx 1d: fa cli 1e: 0f 20 e0 mov %cr4,%rax 21: 48 89 c1 mov %rax,%rcx 24: 80 e1 7f and $0x7f,%cl 27: 0f 22 e1 mov %rcx,%cr4 2a: 0f 22 e0 mov %rax,%cr4 2d: 52 push %rdx 2e: 9d popfq
2f:* eb cf jmp back <-- trapping instruction
and %rdx is 0x0202 which is actually a valid flags value.
That looks like the code for __native_flush_tlb_global().
Not that interrupt should have been disabled very long.
Quoted 7 lines
Call Trace: [<ffffffff81185ebf>] get_page_from_freelist+0x49f/0xaa0 [<ffffffff811866ee>] __alloc_pages_nodemask+0x22e/0xb60 [<ffffffff811d093e>] alloc_pages_vma+0xee/0x1b0 [<ffffffff81194f0e>] shmem_alloc_page+0x6e/0xc0 [<ffffffff81197880>] shmem_getpage_gfp+0x4d0/0x7e0 [<ffffffff81197bd2>] shmem_write_begin+0x42/0x70
Quoted 8 lines
[<ffffffff8117c2d4>] generic_perform_write+0xd4/0x1f0 [<ffffffff8117eac2>] __generic_file_write_iter+0x162/0x350 [<ffffffff8117ecef>] generic_file_write_iter+0x3f/0xb0 [<ffffffff811f01b8>] do_iter_readv_writev+0x78/0xc0 [<ffffffff811f19e8>] do_readv_writev+0xd8/0x2a0 [<ffffffff811f1c3c>] vfs_writev+0x3c/0x50 [<ffffffff811f1dac>] SyS_writev+0x5c/0x100 [<ffffffff817e0249>] tracesys_phase2+0xd4/0xd9
Hmm. Maybe some oom issue, that we spent a long time before this trying to free pages?
Linus
Quoted 9 lines · Dave Jones
Quoted 4 lines · Linus Torvalds
So that would either imply you have some staging driver (unlikely), or more likely that 3.17 really already has the problem, it's just that it needs some particular code alignment or phase of the moon or something to trigger.
Maybe I'll try 3.17 + perf fix for an even longer runtime. Like over thanksgiving or something.
Dammit, dammit, dammit.
I didn't even have to wait that long.
[19861.135201] NMI watchdog: BUG: soft lockup - CPU#1 stuck for 23s! [trinity-c132:26979] [19861.135652] Modules linked in: snd_seq_dummy 8021q garp stp fuse tun hidp bnep rfcomm af_key llc2 scsi_transport_iscsi nfnetlink can_bcm nfc caif_socket caif af_802154 ieee802154 phonet af_rxrpc bluetooth can_raw can pppoe pppox ppp_ge neric slhc irda crc_ccitt rds rose sctp libcrc32c x25 atm netrom appletalk ipx p8023 psnap p8022 llc ax25 cfg80211 rfkill coretemp hwmon x86_pkg_temp_thermal kvm_intel kvm snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi crc t10dif_pclmul crc32c_intel snd_hda_intel snd_hda_controller snd_hda_codec ghash_clmulni_intel snd_hwdep pcspkr snd_seq snd_seq_device serio_raw usb_debug snd_pcm e1000e snd_timer microcode ptp snd pps_core shpchp soundcore nfsd auth_rpcgs s oid_registry nfs_acl lockd sunrpc [19861.138604] CPU: 1 PID: 26979 Comm: trinity-c132 Not tainted 3.17.0+ #2 [19861.139229] Hardware name: Intel Corporation Shark Bay Client platform/Flathead Creek Crb, BIOS HSWLPTU1.86C.0109.R03.1301282055 01/28/2013 [19861.139897] task: ffff8801ec6716f0 ti: ffff8801b5bf8000 task.ti: ffff8801b5bf8000 [19861.140564] RIP: 0010:[<ffffffff81369585>] [<ffffffff81369585>] copy_user_enhanced_fast_string+0x5/0x10 [19861.141263] RSP: 0018:ffff8801b5bfbcf0 EFLAGS: 00010206 [19861.141974] RAX: ffff8801b5bfbe48 RBX: 0000000000000003 RCX: 0000000000000a1d [19861.142688] RDX: 0000000000001000 RSI: 00007f6f89ef85e3 RDI: ffff8801750445e3 [19861.143416] RBP: ffff8801b5bfbd30 R08: 0000000000000000 R09: 0000000000000001 [19861.144164] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801b5bfbc78 [19861.144909] R13: ffff8801d702ed70 R14: ffffffff810a3d2b R15: ffff8801b5bfbc60 [19861.145668] FS: 00007f6f89eeb740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [19861.146440] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [19861.147218] CR2: 00007f6f89ef3000 CR3: 00000001cddb5000 CR4: 00000000001407e0 [19861.148014] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [19861.148828] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [19861.149640] Stack: [19861.150443] ffffffff8119a4f8 160000007c331000 0000000000001000 160000007c331000 [19861.151283] 0000000000001000 ffff8801b5bfbe58 0000000000000000 ffff8801d702f0a0 [19861.152133] ffff8801b5bfbdc0 ffffffff81170474 ffff8801b5bfbd88 0000000000001000 [19861.152995] Call Trace: [19861.153851] [<ffffffff8119a4f8>] ? iov_iter_copy_from_user_atomic+0x78/0x1c0 [19861.154738] [<ffffffff81170474>] generic_perform_write+0xf4/0x1e0 [19861.155636] [<ffffffff811ff1da>] ? file_update_time+0xaa/0xf0 [19861.156536] [<ffffffff81172ba2>] __generic_file_write_iter+0x162/0x350 [19861.157447] [<ffffffff81172dcf>] generic_file_write_iter+0x3f/0xb0 [19861.158365] [<ffffffff811e17ae>] new_sync_write+0x8e/0xd0 [19861.159287] [<ffffffff811e202a>] vfs_write+0xba/0x1f0 [19861.160214] [<ffffffff811e2e42>] SyS_pwrite64+0x92/0xc0 [19861.161152] [<ffffffff817b62a4>] tracesys+0xdd/0xe2 [19861.162091] Code: 48 ff c6 48 ff c7 ff c9 75 f2 89 d1 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 31 c0 0f 1f 00 c3 0f 1f 80 00 00 00 00 0f 1f 00 89 d1 <f3> a4 31 c0 0f 1f 00 c3 90 90 90 0f 1f 00 83 fa 08 0f 82 95 00 [19861.164217] sending NMI to other CPUs: [19861.165221] NMI backtrace for cpu 2 [19861.166099] CPU: 2 PID: 28083 Comm: trinity-c151 Not tainted 3.17.0+ #2 [19861.167084] Hardware name: Intel Corporation Shark Bay Client platform/Flathead Creek Crb, BIOS HSWLPTU1.86C.0109.R03.1301282055 01/28/2013 [19861.168113] task: ffff8800746116f0 ti: ffff8801c6894000 task.ti: ffff8801c6894000 [19861.169152] RIP: 0010:[<ffffffff810fb326>] [<ffffffff810fb326>] smp_call_function_many+0x276/0x320 [19861.170223] RSP: 0000:ffff8801c6897b00 EFLAGS: 00000202 [19861.171295] RAX: 0000000000000001 RBX: ffff8802445d4c40 RCX: ffff8802443da408 [19861.172384] RDX: 0000000000000001 RSI: 0000000000000008 RDI: 0000000000000000 [19861.173483] RBP: ffff8801c6897b40 R08: ffff880242469ce0 R09: 0000000100180011 [19861.174590] R10: ffff880243c04240 R11: 0000000000000000 R12: 0000000000000001 [19861.175703] R13: 0000000000000000 R14: 0000000000000008 R15: 0000000000000008 [19861.176822] FS: 00007f6f89eeb740(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 [19861.177956] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [19861.179103] CR2: 0000000002400000 CR3: 0000000231685000 CR4: 00000000001407e0 [19861.180264] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [19861.181428] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [19861.182595] Stack: [19861.183764] ffff88024d64dd00 000000014d64dd00 00000000001d4c00 ffffffff82be41a0 [19861.184969] 0000000000000002 ffffffff8117a700 0000000000000000 0000000000000001 [19861.186167] ffff8801c6897b78 ffffffff810fb542 0000000000000003 0000000000000008 [19861.187355] Call Trace: [19861.188538] [<ffffffff8117a700>] ? drain_pages+0xc0/0xc0 [19861.189709] [<ffffffff810fb542>] on_each_cpu_mask+0x42/0xc0 [19861.190853] [<ffffffff811768b1>] drain_all_pages+0x101/0x120 [19861.191989] [<ffffffff8117af40>] __alloc_pages_nodemask+0x7d0/0xb20 [19861.193130] [<ffffffff811c2b11>] alloc_pages_vma+0xf1/0x1b0 [19861.194258] [<ffffffff811d705c>] ? do_huge_pmd_anonymous_page+0x10c/0x3e0 [19861.195367] [<ffffffff811d705c>] do_huge_pmd_anonymous_page+0x10c/0x3e0 [19861.196450] [<ffffffff811a10dc>] handle_mm_fault+0x14c/0xe90 [19861.197509] [<ffffffff81041940>] ? __do_page_fault+0x140/0x600 [19861.198540] [<ffffffff810419a4>] __do_page_fault+0x1a4/0x600 [19861.199550] [<ffffffff810a3bcd>] ? get_parent_ip+0xd/0x50 [19861.200539] [<ffffffff810a3d2b>] ? preempt_count_sub+0x6b/0xf0 [19861.201514] [<ffffffff810c0b6e>] ? put_lock_stats.isra.23+0xe/0x30 [19861.202467] [<ffffffff8136ad3d>] ? trace_hardirqs_off_thunk+0x3a/0x3c [19861.203407] [<ffffffff81041e0c>] do_page_fault+0xc/0x10 [19861.204331] [<ffffffff817b7d72>] page_fault+0x22/0x30 [19861.205249] Code: 00 41 89 c4 39 f0 0f 8d 25 fe ff ff 48 63 d0 48 8b 0b 48 03 0c d5 a0 b9 d1 81 f6 41 18 01 74 14 0f 1f 44 00 00 f3 90 f6 41 18 01 <75> f8 48 63 35 45 3b c2 00 83 f8 ff 48 8b 7b 08 74 b0 39 c6 77 [19861.207272] NMI backtrace for cpu 0 [19861.207376] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 42.050 msecs [19861.209220] CPU: 0 PID: 28128 Comm: trinity-c242 Not tainted 3.17.0+ #2 [19861.210200] Hardware name: Intel Corporation Shark Bay Client platform/Flathead Creek Crb, BIOS HSWLPTU1.86C.0109.R03.1301282055 01/28/2013 [19861.211210] task: ffff8802168716f0 ti: ffff88007467c000 task.ti: ffff88007467c000 [19861.212215] RIP: 0010:[<ffffffff810c26ea>] [<ffffffff810c26ea>] __lock_acquire.isra.31+0xfa/0x9f0 [19861.213248] RSP: 0000:ffff880244003cb0 EFLAGS: 00000046 [19861.214281] RAX: 0000000000000046 RBX: ffff8802168716f0 RCX: 0000000000000000 [19861.215318] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88023fcbbc40 [19861.216346] RBP: ffff880244003d18 R08: 0000000000000001 R09: 0000000000000000 [19861.217378] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001 [19861.218399] R13: 0000000000000000 R14: ffff88023fcbbc40 R15: 0000000000000000 [19861.219410] FS: 00007f6f89eeb740(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 [19861.220425] CS: 0010 DS: 0000 ES: 0[19861.273167] NMI backtrace for cpu 3 [19861.273315] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 107.946 msecs [19861.274821] CPU: 3 PID: 27913 Comm: trinity-c37 Not tainted 3.17.0+ #2 [19861.275672] Hardware name: Intel Corporation Shark Bay Client platform/Flathead Creek Crb, BIOS HSWLPTU1.86C.0109.R03.1301282055 01/28/2013 [19861.276543] task: ffff88009a735bc0 ti: ffff8801eda8c000 task.ti: ffff8801eda8c000 [19861.277422] RIP: 0010:[<ffffffff810fb322>] [<ffffffff810fb322>] smp_call_function_many+0x272/0x320 [19861.278339] RSP: 0000:ffff8801eda8fb00 EFLAGS: 00000202 [19861.279220] RAX: 0000000000000001 RBX: ffff8802447d4c40 RCX: ffff8802443da428 [19861.280115] RDX: 0000000000000001 RSI: 0000000000000008 RDI: 0000000000000000 [19861.281021] RBP: ffff8801eda8fb40 R08: ffff880242469a40 R09: 0000000100180011 [19861.281917] R10: ffff880243c04240 R11: 0000000000000000 R12: 0000000000000001 [19861.282813] R13: 0000000000000000 R14: 0000000000000008 R15: 0000000000000008 [19861.283690] FS: 00007f6f89eeb740(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 [19861.284570] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [19861.285466] CR2: 0000000002400000 CR3: 00000001cdd92000 CR4: 00000000001407e0 [19861.286363] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [19861.287255] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [19861.288142] Stack: [19861.289024] ffff88024d64dd00 000000014d64dd00 00000000001d4c00 ffffffff82be41a0 [19861.289934] 0000000000000003 ffffffff8117a700 0000000000000000 0000000000000001 [19861.290845] ffff8801eda8fb78 ffffffff810fb542 0000000000000003 0000000000000008 [19861.291763] Call Trace: [19861.292664] [<ffffffff8117a700>] ? drain_pages+0xc0/0xc0 [19861.293582] [<ffffffff810fb542>] on_each_cpu_mask+0x42/0xc0 [19861.294501] [<ffffffff811768b1>] drain_all_pages+0x101/0x120 [19861.295439] [<ffffffff8117af40>] __alloc_pages_nodemask+0x7d0/0xb20 [19861.296369] [<ffffffff811c2b11>] alloc_pages_vma+0xf1/0x1b0 [19861.297292] [<ffffffff811d705c>] ? do_huge_pmd_anonymous_page+0x10c/0x3e0 [19861.298218] [<ffffffff811d705c>] do_huge_pmd_anonymous_page+0x10c/0x3e0 [19861.299146] [<ffffffff811a10dc>] handle_mm_fault+0x14c/0xe90 [19861.300078] [<ffffffff81041940>] ? __do_page_fault+0x140/0x600 [19861.301011] [<ffffffff810419a4>] __do_page_fault+0x1a4/0x600 [19861.301946] [<ffffffff810a3bcd>] ? get_parent_ip+0xd/0x50 [19861.302874] [<ffffffff810a3d2b>] ? preempt_count_sub+0x6b/0xf0 [19861.303805] [<ffffffff810c0b6e>] ? put_lock_stats.isra.23+0xe/0x30 [19861.304736] [<ffffffff8136ad3d>] ? trace_hardirqs_off_thunk+0x3a/0x3c [19861.305665] [<ffffffff81041e0c>] do_page_fault+0xc/0x10 [19861.306590] [<ffffffff817b7d72>] page_fault+0x22/0x30 [19861.307527] Code: 35 78 3b c2 00 41 89 c4 39 f0 0f 8d 25 fe ff ff 48 63 d0 48 8b 0b 48 03 0c d5 a0 b9 d1 81 f6 41 18 01 74 14 0f 1f 44 00 00 f3 90 <f6> 41 18 01 75 f8 48 63 35 45 3b c2 00 83 f8 ff 48 8b 7b 08 74 [19861.309600] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 144.376 msecs
So 3.17 also has this problem.
Good news I guess in that it's not a regression, but damn I really didn't want to have to go digging through the mists of time to find the last 'good' point. At least it shouldn't hold up 3.18
I'll do a couple builds to run over the holidays, but next week I think I'm going to need to approach this differently to add more debugging somewhere/somehow.
Dave
Quoted 5 lines · Dave Jones
So 3.17 also has this problem.
Good news I guess in that it's not a regression, but damn I really didn't want to have to go digging through the mists of time to find the last 'good' point. At least it shouldn't hold up 3.18
Ugh. That still doesn't make me very happy.
I'll try to think about this more.
Linus
Quoted 4 lines · Dave Jones
So 3.17 also has this problem.
Good news I guess in that it's not a regression, but damn I really didn't want to have to go digging through the mists of time to find the last 'good' point.
So I'm looking at the watchdog code, and it seems racy wrt parking and startup.
In particular, it sets the high priority *after* starting the hrtimer, and it goes back to SCHED_NORMAL *before* canceling the timer.
Which seems completely ass-backwards. And the smp_hotplug_thread stuff explicitly enables preemption around the setup/cleanup/part/unpark operations.
However, that would be an issue only if trinity might be doing things that enable and disable the watchdog. And doing so under insane loads. Even then it seems unlikely.
The insane loads you have. But even then, could a load average of 169 possibly delay running a non-RT process for 22 seconds? Doubtful.
But just in case: do you do cpu hotplug events (that will disable and re-enable the watchdog process?). Anything else that will part/unpark the hotplug thread?
Quite frankly, I'm just grasping for straws here, but a lot of the watchdog traces really have seemed spurious...
Linus
Quoted 19 lines · Linus Torvalds
Quoted 4 lines · Dave Jones
So 3.17 also has this problem.
Good news I guess in that it's not a regression, but damn I really didn't want to have to go digging through the mists of time to find the last 'good' point.So I'm looking at the watchdog code, and it seems racy wrt parking and startup.
In particular, it sets the high priority *after* starting the hrtimer, and it goes back to
SCHED_NORMAL*before* canceling the timer.Which seems completely ass-backwards. And the
smp_hotplug_threadstuff explicitly enables preemption around the setup/cleanup/part/unpark operations.However, that would be an issue only if trinity might be doing things that enable and disable the watchdog. And doing so under insane loads. Even then it seems unlikely.
Quoted 6 lines
The insane loads you have. But even then, could a load average of 169 possibly delay running a non-RT process for 22 seconds? Doubtful.
But just in case: do you do cpu hotplug events (that will disable and re-enable the watchdog process?). Anything else that will part/unpark the hotplug thread?
That's root-only iirc, and I'm not running trinity as root, so that shouldn't be happening. There's also no sign of such behaviour in dmesg when the problem occurs.
Quoted 2 lines
Quite frankly, I'm just grasping for straws here, but a lot of the watchdog traces really have seemed spurious...
Agreed.
Currently leaving 3.16 running. 21hrs so far.
Dave
Quoted 3 lines · On Thu, 27 Nov 2014 17:56:37 -0500 Dave Jones <[email protected]> wrote:
Agreed.
Currently leaving 3.16 running. 21hrs so far.
Dave, I think I reported this bug in this bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=85941
Just posting in case the call trace helps...
In my case it happens when I watch a video on Youtube or play a
audio file...
Signature · 4 lines
Linux 3.16.0-00115-g19583ca: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 2 lines · Dâniel Fraga
Dave, I think I reported this bug in this bug report:
Yours looks very different. Dave (and Sasha Levin) have reported rcy_preempt stalls too, but it's not clear it's the same issue.
In case yours is repeatable (you seem to say it is), can you try it without TREE_PREEMPT_RCU?
Linus
Quoted 5 lines · On Sun, 30 Nov 2014 12:45:31 -0800 Linus Torvalds…
Yours looks very different. Dave (and Sasha Levin) have reported
rcy_preemptstalls too, but it's not clear it's the same issue.In case yours is repeatable (you seem to say it is), can you try it without
TREE_PREEMPT_RCU?
Yes, but "menuconfig" doesn't allow me to disable it (it's
always checked). Newbie question: does TREE_PREEMPT_RCU depends on any other option? Thanks.
Signature · 4 lines
Linux 3.16.0-00115-g19583ca: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 4 lines · Dâniel Fraga
Yes, but "menuconfig" doesn't allow me to disable it (it's
always checked). Newbie question: doesTREE_PREEMPT_RCUdepends on any other option? Thanks.
Maybe you'll have to turn off RCU_CPU_STALL_VERBOSE first.
Although I think you should be able to just edit the .config file, delete the like that says
CONFIG_TREE_PREEMPT_RCU=y
and then just do a "make oldconfig", and then verify that TREE_PREEMPT_RCU hasn't been re-enabled by some dependency. But it shouldn't have, and that "make oldconfig" should get rid of anything that depends on TREE_PREEMPT_RCU.
Linus
Quoted 11 lines · On Sun, 30 Nov 2014 16:21:19 -0800 Linus Torvalds…
Maybe you'll have to turn off
RCU_CPU_STALL_VERBOSEfirst.Although I think you should be able to just edit the .config file, delete the like that says
CONFIG_TREE_PREEMPT_RCU=yand then just do a "make oldconfig", and then verify that
TREE_PREEMPT_RCUhasn't been re-enabled by some dependency. But it shouldn't have, and that "make oldconfig" should get rid of anything that depends onTREE_PREEMPT_RCU.
Ok, I did exactly that, but CONFIG_TREE_PREEMPT_RCU is
re-enabled. I talked with Pranith Kumar and he suggested I could just disable preemption (No Forced Preemption (Server)) and that's the only way to disable CONFIG_TREE_PREEMPT_RCU.
Now I'll try to make the system freeze, then I'll send
you the Call trace.
Thanks.
Signature · 4 lines
Linux 3.17.0: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 6 lines · Will Deacon
I'm not sure if this is useful, but I've been seeing trinity lockups on arm64 as well. Sometimes they happen a few times a day, sometimes it takes a few days (I just saw my first one on -rc6, for example).
However, I have a little bit more trace than you do and *every single time* the lockup has involved an execve to a virtual file system.
Ok, just hit another one of these and I have a little bit more info this time. The trinity log is:
[child1:27912] [438] execve(name="/proc/602/task/602/oom_score", argv=0x3a8426c0, envp=0x3a7a3bb0) = 0 # wtf
[child0:27837] [1081] setfsuid(uid=-128) = 0x3fffb000
[child0:27837] [1082] shmdt(shmaddr=0x7f92269000) = -1 (Invalid argument)
[child0:27837] [1083] fchmod(fd=676, mode=5237) = -1 (Operation not permitted)
[child0:27837] [1084] setuid(uid=0xffffe000) = -1 (Operation not permitted)
[child0:27837] [1085] newfstatat(dfd=676, filename="/proc/612/fdinfo/390", statbuf=0x7f935d8000, flag=0x0) = -1 (Permission denied) [child0:27837] [1086] process_vm_readv(pid=0, lvec=0x3a7a3d70, liovcnt=47, rvec=0x3a7a4070, riovcnt=74, flags=0x0) = -1 (No such process) [child0:27837] [1087] clock_gettime(which_clock=0x890000000000003f, tp=0x0) = -1 (Invalid argument)
[child0:27837] [1088] accept(fd=676, upeer_sockaddr=0x3a842360, upeer_addrlen=16) = -1 (Socket operation on non-socket) [child0:27837] [1089] getpid() = 0x6cbd
[child0:27837] [1090] getpeername(fd=496, usockaddr=0x3a842310, usockaddr_len=16) = -1 (Socket operation on non-socket) [child0:27837] [1091] timer_getoverrun(timer_id=0x4ff8e1) = -1 (Invalid argument)
[child0:27837] [1092] sigaltstack(uss=0x7f93069000, uoss=0x0, regs=0x0) = -1 (Invalid argument)
[child0:27837] [1093] io_cancel(ctx_id=-3, iocb=0x0, result=0xffffffc000080000) = -1 (Bad address)
[child0:27837] [1094] mknodat(dfd=496, filename="/proc/irq/84/affinity_hint", mode=0xa2c03013110804a0, dev=0xfbac6adf1379fada) = -1 (File exists) [child0:27837] [1095] clock_nanosleep(which_clock=0x2, flags=0x1, rqtp=0x0, rmtp=0xffffffc000080000) = -1 (Bad address) [child0:27837] [1096] reboot(magic1=-52, magic2=0xffffff1edbdf7fff, cmd=0xffb5179bfafbfbff, arg=0x0) = -1 (Operation not permitted) [child0:27837] [1097] sched_yield() = 0
[child0:27837] [1098] getpid() = 0x6cbd
[child0:27837] [1099] newuname(name=0x400008200405) = -1 (Bad address)
[child0:27837] [1100] vmsplice(fd=384, iov=0x3a88fc20, nr_segs=687, flags=0x2) = -1 (Resource temporarily unavailable) [child0:27837] [1101] timerfd_gettime(ufd=496, otmr=0x1) = -1 (Invalid argument)
[child0:27837] [1102] getcwd(buf=0x0, size=111) = -1 (Bad address)
[child0:27837] [1103] setdomainname(name=0x0, len=0) = -1 (Operation not permitted)
[child0:27837] [1104] sched_getparam(pid=0, param=0xbaedc7bf7ffaf2fe) = -1 (Bad address)
[child0:27837] [1105] readlinkat(dfd=496, pathname="/proc/4/task/4/net/netstat", buf=0x7f935d4000, bufsiz=0) = -1 (Invalid argument) [child0:27837] [1106] shmctl(shmid=0xa1000000000000ff, cmd=0x7dad54836e49ff1d, buf=0x900000000000002c) = -1 (Invalid argument) [child0:27837] [1107] getpgid(pid=0) = 0x6cbd
[child0:27837] [1108] flistxattr(fd=496, list=0xffffffffffffffdf, size=0xe7ff) = 0
[child0:27837] [1109] remap_file_pages(start=0x7f9324b000, size=0xfffffffffffaaead, prot=0, pgoff=0, flags=0x0) = -1 (Invalid argument) [child0:27837] [1110] io_submit(ctx_id=0xffbf, nr=0xffbef, iocbpp=0x8) = -1 (Invalid argument)
[child0:27837] [1111] flistxattr(fd=384, list=0x0, size=0) = 0
[child0:27837] [1112] semtimedop(semid=0xffffffffefffffff, tsops=0x0, nsops=0xfffffffff71a7113, timeout=0xffffffa9) = -1 (Invalid argument) [child0:27837] [1113] ioctl(fd=384, cmd=0x5100000080000000, arg=362) = -1 (Inappropriate ioctl for device)
[child0:27837] [1114] futex(uaddr=0x0, op=0xb, val=0x80000000000000de, utime=0x8, uaddr2=0x0, val3=0xffffffff00000fff) = -1 (Bad address) [child0:27837] [1115] listxattr(pathname="/proc/219/net/softnet_stat", list=0x0, size=152) = 0
[child0:27837] [1116] getrusage(who=0xffffffffff080808, ru=0xffffffc000080000) = -1 (Invalid argument)
[child0:27837] [1117] clock_settime(which_clock=0xffffffff7fffffff, tp=0x0) = -1 (Invalid argument)
[child0:27837] [1118] mremap(addr=0x6680000000, old_len=0, new_len=8192, flags=0x2, new_addr=0x5080400000) = -1 (Invalid argument) [child0:27837] [1119] waitid(which=0x80000702c966254, upid=0, infop=0x7f90069000, options=-166, ru=0x7f90069004) = -1 (Invalid argument) [child0:27837] [1120] sigaltstack(uss=0x40000000bd5fff6f, uoss=0x8000000000000000, regs=0x0) = -1 (Bad address) [child0:27837] [1121] timer_delete(timer_id=0x4300d68e28803329) = -1 (Invalid argument)
[child0:27837] [1122] preadv(fd=384, vec=0x3a88fc20, vlen=173, pos_l=0x82000000ff804000, pos_h=96) = -1 (Invalid argument) [child0:27837] [1123] getdents64(fd=384, dirent=0x7f90a69000, count=0x2ab672e3) = -1 (Not a directory)
[child0:27837] [1124] mlock(addr=0x7f92e69000, len=0x1e0000)
so for some bizarre reason, child1 (27912) managed to execve oom_score from /proc. mlock then hangs waiting for a completion in flush_work, although I'm not sure how the execve is responsible for that.
Looking at the task trace:
SysRq : Show State
task PC stack pid father
[...]
deferwq S ffffffc0000855b0 0 599 2 0x00000000
Call trace: [<ffffffc0000855b0>] __switch_to+0x74/0x8c [<ffffffc000534214>] __schedule+0x214/0x680 [<ffffffc0005346a4>] schedule+0x24/0x74 [<ffffffc0000c5780>] rescuer_thread+0x200/0x29c [<ffffffc0000ca404>] kthread+0xd8/0xf0 sh S ffffffc0000855b0 0 602 1 0x00000000 Call trace: [<ffffffc0000855b0>] __switch_to+0x74/0x8c [<ffffffc000534214>] __schedule+0x214/0x680 [<ffffffc0005346a4>] schedule+0x24/0x74 [<ffffffc0000b1f94>] do_wait+0x1c4/0x1fc [<ffffffc0000b306c>] SyS_wait4+0x74/0xf0 trinity S ffffffc0000855b0 0 610 602 0x00000000 Call trace: [<ffffffc0000855b0>] __switch_to+0x74/0x8c [<ffffffc000534214>] __schedule+0x214/0x680 [<ffffffc0005346a4>] schedule+0x24/0x74 [<ffffffc0000b1f94>] do_wait+0x1c4/0x1fc [<ffffffc0000b306c>] SyS_wait4+0x74/0xf0 trinity-watchdo R running task 0 611 610 0x00000000 Call trace: [<ffffffc0000855b0>] __switch_to+0x74/0x8c [<ffffffc000534214>] __schedule+0x214/0x680 [<ffffffc0005346a4>] schedule+0x24/0x74 [<ffffffc0005373a0>] do_nanosleep+0xcc/0x134 [<ffffffc0000f9da4>] hrtimer_nanosleep+0x88/0x108 [<ffffffc0000f9eb0>] SyS_nanosleep+0x8c/0xa4 trinity-main S ffffffc0000855b0 0 612 610 0x00000000 Call trace: [<ffffffc0000855b0>] __switch_to+0x74/0x8c [<ffffffc000534214>] __schedule+0x214/0x680 [<ffffffc0005346a4>] schedule+0x24/0x74 [<ffffffc0000b1f94>] do_wait+0x1c4/0x1fc [<ffffffc0000b306c>] SyS_wait4+0x74/0xf0 trinity-c0 D ffffffc0000855b0 0 27837 612 0x00000000 Call trace: [<ffffffc0000855b0>] __switch_to+0x74/0x8c [<ffffffc000534214>] __schedule+0x214/0x680 [<ffffffc0005346a4>] schedule+0x24/0x74 [<ffffffc000537204>] schedule_timeout+0x134/0x18c [<ffffffc000535364>] wait_for_common+0x9c/0x144 [<ffffffc00053541c>] wait_for_completion+0x10/0x1c [<ffffffc0000c4cdc>] flush_work+0xbc/0x168 [<ffffffc00013f608>] lru_add_drain_all+0x12c/0x180 [<ffffffc00015cb78>] SyS_mlock+0x20/0x118 trinity-c1 R running task 0 27912 612 0x00000000 Call trace: [<ffffffc0000855b0>] __switch_to+0x74/0x8c trinity-c1 R running task 0 27921 27912 0x00000000 Call trace:
We can see the child that did the execve has somehow gained its own child process (27921) that we're unable to backtrace. I can't see any clone/fork syscalls in the log for 27912.
At this point, both of the CPUs are sitting in idle, so there's nothing interesting in their register dumps.
Still confused.
Will
Quoted 23 lines · Dave Jones
Quoted 22 lines · Linus Torvalds
Quoted 4 lines · Dave Jones
So 3.17 also has this problem.
Good news I guess in that it's not a regression, but damn I really didn't want to have to go digging through the mists of time to find the last 'good' point.So I'm looking at the watchdog code, and it seems racy wrt parking and startup.
In particular, it sets the high priority *after* starting the hrtimer, and it goes back to
SCHED_NORMAL*before* canceling the timer.Which seems completely ass-backwards. And the
smp_hotplug_threadstuff explicitly enables preemption around the setup/cleanup/part/unpark operations.However, that would be an issue only if trinity might be doing things that enable and disable the watchdog. And doing so under insane loads. Even then it seems unlikely.
The insane loads you have. But even then, could a load average of 169 possibly delay running a non-RT process for 22 seconds? Doubtful.
Quoted 7 lines
Quoted 3 lines
But just in case: do you do cpu hotplug events (that will disable and re-enable the watchdog process?). Anything else that will part/unpark the hotplug thread?
That's root-only iirc, and I'm not running trinity as root, so that shouldn't be happening. There's also no sign of such behaviour in dmesg when the problem occurs.
Yeah, the watchdog code is very chatty during thread 'unparking'. If Dave's dmesg log isn't seeing any:
"enabled on all CPUs, permanently consumes one hw-PMU counter"
except on boot, then I believe the park/unpark race you see shouldn't be occuring in this scenario.
Quoted 5 lines
Quoted 3 lines
Quite frankly, I'm just grasping for straws here, but a lot of the watchdog traces really have seemed spurious...
Agreed.
Well we can explore this route..
I added a patch below that just logs the watchdog timer function and kernel thread for each cpu. It's a little chatty but every 4 seconds you will see something like this in the logs:
[ 2507.580184] 1: watchdog process kicked (reset) [ 2507.581154] 0: watchdog process kicked (reset) [ 2507.581172] 0: watchdog run [ 2507.593469] 1: watchdog run [ 2507.595106] 2: watchdog process kicked (reset) [ 2507.595120] 2: watchdog run [ 2507.608136] 3: watchdog process kicked (reset) [ 2507.613204] 3: watchdog run
With the printk timestamps it would be interesting to see what the watchdog was doing in its final moments and if the timestamps verify the exceeded duration or if the watchdog screws up the calculation and falsely reports a lockup.
Cheers,
Don
kernel/watchdog.c +3 -0
@@ -324,6 +324,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)hrtimer_forward_now (hrtimer,ns_to_ktime (sample_period));if (touch_ts ==0 ) { +printk ("%d: watchdog process kicked (reset)\n" ,smp_processor_id ());if (unlikely (__this_cpu_read (softlockup_touch_sync))) {/* * If the time stamp was touched atomically
@@ -346,6 +347,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)* this is a good indication some task is hogging the cpu */ duration =is_softlockup (touch_ts); +printk ("%d: watchdog process kicked (%d seconds since last)\n" ,smp_processor_id (), duration);if (unlikely (duration)) {/* * If a virtual machine is stopped by the host it can look to
@@ -477,6 +479,7 @@ static void watchdog(unsigned int cpu)__this_cpu_write (soft_lockup_hrtimer_cnt,__this_cpu_read (hrtimer_interrupts));__touch_watchdog (); +printk ("%d: watchdog run\n" , cpu); }#ifdef CONFIG_HARDLOCKUP_DETECTOR
Quoted 3 lines · Will Deacon
so for some bizarre reason, child1 (27912) managed to execve
oom_scorefrom /proc.
That sounds like you have a binfmt that accepts crap. Possibly ARM-specific, although more likely it's just a misc script.
Quoted 3 lines
We can see the child that did the execve has somehow gained its own child process (27921) that we're unable to backtrace. I can't see any clone/fork syscalls in the log for 27912.
Well, it wouldn't be trinity any more, it would likely be some execve script (think "/bin/sh", except likely through binfmt_misc).
Do you have anything in /proc/sys/fs/binfmt_misc? I don't see anything else that would trigger it.
This doesn't really look anything like DaveJ's issue, but who knows..
Linus
Quoted 11 lines · Linus Torvalds
Quoted 2 lines · Will Deacon
so for some bizarre reason, child1 (27912) managed to execve
oom_scorefrom /proc.That sounds like you have a binfmt that accepts crap. Possibly ARM-specific, although more likely it's just a misc script.
Quoted 3 lines
We can see the child that did the execve has somehow gained its own child process (27921) that we're unable to backtrace. I can't see any clone/fork syscalls in the log for 27912.
Quoted 5 lines
Well, it wouldn't be trinity any more, it would likely be some execve script (think "
/bin/sh", except likely throughbinfmt_misc).Do you have anything in
/proc/sys/fs/binfmt_misc? I don't see anything else that would trigger it.
So I don't even have binfmt-misc compiled in. The two handlers I have are BINFMT_ELF and BINFMT_SCRIPT, but they both check for headers that we won't get back from oom_score afaict.
Quoted 1 line
This doesn't really look anything like DaveJ's issue, but who knows..
It's the only lockup I'm seeing on arm64 with trinity, but I agree that it's not very helpful.
Will
Quoted 4 lines · Will Deacon
So I don't even have binfmt-misc compiled in. The two handlers I have are
BINFMT_ELFandBINFMT_SCRIPT, but they both check for headers that we won't get back fromoom_scoreafaict.
Hmm. So I can't even get that "oom_score" file to be executable in the first place, which should mean that execve() should terminate very quickly with an EACCES error.
The fact that you have a "flush_work()" that is waiting for completion is interesting. Maybe the odd new thread is a worker thread for some modprobe or similar, and we . There's that whole
request_module("binfmt-%04x", *(ushort *)(bprm->buf + 2))
which ends up creating a new work. Maybe the flush_work() is waiting for that whole mess. Adding Tejun to the cc, since there *were* changes to workqueues etc since 3.16..
Tejun, full thread on lkml, I'm assuming you can find it in your mail archives..
Linus
Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Will Deacon
So I don't even have binfmt-misc compiled in. The two handlers I have are
BINFMT_ELFandBINFMT_SCRIPT, but they both check for headers that we won't get back fromoom_scoreafaict.Hmm. So I can't even get that "
oom_score" file to be executable in the first place, which should mean thatexecve()should terminate very quickly with an EACCES error.
No idea about oom_score, but kernel happily accepts chmod on any file under /proc/PID/net/. It caused issues before[1].
Why do we allow this?
I've asked before, but no answer so far.
[1] https://lkml.org/lkml/2014/8/2/103
Signature · 1 line
Kirill A. Shutemov
Quoted 3 lines · Kirill A. Shutemov
No idea about
oom_score, but kernel happily accepts chmod on any file under/proc/PID/net/.
/proc used to accept that fairly widely, but no, we tightened things down, and core /proc files end up not accepting chmod. See 'proc_setattr()':
if (attr->ia_valid & ATTR_MODE)
return -EPERM;although particular /proc files could choose to not use 'proc_setattr' if they want to.
The '/proc/pid/net' subtree is obviously not doing that. No idea why, and probably for no good reason.
Linus
Quoted 15 lines · Dâniel Fraga
Quoted 11 lines · On Sun, 30 Nov 2014 16:21:19 -0800 Linus Torvalds…
Maybe you'll have to turn off
RCU_CPU_STALL_VERBOSEfirst.Although I think you should be able to just edit the .config file, delete the like that says
CONFIG_TREE_PREEMPT_RCU=yand then just do a "make oldconfig", and then verify that
TREE_PREEMPT_RCUhasn't been re-enabled by some dependency. But it shouldn't have, and that "make oldconfig" should get rid of anything that depends onTREE_PREEMPT_RCU.
Quoted 4 lines
Ok, I did exactly that, but
CONFIG_TREE_PREEMPT_RCUis
re-enabled. I talked with Pranith Kumar and he suggested I could just disable preemption (No Forced Preemption (Server)) and that's the only way to disableCONFIG_TREE_PREEMPT_RCU.
If it would help to have !CONFIG_TREE_PREEMPT_RCU with CONFIG_PREEMPT=y, please let me know and I will create a patch that forces this. (Not mainline material, but if it helps with debug...)
Thanx, Paul
Quoted 15 lines
Now I'll try to make the system freeze, then I'll send
you the Call trace.Thanks.
Signature · 9 lines
Linux 3.17.0: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Quoted 3 lines · On Mon, 1 Dec 2014 11:14:31 -0800 "Paul E. McKenney"…
If it would help to have !CONFIG_TREE_PREEMPT_RCU with
CONFIG_PREEMPT=y, please let me know and I will create a patch that forces this. (Not mainline material, but if it helps with debug...)
Hi Paul. Please, I'd like the patch, because without
preemption, I'm unable to trigger this bug.
Thanks.
Signature · 4 lines
Linux 3.17.0: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 3 lines · Dâniel Fraga
Hi Paul. Please, I'd like the patch, because without
preemption, I'm unable to trigger this bug.
Ok, that's already interesting information. And yes, it would probably be interesting to see if CONFIG_PREEMPT=y but !CONFIG_TREE_PREEMPT_RCU then solves it too, to narrow it down to one but not the other..
DaveJ - what about your situation? The standard Fedora kernels use CONFIG_PREEMPT_VOLUNTARY, do you have CONFIG_PREEMPT and CONFIG_TREE_PREEMPT_RCU enabled? I think you and Sasha both saw some RCU oddities too, no?
Linus
Quoted 9 lines · Dâniel Fraga
Quoted 3 lines · On Mon, 1 Dec 2014 11:14:31 -0800 "Paul E. McKenney"…
If it would help to have !CONFIG_TREE_PREEMPT_RCU with
CONFIG_PREEMPT=y, please let me know and I will create a patch that forces this. (Not mainline material, but if it helps with debug...)Hi Paul. Please, I'd like the patch, because without
preemption, I'm unable to trigger this bug.
Well, this turned out to be way simpler than I expected. Passes light rcutorture testing. Sometimes you get lucky...
Thanx, Paul
init/Kconfig +1 -1
@@ -469,7 +469,7 @@ choice config TREE_RCU bool "Tree-based hierarchical RCU" - depends on !PREEMPT && SMP + depends on SMP select IRQ_WORK help This option selects the RCU implementation that is
I'm not sure if this is related, but running trinity here, I noticed it was stuck at 100% system time on every CPU. perf report tells me we are spending all of our time in spin_lock under the sync system call.
I think it's coming from contention in the bdi_queue_work() call from inside sync_inodes_sb, which is spin_lock_bh().
I wonder if we're just spinning so hard on this one bh lock that we're starving the watchdog?
Dave, do you have spinlock debugging on?
-chris
Quoted 6 lines · Chris Mason
I'm not sure if this is related, but running trinity here, I noticed it was stuck at 100% system time on every CPU. perf report tells me we are spending all of our time in
spin_lockunder the sync system call.I think it's coming from contention in the
bdi_queue_work()call from insidesync_inodes_sb, which isspin_lock_bh().
Please do a perf run with -g to get the call chain to make sure..
Quoted 2 lines
I wonder if we're just spinning so hard on this one bh lock that we're starving the watchdog?
If it was that simple, we should see it in the actual soft-lockup stack trace.
That said, looking at the bdi_queue_work() function, I don't think you should see any real contention there, although:
- spin-lock debugging can make any bad situation about 10x worse by
making the spinlocks just that much more horrible from a performance standpoint
- the whole "complete(work->done)" thing seems to be pointlessly done
inside the spinlock, and that just seems horrible. Do you have a ton of BDI's that might fail that BDI_registered thing?
- even the "mod_delayed_work()" is dubious wrt the wb_lock. From what
I can tell, the spinlock is supposed to just protect the list.
So I think that bdi_queue_work() quite possibly is horribly broken crap and *if* it really is contention on wb_lock, we could rewrite it to not be so bad locking-wise.
That said, contention that happens with spinlock debugging enabled really tends to fall under the heading of "that's your own fault".
Linus
Quoted 7 lines · Linus Torvalds
Quoted 6 lines · Chris Mason
I'm not sure if this is related, but running trinity here, I
noticed it
was stuck at 100% system time on every CPU. perf report tells me
we are
spending all of our time inspin_lockunder the sync system call.
Quoted 5 lines
Quoted 3 lines
I think it's coming from contention in the
bdi_queue_work()call
from
insidesync_inodes_sb, which isspin_lock_bh().Please do a perf run with -g to get the call chain to make sure..
The call chain goes something like this:
--- _raw_spin_lock
|
|--99.72%-- sync_inodes_sb
| sync_inodes_one_sb
| iterate_supers
| sys_sync
| |
| |--79.66%-- system_call_fastpath
| | syscall
| |
| --20.34%-- ia32_sysret
| __do_syscall
--0.28%-- [...](the 64bit call variation is similar) Adding -v doesn't really help, because it isn't giving me the address inside sync_inodes_sb()
I first read this and guessed it must be leaving out the call to bdi_queue_work, hoping the spin_lock_bh and lock debugging were teaming up to stall the box.
But looking harder it's probably inside wait_sb_inodes:
spin_lock(&inode_sb_list_lock);
Which is a little harder to blame. Maaaaaybe with lock debugging, but its enough of a stretch that I wouldn't have emailed at all if I hadn't fixated on the bdi code.
-chris
Quoted 4 lines · Chris Mason
But looking harder it's probably inside
wait_sb_inodes:spin_lock(&inode_sb_list_lock);
Yeah, that's a known pain-point for sync(), although nobody has really cared enough, since performance of parallel sync() calls is usually not very high on anybody's list of things to care about except when it occasionally shows up on some old Unix benchmark (maybe AIM, I forget).
Anyway, lock debugging will make what is usually not noticeable into a "whee, that's horrible", because the lock debugging overhead is often many *many* times higher than the cost of the code inside the lock..
Linus
Quoted 16 lines · Paul E. McKenney
Quoted 15 lines · Dâniel Fraga
Quoted 11 lines · On Sun, 30 Nov 2014 16:21:19 -0800 Linus Torvalds…
Maybe you'll have to turn off
RCU_CPU_STALL_VERBOSEfirst.Although I think you should be able to just edit the .config file, delete the like that says
CONFIG_TREE_PREEMPT_RCU=yand then just do a "make oldconfig", and then verify that
TREE_PREEMPT_RCUhasn't been re-enabled by some dependency. But it shouldn't have, and that "make oldconfig" should get rid of anything that depends onTREE_PREEMPT_RCU.
Quoted 6 lines
Quoted 4 lines
Ok, I did exactly that, but
CONFIG_TREE_PREEMPT_RCUis
re-enabled. I talked with Pranith Kumar and he suggested I could just disable preemption (No Forced Preemption (Server)) and that's the only way to disableCONFIG_TREE_PREEMPT_RCU.If it would help to have !CONFIG_TREE_PREEMPT_RCU with
CONFIG_PREEMPT=y,
It is needed at lest for testing.
CONFIG_TREE_PREEMPT_RCU=y with CONFIG_PREEMPT=n is needed for testing too.
Please enable them (or enable them under CONFIG_RCU_TRACE=y)
Quoted 27 lines
please let me know and I will create a patch that forces this. (Not mainline material, but if it helps with debug...)
Thanx, Paul
Quoted 15 lines
Now I'll try to make the system freeze, then I'll send
you the Call trace.Thanks.
Signature · 9 lines
Linux 3.17.0: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 9 lines · Chris Mason
I'm not sure if this is related, but running trinity here, I noticed it was stuck at 100% system time on every CPU. perf report tells me we are spending all of our time in
spin_lockunder the sync system call.I think it's coming from contention in the
bdi_queue_work()call from insidesync_inodes_sb, which isspin_lock_bh().I wonder if we're just spinning so hard on this one bh lock that we're starving the watchdog?
The bean counting problem below can contribute.
https://lkml.org/lkml/2014/3/30/7
-Mike
Quoted 4 lines · Mike Galbraith
The bean counting problem below can contribute.
Hmm. That never got applied. I didn't apply it originally because of timing and wanting clarifications, but apparently it never made it into the -tip tree either.
Ingo, PeterZ - comments?
Looking again at that patch (the commit message still doesn't strike me as wonderfully explanatory :^) makes me worry, though.
Is that
if (rq->skip_clock_update-- > 0)
return;really right? If skip_clock_update was zero (normal), it now gets set to -1, which has its own specific meaning (see "force clock update" comment in kernel/sched/rt.c). Is that intentional? That seems insane.
Or should it be
if (rq->skip_clock_update > 0) {
rq->skip_clock_update = 0;
return;
}or what? Maybe there was a reason the patch never got applied even to -tip.
At the same time, the whole "incapacitated by the rt throttle long enough for the hard lockup detector to trigger" commentary about that skip_clock_update issue does make me go "Hmmm..". It would certainly explain Dave's incomprehensible watchdog messages..
Linus
Quoted 2 lines · On Mon, 1 Dec 2014 15:08:13 -0800 "Paul E. McKenney"…
Well, this turned out to be way simpler than I expected. Passes light rcutorture testing. Sometimes you get lucky...
Linus, Paul and others, I finally got a call trace with
only CONFIG_TREE_PREEMPT_RCU *disabled* using Paul's patch (to trigger it I compiled PHP with make -j8).
Dec 2 14:24:39 tux kernel: [ 8475.941616] conftest[9730]: segfault at 0 ip 0000000000400640 sp 00007fffa67ab300 error 4 in conftest[400000+1000]
Dec 2 14:24:40 tux kernel: [ 8476.104725] conftest[9753]: segfault at 0 ip 00007f6863024906 sp 00007fff0e31cc48 error 4 in libc-2.19.so[7f6862efe000+1a1000]
Dec 2 14:25:54 tux kernel: [ 8550.791697] INFO: rcu_sched detected stalls on CPUs/tasks: { 4} (detected by 0, t=60002 jiffies, g=112854, c=112853, q=0)
Dec 2 14:25:54 tux kernel: [ 8550.791702] Task dump for CPU 4:
Dec 2 14:25:54 tux kernel: [ 8550.791703] cc1 R running task 0 14344 14340 0x00080008
Dec 2 14:25:54 tux kernel: [ 8550.791706] 000000001bcebcd8 ffff880100000003 ffffffff810cb7f1 ffff88021f5f5c00
Dec 2 14:25:54 tux kernel: [ 8550.791708] ffff88011bcebfd8 ffff88011bcebce8 ffffffff811fb970 ffff8802149a2a00
Dec 2 14:25:54 tux kernel: [ 8550.791710] ffff8802149a2cc8 ffff88011bcebd28 ffffffff8103e979 ffff88020ed01398
Dec 2 14:25:54 tux kernel: [ 8550.791712] Call Trace:
Dec 2 14:25:54 tux kernel: [ 8550.791718] [<ffffffff810cb7f1>] ? release_pages+0xa1/0x1e0
Dec 2 14:25:54 tux kernel: [ 8550.791722] [<ffffffff811fb970>] ? cpumask_any_but+0x30/0x40
Dec 2 14:25:54 tux kernel: [ 8550.791725] [<ffffffff8103e979>] ? flush_tlb_page+0x49/0xf0
Dec 2 14:25:54 tux kernel: [ 8550.791727] [<ffffffff810cbe72>] ? lru_cache_add_active_or_unevictable+0x22/0x90
Dec 2 14:25:54 tux kernel: [ 8550.791731] [<ffffffff810fc4c2>] ? alloc_pages_vma+0x72/0x130
Dec 2 14:25:54 tux kernel: [ 8550.791733] [<ffffffff810cbe72>] ? lru_cache_add_active_or_unevictable+0x22/0x90
Dec 2 14:25:54 tux kernel: [ 8550.791735] [<ffffffff810e5220>] ? handle_mm_fault+0x3a0/0xaf0
Dec 2 14:25:54 tux kernel: [ 8550.791737] [<ffffffff81039074>] ? __do_page_fault+0x224/0x4c0
Dec 2 14:25:54 tux kernel: [ 8550.791740] [<ffffffff8110d54c>] ? new_sync_write+0x7c/0xb0
Dec 2 14:25:55 tux kernel: [ 8550.791743] [<ffffffff8114765c>] ? fsnotify+0x27c/0x350
Dec 2 14:25:55 tux kernel: [ 8550.791746] [<ffffffff81087233>] ? rcu_eqs_enter+0x93/0xa0
Dec 2 14:25:55 tux kernel: [ 8550.791748] [<ffffffff81087a5e>] ? rcu_user_enter+0xe/0x10
Dec 2 14:25:55 tux kernel: [ 8550.791749] [<ffffffff8103938a>] ? do_page_fault+0x5a/0x70
Dec 2 14:25:55 tux kernel: [ 8550.791752] [<ffffffff8139d9d2>] ? page_fault+0x22/0x30If you need more info/testing, just ask.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 22 lines · Lai Jiangshan
Quoted 21 lines · Paul E. McKenney
Quoted 19 lines · Dâniel Fraga
Quoted 11 lines · On Sun, 30 Nov 2014 16:21:19 -0800 Linus Torvalds…
Maybe you'll have to turn off
RCU_CPU_STALL_VERBOSEfirst.Although I think you should be able to just edit the .config file, delete the like that says
CONFIG_TREE_PREEMPT_RCU=yand then just do a "make oldconfig", and then verify that
TREE_PREEMPT_RCUhasn't been re-enabled by some dependency. But it shouldn't have, and that "make oldconfig" should get rid of anything that depends onTREE_PREEMPT_RCU.Ok, I did exactly that, but
CONFIG_TREE_PREEMPT_RCUis
re-enabled. I talked with Pranith Kumar and he suggested I could just disable preemption (No Forced Preemption (Server)) and that's the only way to disableCONFIG_TREE_PREEMPT_RCU.
Quoted 7 lines
Quoted 1 line
If it would help to have !CONFIG_TREE_PREEMPT_RCU with
CONFIG_PREEMPT=y,It is needed at lest for testing.
CONFIG_TREE_PREEMPT_RCU=ywithCONFIG_PREEMPT=nis needed for testing too.Please enable them (or enable them under
CONFIG_RCU_TRACE=y)
It is a really easy edit to Kconfig, but I don't want people using it in production because I really don't need the extra test scenarios. So I am happy to provide the patch below as needed, but not willing to submit it to mainline without a lot more justification. Because if it appears in mainline, people will start using it in production, whether I am doing proper testing of it or not. :-/
Thanx, Paul
------------------------------------------------------------------------
init/Kconfig +1 -1
@@ -469,7 +469,7 @@ choice config TREE_RCU bool "Tree-based hierarchical RCU" - depends on !PREEMPT && SMP + depends on SMP select IRQ_WORK help This option selects the RCU implementation that is
Quoted 5 lines · On Tue, 2 Dec 2014 16:40:37 +0800 Lai Jiangshan <[email protected]> wrote:
It is needed at lest for testing.
CONFIG_TREE_PREEMPT_RCU=ywithCONFIG_PREEMPT=nis needed for testing too.Please enable them (or enable them under
CONFIG_RCU_TRACE=y)
Lai, sorry but I didn't understand. Do you mean both of them
enabled? Because how can CONFIG_TREE_PREEMPT_RCU be enabled without CONFIG_PREEMPT ?
If you mean both enabled, I already reported a call trace with
both enabled:
https://bugzilla.kernel.org/show_bug.cgi?id=85941
Please see my previous answer to Linus and Paul too.
Regarding CONFIG_RCU_TRACE, do you mean
"CONFIG_TREE_RCU_TRACE"? I couldn't find CONFIG_RCU_TRACE.
Thanks.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 9 lines · Dâniel Fraga
Quoted 2 lines · On Mon, 1 Dec 2014 15:08:13 -0800 "Paul E. McKenney"…
Well, this turned out to be way simpler than I expected. Passes light rcutorture testing. Sometimes you get lucky...
Linus, Paul and others, I finally got a call trace with
onlyCONFIG_TREE_PREEMPT_RCU*disabled* using Paul's patch (to trigger it I compiled PHP with make -j8).
Is it harder to reproduce with CONFIG_PREEMPT=y and CONFIG_TREE_PREEMPT_RCU=n?
If it is a -lot- harder to reproduce, it might be worth bisecting among the RCU read-side critical sections. If making a few of them be non-preemptible greatly reduces the probability of the bug occuring, that might provide a clue about root cause.
On the other hand, if it is just a little harder to reproduce, this RCU read-side bisection would likely be an exercise in futility.
Thanx, Paul
Quoted 32 lines
Dec 2 14:24:39 tux kernel: [ 8475.941616] conftest[9730]: segfault at 0 ip 0000000000400640 sp 00007fffa67ab300 error 4 in conftest[400000+1000] Dec 2 14:24:40 tux kernel: [ 8476.104725] conftest[9753]: segfault at 0 ip 00007f6863024906 sp 00007fff0e31cc48 error 4 in libc-2.19.so[7f6862efe000+1a1000] Dec 2 14:25:54 tux kernel: [ 8550.791697] INFO: rcu_sched detected stalls on CPUs/tasks: { 4} (detected by 0, t=60002 jiffies, g=112854, c=112853, q=0) Dec 2 14:25:54 tux kernel: [ 8550.791702] Task dump for CPU 4: Dec 2 14:25:54 tux kernel: [ 8550.791703] cc1 R running task 0 14344 14340 0x00080008 Dec 2 14:25:54 tux kernel: [ 8550.791706] 000000001bcebcd8 ffff880100000003 ffffffff810cb7f1 ffff88021f5f5c00 Dec 2 14:25:54 tux kernel: [ 8550.791708] ffff88011bcebfd8 ffff88011bcebce8 ffffffff811fb970 ffff8802149a2a00 Dec 2 14:25:54 tux kernel: [ 8550.791710] ffff8802149a2cc8 ffff88011bcebd28 ffffffff8103e979 ffff88020ed01398 Dec 2 14:25:54 tux kernel: [ 8550.791712] Call Trace: Dec 2 14:25:54 tux kernel: [ 8550.791718] [<ffffffff810cb7f1>] ? release_pages+0xa1/0x1e0 Dec 2 14:25:54 tux kernel: [ 8550.791722] [<ffffffff811fb970>] ? cpumask_any_but+0x30/0x40 Dec 2 14:25:54 tux kernel: [ 8550.791725] [<ffffffff8103e979>] ? flush_tlb_page+0x49/0xf0 Dec 2 14:25:54 tux kernel: [ 8550.791727] [<ffffffff810cbe72>] ? lru_cache_add_active_or_unevictable+0x22/0x90 Dec 2 14:25:54 tux kernel: [ 8550.791731] [<ffffffff810fc4c2>] ? alloc_pages_vma+0x72/0x130 Dec 2 14:25:54 tux kernel: [ 8550.791733] [<ffffffff810cbe72>] ? lru_cache_add_active_or_unevictable+0x22/0x90 Dec 2 14:25:54 tux kernel: [ 8550.791735] [<ffffffff810e5220>] ? handle_mm_fault+0x3a0/0xaf0 Dec 2 14:25:54 tux kernel: [ 8550.791737] [<ffffffff81039074>] ? __do_page_fault+0x224/0x4c0 Dec 2 14:25:54 tux kernel: [ 8550.791740] [<ffffffff8110d54c>] ? new_sync_write+0x7c/0xb0 Dec 2 14:25:55 tux kernel: [ 8550.791743] [<ffffffff8114765c>] ? fsnotify+0x27c/0x350 Dec 2 14:25:55 tux kernel: [ 8550.791746] [<ffffffff81087233>] ? rcu_eqs_enter+0x93/0xa0 Dec 2 14:25:55 tux kernel: [ 8550.791748] [<ffffffff81087a5e>] ? rcu_user_enter+0xe/0x10 Dec 2 14:25:55 tux kernel: [ 8550.791749] [<ffffffff8103938a>] ? do_page_fault+0x5a/0x70 Dec 2 14:25:55 tux kernel: [ 8550.791752] [<ffffffff8139d9d2>] ? page_fault+0x22/0x30If you need more info/testing, just ask.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 4 lines · Dâniel Fraga
Linus, Paul and others, I finally got a call trace with
onlyCONFIG_TREE_PREEMPT_RCU*disabled* using Paul's patch (to trigger it I compiled PHP with make -j8).
So just to verify:
Without CONFIG_PREEMPT, things work well for you?
But with CONFIG_PREEMPT, you are able to create the rcu_sched stalls both with and without CONFIG_TREE_PREEMPT_RCU?
Correct?
Quoted 1 line
Dec 2 14:25:54 tux kernel: [ 8550.791697] INFO: rcu_sched detected stalls on CPUs/tasks: { 4} (detected by 0, t=60002 jiffies, g=112854, c=112853, q=0)Paul?
Linus
Quoted 1 line · On Tue, 2 Dec 2014 09:04:07 -0800 "Paul E. McKenney"…
Is it harder to reproduce with
CONFIG_PREEMPT=yandCONFIG_TREE_PREEMPT_RCU=n?
Yes, it's much harder! :)
Quoted 7 lines
If it is a -lot- harder to reproduce, it might be worth bisecting among the RCU read-side critical sections. If making a few of them be non-preemptible greatly reduces the probability of the bug occuring, that might provide a clue about root cause.
On the other hand, if it is just a little harder to reproduce, this RCU read-side bisection would likely be an exercise in futility.
Ok, I want to bisect it. Since it could be painful to bisect,
could you suggest 2 commits between 3.16.0 and 3.17.0 so we can narrow the bisect? I could just bisect between 3.16.0 and 3.17.0 but it would take many days :).
Ps: if you prefer I bisect between 3.16.0 and 3.17.0, no
problem, but you'll have to be patient ;).
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 6 lines · Linus Torvalds
On Tue, Dec 2, 2014 at 6:13 AM, Mike Galbraith <[email protected]> wrote:
At the same time, the whole "incapacitated by the rt throttle long enough for the hard lockup detector to trigger" commentary about that
skip_clock_updateissue does make me go "Hmmm..". It would certainly explain Dave's incomprehensible watchdog messages..
Dave's first email mentioned that he had panic on softlockup enabled, but even with that off the box wasn't recovering.
In my trinity runs here, I've gotten softlockup warnings where the box eventually recovered. I'm wondering if some of the "bad" commits in the bisection are really false positives where the box would have been able to recover if we'd killed off all the trinity procs and given it time to breath.
-chris
Quoted 3 lines · On Tue, 2 Dec 2014 09:08:53 -0800 Linus Torvalds…
So just to verify:
Without
CONFIG_PREEMPT, things work well for you?
Yes.
Quoted 4 lines
But with
CONFIG_PREEMPT, you are able to create thercu_schedstalls both with and withoutCONFIG_TREE_PREEMPT_RCU?Correct?
Yes, correct. And without CONFIG_TREE_PREEMPT_RCU it's
much harder to trigger the bug.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 5 lines · Dâniel Fraga
Quoted 2 lines · On Tue, 2 Dec 2014 16:40:37 +0800 Lai Jiangshan <[email protected]> wrote:
It is needed at lest for testing.
Quoted 7 lines
Quoted 3 lines
CONFIG_TREE_PREEMPT_RCU=ywithCONFIG_PREEMPT=nis needed for testing too.Please enable them (or enable them under
CONFIG_RCU_TRACE=y)Lai, sorry but I didn't understand. Do you mean both of them
enabled? Because how canCONFIG_TREE_PREEMPT_RCUbe enabled withoutCONFIG_PREEMPT?
Hmmm... I did misread that in my reply. A similar Kconfig edit will enable that, but I am even less happy about the thought of pushing that to mainline! ;-)
Thanx, Paul
Quoted 18 lines
If you mean both enabled, I already reported a call trace with
both enabled:https://bugzilla.kernel.org/show_bug.cgi?id=85941
Please see my previous answer to Linus and Paul too.
Regarding
CONFIG_RCU_TRACE, do you mean
"CONFIG_TREE_RCU_TRACE"? I couldn't findCONFIG_RCU_TRACE.Thanks.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 11 lines · Linus Torvalds
Looking again at that patch (the commit message still doesn't strike me as wonderfully explanatory :^) makes me worry, though.
Is that
if (rq->skip_clock_update-- > 0) return;really right? If
skip_clock_updatewas zero (normal), it now gets set to -1, which has its own specific meaning (see "force clock update" comment inkernel/sched/rt.c). Is that intentional? That seems insane.
Yeah, it was intentional. Least lines.
Quoted 8 lines
Or should it be
if (rq->skip_clock_update > 0) { rq->skip_clock_update = 0; return; }or what? Maybe there was a reason the patch never got applied even to -tip.
Peterz was looking at corner case proofing the thing. Saving those cycles has been entirely too annoying.
https://lkml.org/lkml/2014/4/8/295
-Mike
Quoted 13 lines · Paul E. McKenney
Quoted 9 lines · Dâniel Fraga
Quoted 2 lines · On Mon, 1 Dec 2014 15:08:13 -0800 "Paul E. McKenney"…
Well, this turned out to be way simpler than I expected. Passes light rcutorture testing. Sometimes you get lucky...
Linus, Paul and others, I finally got a call trace with
onlyCONFIG_TREE_PREEMPT_RCU*disabled* using Paul's patch (to trigger it I compiled PHP with make -j8).Is it harder to reproduce with
CONFIG_PREEMPT=yandCONFIG_TREE_PREEMPT_RCU=n?
Quoted 7 lines
If it is a -lot- harder to reproduce, it might be worth bisecting among the RCU read-side critical sections. If making a few of them be non-preemptible greatly reduces the probability of the bug occuring, that might provide a clue about root cause.
On the other hand, if it is just a little harder to reproduce, this RCU read-side bisection would likely be an exercise in futility.
To Linus's point, I guess I could look at the RCU CPU stall warning. ;-)
Summary: Not seeing something that would loop for 21 seconds. Dâniel, if you let this run, does it hit a second RCU CPU stall warning, or does it just lock up?
Details:
First, what would we be looking for? We know that with CONFIG_PREEMPT=n, things work, or at least that the failure rate is quite low. With CONFIG_PREEMPT=y, with or without CONFIG_TREE_PREEMPT_RCU=y, things can break. This is backwards of the usual behavior: Normally CONFIG_PREEMPT=y kernels are a bit less prone to RCU CPU stall warnings, at least assuming that the kernel spends a relatively small fraction of its time in RCU read-side critical sections.
So, how could this be?
1. Someone forgot an rcu_read_unlock() on one of the exit paths from
some RCU read-side critical section somewhere. This seems unlikely, but either CONFIG_PROVE_RCU=y or CONFIG_PREEMPT_DEBUG=y should catch it.
2. Someone forgot a preempt_enable() on one of the exit paths from
some preempt-disable region somewhere. This also seems a bit unlikely, but CONFIG_PREEMPT_DEBUG=y should catch it.
3. Preemption exposes a race condition that is extremely unlikely
for CONFIG_PREEMPT=n.
Of course, it wouldn't hurt for someone who knows mm better than I to check my work.
Quoted 3 lines
Quoted 3 lines
Dec 2 14:24:39 tux kernel: [ 8475.941616] conftest[9730]: segfault at 0 ip 0000000000400640 sp 00007fffa67ab300 error 4 in conftest[400000+1000] Dec 2 14:24:40 tux kernel: [ 8476.104725] conftest[9753]: segfault at 0 ip 00007f6863024906 sp 00007fff0e31cc48 error 4 in libc-2.19.so[7f6862efe000+1a1000] Dec 2 14:25:54 tux kernel: [ 8550.791697] INFO: rcu_sched detected stalls on CPUs/tasks: { 4} (detected by 0, t=60002 jiffies, g=112854, c=112853, q=0)
Note that the patch I gave to Dâniel provides only rcu_sched, as opposed to the usual CONFIG_PREEMPT=y rcu_preempt and rcu_sched. This is expected behavior for CONFIG_TREE_RCU=y/CONFIG_TREE_PREEMPT_RCU=n.
Quoted 7 lines
Quoted 7 lines
Dec 2 14:25:54 tux kernel: [ 8550.791702] Task dump for CPU 4: Dec 2 14:25:54 tux kernel: [ 8550.791703] cc1 R running task 0 14344 14340 0x00080008 Dec 2 14:25:54 tux kernel: [ 8550.791706] 000000001bcebcd8 ffff880100000003 ffffffff810cb7f1 ffff88021f5f5c00 Dec 2 14:25:54 tux kernel: [ 8550.791708] ffff88011bcebfd8 ffff88011bcebce8 ffffffff811fb970 ffff8802149a2a00 Dec 2 14:25:54 tux kernel: [ 8550.791710] ffff8802149a2cc8 ffff88011bcebd28 ffffffff8103e979 ffff88020ed01398 Dec 2 14:25:54 tux kernel: [ 8550.791712] Call Trace: Dec 2 14:25:54 tux kernel: [ 8550.791718] [<ffffffff810cb7f1>] ? release_pages+0xa1/0x1e0
This does have a loop whose length is controlled by the "nr" argument.
Quoted 1 line
Quoted 1 line
Dec 2 14:25:54 tux kernel: [ 8550.791722] [<ffffffff811fb970>] ? cpumask_any_but+0x30/0x40
This one is inconsistent with the release_pages() called function. Besides, its runtime is limited by the number of CPUs, so it shouldn't go on forever.
Quoted 1 line
Quoted 1 line
Dec 2 14:25:54 tux kernel: [ 8550.791725] [<ffffffff8103e979>] ? flush_tlb_page+0x49/0xf0
This one should also have a sharply limited runtime.
Quoted 1 line
Quoted 1 line
Dec 2 14:25:54 tux kernel: [ 8550.791727] [<ffffffff810cbe72>] ? lru_cache_add_active_or_unevictable+0x22/0x90
This one does acquire locks, so could in theory run for a long time. Would require high contention on ->lru_lock, though. A pvec can only contain 14 pages, so the move loop should have limited runtime.
Quoted 1 line
Quoted 1 line
Dec 2 14:25:54 tux kernel: [ 8550.791731] [<ffffffff810fc4c2>] ? alloc_pages_vma+0x72/0x130
This one contains a retry loop, at least if CONFIG_NUMA=y. But I don't see anything here that would block an RCU grace period.
Quoted 1 line
Quoted 1 line
Dec 2 14:25:54 tux kernel: [ 8550.791733] [<ffffffff810cbe72>] ? lru_cache_add_active_or_unevictable+0x22/0x90
Duplicate address above, presumably one or both are due to stack-trace confusion.
Quoted 1 line
Quoted 1 line
Dec 2 14:25:54 tux kernel: [ 8550.791735] [<ffffffff810e5220>] ? handle_mm_fault+0x3a0/0xaf0
If this one had a problem, I would expect to see it in some of its called functions.
Quoted 1 line
Quoted 1 line
Dec 2 14:25:54 tux kernel: [ 8550.791737] [<ffffffff81039074>] ? __do_page_fault+0x224/0x4c0
Ditto.
Quoted 1 line
Quoted 1 line
Dec 2 14:25:54 tux kernel: [ 8550.791740] [<ffffffff8110d54c>] ? new_sync_write+0x7c/0xb0
Ditto.
Quoted 1 line
Quoted 1 line
Dec 2 14:25:55 tux kernel: [ 8550.791743] [<ffffffff8114765c>] ? fsnotify+0x27c/0x350
This one uses SRCU, not RCU.
Quoted 2 lines
Quoted 2 lines
Dec 2 14:25:55 tux kernel: [ 8550.791746] [<ffffffff81087233>] ? rcu_eqs_enter+0x93/0xa0 Dec 2 14:25:55 tux kernel: [ 8550.791748] [<ffffffff81087a5e>] ? rcu_user_enter+0xe/0x10
These two don't call fsnotify(), so I am assuming that the stack trace is confused here. Any chance of enabling frame pointers or some such to get an accurate stack trace? (And yes, this is one CPU tracing another live CPU's stack, so some confusion is inherent, but probably not this far up the stack.)
Quoted 1 line
Quoted 1 line
Dec 2 14:25:55 tux kernel: [ 8550.791749] [<ffffffff8103938a>] ? do_page_fault+0x5a/0x70
Wrapper for __do_page_fault(). Yay! Functions that actually call each other in this stack trace! ;-)
Quoted 1 line
Quoted 1 line
Dec 2 14:25:55 tux kernel: [ 8550.791752] [<ffffffff8139d9d2>] ? page_fault+0x22/0x30
Not seeing much in the way of loops here.
Thanx, Paul
Quoted 9 lines
Quoted 9 lines
If you need more info/testing, just ask.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 5 lines · On Tue, 2 Dec 2014 10:09:47 -0800 "Paul E. McKenney"…
To Linus's point, I guess I could look at the RCU CPU stall warning. ;-)
Summary: Not seeing something that would loop for 21 seconds. Dâniel, if you let this run, does it hit a second RCU CPU stall warning, or does it just lock up?
It just lock up. I can't even use the keyboard or mouse, so I
have to hard reset the system.
I'm trying the bisect you asked... even if it takes longer,
maybe I can find something for you.
Signature · 4 lines
Linux 3.17.0-rc6-00235-gb94d525: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 15 lines · Dâniel Fraga
Quoted 1 line · On Tue, 2 Dec 2014 09:04:07 -0800 "Paul E. McKenney"…
Is it harder to reproduce with
CONFIG_PREEMPT=yandCONFIG_TREE_PREEMPT_RCU=n?Yes, it's much harder! :)
Quoted 7 lines
If it is a -lot- harder to reproduce, it might be worth bisecting among the RCU read-side critical sections. If making a few of them be non-preemptible greatly reduces the probability of the bug occuring, that might provide a clue about root cause.
On the other hand, if it is just a little harder to reproduce, this RCU read-side bisection would likely be an exercise in futility.
Quoted 7 lines
Ok, I want to bisect it. Since it could be painful to bisect,
could you suggest 2 commits between 3.16.0 and 3.17.0 so we can narrow the bisect? I could just bisect between 3.16.0 and 3.17.0 but it would take many days :).Ps: if you prefer I bisect between 3.16.0 and 3.17.0, no
problem, but you'll have to be patient ;).
I was actually suggesting something a bit different. Instead of bisecting by release, bisect by code. The procedure is as follows:
1. I figure out some reliable way of making RCU allow preemption to
be disabled for some RCU read-side critical sections, but not for others. I send you the patch, which has rcu_read_lock_test() as well as rcu_read_lock().
2. You build a kernel without my Kconfig hack, with my patch from
#1 above, and build a kernel with CONFIG_PREEMPT=y (which of course implies CONFIG_TREE_PREEMPT_RCU=y, given that you are building without my Kconfig hack).
3. You make a list of all the rcu_read_lock() uses in the kernel
(or ask me to provide it). You change the rcu_read_lock() calls in the first half of this list to rcu_read_lock_test().
If the kernel locks up as easily with this change as it did in a stock CONFIG_PREEMPT=y CONFIG_TREE_PREEMPT_RCU=y kernel, change half of the remaining rcu_read_lock() calls to rcu_read_lock_test(). If the kernel is much more resistant to lockup, change half of the rcu_read_lock_test() calls back to rcu_read_lock().
4. It is quite possible that several of the RCU read-side critical
sections contribute to the unreliability, in which case the bisection will get a bit more complicated.
Other thoughts on how to attack this?
Thanx, Paul
Quoted 17 lines · On Tue, 2 Dec 2014 10:42:02 -0800 "Paul E. McKenney"…
I was actually suggesting something a bit different. Instead of bisecting by release, bisect by code. The procedure is as follows:
1. I figure out some reliable way of making RCU allow preemption to
be disabled for some RCU read-side critical sections, but not for others. I send you the patch, which hasrcu_read_lock_test()as well asrcu_read_lock().2. You build a kernel without my
Kconfighack, with my patch from
#1 above, and build a kernel withCONFIG_PREEMPT=y(which of course impliesCONFIG_TREE_PREEMPT_RCU=y, given that you are building without myKconfighack).3. You make a list of all the
rcu_read_lock()uses in the kernel
(or ask me to provide it). You change thercu_read_lock()calls in the first half of this list torcu_read_lock_test().
Quoted 6 lines
If the kernel locks up as easily with this change as it did in a stock
CONFIG_PREEMPT=yCONFIG_TREE_PREEMPT_RCU=ykernel, change half of the remainingrcu_read_lock()calls torcu_read_lock_test(). If the kernel is much more resistant to lockup, change half of thercu_read_lock_test()calls back torcu_read_lock().
Ok Paul, I want to do everything I can to help you debug this.
So can you provide me the list you mentioned at point 3 (or
tell me how can I get it)? If you guide me through this, I can do whatever you need. Thanks!
Signature · 4 lines
Linux 3.17.0-rc6-00235-gb94d525: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 27 lines · Dâniel Fraga
Quoted 17 lines · On Tue, 2 Dec 2014 10:42:02 -0800 "Paul E. McKenney"…
I was actually suggesting something a bit different. Instead of bisecting by release, bisect by code. The procedure is as follows:
1. I figure out some reliable way of making RCU allow preemption to
be disabled for some RCU read-side critical sections, but not for others. I send you the patch, which hasrcu_read_lock_test()as well asrcu_read_lock().2. You build a kernel without my
Kconfighack, with my patch from
#1 above, and build a kernel withCONFIG_PREEMPT=y(which of course impliesCONFIG_TREE_PREEMPT_RCU=y, given that you are building without myKconfighack).3. You make a list of all the
rcu_read_lock()uses in the kernel
(or ask me to provide it). You change thercu_read_lock()calls in the first half of this list torcu_read_lock_test().Quoted 6 lines
If the kernel locks up as easily with this change as it did in a stock
CONFIG_PREEMPT=yCONFIG_TREE_PREEMPT_RCU=ykernel, change half of the remainingrcu_read_lock()calls torcu_read_lock_test(). If the kernel is much more resistant to lockup, change half of thercu_read_lock_test()calls back torcu_read_lock().
Quoted 5 lines
Ok Paul, I want to do everything I can to help you debug this.
So can you provide me the list you mentioned at point 3 (or
tell me how can I get it)? If you guide me through this, I can do whatever you need. Thanks!
OK. I need to know exactly what version of the Linux kernel you are using. 3.18-rc7? (I am not too worried about exactly which version you are using as long as I know which version it is.)
Thanx, Paul
Quoted 3 lines · On Tue, 2 Dec 2014 11:11:43 -0800 "Paul E. McKenney"…
OK. I need to know exactly what version of the Linux kernel you are using. 3.18-rc7? (I am not too worried about exactly which version you are using as long as I know which version it is.)
Ok, I stopped bisecting and went back to 3.17.0 stock kernel.
I'm testing with 3.17.0 kernel because this one is the first to show problems. If you want me to go to 3.18-rc7, just ask I can checkout through git.
Ps: my signature will reflect the kernel I'm using now ;)
Signature · 4 lines
Linux 3.17.0: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 5 lines · Linus Torvalds
Quoted 3 lines · Dâniel Fraga
Hi Paul. Please, I'd like the patch, because without
preemption, I'm unable to trigger this bug.
Quoted 7 lines
Ok, that's already interesting information. And yes, it would probably be interesting to see if
CONFIG_PREEMPT=ybut !CONFIG_TREE_PREEMPT_RCU then solves it too, to narrow it down to one but not the other..DaveJ - what about your situation? The standard Fedora kernels use
CONFIG_PREEMPT_VOLUNTARY, do you haveCONFIG_PREEMPTandCONFIG_TREE_PREEMPT_RCUenabled?
I periodically switch PREEMPT options, just to see if anything new falls out, though I've been on CONFIG_PREEMPT for quite a while. So right now I'm testing the TREE_PREEMPT_RCU case.
I'm in the process of bisecting 3.16 -> 3.17 (currently on -rc1) Thanksgiving kind of screwed up my flow, but 3.16 got a real pounding for over 3 days with no problems.
I can give a !PREEMPT_RCU build a try, in case that turns out to point to something quicker than a bisect is going to.
Quoted 1 line
I think you and Sasha both saw some RCU oddities too, no?
I don't recall a kernel where I didn't see RCU oddities of some description, but in recent times, not so much, though a few releases back I did change some of the RCU related CONFIG options while Paul & co were chasing down some bugs.
These days I've been running with..
# RCU SubsystemCONFIG_TREE_PREEMPT_RCU=yCONFIG_PREEMPT_RCU=y
# CONFIG_TASKS_RCU is not setCONFIG_RCU_STALL_COMMON=y
# CONFIG_RCU_USER_QS is not setCONFIG_RCU_FANOUT=64CONFIG_RCU_FANOUT_LEAF=16
# CONFIG_RCU_FANOUT_EXACT is not setCONFIG_TREE_RCU_TRACE=yCONFIG_RCU_BOOST=yCONFIG_RCU_BOOST_PRIO=1CONFIG_RCU_BOOST_DELAY=500CONFIG_RCU_NOCB_CPU=y
# CONFIG_RCU_NOCB_CPU_NONE is not set
# CONFIG_RCU_NOCB_CPU_ZERO is not setCONFIG_RCU_NOCB_CPU_ALL=yCONFIG_DEBUG_OBJECTS_RCU_HEAD=y
# RCU DebuggingCONFIG_SPARSE_RCU_POINTER=y
# CONFIG_RCU_TORTURE_TEST is not setCONFIG_RCU_CPU_STALL_TIMEOUT=60CONFIG_RCU_CPU_STALL_VERBOSE=yCONFIG_RCU_CPU_STALL_INFO=yCONFIG_RCU_TRACE=y
Dave
Quoted 11 lines · Chris Mason
I'm not sure if this is related, but running trinity here, I noticed it was stuck at 100% system time on every CPU. perf report tells me we are spending all of our time in
spin_lockunder the sync system call.I think it's coming from contention in the
bdi_queue_work()call from insidesync_inodes_sb, which isspin_lock_bh().I wonder if we're just spinning so hard on this one bh lock that we're starving the watchdog?
Dave, do you have spinlock debugging on?
That has been a constant, yes. I can try with that disabled some time.
Dave
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Dâniel Fraga
Hi Paul. Please, I'd like the patch, because without
preemption, I'm unable to trigger this bug.Ok, that's already interesting information. And yes, it would probably be interesting to see if
CONFIG_PREEMPT=ybut !CONFIG_TREE_PREEMPT_RCU then solves it too, to narrow it down to one but not the other..
That combination doesn't seem possible. TREE_PREEMPT_RCU is the only possible choice if PREEMPT=y
Dave
Quoted 6 lines · Dave Jones
Quoted 5 lines · Linus Torvalds
Quoted 3 lines · Dâniel Fraga
Hi Paul. Please, I'd like the patch, because without
preemption, I'm unable to trigger this bug.
Quoted 6 lines
Quoted 3 lines
Ok, that's already interesting information. And yes, it would probably be interesting to see if
CONFIG_PREEMPT=ybut !CONFIG_TREE_PREEMPT_RCU then solves it too, to narrow it down to one but not the other..That combination doesn't seem possible.
TREE_PREEMPT_RCUis the only possible choice if PREEMPT=y
Indeed, getting that combination requires a Kconfig patch, which I supplied below. Not for mainline, debugging only.
Thanx, Paul
------------------------------------------------------------------------
init/Kconfig +1 -1
@@ -469,7 +469,7 @@ choice config TREE_RCU bool "Tree-based hierarchical RCU" - depends on !PREEMPT && SMP + depends on SMP select IRQ_WORK help This option selects the RCU implementation that is
Quoted 7 lines · Dâniel Fraga
Quoted 3 lines · On Tue, 2 Dec 2014 11:11:43 -0800 "Paul E. McKenney"…
OK. I need to know exactly what version of the Linux kernel you are using. 3.18-rc7? (I am not too worried about exactly which version you are using as long as I know which version it is.)
Quoted 6 lines
Ok, I stopped bisecting and went back to 3.17.0 stock kernel.
I'm testing with 3.17.0 kernel because this one is the first to show problems. If you want me to go to 3.18-rc7, just ask I can checkout through git.Ps: my signature will reflect the kernel I'm using now ;)
And I left out a step. Let's make sure that my preempt_disabled() hack to CONFIG_TREE_PREEMPT_RCU=y has the same effect as the Kconfig hack that allowed CONFIG_PREEMPT=y and CONFIG_TREE_PREEMPT_RCU=n. Could you please try out the following patch configured with CONFIG_PREEMPT=y and CONFIG_TREE_PREEMPT_RCU=y?
Thanx, Paul
------------------------------------------------------------------------
kernel/rcu/update.c +6 -1
@@ -71,7 +71,11 @@ module_param(rcu_expedited, int, 0);*/ void __rcu_read_lock (void ) { - current->rcu_read_lock_nesting++; +struct task_struct *t = current; + +if (!t->rcu_read_lock_nesting) +preempt_disable (); + t->rcu_read_lock_nesting++;barrier ();/* critical section after entry code. */ }EXPORT_SYMBOL_GPL (__rcu_read_lock);
@@ -92,6 +96,7 @@ void __rcu_read_unlock(void) }else {barrier ();/* critical section before exit code. */ t->rcu_read_lock_nesting =INT_MIN ; +preempt_enable ();barrier ();/* assign before ->rcu_read_unlock_special load */ if (unlikely (ACCESS_ONCE (t->rcu_read_unlock_special.s)))rcu_read_unlock_special (t);
Quoted 6 lines · Dave Jones
I'm in the process of bisecting 3.16 -> 3.17 (currently on -rc1) Thanksgiving kind of screwed up my flow, but 3.16 got a real pounding for over 3 days with no problems.
I can give a !PREEMPT_RCU build a try, in case that turns out to point to something quicker than a bisect is going to.
No,. go on with the bisect. I think at this point we'll all be happier narrowing down the range of commits than anything else. The behavior Dâniel sees may be entirely unrelated anyway.
Linus
Quoted 5 lines · On Tue, 2 Dec 2014 12:56:36 -0800 "Paul E. McKenney"…
And I left out a step. Let's make sure that my
preempt_disabled()hack toCONFIG_TREE_PREEMPT_RCU=yhas the same effect as theKconfighack that allowedCONFIG_PREEMPT=yandCONFIG_TREE_PREEMPT_RCU=n. Could you please try out the following patch configured withCONFIG_PREEMPT=yandCONFIG_TREE_PREEMPT_RCU=y?
Of course! I applied your patch to 3.17 stock kernel and after
stressing it (compiling with -j8 and watching videos on Youtube) to trigger the bug I got the following:
Dec 2 19:47:25 tux kernel: [ 927.973547] INFO: rcu_preempt detected stalls on CPUs/tasks: { 5} (detected by 1, t=60002 jiffies, g=71142, c=71141, q=0)
Dec 2 19:47:26 tux kernel: [ 927.973553] Task dump for CPU 5:
Dec 2 19:47:26 tux kernel: [ 927.973555] cc1 R running task 0 30691 30680 0x00080008
Dec 2 19:47:26 tux kernel: [ 927.973558] ffff88021f351bc0 ffff8801d5743f00 ffffffff8107062a ffff88021f351c38
Dec 2 19:47:26 tux kernel: [ 927.973560] ffff8801d5743ea8 ffff8800cd3b0000 ffff8800cd3b041c 0000000000000000
Dec 2 19:47:26 tux kernel: [ 927.973562] 00007f89b4d7d8e8 00007f89b5939a60 ffff88021f34d2c0 00007f89b4d7f000
Dec 2 19:47:26 tux kernel: [ 927.973564] Call Trace:
Dec 2 19:47:26 tux kernel: [ 927.973573] [<ffffffff8107062a>] ? pick_next_task_fair+0x6aa/0x890
Dec 2 19:47:26 tux kernel: [ 927.973577] [<ffffffff81087483>] ? rcu_eqs_enter+0x93/0xa0
Dec 2 19:47:26 tux kernel: [ 927.973579] [<ffffffff81087f2e>] ? rcu_user_enter+0xe/0x10
Dec 2 19:47:26 tux kernel: [ 927.973582] [<ffffffff8103935a>] ? do_page_fault+0x5a/0x70
Dec 2 19:47:26 tux kernel: [ 927.973585] [<ffffffff8139bed2>] ? page_fault+0x22/0x30
Dec 2 19:47:30 tux kernel: [ 932.471964] CPU1: Core temperature above threshold, cpu clock throttled (total events = 820)
Dec 2 19:47:30 tux kernel: [ 932.471966] CPU6: Package temperature above threshold, cpu clock throttled (total events = 2624)
Dec 2 19:47:30 tux kernel: [ 932.471967] CPU3: Package temperature above threshold, cpu clock throttled (total events = 2624)
Dec 2 19:47:30 tux kernel: [ 932.471968] CPU7: Package temperature above threshold, cpu clock throttled (total events = 2624)
Dec 2 19:47:30 tux kernel: [ 932.471969] CPU0: Package temperature above threshold, cpu clock throttled (total events = 2624)
Dec 2 19:47:30 tux kernel: [ 932.471970] CPU2: Package temperature above threshold, cpu clock throttled (total events = 2624)
Dec 2 19:47:30 tux kernel: [ 932.471978] CPU1: Package temperature above threshold, cpu clock throttled (total events = 2624)
Dec 2 19:47:30 tux kernel: [ 932.472922] CPU1: Core temperature/speed normal
Dec 2 19:47:30 tux kernel: [ 932.472923] CPU6: Package temperature/speed normal
Dec 2 19:47:31 tux kernel: [ 932.472923] CPU2: Package temperature/speed normal
Dec 2 19:47:31 tux kernel: [ 932.472924] CPU3: Package temperature/speed normal
Dec 2 19:47:31 tux kernel: [ 932.472925] CPU0: Package temperature/speed normalWaiting for your next instructions.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 4 lines · Dâniel Fraga
Of course! I applied your patch to 3.17 stock kernel and after
stressing it (compiling with -j8 and watching videos on Youtube) to trigger the bug I got the following:
So it appears that you can recreate this much more quickly than DaveJ can recreate his issue.
The two issues may be entirely unrelated, but the it is certainly quite possible that they have some relation to each other, and the timing is intriguing, in that 3.17 seems to be the first kernel release this happened in.
So at this point I think I'd ask you to just go back to your bisection that you apparently already started earlier. I take it 3.16 worked fine, and that's what you used as the good base for your bisect?
Even if it's something else than what DaveJ sees (or perhaps *particularly* if it's something else), bisecting when it started would be very worthwhile.
There's 13k+ commits in between 3.16 and 3.17, so a full bisect should be around 15 test-points. But judging by the timing of your emails, you can generally reproduce this relatively quickly..
Linus
Quoted 9 lines · Dâniel Fraga
Quoted 5 lines · On Tue, 2 Dec 2014 12:56:36 -0800 "Paul E. McKenney"…
And I left out a step. Let's make sure that my
preempt_disabled()hack toCONFIG_TREE_PREEMPT_RCU=yhas the same effect as theKconfighack that allowedCONFIG_PREEMPT=yandCONFIG_TREE_PREEMPT_RCU=n. Could you please try out the following patch configured withCONFIG_PREEMPT=yandCONFIG_TREE_PREEMPT_RCU=y?
Quoted 3 lines
Of course! I applied your patch to 3.17 stock kernel and after
stressing it (compiling with -j8 and watching videos on Youtube) to trigger the bug I got the following:
Thank you!!!
Was this as difficult to trigger as the version with the Kconfig hack that used CONFIG_PREEMPT=y and CONFIG_TREE_PREEMPT_RCU=n?
Thanx, Paul
Quoted 33 lines
Dec 2 19:47:25 tux kernel: [ 927.973547] INFO: rcu_preempt detected stalls on CPUs/tasks: { 5} (detected by 1, t=60002 jiffies, g=71142, c=71141, q=0) Dec 2 19:47:26 tux kernel: [ 927.973553] Task dump for CPU 5: Dec 2 19:47:26 tux kernel: [ 927.973555] cc1 R running task 0 30691 30680 0x00080008 Dec 2 19:47:26 tux kernel: [ 927.973558] ffff88021f351bc0 ffff8801d5743f00 ffffffff8107062a ffff88021f351c38 Dec 2 19:47:26 tux kernel: [ 927.973560] ffff8801d5743ea8 ffff8800cd3b0000 ffff8800cd3b041c 0000000000000000 Dec 2 19:47:26 tux kernel: [ 927.973562] 00007f89b4d7d8e8 00007f89b5939a60 ffff88021f34d2c0 00007f89b4d7f000 Dec 2 19:47:26 tux kernel: [ 927.973564] Call Trace: Dec 2 19:47:26 tux kernel: [ 927.973573] [<ffffffff8107062a>] ? pick_next_task_fair+0x6aa/0x890 Dec 2 19:47:26 tux kernel: [ 927.973577] [<ffffffff81087483>] ? rcu_eqs_enter+0x93/0xa0 Dec 2 19:47:26 tux kernel: [ 927.973579] [<ffffffff81087f2e>] ? rcu_user_enter+0xe/0x10 Dec 2 19:47:26 tux kernel: [ 927.973582] [<ffffffff8103935a>] ? do_page_fault+0x5a/0x70 Dec 2 19:47:26 tux kernel: [ 927.973585] [<ffffffff8139bed2>] ? page_fault+0x22/0x30 Dec 2 19:47:30 tux kernel: [ 932.471964] CPU1: Core temperature above threshold, cpu clock throttled (total events = 820) Dec 2 19:47:30 tux kernel: [ 932.471966] CPU6: Package temperature above threshold, cpu clock throttled (total events = 2624) Dec 2 19:47:30 tux kernel: [ 932.471967] CPU3: Package temperature above threshold, cpu clock throttled (total events = 2624) Dec 2 19:47:30 tux kernel: [ 932.471968] CPU7: Package temperature above threshold, cpu clock throttled (total events = 2624) Dec 2 19:47:30 tux kernel: [ 932.471969] CPU0: Package temperature above threshold, cpu clock throttled (total events = 2624) Dec 2 19:47:30 tux kernel: [ 932.471970] CPU2: Package temperature above threshold, cpu clock throttled (total events = 2624) Dec 2 19:47:30 tux kernel: [ 932.471978] CPU1: Package temperature above threshold, cpu clock throttled (total events = 2624) Dec 2 19:47:30 tux kernel: [ 932.472922] CPU1: Core temperature/speed normal Dec 2 19:47:30 tux kernel: [ 932.472923] CPU6: Package temperature/speed normal Dec 2 19:47:31 tux kernel: [ 932.472923] CPU2: Package temperature/speed normal Dec 2 19:47:31 tux kernel: [ 932.472924] CPU3: Package temperature/speed normal Dec 2 19:47:31 tux kernel: [ 932.472925] CPU0: Package temperature/speed normalWaiting for your next instructions.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 12 lines · On Tue, 2 Dec 2014 14:10:33 -0800 Linus Torvalds…
So it appears that you can recreate this much more quickly than DaveJ can recreate his issue.
The two issues may be entirely unrelated, but the it is certainly quite possible that they have some relation to each other, and the timing is intriguing, in that 3.17 seems to be the first kernel release this happened in.
So at this point I think I'd ask you to just go back to your bisection that you apparently already started earlier. I take it 3.16 worked fine, and that's what you used as the good base for your bisect?
Quoted 7 lines
Even if it's something else than what DaveJ sees (or perhaps *particularly* if it's something else), bisecting when it started would be very worthwhile.
There's 13k+ commits in between 3.16 and 3.17, so a full bisect should be around 15 test-points. But judging by the timing of your emails, you can generally reproduce this relatively quickly..
No problem Linus. I'll try the full bisect and I post here
later with the final result.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 1 line · On Tue, 2 Dec 2014 14:10:31 -0800 "Paul E. McKenney"…
Thank you!!!
;)
Quoted 2 lines
Was this as difficult to trigger as the version with the
Kconfighack that usedCONFIG_PREEMPT=yandCONFIG_TREE_PREEMPT_RCU=n?
Yes. I had to try many times until I got the call trace.
I'll try the bisect as Linus suggested, but if you have any
other suggestions, just ask ;). Thanks Paul.
Signature · 4 lines
Linux 3.17.0-dirty: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 7 lines · Dâniel Fraga
Quoted 1 line · On Tue, 2 Dec 2014 14:10:31 -0800 "Paul E. McKenney"…
Thank you!!!
;)
Quoted 7 lines
Quoted 2 lines
Was this as difficult to trigger as the version with the
Kconfighack that usedCONFIG_PREEMPT=yandCONFIG_TREE_PREEMPT_RCU=n?Yes. I had to try many times until I got the call trace.
I'll try the bisect as Linus suggested, but if you have any
other suggestions, just ask ;). Thanks Paul.
Sounds good to me -- getting a single commit somewhere between 3.16 and 3.17 is going to be a lot better than reasoning indirectly from some set of RCU read-side critical sections. ;-)
Thanx, Paul
Quoted 8 lines · Dave Jones
Quoted 7 lines · Chris Mason
I'm not sure if this is related, but running trinity here, I noticed it was stuck at 100% system time on every CPU. perf report tells me we are spending all of our time in
spin_lockunder the sync system call.I think it's coming from contention in the
bdi_queue_work()call from insidesync_inodes_sb, which isspin_lock_bh().
Quoted 6 lines
Quoted 4 lines
I wonder if we're just spinning so hard on this one bh lock that we're starving the watchdog?
Dave, do you have spinlock debugging on?
That has been a constant, yes. I can try with that disabled some time.
Here's my side of the story: I was observing RCU lockups which went away when I disabled verbose printing for fault injections. It seems that printing one line ~10 times a second can cause that...
I've disabled lock debugging to see if anything new will show up, and hit something that may be related:
[ 787.894288] ================================================================================ [ 787.897074] UBSan: Undefined behaviour in kernel/sched/fair.c:4541:17 [ 787.898981] signed integer overflow: [ 787.900066] 361516561629678 * 101500 cannot be represented in type 'long long int' [ 787.900066] CPU: 18 PID: 12958 Comm: trinity-c103 Not tainted 3.18.0-rc6-next-20141201-sasha-00070-g028060a-dirty #1528 [ 787.900066] 0000000000000000 0000000000000000 ffffffff93b0f890 ffff8806e3eff918 [ 787.900066] ffffffff91f1cf26 1ffffffff3c2de73 ffffffff93b0f8a8 ffff8806e3eff938 [ 787.900066] ffffffff91f1fb90 1ffffffff3c2de73 ffffffff93b0f8a8 ffff8806e3eff9f8 [ 787.900066] Call Trace: [ 787.900066] dump_stack (lib/dump_stack.c:52) [ 787.900066] ubsan_epilogue (lib/ubsan.c:159) [ 787.900066] handle_overflow (lib/ubsan.c:191) [ 787.900066] ? __do_page_fault (arch/x86/mm/fault.c:1220) [ 787.900066] ? local_clock (kernel/sched/clock.c:392) [ 787.900066] __ubsan_handle_mul_overflow (lib/ubsan.c:218) [ 787.900066] select_task_rq_fair (kernel/sched/fair.c:4541 kernel/sched/fair.c:4755) [ 787.900066] try_to_wake_up (kernel/sched/core.c:1415 kernel/sched/core.c:1724) [ 787.900066] ? trace_hardirqs_on_thunk (arch/x86/lib/thunk_64.S:33) [ 787.900066] default_wake_function (kernel/sched/core.c:2979) [ 787.900066] ? get_parent_ip (kernel/sched/core.c:2559) [ 787.900066] autoremove_wake_function (kernel/sched/wait.c:295) [ 787.900066] ? get_parent_ip (kernel/sched/core.c:2559) [ 787.900066] __wake_up_common (kernel/sched/wait.c:73) [ 787.900066] __wake_up_sync_key (include/linux/spinlock.h:364 kernel/sched/wait.c:146) [ 787.900066] pipe_write (fs/pipe.c:466) [ 787.900066] ? kasan_poison_shadow (mm/kasan/kasan.c:48) [ 787.900066] ? new_sync_read (fs/read_write.c:480) [ 787.900066] do_iter_readv_writev (fs/read_write.c:681) [ 787.900066] compat_do_readv_writev (fs/read_write.c:1029) [ 787.900066] ? wait_for_partner (fs/pipe.c:340) [ 787.900066] ? _raw_spin_unlock (./arch/x86/include/asm/preempt.h:95 include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183) [ 787.900066] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63) [ 787.900066] ? syscall_trace_enter_phase1 (include/linux/context_tracking.h:27 arch/x86/kernel/ptrace.c:1486) [ 787.900066] compat_writev (fs/read_write.c:1145) [ 787.900066] compat_SyS_writev (fs/read_write.c:1163 fs/read_write.c:1151) [ 787.900066] ia32_do_call (arch/x86/ia32/ia32entry.S:446) [ 787.900066] ================================================================================
(For Linus asking himself "what the hell is this UBSan thing, I didn't merge that!" - it's an undefined behaviour sanitizer that works with gcc5.)
Thanks,
Sasha
Quoted 3 lines · Sasha Levin
I've disabled lock debugging to see if anything new will show up, and hit something that may be related:
Very interesting. But your source code doesn't match mine - can you say what that
kernel/sched/fair.c:4541:17
line is?
There are at least five multiplications there (all inlined):
- "imbalance*min_load" from find_idlest_group()
- "factor * p->wakee_flips" in wake_wide()
- at least three in wake_affine:
"prev_eff_load *= capacity_of(this_cpu)"
"this_eff_load *= this_load + effective_load(tg, this_cpu, weight, weight)" "prev_eff_load *= load + effective_load(tg, prev_cpu, 0, weight)"
(There are other multiplications too, but they are by constants afaik and don't match yours).
None of those seem to have anything to do with the 3.16..3.17 changes, but I might be missing something, and obviously this also might have nothing to do with the problems anyway.
Adding Ingo/PeterZ to the participants again.
Linus
---
Quoted 10 lines
[ 787.894288] ================================================================================ [ 787.897074] UBSan: Undefined behaviour in kernel/sched/fair.c:4541:17 [ 787.898981] signed integer overflow: [ 787.900066] 361516561629678 * 101500 cannot be represented in type 'long long int' [ 787.900066] ubsan_epilogue (lib/ubsan.c:159) [ 787.900066] handle_overflow (lib/ubsan.c:191) [ 787.900066] ? __do_page_fault (arch/x86/mm/fault.c:1220) [ 787.900066] ? local_clock (kernel/sched/clock.c:392) [ 787.900066] __ubsan_handle_mul_overflow (lib/ubsan.c:218) [ 787.900066] select_task_rq_fair (kernel/sched/fair.c:4541 kernel/sched/fair.c:4755)
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Sasha Levin
Quoted 3 lines
I've disabled lock debugging to see if anything new will show up, and hit something that may be related:
Very interesting. But your source code doesn't match mine - can you say what that
kernel/sched/fair.c:4541:17line is?
Sorry about that, I'm testing on the -next kernel. The relevant code snippet is in wake_affine:
prev_eff_load = 100 + (sd->imbalance_pct - 100) / 2;
prev_eff_load *= capacity_of(this_cpu);
if (this_load > 0) {
this_eff_load *= this_load +
effective_load(tg, this_cpu, weight, weight); <==== This one
prev_eff_load *= load + effective_load(tg, prev_cpu, 0, weight);
}Thanks,
Sasha
Quoted 5 lines · Dâniel Fraga
Quoted 2 lines · On Tue, 2 Dec 2014 16:40:37 +0800 Lai Jiangshan <[email protected]> wrote:
It is needed at lest for testing.
Quoted 7 lines
Quoted 3 lines
CONFIG_TREE_PREEMPT_RCU=ywithCONFIG_PREEMPT=nis needed for testing too.Please enable them (or enable them under
CONFIG_RCU_TRACE=y)Lai, sorry but I didn't understand. Do you mean both of them
enabled? Because how canCONFIG_TREE_PREEMPT_RCUbe enabled withoutCONFIG_PREEMPT?
Sorry, I replied to Paul, and my reply was off-topic, it has nothing related your reports. Sorry again.
I think we need two combinations for testing (not mainline, but I think they (combinations) should be enabled for test farms).
So I hope Paul enable them (combinations).
combination1: CONFIG_TREE_PREEMPT_RCU=n & CONFIG_PREEMPT=y
combination2: CONFIG_TREE_PREEMPT_RCU=y & CONFIG_PREEMPT=n
The core code should work correctly in these combinations.
I agree with Paul that these combinations should not be enabled in production, So my request is: enable these combinations under CONFIG_RCU_TRACE or CONFIG_TREE_RCU_TRACE.
For myself, I always edit the Kconfig directly, thus it is not a problem for me. But there is no way for test farms to test these combinations.
Thanks,
Lai
Quoted 13 lines
If you mean both enabled, I already reported a call trace with
both enabled:https://bugzilla.kernel.org/show_bug.cgi?id=85941
Please see my previous answer to Linus and Paul too.
Regarding
CONFIG_RCU_TRACE, do you mean
"CONFIG_TREE_RCU_TRACE"? I couldn't findCONFIG_RCU_TRACE.Thanks.
Quoted 3 lines · On Tue, 2 Dec 2014 14:10:33 -0800 Linus Torvalds…
There's 13k+ commits in between 3.16 and 3.17, so a full bisect should be around 15 test-points. But judging by the timing of your emails, you can generally reproduce this relatively quickly..
Ok Linus and Paul, it took me almost 5 hours to bisect it and
the result is:
c9b88e9581828bb8bba06c5e7ee8ed1761172b6e is the first bad commit
I hope I didn't get any false positive/negative during
bisect.
And here's the complete bisect log (just in case):
git bisect start
# good: [19583ca584d6f574384e17fe7613dfaeadcdc4a6] Linux 3.16
git bisect good 19583ca584d6f574384e17fe7613dfaeadcdc4a6
# bad: [bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9] Linux 3.17
git bisect bad bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9
# bad: [f2d7e4d4398092d14fb039cb4d38e502d3f019ee] checkpatch: add fix_insert_line and fix_delete_line helpers
git bisect bad f2d7e4d4398092d14fb039cb4d38e502d3f019ee
# bad: [79eb238c76782a59d51adf8a3dd7f6444245b475] Merge tag 'tty-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect bad 79eb238c76782a59d51adf8a3dd7f6444245b475
# good: [3d582487beb83d650fbd25cb65688b0fbedc97f1] staging: vt6656: struct vnt_private pInterruptURB rename to interrupt_urb git bisect good 3d582487beb83d650fbd25cb65688b0fbedc97f1
# bad: [e9c9eecabaa898ff3fedd98813ee4ac1a00d006a] Merge branch 'x86-cpufeature-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect bad e9c9eecabaa898ff3fedd98813ee4ac1a00d006a
# bad: [c9b88e9581828bb8bba06c5e7ee8ed1761172b6e] Merge tag 'trace-3.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
git bisect bad c9b88e9581828bb8bba06c5e7ee8ed1761172b6e
# good: [47dfe4037e37b2843055ea3feccf1c335ea23a9c] Merge branch 'for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
git bisect good 47dfe4037e37b2843055ea3feccf1c335ea23a9c
# good: [b11a6face1b6d5518319f797a74e22bb4309daa9] clk: Add missing of_clk_set_defaults export
git bisect good b11a6face1b6d5518319f797a74e22bb4309daa9
# good: [3a636388bae8390d23f31e061c0c6fdc14525786] tracing: Remove function_trace_stop and HAVE_FUNCTION_TRACE_MCOUNT_TEST git bisect good 3a636388bae8390d23f31e061c0c6fdc14525786
# good: [e17acfdc83b877794c119fac4627e80510ea3c09] Merge branch 'for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
git bisect good e17acfdc83b877794c119fac4627e80510ea3c09
# good: [c7ed326fa7cafb83ced5a8b02517a61672fe9e90] Merge tag 'ktest-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest
git bisect good c7ed326fa7cafb83ced5a8b02517a61672fe9e90
# good: [dc6f03f26f570104a2bb03f9d1deb588026d7c75] ftrace: Add warning if tramp hash does not match nr_trampolines
git bisect good dc6f03f26f570104a2bb03f9d1deb588026d7c75
# good: [ede392a75090aab49b01ecd6f7694bb9130ad461] tracing/uprobes: Kill the dead TRACE_EVENT_FL_USE_CALL_FILTER logic
git bisect good ede392a75090aab49b01ecd6f7694bb9130ad461
# good: [bb9ef1cb7d8668d6b0038b6f9f783c849135e40d] tracing: Change apply_subsystem_event_filter() paths to check file->system == dir git bisect good bb9ef1cb7d8668d6b0038b6f9f783c849135e40d
# good: [6355d54438bfc3b636cb6453cd091f782fb9b4d7] tracing: Kill "filter_string" arg of replace_preds()
git bisect good 6355d54438bfc3b636cb6453cd091f782fb9b4d7
# good: [b8c0aa46b3e86083721b57ed2eec6bd2c29ebfba] Merge tag 'trace-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
git bisect good b8c0aa46b3e86083721b57ed2eec6bd2c29ebfba
# first bad commit: [c9b88e9581828bb8bba06c5e7ee8ed1761172b6e] Merge tag 'trace-3.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Signature · 4 lines
Linux 3.16.0-00409-gb8c0aa4: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 3 lines · Dâniel Fraga
Ok Linus and Paul, it took me almost 5 hours to bisect it and
the result is:
Much faster than I expected. However:
Quoted 1 line
c9b88e9581828bb8bba06c5e7ee8ed1761172b6eis the first bad commit
Hgghnn.. A merge commit can certainly be the thing that introduces bugs, but it *usually* isn't. Especially not one that is fairly small and has no actual conflcts in it. Sure, there could be semantics conflicts etc, but that's where "fairly small" comes in - that is just not a complicated or subtle merge. And there are other reasons to believe your bisection weered off into the weeds earlier. Read on.
So:
Quoted 2 lines
I hope I didn't get any false positive/negative during
bisect.
Well, the "bad" ones should be pretty safe, since there is no question at all about any case where things locked up. So unless you actually mis-typed or did something other silly, I'll trust the ones you marked bad.
It's the ones marked "good" that are more questionable, and might be wrong, because you didn't run for long enough, and didn't happen to hit the right condition.
Your bisection log also kind of points to a mistake: it ends with a long run of "all good". That usually means that you're not actually getting closer to the bug: if you were, you'd - pretty much by definition - also get closer to the "edge" of the bug, and you should generally see a mix of good/bad as you narrow in on it. Of course, it's all statistical, so I'm not saying that a run of "good" bisections is a sure-fire sign of anything, but it's just another
sign: you may have marked something "good" that wasn't, and that actually took you *away* from the bug, so now everything that followed that false positive was good.
Quoted 1 line
And here's the complete bisect log (just in case):
So this part I'll believe in:
Quoted 7 lines
git bisect start
# good: [19583ca584d6f574384e17fe7613dfaeadcdc4a6] Linux 3.16
git bisect good19583ca584d6f574384e17fe7613dfaeadcdc4a6
# bad: [bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9] Linux 3.17
git bisect badbfe01a5ba2490f299e1d2d5508cbbbadd897bbe9
# bad: [f2d7e4d4398092d14fb039cb4d38e502d3f019ee] checkpatch: addfix_insert_lineandfix_delete_linehelpers git bisect badf2d7e4d4398092d14fb039cb4d38e502d3f019ee
Quoted 8 lines
# bad: [
79eb238c76782a59d51adf8a3dd7f6444245b475] Merge tag 'tty-3.17-rc1' ofgit://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect bad79eb238c76782a59d51adf8a3dd7f6444245b475
# good: [3d582487beb83d650fbd25cb65688b0fbedc97f1] staging: vt6656: structvnt_privatepInterruptURB rename tointerrupt_urbgit bisect good3d582487beb83d650fbd25cb65688b0fbedc97f1
# bad: [e9c9eecabaa898ff3fedd98813ee4ac1a00d006a] Merge branch 'x86-cpufeature-for-linus' ofgit://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect bade9c9eecabaa898ff3fedd98813ee4ac1a00d006a
# bad: [c9b88e9581828bb8bba06c5e7ee8ed1761172b6e] Merge tag 'trace-3.17-2' ofgit://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
git bisect badc9b88e9581828bb8bba06c5e7ee8ed1761172b6e
because anything marked "bad" clearly must be bad, and anything you marked "good" before that was probably correct too - because you saw "bad" cases after it, the good marking clearly hadn't made us ignore the bug.
Put another way: "bad" is generally more trustworthy (because you actively saw the bug), while a "good" _before_ a subsequent bad is also trustworthy (because if the "good" kernel contained the bug and you should have marked it bad, we'd then go on to test all the commits that were *not* the bug, so we'd never see a "bad" kernel again).
Of course, the above rule-of-thumb is a simplification of reality. In reality, there might be multiple bugs that come together and make the whole good-vs-bad a much less black-and-white thing, but *generally* I trust "git bisect bad" more than "git bisect good", and "git bisect good" that is followed by "bad".
What is *really* suspicious is a series of "git bisect good" with no "bad"s anywhere. Which is exactly what we see at the end of the bisect.
So might I ask you to try starting from this point again (this is why the bisect log is so useful - no need to retest the above part, you can just mindlessly do that sequence by hand without testing), and starting with this commit:
Quoted 2 lines
# good: [
47dfe4037e37b2843055ea3feccf1c335ea23a9c] Merge branch 'for-3.17' ofgit://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
git bisect good47dfe4037e37b2843055ea3feccf1c335ea23a9c
Double-check whether that commit is really good. Run that "good" kernel for a longer time, and under heavier load. Just to verify.
Because looking at the part of the bisect that seems trust-worthy, and looking at what remains (hint: do "gitk --bisect" while bisecting to see what is going on), these are the merges in that set (in my "mergelog" format):
Bjorn Helgaas (1):
PCI updates
Borislav Petkov (1):
EDAC changes
Herbert Xu (1):
crypto update
Jeff Layton (1):
file locking related changes
Mike Turquette (1):
clock framework updates
Steven Rostedt (3):
config-bisect changes
tracing updates
tracing filter cleanups
Tejun Heo (4):
workqueue updates
percpu updates
cgroup changes
libata changes
and quite frankly, for some core bug like this, I'd suspsect the workqueue or percpu updates from Tejun (possibly cgroup), *not* the tracing pull.
Of course, bugs can come in from anywhere, so it *could* be the tracing one, and it *could* be the merge commit, but my gut just screams that you probably missed one bad kernel, and marked it good. And it's really that very first one (ie commit 47dfe4037e37b2843055ea3feccf1c335ea23a9c) that contains most of the actually suspect code, so I'd really like you to re-test that one a lot before you call it "good" again.
Humor me.
I added Tejun to the Cc, just because I wanted to give him a heads-up that I am tentatively starting to blame him in my dark little mind..
Linus
Quoted 22 lines · On Tue, 2 Dec 2014 20:14:52 -0800 Linus Torvalds…
What is *really* suspicious is a series of "git bisect good" with no "bad"s anywhere. Which is exactly what we see at the end of the bisect.
So might I ask you to try starting from this point again (this is why the bisect log is so useful - no need to retest the above part, you can just mindlessly do that sequence by hand without testing), and starting with this commit:
Quoted 4 lines
# good: [
47dfe4037e37b2843055ea3feccf1c335ea23a9c] Merge branch 'for-3.17' ofgit://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroupgit bisect good47dfe4037e37b2843055ea3feccf1c335ea23a9cOf course, bugs can come in from anywhere, so it *could* be the tracing one, and it *could* be the merge commit, but my gut just screams that you probably missed one bad kernel, and marked it good. And it's really that very first one (ie commit
47dfe4037e37b2843055ea3feccf1c335ea23a9c) that contains most of the actually suspect code, so I'd really like you to re-test that one a lot before you call it "good" again.
Quoted 4 lines
Humor me.
I added Tejun to the Cc, just because I wanted to give him a heads-up that I am tentatively starting to blame him in my dark little mind..
:) I understand Linus. I'll try the 47dfe4037 commit you
suggested harder and I'll return tomorrow.
Signature · 4 lines
Linux 3.16.0-00409-gb8c0aa4: Shuffling Zombie Juror http://www.youtube.com/DanielFragaBR http://exchangewar.info Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
Quoted 26 lines · Lai Jiangshan
Quoted 5 lines · Dâniel Fraga
Quoted 2 lines · On Tue, 2 Dec 2014 16:40:37 +0800 Lai Jiangshan <[email protected]> wrote:
It is needed at lest for testing.
Quoted 7 lines
Quoted 3 lines
CONFIG_TREE_PREEMPT_RCU=ywithCONFIG_PREEMPT=nis needed for testing too.Please enable them (or enable them under
CONFIG_RCU_TRACE=y)Lai, sorry but I didn't understand. Do you mean both of them
enabled? Because how canCONFIG_TREE_PREEMPT_RCUbe enabled withoutCONFIG_PREEMPT?Sorry, I replied to Paul, and my reply was off-topic, it has nothing related your reports. Sorry again.
I think we need two combinations for testing (not mainline, but I think they (combinations) should be enabled for test farms).
So I hope Paul enable them (combinations).
combination1:
CONFIG_TREE_PREEMPT_RCU=n&CONFIG_PREEMPT=y
combination2:CONFIG_TREE_PREEMPT_RCU=y&CONFIG_PREEMPT=n
Quoted 7 lines
The core code should work correctly in these combinations.
I agree with Paul that these combinations should not be enabled in production, So my request is: enable these combinations underCONFIG_RCU_TRACEorCONFIG_TREE_RCU_TRACE.For myself, I always edit the
Kconfigdirectly, thus it is not a problem for me. But there is no way for test farms to test these combinations.
OK, I'll bite...
How have these two combinations helped you in your testing?
The reason I ask is that I am actually trying to -decrease- the RCU configurations, not increase them. Added configurations need to have strong justification, for example, the kernel-tracing/patching need for tasks_rcu.
Thanx, Paul
Quoted 17 lines
Thanks,
LaiQuoted 13 lines
If you mean both enabled, I already reported a call trace with
both enabled:https://bugzilla.kernel.org/show_bug.cgi?id=85941
Please see my previous answer to Linus and Paul too.
Regarding
CONFIG_RCU_TRACE, do you mean
"CONFIG_TREE_RCU_TRACE"? I couldn't findCONFIG_RCU_TRACE.Thanks.
Quoted 2 lines · Linus Torvalds
Put another way: "bad" is generally more trustworthy (because you actively saw the bug),
Makes sense, but ...
Quoted 4 lines
while a "good" _before_ a subsequent bad is
also trustworthy (because if the "good" kernel contained the bug and you should have marked it bad, we'd then go on to test all the commits that were *not* the bug, so we'd never see a "bad" kernel again).
wouldn't marking a bad commit "good" cause you to not see a *good* kernel again? Marking it "good" would seem push the search away from the bug toward the current "bad" commit.