Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2465383rda; Wed, 25 Oct 2023 03:42:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYuq2N0tz4CssTFT0xB39gff4e+c9UqbLFraMI+rVsExeFRLRd1o2l2DCOiTG2Xc0Imad4 X-Received: by 2002:a0d:e614:0:b0:59b:54b5:7d66 with SMTP id p20-20020a0de614000000b0059b54b57d66mr14913424ywe.34.1698230562543; Wed, 25 Oct 2023 03:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698230562; cv=none; d=google.com; s=arc-20160816; b=TKHMm0q0U1BErRHQjiWATdQyBowlRbF0EYM2vRzriAGkAcN+fxU9Quhw/JMHqpF+jr 3jbN1Udymy1aRg16fC/hsbk1kWIjeZt7pbKfCQKiilm6NJV/V/f5WX8Ebd1uQhRMIYi3 0ahYkFIHTLzNDBwtop5sJfm0oODtyuHdndgSMRe7ko0vGaBvSGsUH5PSuXPode01dFXa uDd/KTBHTkZCDh5rN5oawn7hhQGeBzLSbOZ753xkang1ikGKtB1hk1O0Sb6H7vAc3Vos q54HbasC3M4wF49EEDv1Psk5zYCDw341sdGmnGWRB5kjtXW8UO33MDd99SE4NsGRleN1 4iIA== 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=uoKCVJuSp1gaNURdshaMYFoNVzJG6iYu6RxzVx/iCgY=; fh=zJJRk5+BZN/TWwsTxHGhtfo1q7KKcftHMHW7XAPRPOQ=; b=1CJz6+dA/Ks7THJnl9g3gsRzIuZrZ8KemEzq7wThT5yUTLDDu3bzdH21P5J6ZtVu3s gtTtglZLYX1JULKhkGX0hEt+b20pJ+T8szgA6U7hBMV1dPk+9S2+dB+RP+p4W8B4TLqI 5f2KEKPoCHwzv6hGTrRG+iuuVKY//no0JI1WOm2Sf1iuljwB3l+PLwObg8mppHuIWzJk 7MkJ/y8Cv7uqqojOC+2IHYb4owsbEJMKDe1jTWvi+9EGT/WVbuobQTWfGHzBVCLe/U9F E4jkeOkHbVmSa2tGHtScaG4b+8F6xRAW16HQHaMVjsWw5hXBi5Iak3BZ/3pRmff0Szi6 fA5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oFO4hFxB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id q188-20020a0dcec5000000b005a7c72fa600si9647997ywd.279.2023.10.25.03.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 03:42:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oFO4hFxB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5A2B88076E7A; Wed, 25 Oct 2023 03:42:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234943AbjJYKmG (ORCPT + 99 others); Wed, 25 Oct 2023 06:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234935AbjJYKlr (ORCPT ); Wed, 25 Oct 2023 06:41:47 -0400 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D6342115 for ; Wed, 25 Oct 2023 03:41:03 -0700 (PDT) Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6cd1918afb2so3324908a34.0 for ; Wed, 25 Oct 2023 03:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698230462; x=1698835262; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uoKCVJuSp1gaNURdshaMYFoNVzJG6iYu6RxzVx/iCgY=; b=oFO4hFxBq8vb3sq3psqzjJmjVHzm+nMo3upTEcl/U1xy2Gz7FQGrvIYKEBctj9UeRs GIYR5DMs8+pjxcCymCFd0UZ7thZXKkjqBxww10Mfb+Tz1meJln/z3mcyx56nDTFnOzK2 RjreUKVuIC1L0d/N+J9VQBiX6iCE894z0ugj6tSg+7ZFIji5GgTQ1Zrh6SzO/uwl/4hg YKnHzssx5tmEwdV1oG/jjSeuh0k550vHGf/234mB4SYh9afSTQoKXWXdvDOBv06SfDK0 HnDKuhgnznLKoXNfUWB4pbHjOgZtvYnFiB3k1NENTum/kiw/clzUyo/0VVoCC2GvZvjg qM7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698230462; x=1698835262; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uoKCVJuSp1gaNURdshaMYFoNVzJG6iYu6RxzVx/iCgY=; b=HDFFe3RaBdQnA63iHOZRBnaOx63hz+9v80Dcax0OQPTQDD+F85DeNfjD6N/v4Xqlrf gWdYtxhNbLwsG5TgbOKnvXofIRO/7U3y3PSzUzHqgd4QoN4+xa0riHIM+IFMqSqIyxZd PMAEMZQZSneFWv6/S9MPFP54UQSW0cHXIbiuccwOJsiLU8ouhlkakOI3bn4FLiOG/gCq IFULUJd3IHY1vWkQ/FyvWhPZ2Eao2Sp18YuBUR9wTUQIWM4eJ5h7iJ0HhUexq4MbcYOH BVhH2LR5IqEp642T7uokPnvVYHbf1VuyNa+XJhD4BnPWaJnOczQ3DYS3veUOXNdrJD3v Aedg== X-Gm-Message-State: AOJu0YyCt1dL6+IkgWamJPY8QicoBQBZeL30M0FMfIGx17IhFQ9oGXHq pGmKdCXMP5IRd1x3eRn3D6bJUFrMqHbZcEI5GhU9Yw== X-Received: by 2002:a05:6830:43a6:b0:6ce:29cd:b663 with SMTP id s38-20020a05683043a600b006ce29cdb663mr16885481otv.8.1698230462249; Wed, 25 Oct 2023 03:41:02 -0700 (PDT) MIME-Version: 1.0 References: <20231025065458.z3klmhahrcqh6qyw@vireshk-i7> In-Reply-To: <20231025065458.z3klmhahrcqh6qyw@vireshk-i7> From: Ulf Hansson Date: Wed, 25 Oct 2023 12:40:26 +0200 Message-ID: Subject: Re: [PATCH 1/2] OPP: Use _set_opp_level() for single genpd case To: Viresh Kumar Cc: Viresh Kumar , Nishanth Menon , Stephen Boyd , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephan Gerhold , Konrad Dybcio , Manivannan Sadhasivam , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 25 Oct 2023 03:42:39 -0700 (PDT) On Wed, 25 Oct 2023 at 08:55, Viresh Kumar wrote: > > On 19-10-23, 13:16, Ulf Hansson wrote: > > On Thu, 19 Oct 2023 at 12:22, Viresh Kumar wrote: > > > +static int _link_required_opps(struct dev_pm_opp *opp, struct opp_table *opp_table, > > > struct opp_table *required_table, int index) > > > { > > > struct device_node *np; > > > @@ -314,6 +314,25 @@ static int _link_required_opps(struct dev_pm_opp *opp, > > > return -ENODEV; > > > } > > > > > > + /* > > > + * There are two genpd (as required-opp) cases that we need to handle, > > > + * devices with a single genpd and ones with multiple genpds. > > > + * > > > + * The single genpd case requires special handling as we need to use the > > > + * same `dev` structure (instead of a virtual one provided by genpd > > > + * core) for setting the performance state. Lets treat this as a case > > > + * where the OPP's level is directly available without required genpd > > > + * link in the DT. > > > + * > > > + * Just update the `level` with the right value, which > > > + * dev_pm_opp_set_opp() will take care of in the normal path itself. > > > + */ > > > + if (required_table->is_genpd && opp_table->required_opp_count == 1 && > > > + !opp_table->genpd_virt_devs) { > > > + if (!WARN_ON(opp->level)) > > > > Hmm. Doesn't this introduce an unnecessary limitation? > > > > An opp node that has a required-opps phande, may have "opp-hz", > > "opp-microvolt", etc. Why would we not allow the "opp-level" to be > > used too? > > Coming back to this, why would we ever want a device to have "opp-level" and > "required-opp" (set to genpd's table) ? That would mean we will call: > > dev_pm_domain_set_performance_state() twice to set different level values. Yes - and that would be weird, especially since the PM domain (genpd) is already managing the aggregation and propagation to parent domains. I guess I got a bit confused by the commit message for patch2/2, where it sounded like you were striving towards introducing recursive calls to set OPPs. Having a closer look, I realize that isn't the case, which I think makes sense. > > And so it should be safe to force that if required-opp table is set to a genpd, > then opp-level shouldn't be set. Maybe we should fail in that case, which isn't > happening currently. Yes, it seems better to fail earlier during the OF parsing of the required-opps or when adding an OPP dynamically. In that way, the WARN_ON above could be removed. That said, sorry for the noise and either way, feel free to add (for $subject patch): Reviewed-by: Ulf Hansson Kind regards Uffe