From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f46.google.com (mail-dl1-f46.google.com [74.125.82.46]) (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 4C2292DC350 for ; Wed, 24 Jun 2026 14:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=74.125.82.46 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782311922; cv=pass; b=SgiH1hkIxaqJbzmySHqhnsDvsZGvufwbOsxBY9yXIYHjIgUdozyXyYITHRgDOwLPpbkjfoIU4oTEzxFsL6nCCIcMkFZn00qzaJaokkd3NLGa29LQZR13xVe46/Z6hkBThdqo9OTsqzoemr39/1RZk2n1ANjcwZ+nIpkB5u+LAA0= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782311922; c=relaxed/simple; bh=+a1qMWWmOM6Y8/o1eN1lz2qoObcQIVgbkHxFmUvd4Kc=; h=From:In-Reply-To:References:MIME-Version:Date:Message-ID:Subject: To:Cc:Content-Type; b=fiD/9Llv4ePg+5AHwwtaU8DLTSuogMH2qpl+9nLmGWWJEZBHa6muHHXTMvmjIJCwLilNHLm0C8nDiShfZ+SYtzbutKAoWn+WEA/eUGPMTRijpH6Wepc7CJkiTjOpLzZHQK1UpBn9Ns8CPUhAmjnIswyjYbm0CmHKLPstsfKI7oM= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=mNSNe9wb; arc=pass smtp.client-ip=74.125.82.46 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mNSNe9wb" Received: by mail-dl1-f46.google.com with SMTP id a92af1059eb24-139a5f4ca15so1298067c88.1 for ; Wed, 24 Jun 2026 07:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782311920; cv=none; d=google.com; s=arc-20240605; b=cPusJMJ4Byc0sKQAtF1d/5lEdpWeM28Z3P2oBPGSikzLOD97iNKZMLI7fojondUVyB 4G7vkz5Kf0Eu1Wx5GAnNXq2hW0qQWAB7KtSiLy/1oqyp626zsiO7DvqnAp4AZu9M0PQG 8k0oiqx1HOSgwmn1DwwR63g/f4cHjGqZdSf5yE5Nq1U9I1Gqw07d2U/B4haTwKxOIobr qz4ftBeuk9mFZnSb65yPPjKrAUSXSkmgO4sKXuuG1bIDHws+IUFpyz1mQWOOs+Yl049/ rqPOQO3GCrXUnkvOnjwDTFrroelJqsVdC1Eufdam/PUZUllU3tKOkOwnRAfJ5yUtGROc B1Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:dkim-signature; bh=HpVAzGtumZJ9rywOtX3ITBDfHQ1Vjgs3+apnvgsrs7k=; fh=RImFyhd8SLY67qHeDCLhApj9IRiGk9PdZscF4lBvAes=; b=TWAdEWPihCbhWUoOEzwtG9PRGrEBQBLWsPs4DaBzDYHGKj2Hs95JLrx6IgpqZ0ApuG lTBh8pow6yxEIsf+3PIVqF1KuT3SbGjnnx3IDy8VVrE27PsGxsg+zWyZt+EGctnejWqD w8PAxYl+c+1+kHTXXi0AXaLChGk/xFIqiQz64kidXX7+W40qjwPQp0bJwwzHaQkq1wey Ueu+rPX0xZGE5npa900ZDHoRjfg4IGN+bbIYj9oGUTgOV2Vqc1DiKNvbHar8OplFa810 bNcH0tTLk7IXuonzI2oYhY4IHRX36LYIs8IVGNCtcQd8aam310LwzKcbRVjRBkRGg2xc ZZDw==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782311920; x=1782916720; darn=vger.kernel.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=HpVAzGtumZJ9rywOtX3ITBDfHQ1Vjgs3+apnvgsrs7k=; b=mNSNe9wbTP9Ngof4VtQoFcV2uv52SUPaZgY+Tbi660cx+xZqhgJ2b3iYt44xjlEr6I ELCjjQ9gLffplXOTXMTE3aF0bPXSlYL7CEDv/m8Y61oFNVZwQPaSVRLm9AqiUWupNXz9 IlLVsV72n9CO/cCbMEXwfXIzvGB7GvrX/TAQHIGJiBfQ4PUfK9rT4oDvczZ9ytL4FU0u OidJ8kWId23VDBoEkkY6a6NZZJ2SKgenW7G4SsyXAhUq9Zi2A+OJoDsFdVZDw2Pv5lr/ pl3c+NsUeE8KQ0GZFGCbtsNJItUDelIt2UCx2XniStgj4PvZGXLbswTlT90kbvWoN4y4 pdjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782311920; x=1782916720; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HpVAzGtumZJ9rywOtX3ITBDfHQ1Vjgs3+apnvgsrs7k=; b=W28FV8mr5SRJUF65YuX8xJZp3NBIrFxZmPjx1Z3LVherMnhQp8Vio1unnQhuu5AVPk Kc9orlfdtn3Z2eWIWTW1uOgs7ufCFhSvNm1QHnhIxuoTA9Phmvx85exkKo7d8ZNrRMJS FWfcEQaSfZXsiqRtRCD0pXg5tDklX6WgGnRNHSdlf+qMXFDxZmq32Fn7G0hrTb1GcE1k 5+ZGgSPzXgT5rKST/0G1HRTxbOOdM5ypdoTaW5lfLdd96rKl4u4fi6KK2eYZtbXzgZ/+ akcZOKMXq+w0O8ZeWXLO4TVKLk5l9pqsn1Cgx0qJ+Y7xalJ9x0E7Alwn90rJ/IK73pnE 7NQg== X-Forwarded-Encrypted: i=1; AFNElJ+ILiWt1JyL4C+t8xanF2DrB8BhVJJqF+FcUbm/URNybXd4AQV1fYna937ZZwKm7F/pg9HV0YVUx7uD6Vc=@vger.kernel.org X-Gm-Message-State: AOJu0YxJVUzrHHRC0qRso0tThTSUxGtvbY8c+DSfkal8Ehw4unAXDzZe Cd+usIy+x8xrbJjAezk4XmPSraZ4rufjAKQEry8Q/wLJ8yoBt0E8rrEnY8XnxrttPHxKnoTxsOP Dm8EvnQSQsuTULKCzAn8FesgOGkk1qTbCS1jrbB3W X-Gm-Gg: AfdE7cn8KDx6PmQnOXWtBZd1hiiq+JB9KucpPiVi+Pz+ZDpx6pUnS0gNHHIAQoIYRLG pUIpBfqN+ozPkS53fC/XNlPKSHx7sAf+iUsxz9thW1/LA8uzcCorO2Qzse29A9Ng9rVpux8rWvT yrI2aMbWd87/vR0iRvbiDphJ86f4mEO+XF5AyhV0T+l3gOCOs9TJQ9m0IwL1j/a/AYgBec+2GRu 9YnuCDDbom/dOv9GpvfNFrMUnRbTkBqC3F3GWpl96gyG833ZCo7mvl6qoPjZ7YkkibGG0/kEvsW /V4QGIwWQDxQvEZrpUUGzF92bVFp X-Received: by 2002:a05:7022:6612:b0:133:3bb1:8d40 with SMTP id a92af1059eb24-139d0c24496mr2539007c88.15.1782311919284; Wed, 24 Jun 2026 07:38:39 -0700 (PDT) Received: from 176938342045 named unknown by gmailapi.google.com with HTTPREST; Wed, 24 Jun 2026 07:38:38 -0700 Received: from 176938342045 named unknown by gmailapi.google.com with HTTPREST; Wed, 24 Jun 2026 07:38:38 -0700 From: Ackerley Tng In-Reply-To: <1b59fec2-a464-4429-8532-880394912af5@linux.intel.com> References: <20260618-gmem-inplace-conversion-v8-0-9d2959357853@google.com> <20260618-gmem-inplace-conversion-v8-9-9d2959357853@google.com> <1b59fec2-a464-4429-8532-880394912af5@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Wed, 24 Jun 2026 07:38:38 -0700 X-Gm-Features: AVVi8CeozOwjsDHz095RESzI1L73Y_-_c-08wJAGuPOXvsS0FIpnjscm-5zrczA Message-ID: Subject: Re: [PATCH v8 09/46] KVM: guest_memfd: Introduce function to check GFN private/shared status To: Binbin Wu Cc: 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, 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 , Sean Christopherson , 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="UTF-8" Binbin Wu writes: > > [...snip...] > >> +bool kvm_gmem_is_private(struct kvm *kvm, gfn_t gfn) >> +{ >> + struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn); >> + struct inode *inode; >> + >> + /* >> + * If this gfn has no associated memslot, there's no chance of the gfn >> + * being backed by private memory, since guest_memfd must be used for >> + * private memory, > > "guest_memfd must be used for private memory" is a bit confusing to me. > Hmm good point. Is the source of confusion that guest_memfd can be used for both shared and private memory? Perhaps this can be rephrased as: guest_memfd is the only provider of private memory and guest_memfd must be used with a memslot, hence if there's no associated memslot, there's no chance of this gfn being private. >> and guest_memfd must be associated with some memslot. >> + */ >> + if (!slot) >> + return 0; >> + >> >> [...snip...] >>