From patchwork Thu Sep 2 10:16:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 505732 Delivered-To: patches@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1078644jai; Thu, 2 Sep 2021 03:16:39 -0700 (PDT) X-Received: by 2002:a2e:808a:: with SMTP id i10mr1778533ljg.396.1630577799453; Thu, 02 Sep 2021 03:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630577799; cv=none; d=google.com; s=arc-20160816; b=uDW+u4LQYBanRJIFkJ+E2F6ED5SDp1BrF4yCXRolBhFjx5YgQloDG5w78TTn3eMIZy Q93OvzIjS6IssLBkt00yab0pO1zNnEKzeQ6F+7DTsdVL5gz68JEH/yzJrpVvJghpsd+i CQeLsLatKZ41oSmrT7swdS/Ixj9xeJa7v1JIUNW3MPLXQwzw4oBSg/L7vFGi26Kslg6T 76cAPsS3PFIvpSl6lLRB2D2OIjh6zqoNj4HPGMImDsl431Kos8eXU0AyxzZs03H+UpKg gsNdSd/l63qVKGm+P7keUWn17mhNij/5PrRiKlMosJbS+X9ScoUw8VAVw1eEHdOUwt0+ B3+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=TywneFOHqk/q2lDRXrfDY/E+kQPlWfGyGjEe/NIEHS0=; b=YzkgDED+cvDihe9nHaBo0ADjkjjJpmIn63H2kLBLOdW6N2j3m0uKlLUQnLPXRYhmni QwIfcZBI+niBuyqz9wS5YiK0FE3eOcDCzLbKq/ytd+56fw/AxjaoZL0EJGLkcq04gPCs /6O4oQGjkLUw2J4aUbYI6HVvqXqxsS8iI9gQL93IwVrGZr/DtrKcGKcPT+hfWQgAzsXW E0XYEhHmOyFTcQL5CYSH0ZvbLr3V3lqS6zXUV9BNeP7E+ltBTP9WWYTUxpDoABJNHG0w 9Yjq76eZfat6a3i+kW246+OejY4kSv8sa0VZwlXd5hWdF4Li5MfyJorHP70VtBP2vq4h i4Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M8h86JEI; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id p9sor348127lfa.103.2021.09.02.03.16.39 for (Google Transport Security); Thu, 02 Sep 2021 03:16:39 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M8h86JEI; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TywneFOHqk/q2lDRXrfDY/E+kQPlWfGyGjEe/NIEHS0=; b=M8h86JEIQRSZsTCGeR6pJ1N/QzA6dqeytHrr1+dBQeZWjNPOTfftT1ZYil39lLRzuI /+Mky0RdvsbyLL56yPCl536D0WeL6Ge+/lZDCk/exQAWqKxd9H+o0c01eHWWwglrUpRP T6rYxeocRQZ2uxuTa8X72ndaRdn68a92qloDdxFsAlvY20Bty0tO/O4xi8qRis2n3Uyj xn7vV44D7K9e9DDVNFJGpwAFpNChcqJ05ELDkXzVr7LS4MsxrnJlysoa9m4Jne+TX+2S n+rhCEQYf762oGA3FnjWzLpElbBMOKWMDCywomJ+uxGYYqNIm+KR9x2U1gRDD2z1NdW6 QERA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TywneFOHqk/q2lDRXrfDY/E+kQPlWfGyGjEe/NIEHS0=; b=AFByTvOIrfYWMtAi7HggxDCISKcoBrPFyU/2kecKxplbhSpZamAYvkIvkFoTrIjj+6 04BmX0YEIrsMn8bl0OKPCGn9WZr96p4t5ivwNg0RWPzsZf3b6iX7LB066ZP7z6jv2yI1 PpVWN8qN0nlEfHCbuVaQkIrCzrhlOd+/7M8T6i9HfbOQxzRwSFgTSeUz635zDTsDSn/M 7VVeeiMm/sNr/eX4daT6/lYdM9uJXb5be+KixSskKB05die8/8HkttdC1siYCGnZ4aio xFqpmFg2KCmfIWp7kmAGu9T9ZKERb8uiIg8KXRPnmlLT3GgDQHrankDD5Lb3tIPqStt4 wE4g== X-Gm-Message-State: AOAM531LZOzxgjAedguW7nA5v7ffuQXrm4hV1w+MR0COoOX34tgQDf3V V9OO9B1ggimDrBoCwoZKzsOE4WaC X-Google-Smtp-Source: ABdhPJz03CxOy2DhzYQaRQsDsXZhX9SfdHEpc+fmAhDjGziDxiaA2v5/+BLy2btECx3VnNmdVU+HUQ== X-Received: by 2002:a05:6512:3091:: with SMTP id z17mr1987212lfd.418.1630577799097; Thu, 02 Sep 2021 03:16:39 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-146.NA.cust.bahnhof.se. [155.4.129.146]) by smtp.gmail.com with ESMTPSA id s4sm155897lfd.53.2021.09.02.03.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 03:16:38 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Viresh Kumar , Dmitry Osipenko , linux-pm@vger.kernel.org Cc: Dmitry Baryshkov , Jonathan Hunter , Thierry Reding , Rajendra Nayak , Stephan Gerhold , Bjorn Andersson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH 1/3] PM: domains: Drop the performance state vote for a device at detach Date: Thu, 2 Sep 2021 12:16:32 +0200 Message-Id: <20210902101634.827187-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210902101634.827187-1-ulf.hansson@linaro.org> References: <20210902101634.827187-1-ulf.hansson@linaro.org> MIME-Version: 1.0 When a device is detached from its genpd, genpd loses track of the device, including its performance state vote that may have been requested for it. Rather than relying on the consumer driver to drop the performance state vote for its device, let's do it internally in genpd when the device is getting detached. In this way, we makes sure that the aggregation of the votes in genpd becomes correct. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 9 ++------- include/linux/pm_domain.h | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 5db704f02e71..278e040f607f 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1665,6 +1665,8 @@ static int genpd_remove_device(struct generic_pm_domain *genpd, goto out; } + genpd_set_performance_state(dev, 0); + genpd->device_count--; genpd->max_off_time_changed = true; @@ -2604,12 +2606,6 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off) dev_dbg(dev, "removing from PM domain %s\n", pd->name); - /* Drop the default performance state */ - if (dev_gpd_data(dev)->default_pstate) { - dev_pm_genpd_set_performance_state(dev, 0); - dev_gpd_data(dev)->default_pstate = 0; - } - for (i = 1; i < GENPD_RETRY_MAX_MS; i <<= 1) { ret = genpd_remove_device(pd, dev); if (ret != -EAGAIN) @@ -2702,7 +2698,6 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev, ret = dev_pm_genpd_set_performance_state(dev, pstate); if (ret) goto err; - dev_gpd_data(dev)->default_pstate = pstate; } return 1; diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 67017c9390c8..21a0577305ef 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -198,7 +198,6 @@ struct generic_pm_domain_data { struct notifier_block *power_nb; int cpu; unsigned int performance_state; - unsigned int default_pstate; unsigned int rpm_pstate; ktime_t next_wakeup; void *data;