Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2927116rwb; Mon, 15 Aug 2022 14:12:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Vpt9srTNU7XnJOvfuX/9mfSIT2FMxVLN1VB/xI7Ot2q/3mUT6f4UQ/r8XMeMvzovv4sVm X-Received: by 2002:a63:e90c:0:b0:422:5ab9:99d6 with SMTP id i12-20020a63e90c000000b004225ab999d6mr13743458pgh.394.1660597952080; Mon, 15 Aug 2022 14:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597952; cv=none; d=google.com; s=arc-20160816; b=mhhvP4VsZOrV85Pexa444pFHifRnRHkl9+9eh2NPacZPAiSdnGI1FpqHteCfMl6og7 HLV5/u+u7wWJckd+8WrURHXGm0Q7Tfi7tHlOlbc33y0CUpWgSQHUalyMHZc/nwvxYjY6 DjS0m1UbIgV15/rixISbAjP9oSPox6DVggKvqSECtw6k/Gv5XBEm8qB7FTe56Ls+urvh 38e+2cGFBvF8m8H7GsOkOcXF1J09AbutwXZ62TfWRJFOyerOCkkS3hsomno6yQjBKczA 19BRj6a5FxKrn6+ywInr1kXldgoNQkKbcLA+sBksmUt+6wfDq/doVnOHcQMVdd5IuJCx H0vg== 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=D+xWAtcqey4x/lbq8ov85g9hWorZ9E0Ku5UhR122BNo=; b=XFkO0llsn/iu4bLFWd804apvnMj3LsGvv4rmQVrZDbUrd1W0gia91w1dV31S4I5ML5 lPnzQmPKIT/ymoREv/bx0or3Q7785Mo5+59sK4/NyNowW6WukVi1DFZm19A+BLvmjW8Q h2Wu11E3H9uwYV48J3NWg5rBLj9xg0vk68MKxsCM5/AH7/gRa2OyNI2rucxfEgrrVeb/ HcqEaKMwzelyJgQ3MUL0n+Y5w4uhmLyT1cn2tUK6J2vEP2JkUKWYNbhNLph3yBdLmp97 anyXb3VFQU7NN0vWUSyZyvqDG5PhLIpn7kcB5Bp+iwOmryjqtu6sJAyb/GS5Q0RY9KkU deAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qji79Sbv; 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 q1-20020a056a00084100b0052dcf00aca5si10685614pfk.40.2022.08.15.14.12.20; Mon, 15 Aug 2022 14:12:32 -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=qji79Sbv; 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 S1346784AbiHOUQZ (ORCPT + 99 others); Mon, 15 Aug 2022 16:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346540AbiHOULl (ORCPT ); Mon, 15 Aug 2022 16:11:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18AAB48EBF; Mon, 15 Aug 2022 11:57:52 -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 0261CB810D5; Mon, 15 Aug 2022 18:57:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56BC6C433C1; Mon, 15 Aug 2022 18:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589869; bh=Rb/9eQRLbUfd2fRzgGAKHPh1034WETbV1eA+5pMP7DU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qji79SbvIucD0sW+OvZKuFeKHBpocmX+NIePYyzueR49AUQLSA1Kh5P4Ag9HLOLIL vGb5b47++w3Gury5C2Oz7XEjDCfgufFSxEUo2tBmTaesNsiUg3nv58bz8GHq5ka5fH wTrpDrjZ9LzxOdo+L7WLLINKT6D3/qEUComomoHs= 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.18 0075/1095] drm/gem: Properly annotate WW context on drm_gem_lock_reservations() error Date: Mon, 15 Aug 2022 19:51:14 +0200 Message-Id: <20220815180432.632763251@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 @@ -1225,7 +1225,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; } } @@ -1250,7 +1250,7 @@ retry: goto retry; } - ww_acquire_done(acquire_ctx); + ww_acquire_fini(acquire_ctx); return ret; } }