Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9043350rwd; Wed, 21 Jun 2023 02:08:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4y+0y2Tv9ztSRxAUM+NAqsr6JJE9RHv2vr3UQ4QWADVMKQ7Bfshfc0qRgADc1Jy1u0FV5Z X-Received: by 2002:a05:6a00:21d4:b0:668:9bf9:fa70 with SMTP id t20-20020a056a0021d400b006689bf9fa70mr3658106pfj.34.1687338523166; Wed, 21 Jun 2023 02:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687338523; cv=none; d=google.com; s=arc-20160816; b=jheh9O82jvWOC51N0nR1z6BJbYk0N71RRzwf9sqXsTsKcUMySHFuwOcqOfLpQdefhK 5tyjrYcuHk4WoighGeLHuEXLQPThDRurIadUtFr8gPhLU6wYmbpbEZaS7rM1nyJUlTPS jLRzgUopBrXHJt0lcS2BOjKE3vUpvxzJR7gAje16Pk1vbAyPOFHrVEQSdLfIViIbZpTa TeQuVLE+JVvbikEd99xQe7uTdhHPGeeViz21WFnnQibkG+/aQj/PXu7KlNYYcLWphj6x f66kzLXXyvhrQDudvePMpYmx2QCD0ys1Ykk9KEEHEEbqmlJ/NJ8KMj0UvbOpDsp9v3R0 r3Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=GggaCXOFg4z+F5xlvFzI/hjEnVVezaR8FCxhsY4X+4k=; b=EySqLCq1Yz00xYH7TXV1uSd7v+kp8kIPuk3HDqZs3tHI88pvQx75QQJnSgRpHi98Rd 2qfVJuwNBSrd7XQk5CtSnGwGV7FDLHibBcdK3GW/DEJ11u4bKBoswRHziuF6g1dYysCI RIgVy+4CCX50C1dD7tot/T2UzxaclphZma80M4VxyqSNKaiSsHvJvirYjLBF3zeYpowS R8dfJAfCFZb317Gdj88LayGy6XwxdejpFawd3x+APDg9aH06bQWklB3uPUD8gckv9uR4 agYKi5EVS39kLC2pB1mIhrchwI2cIXkCpS3Nsz9x3zk0v43tC/+jM0NPjQgjX0l08zhg Ujyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=YAkAPnxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y24-20020aa79438000000b0066879af7571si3557511pfo.130.2023.06.21.02.08.21; Wed, 21 Jun 2023 02:08:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=YAkAPnxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231226AbjFUJCa (ORCPT + 99 others); Wed, 21 Jun 2023 05:02:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbjFUJBz (ORCPT ); Wed, 21 Jun 2023 05:01:55 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D60B1997 for ; Wed, 21 Jun 2023 02:01:28 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id af79cd13be357-7624e8ceef7so448596285a.2 for ; Wed, 21 Jun 2023 02:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687338087; x=1689930087; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GggaCXOFg4z+F5xlvFzI/hjEnVVezaR8FCxhsY4X+4k=; b=YAkAPnxt6pZOgcUU5gErX3sbI43Adc76e+9dsxfRuvvo+hzThnkDKhy0joF+qo8LKM HkRf3+n40noWJYMgW83bd7IvUDZ/poWHNY3Jx1Z0KKe+uvulO3QyNs4xo6HTDMH2hPXm mEyTVrzeHNyELzHfZu0pENPirl89gRQWJHsWmtgLETtVwCs3WFG3VOYxDKL6+/p0L57u Ed6oukufenkRQxhbsbLj97fBL8/GHe0TLHzpbnHYFmrrtWgSp8ZZC8fJiJiVaSIZwngJ fGzr6DoZWgbSFyEfbfo7ZEqzCzJckfia6djl5Sxaxenl3VRUwlMPCMrLTnNH2Z7mADxU oCWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687338087; x=1689930087; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GggaCXOFg4z+F5xlvFzI/hjEnVVezaR8FCxhsY4X+4k=; b=YoxoPaoOiA4T6EavFaljI6kPMocXr97sintPdTryWTZYq3JzGM7699gkyY0v+gaM7c 3KB5yZB6eYEObYXS8jlI7m223cJUCuxh0IxKy9O3woawWv5deAyp2806pZO2Du2hO/1M ekWBW5aG0E8iRRC+QbEoKOl4PEyNpZVTtg45jleW1dit4YvNzUM/cuVWXKA2kcN+poig R8YgizekJrzBcpdnQWfumFcbaUoV2yceeiHSP6FSeLeEb11/wpKrn4/06bjW44yoAzfx m9vxLqsxe3eR4R0/cYPqUZdQFb+bmyeSbNSKSr6PSanLs4NbiBSzBok+YQWjZYLQoy9T IWXQ== X-Gm-Message-State: AC+VfDxPuGuykZxF6MfpMp2IC/DVe2xfHSqhq881Mj5spBP2emzAOSG1 uDvwh3TsOYpkO4WyJbwRNBvDMtq4HwwNdHBvGIPIJw== X-Received: by 2002:a05:6214:1c87:b0:628:8185:bd6e with SMTP id ib7-20020a0562141c8700b006288185bd6emr6847558qvb.5.1687338087414; Wed, 21 Jun 2023 02:01:27 -0700 (PDT) MIME-Version: 1.0 References: <20230616182815.GA7371@monkey> In-Reply-To: <20230616182815.GA7371@monkey> From: Vishal Annapurve Date: Wed, 21 Jun 2023 02:01:16 -0700 Message-ID: Subject: Re: [RFC PATCH 00/19] hugetlb support for KVM guest_mem To: Mike Kravetz Cc: Ackerley Tng , akpm@linux-foundation.org, muchun.song@linux.dev, pbonzini@redhat.com, seanjc@google.com, shuah@kernel.org, willy@infradead.org, brauner@kernel.org, chao.p.peng@linux.intel.com, coltonlewis@google.com, david@redhat.com, dhildenb@redhat.com, dmatlack@google.com, erdemaktas@google.com, hughd@google.com, isaku.yamahata@gmail.com, jarkko@kernel.org, jmattson@google.com, joro@8bytes.org, jthoughton@google.com, jun.nakajima@intel.com, kirill.shutemov@linux.intel.com, liam.merwick@oracle.com, mail@maciej.szmigiero.name, mhocko@suse.com, michael.roth@amd.com, qperret@google.com, rientjes@google.com, rppt@kernel.org, steven.price@arm.com, tabba@google.com, vbabka@suse.cz, vipinsh@google.com, vkuznets@redhat.com, wei.w.wang@intel.com, yu.c.zhang@linux.intel.com, kvm@vger.kernel.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, qemu-devel@nongnu.org, x86@kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 16, 2023 at 11:28=E2=80=AFAM Mike Kravetz wrote: > > On 06/06/23 19:03, Ackerley Tng wrote: > > Hello, > > > > This patchset builds upon a soon-to-be-published WIP patchset that Sean > > published at https://github.com/sean-jc/linux/tree/x86/kvm_gmem_solo, m= entioned > > at [1]. > > > > The tree can be found at: > > https://github.com/googleprodkernel/linux-cc/tree/gmem-hugetlb-rfc-v1 > > > > In this patchset, hugetlb support for KVM's guest_mem (aka gmem) is int= roduced, > > allowing VM private memory (for confidential computing) to be backed by= hugetlb > > pages. > > > > guest_mem provides userspace with a handle, with which userspace can al= locate > > and deallocate memory for confidential VMs without mapping the memory i= nto > > userspace. > > Hello Ackerley, > > I am not sure if you are aware or, have been following the hugetlb HGM > discussion in this thread: > https://lore.kernel.org/linux-mm/20230306191944.GA15773@monkey/ > > There we are trying to decide if HGM should be added to hugetlb, or if > perhaps a new filesystem/driver/allocator should be created. The concern > is added complexity to hugetlb as well as core mm special casing. Note > that HGM is addressing issues faced by existing hugetlb users. > > Your proposal here suggests modifying hugetlb so that it can be used in > a new way (use case) by KVM's guest_mem. As such it really seems like > something that should be done in a separate filesystem/driver/allocator. > You will likely not get much support for modifying hugetlb. > > -- > Mike Kravetz > IIUC mm/hugetlb.c implements memory manager for Hugetlb pages and fd/hugetlbfs/inode.c implements the filesystem logic for hugetlbfs. This series implements a new filesystem with limited operations parallel to hugetlbfs filesystem but tries to reuse hugetlb memory manager. The effort here is to not add any new feature to hugetlb memory manager but clean it up so that it can be used by a new filesystem. guest_mem warrants a new filesystem since it supports limited operations on the underlying files but there is no additional restriction on underlying memory management. Though one could argue that memory management for guest_mem files can be a very simple one that goes inline with limited operations on the files. If this series were to go a separate way of implementing a new memory manager, one immediate requirement that might spring up, would be to convert memory from hugetlb managed memory to be managed by this newly introduced memory manager and vice a versa at runtime since there could be a mix of VMs on the same platform using guest_mem and hugetlb. Maybe this can be satisfied by having a separate global pool for reservation that's consumed by both, which would need more changes in my understanding. Using guest_mem for all the VMs by default would be a future work contingent on all existing usecases/requirements being satisfied. Regards, Vishal