Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2716842imj; Mon, 11 Feb 2019 07:25:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IZxgrFhqPDdgjcXYQFEK/N4Llfob3rEqoNjy5UsvQm2kk0rQOVdjKaIX6Bzj2FRHCbpuUR/ X-Received: by 2002:a17:902:f20b:: with SMTP id gn11mr36932823plb.274.1549898759355; Mon, 11 Feb 2019 07:25:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898759; cv=none; d=google.com; s=arc-20160816; b=pVmVFzY1JanljRpGvApbxyt5A2J3mWvEAevjn5avi8O7v35RTNqgM7DqbQvn19Wi5o PZwTycFA29folcw2bBFpfW1qq8Ts+fvFPThKJYC4eQWbAMke1nlL+5vpU8OYEqDybVNP Yo2jjmpdYjzEcr23jhCEvPxGzrflTup3BxY/J4KOEPVqUgx5/Zn/F0q4wR1CLQxJETFu zM7HivxfmiCO5M95NnFcHlg6issQ8RLXcLNSeuh1WtEJjDvbJOzHcOYgi/y/AoApo/RK bOPbK9XqukSllp2FPwEk+0RN3cTDq2ILjdPhiySbVDiz8kbQXy0CrWKDU16MvS1SO71s yrvA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sZO2rUvP3rYUVoHQZuCXkGxkAzqGbSGEM1xw4mbu69g=; b=GE1wLK4OXb91YSiNtliMze8CpqLOoyV22ua4Wo6Xnivp2+ceMnN33s9TYzIf2P691h 7OE9mdfxzC9g5Sm7aqe/UMWt0h/6hBrUAmRyU10wZOmsVjxmrIWVuVMv3z896xg3+miZ 84aIVUNNCqlavfZAwSYVg89XDXqUIt+ERcjp/wCnG5dLQsaifEaYcPb7P4Owg2Fqjv2+ W0lX27PebMC6xkqkdLDVLiiRXLgFx3XjCoDILzuNsGnf7EfTmLtEPeiqaYJRdrYqAf7i 6CAoSvVIF48ZHon1vL/ZRxQtFkpVi36RA5eXwh+ATtoXM2UJZfl0+GpCMFk1orx0Ncx4 CDlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NDtSjVFt; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s73si10003816pfs.54.2019.02.11.07.25.41; Mon, 11 Feb 2019 07:25:59 -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=NDtSjVFt; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389331AbfBKPB4 (ORCPT + 99 others); Mon, 11 Feb 2019 10:01:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:50038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390289AbfBKPBy (ORCPT ); Mon, 11 Feb 2019 10:01:54 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D85A4222AB; Mon, 11 Feb 2019 15:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897313; bh=VP1HEsG56NCE7o9bY5fvfpKur7t/OjfnOTKTHtIXArE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDtSjVFtzumv3gkfb/TqJnI8FnwmlMQ4L015sFG/UfUzH764wSYJa9hYFpveT/SI/ MAAjxdDAWZ84q8Jt1XljTKAhaE6X5CDOuNgLrYz8a1K7O87gzeQMb3i46EciwIxOik FIUznjOoehntiZNEhBX7KbgTmM0I2p+bYumSqVjU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuansheng Liu , Petr Mladek , Sergey Senozhatsky , Tetsuo Handa , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 161/205] kernel/hung_task.c: force console verbose before panic Date: Mon, 11 Feb 2019 15:19:19 +0100 Message-Id: <20190211141838.885424462@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 0cec1241e26f..f9aaf4994062 100644 --- a/kernel/hung_task.c +++ b/kernel/hung_task.c @@ -103,8 +103,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, @@ -126,11 +129,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