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 29241C433EF for ; Tue, 23 Nov 2021 14:35:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FE4E6B006C; Tue, 23 Nov 2021 09:35:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4AD0C6B0071; Tue, 23 Nov 2021 09:35:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34E0C6B0073; Tue, 23 Nov 2021 09:35:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 250206B006C for ; Tue, 23 Nov 2021 09:35:00 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DB27B183DEA81 for ; Tue, 23 Nov 2021 14:34:49 +0000 (UTC) X-FDA: 78840441498.13.75BEDFD Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf29.hostedemail.com (Postfix) with ESMTP id 7A7079000277 for ; Tue, 23 Nov 2021 14:34:46 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10176"; a="235268036" X-IronPort-AV: E=Sophos;i="5.87,258,1631602800"; d="scan'208";a="235268036" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2021 06:34:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,257,1631602800"; d="scan'208";a="509430316" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.192.101]) by orsmga008.jf.intel.com with ESMTP; 23 Nov 2021 06:34:39 -0800 Date: Tue, 23 Nov 2021 22:33:53 +0800 From: Chao Peng To: Paolo Bonzini Cc: David Hildenbrand , Jason Gunthorpe , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, qemu-devel@nongnu.org, Jonathan Corbet , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Yu Zhang , "Kirill A . Shutemov" , luto@kernel.org, john.ji@intel.com, susie.li@intel.com, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com Subject: Re: [RFC v2 PATCH 01/13] mm/shmem: Introduce F_SEAL_GUEST Message-ID: <20211123143353.GD32088@chaop.bj.intel.com> Reply-To: Chao Peng References: <20211119134739.20218-1-chao.p.peng@linux.intel.com> <20211119134739.20218-2-chao.p.peng@linux.intel.com> <20211119151943.GH876299@ziepe.ca> <6de78894-8269-ea3a-b4ee-a5cc4dad827e@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6de78894-8269-ea3a-b4ee-a5cc4dad827e@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 7A7079000277 X-Stat-Signature: xxaatt7e9qymker44sqy87zsmxue4159 Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf29.hostedemail.com: domain of chao.p.peng@linux.intel.com has no SPF policy when checking 192.55.52.115) smtp.mailfrom=chao.p.peng@linux.intel.com X-Rspamd-Server: rspam02 X-HE-Tag: 1637678086-214748 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: On Tue, Nov 23, 2021 at 10:06:02AM +0100, Paolo Bonzini wrote: > On 11/19/21 16:39, David Hildenbrand wrote: > > > If qmeu can put all the guest memory in a memfd and not map it, then > > > I'd also like to see that the IOMMU can use this interface too so we > > > can have VFIO working in this configuration. > > > > In QEMU we usually want to (and must) be able to access guest memory > > from user space, with the current design we wouldn't even be able to > > temporarily mmap it -- which makes sense for encrypted memory only. The > > corner case really is encrypted memory. So I don't think we'll see a > > broad use of this feature outside of encrypted VMs in QEMU. I might be > > wrong, most probably I am:) > > It's not _that_ crazy an idea, but it's going to be some work to teach KVM > that it has to kmap/kunmap around all memory accesses. > > I think it's great that memfd hooks are usable by more than one subsystem, > OTOH it's fair that whoever needs it does the work---and VFIO does not need > it for confidential VMs, yet, so it should be fine for now to have a single > user. > > On the other hand, as I commented already, the lack of locking in the > register/unregister functions has to be fixed even with a single user. > Another thing we can do already is change the guest_ops/guest_mem_ops to > something like memfd_falloc_notifier_ops/memfd_pfn_ops, and the > register/unregister functions to memfd_register/unregister_falloc_notifier. I'm satisified with this naming ;) > > Chao, can you also put this under a new CONFIG such as "bool MEMFD_OPS", and > select it from KVM? Yes, reasonable. > > Thanks, > > Paolo