From patchwork Fri Jan 25 15:09:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 156607 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp468162jaa; Fri, 25 Jan 2019 07:09:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN7BnyV3HCgcX3Ak4uYBBeQqCow0I6TNplXHFHOJbjMNHJhMon7uUDuHusCLQr/mAPUtwGt4 X-Received: by 2002:a17:902:280b:: with SMTP id e11mr11390179plb.269.1548428960476; Fri, 25 Jan 2019 07:09:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548428960; cv=none; d=google.com; s=arc-20160816; b=pe6ngWcl4MT+Bus9a68H/83eJQJLlASUjUleKNyqdgUUzMZXrN/Ue/e8KY/cvvJf8E rg6s3c+DbLYB8HhSA3YZZX6ZtE/EKDvAJ8gCbTVX4Fpa0Qv/4Y9URzqzmZ1I1bRj98Hn 6qyIRH/IW/YVW+Hu4cKnfi+eHTXV8mV3FuznWdXJAaHKoH6CtEREnTis8vkxAU6CkxX9 CAOQl0IpqxzwUG2pl0MuxgJ5cooXy9n1d1qYzYkil6qJ0RrYtaQAlXIZMkZC0j+PnsPx dKprrxKlGjqLNycQHpz7EMEW9wJQ0fuVLZ6GF/yWWkcTskY63Lg3bdxLh/zcxnS4oSCR EZZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=WTAIG5OEIiBixZfHGfrhlSBN4JcjdLtCzUT+X0a4FBk=; b=SD3Nlr/GNNo0GeZJWG2G5+JTFZXJ7xiHXdb6yFLEgG7nIsis1+gyc1pVYOw1z2hONq nkommHnC3cHE39hxbyHspqgJrjrKARhsMTDPTEIzf+JWZAMZu7FHMQtYLCWwc4vaXVSw p/k8wqRolI+jhGYhUBiG/FsdUSBLFn0hVnAg/9cSgzJTP09LDNgfWKjhg+5w9zgvJCKw WfQ/M+Q6K0Ciuo8CgEamuhl8sqrALVcV7cpvocq/2LvQGAzEgAb25pKimPc8Y/CZX3aq tB3tdu4xPgybiMdqalWu6Xn0xqMvw1899/rco8aOpU5egU1RsX/IB0l+BCPdoVJYoDO/ xD+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o19si21147509pfi.261.2019.01.25.07.09.20; Fri, 25 Jan 2019 07:09:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726238AbfAYPJT (ORCPT + 11 others); Fri, 25 Jan 2019 10:09:19 -0500 Received: from foss.arm.com ([217.140.101.70]:48734 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726216AbfAYPJT (ORCPT ); Fri, 25 Jan 2019 10:09:19 -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 E63DBA78; Fri, 25 Jan 2019 07:09:18 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 494403F5C1; Fri, 25 Jan 2019 07:09:17 -0800 (PST) From: Sudeep Holla To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Jisheng Zhang , Steve Longerbeam , Eugeniu Rosca , Joshua Frkuska , Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: [RFC PATCH] drivers core: cpu: add hotplug callback to update cpu_dev state to resumed Date: Fri, 25 Jan 2019 15:09:06 +0000 Message-Id: <20190125150906.27614-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190125130701.GA855@vmlxhi-102.adit-jv.com> References: <20190125130701.GA855@vmlxhi-102.adit-jv.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The sysfs for the cpu caches are managed by adding devices with cpu as the parent in cpu_device_create() when secondary cpu is brought onlin. Generally when the secondary CPUs are hotplugged back is as part of resume from suspend-to-ram, we call cpu_device_create() from the cpu hotplug state machine while the cpu device associated with that CPU is not yet ready to be resumed as the device_resume() call happens bit later. It's not really needed to set the flag is_prepared for cpu devices are they are mostly pseudo device and hotplug framework deals with state machine and not managed through the cpu device. This often results in annoying warning when resuming: Enabling non-boot CPUs ... CPU1: Booted secondary processor cache: parent cpu1 should not be sleeping CPU1 is up CPU2: Booted secondary processor cache: parent cpu2 should not be sleeping CPU2 is up .... and so on. Just fix the warning by updating the device state quite early. Cc: "Rafael J. Wysocki" Reported-by: Jisheng Zhang Reported-by: Steve Longerbeam Reported-by: Eugeniu Rosca Signed-off-by: Sudeep Holla --- drivers/base/cpu.c | 20 +++++++++++++++++++- include/linux/cpuhotplug.h | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) Hi Rafael, This is getting reported for quite some time. Let me know if you have better solution to fix this harmless yet annoying warnings during system resume. Regards, Sudeep -- 2.17.1 Tested-by: Eugeniu Rosca diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index eb9443d5bae1..ae0403528bff 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -80,6 +80,8 @@ void unregister_cpu(struct cpu *cpu) device_unregister(&cpu->dev); per_cpu(cpu_sys_devices, logical_cpu) = NULL; + + cpuhp_remove_state_nocalls(CPUHP_CPUDEV_PM_PREPARE); return; } @@ -355,6 +357,20 @@ 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); + + /* + * device_resume sets this for cpu_dev bit later but the child + * devices are resumes in the cpu hotplug state machine much + * before device_resume is called. + */ + 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 @@ -392,7 +408,9 @@ int register_cpu(struct cpu *cpu, int num) dev_pm_qos_expose_latency_limit(&cpu->dev, PM_QOS_RESUME_LATENCY_NO_CONSTRAINT); - 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 a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index fd586d0301e7..2ecb4c9370ce 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -69,6 +69,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,