From patchwork Tue Nov 17 13:04:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 325500 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4187211ils; Tue, 17 Nov 2020 05:56:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoHvNrEfiTV623u0a+eYz8TmkyUpnY2N70nGBdIM74Bc4YrGfyTw0id37dhXgWKd3NegjC X-Received: by 2002:aa7:d711:: with SMTP id t17mr20982450edq.83.1605621398705; Tue, 17 Nov 2020 05:56:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621398; cv=none; d=google.com; s=arc-20160816; b=gzo/qZUPnIE3NdhIvcQucChHCnm4EnFkdJQxdGDrHb88UoecoBmE/iIUDUB7avgv+K ZjAuOvToZNWbLxrb5eL8janF6aUGfkOTGnMW2JzB1oh4+3Ru6cHiUL4nQOaPQtopf5me 5SeRZhtoD/K9HdcJKA0L5NpC/Y2SnkjMr4ESVGddpdDAPcU62sQPzKzZDJzHVCMhVelD 95v94uUyqI81CBJ0Sqz8iVqK1nPAvD8r30FevfmEoE5GN2YFV2ulNKqbnsiJPKuFRpjl GPLFIWjBeW3VwnVgu0dmOwOHqy63+m6p08uURweLzbJIXF3KdqMFiaQrbI1zhahEDWoT 5k6A== 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=HsNEvSzNLANXYPb62tP8MpELLNRmAQi3tzOnzo6k/9c=; b=MWdBqnn1qOGdRZ2JPH26vTGtN5BDBcpQjLRGsYUBJNR/VDZIa5nPUh9botCk0aLTeq 5CSMcfUFAqQKAzWNHPajLod7KGYV+rd1rfAYd1jpaMQx8HlkEtzZhFdU0mvsTGw7h++s TtM4GNEHkG1SvP2eF6l/bnNBzHjJyyPpQlHuvDVgPTx0ntSytX+ozoyqlEgbXuAXP0Pq Mjr32v/pLTJ/U2paMXqS7RMFcTtaLMJQhYPffWwUfPEV5TDvHNIysSJdjilc5qETqSGY +p4RV/IXgxXcmtb+BUTQknUhqihO46rQYpdFI9kJt9OilS1G7z/ksPVMuIrhqMmobh3X QDNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RqRoO6vs; 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 d9si19797622edn.570.2020.11.17.05.56.38; Tue, 17 Nov 2020 05:56: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=RqRoO6vs; 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 S1731951AbgKQNy6 (ORCPT + 14 others); Tue, 17 Nov 2020 08:54:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:59434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730386AbgKQNY2 (ORCPT ); Tue, 17 Nov 2020 08:24:28 -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 2772420781; Tue, 17 Nov 2020 13:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619466; bh=YfigFUwLDE86NFgJVQhKTDRJqq/XbrY0D+5UH8FsDhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RqRoO6vsMJO4a5jCgBh9RbpUl6HEz1TkZP/qNVhQgsly/PW+7RWw2p7IIAVW8oZ01 rTLzH95yYq87+7ZsSwIs60cqdMxVxdMZ6/M1atudLegCh5CPriOMHAbVz6vqPN5hP0 xisr4uLJ0087B6dsZzIs5LyBiOC3Z0rtbKapzji8= 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.4 049/151] opp: Reduce the size of critical section in _opp_table_kref_release() Date: Tue, 17 Nov 2020 14:04:39 +0100 Message-Id: <20201117122123.815339627@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122121.381905960@linuxfoundation.org> References: <20201117122121.381905960@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 8867bab72e171..088c93dc0085c 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1046,6 +1046,10 @@ static void _opp_table_kref_release(struct kref *kref) struct opp_table *opp_table = container_of(kref, struct opp_table, kref); struct opp_device *opp_dev, *temp; + /* 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 */ @@ -1067,10 +1071,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)