From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (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 B3A0F40861E for ; Mon, 10 Aug 2026 15:01:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786374082; cv=none; b=CCkLtFXX2av5w54qQ8UHpuk4KAySSgPqT+9D73xxqPRN6S4kETibl3t6tCI11SzMx6g/C/LcfVR7J0jIQTkUu9oLkkCZOrYvkiJnOresYv3O9ygRkytNBbDfZtNyTG09AuydnOQOzgMKxO0FNLI4ees6wIVWZp/D7hTloxWygMo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786374082; c=relaxed/simple; bh=5qqRAv89nnapnboqyF9PWAGC9EirWJivtNWwArhN4cQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NV+dfYfwaqA6oVHflOdsjDrRNwd2+ndXd2IKkA3Lt5ETMJ0ja45iCxUj6XZMpIAT427B1/FU/kRap8p0Nu6uCuQE7HoLaU+0KkxYpJko0wqH0zbt+tksikJLkAVdcrVqdlsLsCCRgjuydeWJtvbLxEY8rjG6ERwc75yre5Edc6E= 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=UYiGUP4j; arc=none smtp.client-ip=209.85.216.71 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="UYiGUP4j" Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38e1118e4abso3439752a91.0 for ; Mon, 10 Aug 2026 08:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786374073; x=1786978873; 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=qSKxDjTci2S5HKL2Y8g6gVb9b+tAUX3tfJowR2dLyss=; b=UYiGUP4jSvUT1LBlyHyBe3CYh7wJfKPITRMqHwtcVKU4HILRgewEDEHLs+Vvv/JcZW lsLsfxGyqjMmh3vazGuOhCTu2gCnWAqUVRoc2zkY32NY6OBAcvR6cascRYpqSGciNZBW mOTaTjT1GfCkpa1oUmved+ksCjNF9HPZ5kX6OUAyOyGBP52LCWv6tj3J+emG5j+2gFBm +/tuhowlP1xRUWsVo6MZxIk7LpC5GSxDePPJMqFK5Ra0BytGhKucCxSbjw/aodmuFbQd vzhgjxxwUkqcFwBygMTAU/HT4JHxEuB6+BgxdAGYCY1KZWFoS7XTqtoWR5eWOpb/hTex ivHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786374073; x=1786978873; 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=qSKxDjTci2S5HKL2Y8g6gVb9b+tAUX3tfJowR2dLyss=; b=hXgp1VZTtYwgrKtuUAEHFywhHERNVR1IFvgisCExVbWCbv77S42VUPvhA3UR68kjEw i6Uwav09U26Z3df/cCYeaquHlHTC7KB0s2onnxmTXJluGk52GVlkclcx5+G+QGWivwwn 4lDaSi22F10QOYf/NHms8jT/pBulrEU5b1AWD1mx73wJLZ09ll5puceOuRPsdEOjgZLA ZgfIRr2QbogTDgTwPujETpJ+xhZ3ZwWjW95ESlVMX9zK9HfEmZy7Bh1S/RlfN08OFw96 p+mXWMZ+8sE588Lfhr+C1rhSqdxOWKjBbxQfcjD+gxzN5SgYO8CommlHK0rRTWsELtHR 6sWA== X-Forwarded-Encrypted: i=1; AHgh+Ro1rX0BkedRLPr3ezPwkvb2T/bOE5XQ4gD8smeZ87cvpzL+dkqUD7Uk2dr+9jtCWynf3Fzu6ajysz7OQ/0=@vger.kernel.org X-Gm-Message-State: AOJu0Yweyc2Eqfo4YGjPCOierAxX2jgio2WRgJVohUclWRa2ry1WlOX/ 1Cus4RwCcBL9SeacqatImwqT9E1CZmshEnDmJczePyFw/WnAugDjyup8jdaQPI0L1owKIKfb31k psZKUaQ== X-Received: from pjuo6.prod.google.com ([2002:a17:90a:d206:b0:381:2921:e696]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1347:b0:38e:9045:babe with SMTP id 98e67ed59e1d1-392823376d5mr23283260a91.7.1786374060881; Mon, 10 Aug 2026 08:01:00 -0700 (PDT) Date: Mon, 10 Aug 2026 08:01:00 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260807-gmem-inplace-conversion-v10-0-2fc18ee6d3ba@google.com> <20260807-gmem-inplace-conversion-v10-7-2fc18ee6d3ba@google.com> Message-ID: Subject: Re: [PATCH v10 07/41] KVM: guest_memfd: Stub in ability to enable in-place shared<=>private conversion From: Sean Christopherson To: "David Hildenbrand (Arm)" Cc: ackerleytng@google.com, aik@amd.com, andrew.jones@linux.dev, binbin.wu@linux.intel.com, brauner@kernel.org, chao.p.peng@linux.intel.com, 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, tabba@google.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, Vlastimil Babka , 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 Mon, Aug 10, 2026, David Hildenbrand (Arm) wrote: > On 8/7/26 23:52, Ackerley Tng via B4 Relay wrote: > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > > index 65fbce46b63f4..9477ecebbbced 100644 > > --- a/include/linux/kvm_host.h > > +++ b/include/linux/kvm_host.h > > @@ -2580,6 +2580,8 @@ static inline bool kvm_vm_mem_is_private(struct kvm *kvm, gfn_t gfn) > > #endif /* CONFIG_KVM_VM_MEMORY_ATTRIBUTES */ > > > > #ifdef kvm_arch_has_private_mem > > +extern bool gmem_in_place_conversion; > > Is there a "supports/has/enable" in there? And should we call it "kvm_gmem" for > completeness? It's kinda stupid and definitely more than a bit inconsistent, but overall I think I actually like "gmem_in_place_conversion" the best. gmem_has_in_place_conversion and gmem_supports_in_place_conversion are misleading because it's not just that guest_memfd has/supports in-place conversion, it's that that KVM is tracking PRIVATE in guest_memfd and so in-place conversion is the only option. On the other hand, while gmem_in_place_conversion_enabled is better, it's not quite accurate either because userspace isn't strictly required to do in-place conversion. As for a kvm_ prefix, IMO gmem_ is sufficient for a namespace, and not having kvm_ is consistent with most module params in KVM. So I 100% agree this is an odd name and has all kinds of inconsistenties, but all in all I actually like the vagueness and the brevity. > > typedef bool (kvm_mem_is_private_t)(struct kvm *kvm, gfn_t gfn); > > DECLARE_STATIC_CALL(__kvm_mem_is_private, kvm_mem_is_private_t); > > > > @@ -2588,6 +2590,8 @@ static inline bool kvm_mem_is_private(struct kvm *kvm, gfn_t gfn) > > return static_call(__kvm_mem_is_private)(kvm, gfn); > > } > > #else > > +#define gmem_in_place_conversion false > > + > > static inline bool kvm_mem_is_private(struct kvm *kvm, gfn_t gfn) > > { > > return false; > > @@ -2595,6 +2599,8 @@ static inline bool kvm_mem_is_private(struct kvm *kvm, gfn_t gfn) > > #endif /* kvm_arch_has_private_mem */ > > > > #ifdef CONFIG_KVM_GUEST_MEMFD > > +bool kvm_gmem_is_private(struct kvm *kvm, gfn_t gfn); > > As mentioned in v9, the name is confusing. > > kvm_gmem_mem_is_private > > ? Ya, +1 to kvm_gmem_mem_is_private.