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 BF28BC02194 for ; Thu, 6 Feb 2025 19:57:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1CD726B0092; Thu, 6 Feb 2025 14:57:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 17B306B0093; Thu, 6 Feb 2025 14:57:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01C02280002; Thu, 6 Feb 2025 14:57:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D2B676B0092 for ; Thu, 6 Feb 2025 14:57:34 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E423C121550 for ; Thu, 6 Feb 2025 19:57:22 +0000 (UTC) X-FDA: 83090579166.17.827326D Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by imf15.hostedemail.com (Postfix) with ESMTP id DFC86A0009 for ; Thu, 6 Feb 2025 19:57:20 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=asahilina.net header.s=default header.b=NCRCOX62; spf=pass (imf15.hostedemail.com: domain of lina@asahilina.net designates 212.63.210.85 as permitted sender) smtp.mailfrom=lina@asahilina.net; dmarc=pass (policy=quarantine) header.from=asahilina.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738871841; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Oq2MSbg8uowd0cp7hGubDTrXjjRg2sj0R+N70jk1ffs=; b=1ZUTjSkq7Z2ue4w68ZqDAfwWf38FkQPtwrXkqkau0sORBdBqPZaZJsAMPxUD9NRgK+zFcY SQ5SCTgL4s+fCSHnI6asoT8ONq2f/Ez4qh8gcozwyPyXWv4fsgVQrOclXPUUS9Q44qlkvU MV8XIVekGxfJL2zAB+hAciopvmaFWf4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=asahilina.net header.s=default header.b=NCRCOX62; spf=pass (imf15.hostedemail.com: domain of lina@asahilina.net designates 212.63.210.85 as permitted sender) smtp.mailfrom=lina@asahilina.net; dmarc=pass (policy=quarantine) header.from=asahilina.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738871841; a=rsa-sha256; cv=none; b=jk1cYoZQbZ81L1YpqLMB3WMMC+CzHwZ5Xy3rtRj1iyqlt9NBsq6BFNJgptAHqrTDHlQkQD lMHYqs/re5udKtPs7smpI9GoDypLip9Zt9IsBvOAlJNStoWxDS+ezUBuQw7NW93ZeDZd6A r4kWEpt6ntew9GMlqvDEEQaizWbB3uc= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: lina@asahilina.net) by mail.marcansoft.com (Postfix) with ESMTPSA id BEC3E43A93; Thu, 6 Feb 2025 19:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=asahilina.net; s=default; t=1738871838; bh=E+lU6r2Gicb6SJrSYXFHxoENYWrJPQXqghLrsfBIZ0E=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=NCRCOX62cpd8AaeYgG4rxET2H1BdW5ASoApszzfwGbbwxcAi8JWEtWH7VKPS0yNrU KFiGoOBJTGUiBY398SaWyKoOkkxLQKgcKB++A5vdRnKurYaFamwfuqDeD4Li0V7/BD ZFbnXCZIVstHri09WyTDk3rsvei3iqp3Wv88gFpTjboT5hk1QReVygK8DNbS1rAE5e ZVYOfzgP+exVnyyAMksacexFZh5ai5B5OIZuRLE+1hNKKzMmVYnbjvHmFUsKLTJapX sqeFezTN1APVg2wUKlFuAfP0pLwgdEGNsgDxRLidt+apRNe3K3Tef2DzbQ48tGi6XJ h0XYECuYgyX9w== Message-ID: <2f4728be-3a0d-4bc3-ab11-6b1e2e3fbc6e@asahilina.net> Date: Fri, 7 Feb 2025 04:57:13 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 01/26] fuse: Fix dax truncate/punch_hole fault path To: Dan Williams , Vivek Goyal , Alistair Popple , Sergio Lopez Pascual Cc: akpm@linux-foundation.org, linux-mm@kvack.org, alison.schofield@intel.com, 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 References: <67a3fde7da328_2d2c2942b@dwillia2-xfh.jf.intel.com.notmuch> <67a5111b2f805_2d2c29448@dwillia2-xfh.jf.intel.com.notmuch> Content-Language: en-US From: Asahi Lina In-Reply-To: <67a5111b2f805_2d2c29448@dwillia2-xfh.jf.intel.com.notmuch> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DFC86A0009 X-Stat-Signature: zci9p7xrb3in8j64mrj7pupgzx5wieif X-HE-Tag: 1738871840-382468 X-HE-Meta: U2FsdGVkX1+8mN40zvKanXHlMs9wShIXYqTDcst9v021a6N3oE17uinZy7PvCgVrTRhn389BjuYt3VArkbAFhv3pnlDzoZz7qM4UJMq+MkNXicmgRvevsuHsZf8S+BB93KPsDq0YRTtnlmtWW2uzEb9bfGTt+k7ab0E7P2BGwh3FFvst82MR6pr7J+S1F+mznzEUNa7prBpKkR4cZQBceBmE+QFaYGFClgSoVVJyNobitJfOtJm4to9AZmOxrnhgoim8FfGWUgFOtCU8wYuuoMW+PrCaxflKPRdlw5AThyIlFDBgOkJsJZ9BmUWzHgEhNYClgp5NwDKQ9rqaWLv/mKvi3Ymnm9787tGNQlHcx9L/vNfEknztePfH/2NKqWfm/ojTenBJ8F0CUbeTMY+mXYKwUXhRg721wfnzRcC87+UbgpZhiaYr5UxTMANEvd8cRnaO2YUW8iqrUibKFykdMFJ94aMjwKQuaeRFY72rm0onD94l6prV5OMUxRsxcTS6iaKjtckZOGKl59MG/CS0aCdExauo358tJeTV93c+0c30y2U6hzzSeoz5ZNuHe6xhngaWr2M7iTtOf6Ty6GgW42Frb/qm6p/FERw59g6zxk/23FUxqTGTs/I1DiTD/f5vLOxSHHWsKVDgwJzKAkyHCdSJGIgLVkAQ7pWwyddqBGQnR1FuanqyC/zzm8Lv0BKDjrnzAo9rKDNmSG5pj5CCcwUItcr8cGq7Rq7ni15NXv5TH+sUcWhbJl00UvOEhMI9X/3ONjoGZ/6kI5IYyTFkHtm/dExQGGK/YU8xUVIarTwv5s1KdXVutaxy4DwTYhfgSZSAa8SAu+cFqAfzZ0x9PqLvfScaMHTduEEZ3IwKdy+E9XUWLjQxQU3fdPntfE3q8jdIFria0NKjh5A1Gvqk62l6dVkyhEO3U71M3E22Ln4RUwlfahF0gri6XC2IZYAr1LophrnDoX8uiJRhekO F+bzHJZX FvAZdqIjYfvxn/8LnwevkthesQuAC2WMuXiD/i1F7ghQSz+NFYeSmnScrcnmWGDoe49OlbQCqXxc5LUpx4iganxAAdHmriJiCEhhkuRj41SESPXq6cpEl/Xc2CpBz43nrJt26OKk8vnjmw90nxtKoDbUpvtDvtmjcWRRkBmEYRKKpWmywi5vf5/xUdiI/WUP4h0BKlRNNfuKSoAXVI7UEDgUSW/9OKU8LF59TmvkPCh7Go622yj1+GsCOgvj813yz2vk+wTe2KfTAAauUVW4nWJNpvXWoIdOf35QHg+WqYCpXyLxlH8rtslAS77ZeNVPd/stjSlQoerThyKsoJDhJfDiydWrNzExIYDaXf4utEBA/tnifpeusvKI8QhzhMSCOOwvu8RmbQS/Pd8kDDJneAs+IPwZBVXooqAQMaVPonajzcnTd1yY07jSqRYF8fItmpFjJQsvYoJ8gDjdqVlY28HQ+qpsHtsg5J/qgQCWFQwqP9V8= 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 2/7/25 4:44 AM, Dan Williams wrote: > Asahi Lina wrote: >> Hi, >> >> On February 6, 2025 1:10:15 AM GMT+01:00, 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? >> >> I accidentally replied offlist, but I wanted to mention that libkrun >> supports DAX and we use it in muvm. It's a critical part of x11bridge >> functionality, since it uses DAX to share X11 shm fences between X11 >> clients in the VM and the XWayland server on the host, which only >> works if the mmaps are coherent. > > Ah, good to hear. It would be lovely to integrate an muvm smoketest > somewhere in https://github.com/pmem/ndctl/tree/main/test so that we > have early warning on potential breakage. I think you'll probably want a smoke test using libkrun directly, since muvm is quite application-specific. It's really easy to write a quick C file to call into libkrun and spin up a VM. If it's supposed to test an arbitrary kernel though, I'm not sure what the test setup would look like. You'd need to run it on a host (whose kernel is mostly irrelevant) and then use libkrun to spin up a VM with a guest, which then runs the test. libkrun normally uses a bundled kernel though (shipped as libkrunfw), we'd need to add an API to specify an external kernel binary I guess? I'm happy to help with that, but I'll need to know a bit more about the intended usage first. I *think* most of the scaffolding for running arbitrary kernels is already planned, since there was some talk of running the host kernel as the guest kernel, so this wouldn't add much work on top of that. I definitely have a few tests in mind if we do put this together, since I know of one or two things that are definitely broken in DAX upstream right now (which I *think* this series fixes but I never got around to testing it...). Cc: slp for libkrun. ~~ Lina