From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D70E3B8BAE for ; Wed, 21 Jan 2026 13:31:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769002314; cv=none; b=EZJKXG5r8lfcryjN4hJ+PxAlLfcUzr4fExrFllA3s0IdwwnCt37ECtwPzN157niqguoCc3knhEs9DtJJqVn8hA/ZN2ZIZyldGQcL+TNYimvR7ug5pLXIrECklJ1aZm9yV+Z1vQYdnv5ezhBCWo/Na5rBFwLuRsQ/Vq5qFeng5eI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769002314; c=relaxed/simple; bh=DcH9k9Tlh2c03HyU3Zw/7RvqbH8v2zIC0lTji3hhsSM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Hhut56dTzP43yzH0m8qPHM3GLBPwL7HeYsYqCb8v5YbBI2r7bwb9Hj09eqb+vcsjUdfT4/cP+ZpYgc7BZTWHxtI2KKPtUPG2K5MBKa00gwyH7pT2RnWmIgh2C0N4AUfiFis341RYdP66P0RzNO1Y/NTOb/4+ByL8kEyRYmrpe1Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=P5aUjMGQ; arc=none smtp.client-ip=209.85.160.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="P5aUjMGQ" Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-501506f448bso38536911cf.3 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=vger.kernel.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=P5aUjMGQISabFbWzdwZIeIsxiY/Fo7Sj8NcPubSkJeDIbfKV0j4TE2rUdb+56AcE5T ZLKr8CqC4+gBRW5S0ZIdfWYshrEfWq2QkHCs6J/1Zzbsn1a53UZtNJ5Z1ToViw6htJ4q 3R3Cg/7AnC4PEHBR7Rutkjb4sAl/eMo56ydB3XQIkPE2yDm6fDgtrasJT3QCV1u2PiM7 lGM3DosoiavJOnvKqIho+6VmGc8+gcBKQSf5iLajfy5PPsdCyLZsrHP3sf5tVsfUF6Ov M/T/PYVqGP7toMUFrbNpfjZoie7MmXMT5ASm5Rs2ZHfGacKQfHrTqzaxW1tfcE65pDLC iwSQ== 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=VAlcuqLT5jisN7VSgJa3fpgmhfjb6lCmdY/DVnJTFqpNhBdPrL3D7ry8jkJ1jLAqrI MXX9Qd8WmMQat8Ae2j7hY5QmT3CQ7t9quNY80aStV7XuHenDXHU4tmP7eCJl9jckXic9 3bJoXtd1jfe9NafI4nmFclObEHr3nyonTlHz12cd7BexFKERWtgpCjjK13JFAfT/XpPg 9smrIpvH3sDHulHynUViXJja4rGb/8spXgcQW4ONSQCC2B9jX/r8MhmheTeI0GyPlbCf Lr98HNRlCljCT1RBm34vJYJBJi3Bmj+weSSPHZShSDsUld0G5IpcCPJdsFQB0dFdxDqm SfOw== X-Forwarded-Encrypted: i=1; AJvYcCUdddoHqSBLiTXh57dF5Jq4PRjC+bnIhFStigTXLGQX6n0G/NfdElIq1MxMvOoFZ3H/XZ9GPLNAUyqtYR0=@vger.kernel.org X-Gm-Message-State: AOJu0Ywh3lwxdxWjM04qNdU2kgiEH7DEKRvJ9NpaCiMaTw8XTYPvasgY k9nJTQwSL/hs9PcRlfwm3qLyQV2JxTVFwXl9OLlK6Y32Fk5XWZUQKhbTplWNRg4WXlI= X-Gm-Gg: AZuq6aL686ijvVhMZ683YoFk5IyCGwtHtl07PMXbgTu2suiMbVUzxkY9V5no5gzyofu +4XM6Y6Vp+FWyhG1oLgcYet1gswRHB5pedq5JT/oOP+sUO2Q8WeaM4jg9jJ4SgAEyHHkYql0O/v GBmA7oYZlYq3SnaTBMSZOuObffOTdPeQsVsYI1j2IKj5gskCKm2SAOOOIKWzCORtjR90t9E07f2 E+JYYq2iLZESzsWOinv7BaxiFU2gNHZsh9UWenmvURjlTWxlJ935rbG7Z1DaW1OTXDsUlK7UWMU nylmBqwaljN8uOx1FpWe/jwn/HKav2TymORDs74aVPSrpISIxVbLdTpw+UFS1lcGPORBuZrJdlv TuwE3js8nzxOYrVAkd6ZCo4SmrCWDXDJ/5S7llM3o6xUCTHJiTNXEv4tIjGAVjHkmw0ExO0H64t pfJIUfe1c8NfxFMhefsFwPCSZ2hibzoycWbte7U49W8CSCvVifg/RmDfIzx539hmJVFU9U/euz1 Gy4Dw== 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> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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