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=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 1E53AC47082 for ; Mon, 7 Jun 2021 04:48:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0CCE6120F for ; Mon, 7 Jun 2021 04:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbhFGEt6 (ORCPT ); Mon, 7 Jun 2021 00:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbhFGEtq (ORCPT ); Mon, 7 Jun 2021 00:49:46 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D32F5C061787 for ; Sun, 6 Jun 2021 21:47:42 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id k7so9036537pjf.5 for ; Sun, 06 Jun 2021 21:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=t83CoRT70i5x93MDZL3zD/Wyg9e/rIbO96dXM25y8Dk=; b=q6c3ljZ+B497ioExVAaGV9G8aiqtHkHXitdctjXbOq1Y055WWMWyuGIPwmFD07b1Zh k/y+bopMGOtiPBCa/+51Aa1CXzJly49kQkBX4rS4SaU8smnZjgAoOtoYs2Uzr/43lTn8 adaqlbhLKCS+LtUrRYPZmm8CfgKRmr4FQ/YtKXUtMX9RpJQDyx0m8iog4R8WT/dT8Pwq 4c8E7cU0jBeQJWthd7eUCeJT8dgPt1vtg6+k/ofPy9ZWkkustUbyz0XGBBIT76LuS1E1 1nG+bvDfIw+6W9JNIKRJbV6OXbkPLfXTNflQ+awmF/YkwzGi1U3znMBktMlPqnRacSNy np1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=t83CoRT70i5x93MDZL3zD/Wyg9e/rIbO96dXM25y8Dk=; b=J4Z7vpfOF7x/x5g7Qj6cIR+P6Rv8N4cbe2V5m62dxGyfMCqqaOGfQraokf8wFArHN8 KrJhdvmzv48lkr8ajWM3ipfCgTyWERrFg9J/72p5YMPp1t42LhO9AIKJlEmKKsC++QTV DLW/l8BZzVn3czzw/KJZQIKWV1I8n/iqhb+LP79BgDTsMeJPqgOJQ48VeIYnwQyVM1+R Cu03jG2eDWgiAacMoT9/g/kbmwH8iYO/h2E2xsC4y+3qrcneYAlCZRadjAkayaKUKPNH Z5W/Ar+QcYqhmU30//7TUobWPpv26AOttwgSZiX1eXEDAbfxfwLPNsDowE1yunK2YPNX 0bmw== X-Gm-Message-State: AOAM531jIcE7iBqOS90nM6w/j0tqd3BWRQ5ex+liuXJg9SaXTsSY+NAP AaWR/kyTmRbFOzMWSmuCo2rgfw== X-Google-Smtp-Source: ABdhPJziRLKNEhluonlkD4YA9qyW5UZ+raMTyKHdMSHJ+m8XjUMk/07yOHATGkQMUA7RljTZ61ct5Q== X-Received: by 2002:a17:90a:ce02:: with SMTP id f2mr29929553pju.45.1623041262206; Sun, 06 Jun 2021 21:47:42 -0700 (PDT) Received: from localhost ([136.185.169.128]) by smtp.gmail.com with ESMTPSA id p36sm7505315pgm.74.2021.06.06.21.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 21:47:41 -0700 (PDT) Date: Mon, 7 Jun 2021 10:17:38 +0530 From: Viresh Kumar To: Ulf Hansson 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 Subject: Re: [PATCH v2 3/4] PM: domains: Drop/restore performance state votes for devices at runtime PM Message-ID: <20210607044738.3aec6o4imq6u3x6e@vireshk-i7> References: <20210603093438.138705-1-ulf.hansson@linaro.org> <20210603093438.138705-4-ulf.hansson@linaro.org> <20210603095538.b2t3cq25tq7v7kih@vireshk-i7> <20210604035312.jp2gshfigsodwvcg@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 :) > Did this help? :-) Yes :) -- viresh