Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3022835rwb; Mon, 15 Aug 2022 16:20:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR4HSXlZuGAjOH9Sb4cJVb2CeW2n6JUxMoKkntYrSnp4t6C0UPGcieJ6HcMVVxeLoqVp1FR8 X-Received: by 2002:a17:902:f806:b0:172:55a6:bd25 with SMTP id ix6-20020a170902f80600b0017255a6bd25mr15223559plb.61.1660605619332; Mon, 15 Aug 2022 16:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605619; cv=none; d=google.com; s=arc-20160816; b=qH1SEfPSwM4XJTJ3ugvRXINo3GXwC0DnMZocFMV8I7YaLHWYNTJDoc9HNGAxiFhAZp /wPQOkgOvd7iivh33SAyMzKi4bDrB8l3VgEWb/5xPRe3qjRovE1QU6UvvJQmcEZD69Qt TTtGaOhZ8lMgr6LMyKZqlJxauXjzzV0C44KYXNBN6k78EF0gVSzbno94wfPI6z69mjwX 9Is8RIKWDknPBcqmxZGUfxbrQLmQQ4zk4PsL7LdPFxoITDy9cbmFzbzxY3EK9Z2oZjfw /AmWOP8QfXsw/dhUDmfeKknHL3PK/VjQmtY6dYozPGVwE27iOJN1MjnyYfWRnzmB3F6X 1BiQ== 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=H0t6vmd2Ifa6oaTjqFtAjTL81YOE++xCDZZxjdTvHZs=; b=Tw3W54PuPZv9bDQ7yWkfk5VmH3uyx4/ZqGKiAF5Evxu8tA4MQ7ucWzS2WtTdwLmIHe dT3AQ9wnqM6TSd2KGd34O0MWYXnB9/7KD5x2qmAPBjDEXkzvc/co66M58Mu/KIjEpZcd 1zVJ3y4AIkqDYVMQQe2bM+kta/KNFXOMmhzeCPnxLeYy1zBfKH/NDQol1n+VsGP3MYSf XceS8QJqEJcXHrbAWA3vjGTI1YlMa8+/E7ArBngf+EQFTUyGvCEfajuZKOmfJ5EU0+BU ZJR7Yxyhwdp5g0eAZdqygamK6fkoqylfcuVR1r3F1m/R/E3GjfyAzjPvYmG0HEtzfCv9 oIpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yrFwg9iI; 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 d1-20020a170902e14100b0016d5cfc6fd8si10207979pla.32.2022.08.15.16.20.08; Mon, 15 Aug 2022 16:20:19 -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=yrFwg9iI; 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 S1343916AbiHOWJO (ORCPT + 99 others); Mon, 15 Aug 2022 18:09:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348919AbiHOWGN (ORCPT ); Mon, 15 Aug 2022 18:06:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98E85642E0; Mon, 15 Aug 2022 12:37: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 A9504B81136; Mon, 15 Aug 2022 19:37:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00FDFC433C1; Mon, 15 Aug 2022 19:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592262; bh=ANL6klqW/86IDG8pasVTOS+kTf2py8/R0aiAnbzkIjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yrFwg9iIzKnnIwlclIFCGn7tGIex0L0H6eNqzeI7H+MObv4FHjWp00GYAm+Lb2SUY GYF/KYgIp7Q5MYEz6fq91nWuu1oRZiUPwXTXK4BYx02bMPkTlwzZm3Cqzd9VOmGCny JjPorBtDmG1o1i1uDdzOnZ5tQAAgqheSHeFak4ck= 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.19 0082/1157] drm/gem: Properly annotate WW context on drm_gem_lock_reservations() error Date: Mon, 15 Aug 2022 19:50:38 +0200 Message-Id: <20220815180442.818738923@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 @@ -1226,7 +1226,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; } } @@ -1251,7 +1251,7 @@ retry: goto retry; } - ww_acquire_done(acquire_ctx); + ww_acquire_fini(acquire_ctx); return ret; } }