Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3870600pxb; Tue, 17 Nov 2020 05:52:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2c3x0KeDqj2rygjYI3MOlniChOku16rDgFQQZ6LcjrrjYRzVZMfrBx2DNkNzevJBNePio X-Received: by 2002:a17:906:374a:: with SMTP id e10mr10029615ejc.246.1605621125181; Tue, 17 Nov 2020 05:52:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621125; cv=none; d=google.com; s=arc-20160816; b=aFNfiXjzUP/3fUfLguVFYWAVHzUCpsHsOVwCcAcJky7GwYKbVVh3ZsojFohMHX4Gsh pRqfBMn4aWi6DMMMJLPe0CDRUOaZmRsiMfp/w1IOx7uPL3tBruGmnWP/9RZ3UzCs2llE UzAiUKQa4RS1E7kW8fil/q6toeHhKmfXDK6ziSvKd/V7qojHJYphLJst5UI3eEgKQYU+ Ixg5qrJcIScO4gn1iyP29pDinnY9WxWRWyU0cqHRy/2geCCUUOsiz7mJsTLrvWKm5IYg A4HPnOQg9AJfGdjD+vGqoo/aIiXAJkajSR584iNMosepG7oqAgsD9hFY8UmCZu8U3EFy Ygcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a/u4UPNjT5PTtKlbVIIg0ONsyVlno92dCwlikI3iTzM=; b=cpq/fczDwYAxEHP9mTsqpWIyUSrnncK5XrUH3Tw0usOxiKtxpv1KzTxJBeHnGt3VCa 76guJX2fPItsmCGuB3DJpRJ0S4lAtqAbSX80nccYyKDY5wQQS7fSwXAGoPDs9UQZQduO 2BIS4aHRozdYctjxK5WAm1aQSb2tn2St+rV43oAiPvm5r5XPcC/k9X+9L1S4/Udd3RPP 9A8zjoIZ6YeX3fLQdvtNuxdAgYDOcRZbcQtTwMGAdE0ekzKsB2/xjTU5pjv1fYf17S8d 5ciyy5BeqrBwkYDtMqx9huY5Vnx7crTslMgrUezvaVvSb2S5GXpPDWQ3hSa85uN6VdUj 1/LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ML0LAsYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm4si4403941ejb.283.2020.11.17.05.51.41; Tue, 17 Nov 2020 05:52:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ML0LAsYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732092AbgKQNt0 (ORCPT + 99 others); Tue, 17 Nov 2020 08:49:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:43918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732090AbgKQNdm (ORCPT ); Tue, 17 Nov 2020 08:33:42 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 86C46207BC; Tue, 17 Nov 2020 13:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620021; bh=kJ9D4gPCppPR2jdULZdI/Hn5d/8VvmaLfUWrzlAUvnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ML0LAsYX+/f/RH2m0QDvI8FEHZ1spdRdeE6REVydWJwzB49IfZxp5lvPbAhrmRWGM 1YNzL8OyJ5II0s0Eqfe8n8HKipU7okB+vBJ2u4GNrbq1e+harpu/iICHQ9s9ewQ7x2 qbjYPMh5c3LPBJaYPUY6TSpYoMG9IYztlmYU0guI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Dmitry Osipenko , Viresh Kumar , Sasha Levin Subject: [PATCH 5.9 081/255] opp: Reduce the size of critical section in _opp_table_kref_release() Date: Tue, 17 Nov 2020 14:03:41 +0100 Message-Id: <20201117122142.895520931@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Viresh Kumar [ Upstream commit e0df59de670b48a923246fae1f972317b84b2764 ] There is a lot of stuff here which can be done outside of the big opp_table_lock, do that. This helps avoiding few circular dependency lockdeps around debugfs and interconnects. Reported-by: Rob Clark Reported-by: Dmitry Osipenko Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/opp/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 1a95ad40795be..a963df7bd2749 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1160,6 +1160,10 @@ static void _opp_table_kref_release(struct kref *kref) struct opp_device *opp_dev, *temp; int i; + /* Drop the lock as soon as we can */ + list_del(&opp_table->node); + mutex_unlock(&opp_table_lock); + _of_clear_opp_table(opp_table); /* Release clk */ @@ -1187,10 +1191,7 @@ static void _opp_table_kref_release(struct kref *kref) mutex_destroy(&opp_table->genpd_virt_dev_lock); mutex_destroy(&opp_table->lock); - list_del(&opp_table->node); kfree(opp_table); - - mutex_unlock(&opp_table_lock); } void dev_pm_opp_put_opp_table(struct opp_table *opp_table) -- 2.27.0