Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2806728rwb; Mon, 15 Aug 2022 11:43:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR5F1VHtX5+liiuk0U3GBr6GME0XaPbm/x8aCZj9Kk6/KReLdorldIE0o/88atxU2fdzKOE+ X-Received: by 2002:a05:6402:c45:b0:442:c549:8e6b with SMTP id cs5-20020a0564020c4500b00442c5498e6bmr15644891edb.123.1660589037154; Mon, 15 Aug 2022 11:43:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660589037; cv=none; d=google.com; s=arc-20160816; b=na9bsgyhIKZIZhkd3W1LIbNJaCMUqACDxdJzE7bFoqYDzPFL5gSX9GAPyaxakQkfpc Xo4Ir8QT3CkWcYoEufr/yZM/vcXZnjbgTNHokLBaavQwUcUA5iDW79fxupsNIjP1A9f5 CEHC9UsU92eSbJZM+utdwKp0O0BdtesST6N2OnwrmyAZpHp/1BFWgA87J//1Bq9BTnC0 +r9Q8eM3pg7jYh5r0K+j6hNUGYGtp49tXhPvS26rqdBvYPT8ZbqubkHKS7tJIaaTj47F CRi4wdhQIFrKpmjOgmhRKTk1D9rteWCDDRWixryfUXy2h/BP6rgdin277UwV4+985Lx/ Av7w== 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=G29AnuqC5MDz2gSFSMUIDx9eGw3jTFUHpSfcOlemA84=; b=qBVrulaq/8kGlR5l56s2t7y5gYr2F9qlzBEi3Rx9nVku6PdJgPyq2gc1vH+jitKmYq upwh8fQgug55OcW06m5V+9CcuWTGvtmsqFm/q//0ljL4Ci9n+3Pz8hDUlSYtSrn9xMhx YUd4IkvUpW34swSTrr3wAnXOlnihp7nMvGaX0hI3rB+oWW+zseCLSFuKPJfNJgMRYoco fZ9YzAVne8KRHrfLP+ZyLUTRccLQRcMD0x1hjZt6HdOawlgnyEn/8dWbIOZ4EgVko95/ AC8KbhdHA0d/WoFicSJY9COs1oRxQrlbvkefQ1FWg6Vr4OkjD51FREBR1WKbgh4nfxs6 8BWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w8o2lnXK; 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 hs24-20020a1709073e9800b0073165f87d46si9988964ejc.731.2022.08.15.11.43.31; Mon, 15 Aug 2022 11:43:57 -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=w8o2lnXK; 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 S240485AbiHOSXq (ORCPT + 99 others); Mon, 15 Aug 2022 14:23:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241112AbiHOSXG (ORCPT ); Mon, 15 Aug 2022 14:23:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CAD12E69A; Mon, 15 Aug 2022 11:17:39 -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 A54A5B81063; Mon, 15 Aug 2022 18:17:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0211C433C1; Mon, 15 Aug 2022 18:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587452; bh=AlJY+ACG8yNca8rL+K0T0NKrcY/0EA5/g4Bbyoul9Yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w8o2lnXKD1bWi0gJ1+g+EWauL38QXcloVlcaplIn1LlSWgdJDUJ7M2bInP1rGMmRM GW7VoaLsHCpke6zqhAuN5CfkXX+uNAjCwRJR3nxTLbh1O8Afnl6SilOWTu+fnc7SSJ KsMFzNclrbS8bXL4hbOcA9mDx+RmZQDB2prJPcnE= 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.15 060/779] drm/gem: Properly annotate WW context on drm_gem_lock_reservations() error Date: Mon, 15 Aug 2022 19:55:04 +0200 Message-Id: <20220815180339.823514719@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 @@ -1224,7 +1224,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; } } @@ -1249,7 +1249,7 @@ retry: goto retry; } - ww_acquire_done(acquire_ctx); + ww_acquire_fini(acquire_ctx); return ret; } }