From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3971A49B1E0 for ; Wed, 2 Sep 2026 13:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788355838; cv=none; b=u1ifwTUnjxI7eYGcgnc7bO5b7so4OPtJEErXX/CbJr2rk23WuQ0QSxcTE5KmUqZNCk6BAKn7LwLlv4eIRBeYHPFwjDtgiGRJuhWb845R2w3hKi85JCLRDogG/4QQ/9HgbZs/VqJe8Kf8jKAUrMZU66SzsA6DMiUzuo1TK1ff4kI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788355838; c=relaxed/simple; bh=MHL7rgwCnCCzQ0ALQS+vHavGvj+m/st2KmAo4YeAg84=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ui3mgBomiolkjgF4OKsHhcmkU41OpGSVfH55GmzNq7WCIa/W0UKzB+CQg8J9IHdWn7GOWXB6KXJJ6ZfLTnMiNC0ZNCGpCUO4466syC2E+VE5ArUAa75F6mVODFSytiLHr+7FzE3wqSKIqQMd7AC0P0y4ltXGTnhyA08GWbLyhyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HDa/0Oej; arc=none smtp.client-ip=209.85.214.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HDa/0Oej" Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2ce8a76df2dso20384095ad.2 for ; Wed, 02 Sep 2026 06:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1788355835; x=1788960635; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mjYXG96MoSl8fTQZ7UxomEUfCMCHuYclL43aTeN6TlM=; b=HDa/0OejXOLAo60mi/WsaiaFauY4lpsEUXD5S4ErepL7tSUt6BK+qswUsGtrZxee/k AMZ89vrXic2a8oIk4MUXmdYjVgcZ22N31iZpGhm6wp5bEqyvzlstVg8GIru4/ZFYzAr2 z2ufT38pcUCxPWK5qjzBy7ZVEK8dn1yag6u5B0ZE8bax5eVnab2YxmbXblLtfaGalYs7 hpi+q61IuH+UMrDxcLyEQcHs1kOGaHEs8S50arsWnyewMnF8WqwSfP4x89pnsj9u46Qt kPnJeo8nKopTl1HZzVkxmvjcGr8KP/cKkQGbpIuRrlO9PndMduKx7tHKOR7x6cSnWQGr M4Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788355835; x=1788960635; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mjYXG96MoSl8fTQZ7UxomEUfCMCHuYclL43aTeN6TlM=; b=qwdKbqoGudWooBlIT6ctFcb/WPC/ccKeTWqkWXPfAgfN739lvr0ro+vlW6Yy4RcLkh jrm9QDLIYpPur8ijcqr1kPD97FW4I9XootPpXa18K+Fwe50CR+Ws+d5PRddYQv3nwFkV A2Eevef9UM1Bwnm59yWg69lirCDWYgFbCQ4n+tQofxll+5HDPJmQPuIFRMdImI1dTRUs pkscvNutm4hBqB/TEZgp8HqezuMUsgJLM+rHGU/zKItWfyTAUe2wKb2Rdeqm8/6FjhLy ehgDZTlqjuoAN5uE35e8/dWrI5A9LylNpBxQkizeB9anUofVz1URmgRvWihTdyMSkduD 924A== X-Forwarded-Encrypted: i=1; AKwUvByodz7Si7pSAD1Nps/xhfqP8nnROkOCF2GUNbNFW8/d/9a4M6UEqTXy7JK8sfpF77PuByB5tOrP0sQ=@vger.kernel.org X-Gm-Message-State: AFuF++mTGpD8RT/8QBQHvKDqVgLi99QA5fcAN3MWR7SNK9kEtxdsD8gS kh4RE4NSdhTiaPp69I6yDUUBdbUCxPSUFXGJ2JsBQZdOpBYJkOXJeoQzqbobgz8voQeHMhOcVSM xaXVecg== X-Received: from plnt11.prod.google.com ([2002:a17:903:196b:b0:2d3:7166:b1a6]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ec8b:b0:2d9:43f6:59f0 with SMTP id d9443c01a7336-2daec7bae38mr68887665ad.22.1788355834704; Wed, 02 Sep 2026 06:30:34 -0700 (PDT) Date: Wed, 2 Sep 2026 06:30:34 -0700 In-Reply-To: <33431813-fc94-48fb-9042-5cfc68af05b8@linux.intel.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260830-gmem-inplace-conversion-v12-0-85e5fd25252a@google.com> <20260830-gmem-inplace-conversion-v12-23-85e5fd25252a@google.com> <33431813-fc94-48fb-9042-5cfc68af05b8@linux.intel.com> Message-ID: Subject: Re: [PATCH v12 23/45] KVM: Let userspace disable per-VM mem attributes, enable per-gmem attributes From: Sean Christopherson To: Binbin Wu Cc: Fuad Tabba , ackerleytng@google.com, aik@amd.com, andrew.jones@linux.dev, brauner@kernel.org, chao.p.peng@linux.intel.com, david@kernel.org, jmattson@google.com, jthoughton@google.com, michael.roth@amd.com, oupton@kernel.org, pankaj.gupta@amd.com, qperret@google.com, rick.p.edgecombe@intel.com, rientjes@google.com, shivankg@amd.com, steven.price@arm.com, willy@infradead.org, wyihan@google.com, yan.y.zhao@intel.com, forkloop@google.com, pratyush@kernel.org, suzuki.poulose@arm.com, aneesh.kumar@kernel.org, liam@infradead.org, Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jonathan Corbet , Shuah Khan , Shuah Khan , Vishal Annapurve , Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Youngjun Park , Qi Zheng , Shakeel Butt , Kiryl Shutsemau , Baoquan He , Jason Gunthorpe , John Hubbard , Peter Xu , tarunsahu@google.com, Randy Dunlap , Lorenzo Stoakes , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, Xiaoyao Li Content-Type: text/plain; charset="us-ascii" On Wed, Sep 02, 2026, Binbin Wu wrote: > On 9/2/2026 2:26 AM, Sean Christopherson wrote: > > On Tue, Sep 01, 2026, Fuad Tabba wrote: > >> Hi Sean, Ackerley, > >> > >> On Mon, 31 Aug 2026 at 01:25, Ackerley Tng via B4 Relay > >> wrote: > >> ... > >>> + kvm.gmem_in_place_conversion= > >>> + [KVM] Controls whether KVM enables in-place conversion > >>> + support for guest_memfd and tracks the private/shared > >>> + state of memory per guest_memfd instead of per VM. > >>> + > >>> + If enabled, KVM enables the KVM_SET_MEMORY_ATTRIBUTES2 > >>> + ioctl on guest_memfd file descriptors and disables the > >>> + legacy VM-scoped KVM_SET_MEMORY_ATTRIBUTES ioctl for > >>> + private memory state tracking. Only the > >>> + KVM_MEMORY_ATTRIBUTE_PRIVATE attribute moves to > >>> + per-guest_memfd tracking; other attributes remain > >>> + per-VM. > >>> + > >>> + This parameter toggles KVM's in-place conversion > >>> + capability support. Whether a VMM uses separate backends > >>> + or out-of-place memory management is determined by > >>> + userspace VMM design. > >>> + > >>> + Note, this parameter is only available when > >>> + CONFIG_KVM_VM_MEMORY_ATTRIBUTES=y. When > >>> + CONFIG_KVM_VM_MEMORY_ATTRIBUTES is not set, in-place > >>> + conversion is unconditionally enabled. > >>> + > >>> + Default is Y (on). > >> > >> The parameter is only settable when CONFIG_KVM_VM_MEMORY_ATTRIBUTES=y, and > >> in that config gmem_in_place_conversion initialises to > >> !IS_ENABLED(CONFIG_KVM_VM_MEMORY_ATTRIBUTES), i.e. N, not Y. Is the doc line > >> wrong, or is N-by-default not what was intended here? > > > > The doc is wrong. The intent is to maintain backwards compatibility with existing > > deployments if KVM_VM_MEMORY_ATTRIBUTES=y. > > > > Will it result in the situation that kernel builds with CONFIG_KVM_VM_MEMORY_ATTRIBUTES > enabled by default for backwards compatibility, which requires users to explicitly enable > gmem_in_place_conversion by the kernel option? Then it effectively disables > gmem_in_place_conversion by default. Yes. My intent/expectation is that the only reason to build with CONFIG_KVM_VM_MEMORY_ATTRIBUTES=y is for backwards compatibility, and so it makes sense to have the existing behavior be the default. If a deployment only wants the new behavior, then it can simply build with CONFIG_KVM_VM_MEMORY_ATTRIBUTES=n. Folks that want only the new behavior but are using a distro/pre-built kernel will need to manually enable in-place conversion, but that's not too onerous, and it's simply not feasible to provide defaults that work for every possible scenario. > But I guess it's OK for CSPs since they know what they want. Yep.