Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1753615ybh; Sun, 15 Mar 2020 10:11:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsJUY8B0GKVaGzGAKe9F7Phgm1H0Ocg73JzaE586nvaM9lJZ3osfBua2GLpgygVOMfFXUAG X-Received: by 2002:aca:482:: with SMTP id 124mr2390104oie.35.1584292292968; Sun, 15 Mar 2020 10:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584292292; cv=none; d=google.com; s=arc-20160816; b=c2+pvL5n7WX/egtnm0dhJ8bzJNJVkrr2OAPzwMpha+SPuaXGst2V29681GcLMAWdtz UnULgCQFyFpcVTfRoVivmPQiUUHbRDnNJNLVM9jT6BGOPmeCEwJnSvrBBgooQ0cHqYp9 KPNtUqdTQG5rjZfK4zqLUwE3MyUVSd3fdrgJ6F+P3Xxw8y/eKvgYd/o3/cS7fhlCyJKS 8HLP8NQcWkZQJL4cgtjeDnCdBaJi38/VLpqMfRLSdamsygq1e8qqVqK85Nl1/03njl2b w1mVtEMGJQhaWpqtXmIz7gSFzNWudL0n4lFDfkyYgSBBuzREDqJm89jitbebfxu6UThJ FOBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2c5NC7DS/hFQ+9kSaUL5gHgVLY4OAyfbaAYiD0ezTVg=; b=Um1aDuMqxiUu2NF8oroI9nLhc2lM/xOH/xwWz8sj8Hy5xJOfR3ZYKcnliUlJkwRdFh 24cHp6oeEqIbbYBcWKxC2t5XlN2Gk/YP6rwNNYoCVELXfMOVz7EkUEDDhAy69rJHsBl3 BUwZ7VLQxbmUdBnm+LPGyFINTd6qcgz0sU8iw5Du00clWhdFwOiHDqM5IRvvy+0VhAQa nRqBj2Y2D4MRUfeC6ClG4G9Px5HUTzW/1cq6hfsRxYcW6RD7tHL+3egeoKiou/JYsHzV xveK27H9IttuWOXadPNQ73NmhUW3aASm1Og1wNjZzntZrNLm5xYR7BIIY6/PmZYDiDJl s8CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p0zpuQED; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z126si6156818oia.187.2020.03.15.10.11.20; Sun, 15 Mar 2020 10:11:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p0zpuQED; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728998AbgCORKI (ORCPT + 99 others); Sun, 15 Mar 2020 13:10:08 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41696 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728915AbgCORKI (ORCPT ); Sun, 15 Mar 2020 13:10:08 -0400 Received: by mail-wr1-f67.google.com with SMTP id f11so1510126wrp.8 for ; Sun, 15 Mar 2020 10:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2c5NC7DS/hFQ+9kSaUL5gHgVLY4OAyfbaAYiD0ezTVg=; b=p0zpuQEDYUBmGayplCo5JC8bBC5UCN4OrQ5ghlWvJQiuCZt3QLaNlLV7QEw7iylTCA zpWpdUMvWWGvn7NzrTaVvEoTcm+QCVsuG3FmoOKXHKcFnzM10DU0WbkFak10ph2cgxro kFa8qfX+Z/Ggt+XYvm5frUrOSFe+Mux7/voWf3ZtYPgN1jqW4EJ8TVjYp+I8PtyhHTJf 2C8fJEtHbjKGhsir+xNZKISCpMW0iynNYboIDZNL7oTCgUgnvFHBGRtMFy0B/IYYBVFJ ibCERxVSFvIqAuJZdXRz5GU0HiokkHV1imPhP9ql/QD53S0J0NrVaYQ0IvhcfALbZLGV wZeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2c5NC7DS/hFQ+9kSaUL5gHgVLY4OAyfbaAYiD0ezTVg=; b=ruG5mWGk1senH+zWXWVM2CcihFnpVZd+UJlJ8HFbfkXl1UpjN91mmunXP2UgaSLMsc 1JGiJybzyIyhEZRuqm7ey5OEx3vaqS6dr9injWg2xQu0hq8ANSLDBToYoCQrw4iwafnR V3+LwL3wsGvMJHzJPxSIB9r/mj1IpioN+vXdCe0RhooCB9hfaWa6sPaRUVWzzkwO2R+g bszy0Hl5SrbWqKB4pHilTTNcZryeB/86PZtVucV8h5KywfDj/nNILzVnO9NuCNdHqRcw o814ZHR/ocYZlCJgVdrlYiE+6AWUZyUCRAu+1sftwZz1CWA4vJh73SBJhIBayqs00hmY L/7w== X-Gm-Message-State: ANhLgQ0etmTHDF5y/4d0A5bgPTf8S+GccXltsUex7qg2ErJtv91cx3D2 fQUthrjKVeuw92X67XD8757Cas1dwqa9ekHZ X-Received: by 2002:a5d:694e:: with SMTP id r14mr29997479wrw.312.1584292204742; Sun, 15 Mar 2020 10:10:04 -0700 (PDT) Received: from localhost.localdomain (ipb218f56a.dynamic.kabel-deutschland.de. [178.24.245.106]) by smtp.gmail.com with ESMTPSA id u25sm25874774wml.17.2020.03.15.10.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 10:10:04 -0700 (PDT) From: Eugeniu Rosca X-Google-Original-From: Eugeniu Rosca To: linux-kernel@vger.kernel.org Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Jisheng Zhang , Valdis Kletnieks , Sebastian Andrzej Siewior , Andrew Gabbasov , Dirk Behme , Eugeniu Rosca Subject: [RFC PATCH 3/3] watchdog: Turn console verbosity on when reporting softlockup Date: Sun, 15 Mar 2020 18:09:03 +0100 Message-Id: <20200315170903.17393-4-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200315170903.17393-1-erosca@de.adit-jv.com> References: <20200315170903.17393-1-erosca@de.adit-jv.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As pointed out in v5.0 commit 168e06f7937d96 ("kernel/hung_task.c: force console verbose before panic"), users may miss crucial information in pre-panic scenarios, depending on the loglevel value set by the distribion/platform maintainers. For example, assuming loglevel=3 (i.e. print EMERG/ALERT/CRIT only), below is the output of a softlockup got with pure vanilla kernel [1]. In contrast, with current patch applied, output [2] is far more helpful. Save potentially days/weeks/months of debugging efforts for those who: * deal with a softlockup whose reproduction scenario is not clear * are constrainted to use a low loglevel value in production * mostly/exclusively rely on logs like [2] post-mortem [1] Softlockup output [loglevel=3, pure v5.6-rc5, H3ULCB] watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [modprobe:2354] [2] Softlockup output [loglevel=3, v5.6-rc5 + this patch, H3ULCB] [ 292.259324] watchdog: BUG: soft lockup - CPU#3 stuck for 23s! [modprobe:2437] [ 292.266834] Modules linked in: <-- cut --> [ 292.302880] irq event stamp: 519660 [ 292.306555] hardirqs last enabled at (519659): [] el1_irq+0xd8/0x180 [ 292.314909] hardirqs last disabled at (519660): [] el1_irq+0x7c/0x180 [ 292.323274] softirqs last enabled at (519658): [] __do_softirq+0x2e4/0x7c4 [ 292.332179] softirqs last disabled at (519651): [] irq_exit+0x150/0x1e0 [ 292.340720] CPU: 3 PID: 2437 Comm: modprobe Not tainted 5.6.0-rc5+ #96 [ 292.347538] Hardware name: Renesas H3ULCB Kingfisher board based on r8a77951 (DT) [ 292.355355] pstate: 20000005 (nzCv daif -PAN -UAO) [ 292.360435] pc : lkdtm_SOFTLOCKUP+0x18/0x20 [lkdtm] [ 292.365592] lr : lkdtm_SOFTLOCKUP+0x18/0x20 [lkdtm] [ 292.370699] sp : ffff0006cd9af780 [ 292.374187] x29: ffff0006cd9af780 x28: ffffa0000907d000 [ 292.379757] x27: ffff0006cbaebc10 x26: ffffa000090751c0 [ 292.385327] x25: ffffa0000907dfc0 x24: 0000000000000009 [ 292.390896] x23: ffffa0000907d478 x22: 0000000000000000 [ 292.396464] x21: ffffa0000907d340 x20: ffffa0000907d340 [ 292.402034] x19: ffffa000090751c0 x18: 0000000000000000 [ 292.407603] x17: 0000000000000000 x16: 0000000000000000 [ 292.413171] x15: 0000000000000000 x14: ffffa00000000003 [ 292.418740] x13: ffffa00010dc0180 x12: 0000000000000000 [ 292.424309] x11: ffff8000bfc2401d x10: 1fffe000bfc2401d [ 292.429877] x9 : dfffa00000000000 x8 : ffffa00010082c00 [ 292.435445] x7 : ffff0005fe1200ef x6 : 0000000000000000 [ 292.441012] x5 : dfffa00000000000 x4 : ffff0006c82e9c50 [ 292.446580] x3 : ffffa0001024b848 x2 : 0000000000000001 [ 292.452147] x1 : 0000000000000000 x0 : 0000000000000000 [ 292.457713] Call trace: [ 292.460351] lkdtm_SOFTLOCKUP+0x18/0x20 [lkdtm] [ 292.465147] lkdtm_do_action+0x40/0x44 [lkdtm] [ 292.469853] lkdtm_register_cpoint+0x44/0xbc [lkdtm] [ 292.475099] lkdtm_module_init+0x220/0x27c [lkdtm] [ 292.480120] do_one_initcall+0x1c8/0x40c [ 292.484244] do_init_module+0xb4/0x330 [ 292.488185] load_module+0x3404/0x34c8 [ 292.492126] __do_sys_finit_module+0x11c/0x13c [ 292.496787] __arm64_sys_finit_module+0x4c/0x5c [ 292.501539] el0_svc_common.constprop.0+0x160/0x200 [ 292.506647] do_el0_svc+0x74/0xa4 [ 292.510139] el0_sync_handler+0xc4/0x104 [ 292.514257] el0_sync+0x140/0x180 Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Petr Mladek Cc: Jisheng Zhang Cc: Valdis Kletnieks Cc: Sebastian Andrzej Siewior Signed-off-by: Eugeniu Rosca --- kernel/watchdog.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index b6b1f54a7837..cbe7e2c4c5fb 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -428,6 +428,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) } } + console_verbose_start(); + pr_emerg("BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", smp_processor_id(), duration, current->comm, task_pid_nr(current)); @@ -453,6 +455,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) if (softlockup_panic) panic("softlockup: hung tasks"); __this_cpu_write(soft_watchdog_warn, true); + + console_verbose_end(); } else __this_cpu_write(soft_watchdog_warn, false); -- 2.25.0