Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3011555lqp; Mon, 25 Mar 2024 16:57:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUUbZO6PXpWf0WN6RkphIUsL6ioSKdcsTNJn7T+BWOybdgj5ROoCFFnGAE2OyJrPe/Oj+PpwMJug0Zgjkvc8gJPAhWjLQf3gloUiD+0iA== X-Google-Smtp-Source: AGHT+IF9E9iw4P4B2XspdT+FDLVrXTaRYZBllnCiYbz0vXte53zGzQ+Ht2orCjxaflOEvBBBD3yD X-Received: by 2002:a05:6870:8198:b0:22a:4da3:b004 with SMTP id k24-20020a056870819800b0022a4da3b004mr1594261oae.2.1711411024385; Mon, 25 Mar 2024 16:57:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711411024; cv=pass; d=google.com; s=arc-20160816; b=j4OLP0IZguNje0YOHS1BzSsXd9UgkuzTBHzSPgDbeC5vqrKJJJQm58dEWFDQRq8ASS KDXuXcjWi2+7iyMF8VFj00haiKUOAlsXZURc7MMqGc/0Qyvt7UCZGDkE022LYtXpzKPZ 4ryoo/24k03tDEtj2wA5m/BVphJ4PAKpwds1Mq9EkVSfxUSL2TBO5la4u1YdQORW4UdX RiJMNxWO1+00fboBIxcMGHGQpnl7d+GwuRC3NmrqGBnVPtlPFROVv5s6t+9/AV6oMDvt TAYXBNtBQnOYxyjsoyh5kSZKiXDXkbIJr5QbkpnqSiHJBPn7VpNB60G+c8j46YXsP1H3 Zbsg== 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=2xKM7levbgzzkizSqbYyIAoOR2JIJpgHZGYwqdk0avo=; fh=pNbVkYx2YAxzL2t0A0VQu/F7H4tmq+I8QQCkGW/Msfk=; b=A/LXpMYF/yw/1mJRa38dCV7sNfv5iMkCqIejQ+13eX53YGJFssFbiFRa7CkAU1Kb++ nwxNTuWNiR0ZBi5VeXKp1pdLd0QXyWhz6SL2Oiwf+JTdtSFkaqTipm7mJulbc6VuhhRe lRRSG2Mn9zbjnCTh66c0v6kmgUeUmx+pwAzGDxPMcpy8brGWBmgf1uW28EcyaatcvmH9 vONEjj5+iGODRCmvuNANUMlai27pmPdByinx35IpT74MGAE91cjUhum5X7e/ZqAJ3Tss IVKUmyI4mKctRxgLkNkIwUbmQ05GW+/RZobpJCQw5LIWt1O9/tDsJROkwxqLLjir58zl BiHg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BMKbmKeT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117737-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117737-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id w129-20020a626287000000b006e696c73784si5483287pfb.192.2024.03.25.16.57.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 16:57:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117737-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BMKbmKeT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117737-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117737-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B7EDAB2D9ED for ; Mon, 25 Mar 2024 18:51:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3D697F7DE; Mon, 25 Mar 2024 18:42:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BMKbmKeT" 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 BB740745EF; Mon, 25 Mar 2024 18:42:06 +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=1711392126; cv=none; b=uCYS6ud/2j0BbuABSp/aTfyEwxwZQ4rzdRpzdfX3MGglgkFnEHsMIEIjmcYdtqnqLu9de2dUOuIlapnlj4waOD1mSFGttHTI1nYB+7GCihs9bsAyXLL3ubg/uHPs9cs6iKxvrpNJWI1l9Dw21wblaqxGZpMSToGrMO5HEUAQUVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711392126; c=relaxed/simple; bh=vvJhydcOE1G8hnd/r4ClIZBuHsvIC5MR5ecFq88JZsI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HSjjHWWIMJTa+TqpG2vCw58VSHqR/zkhAvnM3USugA5FeG6hSwWet1a4sDrEHY8QJHg+r/s44z3cEanBwZQZOpkCK04DVDZfxaP0OFZWcO7UD3XeXfQp9cFhFRnin3Dm1sj8EFMe2xG/XUeO+Bk3nuQYuj7UI1Q6ClWLDwRDuHs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BMKbmKeT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08286C43399; Mon, 25 Mar 2024 18:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711392126; bh=vvJhydcOE1G8hnd/r4ClIZBuHsvIC5MR5ecFq88JZsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BMKbmKeTrw6tUatdTiMh4ux16rYfZVn39fgDHJb2ulJmItqk8Fu6FiALOyvbkI9/F dSP1uxEA5ZBdw/Em49+9BwGevOROzO/SJG20Pe+Km+cxZWITTMGHI5yf0NwcSW5zSc wr9k0y2zYEhqaszk7if1mDRYTk7CKWS+fr4A8NlYLPyNFRFN+nb/ALWb6ByZfq6bPc oN2oG/J6PhCpmAnOorphY9rKTvnLb/+BmaRyOSk1zEl2ulMv5NMUaE7erQUoTeDQiU avdkEKgI436+pdNQ9LX4CkplcSN6n5KiS4ij++k+zGqL/PN3pVg4lAWbh1aqmnr3XH VIB/WPAYZrkIA== 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 v2 1/5] clk: Remove prepare_lock hold assertion in __clk_release() Date: Mon, 25 Mar 2024 11:41:55 -0700 Message-ID: <20240325184204.745706-2-sboyd@kernel.org> X-Mailer: git-send-email 2.44.0.396.g6e790dbe36-goog In-Reply-To: <20240325184204.745706-1-sboyd@kernel.org> References: <20240325184204.745706-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 Reviewed-by: 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