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 7FD43C71157 for ; Wed, 18 Jun 2025 08:16:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07B9A6B008A; Wed, 18 Jun 2025 04:16:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 02CCE6B008C; Wed, 18 Jun 2025 04:16:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E35DD6B0092; Wed, 18 Jun 2025 04:16:06 -0400 (EDT) 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 CDA066B008A for ; Wed, 18 Jun 2025 04:16:06 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3C62014062C for ; Wed, 18 Jun 2025 08:16:06 +0000 (UTC) X-FDA: 83567813532.24.ECBFF0C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 90250140007 for ; Wed, 18 Jun 2025 08:16:03 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AHtML5jd; spf=pass (imf09.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750234563; a=rsa-sha256; cv=none; b=q4bcsIqwV25YPJo7FPe2sUbg1LJ96U64vxHVVouwJ1UqtXFWM3hZzLqNTa4a6CXjPJLkov Jhta7kZY7QNqkhnoGq9JDBA3gpNSG9HPWaN13B3MwHECi1xgzopAdDDG2W/INkZcb1Mgp5 Uwm49oH5DsQKaix8nbdb6hVMfocYpic= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AHtML5jd; spf=pass (imf09.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750234563; 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=bOZoNJaujjdVlfR2AIdKYM54IJ4MIY01a/D0TQW0tiA=; b=vyIuYoSQD4LXxkQ632l1OAHYw56AE8dDDPI99EN8V9ukj/i4lsOe/rrzmGuQlWyjIlV+ud 9ulztVWcMcARSiicIL5YKVV6vZYdKMnFInInlFDsndIlL6S7IaF93KuhGLHLqoMLLpSFVq vSZWlCT5OXvAB2su4356De+HRMrdYl4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750234562; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=bOZoNJaujjdVlfR2AIdKYM54IJ4MIY01a/D0TQW0tiA=; b=AHtML5jdQ3wc0cqHl4OzNZspyIqExLVs+1QbJNCCY6DtiEd7rNk0HNuTqEKj3xdzCuiMaG 065KNGpcaSvwVWwB3B3W2YgGPhG0hYRzLCWcQRetOkNiTGLQ9adDIaWBXWWynvWGN3m3BZ Q1+aBw7Hxa+2V5x1QjkmJVpCCspgHWg= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-434-3qBBx-vQNR-3pOgyZSsJIg-1; Wed, 18 Jun 2025 04:16:01 -0400 X-MC-Unique: 3qBBx-vQNR-3pOgyZSsJIg-1 X-Mimecast-MFC-AGG-ID: 3qBBx-vQNR-3pOgyZSsJIg_1750234560 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3a4f8192e2cso3217906f8f.3 for ; Wed, 18 Jun 2025 01:16:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750234560; x=1750839360; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=bOZoNJaujjdVlfR2AIdKYM54IJ4MIY01a/D0TQW0tiA=; b=FH0n8l0VUMFGjNTvzwPotUDxvw9m05Kvfuopl6ODuPpJtDAxIt6G/FJOu5azn6qMRq NqQednPb45OKSrTQsjJKSL2C7tD/of3GvcpDQGZfZq17Nh8w1sEKtoK+jm+5m6Urec9R sI57sH4jSoM2dfZkrf9IfU2oI2J/ZgXEASWbeddppMEWdue2nuxyz5U28UC2w09KE+Xv pv1sZ+El3AY9M1A9Ogx3yYwY6Ilfmq3A2eSZJA5a3SEya6ratH/V7c0LmrtitydZrcPF lAZ+Y0pjQdWRvo3tKVUo0+Z3nPU1ALH9wzaQnyzFs5AGZcawjys94RRHqiwtNipSM8Qh FwlA== X-Forwarded-Encrypted: i=1; AJvYcCWQ6seWbEuXBARh0Ce0SVNTFq1LyEMJyorkEAGhSWS5iXs4NexerajeOMFOlDEwH04QRVQCfGlM/Q==@kvack.org X-Gm-Message-State: AOJu0Yx4aGmUzYE4ilFjSNMxRZXDhUOdvsrHjlrt5woyexzIowDp/08d hcnjXOON+t15uaw6QcHhdPXx1bUWEZwlHdu6p4cvVPFdIkTNMWnbOZBOQnSrBUekKeuOUiewcs2 EK/ziXbaV28gdk5UqUpcOUFv9XIiwVKP72KGAzMie5z8q4oViQF+e X-Gm-Gg: ASbGnctGFbU/j6xnVt9REhf2Y9rRcIt2PmKnmB/iI2FcJAsMlH5ZSthKYpbxzssNRwf +0P14qmExAfh+aQ0LxJfYa4kTZOwRwBrd5oO5tioWD0qqUVnTqEawCyBmYr9xM/OySwGNHWzDOe 5/0yixrMm/KubH6MEB1f86Un6j9Xn8aOfccQ+0ZOnPcrlvg2SwXqIh0qFORr8nwLTsgrwPouMk5 CQ4onFRlBLoj82xXgVnqKbXoXoh+yGJnLhh3WhhereQW+UXOl8YkagHKB/17Wxwmj/eH8qDBTDA YltIv5ajTbWLP/SjDCn0QOyfxvT7ZkmWOJ37cxXJyEUSr4mcKwqCyJopE9xyPhKz1gW/zU4yqYq rQy1NraeCD79Yo0oaxGjXfBuXxpyqiQNEocEEzMenAjDiUPA= X-Received: by 2002:a05:6000:4702:b0:3a4:f7e3:c63c with SMTP id ffacd0b85a97d-3a571894b7bmr15128802f8f.0.1750234559799; Wed, 18 Jun 2025 01:15:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGULgOxtyBoShvE9JSoEwQhPgXEf5lkCjWUOo2bSd3nW0M1xu6HvPbfcWE5OJ17ZOLdT+0Hgw== X-Received: by 2002:a05:6000:4702:b0:3a4:f7e3:c63c with SMTP id ffacd0b85a97d-3a571894b7bmr15128720f8f.0.1750234559159; Wed, 18 Jun 2025 01:15:59 -0700 (PDT) Received: from ?IPV6:2003:d8:2f2d:2400:4052:3b5:fff9:4ed0? (p200300d82f2d2400405203b5fff94ed0.dip0.t-ipconnect.de. [2003:d8:2f2d:2400:4052:3b5:fff9:4ed0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a568a547d2sm16556533f8f.19.2025.06.18.01.15.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Jun 2025 01:15:58 -0700 (PDT) Message-ID: <3fb0e82b-f4ef-402d-a33c-0b12e8aa990c@redhat.com> Date: Wed, 18 Jun 2025 10:15:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v12 08/18] KVM: guest_memfd: Allow host to map guest_memfd pages To: Sean Christopherson Cc: Fuad Tabba , Ira Weiny , kvm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mm@kvack.org, kvmarm@lists.linux.dev, pbonzini@redhat.com, chenhuacai@kernel.org, mpe@ellerman.id.au, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, viro@zeniv.linux.org.uk, brauner@kernel.org, willy@infradead.org, akpm@linux-foundation.org, xiaoyao.li@intel.com, yilun.xu@intel.com, chao.p.peng@linux.intel.com, jarkko@kernel.org, amoorthy@google.com, dmatlack@google.com, isaku.yamahata@intel.com, mic@digikod.net, vbabka@suse.cz, vannapurve@google.com, ackerleytng@google.com, mail@maciej.szmigiero.name, michael.roth@amd.com, wei.w.wang@intel.com, liam.merwick@oracle.com, isaku.yamahata@gmail.com, kirill.shutemov@linux.intel.com, suzuki.poulose@arm.com, steven.price@arm.com, quic_eberman@quicinc.com, quic_mnalajal@quicinc.com, quic_tsoni@quicinc.com, quic_svaddagi@quicinc.com, quic_cvanscha@quicinc.com, quic_pderrin@quicinc.com, quic_pheragu@quicinc.com, catalin.marinas@arm.com, james.morse@arm.com, yuzenghui@huawei.com, oliver.upton@linux.dev, maz@kernel.org, will@kernel.org, qperret@google.com, keirf@google.com, roypat@amazon.co.uk, shuah@kernel.org, hch@infradead.org, jgg@nvidia.com, rientjes@google.com, jhubbard@nvidia.com, fvdl@google.com, hughd@google.com, jthoughton@google.com, peterx@redhat.com, pankaj.gupta@amd.com References: <20250611133330.1514028-1-tabba@google.com> <20250611133330.1514028-9-tabba@google.com> <68501fa5dce32_2376af294d1@iweiny-mob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YmPZNdCNjdTDPr_2d714Ejbgk_1750234560 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 90250140007 X-Stat-Signature: g7q45m6yugihymjysidq5y7bsmqa1p4y X-Rspam-User: X-HE-Tag: 1750234563-693592 X-HE-Meta: U2FsdGVkX19u2D62yfkFpgZR+Bf6x+Aj9Ia3sJghm/886zUgmjHK6tBVqZXbP0qsffeyRSJmC1TUPfZIxz4G9QXDzBfWwmutdzfjrwgV7UdsMlMnS8cNp0GWNnp9zJgbt/jWxCY0cdAG78nr3PS0sQJe9mQha3OSOtNtzWNF57vEq+VLDgZ8ZVUoL3CBHkM6c3DYk8ZOd8PuWrURWB88SOMhrfF/Amh4JiSKFcQoqRbLYXzhfYsX3Ztt5Zrybr7/CZKN65LMpCajQ7p8xTl1hyUClDwCaAoH/AlMPDQlafSS8OiZCiphaa9iMEG6T6AabcNlK5Mppri9unKTwsaEMid92J2Rche8U7tUXI7ICzv/xR93NRH34YvvU7tfsofaGyy0K1d7lur5nbhpN80kA+joqYqQYyUJhpkXyZWIcevykpZihY0HRaEu5zITfMe2ZcTgeh5z+fl7WlMp94oheGjT3ltSQax/LS824A5oGvVnH5Rh74E9bO2p7dgMG2sfkbJI8/9y8PD52211QFcWrJoyYh4N+LhHVEM7zJrT1W2K1h0CX/vsb3fiuDtH4+5JAl6Dp7uEev1NHoxTTrwwBZDlZgl41P8FvX3/m4hDo23pW+c7F5zKqJ4GWLwRltkTdV+doPoduRqEI1HI9LJMsK7Ywh9sAwc+V3mdNoAkovIdG9ssa460D0BBPGsMul0ImL0C2iKQVG/bxuO3CGbE6WsjJceVMgdIQ94GkPD6CPDRxJE7k+mmhcuE6bugp6fEnCk04DL2xJ8DLDdvlLQUif+W25K0L8dTa7i3bRGPIprmhlGSPdN1MRzeeB/Sh8ENxBE2n5JqoLVI+0f9mdyCBHsICsHIcjBB5Msl5HXZ2Jo0bvJ9im/8qbx5NtFFoYzpfd/8b+qH03Wo8+ta0OfYwgI2fPxj4CScZHqCSwjKKgKU8SBv/c/dW+/PaYiKBD99/7x8GsCfwfrT5ClnW17 F0cVk3Pc cQYfd53HrTUbZQ3pvKiyTBpLr8dIra38GwxQGBcZvDNeM3WDZQXF9bg9QaZ8NswyAMZSyTzrk6c9SBOnpOIc5daTM2JoxHEml/GI1HdW+J7kRvr51tVHhltXc5Ng6tjmoFpWmczqUV9BOZFqlLFXiOxZmVcPvAv+eiOarz18hw4+95w71TDQdkoL3InZnn5q84UzK4iTQCKdDj9m7ScottQqgTESwM50aTG8Sqsai0WEXImBMP6icUYhqyHKITjsR/6kbsmbFYzTznANwKQcfrLtPF0IgPIPRML75eFunbBGSzzvRwaSb2/wuJCw+f+4V2IHxGa6zI4ZQ+OTBiYbeYPk3HaPXsyuA8Jmd/PxxG988ro0KwWMenI0zQSRtzGIm4ymFMJ6SJtU279k+R6h1Qwgg8OXQsVT6gcq0+jx02YvQTysY5uhmZPEREwpsJLh1XyUb2GoezAvyr42ulUOEB38B62eHres0bqwzJlhFKKXawUxe/c6NZprXKvXhzMj2+6jPTIGPDZvkm51DYui8gQFbXrm1/0GFGWqFpewRs13JSSyb2VfZdtHgPdK+APfTr0tfDZuXQsLVofYpwTuGdIM38I1ev/b4cpn3BnQa8vpNJTM= 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 18.06.25 02:40, Sean Christopherson wrote: > On Mon, Jun 16, 2025, David Hildenbrand wrote: >> On 16.06.25 16:16, Fuad Tabba wrote: >>> On Mon, 16 Jun 2025 at 15:03, David Hildenbrand wrote: >>>>>> IMO, GUEST_MEMFD_FLAG_SHAREABLE would be more appropriate. But even that is >>>>>> weird to me. For non-CoCo VMs, there is no concept of shared vs. private. What's >>>>>> novel and notable is that the memory is _mappable_. Yeah, yeah, pKVM's use case >>>>>> is to share memory, but that's a _use case_, not the property of guest_memfd that >>>>>> is being controlled by userspace. >>>>>> >>>>>> And kvm_gmem_memslot_supports_shared() is even worse. It's simply that the >>>>>> memslot is bound to a mappable guest_memfd instance, it's that the guest_memfd >>>>>> instance is the _only_ entry point to the memslot. >>>>>> >>>>>> So my vote would be "GUEST_MEMFD_FLAG_MAPPABLE", and then something like >>>>> >>>>> If we are going to change this; FLAG_MAPPABLE is not clear to me either. >>>>> The guest can map private memory, right? I see your point about shared >>>>> being overloaded with file shared but it would not be the first time a >>>>> term is overloaded. kvm_slot_has_gmem() does makes a lot of sense. >>>>> >>>>> If it is going to change; how about GUEST_MEMFD_FLAG_USER_MAPPABLE? >>>> >>>> If "shared" is not good enough terminology ... >>>> >>>> ... can we please just find a way to name what this "non-private" memory >>>> is called? > > guest_memfd? Not trying to be cheeky, I genuinely don't understand the need > to come up with a different name. Before CoCo came along, I can't think of a > single time where we felt the need to describe guest memory. There have been > *many* instances of referring to the underlying backing store (e.g. HugeTLB vs. > THP), and many instances where we've needed to talk about the types of mappings > for guest memory, but I can't think of any cases where describing the state of > guest memory itself was ever necessary or even useful. > >>>> That something is mappable into $whatever is not the right >>>> way to look at this IMHO. > > Why not? Honest question. USER_MAPPABLE is very literal, but I think it's the > right granularity. E.g. we _could_ support read()/write()/etc, but it's not > clear to me that we need/want to. And so why bundle those under SHARED, or any > other one-size-fits-all flag? Let's take a step back. There are various ways to look at this: 1) Indicate support for guest_memfd operations: "GUEST_MEMFD_FLAG_MMAP": we support the mmap() operation "GUEST_MEMFD_FLAG_WRITE": we support the write() operation "GUEST_MEMFD_FLAG_READ": we support the read() operation ... "GUEST_MEMFD_FLAG_UFFD": we support userfaultfd operations Absolutely fine with me. In this series, we'd be advertising GUEST_MEMFD_FLAG_MMAP. Because we support the mmap operation. If the others are ever required remains to be seen [1]. 2) Indicating the mmap mapping type (support for MMAP flags) As you write below, one could indicate that we support "mmap(MAP_SHARED)" vs "mmap(MAP_PRIVATE)". I don't think that's required for now, as MAP_SHARED is really the default that anything that supports mmap() supports. If someone ever needs MAP_PRIVATE (CoW) support they can add such a flag (GUEST_MEMFD_FLAG_MMAP_MAP_PRIVATE). I doubt we want that, but who knows. As expressed elsewhere, the mmap mapping type was never what the "SHARED" in KVM_GMEM_SHARED_MEM implied. 3) *guest-memfd specific* memory access characteristics "private (non-accessible, private, secure, protected, ...) vs. "non-private". Traditionally, all was memory in guest-memfd was private, now we will make guest_memfd also support non-private memory. As this memory is "inaccessible" from a host point of view, any access to read/write it (fault it into user page tables, read(), write(), etc) will fail. Mempolicy support wanted to support mmap() without that, though [2], which was one of the reasons I agreed that exposing the access characteristics (that affect what you can actually mmap() ) made sense. In the last upstream meeting we agreed that we will not do that, but rather built up on MMAP+support for non-private memory support. [1] https://lore.kernel.org/kvm/20250303130838.28812-1-kalyazin@amazon.com/T/ [2] https://lore.kernel.org/linux-mm/20250408112402.181574-1-shivankg@amd.com/ [...] >>>> I'll further note that in the doc of KVM_SET_USER_MEMORY_REGION2 we talk >>>> about "private" vs "shared" memory ... so that would have to be improved >>>> as well. >>> >>> To add to what David just wrote, V1 of this series used the term >>> "mappable" [1]. After a few discussions, I thought the consensus was >>> that "shared" was a more accurate description --- i.e., mappability >>> was a side effect of it being shared with the host. > > As I mentioned in the other thread with respect to sharing between other > entities, simply SHARED doesn't provide sufficient granularity. HOST_SHAREABLE > gets us closer, but I still don't like that because it implies the memory is > 100% shareable, e.g. can be accessed just like normal memory. > > And for non-CoCo x86 VMs, sharing with host userspace isn't even necessarily the > goal, i.e. "sharing" is a side effect of needing to allow mmap() so that KVM can > continue to function. Does mmap() support imply "support for non-private" memory or does "support for non-private" imply mmap() support? :) In this series we went for the latter. If I got you correctly, you argue for the former. Maybe both things should simply be separated. > >>> One could argue that non-CoCo VMs have no concept of "shared" vs >>> "private". > > I am that one :-) Well, if the concept of "private" does not exist, I'd argue everything is "non-private" :) > >> A different way of looking at it is, non-CoCo VMs have >>> their state as shared by default. > > Eh, there has to be another state for there to be a default. > >> All memory of these VMs behaves similar to other memory-based shared memory >> backends (memfd, shmem) in the system, yes. You can map it into multiple >> processes and use it like shmem/memfd. > > Ya, but that's more because guest_memfd only supports MAP_SHARED, versus KVM > really wanting to truly share the memory with the entire system. > > Of course, that's also an argument to some extent against USER_MAPPABLE, because > that name assumes we'll never want to support MAP_PRIVATE. But letting userspace > MAP_PRIVATE guest_memfd would completely defeat the purpose of guest_memfd, so > unless I'm forgetting a wrinkle with MAP_PRIVATE vs. MAP_SHARED, that's an > assumption I'm a-ok making. So, first important question, are we okay with adding: "GUEST_MEMFD_FLAG_MMAP": we support the mmap() operation > > If we are really dead set on having SHARED in the name, it could be > GUEST_MEMFD_FLAG_USER_MAPPABLE_SHARED or GUEST_MEMFD_FLAG_USER_MAP_SHARED? But > to me that's _too_ specific and again somewhat confusing given the unfortunate > private vs. shared usage in CoCo-land. And just playing the odds, I'm fine taking > a risk of ending up with GUEST_MEMFD_FLAG_USER_MAPPABLE_PRIVATE or whatever, > because I think that is comically unlikely to happen. I think in addition to GUEST_MEMFD_FLAG_MMAP we want something to express "this is not your old guest_memfd that only supports private memory". And that's what I am struggling with. Now, if you argue "support for mmap() implies support for non-private memory", I'm probably okay for that. I could envision support for non-private memory even without mmap() support, how useful that might be, I don't know. But that's why I was arguing that we mmap() is just one way to consume non-private memory. -- Cheers, David / dhildenb