From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751638AbcFYQVw (ORCPT ); Sat, 25 Jun 2016 12:21:52 -0400 Received: from mga11.intel.com ([192.55.52.93]:20981 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbcFYQVu (ORCPT ); Sat, 25 Jun 2016 12:21:50 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,527,1459839600"; d="scan'208";a="835109966" From: Chen Yu To: linux-pm@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Chen Yu Subject: [PATCH][RFC] cpufreq: Avoid warning during resume by return EAGAIN if cpufreq is unavailable Date: Sun, 26 Jun 2016 00:28:48 +0800 Message-Id: <1466872128-14566-1-git-send-email-yu.c.chen@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previously we saw warning during resume on some platforms, which use acpi-cpufreq: smpboot: Booting Node 0 Processor 3 APIC 0x5 cache: parent cpu3 should not be sleeping CPU3 is up ACPI: Waking up from system sleep state S3 WARNING: CPU: 0 PID: 12546 at drivers/cpufreq/cpufreq.c:2173 Call Trace: [] dump_stack+0x5c/0x77 [] __warn+0xc4/0xe0 [] cpufreq_update_policy+0xfe/0x150 [] cpufreq_update_policy+0x150/0x150 [] acpi_processor_notify+0x51/0xdc [processor] [] acpi_ev_notify_dispatch+0x3c/0x55 [] acpi_os_execute_deferred+0x10/0x1a [] process_one_work+0x14b/0x400 [] worker_thread+0x65/0x4a0 [] rescuer_thread+0x340/0x340 [] kthread+0xdf/0x100 [] ret_from_fork+0x22/0x40 [] kthread_park+0x50/0x50 This is because this platforms tries to notify the processor to reevaluate the _PPC object in _WAK, however at that time the cpufreq driver's resume has not been invoked yet, thus cpufreq_update_current_freq returns zero because of cpufreq_suspended = true, which caused the warning. Actually it should be unnecessary to care the update request at that moment, so remove the warning and change the return value to -EAGAIN for invokers. Reported-and-tested-by: BzukTuk Signed-off-by: Chen Yu --- drivers/cpufreq/cpufreq.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 9009295..67a3aa1 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2262,8 +2262,11 @@ int cpufreq_update_policy(unsigned int cpu) */ if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { new_policy.cur = cpufreq_update_current_freq(policy); - if (WARN_ON(!new_policy.cur)) { - ret = -EIO; + if (!new_policy.cur) { + if (WARN_ON(!cpufreq_suspended)) + ret = -EIO; + else + ret = -EAGAIN; goto unlock; } } -- 2.7.4