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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D8C7C02194 for ; Thu, 6 Feb 2025 13:37:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 967BE6B008A; Thu, 6 Feb 2025 08:37:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F0F128000B; Thu, 6 Feb 2025 08:37:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76ACE6B0092; Thu, 6 Feb 2025 08:37:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 560536B008A for ; Thu, 6 Feb 2025 08:37:57 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F2AC043D38 for ; Thu, 6 Feb 2025 13:37:56 +0000 (UTC) X-FDA: 83089622952.11.9E77678 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id E6255140051 for ; Thu, 6 Feb 2025 13:37:54 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Mgvo+vzs; spf=pass (imf09.hostedemail.com: domain of vgoyal@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=vgoyal@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738849075; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5N+Al59YmEDtBoKSzwKPTh6WUXLbEAKXSUpJ7QukWWw=; b=23Xo3K7DjA16VfEV/OD+0fB9ZHpMDnsE3Ree0a12fDdUyyMcRIiUXzawV47CafsqDBqoE7 MZls2pEtjaDkC6t9WC5dqX6rjQitLLmI6RDrXbTFSdZ+SxTGjSUzoB4VPBEWwx8Vssdo84 C1d0uJTLSDgXr5n19D73bVQInsjz7HA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738849075; a=rsa-sha256; cv=none; b=O5Lngj4FX5/tFT1zaRAX49rK6x/uDIEguWAeB6IxbGm1kwtYdOgJnfat1iHbU94qzTaZTA 2jUPztM4oylprBWIRm+WaLdvnnzz2d+va26qlGME2rTpyyTDuybCu1vHGFv9jyFm1z0uTE uLDXCXqZuvE2QrUC2o99jTqyMtrPiCY= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Mgvo+vzs; spf=pass (imf09.hostedemail.com: domain of vgoyal@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=vgoyal@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738849074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5N+Al59YmEDtBoKSzwKPTh6WUXLbEAKXSUpJ7QukWWw=; b=Mgvo+vzs3KjHSP/DDhot9MOS1Khk6BNrq7OM4Pt3BiAqHe0GKf0LPOvInLT+lFrj+UmkDE BaSCD1u3U0Vid6Rj1rO9cgH/+xuv/L+WvtJRRA/xdZRZEmni/FFvPG61JdG9C0GX2BXCvJ Fg6ZOIbYdnYESLEMQcRRPmMP8Fi2+G4= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-537-Z1CCXbCkNJ6JlHV_rykxEg-1; Thu, 06 Feb 2025 08:37:51 -0500 X-MC-Unique: Z1CCXbCkNJ6JlHV_rykxEg-1 X-Mimecast-MFC-AGG-ID: Z1CCXbCkNJ6JlHV_rykxEg Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3A21C18DFE39; Thu, 6 Feb 2025 13:37:14 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.235]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4FC6618004A7; Thu, 6 Feb 2025 13:37:09 +0000 (UTC) Received: by fedora.redhat.com (Postfix, from userid 1000) id 9E1E56AA45D; Thu, 6 Feb 2025 08:37:07 -0500 (EST) Date: Thu, 6 Feb 2025 08:37:07 -0500 From: Vivek Goyal To: Dan Williams Cc: Alistair Popple , akpm@linux-foundation.org, linux-mm@kvack.org, alison.schofield@intel.com, lina@asahilina.net, zhang.lyra@gmail.com, gerald.schaefer@linux.ibm.com, vishal.l.verma@intel.com, dave.jiang@intel.com, logang@deltatee.com, bhelgaas@google.com, jack@suse.cz, jgg@ziepe.ca, catalin.marinas@arm.com, will@kernel.org, mpe@ellerman.id.au, npiggin@gmail.com, dave.hansen@linux.intel.com, ira.weiny@intel.com, willy@infradead.org, djwong@kernel.org, tytso@mit.edu, linmiaohe@huawei.com, david@redhat.com, peterx@redhat.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, jhubbard@nvidia.com, hch@lst.de, david@fromorbit.com, chenhuacai@kernel.org, kernel@xen0n.name, loongarch@lists.linux.dev, Hanna Czenczek , German Maglione , Stefan Hajnoczi Subject: Re: [PATCH v6 01/26] fuse: Fix dax truncate/punch_hole fault path Message-ID: References: <67a3fde7da328_2d2c2942b@dwillia2-xfh.jf.intel.com.notmuch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <67a3fde7da328_2d2c2942b@dwillia2-xfh.jf.intel.com.notmuch> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Stat-Signature: ntfntcpmdra5u1u9n16xxhh796ak8csq X-Rspam-User: X-Rspamd-Queue-Id: E6255140051 X-Rspamd-Server: rspam03 X-HE-Tag: 1738849074-307920 X-HE-Meta: U2FsdGVkX1/T8otQ5kflNc/MTM327cgBXUWbGMzfVI+Oe2GD2H3eyszbahFuRe+VBHL77/1bVd4nej+2Cek1IuZDECWw42lFBHQas6owIK3fvEJdUnookXHdDN7RzzS49rAXMJIm8COUn/amhyGy2ps8Ia8zyGIQcXCdvTttcOqzslAIZBkOMALqZnI20cFKsAvSH9HurnB0uGU9vAlvldm8Tf/I9/n9s+9diFrC0/Z0bftdGCYJ5QKHAqvOXVhAU6ei9Xg1zK8Oi3quXmzn98ihU3Pu8yeRJXYmzE3JbEhfx2QmBAGv87dP+8fijgbatQioim6mlMi08bhm4RlMApPpw5qSJMeQ7C/URkh3B83nyzp2XNHdfpLwOZY58He9jz5d2fPsENdpLWPS84PEySny4wWub/2wrqfJhATYYN3MFFU8BW9cONIxvuCdqYeFuEGhU0J6Y8+eBbwQJTb7Nu9vGqq3ixUXNStV0ypEUfyhkfjLl3/SG9Y3n8/k+KPmmYe82XPpwI9Hqr05zdw+NSbjwzvmiLhEw+oAqrwk1e+MR82x8l9d7XHi3jhzNU3oVZC/JlFxKKKpjELgX2uCt6CtZEnA+BLbXrJJuSH9hV51AfiKHRAX562GrmmI6dy/MFszlXB2hlZ+nQvPUfHPwmIPBSc8z4TfENLV8zhUdy/2IXZuqCRS/QKlMCSRLOvjEFd8b/z1TWYzSQN/2a+EpACIM/EE+0h5kPXWkD10x7kqB8i7SoYDopBt67fRATonFxpyMAVhrPs4zHS+Y9C2WglGlZO769X3o/l+DJpL9GLGnso24cSBzVgQRojHDj1Uzfdu+lRup8lkfVYagK0kN3fHclU02NbvPdoqPH/b45h3AsDJ+CJmRC3JaDLqhwpHGepocZHJyH/dPH9gEl0DBn5eZcJcBN0tMv5x37qf58vifXCnuC9yGUnjObMihbBtDBJkDOZYhh2KfOtfdb/ vO15PANv 86OeMpR0TZKTQF/klEHqOa8rmsBp7p27RsI70aOCvYAhRz80fjIvq6NqALdVWTgPbFkSq74/IiA/vANZsftGqVAgAy2CXcA4PdsNBBaF0xXLSQZDYUeBVzUF+C0OODpAw84MBF+HjJeOWMQ21WxSIUIfEBrsiEkfhHcCbxQOd9NPwJVwZA5Pce60Hmen6SR90pxf7SkHl0oaYT6xlsHkQQaloDK20wjNdD40qJZlQ2Otv45UsLMST1DS9J5p0M9tCdrMfiqNUIoGHVsnQiaL37J+i3fFQVeUf1B9BSX4Hm17MaOs9kqLWPT/qXnqEWtFCvNzkGKWwnry+w6v5+3TNfugkdLgfMPDS3DxIOlj9A2Cc6wkWj4mVqEhX/l0bhe18du/M2nnaDwBgwc3qrRnWSTja1j5C4QOu/X7NX+5ukcZk8qTeviQXDJdXTwxIZdQtUIr1jp0Qu6XKu/dMRhEuGxJvO41nxp4Ptxk0yLKlqv1ivGw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Feb 05, 2025 at 04:10:15PM -0800, Dan Williams wrote: > Vivek Goyal wrote: > > On Fri, Jan 10, 2025 at 05:00:29PM +1100, Alistair Popple wrote: > > > FS DAX requires file systems to call into the DAX layout prior to unlinking > > > inodes to ensure there is no ongoing DMA or other remote access to the > > > direct mapped page. The fuse file system implements > > > fuse_dax_break_layouts() to do this which includes a comment indicating > > > that passing dmap_end == 0 leads to unmapping of the whole file. > > > > > > However this is not true - passing dmap_end == 0 will not unmap anything > > > before dmap_start, and further more dax_layout_busy_page_range() will not > > > scan any of the range to see if there maybe ongoing DMA access to the > > > range. Fix this by passing -1 for dmap_end to fuse_dax_break_layouts() > > > which will invalidate the entire file range to > > > dax_layout_busy_page_range(). > > > > Hi Alistair, > > > > Thanks for fixing DAX related issues for virtiofs. I am wondering how are > > you testing DAX with virtiofs. AFAIK, we don't have DAX support in Rust > > virtiofsd. C version of virtiofsd used to have out of the tree patches > > for DAX. But C version got deprecated long time ago. > > > > Do you have another implementation of virtiofsd somewhere else which > > supports DAX and allows for testing DAX related changes? > > I have personally never seen a virtiofs-dax test. It sounds like you are > saying we can deprecate that support if there are no longer any users. > Or, do you expect that C-virtiofsd is alive in the ecosystem? Ashai Lina responded that they need and test DAX using libkrun. C version of virtiofsd is now gone. We are actively working and testing Rust version of virtiofsd. We have not been able to add DAX support to it yet for various reasons. Biggest unsolved problem with viritofsd DAX mode is guest process should get a SIGBUS if it tries to access a file beyond the file. This can happen if file has been truncated on the host (while it is still mapped inside the guest). I had tried to summarize the problem in this presentation in the section "KVM Page fault error handling". https://kvm-forum.qemu.org/2020/KVMForum2020_APF.pdf This is a tricky problem to handle. Once this gets handled, it becomes safer to use DAX with virtiofs. Otherwise you can't share the filesystem with other guests in DAX mode and use cases are limited. And then there are challenges at QEMU level. virtiofsd needs additional vhost-user commands to implement DAX and these never went upstream in QEMU. I hope these challenges are sorted at some point of time. I think virtiofs DAX is a very cool piece of technology. I would not like to deprecate it. It has its own problems and challenges and once we are able to solve these, it might see wider usage/adoption. Thanks Vivek