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 F414CC54E60 for ; Tue, 19 Mar 2024 13:19:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FD526B0083; Tue, 19 Mar 2024 09:19:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B01D6B0085; Tue, 19 Mar 2024 09:19:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D9C66B0087; Tue, 19 Mar 2024 09:19:49 -0400 (EDT) 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 1B7346B0083 for ; Tue, 19 Mar 2024 09:19:49 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BA7D416093D for ; Tue, 19 Mar 2024 13:19:48 +0000 (UTC) X-FDA: 81913846056.12.171486E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 6DE804001B for ; Tue, 19 Mar 2024 13:19:46 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hkgYq+iA; spf=pass (imf01.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@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=1710854386; 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=pUA4jyYPpyLWZ5GdB21IaWHY0bnpxN+yp5QXHB7m1nw=; b=XwybpvpqAgR2p/S+fTyp9U54arfct+jDjh0BBpfIayZOYR3OoLaOfI9QabhlChhyc2qb62 M/D3RsGYzUBUArTLkwqC7ZdknfRDVNp9YHEFug++ZbpU3ZJ5mgtoR+7xOrW4UA7bgpDGMh tGeEo81fHPfVCGB0HGcwxWoEmdufxW0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710854386; a=rsa-sha256; cv=none; b=VsxhnY94R1CdE3kcreGsEL0CbGseTmgafDnc3Sr37zQIt0lV8NbjnqTKKBRGCqdWeUevw5 bEkEkQMqGwSQ1C3G+C2PQ9sywwVshB4S5NBmkztrUYt7mZVzcij4r9TW3CzBeOdB72xjNj j+Zq3s1YLnaxCzzYAo0253K7AZyOkRs= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hkgYq+iA; spf=pass (imf01.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@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=1710854385; 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=pUA4jyYPpyLWZ5GdB21IaWHY0bnpxN+yp5QXHB7m1nw=; b=hkgYq+iAQOfRjeFjPCDzRE/O2480CWuVQ/B32zxMAPDSEdSyCCy2RNAk6n8fJh8aZ1a1+U snrkiS0id3D7yfHrT8MuJSPfMQNiCrN9LgwiC4+2/PPFDGFTwAcMkm4YwQK3NLfAi5cmUz 7gEHlwSqHLzdThd5K2n+G2x9L9YiySA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-345-wECgXPvdOJi-SIaeyotYYw-1; Tue, 19 Mar 2024 09:19:42 -0400 X-MC-Unique: wECgXPvdOJi-SIaeyotYYw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40e53200380so26465415e9.3 for ; Tue, 19 Mar 2024 06:19:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710854381; x=1711459181; h=content-transfer-encoding:in-reply-to:organization:autocrypt :references:cc:to:from:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=pUA4jyYPpyLWZ5GdB21IaWHY0bnpxN+yp5QXHB7m1nw=; b=prsQPlZB125lQRK1pjen6/hQPLFelTk0WEziGbxLQxkmRHQkHlsNm99tVSs01uTeXu xFiyftxpKljfV79rgSmEZ4FuNsEkUZLVQQIUmOnN9nlH+bPTKaWhz7EoL3zP9SIayCiJ 1Om4lgJi9RDaVxIfjfjEBmx6cvhRW6WSISV3ABAYYpL5G9TWO1vmzIEvdNP3MYPQi7W3 Iii/SdVwGpv4EtvVXWeU3HNZ75gK8c+wUsjVYw+9JtyNB9pWSAdf8lsjBANvMc/ORl+1 KjyY/894TNS5BWrywbm5ZpdZ3BoI8zAFkWxPSvvz/6SP/kmIvCPpYctIFCF3Kp1aT+w0 ej8Q== X-Forwarded-Encrypted: i=1; AJvYcCVshQNe+yYPgnBBv2Q++kXhVasxg7MiXP0oQJCLIucokk+iXryuUlFBo5t1bxv8aV8b451TDf9EHrhK3EYzYQ+lZBI= X-Gm-Message-State: AOJu0Yz3Xa15p0Hmidb3oQPx7wc2oaFd8X36P17z+F7CbvQ46YPT8xfQ Fk4B4pbBeTVsSXT1BqxabWNYIY1X/QnFQ4NPaXvBMLQ8e+jFm0rnhrV9k1NmEzmZzbTU11Zpsgf Zl2vgyh1nY3OxC6xIJhcK1RbCXES+wTbeFZ8QrEwZacEn+dwM X-Received: by 2002:a05:600c:1d0e:b0:413:3941:d9ae with SMTP id l14-20020a05600c1d0e00b004133941d9aemr10729857wms.31.1710854381244; Tue, 19 Mar 2024 06:19:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQggSEygSN3zjaUeleSU2az0Hn2tbOnGs4AaLWZpa++FmT1PitVXiZZMyXBncQjc3UEteHOA== X-Received: by 2002:a05:600c:1d0e:b0:413:3941:d9ae with SMTP id l14-20020a05600c1d0e00b004133941d9aemr10729813wms.31.1710854380767; Tue, 19 Mar 2024 06:19:40 -0700 (PDT) Received: from ?IPV6:2003:cb:c741:2200:2adc:9a8d:ae91:2e9f? (p200300cbc74122002adc9a8dae912e9f.dip0.t-ipconnect.de. [2003:cb:c741:2200:2adc:9a8d:ae91:2e9f]) by smtp.gmail.com with ESMTPSA id fj14-20020a05600c0c8e00b00413385ec7e6sm21514330wmb.47.2024.03.19.06.19.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Mar 2024 06:19:40 -0700 (PDT) Message-ID: <0b1e1054-012f-4cc3-9d25-1147fa8cd6f0@redhat.com> Date: Tue, 19 Mar 2024 14:19:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: folio_mmapped From: David Hildenbrand To: Sean Christopherson , Vishal Annapurve Cc: Quentin Perret , Matthew Wilcox , Fuad Tabba , kvm@vger.kernel.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, 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, yu.c.zhang@linux.intel.com, isaku.yamahata@intel.com, mic@digikod.net, vbabka@suse.cz, 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_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, keirf@google.com, linux-mm@kvack.org References: <99a94a42-2781-4d48-8b8c-004e95db6bb5@redhat.com> <7470390a-5a97-475d-aaad-0f6dfb3d26ea@redhat.com> <40f82a61-39b0-4dda-ac32-a7b5da2a31e8@redhat.com> Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89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oE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <40f82a61-39b0-4dda-ac32-a7b5da2a31e8@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 6DE804001B X-Rspam-User: X-Stat-Signature: o7ftihe8dyd49qx5k94w7egyoy43yce1 X-Rspamd-Server: rspam03 X-HE-Tag: 1710854386-34475 X-HE-Meta: U2FsdGVkX19uHchWp/Sdl1iQqA5kQVb7tzmrn1yqaUem4gowvq66zotctsh7nRHJGxj8REqonNnOcF3T7dD1VlsPdF7PJ/zywqPTTt/MAGqH9bCIMGu/ilutgJJ4BVmwcZMhDhDeeORWlUfNU4YgxzQY81TWCqnbIrwvx7Ls/a9h8CbG3x1lX/0nZIGne44pd1+/+hsTWCklndqm5w9b1hnrabMW8Rj6NA1NheK6tiftChcaV3Yh0vSoTNzcjLKGoBXBknWczUPXv3g9UlgRFEMNqjx1uioMc4pUYsQ5Xf2n4au0zDVHC387m1LQaUbc/fOYZRNEbq+3yue79i3LzcaVe58mbrbzlhmulfSH1J7PKEpSu1cXNeAk55StW+6YavPGTZpUjE07d13CyVpLs1NQl+QHTSpDf9xXSgfgxJmIlRh5txQwDCW9UbfHXOYnizpXlSWLBWpb2xg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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: >>> I had started a discussion for this [2] using an RFC series. >> >> David is talking about the host side of things, AFAICT you're talking about the >> guest side... >> >>> challenge here remain: >>> 1) Unifying all the conversions under one layer >>> 2) Ensuring shared memory allocations are huge page aligned at boot >>> time and runtime. >>> >>> Using any kind of unified shared memory allocator (today this part is >>> played by SWIOTLB) will need to support huge page aligned dynamic >>> increments, which can be only guaranteed by carving out enough memory >>> at boot time for CMA area and using CMA area for allocation at >>> runtime. >>> - Since it's hard to come up with a maximum amount of shared memory >>> needed by VM, especially with GPUs/TPUs around, it's difficult to come >>> up with CMA area size at boot time. >> >> ...which is very relevant as carving out memory in the guest is nigh impossible, >> but carving out memory in the host for systems whose sole purpose is to run VMs >> is very doable. >> >>> I think it's arguable that even if a VM converts 10 % of its memory to >>> shared using 4k granularity, we still have fewer page table walks on >>> the rest of the memory when using 1G/2M pages, which is a significant >>> portion. >> >> Performance is a secondary concern. If this were _just_ about guest performance, >> I would unequivocally side with David: the guest gets to keep the pieces if it >> fragments a 1GiB page. >> >> The main problem we're trying to solve is that we want to provision a host such >> that the host can serve 1GiB pages for non-CoCo VMs, and can also simultaneously >> run CoCo VMs, with 100% fungibility. I.e. a host could run 100% non-CoCo VMs, >> 100% CoCo VMs, or more likely, some sliding mix of the two. Ideally, CoCo VMs >> would also get the benefits of 1GiB mappings, that's not the driving motiviation >> for this discussion. > > Supporting 1 GiB mappings there sounds like unnecessary complexity and > opening a big can of worms, especially if "it's not the driving motivation". > > If I understand you correctly, the scenario is > > (1) We have free 1 GiB hugetlb pages lying around > (2) We want to start a CoCo VM > (3) We don't care about 1 GiB mappings for that CoCo VM, but hguetlb > pages is all we have. > (4) We want to be able to use the 1 GiB hugetlb page in the future. > > With hugetlb, it's possible to reserve a CMA area from which to later > allocate 1 GiB pages. While not allocated, they can be used for movable > allocations. > > So in the scenario above, free the hugetlb pages back to CMA. Then, > consume them as 4K pages for the CoCo VM. When wanting to start a > non-CoCo VM, re-allocate them from CMA. > > One catch with that is that > (a) CMA pages cannot get longterm-pinned: for obvious reasons, we > wouldn't be able to migrate them in order to free up the 1 GiB page. > (b) guest_memfd pages are not movable and cannot currently end up on CMA > memory. > > But maybe that's not actually required in this scenario and we'd like to > have slightly different semantics: if you were to give the CoCo VM the 1 > GiB pages, they would similarly be unusable until that VM quit and freed > up the memory! > > So it might be acceptable to get "selected" unmovable allocations (from > guest_memfd) on selected (hugetlb) CMA area, that the "owner" will free > up when wanting to re-allocate that memory. Otherwise, the CMA > allocation will simply fail. > > If we need improvements in that area to support this case, we can talk. > Just an idea to avoid HGM and friends just to make it somehow work with > 1 GiB pages ... Thought about that some more and some cases can also be tricky (avoiding fragmenting multiple 1 GiB pages ...). It's all tricky, especially once multiple (guest_)memfds are involved and we really want to avoid most waste. Knowing that large mappings for CoCo are rather "optional" and that the challenge is in "reusing" large pages is valuable, though. -- Cheers, David / dhildenb