Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2657363lqp; Mon, 25 Mar 2024 05:58:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/GxgkkmKESqqrOBEJIpqgBDftXEmzN2otnYGkkB60IZljGHKcy4+X7oGrbaOC1KjO2KSwU4/gY8G/S6T0CcJA6DAAsSDNSsAXa8oDWQ== X-Google-Smtp-Source: AGHT+IFqRUl0kech84Tju+9VlWrzmbU+dcDMJCBVIZVRS0viAZ9Dhqochz1+8eAAqLgy7MdoBU7l X-Received: by 2002:a05:6358:7f1c:b0:17e:694d:57f9 with SMTP id p28-20020a0563587f1c00b0017e694d57f9mr6502024rwn.31.1711371511901; Mon, 25 Mar 2024 05:58:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711371511; cv=pass; d=google.com; s=arc-20160816; b=jDlZGlc9exdEfAeiorp6Oci7PH9q6dRJw+O/y1vbh2IYvojtrpWd3vuIrAysPkF5/K tKOYBmAKMomKqRPXZMV2YOatjqW9QYBvIxafoyrbrvLkVPxJ3xsFiglyL62Q5XlZ7/5/ Gk4lsUn8hAw+Z+KCyn8u1I27fxAxXvwSifXDDjo4MtHVN5q03GVFZ2DS/5WoXXJnYFOY tneX1gqZjnk8MHyuJD7jDqPu6YFoSrjsgS4TOFwZS3tcs3MWJ2446+w0lXBBrI7fB3tC CUoQ1+DcG4gSuxXCuRHB7K4QiilQelklm/oxQk6LCHeYXd3HZMvUBBIvUrsP7YG3ok4G YjtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UAy5PMZluoqYlHNob0TStsWaPFuhuh/09q/jBvGes88=; fh=pNbVkYx2YAxzL2t0A0VQu/F7H4tmq+I8QQCkGW/Msfk=; b=OgtJPZ3SH3eV3misLWfDp/f8ln4aOCgelrnNEu0laDJML0eC5LLVH2Z8xcKYXWne8d M1lTWtQAHIlBhBd2jND3lQLEvZ9qT7HJghmfVl7RFOXos9fq/34pFJsq0klbPrEYSt7M hZH3OhuwKGKkPd0SCoFwGZmN8l5Wr7av0HfCTWst+ywPN9QSmD8ta1+fiGHrTmf/ZMww cIebtviNeOhY3pWM63AfZGoHsAc3cowItHiqqgWw86EeUoEt5LDVLhI1yEjUm6b5drbR u5d/3uE7DmBwkDCzPpbcxdr9vbcyKlj7MbarhAcoFgz36HvzdiJQ41Frv9tAFbsxi3NK j25w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XTThkeOH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116545-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116545-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z21-20020a634c15000000b005f057f34455si2797826pga.242.2024.03.25.05.58.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 05:58:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116545-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XTThkeOH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116545-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116545-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 152042A6A9E for ; Mon, 25 Mar 2024 12:58:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 702E31419A7; Mon, 25 Mar 2024 07:57:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XTThkeOH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF94E1411F8; Mon, 25 Mar 2024 05:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711345445; cv=none; b=R6AXgi9qi2ywj+3fCz1G5XrC8KvGVNxsVtrEF7qlrN/ymEdk1DT2iILVhhTmu5eMbks4RkOXvImtlhThQKlUsbG7ssVmYb2yG6w1B/diCZis2JRNQi6HYEYRvbttXTlHYW8rPtovEDDLSC0wjafNbA04KPqR6ioNrxHF2+5owlQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711345445; c=relaxed/simple; bh=HBI+Gf+zyj89/JIgSSOwlpZAPa/EE8Nn6UlvurY0Z5Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M//o8P5fO1vrwMTpRpwcJQsSAHql1C0uHk3b8wMo2a+J2rQA4aOdMU8gpgzGfhTh3ja+N8ctd0T/5110dUBQ8bZQn9ZN1VOn0O9FlsHK+fTwld9rO4mGRL8dBZTjPp8XemFKXIdueD5fCN6Pg1Hf4z5XEe/0rYkHeuBM96+G2Cc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XTThkeOH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26616C433F1; Mon, 25 Mar 2024 05:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711345445; bh=HBI+Gf+zyj89/JIgSSOwlpZAPa/EE8Nn6UlvurY0Z5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTThkeOHfPQCOIB0JsWYniYn3zGCVag7AQoAX+3ReCt0+zf3H1hWM3mkDqdU22UYw RDrHRdw4v7vTCFeGUj5sXSyy43ycTtEa3W7MwZ1dgqxDdiBau8j2tcilzUql7YdC2v opvLa4RCA6uQZbUSIJogCKO1IoH+Py6Xx+1Gi7irAtakozBSVeXKkXaRhn6YRCsp3x C/U3GNG7JdrwEH9oLj3BrjJZlHDin1KK56wPM0+KmoCFgbFaSxgU+ONfZJ2QDhMp3c 0+J+iAtodLB8fbVb8I8rDH5jnq5NjySJNhNc1Vp7sEpdp12LfvRy3u4b+FDm93WFQt 95SMZEDjyYPDg== From: Stephen Boyd To: Michael Turquette , Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, patches@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski , Douglas Anderson Subject: [PATCH 1/5] clk: Remove prepare_lock hold assertion in __clk_release() Date: Sun, 24 Mar 2024 22:43:58 -0700 Message-ID: <20240325054403.592298-2-sboyd@kernel.org> X-Mailer: git-send-email 2.44.0.396.g6e790dbe36-goog In-Reply-To: <20240325054403.592298-1-sboyd@kernel.org> References: <20240325054403.592298-1-sboyd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Removing this assertion lets us move the kref_put() call outside the prepare_lock section. We don't need to hold the prepare_lock here to free memory and destroy the clk_core structure. We've already unlinked the clk from the clk tree and by the time the release function runs nothing holds a reference to the clk_core anymore so anything with the pointer can't access the memory that's being freed anyway. Way back in commit 496eadf821c2 ("clk: Use lockdep asserts to find missing hold of prepare_lock") we didn't need to have this assertion either. Fixes: 496eadf821c2 ("clk: Use lockdep asserts to find missing hold of prepare_lock") Cc: Krzysztof Kozlowski Cc: Douglas Anderson Signed-off-by: Stephen Boyd --- drivers/clk/clk.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 2253c154a824..44e71736477d 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -4353,8 +4353,6 @@ static void __clk_release(struct kref *ref) { struct clk_core *core = container_of(ref, struct clk_core, ref); - lockdep_assert_held(&prepare_lock); - clk_core_free_parent_map(core); kfree_const(core->name); kfree(core); -- https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/ https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git