Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5053913pxj; Wed, 9 Jun 2021 08:08:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynq+yhX5obAFtp0cZLQjY6YMK226rBzbKw0H3yl3of3AyuRnk06Uwkux0uol3Dcqc9UBog X-Received: by 2002:a05:6402:612:: with SMTP id n18mr30525176edv.83.1623251329855; Wed, 09 Jun 2021 08:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623251329; cv=none; d=google.com; s=arc-20160816; b=Hmdo83iWGfRjVn+wXUKduCJRLz14fnzYYUzmqborUZJQxRFwXD0/RC69T0mphqyJTN bwB6d4cNlq9lT6qaIjKnZWk5tO4tiSQfW+hVgIaaJaiEFsVe5DblxyIhbFET7Bzlxg9z Zhav3JgAedzyG7RJCVXqhivedOfX0wDJU433t17vLMxiS03Opie6IF7/hc84OKPCpcji zsJwCPz0JsNqCxiP0mUu0Q+7Fh6ukWYqyK9OdHAsGbO2e8FBuUbMpxygslrwWrgn3eNZ lLeZYhe+J5ciyjnLWxb0Pak30ciWPGn9vxhlNDO1JUtnS30Bek0UcfnGlmKFNBIvzKdS r+Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hucOmK/CjweQJSSO1Hf7ZZzsD4aQuXOkD7vA3MTZoGs=; b=r9Dhl/fqbwkVRVnNdhG8qJSvkH38aR0YuOhpGZu7Xq0Q6AokLREk5pNzqI2A6Ju/dc tTL/DyaRkXNlBNdiOMi7PUEUyD91w3oK/a6djTQVZ3sY4CwXXFWCAOvDUCPYL1FGZif6 x47XT/oRn9DZGTcEGQYipcCdXVXD2ei6JqIV2mBLLr4g1MnfbqQkAuTYhhEwo/cs+XUn 6PeXU0ieoTBo02NXjY7ZzG5ZMb8pLu740acljH50re4JYzFtpN12Rk9W2U5YCFRKUVxF VU1+r7+qwoXc2y5yvkBMw2x29rhAZrI2G6pMF25jtT7RXDdzr7RewovRD0Z5HiVZVQtC T6YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x9aAzg/x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la20si72413ejc.3.2021.06.09.08.08.26; Wed, 09 Jun 2021 08:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x9aAzg/x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231478AbhFIM2E (ORCPT + 99 others); Wed, 9 Jun 2021 08:28:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbhFIM2D (ORCPT ); Wed, 9 Jun 2021 08:28:03 -0400 Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81E60C061574 for ; Wed, 9 Jun 2021 05:25:58 -0700 (PDT) Received: by mail-vs1-xe2b.google.com with SMTP id x13so4310690vsf.11 for ; Wed, 09 Jun 2021 05:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hucOmK/CjweQJSSO1Hf7ZZzsD4aQuXOkD7vA3MTZoGs=; b=x9aAzg/x5G9mUEdZDORGkYQ24KtiAFvlulFcNv4ktthMC/3J6t3F4t+kdB69qCFRaX ut5simhYHjRbFuAeYs8lYlRmz4HULtCyugBU0WouLgYznvTJx9Wyok44ow82WkwvGdRe /Msa7dX2PiGH0gafRD2/nPxCLsg2SY2J4Yqt7dn9DzRqmiH1hNDITFiOnG9ZYQHTOuKE 0ShI1IdrLCvAPWH07Z2e9KitGYkaiCX7QcmH9NKIeTIVcxH5kaOdChmaEd1M5xkGV6GA MvNLNu2utrcE9S/O1HkcN10HUs5iPjY6ipic8Dss80q/4PA/+ndM1zDSXp4pE7n8lo1U fiPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hucOmK/CjweQJSSO1Hf7ZZzsD4aQuXOkD7vA3MTZoGs=; b=efu0CdiNmW5XIT1N3HFMibUfmA8o8+Aki+N2TK2n0xTWZgml04Z0pNUmv2u7qn74Wl b3VTGpq+TLiesn41TT9vO09kol8D54ISAluLrvDcz8if0orFMCkyHxh3Y+pn2WgcaPlb k4v8pm6BZf3KFQCyYY2e+DZ6tinKhCVb+2Qk5Bfi2iQNpTar2L5Xvydyrs0YExnle7ui 69xdclr+2HpiEZb2WYI0/bi2d8pQxP1s8uajauLvpvBlaUUt9ZiUXHgApBwLWFslvscy 7vRKTJsPmoYjj9neQw5Q71J7nJIjYDS+XgElHOxFJwO8Anqw+3cmgOKW9TwQhiBNL0F5 ez6g== X-Gm-Message-State: AOAM532KSlSQU6VCWYCQhOkLmrS0q1/ViMXAB2JV413QYDYSkkkW+HAE IJ8vS3gyEN4TqAbZsfEfeie9ngZGr1U0sItOmn9ZOQ== X-Received: by 2002:a05:6102:d1:: with SMTP id u17mr4787199vsp.48.1623241557705; Wed, 09 Jun 2021 05:25:57 -0700 (PDT) MIME-Version: 1.0 References: <20210603093438.138705-1-ulf.hansson@linaro.org> <20210603093438.138705-4-ulf.hansson@linaro.org> <20210603095538.b2t3cq25tq7v7kih@vireshk-i7> <20210604035312.jp2gshfigsodwvcg@vireshk-i7> <20210607044738.3aec6o4imq6u3x6e@vireshk-i7> In-Reply-To: <20210607044738.3aec6o4imq6u3x6e@vireshk-i7> From: Ulf Hansson Date: Wed, 9 Jun 2021 14:25:21 +0200 Message-ID: Subject: Re: [PATCH v2 3/4] PM: domains: Drop/restore performance state votes for devices at runtime PM To: Viresh Kumar Cc: "Rafael J . Wysocki" , Linux PM , Dmitry Osipenko , Jonathan Hunter , Thierry Reding , Rajendra Nayak , Stephan Gerhold , Roja Rani Yarubandi , Bjorn Andersson , Vincent Guittot , Stephen Boyd , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 7 Jun 2021 at 06:47, Viresh Kumar wrote: > > On 04-06-21, 09:45, Ulf Hansson wrote: > > Starting calls from the subsystem/driver: > > > > ------ > > dev_pm_genpd_set_performance_state(dev, 100); > > "run a use case with device runtime resumed" > > ... > > "use case ends" > > dev_pm_genpd_set_performance_state(dev, 0); > > pm_runtime_put() > > ->genpd_runtime_suspend() > > gpd_data->performance_state == 0, -> gpd_data->rpm_pstate = 0; > > ... > > "new use case start" > > dev_pm_genpd_set_performance_state(dev, 100); > > pm_runtime_get_sync() > > ->genpd_runtime_resume() > > gpd_data->performance_state == 100, -> gpd_data->rpm_pstate = 0; > > (This is where we need to check for "zero" to not override the value) > > ..... > > ------ > > > > I wouldn't say that the above is the way how I see the calls to > > dev_pm_genpd_set_performance_state (or actually > > dev_pm_opp_set_rate|opp()) being deployed. The calls should rather be > > done from the subsystem/driver's ->runtime_suspend|resume() callback, > > then the path above would work in the way you suggest. > > > > Although, as we currently treat performance states and power states in > > genpd orthogonally, I wanted to make sure we could cope with both > > situations. > > I think letting the drivers to call > dev_pm_genpd_set_performance_state(dev, 0) from suspend/resume makes > it really ugly/racy as both depend on the gpd_data->performance_state > for this. It doesn't look nice. And we shouldn't try to protect such > drivers. > > Anyway, your call :) Well, I am not sure we have an option at this point. As long as we allow performance states to be managed orthogonally to on/off states in genpd, the check in genpd_restore_performance_state() is needed. I have started to prepare a new version of the series - and will add a comment about this in the code to try to clarify this. [...] Kind regards Uffe