Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp318559rdb; Fri, 5 Jan 2024 10:48:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrAVVSsNPEwLIM3PDE5sMl5KrcE912jo9k7OPBSWFNz/Y0q61XWFQ6npgbus/5sccStr3z X-Received: by 2002:a17:903:48d:b0:1d4:cfcd:39a0 with SMTP id jj13-20020a170903048d00b001d4cfcd39a0mr2335735plb.8.1704480481026; Fri, 05 Jan 2024 10:48:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704480481; cv=none; d=google.com; s=arc-20160816; b=hnmJlgO88YGmZ/+r+D81M2wFfslpSDXMccxFoKPHVkfZpliJCTiPeXjoLmgDF71plk 74gtW0W+of7zMOOWmpK2EKqNwXHir2dnOjG1AOOKVLxvZ2X1DZm5KbluO0hzJ+S/aP/6 dJggEs/VKG1wD27h7NB78pcr7/M+XD5agWkV7AH0bTiGiw36DXzfV4DPZiIwz4PVR+Tv jTe2yiEOecHb3zJQwwcvX3AKeQzzQjm1f3rH7cRP29Db0HjhJvHu4uzVILMjDfTXAym/ 3/J+NOT30amRCb5iuDUT9EBlDJ9Yxt1sZnhrChRRUOE9PP1Lve6YUaIw4u0Iht9n2WDW 23Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VAVzM0Bkhs4/hX6WtFua+aANKLF+hZaeRqhKCvrYXvQ=; fh=5cel2jD5h+yPMXVwxbomyVhwojHUqATy6nFjd4aOh4o=; b=bp78W/e8pLDojXykxGHvNovK9UEFN4WPDUqJhdsZrL36Rtv6It+1Nx2Vh5hDL6CyZz 9c8mmVNjzaxdOu/OpCrhHkkcsnCCm7a6SWk53Tw2349/v3HGkLYb5LxftUUfuwYFIm8E C85iVbDWlN4wlvmMENhB2ZN0v6wO87MbgeGDQ1KMleEkNAAHsbuTEFZZ0UHdHg+wwC71 uWOM8xuLE6x4E7IWJQfz99ww/JsBLePT87HTp3b/ZqzCUmQxF1efJLE2BFigjy8fjJ22 b/iRTZcD3dba4vL2Yz/hGpaIiyHDeO9GXIMkZJ4FZtfK5Dw62xETEnSWp/Rwj9IPKWdG C98Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=tJ2pdd+p; spf=pass (google.com: domain of linux-kernel+bounces-18241-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id r6-20020a170902be0600b001d36292f2b2si1620378pls.215.2024.01.05.10.48.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 10:48:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18241-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=tJ2pdd+p; spf=pass (google.com: domain of linux-kernel+bounces-18241-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A208BB23B1B for ; Fri, 5 Jan 2024 18:47:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14321364A7; Fri, 5 Jan 2024 18:46:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="tJ2pdd+p" X-Original-To: linux-kernel@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D596135F16 for ; Fri, 5 Jan 2024 18:46:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com 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=20K=C3=B6nig?= , Qiang Yu , Steven Price , Boris Brezillon , Emma Anholt , Melissa Wen Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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. */ -- 2.43.0