From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84E7DC4363A for ; Tue, 27 Oct 2020 07:57:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C65C2225E for ; Tue, 27 Oct 2020 07:57:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JP1L/hqg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2508491AbgJ0H5N (ORCPT ); Tue, 27 Oct 2020 03:57:13 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:44835 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2508483AbgJ0H5M (ORCPT ); Tue, 27 Oct 2020 03:57:12 -0400 Received: by mail-pl1-f195.google.com with SMTP id h2so323358pll.11 for ; Tue, 27 Oct 2020 00:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WTGC2OTITxlQLtj5zM0pFSoVah1I+fME0Bx3VBUu+Yo=; b=JP1L/hqgpYoepOQ3ejAHcxMgOon16s5amlaf/SsSxdhvw982pStR+nZXKSo5OA2n1s H/c7cg+12r/pMF0SkpABvySTyVfTsrB20jVhtU96QhPOQfH1j/QRSWO10Zqmu2qYa1UI nX2jozFMAEfQFUbinMh2s9Y50XMv+S9qPCh2lnmWqq4WxfWzySBDDFmDfODOTbKYBgYr p+j+Cy2YcU0Z24CoAeKAC28TKgBQ1d92ZrWdDRZTw5TDHPhgsqzW86LmaoCU96J1Lh4t fdEgIqXkwtPvQ4qyrZwDAeIp1Ok3ME6HjZI4qqXaE/rq8NTBydolaxbpcqQlkra0cbSi xHsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WTGC2OTITxlQLtj5zM0pFSoVah1I+fME0Bx3VBUu+Yo=; b=U6L2fYI7V9PNgsmq3k8jFzCT1VWHwcALjpfY1vEl3tbTm+ofF9ac6Rf9WhKsUsxPZQ bf0b/EDmKDrhLMcAahfehQDHoNaIrkOO4bIgJ8b9DjbM6N0BLUinO2NH2DIMwHJwGakq mdiIEgD3IQePZXD2yBE9hG0wXyVIq0o68XMSGr/1B5xPEa9lSTIfFMtVHBEXSo4PDORs 18HV4avPtuczREK95XodH67fW6fWGo1OpBLTZ9hohELBgJ2ZVOnu3KQ4yxeRmIBjuDKs JOb72CKoJbBOugvuLl1NOMu0lANV2u25FcA+/wfLEs/jpBH/8aGAU31uLjxYbbuvYyXh NugQ== X-Gm-Message-State: AOAM5309cpLXpTbTrwzJFVq9K0HQBFs3jt998FRwBLpHcwYz+vmISFPH Po7ulhtRYTxa0zPbFjkcf7GYDA== X-Google-Smtp-Source: ABdhPJwd354cCqeKi4ljRpmFshygrJuB4B086tJCKwr85zi67cGcxWbK7tBwaL8IV0iw93wYVTqRVw== X-Received: by 2002:a17:90a:d082:: with SMTP id k2mr905742pju.195.1603785431787; Tue, 27 Oct 2020 00:57:11 -0700 (PDT) Received: from localhost ([122.181.54.133]) by smtp.gmail.com with ESMTPSA id m13sm976201pjr.30.2020.10.27.00.57.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2020 00:57:11 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Rob Clark , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH] opp: Reduce the size of critical section in _opp_table_kref_release() Date: Tue, 27 Oct 2020 13:27:06 +0530 Message-Id: X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Rob: I know this only fixes the issue partially for you and I am still looking into that. I just wanted to get this merged in early as this fixes lockdep for other users as well. 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 4ac4e7ce6b8b..0e0a5269dc82 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1181,6 +1181,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 */ @@ -1208,10 +1212,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.25.0.rc1.19.g042ed3e048af