Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752574AbbDBKto (ORCPT ); Thu, 2 Apr 2015 06:49:44 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:40811 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751054AbbDBKtl (ORCPT ); Thu, 2 Apr 2015 06:49:41 -0400 X-AuditID: cbfec7f4-b7f126d000001e9a-05-551d1e170f80 From: Andrey Ryabinin To: Peter Oberparleiter , Andrew Morton Cc: Fengguang Wu , lkp@01.org, linux-kernel@vger.kernel.org, Andrey Ryabinin Subject: [PATCH] gcov: fix softlockups Date: Thu, 02 Apr 2015 13:49:30 +0300 Message-id: <1427971770-7456-1-git-send-email-a.ryabinin@samsung.com> X-Mailer: git-send-email 2.3.5 In-reply-to: <20150323012500.GA15155@wfg-t540p.sh.intel.com> References: <20150323012500.GA15155@wfg-t540p.sh.intel.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrEJMWRmVeSWpSXmKPExsVy+t/xK7ricrKhBleWsFhs+/WIzWLO+jVs Fu+fr2e2uLxrDpvFyuPtrBYN378zO7B53N/L7rF4z0smjxMzfrN4PDi0mcWjb8sqRo/Pm+QC 2KK4bFJSczLLUov07RK4Mjr3PGUumK5cMWPCZvYGxiuyXYycHBICJhKPJ7QwQ9hiEhfurWfr YuTiEBJYyihxcv8FZginj0ni3NtNbCBVbAJ6Ev9mbQezRQQSJT6/OcrSxcjBwSxQL3Gq1xwk LCygJrH+3C1GkDCLgKrEi2VyIGFeAVeJBX9/sUHskpO4+vUyO0gJp4CNxM+OYJCwkIC1xNp9 99gnMPIuYGRYxSiaWppcUJyUnmuoV5yYW1yal66XnJ+7iRESTl92MC4+ZnWIUYCDUYmH98Yn 6VAh1sSy4srcQ4wSHMxKIrx/xGVDhXhTEiurUovy44tKc1KLDzEycXBKNTDOzH/D7v7lH5PX lSZT8/en5A9/8+OxPDVNL1LKOveMU3zpaaZpG5ZOLTf6/EK/tUdEc+UkF7+5+Z7MgQw3lW2F rDjsg59ybThW/3HakhV7FcMlXTx2nWJ9Zrh4yWb5sgx2y/pb9/OXO2jknpF5/9rns4Sqs4zU ksfBntmi4s9b8hz37mmveqbEUpyRaKjFXFScCADN1sGyBQIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4664 Lines: 89 gcov profiling if enabled with other heavy compile-time instrumentation like KASan could trigger following softlockups: [ 72.460059] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [swapper/0:1] [ 72.460068] Modules linked in: [ 72.460068] irq event stamp: 22823276 [ 72.460068] hardirqs last enabled at (22823275): [] mutex_lock_nested+0x7d9/0x930 [ 72.460068] hardirqs last disabled at (22823276): [] apic_timer_interrupt+0x6d/0x80 [ 72.460068] softirqs last enabled at (22823172): [] __do_softirq+0x4db/0x729 [ 72.460068] softirqs last disabled at (22823167): [] irq_exit+0x7d/0x15b [ 72.460068] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 3.19.0-05245-gbb33326-dirty #3 [ 72.460068] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5.1-0-g8936dbb-20141113_115728-nilsson.home.kraxel.org 04/01/2014 [ 72.460068] task: ffff88006cba8000 ti: ffff88006cbb0000 task.ti: ffff88006cbb0000 [ 72.460068] RIP: 0010:[] [] kasan_mem_to_shadow+0x1e/0x1f [ 72.460068] RSP: 0000:ffff88006cbb3cb0 EFLAGS: 00000207 [ 72.460068] RAX: fffffbfff1331380 RBX: ffffffff81468fc2 RCX: ffff88006d600006 [ 72.460068] RDX: dffffc0000000000 RSI: ffffffff89989bfa RDI: 1ffffffff1331380 [ 72.460068] RBP: ffff88006cbb3cf8 R08: 00000000037178af R09: 0000000003714ae1 [ 72.460068] R10: ffffed000c8d0b1f R11: 00000000000000cf R12: ffffffff8d8c2ba0 [ 72.460068] R13: ffff88006d640780 R14: ffffffff81269ad5 R15: ffff88006cbb3c58 [ 72.460068] FS: 0000000000000000(0000) GS:ffff88006d600000(0000) knlGS:0000000000000000 [ 72.460068] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 72.460068] CR2: 0000000000000000 CR3: 000000000a229000 CR4: 00000000000006f0 [ 72.460068] Stack: [ 72.460068] ffffffff81468a10 dffffc0000000000 ffffffff8abcfac0 ffff88006cbb3d28 [ 72.460068] ffffffff81468fc2 ffff88006cbb3d38 ffffffff81468fc2 dffffc0000000000 [ 72.460068] ffffffff89989c05 ffff88006cbb3d28 ffffffff8212fea0 ffff880063049398 [ 72.460068] Call Trace: [ 72.460068] [] ? __asan_load1+0x66/0xbb [ 72.460068] [] ? __asan_load8+0x6d/0x10c [ 72.460068] [] ? __asan_load8+0x6d/0x10c [ 72.460068] [] strcmp+0x28/0x70 [ 72.460068] [] get_node_by_name+0x66/0x99 [ 72.460068] [] gcov_event+0x4f/0x69e [ 72.460068] [] ? mutex_unlock+0x15/0x1e [ 72.460068] [] ? gcov_persist_setup+0x77/0x77 [ 72.460068] [] ? gcov_persist_setup+0x77/0x77 [ 72.460068] [] gcov_enable_events+0x54/0x7b [ 72.460068] [] gcov_fs_init+0xf8/0x134 [ 72.460068] [] do_one_initcall+0x1b2/0x288 [ 72.460068] [] ? __asan_load8+0x6d/0x10c [ 72.460068] [] kernel_init_freeable+0x467/0x580 [ 72.460068] [] ? rest_init+0x23b/0x23b [ 72.460068] [] kernel_init+0x15/0x18b [ 72.460068] [] ret_from_fork+0x7c/0xb0 [ 72.460068] [] ? rest_init+0x23b/0x23b [ 72.460068] Code: ff 48 ff 05 61 ec c2 0c 48 89 e5 5d c3 55 48 c1 ef 03 48 ba 00 00 00 00 00 fc ff df 48 8d 04 17 48 ff 05 da f5 c2 0c 48 89 e5 5d 55 48 ff 05 f5 fe c2 0c 48 89 e5 5d c3 55 48 ff 05 f0 fe c2 [ 72.460068] Kernel panic - not syncing: softlockup: hung tasks Fix this by sticking cond_resched() in gcov_enable_events(). Signed-off-by: Andrey Ryabinin Reported-by: Fengguang Wu --- kernel/gcov/base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/gcov/base.c b/kernel/gcov/base.c index b358a80..a744098 100644 --- a/kernel/gcov/base.c +++ b/kernel/gcov/base.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "gcov.h" static int gcov_events_enabled; @@ -107,8 +108,10 @@ void gcov_enable_events(void) gcov_events_enabled = 1; /* Perform event callback for previously registered entries. */ - while ((info = gcov_info_next(info))) + while ((info = gcov_info_next(info))) { gcov_event(GCOV_ADD, info); + cond_resched(); + } mutex_unlock(&gcov_lock); } -- 2.3.5 -- 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/