Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3694567imu; Mon, 28 Jan 2019 09:10:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN6YII3sJp0bBlKpkECmIYfUEZAhcr/AEjF3/PJwWKSUbu3rU+X1boe8po5W2vsyDWpCVsFt X-Received: by 2002:a63:2406:: with SMTP id k6mr19807307pgk.229.1548695442419; Mon, 28 Jan 2019 09:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695442; cv=none; d=google.com; s=arc-20160816; b=w9925Y0n5KUg3mgwLfEoWrwcH/fj9fFRDSPB5QzVTE9I/VYufifYu+0snn18re4bGh J9DcKLZ+fA6FewkAxpAJtjrpUZ8NZX5NwveH+zfgxjjpFs9kxCbQvkh+OpTkSyBCx3dH QDR1N5hobhysxXYpgsqs3DUnjvgnG2DLOsnChUGfzfDfBIcmGRUURYET/zK9bo2a8arA 5yCfREfWQ4eyfzsczWBvjDcxEFQ769vv8y0dAu7y9QeDrm7fWcgLdjiOb2ixaiZrPBea YNDaYZhvytkZWy7EGZjj6sOTtjFm2CGEz4rbCxIUT73+M2wdHe0LLd1vGqxzMBso+YQf 22gA== 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=d+sa+3+eqClbRziiZlMb0qMuUap0kSwIrPgOkz4b2bI=; b=Iwe4TMUlXN+0jyuQ6vSGm/h89d+DrIgt41tO3FgA1L7rgTn0jpPkN/yQHK8ukzNe+J 8Uu8JtKMmIMXBR+rfhTuU8pjRAjDg5h7EVzQZo8P5DP5taX7Clu1ojPWTp63JUuVrQAz tiJ+S28SdzfEz7BDfV/N4abu37p8DYzdrjXtSles976Pu8cgwUuB78nINJbPI7NA45uk faDJmor5CivZoNf3Ub1aWA5UP9xXMbUKbyv0w8T1T+6bVD0C/2vshfO8zQgxpEEMrk4q tDLxoykF51BDoTtV+84poL8DSJqveeS//lXvuNQOxlHYdS/PiOpMVqREqXrvsNQkcpts 8PVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="iECl/Wp8"; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si15499265plk.373.2019.01.28.09.10.27; Mon, 28 Jan 2019 09:10:42 -0800 (PST) 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=@kernel.org header.s=default header.b="iECl/Wp8"; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732369AbfA1QLu (ORCPT + 99 others); Mon, 28 Jan 2019 11:11:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:39138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733015AbfA1QLr (ORCPT ); Mon, 28 Jan 2019 11:11:47 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2321C2147A; Mon, 28 Jan 2019 16:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691906; bh=R9UjbWR42N1bMFqAXz7fxRNMKrSK7hO0KZrzRCFmMK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iECl/Wp8bbodenMP8msL4+ZyvtXA4zzeXmEd0yNG8hmeINFulH9dHB+qcb+DnFqjV 0jv5vAczz9fsXpoMevA1llssQHFvI5YMCmKDFoRk48P8+KesdIrn9lufdYaVNqZKaE NoCkMuBzynPFJCoCBz5wMCpGHi8xvgSNlkb+EsWc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Liu, Chuansheng" , Tetsuo Handa , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH AUTOSEL 4.19 254/258] kernel/hung_task.c: force console verbose before panic Date: Mon, 28 Jan 2019 10:59:20 -0500 Message-Id: <20190128155924.51521-254-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Liu, Chuansheng" [ Upstream commit 168e06f7937d96c7222037d8a05565e8a6eb00fe ] Based on commit 401c636a0eeb ("kernel/hung_task.c: show all hung tasks before panic"), we could get the call stack of hung task. However, if the console loglevel is not high, we still can not see the useful panic information in practice, and in most cases users don't set console loglevel to high level. This patch is to force console verbose before system panic, so that the real useful information can be seen in the console, instead of being like the following, which doesn't have hung task information. INFO: task init:1 blocked for more than 120 seconds. Tainted: G U W 4.19.0-quilt-2e5dc0ac-g51b6c21d76cc #1 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. Kernel panic - not syncing: hung_task: blocked tasks CPU: 2 PID: 479 Comm: khungtaskd Tainted: G U W 4.19.0-quilt-2e5dc0ac-g51b6c21d76cc #1 Call Trace: dump_stack+0x4f/0x65 panic+0xde/0x231 watchdog+0x290/0x410 kthread+0x12c/0x150 ret_from_fork+0x35/0x40 reboot: panic mode set: p,w Kernel Offset: 0x34000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) Link: http://lkml.kernel.org/r/27240C0AC20F114CBF8149A2696CBE4A6015B675@SHSMSX101.ccr.corp.intel.com Signed-off-by: Chuansheng Liu Reviewed-by: Petr Mladek Reviewed-by: Sergey Senozhatsky Cc: Tetsuo Handa Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- kernel/hung_task.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/kernel/hung_task.c b/kernel/hung_task.c index aa3c51f300aa..9eca2371f189 100644 --- a/kernel/hung_task.c +++ b/kernel/hung_task.c @@ -111,8 +111,11 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) trace_sched_process_hang(t); - if (!sysctl_hung_task_warnings && !sysctl_hung_task_panic) - return; + if (sysctl_hung_task_panic) { + console_verbose(); + hung_task_show_lock = true; + hung_task_call_panic = true; + } /* * Ok, the task did not get scheduled for more than 2 minutes, @@ -134,11 +137,6 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) } touch_nmi_watchdog(); - - if (sysctl_hung_task_panic) { - hung_task_show_lock = true; - hung_task_call_panic = true; - } } /* -- 2.19.1