Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1972219rwl; Thu, 6 Apr 2023 04:11:50 -0700 (PDT) X-Google-Smtp-Source: AKy350breKcjDu7DN7uW4+ti14KTJxI4nRxbe4hClu1l7FaJv0XwfRuqWokWz8FavQS2pge8ceep X-Received: by 2002:a05:6a20:a894:b0:d8:997f:b21c with SMTP id ca20-20020a056a20a89400b000d8997fb21cmr2507262pzb.27.1680779509838; Thu, 06 Apr 2023 04:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680779509; cv=none; d=google.com; s=arc-20160816; b=B7mol5C4bRbrI1EF5FHjxNDqQZVPNPwwt5asUJuuzK4wEl9Ob5SouQ3VFSOb9fF2g+ p8V9avYBMWORt5qft1pD93XZJB/zsNBjoP52U60CR9bMnEEa7KukrcGjAxDwA7frtZFj wViRW9gRj/sGbJsOHIKFX7IrOWuBXYpYY+n7qWVavJsHoySsQZBG6884fLV4q66RLhzA 09aq5p0L0JQBqY3NVkVwUcxowKfWUyrvw4BJbZP5QOcQbh1Td3hGKLDdd3mNygdnbEBd Dg/OOI4BJEHdIJbbo8u7AaBJfaqZBDh59dF8w5LzqrqlYmGkV9183qdSH6bG5eqY+ulV mbSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=nD1WTAK58/vqm28JkhVU6GZOl4ufBXsw089tkC+xpWw=; b=R6TnpXMIss36DAPHTHzmXM0zPTHNQ5OmMK0QbyypSjqKAWaSkgiEsi6BE2k9Z6uEYw 2xR6Rs02rP0bEZbWVHVz7Xk7nuLFR0g0cK89q9pKe0II4YapctCM8d5p9Dg0QeptFeUw 2mpc2TSo6SXWzb9K9Ir4sU71rV8GxS2YVSibu5pSTjSbEQxnaatwfq725MKm/3A2bDW7 vXrqXaF2Qk1/x+xqp1bGBGDrFfHZ5g3Zl4c2NndT2I4BwSVG5jfiaCBvmaECSKxwxO+r BzDKt7SvqEF/4y6FZqNeSTrVjpDR+rRxWhGfURmD8MpwghKT+Yex7kpCwXBeC2g+0Y9x 4Zfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rstXWKv7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a655b8a000000b00513237b6b61si967510pgr.562.2023.04.06.04.11.38; Thu, 06 Apr 2023 04:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rstXWKv7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229827AbjDFK7u (ORCPT + 99 others); Thu, 6 Apr 2023 06:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbjDFK7t (ORCPT ); Thu, 6 Apr 2023 06:59:49 -0400 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 876E17A97 for ; Thu, 6 Apr 2023 03:59:47 -0700 (PDT) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-545e907790fso616187867b3.3 for ; Thu, 06 Apr 2023 03:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680778786; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nD1WTAK58/vqm28JkhVU6GZOl4ufBXsw089tkC+xpWw=; b=rstXWKv7UVHpBvrj+D64aEpmhqkUePscquDSERUiqCo/2kvTPcISLn9/T2z9bf71N5 y0F67VeMCuWYtTzRt5GraOjnIm0DMkNgtxlH3xUKfYpi+g9eqKFeWWifs/ffvnsshV8M zfXSNfMUBkYgvZx5x8XwfQELCVomMs8nyj8GHtdNZPBpsBLi068gpr7siuqqTOgoYdIM dRmcs9prAopv9R3upqAW3YKcWonOSqYQKnyvCcP3BQuCoUmQq7vqqSgiaXBXdZgbVh/9 8pnZ/+3XBphz+u92hF1zMFIvv1FTUubcEn4lCz1GlGMus7rbkeBCuajJ/JNYDZzTsGUV edxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680778786; h=content-transfer-encoding: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=nD1WTAK58/vqm28JkhVU6GZOl4ufBXsw089tkC+xpWw=; b=oXrxe2ZrGnCAkWv5OB22lVsfUm3fkrrb8X1spc9Mdwx47/M9GCk/0TPUmwxpj69K+V SIDcshqGGYHrA72/2eMqx4+Sc+mSeZgtDNMH2b+micLJaWcdjzas9UdfsivgzkUi+m26 sNaQv6cA2VwE5bQIsQACwG9sA8u8KNHGP5OSfPQ0g+lMFTHSOUojIMpBaaHtKGLaDujU udQDhzTislM5Afe/uWA0W+Y58DTOfjvDpmVVtH1yM7qhaxjwPEwMC1edO4yPELVLPopS mkWcKpesuFoMYKEiaDERX+JtdwMqUhDaKuSdpDHypDHwNeKMH7A1NhiSdjJfmg9tmvAd XxVw== X-Gm-Message-State: AAQBX9eQ1ZArKO6aTen6ttc+Je2S6HDW6C3xNW5qy2GYIDznJgFy0+ye kQ5H/u1lx0fsBn77a5AJaVkdvH0FP62e8G1VEIpZKA== X-Received: by 2002:a81:c509:0:b0:549:143f:3d3 with SMTP id k9-20020a81c509000000b00549143f03d3mr5573053ywi.0.1680778786661; Thu, 06 Apr 2023 03:59:46 -0700 (PDT) MIME-Version: 1.0 References: <20230327193829.3756640-1-abel.vesa@linaro.org> In-Reply-To: From: Ulf Hansson Date: Thu, 6 Apr 2023 12:59:10 +0200 Message-ID: Subject: Re: [PATCH v3 0/4] Allow genpd providers to power off domains on sync state To: Abel Vesa Cc: Saravana Kannan , "Rafael J. Wysocki" , Kevin Hilman , Pavel Machek , Len Brown , Greg Kroah-Hartman , Bjorn Andersson , Andy Gross , Konrad Dybcio , Mike Turquette , Stephen Boyd , linux-pm@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, Doug Anderson , Matthias Kaehlcke , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Apr 2023 at 11:26, Abel Vesa wrote: > > On 23-04-05 16:11:18, Ulf Hansson wrote: > > Abel, Saravana, > > > > On Fri, 31 Mar 2023 at 06:59, Abel Vesa wrote: > > > > > > On 23-03-30 12:50:44, Saravana Kannan wrote: > > > > On Thu, Mar 30, 2023 at 4:27=E2=80=AFAM Abel Vesa wrote: > > > > > > > > > > On 23-03-27 17:17:28, Saravana Kannan wrote: > > > > > > On Mon, Mar 27, 2023 at 12:38=E2=80=AFPM Abel Vesa wrote: > > > > > > > > > > > > > > There have been already a couple of tries to make the genpd "= disable > > > > > > > unused" late initcall skip the powering off of domains that m= ight be > > > > > > > needed until later on (i.e. until some consumer probes). The = conclusion > > > > > > > was that the provider could return -EBUSY from the power_off = callback > > > > > > > until the provider's sync state has been reached. This patch = series tries > > > > > > > to provide a proof-of-concept that is working on Qualcomm pla= tforms. > > > > > > > > > > > > I'm giving my thoughts in the cover letter instead of spreading= it > > > > > > around all the patches so that there's context between the comm= ents. > > > > > > > > > > > > 1) Why can't all the logic in this patch series be implemented = at the > > > > > > framework level? And then allow the drivers to opt into this be= havior > > > > > > by setting the sync_state() callback. > > > > > > > > > > > > That way, you can land it only for QC drivers by setting up > > > > > > sync_state() callback only for QC drivers, but actually have th= e same > > > > > > code function correctly for non-QC drivers too. And then once w= e have > > > > > > this functionality working properly for QC drivers for one kern= el > > > > > > version (or two), we'll just have the framework set the device'= s > > > > > > driver's sync_state() if it doesn't have one already. > > > > > > > > > > I think Ulf has already NACK'ed that approach here: > > > > > [1] https://lore.kernel.org/lkml/CAPDyKFon35wcQ+5kx3QZb-awN_S_q8y= 1Sir-G+GoxkCvpN=3DiiA@mail.gmail.com/ > > > > > > > > I would have NACK'ed that too because that's an incomplete fix. As = I > > > > said further below, the fix needs to be at the aggregation level wh= ere > > > > you aggregate all the current consumer requests. In there, you need= to > > > > add in the "state at boot" input that gets cleared out after a > > > > sync_state() call is received for that power domain. > > > > > > > > > > So, just to make sure I understand your point. You would rather have = the > > > genpd_power_off check if 'state at boot' is 'on' and return busy and > > > then clear then, via a generic genpd sync state you would mark 'state= at > > > boot' as 'off' and queue up a power off request for each PD from ther= e. > > > And as for 'state at boot' it would check the enable bit through > > > provider. > > > > > > Am I right so far? > > > > I am not sure I completely follow what you are suggesting here. > > Please have a look at this: > https://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux.git/commit= /?h=3Dqcom/genpd/ignore_unused_until_sync_state&id=3D4f9e6140dfe77884012383= f8ba2140cadb62ca4a > > Keep in mind that is WIP for now. Once I have something, I'll post it on > mailing list. Right now, there is a missing piece mentioned in that > commit message. I had a quick look and it seems rather promising, but I will have a closer look when you post it. > > > > > Although, let me point out that there is no requirement from the genpd > > API point of view, that the provider needs to be a driver. This means > > that the sync_state callback may not even be applicable for all genpd > > providers. > > Yes, I'm considering that case too. Good. > > > > > In other words, it looks to me that we may need some new genpd helper > > functions, no matter what. More importantly, it looks like we need an > > opt-in behaviour, unless we can figure out a common way for genpd to > > understand whether the sync_state thing is going to be applicable or > > not. Maybe Saravana has some ideas around this? > > > > Note that, I don't object to extending genpd to be more clever and to > > share common code, of course. We could, for example, make > > genpd_power_off() to bail out earlier, rather than calling the > > ->power_off() callback and waiting for it to return -EBUSY. Both of > > you have pointed this out to me, in some of the earlier > > replies/discussions too. > > The above link basically does this. I hope this is what Saravana has in > mind as well. Okay, let's see what Saravana thinks. Maybe it's easier to post an RFC, based upon the above and continue the discussion around that? Kind regards Uffe