From patchwork Tue Oct 13 14:10:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 54852 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 0E39620490 for ; Tue, 13 Oct 2015 14:10:48 +0000 (UTC) Received: by lbbti1 with SMTP id ti1sf10248882lbb.3 for ; Tue, 13 Oct 2015 07:10:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=VxZeYVBKQPxZ6PXDN9yybkira8AVIKwoY5nKTJOm5J8=; b=XGVtwd/+IWAFoMcU26P1D1mrIadX1b8X8prP5lcDzq2NPi/l6KT7++Dkoy8UBquJgR OZZFxhbO1O+no8q4Kzq4zSldGBUDntfxngMAWgrP7GxQ9xpqhJVUcmsi5FTSgV5LzDu3 G16mHlSS8fVKcC0yRKJ1oA+NWIbBBdKv5eZQmcTERpVM6btaCeeSZPUjNA+mFhhN/tLm 8ls61i9Cpz726NyasELKozMstPAQ5DI++flTI4w9kSs8fue2H4k72AUbBfKi0+vzxE/e Xzl1lWqORBauwGRwXR5Tpz1Zo/LZJwgJEKC18492Lc2HFObN6Lt8K4MIhCS0tCPs+WQd JNSA== X-Gm-Message-State: ALoCoQnAc2fYrihptKwF43fclGZhz9umNZZhrBpFOBtAr4y91fxvVPRSHQ+GvRc4EjpFKgmamJ1d X-Received: by 10.180.210.212 with SMTP id mw20mr4282089wic.3.1444745446899; Tue, 13 Oct 2015 07:10:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.81.208 with SMTP id f199ls166327lfb.101.gmail; Tue, 13 Oct 2015 07:10:46 -0700 (PDT) X-Received: by 10.112.132.74 with SMTP id os10mr15132437lbb.40.1444745446751; Tue, 13 Oct 2015 07:10:46 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id nu8si2283312lbb.111.2015.10.13.07.10.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2015 07:10:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbck17 with SMTP id ck17so21754774lbb.1 for ; Tue, 13 Oct 2015 07:10:46 -0700 (PDT) X-Received: by 10.25.28.73 with SMTP id c70mr8327767lfc.76.1444745446384; Tue, 13 Oct 2015 07:10:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2155517lbq; Tue, 13 Oct 2015 07:10:44 -0700 (PDT) X-Received: by 10.112.52.40 with SMTP id q8mr15271143lbo.100.1444745444668; Tue, 13 Oct 2015 07:10:44 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id d2si2273477lbc.149.2015.10.13.07.10.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2015 07:10:44 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbk10 with SMTP id k10so21797050lbb.0 for ; Tue, 13 Oct 2015 07:10:44 -0700 (PDT) X-Received: by 10.112.147.39 with SMTP id th7mr15111076lbb.82.1444745443776; Tue, 13 Oct 2015 07:10:43 -0700 (PDT) Received: from uffe-Latitude-E6430s.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id m133sm551703lfg.47.2015.10.13.07.10.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Oct 2015 07:10:43 -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 , Krzysztof Kozlowski Subject: [PATCH] PM / Domains: Fix validation of latency constraints in genpd governor Date: Tue, 13 Oct 2015 16:10:28 +0200 Message-Id: <1444745428-4396-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Commit ba2bbfbf6307 ("PM / Domains: Remove intermediate states from the power off sequence") changed the power off sequence in genpd. That also required some updates regarding the validation of latency constraints in the genpd governor. Unfortunate that wasn't covered, so let's fix this. >From a runtime PM and latency point of view, we need to consider the worst case scenario while validating latency constraints. That's typically when a call to pm_runtime_get_sync() needs to wait for a ongoing runtime suspend operation to be carried out, as it then also needs to wait for the device to be runtime resumed again. The above mentioned commit made the genpd governor's ->stop_ok() callback responsible of validating genpd's device's runtime suspend/resume latency. In other words, the constraint needs to be validated towards the relevant latencies present in genpd's ->runtime_suspend|resume() callbacks. Earlier, that included latencies from the ->stop|start() callbacks, but as ->save|restore_state() are now also being invoked from genpd's ->runtime_suspend|resume() and to comply with the worst case scenario, let's take also those latencies into account. Fixes: ba2bbfbf6307 ("PM / Domains: Remove intermediate states from the power off sequence") Signed-off-by: Ulf Hansson --- drivers/base/power/domain_governor.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c index 2a4154a..85e17ba 100644 --- a/drivers/base/power/domain_governor.c +++ b/drivers/base/power/domain_governor.c @@ -77,13 +77,16 @@ static bool default_stop_ok(struct device *dev) dev_update_qos_constraint); if (constraint_ns > 0) { - constraint_ns -= td->start_latency_ns; + constraint_ns -= td->save_state_latency_ns + + td->stop_latency_ns + + td->start_latency_ns + + td->restore_state_latency_ns; if (constraint_ns == 0) return false; } td->effective_constraint_ns = constraint_ns; - td->cached_stop_ok = constraint_ns > td->stop_latency_ns || - constraint_ns == 0; + td->cached_stop_ok = constraint_ns >= 0; + /* * The children have been suspended already, so we don't need to take * their stop latencies into account here. @@ -126,18 +129,6 @@ static bool default_power_down_ok(struct dev_pm_domain *pd) off_on_time_ns = genpd->power_off_latency_ns + genpd->power_on_latency_ns; - /* - * It doesn't make sense to remove power from the domain if saving - * the state of all devices in it and the power off/power on operations - * take too much time. - * - * All devices in this domain have been stopped already at this point. - */ - list_for_each_entry(pdd, &genpd->dev_list, list_node) { - if (pdd->dev->driver) - off_on_time_ns += - to_gpd_data(pdd)->td.save_state_latency_ns; - } min_off_time_ns = -1; /* @@ -193,7 +184,6 @@ static bool default_power_down_ok(struct dev_pm_domain *pd) * constraint_ns cannot be negative here, because the device has * been suspended. */ - constraint_ns -= td->restore_state_latency_ns; if (constraint_ns <= off_on_time_ns) return false;