From patchwork Sat Jun 25 16:28:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Yu X-Patchwork-Id: 9198601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CB86060754 for ; Sat, 25 Jun 2016 16:21:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEA6028515 for ; Sat, 25 Jun 2016 16:21:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 904AA28518; Sat, 25 Jun 2016 16:21:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DFC828515 for ; Sat, 25 Jun 2016 16:21:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbcFYQVv (ORCPT ); Sat, 25 Jun 2016 12:21:51 -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 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 25 Jun 2016 09:21:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,527,1459839600"; d="scan'208";a="835109966" Received: from sharon.sh.intel.com ([10.239.160.87]) by orsmga003.jf.intel.com with ESMTP; 25 Jun 2016 09:21:49 -0700 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-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; } }