From patchwork Wed Dec 21 16:54:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 9483271 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 422CC601B3 for ; Wed, 21 Dec 2016 16:54:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 310EA2840B for ; Wed, 21 Dec 2016 16:54:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2485C28424; Wed, 21 Dec 2016 16:54:29 +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 9CB442840B for ; Wed, 21 Dec 2016 16:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756963AbcLUQy1 (ORCPT ); Wed, 21 Dec 2016 11:54:27 -0500 Received: from foss.arm.com ([217.140.101.70]:33092 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757871AbcLUQy1 (ORCPT ); Wed, 21 Dec 2016 11:54:27 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4FC5FF; Wed, 21 Dec 2016 08:54:26 -0800 (PST) Received: from [10.1.210.28] (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6CF063F445; Wed, 21 Dec 2016 08:54:25 -0800 (PST) Subject: Re: How to remove warn msg "cache: parent cpui should not be sleeping" i=1, 2, 3... To: Jisheng Zhang , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" References: <20161221193703.6eac880c@xhacker> Cc: Sudeep Holla From: Sudeep Holla Organization: ARM Message-ID: Date: Wed, 21 Dec 2016 16:54:22 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161221193703.6eac880c@xhacker> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 21/12/16 11:37, Jisheng Zhang wrote: > Hi all, > > I'm not sure this is a bug, when wake up from s2ram, I could get something > like: > > [ 313.271464] Enabling non-boot CPUs ... > [ 313.271551] CPU1: Booted secondary processor > [ 313.271556] Detected VIPT I-cache on CPU1 > [ 313.301378] cache: parent cpu1 should not be sleeping > [ 313.301504] CPU1 is up > [ 313.301582] CPU2: Booted secondary processor > [ 313.301585] Detected VIPT I-cache on CPU2 > [ 313.331485] cache: parent cpu2 should not be sleeping > [ 313.331605] CPU2 is up > [ 313.331683] CPU3: Booted secondary processor > [ 313.331686] Detected VIPT I-cache on CPU3 > [ 313.361599] cache: parent cpu3 should not be sleeping > [ 313.361719] CPU3 is up > > This is because we call cpu_device_create() when secondary cpu is brought > online, the cpu_cache device's parent device: cpu device isn't already > resumed, all device resume will resume after secondary cores are brought > up. > > What's the elegant solution to remove this warning msg? > It is not a serious warning as you can see a comment in the code: "/* * This is a fib. But we'll allow new children to be added below * a resumed device, even if the device hasn't been completed yet. */" But if we think it needs to be removed, I have something like below in my mind. I am not sure if this is hacky or not(completely untested, not even compiled). Regards, Sudeep -->8 --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git i/drivers/base/cpu.c w/drivers/base/cpu.c index 4c28e1a09786..2a5c04377adf 100644 --- i/drivers/base/cpu.c +++ w/drivers/base/cpu.c @@ -344,6 +344,14 @@ static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env) } #endif +static int cpu_dev_pm_unset_is_prepared(unsigned int cpu) +{ + struct device *cpu_dev = get_cpu_device(cpu); + + if(cpu_dev) + cpu_dev->power.is_prepared = false; + return 0; +} /* * register_cpu - Setup a sysfs device for a CPU. * @cpu - cpu->hotpluggable field set to 1 will generate a control file in @@ -377,7 +385,9 @@ int register_cpu(struct cpu *cpu, int num) per_cpu(cpu_sys_devices, num) = &cpu->dev; register_cpu_under_node(num, cpu_to_node(num)); - return 0; + return cpuhp_setup_state_nocalls(CPUHP_CPUDEV_PM_PREPARE, + "base/cpu/dev_pm:prepare", + cpu_dev_pm_unset_is_prepared, NULL); } struct device *get_cpu_device(unsigned cpu) diff --git i/include/linux/cpuhotplug.h w/include/linux/cpuhotplug.h index 2ab7bf53d529..5bfe3c1aa148 100644 --- i/include/linux/cpuhotplug.h +++ w/include/linux/cpuhotplug.h @@ -51,6 +51,7 @@ enum cpuhp_state { CPUHP_SLAB_PREPARE, CPUHP_MD_RAID5_PREPARE, CPUHP_RCUTREE_PREP, + CPUHP_CPUDEV_PM_PREPARE, CPUHP_CPUIDLE_COUPLED_PREPARE, CPUHP_POWERPC_PMAC_PREPARE, CPUHP_POWERPC_MMU_CTX_PREPARE,