Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754476AbbHCQtN (ORCPT ); Mon, 3 Aug 2015 12:49:13 -0400 Received: from smtprelay0072.hostedemail.com ([216.40.44.72]:57495 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753216AbbHCQtL (ORCPT ); Mon, 3 Aug 2015 12:49:11 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::,RULES_HIT:2:41:69:355:379:541:599:800:960:966:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1535:1593:1594:1605:1606:1730:1747:1777:1792:2194:2196:2198:2199:2200:2201:2393:2525:2553:2561:2564:2682:2685:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3167:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4361:4385:4605:5007:6238:6261:7875:7903:7904:8660:9025:9038:9163:10004:10848:10967:11026:11232:11473:11658:11914:12043:12114:12296:12438:12517:12519:12555:12663:12679:12740:13019:13148:13161:13229:13230:13870:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: wing31_4fc7e9b7cda14 X-Filterd-Recvd-Size: 5973 Date: Mon, 3 Aug 2015 12:49:07 -0400 From: Steven Rostedt To: Nikolay Borisov Cc: "Linux-Kernel@Vger. Kernel. Org" , oleg@redhat.com, riel@redhat.com, Peter Zijlstra Subject: Re: HARD LOCKUP: Strange hard lock up on spin_lock(&sighand->siglock); Message-ID: <20150803124907.13bfc3e4@gandalf.local.home> In-Reply-To: <55B629E9.6020207@kyup.com> References: <55B629E9.6020207@kyup.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5243 Lines: 105 On Mon, 27 Jul 2015 15:54:01 +0300 Nikolay Borisov wrote: > Hello, > > I have a machine running kernel 3.13.3, in fact I have 3 such machines 3.13.3 is a very old kernel. A lot has changed. Also there's newer stable kernels of that release too (3.13.11). > which are connected via corosync in a cluster. On one of the machines > I observed the following lock-up: > > Jul 26 06:01:14 shrek kernel: ------------[ cut here ]------------ > Jul 26 06:01:14 shrek kernel: NMI backtrace for cpu 8 > Jul 26 06:01:14 shrek kernel: CPU: 8 PID: 29979 Comm: sg-queue Tainted: W O 3.13.3-sg1 #6 > Jul 26 06:01:14 shrek kernel: Hardware name: Supermicro X9DRD-7LN4F(-JBOD)/X9DRD-EF/X9DRD-7LN4F, BIOS 3.0a 12/05/2013 > Jul 26 06:01:14 shrek kernel: task: ffff880622796e40 ti: ffff880622797398 task.ti: ffff880622797398 > Jul 26 06:01:14 shrek kernel: RIP: 0010:[] [] ffffffff815ab0bd > Jul 26 06:01:14 shrek kernel: RSP: 0018:ffff88067e6a1e68 EFLAGS: 00000097 > Jul 26 06:01:14 shrek kernel: RAX: 000000000000002e RBX: ffff880622796e40 RCX: ffff880622796e40 > Jul 26 06:01:14 shrek kernel: RDX: 0000000000000000 RSI: ffff88067e6a1eb8 RDI: ffff880621f44a08 > Jul 26 06:01:14 shrek kernel: RBP: ffff88067e6a1e68 R08: ffff88067e6a1eb8 R09: 000000000000751a > Jul 26 06:01:14 shrek kernel: R10: 0000000000000008 R11: 0000000000000246 R12: ffff88067e6a1e98 > Jul 26 06:01:14 shrek kernel: R13: ffff88067e6a1eb8 R14: 0000000002d7c680 R15: 0000000002d7ccb0 > Jul 26 06:01:14 shrek kernel: FS: 0000037e10229700(0000) GS:ffff88087fc40000(0000) knlGS:0000000000000000 > Jul 26 06:01:14 shrek kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > Jul 26 06:01:14 shrek kernel: CR2: 0000037e0f8978d0 CR3: 00000000015c8000 CR4: 00000000001607f0 > Jul 26 06:01:14 shrek kernel: Stack: > Jul 26 06:01:14 shrek kernel: ffff88067e6a1e88 ffffffff81053620 0000000000000000 0000000000000002 > Jul 26 06:01:14 shrek kernel: ffff88067e6a1ea8 ffffffff8105369a 0000000000000000 0000000002d7ccb0 > Jul 26 06:01:14 shrek kernel: ffff88067e6a1ef8 ffffffff81056fcb 0000000000000000 ffffffffffff4111 > Jul 26 06:01:14 shrek kernel: Call Trace: > Jul 26 06:01:14 shrek kernel: [] __set_current_blocked+0x30/0x60 > Jul 26 06:01:14 shrek kernel: [] sigprocmask+0x4a/0x80 > Jul 26 06:01:14 shrek kernel: [] SyS_rt_sigprocmask+0xbb/0xd0 > Jul 26 06:01:14 shrek kernel: [] system_call_fastpath+0x16/0x1b > Jul 26 06:01:14 shrek kernel: [] ? retint_swapgs+0xe/0x11 > Jul 26 06:01:14 shrek kernel: Code: 48 83 c4 08 b8 01 00 00 00 5b c9 c3 66 90 55 48 89 e5 fa b8 00 01 00 00 f0 66 0f c1 07 89 c2 66 c1 ea 08 38 c2 75 04 c9 c3 f3 90 <0f> b6 07 38 c2 75 f7 c9 c3 66 2e 0f 1f 84 00 00 00 00 00 55 48 > My investigation showed up that the CPUs are in the following state: > CPUS 1, 2, 3, 6, 7, 8, 9, 10, 11, 18, 21, 22 are locked on the spinlock > inside __lock_task_sighand, in a rcu_read_lock() section. Whereas Except CPU 8 is blocked in sigprocmask() not in __lock_task_sighand(). > CPUS: 4, 5, 13, 14, 15, 16, 17, 19, 20, 23 are staying idle. > > >From the logs I gather that 2 different subsystems detected that: > the NMI watchdog and the rcu stall detector (cpu's 8 and 18). > While looking at the code and googling around I discovered the > following commit from PeterZ: https://lkml.org/lkml/2008/11/13/157 > > Based on that I think could be happening is that the sighand itself is > being freed while we are in the grace period inside __lock_task_sighand > but the slab page itself is not freed as per the semantics of > SLAB_DESTROY_BY_RCU. I looked up the source of this function in the > latest kernels and saw that Oleg had put a comment clarifying the > semantics but I'm still not convinced that it is safe. What if > we are trying to lock the spinlock before this particular slab is > initialised with sighand_ctor? Looking at the code and reading > Peter's explanation of SLAB_RCU I cannot identify which portion This confused me a while back but it is safe. See this thread: https://lkml.org/lkml/2014/6/3/759 The ctor isn't called by new allocations, but when the slab is created. But as I said, your kernel is very old and lots of things have changed. Unless you can reproduce on a newer kernel, most wont spend time looking at this. -- Steve > of __lock_task_sighand implements the following logic: > > if (!try_get_ref(obj)) // might fail for free objects > goto again; > > > Also what's more peculiar was the fact that when "Shrek" experienced > this issue, resources were migrated to the 2nd machine and it > also experienced the same behavior - CPUs locked on the sighand > spinlock. > > > That's the first time I've seen this particular issue. And I'm not > really able to come up with a way where a task's sighand could be > corrupted in a such a way as to prevent acquiring the lock. > > Regards, > Nikolay -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/