Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp3379960rwi; Tue, 1 Nov 2022 20:39:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LxgWfIo9XqOjBaPdo/ZbfxC6DwcHijBQl9jPWhBmWWJjwwz38rOwUMUpllfO88bvBpoI1 X-Received: by 2002:a05:6402:3217:b0:461:d6d7:7f19 with SMTP id g23-20020a056402321700b00461d6d77f19mr987249eda.109.1667360353219; Tue, 01 Nov 2022 20:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667360353; cv=none; d=google.com; s=arc-20160816; b=pTTVHVXCRd9n9ReGcZ7U2PuX4Nfd78q/W2kgoh81AgodbMbuJrKwg57ZO1HOC5UuPB IV+UZxTisO5m87gwkQPvuDEaZLlbaiD49073Shxog1HkLPT78Xy6u94nu9MN1V/aQF/6 zMtaRt3DpAlcwtXhcLS1N8t2EH6I2Ny3tqkV22WDLaMfTLdVhrNVitnUWNLxi8DaJM2L ZanXX3S+y+zDOphxgtO623tJr45ZPDwQVP6Kq2SuCJ6rB79dZ9Gh3hqE7WwU51aHnbut A1SKKHHs4Igp4Tc7FF+H/NK1iXvZXze2wGPKbalQcBD5RQ1qn9fu7SLewaKUSZV9jLbM HL9g== 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:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=f0FKuPdAXIYX300uZ/xt/rKcm8IpOOmo6yvLqruKEg4=; b=L8cWA/Jvhu5l202Q+qRIDaCjRdcGuPC84tdmn7BdqF+l8jf07edpqAWb6sZMbm3sTY 8XwCi1MLZ0HchYOBDPVgb028rtNlZZjINVDbYtrmZuhAvZGww3P4AhGaoR9BXgRD6a0d ZAPKfO3I78Zo3VlW5RWsYVPPLR7TWehO20vy8/emn5yxqqB1Wc78pLAulCYDOoptjVXM TFSx5Vyuot5Ex+tcCtxeqECg8MFmMubatd9gL5GbKLNK1ORNunyZ/v7srEyqu9jot9ti JPu1E0nWA4yi2T6p37GDUODsUTO4GKKFklDRrw2kzvW7/du2v8UmknlX8sCw4+e48epu V3Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=niypHrut; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt41-20020a1709072da900b0073d9c412570si18104931ejc.785.2022.11.01.20.38.37; Tue, 01 Nov 2022 20:39:13 -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=@chromium.org header.s=google header.b=niypHrut; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230214AbiKBDRE (ORCPT + 97 others); Tue, 1 Nov 2022 23:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230258AbiKBDQi (ORCPT ); Tue, 1 Nov 2022 23:16:38 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAF2624BC9 for ; Tue, 1 Nov 2022 20:16:37 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id u2so23567725ljl.3 for ; Tue, 01 Nov 2022 20:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:from:to:cc:subject:date:message-id :reply-to; bh=f0FKuPdAXIYX300uZ/xt/rKcm8IpOOmo6yvLqruKEg4=; b=niypHrutCHgNxpl26t0c39eSC/75ATCFI2GMdqMsAje9m3mhC709C4YyB0owZQvCJU NZ+DuVWmF93aTauDCkJWOBiJiaTeJIKONV7xxdY4n9Uilb3YKlYhhb8m15neh1i21jte FyMVFwSm0W6Id5SK84FT8TdsOfchDJSv6qN0k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=f0FKuPdAXIYX300uZ/xt/rKcm8IpOOmo6yvLqruKEg4=; b=ZRQuEpoM3QnopAVPOUvAQJsHTDTXMbde70F+HHAMwDXFuy+u2EFyZoGBltdu9MeJed KBOZnEfzHUN1OlqMr9+VUsoju1KjuqnGXANJaNZY9TLDNYFVDwbOEALiEMqFiS0z9laM CUbIMoD1B0CDFl1ZE6B4HE8Qlc56vm7AEcUgJWKeokuc3TloPRPN4zsPGrd2dtt/Iwc6 odvPnz46nqdCjA9uCXXYFE56r76GikzYVXdTYmyLxoTyy+3XwzJhW3ZKGbSIHRKxR5vi 3TJ7XovEtDqU8DxMD8/ej0uMWfdGskDRUFrWuSbV3l6pQfBENyqGh6Z1u/ZcbtEt7G8B wlsQ== X-Gm-Message-State: ACrzQf022ruX7U7MxXsOEUQzFCURBrTI5x7SFamr/HRiWqzwQu5zbpJc 5szx8fNFQy4oSt8wccKBz2Ts3FWRh9e5wtHR0xEfpg== X-Received: by 2002:a2e:8081:0:b0:277:b:33db with SMTP id i1-20020a2e8081000000b00277000b33dbmr7971726ljg.228.1667358996017; Tue, 01 Nov 2022 20:16:36 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 1 Nov 2022 20:16:35 -0700 MIME-Version: 1.0 In-Reply-To: References: <20221101233421.997149-1-swboyd@chromium.org> From: Stephen Boyd User-Agent: alot/0.10 Date: Tue, 1 Nov 2022 20:16:35 -0700 Message-ID: Subject: Re: [PATCH] clk: qcom: gdsc: Remove direct runtime PM calls To: Doug Anderson Cc: Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, patches@lists.linux.dev, Andy Gross , Bjorn Andersson , Konrad Dybcio , linux-arm-msm@vger.kernel.org, Dmitry Baryshkov , Johan Hovold , Ulf Hansson , Taniya Das , Satya Priya , Matthias Kaehlcke Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, GUARANTEED_100_PERCENT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Quoting Doug Anderson (2022-11-01 17:45:03) > > One small nit is that the kernel doc for "@dev" in "struct gdsc" is > incorrect after your patch. It still says this even though we're not > using it for pm_runtime calls anymore: > > * @dev: the device holding the GDSC, used for pm_runtime calls Good catch! I can remove the part after the comma. > > Other than that, this seems OK to me. I don't feel like I have a lot > of good intuition around PM Clocks and genpd and all the topics talked > about here, but I tried to look at the diff from before all the > "recent" patches to "drivers/clk/qcom/gdsc.c" till the state after > your patch. In other words the combined diff of these 4 patches: > > clk: qcom: gdsc: Remove direct runtime PM calls > clk: qcom: gdsc: add missing error handling > clk: qcom: gdsc: Bump parent usage count when GDSC is found enabled > clk: qcom: gdsc: enable optional power domain support > > That basically shows a combined change that does two things: > > a) Adds error handling if pm_genpd_init() returns an error. > > b) Says that if "scs[i]->parent" wasn't provided that we can imply a > parent from "dev->pm_domain". > > That seems to make sense, but one thing I'm wondering about for "b)" > is how you know that "dev->pm_domain" can be safely upcast to a genpd. > In other words, I'm hesitant about the "pd_to_genpd(dev->pm_domain)" > call. I'll assume that "dev->pm_domain" isn't 100% guaranteed to be a > genpd or else (presumably) we would have stored a genpd. Is there > something about the "dev" that's passed in with "struct gdsc_desc" > that gives the stronger guarantee about this being a genpd? Not really any stronger guarantee. The guarantee is pretty strong already though. You can look at the callers of dev_pm_domain_set() and see that nothing is calling that really besides the genpd attachment logic when a driver is bound to a device (follow dev_pm_domain_attach() from platform_probe()). The dev->pm_domain is going to be assigned to a genpd assuming the 'dev' pointer is a platform device and has 'power-domains' in DT. It's not great, but it works for now. Certainly if we ever want to replace the pm_domain with something that isn't a genpd then we'll be in trouble. I'm not sure it will ever happen. Ulf, can you provide more assurances here? > > > In any case, I will note that this seems to make the hang that I > described [1] go away. I never totally dug into why the patch was > tickling it, but I'm happy for now that it's back to not reproducing. > :-) Cool!