Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7297343imu; Thu, 31 Jan 2019 08:07:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN4MYaywZ4tYYSjyjLXMZYGxmvLEJhy3jAJTf4klRQ7iKh8XK2z+TDI1esR8QOmhYIPTPHaW X-Received: by 2002:a17:902:f082:: with SMTP id go2mr35455254plb.115.1548950835750; Thu, 31 Jan 2019 08:07:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548950835; cv=none; d=google.com; s=arc-20160816; b=B4qPX5311jvC6ZnNsxw8ltj2ZFbcytgzB35sZTiT+zFgyqrnzFdY1a7OBDUzmBr2C9 K7yaGBAfeSKaVrYpcTOtV1UaxaXVzhutzM2uQgrYgNTMvJtmF0b344T6/ShC017tBr7B VvgnwS8qs3zw/4e4mP6GS6lGzdmHlhS2FgAKwh2hQcyBQ9AeyIJANu4DFYRZgQEv24mO jTuWlhdFUvrAVrmLSvC90JoKaKTbZMdoJBM64iFsFDXnmpkO4eOU0x9lBTiybo59ruv+ rRC+yNcUEgL7J2cqiEb3c6NO3GJSTER2JdfMzVW9pAGlOFNkVKjv9HIwEPom2/KCITJw T1nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1jpQ7dx0GvWVk1xtHu/RRkNWO69eulGtNkkjd6TIPQg=; b=vON2C7UYN5g3xitj5/I+9CRFme4GPi2nCpDgXOQy+W5mXL+PL8yjRPIYjVRFjVr+bV DGqjPfx2yS/5yqlkPEhXrxgy7M1d6T5bxa1q30mALaIwHuvBy7dToROMpp4T6ToX//9W muOnnMKKUuYT56ZEDiyRAuPhO+uODSQb7RHeZObiuCuGji5vXvK10yJ3HqtoGSla1h3j zzKFjrmCoWI5tZ7XPPj40d152M/lFu1SIWkhi844Mx3k/v3W8RWA2jmhmCafreHIRTO3 V4ZO/VRcP48+4hInnaeip7MJL3bHHcCos6aJjR2L5xudpiYk4BA8G6nv/mORhOmYH9Gy mUbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 l185si3850748pgd.253.2019.01.31.08.06.55; Thu, 31 Jan 2019 08:07:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388045AbfAaQGI (ORCPT + 99 others); Thu, 31 Jan 2019 11:06:08 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:46922 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733167AbfAaQGI (ORCPT ); Thu, 31 Jan 2019 11:06:08 -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 983FF80D; Thu, 31 Jan 2019 08:06:07 -0800 (PST) Received: from e107155-lin (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EF0B33F557; Thu, 31 Jan 2019 08:06:05 -0800 (PST) Date: Thu, 31 Jan 2019 16:05:59 +0000 From: Sudeep Holla To: "Rafael J. Wysocki" Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Jisheng Zhang , Steve Longerbeam , Eugeniu Rosca , Joshua Frkuska , Greg Kroah-Hartman , Sudeep Holla Subject: Re: [RFC PATCH] drivers core: cpu: add hotplug callback to update cpu_dev state to resumed Message-ID: <20190131160559.GA32759@e107155-lin> References: <20190125130701.GA855@vmlxhi-102.adit-jv.com> <20190125150906.27614-1-sudeep.holla@arm.com> <2397404.eE4apdlqQK@aspire.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2397404.eE4apdlqQK@aspire.rjw.lan> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 31, 2019 at 12:48:49AM +0100, Rafael J. Wysocki wrote: > On Friday, January 25, 2019 4:09:06 PM CET Sudeep Holla wrote: > > 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. > > I'd rather have a flag in struct dev_pm_info that will cause the message to > be suppressed if set. > > It could be used for other purposes too then in princple (like skipping the > creation of empty "power" attr groups in sysfs for devices that don't > need them etc.). > Thanks for the suggestion. I did quick hack and came up with something below. I wanted to run through you once before I materialise it into a formal patch to check if I understood your suggestion correctly. We can move no_pm_required outside dev_pm_info struct and rename with any better names. -->8 diff --git i/drivers/base/cpu.c w/drivers/base/cpu.c index eb9443d5bae1..b61f9772ed33 100644 --- i/drivers/base/cpu.c +++ w/drivers/base/cpu.c @@ -379,6 +379,7 @@ int register_cpu(struct cpu *cpu, int num) cpu->dev.bus->uevent = cpu_uevent; #endif cpu->dev.groups = common_cpu_attr_groups; + cpu->dev.power.no_pm_required = true; if (cpu->hotpluggable) cpu->dev.groups = hotplugable_cpu_attr_groups; error = device_register(&cpu->dev); @@ -427,6 +428,7 @@ __cpu_device_create(struct device *parent, void *drvdata, dev->parent = parent; dev->groups = groups; dev->release = device_create_release; + dev->power.no_pm_required = true; dev_set_drvdata(dev, drvdata); retval = kobject_set_name_vargs(&dev->kobj, fmt, args); diff --git i/drivers/base/power/main.c w/drivers/base/power/main.c index 0992e67e862b..ed1b133f73db 100644 --- i/drivers/base/power/main.c +++ w/drivers/base/power/main.c @@ -124,6 +124,8 @@ void device_pm_unlock(void) */ void device_pm_add(struct device *dev) { + if (dev->power.no_pm_required) + return; pr_debug("PM: Adding info for %s:%s\n", dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); device_pm_check_callbacks(dev); @@ -142,6 +144,8 @@ void device_pm_add(struct device *dev) */ void device_pm_remove(struct device *dev) { + if (dev->power.no_pm_required) + return; pr_debug("PM: Removing info for %s:%s\n", dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); complete_all(&dev->power.completion); diff --git i/drivers/base/power/sysfs.c w/drivers/base/power/sysfs.c index d713738ce796..54c1bfec396e 100644 --- i/drivers/base/power/sysfs.c +++ w/drivers/base/power/sysfs.c @@ -648,6 +648,9 @@ int dpm_sysfs_add(struct device *dev) { int rc; + if (dev->power.no_pm_required) + return 0; + rc = sysfs_create_group(&dev->kobj, &pm_attr_group); if (rc) return rc; diff --git i/include/linux/pm.h w/include/linux/pm.h index 0bd9de116826..300ab9f0b858 100644 --- i/include/linux/pm.h +++ w/include/linux/pm.h @@ -592,6 +592,7 @@ struct dev_pm_info { bool is_suspended:1; /* Ditto */ bool is_noirq_suspended:1; bool is_late_suspended:1; + bool no_pm_required:1; bool early_init:1; /* Owned by the PM core */ bool direct_complete:1; /* Owned by the PM core */ u32 driver_flags;