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: 9483273 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 2E3E2601B3 for ; Wed, 21 Dec 2016 16:56:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CD8B28422 for ; Wed, 21 Dec 2016 16:56:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1178928458; Wed, 21 Dec 2016 16:56:16 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8B27B28422 for ; Wed, 21 Dec 2016 16:56:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cJkAI-00064B-SE; Wed, 21 Dec 2016 16:54:54 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cJkAD-000600-5e for linux-arm-kernel@lists.infradead.org; Wed, 21 Dec 2016 16:54:50 +0000 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> 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161221_085449_297971_B06121D8 X-CRM114-Status: GOOD ( 14.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudeep Holla Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 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,