From patchwork Sun Mar 29 14:46:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Yu X-Patchwork-Id: 11464059 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A9F0159A for ; Sun, 29 Mar 2020 14:48:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 720BE20733 for ; Sun, 29 Mar 2020 14:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728281AbgC2OsL (ORCPT ); Sun, 29 Mar 2020 10:48:11 -0400 Received: from mga01.intel.com ([192.55.52.88]:32557 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728245AbgC2OsL (ORCPT ); Sun, 29 Mar 2020 10:48:11 -0400 IronPort-SDR: iLd7iGvGspOVEtGFXGuVAv65b7ywRNq1dQb7N0Tiw4NOA+B7tpiGYw4ndBBW07zpIm2DWnHdc9 Y+PtIyEcPwJQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2020 07:48:10 -0700 IronPort-SDR: nBtIlt8xw3X87rGtSiAizW/ezAp70RXQNKCOhFd0IT1apP1sgku/UPl5TJEycg9t45f4eNxojk SoiuDVtLQgOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,320,1580803200"; d="scan'208";a="272123787" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by fmsmga004.fm.intel.com with ESMTP; 29 Mar 2020 07:48:08 -0700 From: Chen Yu To: linux-pm@vger.kernel.org Cc: Jonathan Corbet , Pavel Machek , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Thomas Gleixner , Josh Poimboeuf , Andrew Morton , Chen Yu , "Rafael J. Wysocki" , Len Brown , Andy Shevchenko , Randy Dunlap Subject: [PATCH][v2] PM / sleep: Add pm_debug_messages boot command control Date: Sun, 29 Mar 2020 22:46:40 +0800 Message-Id: <20200329144640.20536-1-yu.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Debug messages from the system suspend/hibernation infrastructure is disabled by default, and can only be enabled after the system has boot up via /sys/power/pm_debug_messages. This makes the hibernation resume hard to track as it involves system boot up across hibernation. There's no chance for software_resume() to track the resume process, eg. Turning on the pm_debug_messages during boot up by appending 'pm_debug_message'. Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Andy Shevchenko Cc: Randy Dunlap Signed-off-by: Chen Yu --- v2: According to Randy's suggestion, add the command line option to Documentation/admin-guide/kernel-parameters.txt --- Documentation/admin-guide/kernel-parameters.txt | 3 +++ kernel/power/main.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index c07815d230bc..105ec73743d7 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3698,6 +3698,9 @@ Override pmtimer IOPort with a hex value. e.g. pmtmr=0x508 + pm_debug_message [SUSPEND,KNL] + Enable suspend/resume debug messages during boot up. + pnp.debug=1 [PNP] Enable PNP debug messages (depends on the CONFIG_PNP_DEBUG_MESSAGES option). Change at run-time diff --git a/kernel/power/main.c b/kernel/power/main.c index 69b7a8aeca3b..1da3d7c15e03 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -535,6 +535,13 @@ static ssize_t pm_debug_messages_store(struct kobject *kobj, power_attr(pm_debug_messages); +static int __init pm_debug_message_setup(char *str) +{ + pm_debug_messages_on = true; + return 1; +} +__setup("pm_debug_message", pm_debug_message_setup); + /** * __pm_pr_dbg - Print a suspend debug message to the kernel log. * @defer: Whether or not to use printk_deferred() to print the message.