From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F8F0C432BE for ; Mon, 23 Aug 2021 15:54:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23447613DA for ; Mon, 23 Aug 2021 15:54:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 23447613DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DAD61892BC; Mon, 23 Aug 2021 15:54:31 +0000 (UTC) Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by gabe.freedesktop.org (Postfix) with ESMTPS id 298E2892BC for ; Mon, 23 Aug 2021 15:54:31 +0000 (UTC) Received: by mail-lf1-x129.google.com with SMTP id o10so38842712lfr.11 for ; Mon, 23 Aug 2021 08:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7mncJ6pduW/52O6ekhmOFTY3dWeez/jgkRyR/0Vdsyw=; b=GjDLwuw1u5t0huse+wcSUJvd9NlDsq9fLH5ifMhjoFLd/jX7arhT4V0b4pMg9fkZx0 SFoXhZrGpDe1zyz7PwMpqtrmGVNRg4uenD426vrzx09jDp5+gZwPaSOWi2CzEdhHZN72 biZ9w4cugGtwCB8oOkwmNR+z285tRdqilLSsiYBx3KMs+2gRQ2Qufwsaf9Kkn44cA20t ytzwyZjnYP+KTq05NUlj+435IalTyox6/J6oSbEJjWcMz4NbsCi+r8m8O7scEsRH0iPC mwCHAhLhpQqHYFd7f4axkEH/iwpXUU5wQP5pO5DMDqwE7H45GOLzvXAyvPw0J1h3bnVb 85LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7mncJ6pduW/52O6ekhmOFTY3dWeez/jgkRyR/0Vdsyw=; b=KbO/4vnNv/SdWcgO28EQtkQgXVE6o4xCfMahFrz+fj3O/8SsLbxj7rMErY+UhMu0j5 Kth2Pi/T79oQs+6no11GhFZSJG5hkRyf34TnaoXJTSzcU+90IF0FnbWkHsCCIeU689Zj UdWx8qwHAdFX+tdUuBG2TH2rFEpyf4/p8AjGxsEtYQBQUcCBuWhNOqsSnYJVGcG83XTe rca55F/r97Zj0vOvEEZEVRm/j6LS2Qw0dpMdQYz18LaKUIJDgaPYfP/A1qsaaZJZ5ZkW PCKTgBV5xZ/oxQZpc/SdDTO0S/gYIzaRAYQ2OBaxWJzxkTPFi0ZQbz4IKB4IgZBZPWm9 fcOQ== X-Gm-Message-State: AOAM530y76FdN5XVSIgsXETWvSrIx5BErJL1veEFPF+qb62w5WiVY2Bw qRUIo/mZj3Nn1rk+6B+dRgg= X-Google-Smtp-Source: ABdhPJzNDGjnGQzIrcQXTM2iukhjwhqvC5wj3OdYqtfrrWEzlRV302pS9l5Dkjzi+NNxjkL6pb5dHg== X-Received: by 2002:a05:6512:3157:: with SMTP id s23mr24865578lfi.247.1629734069444; Mon, 23 Aug 2021 08:54:29 -0700 (PDT) Received: from [192.168.2.145] (46-138-120-72.dynamic.spd-mgts.ru. [46.138.120.72]) by smtp.googlemail.com with ESMTPSA id u2sm1482543lfr.79.2021.08.23.08.54.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Aug 2021 08:54:28 -0700 (PDT) Subject: Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper To: Ulf Hansson Cc: Viresh Kumar , Thierry Reding , Jonathan Hunter , Viresh Kumar , Stephen Boyd , Peter De Schrijver , Mikko Perttunen , Peter Chen , Mark Brown , Lee Jones , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Nishanth Menon , Vignesh Raghavendra , Richard Weinberger , Miquel Raynal , Lucas Stach , Stefan Agner , Adrian Hunter , Mauro Carvalho Chehab , Rob Herring , Michael Turquette , Linux Kernel Mailing List , linux-tegra , Linux PM , Linux USB List , linux-staging@lists.linux.dev, linux-spi@vger.kernel.org, linux-pwm@vger.kernel.org, linux-mtd@lists.infradead.org, linux-mmc , Linux Media Mailing List , dri-devel , DTML , linux-clk References: <20210818043131.7klajx6drvvkftoc@vireshk-i7> <20210818045307.4brb6cafkh3adjth@vireshk-i7> <080469b3-612b-3a34-86e5-7037a64de2fe@gmail.com> <20210818055849.ybfajzu75ecpdrbn@vireshk-i7> <20210818062723.dqamssfkf7lf7cf7@vireshk-i7> <20210818091417.dvlnsxlgybdsn76x@vireshk-i7> <20210818095044.e2ntsm45h5cddk7s@vireshk-i7> <0354acbe-d856-4040-f453-8e8164102045@gmail.com> <87073fc2-d7b3-98f4-0067-29430ea2adef@gmail.com> <9129a9f0-8c9b-d8e0-ddf5-c8820871fb7f@gmail.com> From: Dmitry Osipenko Message-ID: <9a783eb3-786b-a3b2-7854-2be6954527db@gmail.com> Date: Mon, 23 Aug 2021 18:54:26 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 23.08.2021 13:46, Ulf Hansson пишет: >>> ... >>> dev_pm_opp_set_rate(rate) >>> pm_runtime_get_noresume() >>> pm_runtime_set_active() >>> pm_runtime_enable() >>> ... >>> pm_runtime_put() >>> ... >>> >>> We need to call genpd_set_performance_state() independently of whether >>> the device is runtime suspended or not. >> >> I don't see where is the problem in yours example. >> >> pm_runtime_suspended() = false while RPM is disabled. When device is >> resumed, the rpm_pstate=0, so it won't change the pstate on resume. > > Yes, you are certainly correct, my bad! I mixed it up with > pm_runtime_status_suspended(), which only cares about the status. > > So, after a second thought, your suggestion sounds very much > reasonable to me! I have also tried to consider all different > scenarios, including the system suspend/resume path, but I think it > should be fine. It could be improved slightly to cover more cases. > I also think that a patch like the above should be considered as a > fix, because it actually fixes a problem, according to what I said in > my earlier reply, below. > > Fixes : 5937c3ce2122 ("PM: domains: Drop/restore performance state > votes for devices at runtime PM"). > >> >>> Although, it actually seems like good idea to update >>> dev_gpd_data(dev)->rpm_pstate = state here, as to make sure >>> genpd_runtime_resume() doesn't restore an old/invalid value that was >>> saved while dropping the performance state vote for the device in >>> genpd_runtime_suspend() earlier. >>> >>> Let me send a patch for this shortly, to close this window of a possible error. >> >> It will also remove the need to resume device just to change the clock >> rate, like I needed to do it in the PWM patch of this series. > > Do you want to send the patch formally? Or do you prefer it if I do it? I'll send the patch.