Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1861972rwb; Fri, 19 Aug 2022 10:36:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Zi8fLF/Ubfim0nfe93BCK7HqhckI/RsSnu/qOxJTzbGgPRAFMKRM0QYPVVD8UgYtqS+pN X-Received: by 2002:a05:6a00:1a91:b0:52f:29e7:c32c with SMTP id e17-20020a056a001a9100b0052f29e7c32cmr9001356pfv.10.1660930608738; Fri, 19 Aug 2022 10:36:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930608; cv=none; d=google.com; s=arc-20160816; b=f5m2nWbZ+mAY1BhU2hFr8zOytAI/QJj5zWBQVP1cxLbR2z5P2ZWNrSo8K7aB+MrhCR 7Ktm67v/3FY3VQJjFs85NvOmt7ZMFbFfkvAYn581be+kJ4oenIG0ii37AKb4/t6k6dsu jzGLcAE/7i9nPe6Fl5xmKNTtU9pvJffG6E/fYmSWLLYjsXdTxE01HOczELA7sLnR9+KP 0qtge01Nu5wcA1qv2CFxBa7bY0RNummNFlWooszddSwzsVBijX1EsGAIm+fI2bhJ+4T4 W8rosu2Lp/wjUypZfIWFqW/cWoFc01iMvmEBtj3L1CVJ34pz7DBoPqsnk1dS9FVs2djG h+gA== 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=Ron0Mu+QP5IClViz3ZziQaULBnw9AROIW9M2Tx+5z6E=; b=BfG4rShVAE+EIn6qyGqsFVFUlqEH7Mf3WdLuO0aMiU4rvwFvALU2zhPyL9y1nuEk6n XGG/9oSYkZSdH4SKsxVcneX60caCgemPCS6Xqrk5BpcgSeZWxJ4xC8pZoPTnXmGJZDca 8VtaA6gVb2hMCXSM8O0Pk+YII+nnNOiDJZ5I0mvgQB57dChZrjAJVwegVMH7H+J/Cfs0 se+hcaMA5du9uokcqUGa6CnJAJPo4dSLBygbKyMTLXfS4AIOESI8uwbdn5Rmfxm7Z0j7 DuUVGqCsCXCbeJivLgOG75lMhbBnYHN2/jm/l55XNsM9AQkiWr1CSDI6lkKclwV4THlq G66g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vw2gaYGi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a056a00134900b0052e525cc159si5234756pfu.160.2022.08.19.10.36.37; Fri, 19 Aug 2022 10:36:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vw2gaYGi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350351AbiHSPuP (ORCPT + 99 others); Fri, 19 Aug 2022 11:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350128AbiHSPtf (ORCPT ); Fri, 19 Aug 2022 11:49:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11169104B1F; Fri, 19 Aug 2022 08:47:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 914F7B827F8; Fri, 19 Aug 2022 15:47:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00853C433D7; Fri, 19 Aug 2022 15:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924062; bh=P7q+UipvlCw/WKePsi4TKb/8NcwBOlpJ3wZ4c8QT+WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vw2gaYGisOzKnIDM6FRZoMgJcqFMSTxIpw2imb/sCR795kVBE9o5L9RDe2s7J8zOc CQwV/NzffT9YLREGqrQAfrEq2OVZAX1oKnn8BsvWW7e+v2CFXruRm8QSKtx2NKAXu8 NWh3HYXz0T19sG3dLUmPpTCr1BAX6lR7F6FhpddM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , Dmitry Osipenko , Daniel Vetter Subject: [PATCH 5.10 042/545] drm/gem: Properly annotate WW context on drm_gem_lock_reservations() error Date: Fri, 19 Aug 2022 17:36:52 +0200 Message-Id: <20220819153831.100583523@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko commit 2939deac1fa220bc82b89235f146df1d9b52e876 upstream. Use ww_acquire_fini() in the error code paths. Otherwise lockdep thinks that lock is held when lock's memory is freed after the drm_gem_lock_reservations() error. The ww_acquire_context needs to be annotated as "released", which fixes the noisy "WARNING: held lock freed!" splat of VirtIO-GPU driver with CONFIG_DEBUG_MUTEXES=y and enabled lockdep. Cc: stable@vger.kernel.org Fixes: 7edc3e3b975b5 ("drm: Add helpers for locking an array of BO reservations.") Reviewed-by: Thomas Hellström Reviewed-by: Christian König Signed-off-by: Dmitry Osipenko Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220630200405.1883897-2-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -1277,7 +1277,7 @@ retry: ret = dma_resv_lock_slow_interruptible(obj->resv, acquire_ctx); if (ret) { - ww_acquire_done(acquire_ctx); + ww_acquire_fini(acquire_ctx); return ret; } } @@ -1302,7 +1302,7 @@ retry: goto retry; } - ww_acquire_done(acquire_ctx); + ww_acquire_fini(acquire_ctx); return ret; } }