From patchwork Wed Sep 21 13:38:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 76687 Delivered-To: patches@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2056375qgf; Wed, 21 Sep 2016 06:39:04 -0700 (PDT) X-Received: by 10.25.125.4 with SMTP id y4mr13796384lfc.75.1474465144548; Wed, 21 Sep 2016 06:39:04 -0700 (PDT) Return-Path: Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com. [2a00:1450:4010:c07::22a]) by mx.google.com with ESMTPS id 184si15622906ljf.12.2016.09.21.06.39.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Sep 2016 06:39:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22a as permitted sender) client-ip=2a00:1450:4010:c07::22a; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22a as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22a.google.com with SMTP id y6so41711202lff.1 for ; Wed, 21 Sep 2016 06:39:04 -0700 (PDT) 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; bh=0p/uhD7KFOwMBaq8iRWH0N/mAXqmj7cS879XwMbrDTY=; b=U2J1Wb3p6iv1vRy3YQLhoRkxPKaqzqaeUjY9BI0inVwjBJUwd+Og/smy0gLwmfBkGr CQ8/Ubxrug9fsQI+EPxM+WnzvUXoUJ1YMt1BHClCbrveJIZ6etuN2XROBGvM6i/TJodL Ud2Q+LqAJWA6WPB0xCHnQDaGEu+VyUWmL3er0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0p/uhD7KFOwMBaq8iRWH0N/mAXqmj7cS879XwMbrDTY=; b=Ea3Nyd+l6vU1eXDISq7Ibf/Oc99eFnckvUouf59dekD2RB7aobdCDRrNZpON01YONB lC7IOB3i8BCiWdqCHoay/kG22RSWWD6G8eqy1Hkr64DaLBwo8nccedlvSzLuhjocqVhT poPkIJA7CWSuLBwc0rvNipXujud5ZYk3yySW8+OSREgvz4zUjltxWOfQRuAaFuXREpe2 WgSOAVcILwwNe4tpYvqGmm/LMMJ7rujSUOjGMo+gTVLI/gGxbHZYRUgiJ18x1vIEKR/v tJBogm8PQ/EClhMtfOM+AALCCXeoVqsdUt12RD51EqQxdG9pDNDTlXo7hUas6gDrskyh vLKA== X-Gm-Message-State: AE9vXwO8tadz+fcHV8eQazLBSevUdDSmBTKlPVGgsvmHc4vjnVCd/XXHTkfi/6LUrF7C6TcTQ10= X-Received: by 10.25.92.155 with SMTP id u27mr7552678lfi.51.1474465144079; Wed, 21 Sep 2016 06:39:04 -0700 (PDT) Return-Path: Received: from uffe-Latitude-E6430s.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id s125sm6710569lja.14.2016.09.21.06.39.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Sep 2016 06:39:02 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , linux-pm@vger.kernel.org Cc: Len Brown , Pavel Machek , Geert Uytterhoeven , Lina Iyer , Jon Hunter Subject: [PATCH 3/4] PM / Domains: Don't measure latency of ->power_on|off() during system PM Date: Wed, 21 Sep 2016 15:38:52 +0200 Message-Id: <1474465133-14865-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474465133-14865-1-git-send-email-ulf.hansson@linaro.org> References: <1474465133-14865-1-git-send-email-ulf.hansson@linaro.org> Measure latency does by itself contribute to an increased latency, thus we should avoid it when it isn't needed. Currently genpd measures latencies in the system PM phase for the ->power_on|off() callbacks, except in the syscore case when it's not allowed to use ktime_get() as timekeeping may be suspended. Since there should be plenty of occasions during runtime PM to perform these measurements, let's rely on that and drop them from system PM. This will also make it consistent for how measurements are done of the runtime PM callbacks (as those may be invoked during system PM). Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) -- 1.9.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 661ac3a..d52709e 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -619,7 +619,6 @@ static bool genpd_dev_active_wakeup(struct generic_pm_domain *genpd, /** * pm_genpd_sync_poweroff - Synchronously power off a PM domain and its masters. * @genpd: PM domain to power off, if possible. - * @timed: True if latency measurements are allowed. * * Check if the given PM domain can be powered off (during system suspend or * hibernation) and do that if so. Also, in that case propagate to its masters. @@ -629,8 +628,7 @@ static bool genpd_dev_active_wakeup(struct generic_pm_domain *genpd, * executed sequentially, so it is guaranteed that it will never run twice in * parallel). */ -static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd, - bool timed) +static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd) { struct gpd_link *link; @@ -643,28 +641,26 @@ static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd, /* Choose the deepest state when suspending */ genpd->state_idx = genpd->state_count - 1; - genpd_power_off(genpd, timed); + genpd_power_off(genpd, false); genpd->status = GPD_STATE_POWER_OFF; list_for_each_entry(link, &genpd->slave_links, slave_node) { genpd_sd_counter_dec(link->master); - pm_genpd_sync_poweroff(link->master, timed); + pm_genpd_sync_poweroff(link->master); } } /** * pm_genpd_sync_poweron - Synchronously power on a PM domain and its masters. * @genpd: PM domain to power on. - * @timed: True if latency measurements are allowed. * * This function is only called in "noirq" and "syscore" stages of system power * transitions, so it need not acquire locks (all of the "noirq" callbacks are * executed sequentially, so it is guaranteed that it will never run twice in * parallel). */ -static void pm_genpd_sync_poweron(struct generic_pm_domain *genpd, - bool timed) +static void pm_genpd_sync_poweron(struct generic_pm_domain *genpd) { struct gpd_link *link; @@ -672,11 +668,11 @@ static void pm_genpd_sync_poweron(struct generic_pm_domain *genpd, return; list_for_each_entry(link, &genpd->slave_links, slave_node) { - pm_genpd_sync_poweron(link->master, timed); + pm_genpd_sync_poweron(link->master); genpd_sd_counter_inc(link->master); } - genpd_power_on(genpd, timed); + genpd_power_on(genpd, false); genpd->status = GPD_STATE_ACTIVE; } @@ -788,7 +784,7 @@ static int pm_genpd_suspend_noirq(struct device *dev) * the same PM domain, so it is not necessary to use locking here. */ genpd->suspended_count++; - pm_genpd_sync_poweroff(genpd, true); + pm_genpd_sync_poweroff(genpd); return 0; } @@ -818,7 +814,7 @@ static int pm_genpd_resume_noirq(struct device *dev) * guaranteed that this function will never run twice in parallel for * the same PM domain, so it is not necessary to use locking here. */ - pm_genpd_sync_poweron(genpd, true); + pm_genpd_sync_poweron(genpd); genpd->suspended_count--; if (genpd->dev_ops.stop && genpd->dev_ops.start) @@ -911,7 +907,7 @@ static int pm_genpd_restore_noirq(struct device *dev) */ genpd->status = GPD_STATE_POWER_OFF; - pm_genpd_sync_poweron(genpd, true); + pm_genpd_sync_poweron(genpd); if (genpd->dev_ops.stop && genpd->dev_ops.start) ret = pm_runtime_force_resume(dev); @@ -966,9 +962,9 @@ static void genpd_syscore_switch(struct device *dev, bool suspend) if (suspend) { genpd->suspended_count++; - pm_genpd_sync_poweroff(genpd, false); + pm_genpd_sync_poweroff(genpd); } else { - pm_genpd_sync_poweron(genpd, false); + pm_genpd_sync_poweron(genpd); genpd->suspended_count--; } }