From patchwork Fri Jan 5 18:45:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 13512452 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54446C3DA6E for ; Fri, 5 Jan 2024 18:46:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 073E410E66E; Fri, 5 Jan 2024 18:46:52 +0000 (UTC) Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5402410E66A for ; Fri, 5 Jan 2024 18:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704480409; bh=ptvxcc6NBB3ZGswpKHFL88IdpqznzAuLiZMI6wVLSM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJ2pdd+pvOEsV/MddsX+Rhpq10rQUgrH8iMoWqsE7sbqJj2DiHIbSlFYhxXUeJYe7 7BGFC5fvX/r/XKQR0X/OOEbXX/Am1YkrB/hrnW3yrbNUXnVguTcn3dzUqQiGlRkLQy knPw1o4W2gcMLpWddKcmZUTf2OeZPsMq5vWBm1n9X3C1mZg/GLQ+rm2i+FJNmQQIiw Cozz73jTI07/xgH2AFJJ7p19o2+J1YPwqmJzre52rzcpeYv2cqMQR4x+xmI/RtRyph TTjY+9ntgII34qtCuS71YoTCGs7ayEtdxt6O6MAuqsrafsAehlAKaupMgVxxQHf4Bh amDBvdPr55FVQ== Received: from workpc.. (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madrid.collaboradmins.com (Postfix) with ESMTPSA id D499B378203D; Fri, 5 Jan 2024 18:46:47 +0000 (UTC) From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , =?utf-8?q?Christian_K=C3=B6nig?= , Qiang Yu , Steven Price , Boris Brezillon , Emma Anholt , Melissa Wen Subject: [PATCH v19 03/30] drm/gem: Document locking rule of vmap and evict callbacks Date: Fri, 5 Jan 2024 21:45:57 +0300 Message-ID: <20240105184624.508603-4-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240105184624.508603-1-dmitry.osipenko@collabora.com> References: <20240105184624.508603-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The vmap/vunmap/evict GEM callbacks are always invoked with a held GEM's reservation lock. Document this locking rule for clarity. Signed-off-by: Dmitry Osipenko Reviewed-by: Boris Brezillon --- include/drm/drm_gem.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index f835fdee6a5e..021f64371056 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -156,7 +156,8 @@ struct drm_gem_object_funcs { * @vmap: * * Returns a virtual address for the buffer. Used by the - * drm_gem_dmabuf_vmap() helper. + * drm_gem_dmabuf_vmap() helper. Called with a held GEM reservation + * lock. * * This callback is optional. */ @@ -166,7 +167,8 @@ struct drm_gem_object_funcs { * @vunmap: * * Releases the address previously returned by @vmap. Used by the - * drm_gem_dmabuf_vunmap() helper. + * drm_gem_dmabuf_vunmap() helper. Called with a held GEM reservation + * lock. * * This callback is optional. */ @@ -189,7 +191,8 @@ struct drm_gem_object_funcs { * @evict: * * Evicts gem object out from memory. Used by the drm_gem_object_evict() - * helper. Returns 0 on success, -errno otherwise. + * helper. Returns 0 on success, -errno otherwise. Called with a held + * GEM reservation lock. * * This callback is optional. */