Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2264936rdb; Mon, 9 Oct 2023 20:23:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3bgvV2UOiU8xPu15jb4PvvirnxPYZSqo+5wtNdEx2Tgu/PZFG53KdUqwMIp+5LIrrzMNH X-Received: by 2002:a05:6808:1582:b0:3af:7db8:21ad with SMTP id t2-20020a056808158200b003af7db821admr22155443oiw.33.1696908198005; Mon, 09 Oct 2023 20:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696908197; cv=none; d=google.com; s=arc-20160816; b=fqeDQ0txpYMBK7gfbY2Q5DhZZXNaCNyW8xALfl+IO6aPkvOP+bzDrXxhtQptYDGr/G 7nzjhz8jnI4ReaIrMTDJU8Ef3S/SGZwU5eZWBjJZG1lkvbJmMdL1+59RwnwVKbdctYGj KRiRZ66VagyhMeVJ9tKMskuon9xMBV4LBeEqZvK3z9gqfGzzDqS0mdE7MJZBI9AW9a5i xgKWMz/M5f8DQNST4lxajciDjyHheq7SbkBJhVroEpzZSwuWrB40a/bDxt3ObiYtUN1/ IgD/dcItg9cTGHQEKVk0DJxKq190Z8qEI3vnwvmzsuNsL+Z8cQvOUNAPCS6Nqf+p4nHY qH9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:message-id :dkim-signature; bh=eqBguovUV/R+MGOMf2pFurG3a3hxHTPP8eYaCsUkOEg=; fh=pPBguppimx+ZE9vgZBUudXPXfV6dfDey7Xz1jz8E7Xk=; b=oI2xb8XpS0ITQ8TvucV0vmxh84moy2mGNOfsNqbogYKRSi7zoXXAsVHgd7VGRDWMuF bijS3lVqgaOZF3zYYpM1yXAOT1jbr0GxuheusIpFqaUkLoy8bBWx4Uq1RSKbz5/3UNCQ jsYtQDZIEjjZPQ4HvXj2Ls6BHqJ5yShRR3Do+O3JClZBsw0oCJPRU+jT2rpBA0HEbZCU w1077oJTiba/2x17+h+TVXO5fC7GyDEOmLmKp+wPcouqWh+tDeqWmSmEJ0gKTuDOMZ3P aOO3WHGJJu4uJPeRwmG44iuaiyYTexhIVo1xS0fUbriTtDviNpnTz7QuSi3mn5LESEgG dKTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WZnNubWq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id r15-20020a63440f000000b00577723d24b0si10853456pga.46.2023.10.09.20.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 20:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WZnNubWq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9FAC781FAD91; Mon, 9 Oct 2023 20:23:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441962AbjJJDXJ (ORCPT + 99 others); Mon, 9 Oct 2023 23:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441903AbjJJDXI (ORCPT ); Mon, 9 Oct 2023 23:23:08 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C78C49E; Mon, 9 Oct 2023 20:23:07 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D650C433C7; Tue, 10 Oct 2023 03:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696908187; bh=kap+Rfsrx6FI8QCBde20mkzghb54YqCctHduIHD6tBA=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=WZnNubWqWby0EvPD3BI/yOe2UpEo+G71xkcZ67sx58OCB+4btLfI3QoEawakyIXub SjCBRp5MFhLnWyEFIPSl9dWOi2pVR6QyWgnhLnIn3CEnXmsAT8bv8JPITN67sjRHCn MdrjFWJLnJVq3XsDKIhAez3uhCs6DDAQXVNifNQgMSAGu+qJ68rTHavejRDeHfsWQw ouGGWiJETOgLSJuk7bGKhgXSkuIg58TIiXZK3h4qWICFo+fy/5jiJh3/8JhanzUQ5T NQtOafxcBM06RC9j457WEJ1Aomp2dTMuAK4nZpmF2Z/zhVp16XWQiZAh5tKOJodoeZ MqclLrUNfKMkA== Message-ID: <127bb741b6787c64e822bf7bc407926c.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20230912175534.2427862-2-sboyd@kernel.org> References: <20230912175534.2427862-1-sboyd@kernel.org> <20230912175534.2427862-2-sboyd@kernel.org> Subject: Re: [PATCH 1/2] clk: Drive clk_leaf_mux_set_rate_parent test from clk_ops From: Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, patches@lists.linux.dev, Guenter Roeck , kernel test robot , Maxime Ripard To: Michael Turquette , Stephen Boyd Date: Mon, 09 Oct 2023 20:23:04 -0700 User-Agent: alot/0.10 X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 09 Oct 2023 20:23:15 -0700 (PDT) X-Spam-Level: ** Quoting Stephen Boyd (2023-09-12 10:55:30) > Running this kunit test with lockdep enabled leads to warning splats > about calling clk provider APIs without the clk_prepare lock held. I > proposed adding a wrapper around these APIs to grab the prepare lock so > we can call them from anywhere, and Maxime implemented that approach[1], > but it didn't look great. That's because we had to make more kunit > testing APIs just to call code from a place that isn't a clk provider > when the prepare lock isn't held. >=20 > Instead of doing that, let's implement a determine_rate clk_op for a new > leaf clk that is the child of the existing leaf clk. We can call > __clk_determine_rate() on the existing leaf clk from there, and stash > away the clk_rate_request struct to check once the clk_op returns. Drive > that clk_op by calling clk_round_rate() to keep things similar to how it > was before (i.e. nothing actually changes rate, just the new rate is > determined). This silences the warning by driving the test from a > clk_op where we know the prepare lock is held. >=20 > While looking at this in more detail, it was determined that the code we > intended to test in commit 262ca38f4b6e ("clk: Stop forwarding > clk_rate_requests to the parent") wasn't actually tested. The call to > __clk_determine_rate() wasn't actually getting to the newly introduced > code under the CLK_SET_RATE_PARENT if condition in > clk_core_round_rate_nolock() because the parent clk (the mux) could > round rates. We introduce a new leaf and make sure the parent of that > clk has no clk_ops so that we can be certain that the > CLK_SET_RATE_PARENT condition in clk_core_round_rate_nolock() is > evaluated. >=20 > Reported-by: Guenter Roeck > Closes: https://lore.kernel.org/linux-clk/2b594e50-2bbf-4a2d-88e6-49fc39f= 3957a@roeck-us.net/ > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-lkp/202301310919.b9d56ee3-yujie.liu@in= tel.com > Cc: Maxime Ripard > Link: https://lore.kernel.org/r/20230721-clk-fix-kunit-lockdep-v1-0-32cdb= a4c8fc1@kernel.org [1] > Fixes: 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the paren= t") > Signed-off-by: Stephen Boyd > --- Applied to clk-next