Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1602238rdb; Wed, 24 Jan 2024 23:55:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IFr12Ezx2JpgohZGHyymo+vUSUOJgkX3bbLt7uq2/B+0ekgv+65obbH4G2Ovc+nvx4BgFbU X-Received: by 2002:a2e:9214:0:b0:2ce:9:bdbf with SMTP id k20-20020a2e9214000000b002ce0009bdbfmr392833ljg.75.1706169324370; Wed, 24 Jan 2024 23:55:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706169324; cv=pass; d=google.com; s=arc-20160816; b=L+52qneDWutNP2szrkEGbABWQNNoNTKO8tgb5CFV3OJhFtFccKtW6063dHFPOuOS/S jU4W1U5/qmc05dEGtLp2mIgmsuUxxVPxo+1xWtORX3+tkmtoLMliB/nZGkDnm0LXFnZW sGAFsu6fH5/zqyd1+kxew7a/KWcd4Pgp4Dr2M24PB+AMZQza4p+B+IJBm3dgwAL7pgWx osQsfnmBCxE5SxHNCI9jvTnbnoYn40fviV/1LsoZpjlEZ1wB6pyjTp6Hdcg2s7qztU/C rIoW2cRfzSIJHaC5HxBqnFLISnYnEngBbs8UQQzGHDEaCvs0oLpapggQG0iyojofrJ9S rlqw== ARC-Message-Signature: i=2; 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:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=ECV5PbGa18En+m0tXrSWv6e3DCTBVaPGJzSgTveG+50=; fh=uxLNaPoPRUzmkUc1KOgGwCEU/bTSjK8Yed2Up6ovXLY=; b=LnH3J3dFnGcV8snfyqME+EWNy717KtpbcvGOYRSUfuOB+xsMzFeLyq1MuVXKWhPDyr iyXGPWkTm9BA/DqE48GY31JlWV4eWoj4MIJJ2wzMqRsv1KWZ6ds4J+bLcsyv+t99+r9M E1UPueJje9jGT+plWNUsp32krQ1ZrvzXX5C+alagQGF1uhD+rNsi32GuB0BYvyhjw1Ji R/iQ62sIWMiZOkqEhhAoC76HP97oUalQDScp0xX4mM38ZDW6+q8mCOyYZ5Yr7jOP9RzL duAHFtmiPF+ImkQGdM5j1o3qr4ZcWR98G8ns5LPa/GQOQ8Fu0vwU7QLgC2H5R/oMYnz+ e8JA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=zBWcBxnJ; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-38112-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38112-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id br18-20020a170906d15200b00a2c552ffc34si762974ejb.480.2024.01.24.23.55.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 23:55:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38112-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=zBWcBxnJ; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-38112-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38112-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 200521F268ED for ; Thu, 25 Jan 2024 07:55:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3346A18039; Thu, 25 Jan 2024 07:55:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="zBWcBxnJ" 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 9477817BAE for ; Thu, 25 Jan 2024 07:55:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706169310; cv=none; b=S6iJVhUxjjs8VkUSjMUtZFbNLXEp/hIc3XA8Knr7GuMhebtXNbyBfmHUWFNn7zGF7/DY2Srj0HQ26jcmS0n6Vb3eMM7XDni8bnMM68L04NxQ7ItZYyPR6FCwPqk9KAvA6X818fDdiMZYoEEMibE7Y90PGMEYT2qvIyfbx58/m8U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706169310; c=relaxed/simple; bh=pyMEcKtVJxb7T/GxClE/3Bz1lwTzPFpnniWDjB5Fa5o=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WmdWud0fqJycTyqKgLPUglPU6PnhEtJf/Mbl5G+VEQZMEBlhznv3G7AUE2V3csCoCMX2gTY51bUhBz42QMJZ/7spnA9BIcR2ptrUChhfW6y3nRwjDjhIlD3YYetRkWDChiQKNhdKIJHIZROmK1B50f02rR8kWflMXakhsHIGcyw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=zBWcBxnJ; arc=none smtp.client-ip=46.235.227.194 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=1706169305; bh=pyMEcKtVJxb7T/GxClE/3Bz1lwTzPFpnniWDjB5Fa5o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=zBWcBxnJsGwrfch37UMhqu8LOsolJ/KVQkSJosUgJJGDb13zcIFPsx6HODmWPyU8f 9Snas5pyoGFXvJxIG8IDHGvtHbNhq2E9pcEdcrwauBNR10UF4BXpcmcBpKtl8eA10W eGtHePMNgsNf/tLNUwustb7V3WUku1kt6gubqx1HQu4eIFXO1tl0DZhkvxuOPpbKb5 F8LZNWLndzD6mX7VsvSNG8t8zZ721d38yKCLaiDKcTqkijAeVgOqfnf6TR3ryfd7S7 7lOI/jnhRkZwApt5Q7OsiAfZ01w21/IPJZ1uUhRowWTgHeQo8Rrl00L40pUw4slIu+ 0Raekb75VHLsQ== Received: from localhost (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: bbrezillon) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 460243781FC7; Thu, 25 Jan 2024 07:55:04 +0000 (UTC) Date: Thu, 25 Jan 2024 08:55:02 +0100 From: Boris Brezillon To: Dmitry Osipenko Cc: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Christian =?UTF-8?B?S8O2bmln?= , Qiang Yu , Steven Price , Emma Anholt , Melissa Wen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v19 03/30] drm/gem: Document locking rule of vmap and evict callbacks Message-ID: <20240125085502.3207ee29@collabora.com> In-Reply-To: <20240105184624.508603-4-dmitry.osipenko@collabora.com> References: <20240105184624.508603-1-dmitry.osipenko@collabora.com> <20240105184624.508603-4-dmitry.osipenko@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 5 Jan 2024 21:45:57 +0300 Dmitry Osipenko wrote: > 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. > */