From patchwork Tue Nov 17 13:03:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 325492 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4184008ils; Tue, 17 Nov 2020 05:51:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWNZw6ShsqvPOJqThVOCqStwnp+7T45cP1PSh1RV39JHS9goqk6on6H6wKAb4aOVMpfv7l X-Received: by 2002:a17:906:3641:: with SMTP id r1mr18605787ejb.405.1605620978124; Tue, 17 Nov 2020 05:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620978; cv=none; d=google.com; s=arc-20160816; b=1KtWIXvYc0RRublG7JICefEe0QW+q6ohM5JDdqzng06kJNLNG+LJy9fKURxFaJaKPr jRITDV6wu1A34DB9TEduTwcU6I/7ctinLeGHlnytZBp9mBbogInCwbr802Pezu8QwNAi t1Q205OhKgOjTlHXjE52JAXfTwVaddUBU4EfZetP5BeipxLp6jWVd4L9fLoZS+2yCs03 KWzuDHn1jsKlhl/cQ0pRbKF7Cg8oIjP+0uTJJc93PrmsPFmmqGlUz3avlJcF67t8VU1S unCR9K9scn72LKzWfqCt6BoLwli+XsZio4PNDOzTYUOJnBgV0pEmNkjj4Z1jZ9l8p2Qv FnFA== 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=yrLk5rYDYEUwsblTK4g4NyYWS0Gax1644uhE5U+6dG/FliLnTJjwcELNMi5LI+GAFj CCzGwuWM3k261tXYN40OtKVNKELFpdvxy2hFX5PPRTA97hCcD7ilHvB3NuyRtgZfXoOU EsqMBpajX3NaIxA+n5vKj3xG/lkJvSRYGE2x5V/AU/Khj2yOktOAYjLEZiZ4SWzE0qCg IOB2eFfERftTGrLcHJdwLWXdNQqN9xzwMaELKyZ4vDZfqWNbD00nTCj3kUImTAUvTL0d Hz+7tH82chIYLKF28L41xY5RnbxJ0mFpMMJwVeOBzXn0HxDwfCyPHI7o30S6gbcoIyrQ Fe3A== 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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 b26si14421865edy.172.2020.11.17.05.49.37; Tue, 17 Nov 2020 05:49:38 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S1732093AbgKQNtZ (ORCPT + 14 others); Tue, 17 Nov 2020 08:49:25 -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 Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.27.0 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)