From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (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 E17FF37CD48 for ; Wed, 1 Jul 2026 16:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782924903; cv=none; b=O0ncuCgx7Lio3h5YOeVlplAa4+5Ot9iUzGHI30t/fuBGjvatfGTpOpqybx6mH45fLhhTW6sjKDgHTVf0gD+Y+ouwrjmqf9q57r1bB80YpIH7WWoW+x+2fuVU3KpmNOL3rBHfAY4b8UA9zOZV5BJZo5TL9jT09tC7TvHWyLP0EJw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782924903; c=relaxed/simple; bh=L5c3o9vgdgjXHGOQSuIW9q3/2N3iJk6DLv8bljpS7DA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WA/uFBcUSOMLXBc8gc9cSCrHRqxKhYE7r7QvJYMm6NKaJrasRjhhZ3mplibSBETP8LOQJxWEbvyzsnTohfvACWpQcPWltmJCecEJ0y+Eg3MT+x0gyZsTHMg8WsM42Gr3tNqk6/hyFa3uPJa7Vhzk/b3Azv2H91yIyB+EzkWmmuA= 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=Bm16Jk10; arc=none smtp.client-ip=209.85.215.201 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="Bm16Jk10" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-c890bac374eso909577a12.1 for ; Wed, 01 Jul 2026 09:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782924901; x=1783529701; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=lbVYdv7/FNdOOvrw/bcfsmdKoQ369BNbAkiBiKDICVU=; b=Bm16Jk10DzFwFM1c7L4fhwdbnVfS0QXzyMzWyFobsZ2zse54L5EUYVd/71MHkeSFHj KO50Lstmu5WUaTKkOpNvDhN544ttzDQhhydyddDJJB3vI2q8CnNVUX0LvodCKgB2r/ON WlIi271UjYatvD6h1k3itEZwUQUUsJxdOvwekCs1tgd8LZ7rVLPbargP99LeV7LtI9q2 w+7CnH/Un7Qa9TMiL/hb+t4YlX9LnzrYuIwvc5e61wC+rtzAy8nozGPD0HriOIhqfpLb vDY094LXpJ432U4I3O2M6nbsCzPKbRKqfC/xXGmdm2OXVsrOSL6cDSS9LAK/BYlbHv7r XRCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782924901; x=1783529701; h=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; bh=lbVYdv7/FNdOOvrw/bcfsmdKoQ369BNbAkiBiKDICVU=; b=WhoGO2Cn7PQyKwObpZPoHEOVu+8MDNfV3iPx6zPRVt6zKuPwNq1kVPz8I9WpNHgcw9 WIeX1c6/u8ezO5U4twqUA9CMeHt0HkLHQ/WjH1kG4msGB2R8z+hh1khvST6+iREKEfJk vHwEXfEGNNIZRONV1XxjgveSAwV+g4MYrDih+jk+SnjrkTipf34VL47mQ6gIOt7Nni4z Z3xHbbf/8Sf4nk6IpuqBjCelVlAJJCdIGa5sBj5eZXcO5x6QcQXPuYmkDCLqPFNpnALB N12T8+eE5EzvGZRSog+nEWLZ1US2sRXeO2zddkT+yKsHXL1sJm9T5rlUPjT4TbryURRh D5bQ== X-Forwarded-Encrypted: i=1; AFNElJ/PeMa1HzpJ9vGKDNPXzh4ZYXLpqNoT3sXYxm6lKoUafQ+A8L+wq2dUvIA+1QAwo0vacdckdhlRlsc9RFo=@vger.kernel.org X-Gm-Message-State: AOJu0YzhFggzaj+YepNObgvfq/QfUlg6vnHYqtXg79vqQDlGXVmX6qVI Jj3J/fUxj7b/bVolR66sGKwnwbsAEvsNliZ3GKUDSYgmHf8EH71eegfik8Biunk7smJiK4un98Z tSH1pzQ== X-Received: from pgja21.prod.google.com ([2002:a63:cd55:0:b0:c82:7761:9936]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:a49:b0:3b3:bf95:f7e3 with SMTP id adf61e73a8af0-3bfed477967mr2785820637.43.1782924900819; Wed, 01 Jul 2026 09:55:00 -0700 (PDT) Date: Wed, 1 Jul 2026 09:55:00 -0700 In-Reply-To: <739e6834-40b3-405b-ada4-d31c38d8416a@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260618-gmem-inplace-conversion-v8-0-9d2959357853@google.com> <20260618-gmem-inplace-conversion-v8-6-9d2959357853@google.com> <739e6834-40b3-405b-ada4-d31c38d8416a@intel.com> Message-ID: Subject: Re: [PATCH v8 06/46] KVM: Enumerate support for PRIVATE memory iff kvm_arch_has_private_mem is defined From: Sean Christopherson To: Xiaoyao Li 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, 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, 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 , 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 Content-Type: text/plain; charset="us-ascii" On Wed, Jul 01, 2026, Xiaoyao Li wrote: > On 6/19/2026 8:31 AM, Ackerley Tng via B4 Relay wrote: > > From: Ackerley Tng > > > > Explicitly guard reporting support for KVM_MEMORY_ATTRIBUTE_PRIVATE based > > on kvm_arch_has_private_mem being #defined in anticipation of decoupling > > kvm_supported_mem_attributes() from CONFIG_KVM_VM_MEMORY_ATTRIBUTES. > > Well, after this series, kvm_supported_mem_attributes() is renamed to > kvm_supported_vm_mem_attributes(), and it's still under > CONFIG_KVM_VM_MEMORY_ATTRIBUTES. > > > guest_memfd support for memory attributes will be unconditional to avoid > > yet more macros (all architectures that support guest_memfd are expected to > > use per-gmem attributes at some point), at which point enumerating support > > KVM_MEMORY_ATTRIBUTE_PRIVATE based solely on memory attributes being > > supported _somewhere_ would result in KVM over-reporting support on arm64. > > I don't understand it. This patch only changes the behavior of > kvm_supported_mem_attributes(), the usage of which is guarded by > CONFIG_KVM_VM_MEMORY_ATTRIBUTESq. This is config is only visible to x86 due > to patch 03. How does it affect arm64? Hrm, yeah, this is messed up. Ahh, I think Ackerley shuffled things around and "broke" stuff in the process. In v7[1] and earlier, the diff was this: diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 091f201251159..68142bc962953 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -722,7 +722,7 @@ static inline int kvm_arch_vcpu_memslots_id(struct kvm_vcpu *vcpu) } #endif -#ifndef CONFIG_KVM_VM_MEMORY_ATTRIBUTES +#ifndef kvm_arch_has_private_mem static inline bool kvm_arch_has_private_mem(struct kvm *kvm) { return false; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 306153abbafa5..abb9cfa3eb04d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2421,8 +2421,10 @@ static int kvm_vm_ioctl_clear_dirty_log(struct kvm *kvm, #ifdef CONFIG_KVM_VM_MEMORY_ATTRIBUTES static u64 kvm_supported_mem_attributes(struct kvm *kvm) { +#ifdef kvm_arch_has_private_mem if (!kvm || kvm_arch_has_private_mem(kvm)) return KVM_MEMORY_ATTRIBUTE_PRIVATE; +#endif return 0; } which makes a *lot* more sense given the changelog (and IMO for the ordering in general). In v8 here, Ackerley combined part of a change[2] (that I provided off-list) with part of this commit, to create patch 4, "KVM: Decouple kvm_has_arch_private_mem from CONFIG_KVM_VM_MEMORY_ATTRIBUTESthe". Ackerley, the cover letter says: + Reshuffled the earlier commits that deal with preparing KVM to stop seeing VM memory attributes as the only source of attributes. but there's no explanation for *why* the reshuffling was done. Reorganizing code like this at v8 of a series this size is a big "no-no" unless there's a *really* good reason to do so. In addition to the resulting confusion, changes like this invalidate Fuad's Reviewed-by. And since it's obviously quite difficult to tease out exactly what changed, it's not realistic to re-review things without doing a deep audit of the series, which no one wants to do for a series that is/was so close to being fully ready. And without such an audit, I can't accept the patches, because I can't trust that what I am accepting is what I and others have reviewed. So, except where there is/was a *need* to shuffle things around relative to v7, I think we should revert back to the v7 ordering for v9. And where there is a need to rework things, each and every one of those needs to be explicitly documented, because "Reshuffled the earlier commits" is grossly insufficient. [1] https://lore.kernel.org/all/20260522-gmem-inplace-conversion-v7-3-2f0fae496530@google.com [2] https://github.com/sean-jc/linux/commit/8a475b1bcf89f1cf776ed9ce7d6bb587aab0d421