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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
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 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 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 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 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 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 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
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 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 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 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
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 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
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
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
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 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
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
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 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 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 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 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 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
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 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 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 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 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 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 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
Peter Zijlstra
maintainerQuoted 33 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 ...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.
Quoted 5 lines
The old code that actually "walked" the page tables was more "portable", but was somewhat misleading about what was actually going on.
Comments?
While going through this thread I wondered whatever became of this patch. It seems a shame to forget about it entirely. Maybe just queued for later while hunting wabbits?
Quoted 4 lines · Peter Zijlstra
While going through this thread I wondered whatever became of this patch. It seems a shame to forget about it entirely. Maybe just queued for later while hunting wabbits?
Mel Gorman took it up, cleaned up some stuff, and I think it's in -mm or on its way there. I'm assuming it's 3.20 material by now.
Linus
Mel Gorman
reviewerQuoted 9 lines · Linus Torvalds
Quoted 4 lines · Peter Zijlstra
While going through this thread I wondered whatever became of this patch. It seems a shame to forget about it entirely. Maybe just queued for later while hunting wabbits?
Mel Gorman took it up, cleaned up some stuff, and I think it's in -mm or on its way there. I'm assuming it's 3.20 material by now.
I didn't pick up this one. My pickup and cleaning was on the PROT_NONE material for automatic NUMA balancing. It was posted way too close to the merge window for -mm. It's post 3.19-rc1 + post Christmas holiday material.
Signature · 2 lines
Mel Gorman SUSE Labs
Peter Zijlstra
maintainerQuoted 7 lines · Mel Gorman
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Peter Zijlstra
While going through this thread I wondered whatever became of this patch. It seems a shame to forget about it entirely. Maybe just queued for later while hunting wabbits?
Quoted 8 lines
Quoted 3 lines
Mel Gorman took it up, cleaned up some stuff, and I think it's in -mm or on its way there. I'm assuming it's 3.20 material by now.
I didn't pick up this one. My pickup and cleaning was on the
PROT_NONEmaterial for automatic NUMA balancing. It was posted way too close to the merge window for -mm. It's post 3.19-rc1 + post Christmas holiday material.
OK, should we just stick it in the x86 tree and see if anything explodes? ;-)
Quoted 3 lines · Peter Zijlstra
OK, should we just stick it in the x86 tree and see if anything explodes? ;-)
Gaah, I got confused about the patches.
And something did explode, it showed some Xen nasties. Xen has that odd "we don't share PMD entries between MM's" thing going on, which means that the vmalloc fault thing does actually have to occasionally walk two levels rather than just copy the top level. I'm still not sure why Xen doesn't share PMD's, since threads that shame the MM clearly can share PMD's within Xen, but I gave up on it.
That said, making x86-64 use "read_cr3()" instead of "current->active_mm" would at least make things a bit safer wrt NMI's during the task switch, of course. So *some* 32/64-bit consolidation should be done, but my patch went a bit too far for Xen.
Linus
Quoted 5 lines · Linus Torvalds
Quoted 3 lines · Peter Zijlstra
OK, should we just stick it in the x86 tree and see if anything explodes? ;-)
Quoted 8 lines
Gaah, I got confused about the patches.
And something did explode, it showed some Xen nasties. Xen has that odd "we don't share PMD entries between MM's" thing going on, which means that the vmalloc fault thing does actually have to occasionally walk two levels rather than just copy the top level. I'm still not sure why Xen doesn't share PMD's, since threads that shame the MM clearly can share PMD's within Xen, but I gave up on it.
Sounds like it's time to ask Konrad, the source of all Xen understanding :)
Linus, do you have a pointer to whatever version of the patch you tried?
--Andy
Quoted 7 lines
That said, making x86-64 use "
read_cr3()" instead of "current->active_mm" would at least make things a bit safer wrt NMI's during the task switch, of course. So *some* 32/64-bit consolidation should be done, but my patch went a bit too far for Xen.Linus
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Quoted 9 lines · Andy Lutomirski
Quoted 7 lines · Linus Torvalds
Quoted 3 lines · Peter Zijlstra
OK, should we just stick it in the x86 tree and see if anything explodes? ;-)
Gaah, I got confused about the patches.
Quoted 8 lines
Quoted 6 lines
And something did explode, it showed some Xen nasties. Xen has that odd "we don't share PMD entries between MM's" thing going on, which means that the vmalloc fault thing does actually have to occasionally walk two levels rather than just copy the top level. I'm still not sure why Xen doesn't share PMD's, since threads that shame the MM clearly can share PMD's within Xen, but I gave up on it.
Sounds like it's time to ask Konrad, the source of all Xen understanding :)
Awesome :-)
Quoted 2 lines
Linus, do you have a pointer to whatever version of the patch you tried?
The patch was this:
a) http://article.gmane.org/gmane.linux.kernel/1835331
Then Jurgen had a patch:
https://lkml.kernel.org/g/CA+55aFxSRujj=cM1NkXYvxmo=Y1hb1e3tgLhdh1JDphzV6WKRw@mail.gmail.com
which was one fix for one bug that ended up being fixed in QEMU - so it can be ignored.
But my understanding of that thread was that it said patch 'a)' did not fix Dave's issues - and the conversation went off on NMI watchdog?
I will look up the giant thread to make sense.
Quoted 16 lines
--Andy
Quoted 7 lines
That said, making x86-64 use "
read_cr3()" instead of "current->active_mm" would at least make things a bit safer wrt NMI's during the task switch, of course. So *some* 32/64-bit consolidation should be done, but my patch went a bit too far for Xen.Linus
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
Peter Zijlstra
maintainerQuoted 11 lines · Konrad Rzeszutek Wilk
Quoted 1 line
Linus, do you have a pointer to whatever version of the patch you tried?
The patch was this:
a) http://article.gmane.org/gmane.linux.kernel/1835331
Then Jurgen had a patch:
https://lkml.kernel.org/g/CA+55aFxSRujj=cM1NkXYvxmo=Y1hb1e3tgLhdh1JDphzV6WKRw@mail.gmail.com
which was one fix for one bug that ended up being fixed in QEMU - so it can be ignored.
Quoted 4 lines
But my understanding of that thread was that it said patch 'a)' did not fix Dave's issues - and the conversation went off on NMI watchdog?
I will look up the giant thread to make sense.
No, you're right in that the patch didn't solve the issue at hand and that the conversation moved on into a different direction.
But I would very much like to see it (or something very much like it) happen, because it does make the code much saner.
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.
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
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 · 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 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.
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
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
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.
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
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 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 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 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
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 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.
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 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 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 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 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
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.
--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
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.
--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
Re: [PATCH] x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
Quoted 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
Re: [PATCH] x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
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.
Linus
Re: [PATCH] x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
Quoted 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
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 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 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
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 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 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
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 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 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 10 lines · Linus Torvalds
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()':
Quoted 8 lines
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.
I just hit another one of these, but it's slightly different this time:
[child1:811] [2219] execve(name="/proc/610/attr/keycreate", argv=0x3a044bf0, envp=0x3a04c810)
this guy disappears off into the execve and never returns. A little later, another guy gets stuck on a completion after a sync:
[child0:856] [155] sync()
trinity-c0 D ffffffc000087570 0 856 612 0x00000000
Call trace: [<ffffffc000087570>] __switch_to+0x74/0x8c [<ffffffc0005350b4>] __schedule+0x204/0x670 [<ffffffc000535544>] schedule+0x24/0x74 [<ffffffc0005380a4>] schedule_timeout+0x134/0x18c [<ffffffc000536204>] wait_for_common+0x9c/0x144 [<ffffffc0005362bc>] wait_for_completion+0x10/0x1c [<ffffffc0001bbc14>] sync_inodes_sb+0x98/0x194 [<ffffffc0001c0244>] sync_inodes_one_sb+0x10/0x1c [<ffffffc0001984c8>] iterate_supers+0x10c/0x114 [<ffffffc0001c04c0>] sys_sync+0x38/0xa4
The backtrace for 811 looks bogus to me (or we're missing some entries):
trinity-c1 R running task 0 811 612 0x00000000
Call trace: [<ffffffc000087570>] __switch_to+0x74/0x8c [<ffffffc0000ecb48>] __handle_domain_irq+0x9c/0xf4 [<ffffffc000301da4>] __this_cpu_preempt_check+0x14/0x20 [<ffffffc000538a2c>] _raw_spin_lock_irq+0x18/0x58 [<ffffffc000538cb4>] _raw_spin_unlock_irq+0x1c/0x48 [<ffffffc0000fa6bc>] run_timer_softirq+0x68/0x240 [<ffffffc0000b5b2c>] __do_softirq+0x110/0x244 [<ffffffc000301d84>] debug_smp_processor_id+0x18/0x24
and, as before, it has a weird child process that I can't backtrace:
trinity-c1 R running task 0 861 811 0x00000000
Call trace:
The RCU stall detector gets cross too, but the stall ends before it has a chance to dump anything.
Will
Quoted 4 lines · Will Deacon
and, as before, it has a weird child process that I can't backtrace:
trinity-c1 R running task 0 861 811
0x00000000Call trace:
When I get these, ftrace is a godsend.
cd /sys/kernel/debug/tracing/
echo 861 >> set_ftrace_pid
echo function_graph >> current_tracer
echo 1 >> tracing_on
wait a little while
cat trace > trace.txt
repeat last two steps if necessary
(assuming it's stuck in kernel space, which /proc/861/stack should
be able to confirm. Usually when I see this problem, that just shows 0xffffffffffffffff)
Dave
Quoted 16 lines · Dave Jones
Quoted 4 lines · Will Deacon
and, as before, it has a weird child process that I can't backtrace:
trinity-c1 R running task 0 861 811
0x00000000Call trace:When I get these, ftrace is a godsend.
cd
/sys/kernel/debug/tracing/
echo 861 >>set_ftrace_pid
echofunction_graph>>current_tracer
echo 1 >>tracing_on
wait a little while
cat trace > trace.txt
Quoted 5 lines
repeat last two steps if necessary
(assuming it's stuck in kernel space, which
/proc/861/stackshould
be able to confirm. Usually when I see this problem, that just shows0xffffffffffffffff)
That would be great if I had a working shell :)
I tried enabling the thing before starting trinity, in the hope of dumping the buffer using sysrq, but now I seem to have hit an unrelated panic in the ftrace code.
Will
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 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 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 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 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
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 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 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 5 lines · Chris Mason
Quoted 3 lines · Linus Torvalds
On Tue, Dec 2, 2014 at 6:13 AM, Mike Galbraith
<[email protected]> wrote:
Quoted 7 lines
Quoted 4 lines
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.
Not sure if I mentioned in an earlier post, but when I'm local to the machine, I've disabled reboot-on-lockup, but yes the problem case is the situation where it actually does lock up afterwards.
Quoted 5 lines
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.
So I've done multiple runs against 3.17-rc1 during bisecting, and hit the case you describe, where I get a dump like below, and then it eventually recovers. (Trinity then exits because the taint flag changes).
I've been stuck on this kernel for a few days now trying to prove it good/bad one way or the other, and I'm leaning towards good, given that it recovers, even though the traces look similar.
Dave
[ 9862.915562] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c29:13237] [ 9862.915684] Modules linked in: 8021q garp stp tun fuse bnep hidp llc2 af_key nfnetlink can_bcm scsi_transport_iscsi can_raw nfc caif_socket caif af_802154 ieee802154 phonet af_rxrpc rfcomm bluetooth can pppoe pppox ppp_generic slhc irda crc_ccitt rds rose x25 atm netrom appletalk ipx p8023 psnap p8022 llc ax25 cfg80211 rfkill snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep e1000e snd_seq coretemp hwmon x86_pkg_temp_thermal nfsd kvm_intel kvm snd_seq_device snd_pcm snd_timer ptp auth_rpcgss snd shpchp oid_registry crct10dif_pclmul crc32c_intel ghash_clmulni_intel usb_debug soundcore pps_core nfs_acl microcode serio_raw pcspkr lockd sunrpc [ 9862.915987] CPU: 0 PID: 13237 Comm: trinity-c29 Not tainted 3.17.0-rc1+ #112 [ 9862.916046] task: ffff88022657dbc0 ti: ffff8800962b0000 task.ti: ffff8800962b0000 [ 9862.916071] RIP: 0010:[<ffffffff81042569>] [<ffffffff81042569>] lookup_address_in_pgd+0x89/0xe0 [ 9862.916103] RSP: 0018:ffff8800962b36a8 EFLAGS: 00000202 [ 9862.917024] RAX: ffff88024da748d0 RBX: ffffffff81164c63 RCX: 0000000000000001 [ 9862.917956] RDX: ffff8800962b3740 RSI: ffff8801a3417000 RDI: 000000024da74000 [ 9862.918891] RBP: ffff8800962b36a8 R08: 00003ffffffff000 R09: ffff880000000000 [ 9862.919828] R10: 0000000000000001 R11: 0000000000000000 R12: ffffffff81375a47 [ 9862.920758] R13: ffff8800962b3618 R14: ffff8802441d81f0 R15: fffff70c86134602 [ 9862.921681] FS: 00007f06c569f740(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 [ 9862.922603] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 9862.923526] CR2: 0000000002378590 CR3: 00000000a1ba3000 CR4: 00000000001407f0 [ 9862.924459] DR0: 00007f40a579e000 DR1: 0000000000000000 DR2: 0000000000000000 [ 9862.925386] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 9862.926342] Stack: [ 9862.927255] ffff8800962b36b8 ffffffff810425e8 ffff8800962b36c8 ffffffff810426ab [ 9862.928188] ffff8800962b37c0 ffffffff810427a0 ffffffff810bfc5e ffff8800962b36f0 [ 9862.929127] ffffffff810a89f5 ffff8800962b3768 ffffffff810c19b4 0000000000000002 [ 9862.930072] Call Trace: [ 9862.931008] [<ffffffff810425e8>] lookup_address+0x28/0x30 [ 9862.931958] [<ffffffff810426ab>] _lookup_address_cpa.isra.9+0x3b/0x40 [ 9862.932913] [<ffffffff810427a0>] __change_page_attr_set_clr+0xf0/0xab0 [ 9862.933869] [<ffffffff810bfc5e>] ? put_lock_stats.isra.23+0xe/0x30 [ 9862.934831] [<ffffffff810a89f5>] ? local_clock+0x25/0x30 [ 9862.935827] [<ffffffff810c19b4>] ? __lock_acquire.isra.31+0x264/0xa60 [ 9862.936798] [<ffffffff8109bfed>] ? finish_task_switch+0x7d/0x120 [ 9862.937765] [<ffffffff810bfc5e>] ? put_lock_stats.isra.23+0xe/0x30 [ 9862.938730] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 9862.939698] [<ffffffff8104418b>] kernel_map_pages+0x7b/0x120 [ 9862.940653] [<ffffffff81178517>] get_page_from_freelist+0x497/0xaa0 [ 9862.941597] [<ffffffff81179498>] __alloc_pages_nodemask+0x228/0xb20 [ 9862.942539] [<ffffffff810a89f5>] ? local_clock+0x25/0x30 [ 9862.943469] [<ffffffff810c19b4>] ? __lock_acquire.isra.31+0x264/0xa60 [ 9862.944411] [<ffffffff8135fe50>] ? __radix_tree_preload+0x60/0xf0 [ 9862.945357] [<ffffffff8135fe50>] ? __radix_tree_preload+0x60/0xf0 [ 9862.946326] [<ffffffff811c14c1>] alloc_pages_vma+0xf1/0x1b0 [ 9862.947263] [<ffffffff8118766e>] ? shmem_alloc_page+0x6e/0xc0 [ 9862.948205] [<ffffffff8118766e>] shmem_alloc_page+0x6e/0xc0 [ 9862.949148] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 9862.950090] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 9862.951012] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 9862.951913] [<ffffffff81382666>] ? __percpu_counter_add+0x86/0xb0 [ 9862.952811] [<ffffffff811a4362>] ? __vm_enough_memory+0x62/0x1c0 [ 9862.953700] [<ffffffff812eb0c7>] ? cap_vm_enough_memory+0x47/0x50 [ 9862.954591] [<ffffffff81189f00>[ 9893.337880] [sched_delayed] sched: RT throttling activated [ 9918.893057] NMI watchdog: BUG: soft lockup - CPU#1 stuck for 24s! [swapper/1:0] [ 9918.894352] Modules linked in: 8021q garp stp tun fuse bnep hidp llc2 af_key nfnetlink can_bcm scsi_transport_iscsi can_raw nfc caif_socket caif af_802154 ieee802154 phonet af_rxrpc rfcomm bluetooth can pppoe pppox ppp_generic slhc irda crc_ccitt rds rose x25 atm netrom appletalk ipx p8023 psnap p8022 llc ax25 cfg80211 rfkill snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep e1000e snd_seq coretemp hwmon x86_pkg_temp_thermal nfsd kvm_intel kvm snd_seq_device snd_pcm snd_timer ptp auth_rpcgss snd shpchp oid_registry crct10dif_pclmul crc32c_intel ghash_clmulni_intel usb_debug soundcore pps_core nfs_acl microcode serio_raw pcspkr lockd sunrpc [ 9918.901158] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G L 3.17.0-rc1+ #112 [ 9918.903863] task: ffff880242b716f0 ti: ffff88024240c000 task.ti: ffff88024240c000 [ 9918.905218] RIP: 0010:[<ffffffff81645849>] [<ffffffff81645849>] cpuidle_enter_state+0x79/0x1c0 [ 9918.906591] RSP: 0000:ffff88024240fe60 EFLAGS: 00000246 [ 9918.907933] RAX: 0000000000000000 RBX: ffff880242b716f0 RCX: 0000000000000019 [ 9918.909264] RDX: 20c49ba5e353f7cf RSI: 000000000003cea4 RDI: 00536da522b45eb6 [ 9918.910594] RBP: ffff88024240fe98 R08: 000000008baf9f86 R09: 0000000000000000 [ 9918.911916] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88024240fdf0 [ 9918.913243] R13: ffffffff810bfc5e R14: ffff88024240fdd0 R15: 00000000000001e1 [ 9918.914523] FS: 0000000000000000(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [ 9918.915815] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 9918.917108] CR2: 000000000044bfa0 CR3: 0000000001c11000 CR4: 00000000001407e0 [ 9918.918414] DR0: 00007f40a579e000 DR1: 0000000000000000 DR2: 0000000000000000 [ 9918.919710] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 9918.920998] Stack: [ 9918.922273] 00000906c89bd5bb ffffffff81cae7f0 ffffffff81d1d290 ffffe8ffff004da8 [ 9918.923576] ffff88024240c000 ffffffff81cae620 ffff88024240c000 ffff88024240fea8 [ 9918.924845] ffffffff81645a47 ffff88024240ff10 ffffffff810b9fb4 ffff88024240ffd8 [ 9918.926108] Call Trace: [ 9918.927351] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 9918.928602] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 9918.929850] [<ffffffff8102ff37>] start_secondary+0x237/0x340 [ 9918.931086] Code: d0 48 89 df ff 50 48 41 89 c5 e8 b3 5c aa ff 44 8b 63 04 49 89 c7 0f 1f 44 00 00 e8 a2 19 b0 ff fb 48 ba cf f7 53 e3 a5 9b c4 20 <4c> 2b 7d c8 4c 89 f8 49 c1 ff 3f 48 f7 ea b8 ff ff ff 7f 48 c1 [ 9918.933755] sending NMI to other CPUs: [ 9918.935008] NMI backtrace for cpu 2 [ 9918.936208] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G L 3.17.0-rc1+ #112 [ 9918.938592] task: ffff880242b744d0 ti: ffff880242414000 task.ti: ffff880242414000 [ 9918.939793] RIP: 0010:[<ffffffff813c9e65>] [<ffffffff813c9e65>] intel_idle+0xd5/0x180 [ 9918.941003] RSP: 0018:ffff880242417e20 EFLAGS: 00000046 [ 9918.942191] RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 [ 9918.943369] RDX: 0000000000000000 RSI: ffff880242417fd8 RDI: 0000000000000002 [ 9918.944535] RBP: ffff880242417e50 R08: 000000008baf9f86 R09: 0000000000000000 [ 9918.945695] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 [ 9918.946856] R13: 0000000000000032 R14: 0000000000000004 R15: ffff880242414000 [ 9918.948013] FS: 0000000000000000(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 [ 9918.949175] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 9918.950339] CR2: 000000000068f760 CR3: 0000000001c11000 CR4: 00000000001407e0 [ 9918.951515] DR0: 00007f40a579e000 DR1: 0000000000000000 DR2: 0000000000000000 [ 9918.952678] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 9918.953840] Stack: [ 9918.954988] 0000000242414000 d7251be6f43cb9e7 ffffe8ffff204da8 0000000000000005 [ 9918.956164] ffffffff81cae620 0000000000000002 ffff880242417e98 ffffffff81645825 [ 9918.957345] 00000906cb95d0a1 ffffffff81cae7f0 ffffffff81d1d290 ffffe8ffff204da8 [ 9918.958527] Call Trace: [ 9918.959692] [<ffffffff81645825>] cpuidle_enter_state+0x55/0x1c0 [ 9918.960866] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 9918.962029] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 9918.963185] [<ffffffff8102ff37>] start_secondary+0x237/0x340 [ 9918.964339] 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 [ 9918.966852] NMI backtrace for cpu 3 [ 9918.968059] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G L 3.17.0-rc1+ #112 [ 9918.970450] task: ffff880242b72de0 ti: ffff880242418000 task.ti: ffff880242418000 [ 9918.971652] RIP: 0010:[<ffffffff813c9e65>] [<ffffffff813c9e65>] intel_idle+0xd5/0x180 [ 9918.972862] RSP: 0018:ffff88024241be20 EFLAGS: 00000046 [ 9918.974045] RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 [ 9918.975212] RDX: 0000000000000000 RSI: ffff88024241bfd8 RDI: 0000000000000003 [ 9918.976349] RBP: ffff88024241be50 R08: 000000008baf9f86 R09: 0000000000000000 [ 9918.977463] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 [ 9918.978550] R13: 0000000000000032 R14: 0000000000000004 R15: ffff880242418000 [ 9918.979628] FS: 0000000000000000(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 [ 9918.980695] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 9918.981739] CR2: 00007f37d766f050 CR3: 0000000001c11000 CR4: 00000000001407e0 [ 9918.982786] DR0: 00007f40a579e000 DR1: 0000000000000000 DR2: 0000000000000000 [ 9918.983821] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 9918.984849] Stack: [ 9918.985866] 0000000342418000 63d0570b22f343d2 ffffe8ffff404da8 0000000000000005 [ 9918.986911] ffffffff81cae620 0000000000000003 ffff88024241be98 ffffffff81645825 [ 9918.987961] 00000906cb9636ab ffffffff81cae7f0 ffffffff81d1d290 ffffe8ffff404da8 [ 9918.989007] Call Trace: [ 9918.990036] [<ffffffff81645825>] cpuidle_enter_state+0x55/0x1c0 [ 9918.991072] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 9918.992097] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 9918.993127] [<ffffffff8102ff37>] start_secondary+0x237/0x340 [ 9918.994152] Code: 31 d2 65 48 8b 34 25 08 ba 00 00 48 8d 86 38 c0 ff ff 48 89 d1 0f
Quoted 4 lines · Dave Jones
I've been stuck on this kernel for a few days now trying to prove it good/bad one way or the other, and I'm leaning towards good, given that it recovers, even though the traces look similar.
Ugh. But this does *not* happen with 3.16, right? Even the non-fatal case?
If so, I'd be inclined to call it "bad". But there might well be two
bugs: one that makes that NMI watchdog trigger, and another one that then makes it be a hard lockup. I'd think it would be good to figure out the "NMI watchdog starts triggering" one first, though.
Linus
Quoted 7 lines · Linus Torvalds
Quoted 4 lines · Dave Jones
I've been stuck on this kernel for a few days now trying to prove it good/bad one way or the other, and I'm leaning towards good, given that it recovers, even though the traces look similar.
Ugh. But this does *not* happen with 3.16, right? Even the non-fatal case?
correct. at least not in any of the runs that I did to date.
Quoted 4 lines
If so, I'd be inclined to call it "bad". But there might well be two
bugs: one that makes that NMI watchdog trigger, and another one that then makes it be a hard lockup. I'd think it would be good to figure out the "NMI watchdog starts triggering" one first, though.
I think you're right.
So right after sending my last mail, I rebooted, and restarted the run on the same kernel again.
As I was writing this mail, this happened.
[ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]
and that's all that made it over the console. I couldn't log in via ssh, and thought "ah-ha, so it IS bad". I walked over to reboot it, and found I could actually log in on the console. check out this dmesg..
[ 503.683055] Clocksource tsc unstable (delta = -95946009388 ns) [ 503.692038] Switched to clocksource hpet [ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182] [ 524.420972] Modules linked in: fuse tun rfcomm llc2 af_key nfnetlink scsi_transport_iscsi can_bcm bnep can_raw 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 nfsd auth_rpcgss oid_registry nfs_acl lockd sunrpc snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec crct10dif_pclmul crc32c_intel ghash_clmulni_intel e1000e snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer microcode snd serio_raw pcspkr usb_debug ptp pps_core shpchp soundcore [ 524.421288] CPU: 0 PID: 20182 Comm: trinity-c178 Not tainted 3.17.0-rc1+ #112 [ 524.421351] task: ffff8801cd63c4d0 ti: ffff8801d2138000 task.ti: ffff8801d2138000 [ 524.421377] RIP: 0010:[<ffffffff8136968d>] [<ffffffff8136968d>] copy_user_handle_tail+0x6d/0x90 [ 524.421411] RSP: 0018:ffff8801d213bf00 EFLAGS: 00000202 [ 524.421430] RAX: 000000000007a8d9 RBX: ffffffff817b2c64 RCX: 0000000000000000 [ 524.421455] RDX: 0000000000056ddc RSI: ffff88023412baf5 RDI: ffff88023412baf4 [ 524.421480] RBP: ffff8801d213bf00 R08: 0000000000000000 R09: 0000000000000000 [ 524.421504] R10: 0000000000000100 R11: 0000000000000000 R12: ffffffff817b92d0 [ 524.421528] R13: 00007f6a24fe0000 R14: ffff8801d2138000 R15: 0000000000000001 [ 524.421552] FS: 00007f6a24fd0740(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 [ 524.421579] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 524.421600] CR2: 00007f6a24fe0000 CR3: 00000002053c8000 CR4: 00000000001407f0 [ 524.421624] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 524.421648] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 524.421672] Stack: [ 524.421683] ffff8801d213bf78 ffffffff812e4a85 00007f6a2452f068 0000000000000000 [ 524.421716] ffffffff3fffffff 00000000000003e8 00007f6a2452f000 00000000000000f8 [ 524.421748] 0000000000000000 00000000a417dc9d 00000000000000f8 00007f6a2452f000 [ 524.421781] Call Trace: [ 524.422754] [<ffffffff812e4a85>] SyS_add_key+0xd5/0x240 [ 524.423736] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 524.424713] Code: c0 74 d3 85 d2 89 d0 74 39 85 c9 74 35 45 31 c0 eb 0c 0f 1f 40 00 83 ea 01 74 17 48 89 f7 48 8d 77 01 44 89 c1 0f 1f 00 c6 07 00 <0f> 1f 00 85 c9 74 e4 0f 1f 00 5d c3 0f 1f 80 00 00 00 00 31 c0 [ 524.426861] sending NMI to other CPUs: [ 524.427867] NMI backtrace for cpu 3 [ 524.428868] CPU: 3 PID: 20165 Comm: trinity-c161 Not tainted 3.17.0-rc1+ #112 [ 524.430914] task: ffff8801fe67dbc0 ti: ffff8801fe70c000 task.ti: ffff8801fe70c000 [ 524.431951] RIP: 0010:[<ffffffff810f99da>] [<ffffffff810f99da>] generic_exec_single+0xea/0x1a0 [ 524.433004] RSP: 0018:ffff8801fe70fc40 EFLAGS: 00000202 [ 524.434051] RAX: 0000000000000000 RBX: ffff8801fe70fc40 RCX: 0000000000000038 [ 524.435108] RDX: 00000000000000ff RSI: 0000000000000008 RDI: 0000000000000000 [ 524.436165] RBP: ffff8801fe70fc90 R08: ffff880242bfa3f0 R09: 0000000000000000 [ 524.437221] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 524.438278] R13: 0000000000000001 R14: ffff880238ef1290 R15: ffffffff8115fd30 [ 524.439339] FS: 00007f6a24fd0740(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 [ 524.440415] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 524.441494] CR2: 00007f6a23446001 CR3: 00000001cd627000 CR4: 00000000001407e0 [ 524.442579] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 524.443665] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 524.444749] Stack: [ 524.445825] 0000000000000000 ffffffff8115fd30 ffff880238ef1290 0000000000000003 [ 524.446926] 00000000af3b5f31 00000000ffffffff 0000000000000000 ffffffff8115fd30 [ 524.448028] ffff880238ef1290 0000000000000001 ffff8801fe70fcd0 ffffffff810f9b5a [ 524.449115] Call Trace: [ 524.450179] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 524.451259] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 524.452334] [<ffffffff810f9b5a>] smp_call_function_single+0x6a/0xe0 [ 524.453411] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 524.454483] [<ffffffff8116036a>] perf_event_read+0xca/0xd0 [ 524.455549] [<ffffffff81160400>] perf_event_read_value+0x90/0xe0 [ 524.456618] [<ffffffff81161b1e>] perf_read+0x20e/0x360 [ 524.457689] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 524.458761] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 524.459827] [<ffffffff811dfdd3>] do_loop_readv_writev+0x63/0x90 [ 524.460887] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 524.461944] [<ffffffff811e1c97>] do_readv_writev+0x267/0x280 [ 524.462996] [<ffffffff81375a47>] ? debug_smp_processor_id+0x17/0x20 [ 524.464029] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 524.465040] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 524.466027] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 524.466995] [<ffffffff817b1377>] ? _raw_spin_unlock_irq+0x37/0x60 [ 524.467940] [<ffffffff810e672a>] ? do_setitimer+0x1ca/0x250 [ 524.468874] [<ffffffff811e1ce9>] vfs_readv+0x39/0x50 [ 524.469791] [<ffffffff811e1dac>] SyS_readv+0x5c/0x100 [ 524.470689] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 524.471568] Code: 00 4c 1d 00 48 89 de 48 03 14 c5 e0 af d1 81 48 89 df e8 5a 47 27 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 d0 65 48 33 0c 25 28 00 00 00 [ 524.473500] NMI backtrace for cpu 1 [ 524.473584] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 45.633 msecs [ 524.475347] CPU: 1 PID: 20241 Comm: trinity-c237 Not tainted 3.17.0-rc1+ #112 [ 524.477246] task: ffff8801e32c16f0 ti: ffff88008696c000 task.ti: ffff88008696c000 [ 524.478212] RIP: 0010:[<ffffffff810f99d8>] [<ffffffff810f99d8>] generic_exec_single+0xe8/0x1a0 [ 524.479189] RSP: 0018:ffff88008696fc40 EFLAGS: 00000202 [ 524.480152] RAX: ffff880062d6bc00 RBX: ffff88008696fc40 RCX: ffff880062d6bc40 [ 524.481130] RDX: ffff8802441d4c00 RSI: ffff88008696fc40 RDI: ffff88008696fc40 [ 524.482108] RBP: ffff88008696fc90 R08: 0000000000000001 R09: 0000000000000001 [ 524.483084] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 524.484051] R13: 0000000000000001 R14: ffff880238ef1bd8 R15: ffffffff8115fd30 [ 524.485022] FS: 00007f6a24fd0740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [ 524.486001] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 524.486975] CR2: 0000000000000000 CR3: 00000000869c1000 CR4: 00000000001407e0 [ 524.487952] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 524.488935] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 524.489891] Stack: [ 524.490817] ffff880062d6bc40 ffffffff8115fd30 ffff880238ef1bd8 0000000000000003 [ 524.491770] 00000000d88cff08 00000000ffffffff 0000000000000000 ffffffff8115fd30 [ 524.492729] ffff880238ef1bd8 0000000000000001 ffff88008696fcd0 ffffffff810f9b5a [ 524.493684] Call Trace: [ 524.494611] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 524.495530] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 524.496433] [<ffffffff810f9b5a>] smp_call_function_single+0x6a/0xe0 [ 524.497334] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 524.498227] [<ffffffff8116036a>] perf_event_read+0xca/0xd0 [ 524.499117] [<ffffffff81160400>] perf_event_read_value+0x90/0xe0 [ 524.500007] [<ffffffff81161b1e>] perf_read+0x20e/0x360 [ 524.500895] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 524.501786] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 524.502668] [<ffffffff811dfdd3>] do_loop_readv_writev+0x63/0x90 [ 524.503548] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 524.504419] [<ffffffff811e1c97>] do_readv_writev+0x267/0x280 [ 524.505295] [<ffffffff81375a47>] ? debug_smp_processor_id+0x17/0x20 [ 524.506172] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 524.507045] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 524.507911] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 524.508774] [<ffffffff817b1377>] ? _raw_spin_unlock_irq+0x37/0x60 [ 524.509634] [<ffffffff810e672a>] ? do_setitimer+0x1ca/0x250 [ 524.510488] [<ffffffff811e1ce9>] vfs_readv+0x39/0x50 [ 524.511330] [<ffffffff811e1dac>] SyS_readv+0x5c/0x100 [ 524.512180] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 524.513026] Code: c7 c2 00 4c 1d 00 48 89 de 48 03 14 c5 e0 af d1 81 48 89 df e8 5a 47 27 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 d0 65 48 33 0c 25 28 00 [ 524.514900] NMI backtrace for cpu 2 [ 524.514903] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 87.033 msecs [ 524.516709] CPU: 2 PID: 20160 Comm: trinity-c156 Not tainted 3.17.0-rc1+ #112 [ 524.518568] task: ffff88006b945bc0 ti: ffff880062d68000 task.ti: ffff880062d68000 [ 524.519521] RIP: 0010:[<ffffffff810f99de>] [<ffffffff810f99de>] generic_exec_single+0xee/0x1a0 [ 524.520488] RSP: 0018:ffff880062d6bc40 EFLAGS: 00000202 [ 524.521456] RAX: ffff8801fe70fc00 RBX: ffff880062d6bc40 RCX: ffff8801fe70fc40 [ 524.522424] RDX: ffff8802441d4c00 RSI: ffff880062d6bc40 RDI: ffff880062d6bc40 [ 524.523394] RBP: ffff880062d6bc90 R08: 0000000000000001 R09: 0000000000000001 [ 524.524360] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 524.525325] R13: 0000000000000001 R14: ffff880238ef5cd0 R15: ffffffff8115fd30 [ 524.526293] FS: 00007f6a24fd0740(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 [ 524.527269] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 524.528248] CR2: 00000000019ca288 CR3: 000000007a7bb000 CR4: 00000000001407e0 [ 524.529238] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 524.530230] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 524.531200] Stack: [ 524.532141] ffff8801fe70fc40 ffffffff8115fd30 ffff880238ef5cd0 0000000000000003 [ 524.533104] 000000008b5d668d 00000000ffffffff 0000000000000000 ffffffff8115fd30 [ 524.534065] ffff880238ef5cd0 0000000000000001 ffff880062d6bcd0 ffffffff810f9b5a [ 524.535014] Call Trace: [ 524.535938] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 524.536854] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 524.537756] [<ffffffff810f9b5a>] smp_call_function_single+0x6a/0xe0 [ 524.538648] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 524.539536] [<ffffffff8116036a>] perf_event_read+0xca/0xd0 [ 524.540425] [<ffffffff81160400>] perf_event_read_value+0x90/0xe0 [ 524.541317] [<ffffffff81161b1e>] perf_read+0x20e/0x360 [ 524.542202] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 524.543089] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 524.543967] [<ffffffff811dfdd3>] do_loop_readv_writev+0x63/0x90 [ 524.544840] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 524.545709] [<ffffffff811e1c97>] do_readv_writev+0x267/0x280 [ 524.546581] [<ffffffff81375a47>] ? debug_smp_processor_id+0x17/0x20 [ 524.547455] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 524.548327] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 524.549188] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 524.550046] [<ffffffff817b1377>] ? _raw_spin_unlock_irq+0x37/0x60 [ 524.550905] [<ffffffff810e672a>] ? do_setitimer+0x1ca/0x250 [ 524.551755] [<ffffffff811e1ce9>] vfs_readv+0x39/0x50 [ 524.552600] [<ffffffff811e1dac>] SyS_readv+0x5c/0x100 [ 524.553444] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 524.554281] Code: 48 89 de 48 03 14 c5 e0 af d1 81 48 89 df e8 5a 47 27 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 d0 65 48 33 0c 25 28 00 00 00 0f 85 8e 00 [ 524.556148] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 128.279 msecs [ 548.406844] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182] [ 548.407766] Modules linked in: fuse tun rfcomm llc2 af_key nfnetlink scsi_transport_iscsi can_bcm bnep can_raw 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 nfsd auth_rpcgss oid_registry nfs_acl lockd sunrpc snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec crct10dif_pclmul crc32c_intel ghash_clmulni_intel e1000e snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer microcode snd serio_raw pcspkr usb_debug ptp pps_core shpchp soundcore [ 548.412860] CPU: 0 PID: 20182 Comm: trinity-c178 Tainted: G L 3.17.0-rc1+ #112 [ 548.414955] task: ffff8801cd63c4d0 ti: ffff8801d2138000 task.ti: ffff8801d2138000 [ 548.416020] RIP: 0010:[<ffffffff8136968d>] [<ffffffff8136968d>] copy_user_handle_tail+0x6d/0x90 [ 548.417110] RSP: 0018:ffff8801d213bf00 EFLAGS: 00000202 [ 548.418188] RAX: 000000000007a8d9 RBX: ffffffff817b2c64 RCX: 0000000000000000 [ 548.419278] RDX: 0000000000056ddc RSI: ffff88023412baf5 RDI: ffff88023412baf4 [ 548.420372] RBP: ffff8801d213bf00 R08: 0000000000000000 R09: 0000000000000000 [ 548.421473] R10: 0000000000000100 R11: 0000000000000000 R12: ffffffff817b92d0 [ 548.422576] R13: 00007f6a24fe0000 R14: ffff8801d2138000 R15: 0000000000000001 [ 548.423662] FS: 00007f6a24fd0740(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 [ 548.424731] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 548.425801] CR2: 00007f6a24fe0000 CR3: 00000002053c8000 CR4: 00000000001407f0 [ 548.426870] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 548.427923] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 548.428956] Stack: [ 548.429968] ffff8801d213bf78 ffffffff812e4a85 00007f6a2452f068 0000000000000000 [ 548.430992] ffffffff3fffffff 00000000000003e8 00007f6a2452f000 00000000000000f8 [ 548.432009] 0000000000000000 00000000a417dc9d 00000000000000f8 00007f6a2452f000 [ 548.433023] Call Trace: [ 548.434031] [<ffffffff812e4a85>] SyS_add_key+0xd5/0x240 [ 548.435046] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 548.436057] Code: c0 74 d3 85 d2 89 d0 74 39 85 c9 74 35 45 31 c0 eb 0c 0f 1f 40 00 83 ea 01 74 17 48 89 f7 48 8d 77 01 44 89 c1 0f 1f 00 c6 07 00 <0f> 1f 00 85 c9 74 e4 0f 1f 00 5d c3 0f 1f 80 00 00 00 00 31 c0 [ 548.438271] sending NMI to other CPUs: [ 548.439311] NMI backtrace for cpu 3 [ 548.440341] CPU: 3 PID: 20165 Comm: trinity-c161 Tainted: G L 3.17.0-rc1+ #112 [ 548.442472] task: ffff8801fe67dbc0 ti: ffff8801fe70c000 task.ti: ffff8801fe70c000 [ 548.443553] RIP: 0010:[<ffffffff810f99de>] [<ffffffff810f99de>] generic_exec_single+0xee/0x1a0 [ 548.444639] RSP: 0018:ffff8801fe70fc40 EFLAGS: 00000202 [ 548.445718] RAX: 0000000000000000 RBX: ffff8801fe70fc40 RCX: 0000000000000038 [ 548.446803] RDX: 00000000000000ff RSI: 0000000000000008 RDI: 0000000000000000 [ 548.447882] RBP: ffff8801fe70fc90 R08: ffff880242bfa3f0 R09: 0000000000000000 [ 548.448957] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 548.450039] R13: 0000000000000001 R14: ffff880238ef1290 R15: ffffffff8115fd30 [ 548.451120] FS: 00007f6a24fd0740(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 [ 548.452211] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 548.453305] CR2: 00007f6a23446001 CR3: 00000001cd627000 CR4: 00000000001407e0 [ 548.454411] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 548.455515] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 548.456617] Stack: [ 548.457711] 0000000000000000 ffffffff8115fd30 ffff880238ef1290 0000000000000003 [ 548.458831] 00000000af3b5f31 00000000ffffffff 0000000000000000 ffffffff8115fd30 [ 548.459954] ffff880238ef1290 0000000000000001 ffff8801fe70fcd0 ffffffff810f9b5a [ 548.461078] Call Trace: [ 548.462187] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 548.463310] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 548.464425] [<ffffffff810f9b5a>] smp_call_function_single+0x6a/0xe0 [ 548.465541] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 548.466656] [<ffffffff8116036a>] perf_event_read+0xca/0xd0 [ 548.467772] [<ffffffff81160400>] perf_event_read_value+0x90/0xe0 [ 548.468887] [<ffffffff81161b1e>] perf_read+0x20e/0x360 [ 548.470003] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 548.471127] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 548.472230] [<ffffffff811dfdd3>] do_loop_readv_writev+0x63/0x90 [ 548.473310] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 548.474375] [<ffffffff811e1c97>] do_readv_writev+0x267/0x280 [ 548.475432] [<ffffffff81375a47>] ? debug_smp_processor_id+0x17/0x20 [ 548.476470] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 548.477486] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 548.478479] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 548.479452] [<ffffffff817b1377>] ? _raw_spin_unlock_irq+0x37/0x60 [ 548.480402] [<ffffffff810e672a>] ? do_setitimer+0x1ca/0x250 [ 548.481346] [<ffffffff811e1ce9>] vfs_readv+0x39/0x50 [ 548.482266] [<ffffffff811e1dac>] SyS_readv+0x5c/0x100 [ 548.483164] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 548.484050] Code: 48 89 de 48 03 14 c5 e0 af d1 81 48 89 df e8 5a 47 27 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 d0 65 48 33 0c 25 28 00 00 00 0f 85 8e 00 [ 548.485991] NMI backtrace for cpu 2 [ 548.486903] CPU: 2 PID: 20160 Comm: trinity-c156 Tainted: G L 3.17.0-rc1+ #112 [ 548.488787] task: ffff88006b945bc0 ti: ffff880062d68000 task.ti: ffff880062d68000 [ 548.489743] RIP: 0010:[<ffffffff810f99da>] [<ffffffff810f99da>] generic_exec_single+0xea/0x1a0 [ 548.490709] RSP: 0018:ffff880062d6bc40 EFLAGS: 00000202 [ 548.491667] RAX: ffff8801fe70fc00 RBX: ffff880062d6bc40 RCX: ffff8801fe70fc40 [ 548.492629] RDX: ffff8802441d4c00 RSI: ffff880062d6bc40 RDI: ffff880062d6bc40 [ 548.493590] RBP: ffff880062d6bc90 R08: 0000000000000001 R09: 0000000000000001 [ 548.494553] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 548.495511] R13: 0000000000000001 R14: ffff880238ef5cd0 R15: ffffffff8115fd30 [ 548.496462] FS: 00007f6a24fd0740(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 [ 548.497423] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 548.498382] CR2: 00000000019ca288 CR3: 000000007a7bb000 CR4: 00000000001407e0 [ 548.499347] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 548.500305] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 548.501264] Stack: [ 548.502193] ffff8801fe70fc40 ffffffff8115fd30 ffff880238ef5cd0 0000000000000003 [ 548.503131] 000000008b5d668d 00000000ffffffff 0000000000000000 ffffffff8115fd30 [ 548.504073] ffff880238ef5cd0 0000000000000001 ffff880062d6bcd0 ffffffff810f9b5a [ 548.505015] Call Trace: [ 548.505940] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 548.506857] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 548.507753] [<ffffffff810f9b5a>] smp_call_function_single+0x6a/0xe0 [ 548.508639] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 548.509518] [<ffffffff8116036a>] perf_event_read+0xca/0xd0 [ 548.510391] [<ffffffff81160400>] perf_event_read_value+0x90/0xe0 [ 548.511261] [<ffffffff81161b1e>] perf_read+0x20e/0x360 [ 548.512130] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 548.513005] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 548.513877] [<ffffffff811dfdd3>] do_loop_readv_writev+0x63/0x90 [ 548.514740] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 548.515600] [<ffffffff811e1c97>] do_readv_writev+0x267/0x280 [ 548.516451] [<ffffffff81375a47>] ? debug_smp_processor_id+0x17/0x20 [ 548.517313] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 548.518177] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 548.519031] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 548.519878] [<ffffffff817b1377>] ? _raw_spin_unlock_irq+0x37/0x60 [ 548.520719] [<ffffffff810e672a>] ? do_setitimer+0x1ca/0x250 [ 548.521563] [<ffffffff811e1ce9>] vfs_readv+0x39/0x50 [ 548.522397] [<ffffffff811e1dac>] SyS_readv+0x5c/0x100 [ 548.523224] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 548.524052] Code: 00 4c 1d 00 48 89 de 48 03 14 c5 e0 af d1 81 48 89 df e8 5a 47 27 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 d0 65 48 33 0c 25 28 00 00 00 [ 548.525897] NMI backtrace for cpu 1 [ 548.526765] CPU: 1 PID: 20241 Comm: trinity-c237 Tainted: G L 3.17.0-rc1+ #112 [ 548.528575] task: ffff8801e32c16f0 ti: ffff88008696c000 task.ti: ffff88008696c000 [ 548.529499] RIP: 0010:[<ffffffff810f99de>] [<ffffffff810f99de>] generic_exec_single+0xee/0x1a0 [ 548.530433] RSP: 0018:ffff88008696fc40 EFLAGS: 00000202 [ 548.531363] RAX: ffff880062d6bc00 RBX: ffff88008696fc40 RCX: ffff880062d6bc40 [ 548.532305] RDX: ffff8802441d4c00 RSI: ffff88008696fc40 RDI: ffff88008696fc40 [ 548.533244] RBP: ffff88008696fc90 R08: 0000000000000001 R09: 0000000000000001 [ 548.534181] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 548.535114] R13: 0000000000000001 R14: ffff880238ef1bd8 R15: ffffffff8115fd30 [ 548.536048] FS: 00007f6a24fd0740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [ 548.536995] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 548.537936] CR2: 0000000000000000 CR3: 00000000869c1000 CR4: 00000000001407e0 [ 548.538888] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 548.539842] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 548.540795] Stack: [ 548.541745] ffff880062d6bc40 ffffffff8115fd30 ffff880238ef1bd8 0000000000000003 [ 548.542699] 00000000d88cff08 00000000ffffffff 0000000000000000 ffffffff8115fd30 [ 548.543640] ffff880238ef1bd8 0000000000000001 ffff88008696fcd0 ffffffff810f9b5a [ 548.544574] Call Trace: [ 548.545491] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 548.546404] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 548.547297] [<ffffffff810f9b5a>] smp_call_function_single+0x6a/0xe0 [ 548.548179] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 548.549053] [<ffffffff8116036a>] perf_event_read+0xca/0xd0 [ 548.549920] [<ffffffff81160400>] perf_event_read_value+0x90/0xe0 [ 548.550789] [<ffffffff81161b1e>] perf_read+0x20e/0x360 [ 548.551651] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 548.552520] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 548.553388] [<ffffffff811dfdd3>] do_loop_readv_writev+0x63/0x90 [ 548.554247] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 548.555103] [<ffffffff811e1c97>] do_readv_writev+0x267/0x280 [ 548.555952] [<ffffffff81375a47>] ? debug_smp_processor_id+0x17/0x20 [ 548.556809] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 548.557665] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 548.558511] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 548.559352] [<ffffffff817b1377>] ? _raw_spin_unlock_irq+0x37/0x60 [ 548.560189] [<ffffffff810e672a>] ? do_setitimer+0x1ca/0x250 [ 548.561021] [<ffffffff811e1ce9>] vfs_readv+0x39/0x50 [ 548.561847] [<ffffffff811e1dac>] SyS_readv+0x5c/0x100 [ 548.562664] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 548.563483] Code: 48 89 de 48 03 14 c5 e0 af d1 81 48 89 df e8 5a 47 27 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 d0 65 48 33 0c 25 28 00 00 00 0f 85 8e 00 [ 564.237567] INFO: rcu_preempt self-detected stall on CPU [ 564.238434] 0: (23495594 ticks this GP) idle=ee5/140000000000001/0 softirq=31067/31067 [ 564.239318] (t=6000 jiffies g=12425 c=12424 q=0) [ 564.240203] Task dump for CPU 0: [ 564.241078] trinity-c178 R running task 13424 20182 19467 0x10000008 [ 564.241975] ffff8801cd63c4d0 00000000a417dc9d ffff880244003dc8 ffffffff810a4406 [ 564.242880] ffffffff810a4372 0000000000000000 ffffffff81c50240 0000000000000086 [ 564.243789] ffff880244003de0 ffffffff810a83e9 0000000000000001 ffff880244003e10 [ 564.244697] Call Trace: [ 564.245597] <IRQ> [<ffffffff810a4406>] sched_show_task+0x116/0x180 [ 564.246511] [<ffffffff810a4372>] ? sched_show_task+0x82/0x180 [ 564.247420] [<ffffffff810a83e9>] dump_cpu_task+0x39/0x40 [ 564.248337] [<ffffffff810d6360>] rcu_dump_cpu_stacks+0xa0/0xe0 [ 564.249247] [<ffffffff810ddba3>] rcu_check_callbacks+0x503/0x810 [ 564.250155] [<ffffffff81375a63>] ? __this_cpu_preempt_check+0x13/0x20 [ 564.251069] [<ffffffff810e5c93>] ? hrtimer_run_queues+0x43/0x130 [ 564.251985] [<ffffffff810e43e7>] update_process_times+0x47/0x70 [ 564.252902] [<ffffffff810f4c8a>] tick_sched_timer+0x4a/0x1a0 [ 564.253796] [<ffffffff810e4a71>] ? __run_hrtimer+0x81/0x250 [ 564.254671] [<ffffffff810e4a71>] __run_hrtimer+0x81/0x250 [ 564.255541] [<ffffffff810f4c40>] ? tick_init_highres+0x20/0x20 [ 564.256404] [<ffffffff810e5697>] hrtimer_interrupt+0x107/0x260 [ 564.257251] [<ffffffff81031cc4>] local_apic_timer_interrupt+0x34/0x60 [ 564.258086] [<ffffffff817b4b8f>] smp_apic_timer_interrupt+0x3f/0x60 [ 564.258907] [<ffffffff817b2faf>] apic_timer_interrupt+0x6f/0x80 [ 564.259721] <EOI> [<ffffffff817b2c64>] ? retint_restore_args+0xe/0xe [ 564.260541] [<ffffffff8136968d>] ? copy_user_handle_tail+0x6d/0x90 [ 564.261360] [<ffffffff812e4a85>] SyS_add_key+0xd5/0x240 [ 564.262176] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 572.432766] NMI watchdog: BUG: soft lockup - CPU#2 stuck for 23s! [trinity-c156:20160] [ 572.433593] Modules linked in: fuse tun rfcomm llc2 af_key nfnetlink scsi_transport_iscsi can_bcm bnep can_raw 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 nfsd auth_rpcgss oid_registry nfs_acl lockd sunrpc snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec crct10dif_pclmul crc32c_intel ghash_clmulni_intel e1000e snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer microcode snd serio_raw pcspkr usb_debug ptp pps_core shpchp soundcore [ 572.438194] CPU: 2 PID: 20160 Comm: trinity-c156 Tainted: G L 3.17.0-rc1+ #112 [ 572.440070] task: ffff88006b945bc0 ti: ffff880062d68000 task.ti: ffff880062d68000 [ 572.441020] RIP: 0010:[<ffffffff810f99de>] [<ffffffff810f99de>] generic_exec_single+0xee/0x1a0 [ 572.441982] RSP: 0018:ffff880062d6bc40 EFLAGS: 00000202 [ 572.442935] RAX: ffff8801fe70fc00 RBX: ffffffff817b2c64 RCX: ffff8801fe70fc40 [ 572.443898] RDX: ffff8802441d4c00 RSI: ffff880062d6bc40 RDI: ffff880062d6bc40 [ 572.444868] RBP: ffff880062d6bc90 R08: 0000000000000001 R09: 0000000000000001 [ 572.445836] R10: 0000000000000000 R11: 0000000000000000 R12: ffff880062d6bbb8 [ 572.446808] R13: 0000000000406040 R14: ffff880062d68000 R15: ffff88006b945bc0 [ 572.447777] FS: 00007f6a24fd0740(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 [ 572.448759] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 572.449742] CR2: 00000000019ca288 CR3: 000000007a7bb000 CR4: 00000000001407e0 [ 572.450733] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 572.451722] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 572.452710] Stack: [ 572.453692] ffff8801fe70fc40 ffffffff8115fd30 ffff880238ef5cd0 0000000000000003 [ 572.454698] 000000008b5d668d 00000000ffffffff 0000000000000000 ffffffff8115fd30 [ 572.455712] ffff880238ef5cd0 0000000000000001 ffff880062d6bcd0 ffffffff810f9b5a [ 572.456721] Call Trace: [ 572.457721] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 572.458732] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 572.459736] [<ffffffff810f9b5a>] smp_call_function_single+0x6a/0xe0 [ 572.460745] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 572.461748] [<ffffffff8116036a>] perf_event_read+0xca/0xd0 [ 572.462763] [<ffffffff81160400>] perf_event_read_value+0x90/0xe0 [ 572.463776] [<ffffffff81161b1e>] perf_read+0x20e/0x360 [ 572.464765] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 572.465738] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 572.466709] [<ffffffff811dfdd3>] do_loop_readv_writev+0x63/0x90 [ 572.467669] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 572.468627] [<ffffffff811e1c97>] do_readv_writev+0x267/0x280 [ 572.469586] [<ffffffff81375a47>] ? debug_smp_processor_id+0x17/0x20 [ 572.470543] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 572.471493] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 572.472442] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 572.473386] [<ffffffff817b1377>] ? _raw_spin_unlock_irq+0x37/0x60 [ 572.474322] [<ffffffff810e672a>] ? do_setitimer+0x1ca/0x250 [ 572.475260] [<ffffffff811e1ce9>] vfs_readv+0x39/0x50 [ 572.476186] [<ffffffff811e1dac>] SyS_readv+0x5c/0x100 [ 572.477112] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 572.478038] Code: 48 89 de 48 03 14 c5 e0 af d1 81 48 89 df e8 5a 47 27 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 d0 65 48 33 0c 25 28 00 00 00 0f 85 8e 00 [ 572.480077] sending NMI to other CPUs: [ 572.481045] NMI backtrace for cpu 1 [ 572.482011] CPU: 1 PID: 20241 Comm: trinity-c237 Tainted: G L 3.17.0-rc1+ #112 [ 572.484001] task: ffff8801e32c16f0 ti: ffff88008696c000 task.ti: ffff88008696c000 [ 572.485020] RIP: 0010:[<ffffffff810f99de>] [<ffffffff810f99de>] generic_exec_single+0xee/0x1a0 [ 572.486053] RSP: 0018:ffff88008696fc40 EFLAGS: 00000202 [ 572.487084] RAX: ffff880062d6bc00 RBX: ffff88008696fc40 RCX: ffff880062d6bc40 [ 572.488124] RDX: ffff8802441d4c00 RSI: ffff88008696fc40 RDI: ffff88008696fc40 [ 572.489163] RBP: ffff88008696fc90 R08: 0000000000000001 R09: 0000000000000001 [ 572.490199] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 572.491231] R13: 0000000000000001 R14: ffff880238ef1bd8 R15: ffffffff8115fd30 [ 572.492262] FS: 00007f6a24fd0740(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [ 572.493299] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 572.494343] CR2: 0000000000000000 CR3: 00000000869c1000 CR4: 00000000001407e0 [ 572.495380] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 572.496396] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 572.497393] Stack: [ 572.498357] ffff880062d6bc40 ffffffff8115fd30 ffff880238ef1bd8 0000000000000003 [ 572.499325] 00000000d88cff08 00000000ffffffff 0000000000000000 ffffffff8115fd30 [ 572.500276] ffff880238ef1bd8 0000000000000001 ffff88008696fcd0 ffffffff810f9b5a [ 572.501223] Call Trace: [ 572.502140] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 572.503053] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 572.503947] [<ffffffff810f9b5a>] smp_call_function_single+0x6a/0xe0 [ 572.504837] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 572.505720] [<ffffffff8116036a>] perf_event_read+0xca/0xd0 [ 572.506600] [<ffffffff81160400>] perf_event_read_value+0x90/0xe0 [ 572.507477] [<ffffffff81161b1e>] perf_read+0x20e/0x360 [ 572.508350] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 572.509229] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 572.510102] [<ffffffff811dfdd3>] do_loop_readv_writev+0x63/0x90 [ 572.510968] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 572.511828] [<ffffffff811e1c97>] do_readv_writev+0x267/0x280 [ 572.512689] [<ffffffff81375a47>] ? debug_smp_processor_id+0x17/0x20 [ 572.513556] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 572.514413] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 572.515267] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 572.516114] [<ffffffff817b1377>] ? _raw_spin_unlock_irq+0x37/0x60 [ 572.516958] [<ffffffff810e672a>] ? do_setitimer+0x1ca/0x250 [ 572.517794] [<ffffffff811e1ce9>] vfs_readv+0x39/0x50 [ 572.518627] [<ffffffff811e1dac>] SyS_readv+0x5c/0x100 [ 572.519462] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 572.520291] Code: 48 89 de 48 03 14 c5 e0 af d1 81 48 89 df e8 5a 47 27 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 d0 65 48 33 0c 25 28 00 00 00 0f 85 8e 00 [ 572.522141] NMI backtrace for cpu 3 [ 572.523018] CPU: 3 PID: 20165 Comm: trinity-c161 Tainted: G L 3.17.0-rc1+ #112 [ 572.524827] task: ffff8801fe67dbc0 ti: ffff8801fe70c000 task.ti: ffff8801fe70c000 [ 572.525748] RIP: 0010:[<ffffffff810f99de>] [<ffffffff810f99de>] generic_exec_single+0xee/0x1a0 [ 572.526677] RSP: 0018:ffff8801fe70fc40 EFLAGS: 00000202 [ 572.527605] RAX: 0000000000000000 RBX: ffff8801fe70fc40 RCX: 0000000000000038 [ 572.528545] RDX: 00000000000000ff RSI: 0000000000000008 RDI: 0000000000000000 [ 572.529480] RBP: ffff8801fe70fc90 R08: ffff880242bfa3f0 R09: 0000000000000000 [ 572.530416] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 572.531350] R13: 0000000000000001 R14: ffff880238ef1290 R15: ffffffff8115fd30 [ 572.532287] FS: 00007f6a24fd0740(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 [ 572.533230] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 572.534174] CR2: 00007f6a23446001 CR3: 00000001cd627000 CR4: 00000000001407e0 [ 572.535133] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 572.536091] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 572.537048] Stack: [ 572.537979] 0000000000000000 ffffffff8115fd30 ffff880238ef1290 0000000000000003 [ 572.538915] 00000000af3b5f31 00000000ffffffff 0000000000000000 ffffffff8115fd30 [ 572.539850] ffff880238ef1290 0000000000000001 ffff8801fe70fcd0 ffffffff810f9b5a [ 572.540790] Call Trace: [ 572.541711] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 572.542629] [<ffffffff8115fd30>] ? perf_duration_warn+0x70/0x70 [ 572.543522] [<ffffffff810f9b5a>] smp_call_function_single+0x6a/0xe0 [ 572.544408] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 572.545285] [<ffffffff8116036a>] perf_event_read+0xca/0xd0 [ 572.546154] [<ffffffff81160400>] perf_event_read_value+0x90/0xe0 [ 572.547027] [<ffffffff81161b1e>] perf_read+0x20e/0x360 [ 572.547890] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 572.548765] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 572.549637] [<ffffffff811dfdd3>] do_loop_readv_writev+0x63/0x90 [ 572.550497] [<ffffffff81161910>] ? cpu_clock_event_init+0x40/0x40 [ 572.551353] [<ffffffff811e1c97>] do_readv_writev+0x267/0x280 [ 572.552210] [<ffffffff81375a47>] ? debug_smp_processor_id+0x17/0x20 [ 572.553066] [<ffffffff810bffc6>] ? lock_release_holdtime.part.24+0xe6/0x160 [ 572.553924] [<ffffffff810a2c5d>] ? get_parent_ip+0xd/0x50 [ 572.554775] [<ffffffff810a2dbb>] ? preempt_count_sub+0x6b/0xf0 [ 572.555618] [<ffffffff817b1377>] ? _raw_spin_unlock_irq+0x37/0x60 [ 572.556453] [<ffffffff810e672a>] ? do_setitimer+0x1ca/0x250 [ 572.557284] [<ffffffff811e1ce9>] vfs_readv+0x39/0x50 [ 572.558111] [<ffffffff811e1dac>] SyS_readv+0x5c/0x100 [ 572.558934] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 572.559756] Code: 48 89 de 48 03 14 c5 e0 af d1 81 48 89 df e8 5a 47 27 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 d0 65 48 33 0c 25 28 00 00 00 0f 85 8e 00 [ 572.561589] NMI backtrace for cpu 0 [ 572.562451] CPU: 0 PID: 20182 Comm: trinity-c178 Tainted: G L 3.17.0-rc1+ #112 [ 572.564252] task: ffff8801cd63c4d0 ti: ffff8801d2138000 task.ti: ffff8801d2138000 [ 572.565166] RIP: 0010:[<ffffffff8103cc16>] [<ffffffff8103cc16>] read_hpet+0x16/0x20 [ 572.566090] RSP: 0018:ffff880244003e70 EFLAGS: 00000046 [ 572.567011] RAX: 00000000e8dd201c RBX: 000000000001cc86 RCX: ffff8802441d1118 [ 572.567939] RDX: 0000000000010001 RSI: ffffffff81a86870 RDI: ffffffff81c28680 [ 572.568869] RBP: ffff880244003e70 R08: 0000000000000000 R09: 0000000000000000 [ 572.569802] R10: 0000000000000000 R11: 0000000000000000 R12: 000000854428057e [ 572.570732] R13: ffff8802441ce060 R14: ffff8802441cda80 R15: 0000008baf2377a5 [ 572.571665] FS: 00007f6a24fd0740(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 [ 572.572608] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 572.573555] CR2: 00007f6a24fe0000 CR3: 00000002053c8000 CR4: 00000000001407f0 [ 572.574508] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 572.575459] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 572.576414] Stack: [ 572.577362] ffff880244003e98 ffffffff810eb574 ffffffff810f4c63 ffff8801d213be58 [ 572.578323] ffff880244003f40 ffff880244003ec8 ffffffff810f4c63 ffff8802441cda80 [ 572.579255] ffff8802441ce060 ffff880244003f40 ffff8802441cdb08 ffff880244003f08 [ 572.580181] Call Trace: [ 572.581092] <IRQ>
[ 572.581988] [<ffffffff810eb574>] ktime_get+0x94/0x120 [ 572.582865] [<ffffffff810f4c63>] ? tick_sched_timer+0x23/0x1a0 [ 572.583735] [<ffffffff810f4c63>] tick_sched_timer+0x23/0x1a0 [ 572.584592] [<ffffffff810e4a71>] __run_hrtimer+0x81/0x250 [ 572.585447] [<ffffffff810f4c40>] ? tick_init_highres+0x20/0x20 [ 572.586297] [<ffffffff810e5697>] hrtimer_interrupt+0x107/0x260 [ 572.587148] [<ffffffff81031cc4>] local_apic_timer_interrupt+0x34/0x60 [ 572.588004] [<ffffffff817b4b8f>] smp_apic_timer_interrupt+0x3f/0x60 [ 572.588859] [<ffffffff817b2faf>] apic_timer_interrupt+0x6f/0x80 [ 572.589705] <EOI>
[ 572.590542] [<ffffffff817b2c64>] ? retint_restore_args+0xe/0xe [ 572.591379] [<ffffffff8136968d>] ? copy_user_handle_tail+0x6d/0x90 [ 572.592225] [<ffffffff812e4a85>] SyS_add_key+0xd5/0x240 [ 572.593071] [<ffffffff817b2264>] tracesys+0xdd/0xe2 [ 572.593901] Code: 00 29 c7 ba 00 00 00 00 b8 c2 ff ff ff 83 ff 7f 5d 0f 4f c2 c3 0f 1f 44 00 00 55 48 8b 05 a3 0c 0b 01 48 89 e5 8b 80 f0 00 00 00 <89> c0 5d c3 66 0f 1f 44 00 00 0f 1f 44 00 00 8b 0d d9 0b 0b 01 [ 599.566886] [sched_delayed] sched: RT throttling activated [ 599.573324] end_request: I/O error, dev sda, sector 0 [ 624.402393] NMI watchdog: BUG: soft lockup - CPU#2 stuck for 23s! [swapper/2:0] [ 624.403521] Modules linked in: fuse tun rfcomm llc2 af_key nfnetlink scsi_transport_iscsi can_bcm bnep can_raw 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 nfsd auth_rpcgss oid_registry nfs_acl lockd sunrpc snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec crct10dif_pclmul crc32c_intel ghash_clmulni_intel e1000e snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer microcode snd serio_raw pcspkr usb_debug ptp pps_core shpchp soundcore [ 624.409477] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G L 3.17.0-rc1+ #112 [ 624.411931] task: ffff880242b744d0 ti: ffff880242414000 task.ti: ffff880242414000 [ 624.413170] RIP: 0010:[<ffffffff81645849>] [<ffffffff81645849>] cpuidle_enter_state+0x79/0x1c0 [ 624.414396] RSP: 0018:ffff880242417e60 EFLAGS: 00000246 [ 624.415614] RAX: 0000000000000000 RBX: ffff880242b744d0 RCX: 0000000000000019 [ 624.416843] RDX: 20c49ba5e353f7cf RSI: 000000000003cd60 RDI: 002e512580cfca6e [ 624.418074] RBP: ffff880242417e98 R08: 000000008bafc4e0 R09: 0000000000000000 [ 624.419397] R10: 0000000000000000 R11: 0000000000000000 R12: ffff880242417df0 [ 624.420626] R13: ffffffff810bfc5e R14: ffff880242417dd0 R15: 0000000000000210 [ 624.421864] FS: 0000000000000000(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 [ 624.423132] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 624.424380] CR2: 00007f15cfbaf000 CR3: 0000000001c11000 CR4: 00000000001407e0 [ 624.425640] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 624.426904] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 624.428164] Stack: [ 624.429393] 0000009177337316 ffffffff81cae7f0 ffffffff81d1d290 ffffe8ffff204da8 [ 624.430630] ffff880242414000 ffffffff81cae620 ffff880242414000 ffff880242417ea8 [ 624.431865] ffffffff81645a47 ffff880242417f10 ffffffff810b9fb4 ffff880242417fd8 [ 624.433085] Call Trace: [ 624.434242] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 624.435413] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 624.436588] [<ffffffff8102ff37>] start_secondary+0x237/0x340 [ 624.437761] Code: d0 48 89 df ff 50 48 41 89 c5 e8 b3 5c aa ff 44 8b 63 04 49 89 c7 0f 1f 44 00 00 e8 a2 19 b0 ff fb 48 ba cf f7 53 e3 a5 9b c4 20 <4c> 2b 7d c8 4c 89 f8 49 c1 ff 3f 48 f7 ea b8 ff ff ff 7f 48 c1 [ 624.440251] sending NMI to other CPUs: [ 624.441500] NMI backtrace for cpu 1 [ 624.442624] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G L 3.17.0-rc1+ #112 [ 624.444912] task: ffff880242b716f0 ti: ffff88024240c000 task.ti: ffff88024240c000 [ 624.446070] RIP: 0010:[<ffffffff813c9e65>] [<ffffffff813c9e65>] intel_idle+0xd5/0x180 [ 624.447236] RSP: 0018:ffff88024240fe20 EFLAGS: 00000046 [ 624.448397] RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 [ 624.449570] RDX: 0000000000000000 RSI: ffff88024240ffd8 RDI: 0000000000000001 [ 624.450735] RBP: ffff88024240fe50 R08: 000000008bafc4e0 R09: 0000000000000000 [ 624.451894] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 [ 624.453053] R13: 0000000000000032 R14: 0000000000000004 R15: ffff88024240c000 [ 624.454213] FS: 0000000000000000(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [ 624.455369] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 624.456531] CR2: 0000000000497120 CR3: 0000000001c11000 CR4: 00000000001407e0 [ 624.457707] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 624.458881] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 624.460056] Stack: [ 624.461220] 000000014240c000 0d2996f8aba02290 ffffe8ffff004da8 0000000000000005 [ 624.462418] ffffffff81cae620 0000000000000001 ffff88024240fe98 ffffffff81645825 [ 624.463622] 000000917994f078 ffffffff81cae7f0 ffffffff81d1d290 ffffe8ffff004da8 [ 624.464826] Call Trace: [ 624.466015] [<ffffffff81645825>] cpuidle_enter_state+0x55/0x1c0 [ 624.467220] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 624.468415] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 624.469607] [<ffffffff8102ff37>] start_secondary+0x237/0x340 [ 624.470800] 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 [ 624.473394] NMI backtrace for cpu 0 [ 624.474616] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G L 3.17.0-rc1+ #112 [ 624.477061] task: ffffffff81c164c0 ti: ffffffff81c00000 task.ti: ffffffff81c00000 [ 624.478299] RIP: 0010:[<ffffffff813c9e65>] [<ffffffff813c9e65>] intel_idle+0xd5/0x180 [ 624.479544] RSP: 0018:ffffffff81c03e68 EFLAGS: 00000046 [ 624.480766] RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 [ 624.481964] RDX: 0000000000000000 RSI: ffffffff81c03fd8 RDI: 0000000000000000 [ 624.483137] RBP: ffffffff81c03e98 R08: 000000008bafc4e0 R09: 0000000000000000 [ 624.484284] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 [ 624.485403] R13: 0000000000000032 R14: 0000000000000004 R15: ffffffff81c00000 [ 624.486516] FS: 0000000000000000(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 [ 624.487613] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 624.488690] CR2: 00007fd405db1000 CR3: 0000000001c11000 CR4: 00000000001407f0 [ 624.489768] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 624.490837] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 624.491894] Stack: [ 624.492941] 0000000081c00000 b6e98a804d03933a ffffe8fffee04da8 0000000000000005 [ 624.494017] ffffffff81cae620 0000000000000000 ffffffff81c03ee0 ffffffff81645825 [ 624.495096] 000000917a0eca81 ffffffff81cae7f0 ffffffff81d1d290 ffffe8fffee04da8 [ 624.496174] Call Trace: [ 624.497229] [<ffffffff81645825>] cpuidle_enter_state+0x55/0x1c0 [ 624.498294] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 624.499348] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 624.500403] [<ffffffff8179d7a0>] rest_init+0xc0/0xd0 [ 624.501458] [<ffffffff8179d6e5>] ? rest_init+0x5/0xd0 [ 624.502507] [<ffffffff81eff009>] start_kernel+0x475/0x496 [ 624.503549] [<ffffffff81efe98d>] ? set_init_arg+0x53/0x53 [ 624.504585] [<ffffffff81efe57b>] x86_64_start_reservations+0x2a/0x2c [ 624.505627] [<ffffffff81efe66e>] x86_64_start_kernel+0xf1/0xf4 [ 624.506655] 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 [ 624.508927] NMI backtrace for cpu 3 [ 624.510061] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G L 3.17.0-rc1+ #112 [ 624.512303] task: ffff880242b72de0 ti: ffff880242418000 task.ti: ffff880242418000 [ 624.513284] RIP: 0010:[<ffffffff813c9e65>] [<ffffffff813c9e65>] intel_idle+0xd5/0x180 [ 624.514281] RSP: 0000:ffff88024241be20 EFLAGS: 00000046 [ 624.515289] RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 [ 624.516286] RDX: 0000000000000000 RSI: ffff88024241bfd8 RDI: 0000000000000003 [ 624.517264] RBP: ffff88024241be50 R08: 000000008bafc4e0 R09: 0000000000000000 [ 624.518235] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 [ 624.519205] R13: 0000000000000032 R14: 0000000000000004 R15: ffff880242418000 [ 624.520169] FS: 0000000000000000(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 [ 624.521142] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 624.522100] CR2: 00000000013a4738 CR3: 0000000001c11000 CR4: 00000000001407e0 [ 624.523105] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 624.524063] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 624.525039] Stack: [ 624.526003] 0000000342418000 1e8c3d4850bfa337 ffffe8ffff404da8 0000000000000005 [ 624.526991] ffffffff81cae620 0000000000000003 ffff88024241be98 ffffffff81645825 [ 624.527953] 000000917994f2a7 ffffffff81cae7f0 ffffffff81d1d290 ffffe8ffff404da8 [ 624.528926] Call Trace: [ 624.529911] [<ffffffff81645825>] cpuidle_enter_state+0x55/0x1c0 [ 624.530911] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 624.531883] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 624.532905] [<ffffffff8102ff37>] start_secondary+0x237/0x340 [ 624.533877] 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 [ 652.386003] NMI watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [swapper/2:0] [ 652.388580] Modules linked in: fuse tun rfcomm llc2 af_key nfnetlink scsi_transport_iscsi can_bcm bnep can_raw 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 nfsd auth_rpcgss oid_registry nfs_acl lockd sunrpc snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec crct10dif_pclmul crc32c_intel ghash_clmulni_intel e1000e snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer microcode snd serio_raw pcspkr usb_debug ptp pps_core shpchp soundcore [ 652.394750] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G L 3.17.0-rc1+ #112 [ 652.397225] task: ffff880242b744d0 ti: ffff880242414000 task.ti: ffff880242414000 [ 652.398457] RIP: 0010:[<ffffffff81645849>] [<ffffffff81645849>] cpuidle_enter_state+0x79/0x1c0 [ 652.399711] RSP: 0018:ffff880242417e60 EFLAGS: 00000246 [ 652.400953] RAX: 0000000000000000 RBX: ffff880242b744d0 RCX: 0000000000000019 [ 652.402203] RDX: 20c49ba5e353f7cf RSI: 0000000000039e2e RDI: 002e6b0e8bd4c66e [ 652.403446] RBP: ffff880242417e98 R08: 000000008bafc4e0 R09: 0000000000000000 [ 652.404695] R10: 0000000000000000 R11: 0000000000000000 R12: ffff880242417df0 [ 652.405953] R13: ffffffff810bfc5e R14: ffff880242417dd0 R15: 00000000000001da [ 652.407176] FS: 0000000000000000(0000) GS:ffff880244400000(0000) knlGS:0000000000000000 [ 652.408441] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 652.409679] CR2: 00007f15cfbaf000 CR3: 0000000001c11000 CR4: 00000000001407e0 [ 652.410923] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 652.412173] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 652.413415] Stack: [ 652.414652] 00000097fc215a08 ffffffff81cae7f0 ffffffff81d1d290 ffffe8ffff204da8 [ 652.415906] ffff880242414000 ffffffff81cae620 ffff880242414000 ffff880242417ea8 [ 652.417138] ffffffff81645a47 ffff880242417f10 ffffffff810b9fb4 ffff880242417fd8 [ 652.418379] Call Trace: [ 652.419637] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 652.420917] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 652.422192] [<ffffffff8102ff37>] start_secondary+0x237/0x340 [ 652.423462] Code: d0 48 89 df ff 50 48 41 89 c5 e8 b3 5c aa ff 44 8b 63 04 49 89 c7 0f 1f 44 00 00 e8 a2 19 b0 ff fb 48 ba cf f7 53 e3 a5 9b c4 20 <4c> 2b 7d c8 4c 89 f8 49 c1 ff 3f 48 f7 ea b8 ff ff ff 7f 48 c1 [ 652.426104] sending NMI to other CPUs: [ 652.427302] NMI backtrace for cpu 0 [ 652.428449] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G L 3.17.0-rc1+ #112 [ 652.430736] task: ffffffff81c164c0 ti: ffffffff81c00000 task.ti: ffffffff81c00000 [ 652.431882] RIP: 0010:[<ffffffff813c9e65>] [<ffffffff813c9e65>] intel_idle+0xd5/0x180 [ 652.433036] RSP: 0018:ffffffff81c03e68 EFLAGS: 00000046 [ 652.434181] RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 [ 652.435341] RDX: 0000000000000000 RSI: ffffffff81c03fd8 RDI: 0000000000000000 [ 652.436491] RBP: ffffffff81c03e98 R08: 000000008bafc4e0 R09: 0000000000000000 [ 652.437642] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 [ 652.438797] R13: 0000000000000032 R14: 0000000000000004 R15: ffffffff81c00000 [ 652.439945] FS: 0000000000000000(0000) GS:ffff880244000000(0000) knlGS:0000000000000000 [ 652.441093] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 652.442234] CR2: 00007f00bcc2c000 CR3: 0000000001c11000 CR4: 00000000001407f0 [ 652.443388] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 652.444540] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 652.445680] Stack: [ 652.446808] 0000000081c00000 b6e98a804d03933a ffffe8fffee04da8 0000000000000005 [ 652.447959] ffffffff81cae620 0000000000000000 ffffffff81c03ee0 ffffffff81645825 [ 652.449111] 00000097ff1f0b6f ffffffff81cae7f0 ffffffff81d1d290 ffffe8fffee04da8 [ 652.450261] Call Trace: [ 652.451392] [<ffffffff81645825>] cpuidle_enter_state+0x55/0x1c0 [ 652.452539] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 652.453682] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 652.454825] [<ffffffff8179d7a0>] rest_init+0xc0/0xd0 [ 652.455942] [<ffffffff8179d6e5>] ? rest_init+0x5/0xd0 [ 652.457036] [<ffffffff81eff009>] start_kernel+0x475/0x496 [ 652.458123] [<ffffffff81efe98d>] ? set_init_arg+0x53/0x53 [ 652.459218] [<ffffffff81efe57b>] x86_64_start_reservations+0x2a/0x2c [ 652.460320] [<ffffffff81efe66e>] x86_64_start_kernel+0xf1/0xf4 [ 652.461419] 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 [ 652.463812] NMI backtrace for cpu 3 [ 652.464973] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G L 3.17.0-rc1+ #112 [ 652.467190] task: ffff880242b72de0 ti: ffff880242418000 task.ti: ffff880242418000 [ 652.468248] RIP: 0010:[<ffffffff813c9e65>] [<ffffffff813c9e65>] intel_idle+0xd5/0x180 [ 652.469309] RSP: 0018:ffff88024241be20 EFLAGS: 00000046 [ 652.470336] RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 [ 652.471368] RDX: 0000000000000000 RSI: ffff88024241bfd8 RDI: 0000000000000003 [ 652.472378] RBP: ffff88024241be50 R08: 000000008bafc4e0 R09: 0000000000000000 [ 652.473383] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 [ 652.474378] R13: 0000000000000032 R14: 0000000000000004 R15: ffff880242418000 [ 652.475366] FS: 0000000000000000(0000) GS:ffff880244600000(0000) knlGS:0000000000000000 [ 652.476385] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 652.477389] CR2: 00000000013a4738 CR3: 0000000001c11000 CR4: 00000000001407e0 [ 652.478379] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 652.479371] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 652.480366] Stack: [ 652.481327] 0000000342418000 1e8c3d4850bfa337 ffffe8ffff404da8 0000000000000005 [ 652.482326] ffffffff81cae620 0000000000000003 ffff88024241be98 ffffffff81645825 [ 652.483326] 00000097ff1b9892 ffffffff81cae7f0 ffffffff81d1d290 ffffe8ffff404da8 [ 652.484332] Call Trace: [ 652.485323] [<ffffffff81645825>] cpuidle_enter_state+0x55/0x1c0 [ 652.486345] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 652.487338] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 652.488335] [<ffffffff8102ff37>] start_secondary+0x237/0x340 [ 652.489322] 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 [ 652.491493] NMI backtrace for cpu 1 [ 652.492553] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G L 3.17.0-rc1+ #112 [ 652.494553] task: ffff880242b716f0 ti: ffff88024240c000 task.ti: ffff88024240c000 [ 652.495559] RIP: 0010:[<ffffffff813c9e65>] [<ffffffff813c9e65>] intel_idle+0xd5/0x180 [ 652.496585] RSP: 0018:ffff88024240fe20 EFLAGS: 00000046 [ 652.497569] RAX: 0000000000000032 RBX: 0000000000000010 RCX: 0000000000000001 [ 652.498545] RDX: 0000000000000000 RSI: ffff88024240ffd8 RDI: 0000000000000001 [ 652.499502] RBP: ffff88024240fe50 R08: 000000008bafc4e0 R09: 0000000000000000 [ 652.500452] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000005 [ 652.501398] R13: 0000000000000032 R14: 0000000000000004 R15: ffff88024240c000 [ 652.502342] FS: 0000000000000000(0000) GS:ffff880244200000(0000) knlGS:0000000000000000 [ 652.503290] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 652.504236] CR2: 00007fecce638ab8 CR3: 0000000001c11000 CR4: 00000000001407e0 [ 652.505195] DR0: 00007f6670c66000 DR1: 0000000000000000 DR2: 0000000000000000 [ 652.506202] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 [ 652.507177] Stack: [ 652.508136] 000000014240c000 0d2996f8aba02290 ffffe8ffff004da8 0000000000000005 [ 652.509122] ffffffff81cae620 0000000000000001 ffff88024240fe98 ffffffff81645825 [ 652.510113] 00000097ff1b96a9 ffffffff81cae7f0 ffffffff81d1d290 ffffe8ffff004da8 [ 652.511130] Call Trace: [ 652.512121] [<ffffffff81645825>] cpuidle_enter_state+0x55/0x1c0 [ 652.513102] [<ffffffff81645a47>] cpuidle_enter+0x17/0x20 [ 652.514086] [<ffffffff810b9fb4>] cpu_startup_entry+0x384/0x410 [ 652.515078] [<ffffffff8102ff37>] start_secondary+0x237/0x340 [ 652.516085] 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
It kept spewing lockups over and over.
Something weird that jumped out to me was this:
[ 599.573324] end_request: I/O error, dev sda, sector 0
User trinity was running under did not have permission to read block device directly, so that's just.. creepy. Hopefully not a sign of impending disk death.
Dave
Quoted 8 lines · Dave Jones
So right after sending my last mail, I rebooted, and restarted the run on the same kernel again.
As I was writing this mail, this happened.
[ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]
Quoted 7 lines
and that's all that made it over the console. I couldn't log in via ssh, and thought "ah-ha, so it IS bad". I walked over to reboot it, and found I could actually log in on the console. check out this dmesg..
[ 503.683055] Clocksource tsc unstable (delta = -95946009388 ns) [ 503.692038] Switched to clocksource hpet [ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]
Interesting. That whole NMI watchdog thing happens pretty much 22s after the "TSC unstable" message.
Have you ever seen that TSC issue before? The watchdog relies on comparing get_timestamp() differences, so if the timestamp was incorrect...
Maybe that whole "clocksource_watchdog()" is bogus. That delta is about 96 seconds, sounds very odd. I'm not seeing how the TSC could actually scew up that badly, so I'd almost be more likely to blame the "watchdog" clock.
I don't know. This piece of code:
delta = clocksource_delta(wdnow, cs->wd_last, watchdog->mask);
makes no sense to me. Shouldn't it be
delta = clocksource_delta(wdnow, watchdog->wd_last, watchdog->mask);
Thomas? John?
Linus
Quoted 17 lines · Linus Torvalds
Quoted 8 lines · Dave Jones
So right after sending my last mail, I rebooted, and restarted the run on the same kernel again.
As I was writing this mail, this happened.
[ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]Quoted 7 lines
and that's all that made it over the console. I couldn't log in via ssh, and thought "ah-ha, so it IS bad". I walked over to reboot it, and found I could actually log in on the console. check out this dmesg..
[ 503.683055] Clocksource tsc unstable (delta = -95946009388 ns) [ 503.692038] Switched to clocksource hpet [ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]
Quoted 6 lines
Interesting. That whole NMI watchdog thing happens pretty much 22s after the "TSC unstable" message.
Have you ever seen that TSC issue before? The watchdog relies on comparing
get_timestamp()differences, so if the timestamp was incorrect...
yeah, quite a lot.
# grep tsc\ unstable /var/log/messages* | wc -l 71
Usually happens pretty soon after boot, once I start the fuzzing run. It sometimes occurs quite some time before the NMI issue though.
eg:
Dec 3 11:50:24 binary kernel: [ 4253.432642] Clocksource tsc unstable (delta = -243666538341 ns) ... Dec 3 13:24:28 binary kernel: [ 9862.915562] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c29:13237]
Dave
Quoted 6 lines · Linus Torvalds
I don't know. This piece of code:
delta = clocksource_delta(wdnow, cs->wd_last, watchdog->mask);makes no sense to me.
Yeah, no, I see what's up. I missed that whole wd_last vs cs_last pairing. I guess that part is all good. There are other crazy issues in there, though, like the double test of 'watchdog_reset_pending'. So I still wonder, though, since that odd 96-second delta is just insane and makes no sense from a TSC standpoint (it's closer to a 32-bit overflow of a hpet counter, but that sounds off too).
Linus
Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Linus Torvalds
I don't know. This piece of code:
delta = clocksource_delta(wdnow, cs->wd_last, watchdog->mask);
Quoted 8 lines
Quoted 1 line
makes no sense to me.
Yeah, no, I see what's up. I missed that whole
wd_lastvscs_lastpairing. I guess that part is all good. There are other crazy issues in there, though, like the double test of 'watchdog_reset_pending'. So I still wonder, though, since that odd 96-second delta is just insane and makes no sense from a TSC standpoint (it's closer to a 32-bit overflow of a hpet counter, but that sounds off too).
fwiw, there's quite a bit of variance in the delta that seems to show up.
Clocksource tsc unstable (delta = -1010986453 ns) Clocksource tsc unstable (delta = -112130224777 ns) Clocksource tsc unstable (delta = -154880389323 ns) Clocksource tsc unstable (delta = -165033940543 ns) Clocksource tsc unstable (delta = -16610147135 ns) Clocksource tsc unstable (delta = -169783264218 ns) Clocksource tsc unstable (delta = -183044061613 ns) Clocksource tsc unstable (delta = -188697049603 ns) Clocksource tsc unstable (delta = -190100649573 ns) Clocksource tsc unstable (delta = -192732788150 ns) Clocksource tsc unstable (delta = -211622574067 ns) Clocksource tsc unstable (delta = -219378634234 ns) Clocksource tsc unstable (delta = -226609871873 ns) Clocksource tsc unstable (delta = -228355467642 ns) Clocksource tsc unstable (delta = -233950238702 ns) Clocksource tsc unstable (delta = -243666538341 ns) Clocksource tsc unstable (delta = -251535074315 ns) Clocksource tsc unstable (delta = -26880030622 ns) Clocksource tsc unstable (delta = -37899993747 ns) Clocksource tsc unstable (delta = -50471031780 ns) Clocksource tsc unstable (delta = -6821168015 ns) Clocksource tsc unstable (delta = -7067883139 ns) Clocksource tsc unstable (delta = -76682050692 ns) Clocksource tsc unstable (delta = -8296489689 ns) Clocksource tsc unstable (delta = -88373866635 ns) Clocksource tsc unstable (delta = -89099193219 ns) Clocksource tsc unstable (delta = -95946009388 ns)
(sort -u'ed post grep, the ordering here doesn't mean anything)
Dave
Quoted 2 lines · Dave Jones
fwiw, there's quite a bit of variance in the delta that seems to show up.
Yeah, anything from 1 to 251 seconds. That's definitely "quite a bit of variance"
Linus
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Dave Jones
fwiw, there's quite a bit of variance in the delta that seems to show up.
Yeah, anything from 1 to 251 seconds. That's definitely "quite a bit of variance"
But it's always negative, which means HPET is always ahead of TSC. That excludes pretty much the clocksource watchdog starvation issue which results in TSC being ahead of HPET due to a HPET wraparound (which takes ~300s).
Thanks,
tglx
Quoted 5 lines · Thomas Gleixner
But it's always negative, which means HPET is always ahead of TSC. That excludes pretty much the clocksource watchdog starvation issue which results in TSC being ahead of HPET due to a HPET wraparound (which takes ~300s).
Still, I'd be more likely to trust the TSC than the HPET on modern machines.. And DaveJ's machine isn't some old one.
Of course, there's always BIOS games. Can we read the TSC offset register and check it being constant (modulo sleep events)?
Linus
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Thomas Gleixner
But it's always negative, which means HPET is always ahead of TSC. That excludes pretty much the clocksource watchdog starvation issue which results in TSC being ahead of HPET due to a HPET wraparound (which takes ~300s).
Still, I'd be more likely to trust the TSC than the HPET on modern machines.. And DaveJ's machine isn't some old one.
Well, that does not explain the softlock watchdog which is solely relying on the TSC.
Quoted 2 lines
Of course, there's always BIOS games. Can we read the TSC offset register and check it being constant (modulo sleep events)?
The kernel does not touch it. Here is a untested hack to verify it on every local apic timer interrupt. Not nice, but simple :)
Thanks.
tglx
---
arch/x86/kernel/apic/apic.c +21 -0
@@ -554,6 +554,7 @@ static struct clock_event_device lapic_clockevent = { .irq = -1, }; static DEFINE_PER_CPU(struct clock_event_device, lapic_events); +static DEFINE_PER_CPU(u64, tsc_adjust);/* * Setup the local APIC timer for this CPU. Copy the initialized values
@@ -569,6 +570,13 @@ static void setup_APIC_timer(void) lapic_clockevent.rating =150 ; } +if (this_cpu_has (X86_FEATURE_TSC_ADJUST )) { +u64 adj; + +rdmsrl (MSR_IA32_TSC_ADJUST , adj); +__this_cpu_write (tsc_adjust, adj); + } +memcpy (levt, &lapic_clockevent,sizeof (*levt)); levt->cpumask =cpumask_of (smp_processor_id ());
@@ -912,6 +920,19 @@ static void local_apic_timer_interrupt(void)return ; } +if (this_cpu_has (X86_FEATURE_TSC_ADJUST )) { +u64 adj; + +rdmsrl (MSR_IA32_TSC_ADJUST , adj); +if (adj !=__this_cpu_read (tsc_adjust)) { +pr_err ("TSC adjustment on cpu %d changed %llu -> %llu\n" , + cpu, + (unsigned long long )__this_cpu_read (tsc_adjust), + (unsigned long long ) adj); +__this_cpu_write (tsc_adjust, adj); + } + } +/* * the NMI deadlock-detector uses this. */
Quoted 20 lines · Thomas Gleixner
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Thomas Gleixner
But it's always negative, which means HPET is always ahead of TSC. That excludes pretty much the clocksource watchdog starvation issue which results in TSC being ahead of HPET due to a HPET wraparound (which takes ~300s).
Still, I'd be more likely to trust the TSC than the HPET on modern machines.. And DaveJ's machine isn't some old one.
Well, that does not explain the softlock watchdog which is solely relying on the TSC.
Quoted 2 lines
Of course, there's always BIOS games. Can we read the TSC offset register and check it being constant (modulo sleep events)?
The kernel does not touch it. Here is a untested hack to verify it on every local apic timer interrupt. Not nice, but simple :)
arch/x86/kernel/apic/apic.c static void local_apic_timer_interrupt(void) · line 931
Quoted 4 lines
arch/x86/kernel/apic/apic.c +4
-0+pr_err ("TSC adjustment on cpu %d changed %llu -> %llu\n" , + cpu, + (unsigned long long )__this_cpu_read (tsc_adjust), + (unsigned long long ) adj);
I just got
[ 1472.614433] Clocksource tsc unstable (delta = -26373048906 ns)
without any sign of the pr_err above.
Dave
Quoted 28 lines · Dave Jones
Quoted 20 lines · Thomas Gleixner
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Thomas Gleixner
But it's always negative, which means HPET is always ahead of TSC. That excludes pretty much the clocksource watchdog starvation issue which results in TSC being ahead of HPET due to a HPET wraparound (which takes ~300s).
Still, I'd be more likely to trust the TSC than the HPET on modern machines.. And DaveJ's machine isn't some old one.
Well, that does not explain the softlock watchdog which is solely relying on the TSC.
Quoted 2 lines
Of course, there's always BIOS games. Can we read the TSC offset register and check it being constant (modulo sleep events)?
The kernel does not touch it. Here is a untested hack to verify it on every local apic timer interrupt. Not nice, but simple :)
arch/x86/kernel/apic/apic.c static void local_apic_timer_interrupt(void) · line 931
Quoted 4 lines
arch/x86/kernel/apic/apic.c +4
-0+pr_err ("TSC adjustment on cpu %d changed %llu -> %llu\n" , + cpu, + (unsigned long long )__this_cpu_read (tsc_adjust), + (unsigned long long ) adj);I just got
Quoted 3 lines
[ 1472.614433] Clocksource tsc unstable (delta = -26373048906 ns)without any sign of the
pr_errabove.
Bah. Would have been too simple ....
Could you please run Ingos time-warp test on that machine for a while?
http://people.redhat.com/mingo/time-warp-test/time-warp-test.c
Please change:
- #define TEST_CLOCK 0
+ #define TEST_CLOCK 1
I'll dig further into the time/clocksource whatever related changes post 3.16
Thanks,
tglx
Quoted 2 lines · Thomas Gleixner
Bah. Would have been too simple ....
I do think you tend to trust the hpet too much.
Yes, we've had issues with people doing bad things to the tsc, but on the whole I really would tend to trust the internal CPU counter a _lot_ more than the external hpet.
So I think it's equally (if not more) likely that switching from tsc to hpet causes trouble, because I'd trust the tsc more than the hpet.
DaveJ, do this:
Quoted 1 line
Could you please run Ingos time-warp test on that machine for a while?
but perhaps also boot with "tsc=reliable", which _should_ get rid of that CLOCK_SOURCE_MUST_VERIFY, and the clocksource watchdog should do nothing.
Thomas? Am I misreading that?
Linus
Quoted 4 lines · Linus Torvalds
Quoted 2 lines · Thomas Gleixner
Bah. Would have been too simple ....
Quoted 8 lines
I do think you tend to trust the hpet too much.
Yes, we've had issues with people doing bad things to the tsc, but on the whole I really would tend to trust the internal CPU counter a _lot_ more than the external hpet.
So I think it's equally (if not more) likely that switching from tsc to hpet causes trouble, because I'd trust the tsc more than the hpet.
Given my experience I trust neither of them too much which makes it admittedly weird to assign one as the supervisor of the other.
But yes, on newer machines the TSC tends to be halfways reliable when you are not exposed to the never ending supply of BIOS bugs.
Though, that still does not explain the softlock watchdog issue as that is completely independent of HPET.
But in the case that the clocksource switches to HPET it is not completely independent because the hrtimer event programming depends on it. But that would require the following scenario:
hrtimer_start(timer) /* timer is first to expire timer */
clockevents_program_event(timer->expires)
delta = expires - ktime_get();
evtdev->set_next_event(delta); So if ktime_get() returns an insane value in the past then delta can become large and of course nothing is going to reprogramm the clock event device unless there is a timer started which is earlier than the one which programmed the large delta.
But ktime_get() cannot return a time which is before the last update of the timekeeper. It might return something in the future, but that would expire the timer earlier not later.
So there is something else here. If the programmed next event does not fire _AND_ there is no earlier timer queued, then nothing which depends on queued timers (hrtimer/timerlist) is going to be scheduled. In the case of highres timers or nohz enabled not even the scheduler tick on that cpu would kick in. We've seen that before and it causes interesting failures ...
Now that machine has tsc_deadline_timer. I haven't seen bug reports for that one yet, but it might be worthwhile to disable that for a test.
But then that does not explain the post 3.16 issue at all.
More questions than answers, sigh.
Quoted 9 lines
DaveJ, do this:
Quoted 1 line
Could you please run Ingos time-warp test on that machine for a while?
but perhaps also boot with "tsc=reliable", which _should_ get rid of that
CLOCK_SOURCE_MUST_VERIFY, and the clocksource watchdog should do nothing.Thomas? Am I misreading that?
No, that's what it is supposed to do and I actually know that it works.
Now we could also do it the other way round and boot with "clocksource=hpet", which should show potential HPET wreckage right away when exposed to Ingos time warp test.
Thanks,
tglx
Quoted 8 lines · Thomas Gleixner
Quoted 5 lines
I just got
[ 1472.614433] Clocksource tsc unstable (delta = -26373048906 ns)without any sign of the
pr_errabove.Bah. Would have been too simple ....
Quoted 8 lines
Could you please run Ingos time-warp test on that machine for a while?
http://people.redhat.com/mingo/time-warp-test/time-warp-test.c
Please change:
- #define
TEST_CLOCK0
+ #defineTEST_CLOCK1
Seems to be 32-bit only, so I built it with -m32. I assume that's ok?
Also, should I run it in isolation, with nothing else going on, or under load where I see problems ?
Dave
Quoted 12 lines · Dave Jones
Quoted 10 lines · Thomas Gleixner
Quoted 5 lines
I just got
[ 1472.614433] Clocksource tsc unstable (delta = -26373048906 ns)without any sign of the
pr_errabove.Bah. Would have been too simple ....
Could you please run Ingos time-warp test on that machine for a while?
Quoted 8 lines
Quoted 6 lines
http://people.redhat.com/mingo/time-warp-test/time-warp-test.c
Please change:
- #define
TEST_CLOCK0
+ #defineTEST_CLOCK1Seems to be 32-bit only, so I built it with -m32. I assume that's ok?
I has some _x86_64 ifdeffery, but I'm too tired to stare at that now. 32bit should show the issue as well.
Quoted 2 lines
Also, should I run it in isolation, with nothing else going on, or under load where I see problems ?
isolated is usually the best thing as it has the highest density of reads.
Thanks,
tglx
Quoted 5 lines · Thomas Gleixner
Quoted 2 lines
Also, should I run it in isolation, with nothing else going on, or under load where I see problems ?
isolated is usually the best thing as it has the highest density of reads.
Ok, it's been running for just over an hour with no 'fails' yet. How long should I leave it ?
Dave
Quoted 10 lines · Dave Jones
Quoted 5 lines · Thomas Gleixner
Quoted 2 lines
Also, should I run it in isolation, with nothing else going on, or under load where I see problems ?
isolated is usually the best thing as it has the highest density of reads.
Ok, it's been running for just over an hour with no 'fails' yet. How long should I leave it ?
Ok, I left it running for four hours with no observed failures. I'd leave it running longer, but I might not have this machine in the new year, so I'm running out of time to complete bisections if they take a day or two to complete each step.
Dave
Quoted 29 lines · Linus Torvalds
Quoted 8 lines · Dave Jones
So right after sending my last mail, I rebooted, and restarted the run on the same kernel again.
As I was writing this mail, this happened.
[ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]Quoted 7 lines
and that's all that made it over the console. I couldn't log in via ssh, and thought "ah-ha, so it IS bad". I walked over to reboot it, and found I could actually log in on the console. check out this dmesg..
[ 503.683055] Clocksource tsc unstable (delta = -95946009388 ns) [ 503.692038] Switched to clocksource hpet [ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]Interesting. That whole NMI watchdog thing happens pretty much 22s after the "TSC unstable" message.
Have you ever seen that TSC issue before? The watchdog relies on comparing
get_timestamp()differences, so if the timestamp was incorrect...Maybe that whole "
clocksource_watchdog()" is bogus. That delta is about 96 seconds, sounds very odd. I'm not seeing how the TSC could actually scew up that badly, so I'd almost be more likely to blame the "watchdog" clock.
Quoted 7 lines
I don't know. This piece of code:
delta = clocksource_delta(wdnow, cs->wd_last, watchdog->mask);makes no sense to me. Shouldn't it be
delta = clocksource_delta(wdnow, watchdog->wd_last, watchdog->mask);
So we store wdnow value in the cs->wd_last a few lines below, so I don't think that's problematic.
I do recall seeing problematic watchdog behavior back in the day w/ PREEMPT_RT when a high priority task really starved the watchdog for a long time. When we came back the hpet had wrapped, making the wd_delta look quite small relative to the TSC delta, causing improper disqualification of the TSC.
But in that case the watchdog would disqualify the TSC after the stall, and here the stall is happening right afterwards. So I'm not sure.
I'll look around for some other suspects though. The nohz ntp improvments might be high on my list there, since it was a 3.17 item. Will dig.
thanks
-john
Quoted 39 lines · John Stultz
Quoted 29 lines · Linus Torvalds
Quoted 8 lines · Dave Jones
So right after sending my last mail, I rebooted, and restarted the run on the same kernel again.
As I was writing this mail, this happened.
[ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]Quoted 7 lines
and that's all that made it over the console. I couldn't log in via ssh, and thought "ah-ha, so it IS bad". I walked over to reboot it, and found I could actually log in on the console. check out this dmesg..
[ 503.683055] Clocksource tsc unstable (delta = -95946009388 ns) [ 503.692038] Switched to clocksource hpet [ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]Interesting. That whole NMI watchdog thing happens pretty much 22s after the "TSC unstable" message.
Have you ever seen that TSC issue before? The watchdog relies on comparing
get_timestamp()differences, so if the timestamp was incorrect...Maybe that whole "
clocksource_watchdog()" is bogus. That delta is about 96 seconds, sounds very odd. I'm not seeing how the TSC could actually scew up that badly, so I'd almost be more likely to blame the "watchdog" clock.Quoted 7 lines
I don't know. This piece of code:
delta = clocksource_delta(wdnow, cs->wd_last, watchdog->mask);makes no sense to me. Shouldn't it be
delta = clocksource_delta(wdnow, watchdog->wd_last, watchdog->mask);
Quoted 8 lines
So we store wdnow value in the
cs->wd_lasta few lines below, so I don't think that's problematic.I do recall seeing problematic watchdog behavior back in the day w/
PREEMPT_RTwhen a high priority task really starved the watchdog for a long time. When we came back the hpet had wrapped, making thewd_deltalook quite small relative to the TSC delta, causing improper disqualification of the TSC.
Right, that resulted in a delta > 0. I have no idea how we could create a negative delta via wrapping the HPET around, i.e. HPET being 96 seconds ahead of TSC.
This looks more like a genuine TSC wreckage. So we have these possible causes:
1) SMI
2) Power states
3) Writing to the wrong MSR
So I assume that 1/2 are a non issue. They should surface in normal non fuzzed operation as well.
Dave, does that TSC unstable thing always happen AFTER you started fuzzing? If yes, what is the fuzzer doing this time?
Thanks,
tglx
Quoted 11 lines · Thomas Gleixner
Right, that resulted in a delta > 0. I have no idea how we could create a negative delta via wrapping the HPET around, i.e. HPET being 96 seconds ahead of TSC.
This looks more like a genuine TSC wreckage. So we have these possible causes:
1) SMI
2) Power states
Quoted 7 lines
3) Writing to the wrong MSR
So I assume that 1/2 are a non issue. They should surface in normal non fuzzed operation as well.
Dave, does that TSC unstable thing always happen AFTER you started fuzzing? If yes, what is the fuzzer doing this time?
I've seen it even after doing just a kernel build sometimes, It's happened so regularly I've just assumed "the tsc is crap on this box".
On occasion I even see it shortly after boot, while idle.
Dave
Quoted 18 lines · Dave Jones
Quoted 16 lines · Thomas Gleixner
Right, that resulted in a delta > 0. I have no idea how we could create a negative delta via wrapping the HPET around, i.e. HPET being 96 seconds ahead of TSC.
This looks more like a genuine TSC wreckage. So we have these possible causes:
1) SMI
2) Power states
3) Writing to the wrong MSR
So I assume that 1/2 are a non issue. They should surface in normal non fuzzed operation as well.
Quoted 7 lines
Quoted 2 lines
Dave, does that TSC unstable thing always happen AFTER you started fuzzing? If yes, what is the fuzzer doing this time?
I've seen it even after doing just a kernel build sometimes, It's happened so regularly I've just assumed "the tsc is crap on this box".
On occasion I even see it shortly after boot, while idle.
Can you please provide the cpuinfo flags of that box?
Thanks,
tglx
Quoted 1 line · Thomas Gleixner
Can you please provide the cpuinfo flags of that box?
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm xsaveopt
Quoted 4 lines · Dave Jones
Quoted 1 line · Thomas Gleixner
Can you please provide the cpuinfo flags of that box?
Quoted 9 lines
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lmconstant_tscarch_perfmonpebs btsrep_goodnopl xtopologynonstop_tscaperfmperf eagerfpu pni pclmulqdq dtes64 monitords_cplvmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcidsse4_1sse4_2x2apic movbe popcnttsc_deadline_timeraes xsave avx f16c rdrandlahf_lmabm ida arat epb pln pts dthermtpr_shadowvnmi flexpriority ept vpid fsgsbasetsc_adjustbmi1 hle avx2 smep bmi2 erms invpcid rtm xsaveopt
So that has nonstop_tsc and constant_tsc, which means that we switch to sched_clock_stable, i.e. no range checks, nothing. We just take the raw value and use it.
The clocksource code is a bit more paranoid and lets the TSC be monitored by the watchdog. Now, if the TSC is detected as unstable we should switch back to sched_clock_unstable, but we don't have a mechanism for that.
That was obviously not considered when the sched_clock_stable stuff was introduced. So sched_clock() happily uses TSC as a reliable thing even when the clocksource code detected that it is crap.
For sure we need something here, but that sched_clock_stable mechanism got introduced in 3.14, so it does not make any sense that you observe that only post 3.16.
Thanks,
tglx
Quoted 3 lines · John Stultz
I'll look around for some other suspects though. The nohz ntp improvments might be high on my list there, since it was a 3.17 item. Will dig.
Neither the clocksource watchdog nor the timestamp of the kernel watchdog are affected by NTP adjustments.
Thanks,
tglx
I asked Dave for his lockups from 3.17-rc1, and they were in the flush_tlb code waiting for remote CPUs to finish flushing. It feels like that's a common theme, and there are a few commits there between 3.16 and 3.17.
One guess is that trinity is generating a huge number of tlb invalidations over sparse and horrible ranges. Perhaps the old code was falling back to full tlb flushes before Dave Hansen's string of fixes?
commit a5102476a24bce364b74f1110005542a2c964103
Author: Dave Hansen <[email protected]>
x86/mm: Set TLB flush tunable to sane value (33)
This entirely untested diff forces full tlb flushes on the remote CPUs. It adds a few parens for good luck, but the nr_pages var is only sent to ftrace, so it's not the bug we're looking for.
I'm only changing the flushes done on remote CPUs. The local CPU is still doing up to 33 fine grained flushes. That may or may not be a good idea, but my hand waiving only makes sense to me if we've got a long string of fine grained flushes from tons of procs fanning out to the remote CPUs.
arch/x86/mm/tlb.c +3 -5
@@ -120,7 +120,7 @@ static void flush_tlb_func(void *info) }else {unsigned long addr;unsigned long nr_pages = - f->flush_end - f->flush_start /PAGE_SIZE ; + (f->flush_end - f->flush_start) /PAGE_SIZE ; addr = f->flush_start;while (addr < f->flush_end) {__flush_tlb_single (addr);
@@ -214,10 +214,8 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, }trace_tlb_flush (TLB_LOCAL_MM_SHOOTDOWN , base_pages_to_flush); out: -if (base_pages_to_flush ==TLB_FLUSH_ALL ) { - start =0UL ; - end =TLB_FLUSH_ALL ; - } + start =0UL ; + end =TLB_FLUSH_ALL ;if (cpumask_any_but (mm_cpumask (mm),smp_processor_id ()) < nr_cpu_ids)flush_tlb_others (mm_cpumask (mm), mm, start, end);preempt_enable ();
Quoted 4 lines · Chris Mason
One guess is that trinity is generating a huge number of tlb invalidations over sparse and horrible ranges. Perhaps the old code was falling back to full tlb flushes before Dave Hansen's string of fixes?
Hmm. I agree that we've had some of the backtraces look like TLB flushing might be involved. Not all, though. And I'm not seeing where a loop over up to 33 pages should matter over doing a full TLB flush.
What *might* matter is if we somehow get that number wrong, and the loops like
addr = f->flush_start;
while (addr < f->flush_end) {
__flush_tlb_single(addr);
addr += PAGE_SIZE;
}ends up looping a *lot* due to some bug, and then the IPI itself would take so long that the watchdog could trigger.
But I do not see how that could actually happen. As far as I can tell, either the number of pages is limited to less than 33, or we have that
TLB_FLUSH_ALL case.
Do you see something I don't?
Linus
Quoted 20 lines · Linus Torvalds
Quoted 6 lines · Chris Mason
One guess is that trinity is generating a huge number of tlb invalidations over sparse and horrible ranges. Perhaps the old
code was
falling back to full tlb flushes before Dave Hansen's string of
fixes?Hmm. I agree that we've had some of the backtraces look like TLB flushing might be involved. Not all, though. And I'm not seeing where a loop over up to 33 pages should matter over doing a full TLB flush.
What *might* matter is if we somehow get that number wrong, and the loops like
addr = f->flush_start; while (addr < f->flush_end) { __flush_tlb_single(addr); addr += PAGE_SIZE; }
Quoted 8 lines
ends up looping a *lot* due to some bug, and then the IPI itself would take so long that the watchdog could trigger.
But I do not see how that could actually happen. As far as I can tell, either the number of pages is limited to less than 33, or we have that
TLB_FLUSH_ALLcase.Do you see something I don't?
Sadly not. Looking harder, I'm pretty sure all of the flushes coming through from this path are single page flushes anyway. So the most likely explanation is that we're waiting on the remote CPU, who is stuck somewhere secret.
-chris
Quoted 18 lines · Linus Torvalds
Quoted 4 lines · Chris Mason
One guess is that trinity is generating a huge number of tlb invalidations over sparse and horrible ranges. Perhaps the old code was falling back to full tlb flushes before Dave Hansen's string of fixes?
Hmm. I agree that we've had some of the backtraces look like TLB flushing might be involved. Not all, though. And I'm not seeing where a loop over up to 33 pages should matter over doing a full TLB flush.
What *might* matter is if we somehow get that number wrong, and the loops like
addr = f->flush_start; while (addr < f->flush_end) { __flush_tlb_single(addr); addr += PAGE_SIZE; }
Quoted 8 lines
ends up looping a *lot* due to some bug, and then the IPI itself would take so long that the watchdog could trigger.
But I do not see how that could actually happen. As far as I can tell, either the number of pages is limited to less than 33, or we have that
TLB_FLUSH_ALLcase.Do you see something I don't?
The one thing I _do_ see now is a missed TLB flush is we're flushing one page at the end of the address space. We'd overflow flush_end back so flush_end=0:
if (!f->flush_end)
f->flush_end = f->flush_start + PAGE_SIZE; <-- overflowand we'll never enter the while loop where we actually do the flush:
while (addr < f->flush_end) {
__flush_tlb_single(addr);
addr += PAGE_SIZE;
}But we have a hole up there on x86_64, so this will never happen in practice there. It might theoretically apply to 32-bit, but this still doesn't help with the bug.
Oh, and the tracepoint is spitting out bogus numbers because we need some parenthesis around the 'nr_pages' calculation.
Quoted 51 lines · Dave Hansen
Quoted 27 lines · Linus Torvalds
Quoted 6 lines · Chris Mason
One guess is that trinity is generating a huge number of tlb invalidations over sparse and horrible ranges. Perhaps the old
code was
falling back to full tlb flushes before Dave Hansen's string of
fixes?Hmm. I agree that we've had some of the backtraces look like TLB flushing might be involved. Not all, though. And I'm not seeing
where
a loop over up to 33 pages should matter over doing a full TLB
flush.What *might* matter is if we somehow get that number wrong, and the
loops likeaddr = f->flush_start; while (addr < f->flush_end) { __flush_tlb_single(addr); addr += PAGE_SIZE; }ends up looping a *lot* due to some bug, and then the IPI itself
would
take so long that the watchdog could trigger.Quoted 7 lines
But I do not see how that could actually happen. As far as I can
tell,
either the number of pages is limited to less than 33, or we have
that
TLB_FLUSH_ALLcase.Do you see something I don't?
The one thing I _do_ see now is a missed TLB flush is we're flushing one page at the end of the address space. We'd overflow
flush_endback so flush_end=0:if (!f->flush_end) f->flush_end = f->flush_start + PAGE_SIZE; <--overflow
and we'll never enter the while loop where we actually do the flush:
while (addr < f->flush_end) { __flush_tlb_single(addr); addr += PAGE_SIZE; }
Quoted 6 lines
But we have a hole up there on
x86_64, so this will never happen in practice there. It might theoretically apply to 32-bit, but this still doesn't help with the bug.Oh, and the tracepoint is spitting out bogus numbers because we need some parenthesis around the '
nr_pages' calculation.
Yeah, I didn't see any problems with your changes, but I was hoping that even a small change like doing 33 flushes at a time was pushing Dave's box just over the line.
-chris
Quoted 32 lines · Dave Jones
Quoted 1 line · Linus Torvalds
On Wed, Dec 3, 2014 at 10:41 AM, Dave Jones <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
I've been stuck on this kernel for a few days now trying to
prove it
Quoted 1 line
Quoted 1 line
good/bad one way or the other, and I'm leaning towards good,
given
Quoted 3 lines
Quoted 1 line
that it recovers, even though the traces look similar.
Ugh. But this does *not* happen with 3.16, right? Even the
non-fatal case?
correct. at least not in any of the runs that I did to date.
Quoted 1 line
If so, I'd be inclined to call it "bad". But there might well be
two
Quoted 1 line
bugs: one that makes that NMI watchdog trigger, and another one
that
Quoted 1 line
then makes it be a hard lockup. I'd think it would be good to
figure
Quoted 1 line
out the "NMI watchdog starts triggering" one first, though.
I think you're right.
So right after sending my last mail, I rebooted, and restarted the run on the same kernel again.
As I was writing this mail, this happened.
[ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]
Quoted 7 lines
and that's all that made it over the console. I couldn't log in via ssh, and thought "ah-ha, so it IS bad". I walked over to reboot it, and found I could actually log in on the console. check out this dmesg..
[ 503.683055] Clocksource tsc unstable (delta = -95946009388 ns) [ 503.692038] Switched to clocksource hpet [ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c178:20182]
Neat. We often see switching to hpet on boxes as they are diving into softlockup pain, but it's not usually before the softlockups.
Are you configured for CONFIG_NOHZ_FULL?
I'd love to blame the only commit to kernel/smp.c between 3.16 and 3.17
commit 478850160636c4f0b2558451df0e42f8c5a10939
Author: Frederic Weisbecker <[email protected]> Date: Thu May 8 01:37:48 2014 +0200
irq_work: Implement remote queueing
You've also mentioned a few times where messages stopped hitting the console?
commit 5874af2003b1aaaa053128d655710140e3187226
Author: Jan Kara <[email protected]> Date: Wed Aug 6 16:09:10 2014 -0700
printk: enable interrupts before callingconsole_trylock_for_printk()
-chris
Quoted 8 lines · Chris Mason
Quoted 3 lines
[ 503.692038] Switched to clocksource hpet [ 524.420897] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s![trinity-c178:20182]
Neat. We often see switching to hpet on boxes as they are diving into softlockup pain, but it's not usually before the softlockups.
Are you configured for
CONFIG_NOHZ_FULL?
No. I have recollections that I did run with that early on in this, but I think someone asked me to try without that a few weeks back, and it's been off since. (made no difference)
Quoted 11 lines
I'd love to blame the only commit to
kernel/smp.cbetween 3.16 and 3.17commit
478850160636c4f0b2558451df0e42f8c5a10939Author: Frederic Weisbecker <[email protected]> Date: Thu May 8 01:37:48 2014 +0200
irq_work: Implement remote queueingYou've also mentioned a few times where messages stopped hitting the console?
Quoted 6 lines
commit
5874af2003b1aaaa053128d655710140e3187226Author: Jan Kara <[email protected]> Date: Wed Aug 6 16:09:10 2014 -0700printk: enable interrupts before calling
console_trylock_for_printk()
Hmm..
Dave
Quoted 6 lines · Dave Jones
Quoted 1 line · Chris Mason
You've also mentioned a few times where messages stopped hitting
the
Quoted 2 lines
console?
Quoted 8 lines
Quoted 6 lines
commit
5874af2003b1aaaa053128d655710140e3187226Author: Jan Kara <[email protected]> Date: Wed Aug 6 16:09:10 2014 -0700printk: enable interrupts before calling
console_trylock_for_printk()Hmm..
Jan Kara has been talking about printk deadlocks for some time. I wouldn't have expected it to get worse since 3.16, but we do have a few printk cleanups and fixes in there.
-chris
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Dave Jones
I've been stuck on this kernel for a few days now trying to prove it good/bad one way or the other, and I'm leaning towards good, given that it recovers, even though the traces look similar.
Quoted 6 lines
Ugh. But this does *not* happen with 3.16, right? Even the non-fatal case?
If so, I'd be inclined to call it "bad". But there might well be two
bugs: one that makes that NMI watchdog trigger, and another one that then makes it be a hard lockup. I'd think it would be good to figure out the "NMI watchdog starts triggering" one first, though.
So I just got a definite "bad" case on 17-rc1. got NMI spew from two CPUs then the box was a boat anchor. Even keyboard stopped responding, had to power cycle it to get it back up.
Given it took 2 days to prove this one, I'm really hoping subsequent bisect branches prove themselves faster.
Dave
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Dave Jones
I've been stuck on this kernel for a few days now trying to prove it good/bad one way or the other, and I'm leaning towards good, given that it recovers, even though the traces look similar.
Quoted 6 lines
Ugh. But this does *not* happen with 3.16, right? Even the non-fatal case?
If so, I'd be inclined to call it "bad". But there might well be two
bugs: one that makes that NMI watchdog trigger, and another one that then makes it be a hard lockup. I'd think it would be good to figure out the "NMI watchdog starts triggering" one first, though.
A bisect later, and I landed on a kernel that ran for a day, before spewing NMI messages, recovering, and then..
http://codemonkey.org.uk/junk/log.txt
I could log in, but every command I tried (even shell built-ins) just printed 'bus error'.
I saw those end_request messages in an earlier bisect, I wonder if there was an actual bug that got fixed where allowed non-root to try and do bad things to raw devices. It's always sector 0 too.
Yet again, I'm wondering if this whole thing is just signs of early hardware death.
Dave
Quoted 5 lines · Dave Jones
A bisect later, and I landed on a kernel that ran for a day, before spewing NMI messages, recovering, and then..
I have to admit I'm seeing absolutely nothing sensible in there.
Call it bad, and see if bisection ends up slowly -oh so slowly - pointing to some direction. Because I don't think it's the hardware, considering that apparently 3.16 is solid. And the spews themselves are so incomprehensible that I'm not seeing any pattern what-so-ever.
Linus
Quoted 5 lines · Linus Torvalds
Quoted 4 lines · Dave Jones
A bisect later, and I landed on a kernel that ran for a day, before spewing NMI messages, recovering, and then..
Quoted 8 lines
Quoted 1 line
I have to admit I'm seeing absolutely nothing sensible in there.
Call it bad, and see if bisection ends up slowly -oh so slowly - pointing to some direction. Because I don't think it's the hardware, considering that apparently 3.16 is solid. And the spews themselves are so incomprehensible that I'm not seeing any pattern what-so-ever.
Will do.
In the meantime, I rebooted into the same kernel, and ran trinity solely doing the lsetxattr syscalls. The load was a bit lower, so I cranked up the number of child processes to 512, and then this happened..
[ 1611.746960] ------------[ cut here ]------------ [ 1611.747053] WARNING: CPU: 0 PID: 14810 at kernel/watchdog.c:265 watchdog_overflow_callback+0xd5/0x120() [ 1611.747083] Watchdog detected hard LOCKUP on cpu 0 [ 1611.747097] Modules linked in: [ 1611.747112] rfcomm hidp bnep scsi_transport_iscsi can_bcm nfnetlink can_raw 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 e1000e crct10dif_pclmul crc32c_intel ghash_clmulni_intel snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec microcode serio_raw pcspkr snd_hwdep snd_seq snd_seq_device nfsd usb_debug snd_pcm ptp shpchp pps_core snd_timer snd soundcore auth_rpcgss oid_registry nfs_acl lockd sunrpc [ 1611.747389] CPU: 0 PID: 14810 Comm: trinity-c304 Not tainted 3.16.0+ #114 [ 1611.747449] 0000000000000000 000000007964733e ffff880244006be0 ffffffff8178fccb [ 1611.747481] ffff880244006c28 ffff880244006c18 ffffffff81073ecd 0000000000000000 [ 1611.747512] 0000000000000000 ffff880244006d58 ffff880244006ef8 0000000000000000 [ 1611.747544] Call Trace: [ 1611.747555] <NMI> [<ffffffff8178fccb>] dump_stack+0x4e/0x7a [ 1611.747582] [<ffffffff81073ecd>] warn_slowpath_common+0x7d/0xa0 [ 1611.747604] [<ffffffff81073f4c>] warn_slowpath_fmt+0x5c/0x80 [ 1611.747625] [<ffffffff811255c0>] ? restart_watchdog_hrtimer+0x50/0x50 [ 1611.747648] [<ffffffff81125695>] watchdog_overflow_callback+0xd5/0x120 [ 1611.747673] [<ffffffff8116446c>] __perf_event_overflow+0xac/0x2a0 [ 1611.747696] [<ffffffff81018ffe>] ? x86_perf_event_set_period+0xde/0x150 [ 1611.747720] [<ffffffff81165034>] perf_event_overflow+0x14/0x20 [ 1611.747742] [<ffffffff8101ed56>] intel_pmu_handle_irq+0x206/0x410 [ 1611.747764] [<ffffffff81017e5b>] perf_event_nmi_handler+0x2b/0x50 [ 1611.747787] [<ffffffff81007403>] nmi_handle+0xa3/0x1b0 [ 1611.747807] [<ffffffff81007365>] ? nmi_handle+0x5/0x1b0 [ 1611.747827] [<ffffffff810a12c8>] ? preempt_count_add+0x18/0xb0 [ 1611.748699] [<ffffffff81007742>] default_do_nmi+0x72/0x1c0 [ 1611.749570] [<ffffffff81007948>] do_nmi+0xb8/0xf0 [ 1611.750438] [<ffffffff8179dd2a>] end_repeat_nmi+0x1e/0x2e [ 1611.751312] [<ffffffff810a12c8>] ? preempt_count_add+0x18/0xb0 [ 1611.752177] [<ffffffff810a12c8>] ? preempt_count_add+0x18/0xb0 [ 1611.753025] [<ffffffff810a12c8>] ? preempt_count_add+0x18/0xb0 [ 1611.753861] <<EOE>> [<ffffffff810fee07>] is_module_text_address+0x17/0x50 [ 1611.754734] [<ffffffff81092ab8>] __kernel_text_address+0x58/0x80 [ 1611.755575] [<ffffffff81006b5f>] print_context_stack+0x8f/0x100 [ 1611.756410] [<ffffffff81005540>] dump_trace+0x140/0x370 [ 1611.757242] [<ffffffff811e797f>] ? getname_flags+0x4f/0x1a0 [ 1611.758072] [<ffffffff811e797f>] ? getname_flags+0x4f/0x1a0 [ 1611.758895] [<ffffffff810137cb>] save_stack_trace+0x2b/0x50 [ 1611.759720] [<ffffffff811c29a0>] set_track+0x70/0x140 [ 1611.760541] [<ffffffff8178d993>] alloc_debug_processing+0x92/0x118 [ 1611.761366] [<ffffffff8178e5d6>] __slab_alloc+0x45f/0x56f [ 1611.762195] [<ffffffff811e797f>] ? getname_flags+0x4f/0x1a0 [ 1611.763024] [<ffffffff8178dd57>] ? __slab_free+0x114/0x309 [ 1611.763853] [<ffffffff8137187e>] ? debug_check_no_obj_freed+0x17e/0x270 [ 1611.764712] [<ffffffff811e797f>] ? getname_flags+0x4f/0x1a0 [ 1611.765539] [<ffffffff811c6b26>] kmem_cache_alloc+0x1f6/0x270 [ 1611.766364] [<ffffffff810a7035>] ? local_clock+0x25/0x30 [ 1611.767183] [<ffffffff811e797f>] getname_flags+0x4f/0x1a0 [ 1611.768004] [<ffffffff811ed7e5>] user_path_at_empty+0x45/0xc0 [ 1611.768827] [<ffffffff810a13cb>] ? preempt_count_sub+0x6b/0xf0 [ 1611.769649] [<ffffffff810be35e>] ? put_lock_stats.isra.23+0xe/0x30 [ 1611.770470] [<ffffffff810be67d>] ? lock_release_holdtime.part.24+0x9d/0x160 [ 1611.771297] [<ffffffff811fdedd>] ? mntput_no_expire+0x6d/0x160 [ 1611.772129] [<ffffffff811ed871>] user_path_at+0x11/0x20 [ 1611.772959] [<ffffffff812040cb>] SyS_lsetxattr+0x4b/0xf0 [ 1611.773783] [<ffffffff8179bc92>] system_call_fastpath+0x16/0x1b [ 1611.774631] ---[ end trace 5beef170ba6002cc ]--- [ 1611.775514] INFO: NMI handler (perf_event_nmi_handler) took too long to run: 28.493 msecs [ 1611.776368] perf interrupt took too long (223592 > 2500), lowering kernel.perf_event_max_sample_rate to 50000
I don't really know if that's indicative of anything useful, but it at least might have been how we triggered the NMI in the previous run.
Dave
Quoted 3 lines · Dave Jones
In the meantime, I rebooted into the same kernel, and ran trinity solely doing the lsetxattr syscalls.
Any particular reason for the lsetxattr guess? Just the last call chain? I don't recognize it from the other traces, but maybe I just didn't notice.
Quoted 3 lines
The load was a bit lower, so I
cranked up the number of child processes to 512, and then this happened..
Ugh. "dump_trace()" being broken and looping forever? I don't actually believe it, because this isn't even on the exception stack (well, the NMI dumper is, but that one worked fine - this is the "nested" dumping of just the allocation call chain)
Smells like more random callchains to me. Unless this one is repeatable.
Limiting trinity to just lsetxattr is interesting. Did it make things fail faster?
Linus
Quoted 19 lines
[ 1611.747053] WARNING: CPU: 0 PID: 14810 at kernel/watchdog.c:265 watchdog_overflow_callback+0xd5/0x120() [ 1611.747083] Watchdog detected hard LOCKUP on cpu 0 [ 1611.747389] CPU: 0 PID: 14810 Comm: trinity-c304 Not tainted 3.16.0+ #114 [ 1611.747544] Call Trace: [ remnoved NMI perf event stack trace ] [ 1611.753861] [<ffffffff810fee07>] is_module_text_address+0x17/0x50 [ 1611.754734] [<ffffffff81092ab8>] __kernel_text_address+0x58/0x80 [ 1611.755575] [<ffffffff81006b5f>] print_context_stack+0x8f/0x100 [ 1611.756410] [<ffffffff81005540>] dump_trace+0x140/0x370 [ 1611.758895] [<ffffffff810137cb>] save_stack_trace+0x2b/0x50 [ 1611.759720] [<ffffffff811c29a0>] set_track+0x70/0x140 [ 1611.760541] [<ffffffff8178d993>] alloc_debug_processing+0x92/0x118 [ 1611.761366] [<ffffffff8178e5d6>] __slab_alloc+0x45f/0x56f [ 1611.765539] [<ffffffff811c6b26>] kmem_cache_alloc+0x1f6/0x270 [ 1611.767183] [<ffffffff811e797f>] getname_flags+0x4f/0x1a0 [ 1611.768004] [<ffffffff811ed7e5>] user_path_at_empty+0x45/0xc0 [ 1611.772129] [<ffffffff811ed871>] user_path_at+0x11/0x20 [ 1611.772959] [<ffffffff812040cb>] SyS_lsetxattr+0x4b/0xf0 [ 1611.773783] [<ffffffff8179bc92>] system_call_fastpath+0x16/0x1b