From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50D243FC3 for ; Mon, 23 Aug 2021 15:54:31 +0000 (UTC) Received: by mail-lf1-f43.google.com with SMTP id j4so3973269lfg.9 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=N3KhMAPJx1nStvF8BHQz8K8bQrXjfDJ4VWmtDOcB0xfJZ51D5qDNVY99e4MebVOZ0N sst7j0ULXn4c/jjkpVV0+xWS4aimlW5/2UzVfw4oWMNQ/s0fByHW4aijIz6gCm6Undec uzuNL/dN5Sw2t2sVAJiAV9ZcMYsv5FnIft75ec/9+TaBMqhrVJzi6mU2iC+q6Lm18r8X i7aIr8eAAChhuO2V8tdsM07I29i4EirVRyVTWltsPG50r3q+I2tLuPE19LX0Rjnn31To 8bZnv3T6IyDxzvdt6YMLXRaICE/SBjPmbbqJmkp4RdHglDlk4xCRd+M/OWmBup7XryiY YODA== X-Gm-Message-State: AOAM53145KwVXwu109lY6vTtZPs8wnkFxBxMmndr62dN1J1luuaG4HeG zdFkgXEzLGL0sqqYWhxJA9w= 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 Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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.