From mboxrd@z Thu Jan 1 00:00:00 1970 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 4F7DAC44526 for ; Wed, 21 Jan 2026 13:31:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C15B88F94; Wed, 21 Jan 2026 13:31:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=ziepe.ca header.i=@ziepe.ca header.b="dr0ExeED"; dkim-atps=neutral Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3881310E154 for ; Wed, 21 Jan 2026 13:31:52 +0000 (UTC) Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-5029af2b4bcso29276571cf.0 for ; Wed, 21 Jan 2026 05:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1769002311; x=1769607111; darn=lists.freedesktop.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=aX294P4TliS2B0BrPhrC1yfpgvWNBReUGID/aL6TSBE=; b=dr0ExeEDyi5g/bVQS07zFXkgjtpQtmdamxgvPGa+Qbt/TLE9ulnRuTb7t3D5dZVvMe esid7rScWII/APmsLWprvrilGK25VG4wiMFTEwMFsqLMep3Qd98RCrpTnaSSgbYketgo yECNYaz6dqFX5Tj1zQdBPEG5SNFI5bhclWDYpM68gS2axBR0z03aaGyCNVbdlkqUKr1V tJnThtjASU/QEBYtNcMV/k6T15M/jntvWQjn2HmwQucJB1AcVvEYuJDir4nE0Zxz2p73 Qj008tDzN1BE98X79V1ittf2pcofPaCJN+M1bZJAfJ+ufY3sL+V0x07tQi3WMgPfC29C sCyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769002311; x=1769607111; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aX294P4TliS2B0BrPhrC1yfpgvWNBReUGID/aL6TSBE=; b=D6L/9MyZM8biWesKN5C6GxTO89mKVVZa2VuG5AF46TIXnEo7S7gey3YAnev8ipxf+p zRT776iM3ztL0fCVpgaoIwzGpDE8ykNsbsA0K8jDyP+QcqD28rS4Aqs58UENCOM50Grv p8TPWc+1AE1UwHCr3DhJ7/YSiCrtQ8dBRxxN7Vy3PyRVqCu/Aa21oishAg9cf9Orqaj9 JURkvAVTctWZc0PXVbeLxkPB1uZhDULD1Bt+VJ43QtbMAH4WjlZ41NyF5obaM34F8d3+ CdxbJFOSpwZ7CrKMTw0pTiJ1cszjP8ag65pRdhJ9csBat1WfUzJ36c3lEkSyWaxurzSt w8zA== X-Forwarded-Encrypted: i=1; AJvYcCVkbcB9NUmqqL0zmVRN6MVTmp2P38KvFxXTqlE3tg4a4vWCxeKsZ2cVBPJSfpoNsDBHc7i3TaQQtmc=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzbewdfNjv22Kglosgg1fLRPfNW2IskKeOInySalUxO46aFEbK+ oiP8sKxg9EMnSeZW5cY0Eh7EEjZNq4teQ7Z/bLsOo5Zgb9i9cnXrqbT45vrZwvjT2Cg= X-Gm-Gg: AZuq6aL6TAWtTiEA1tJ3Q1MIsvyRL7nZBsYSpo/Ov7u/o9eZuP81UOtxu4VXJqZ2pY7 bZG4Nu2pKHcatEBm/Xd9WBsrmnaG8YcCosZ8P7ETKf/UWUZq9x3NDwTEiFZBQV7rIhPytxiC0W2 +3jgEnhz6TadYfKI1cUFFBaCxeg6jOeT9bDRakenWC9pgSPNV0epshoMEO2n7SsGCf5l1DyalQt Y+5WThvb+vuA8h6FNkFsMJhktH46JnRSc3ecBIUE8XKO7vRyp6cwbFDjYkialnVcvKccXsVc8t4 ReEt3aMYbIRHDT5R8l6yuJ5zVidZJHDX+hJr9JGIQiESKMn8BmWUMLRgvjekuEqyTq83jnk3lGX WqGU79mEnYwvWIQ9fzFAzXrapX5auLQS3z0kxwdCROFfFOHUSGVTHcle1PLdukfrtPlKB6BxO1Q FY6nAM2tqcp+FJnFNJVigjvb9ul50T+0kbIrfRyPlF0XAfvs0CLmqn/MsJ3pvO5ahV8JPqKwmY6 e/UZQ== X-Received: by 2002:a05:622a:1aa1:b0:4ee:2200:409e with SMTP id d75a77b69052e-502d82772a6mr67009251cf.4.1769002308002; Wed, 21 Jan 2026 05:31:48 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-112-119.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.112.119]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-502a1f1c1c4sm108692291cf.33.2026.01.21.05.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 05:31:47 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1viYJG-00000006Dbm-2x5v; Wed, 21 Jan 2026 09:31:46 -0400 Date: Wed, 21 Jan 2026 09:31:46 -0400 From: Jason Gunthorpe To: Christian =?utf-8?B?S8O2bmln?= Cc: Leon Romanovsky , Sumit Semwal , Alex Deucher , David Airlie , Simona Vetter , Gerd Hoffmann , Dmitry Osipenko , Gurchetan Singh , Chia-I Wu , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lucas De Marchi , Thomas =?utf-8?Q?Hellstr=C3=B6m?= , Rodrigo Vivi , Kevin Tian , Joerg Roedel , Will Deacon , Robin Murphy , Felix Kuehling , Alex Williamson , Ankit Agrawal , Vivek Kasireddy , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, virtualization@lists.linux.dev, intel-xe@lists.freedesktop.org, linux-rdma@vger.kernel.org, iommu@lists.linux.dev, kvm@vger.kernel.org Subject: Re: [PATCH v3 6/7] vfio: Wait for dma-buf invalidation to complete Message-ID: <20260121133146.GY961572@ziepe.ca> References: <20260120-dmabuf-revoke-v3-0-b7e0b07b8214@nvidia.com> <20260120-dmabuf-revoke-v3-6-b7e0b07b8214@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Jan 21, 2026 at 10:20:51AM +0100, Christian König wrote: > On 1/20/26 15:07, Leon Romanovsky wrote: > > From: Leon Romanovsky > > > > dma-buf invalidation is performed asynchronously by hardware, so VFIO must > > wait until all affected objects have been fully invalidated. > > > > Fixes: 5d74781ebc86 ("vfio/pci: Add dma-buf export support for MMIO regions") > > Signed-off-by: Leon Romanovsky > > Reviewed-by: Christian König > > Please also keep in mind that the while this wait for all fences for > correctness you also need to keep the mapping valid until > dma_buf_unmap_attachment() was called. Can you elaborate on this more? I think what we want for dma_buf_attach_revocable() is the strong guarentee that the importer stops doing all access to the memory once this sequence is completed and the exporter can rely on it. I don't think this works any other way. This is already true for dynamic move capable importers, right? For the non-revocable importers I can see the invalidate sequence is more of an advisory thing and you can't know the access is gone until the map is undone. > In other words you can only redirect the DMA-addresses previously > given out into nirvana (or a dummy memory or similar), but you still > need to avoid re-using them for something else. Does any driver do this? If you unload/reload a GPU driver it is going to re-use the addresses handed out? Jason