From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA06A385D9C; Wed, 2 Sep 2026 06:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788328873; cv=none; b=Dp37it8PX83+5Gs3cQTUqsDo8nC2pelgeDR78EhTA54z9RLZMt8zvmYuSsjok5js55LHK9miaPNhdDCMsDxQuvEgjVDPdfLQseiHaC+ftYmkhyMI69YKjNmH3Jch0Wj8cJY5e4RfJ+Ez1xiIYOGDk2IWwfyMJMdev0tTQmqMAKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788328873; c=relaxed/simple; bh=wodlJBhhDq6XlgK0pYCVcn+VALi8hcSEbRDEccKfps4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=NzJ3GYIxbL2JmLn9tF+pAS4xZn7QuSgyYPI/JQLKg2SDImRoLAbC2/uZyacwP0y5kVW/B5om9wNWUMDqZRJsiqWv4D+xinh2Yo2jx/6QsXiXjMrNS6Y7TjfC+6dOffkBb41HicGuyL2uMfvLTGSu4zy6HOa2dnruooZXyGg9298= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=i7py9ARB; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="i7py9ARB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1788328870; x=1819864870; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=wodlJBhhDq6XlgK0pYCVcn+VALi8hcSEbRDEccKfps4=; b=i7py9ARBXeYXd2z0ZiwcXhnEEuRAgjUnXN3sGUQzZ4StaMv0kDar3Q4k V54OQBVIhT75VZVnnthv9F/2A79y0mTrKNcFVqNW9FjYr8DG1RUW7K1Fz Mt7ok1DO2ZTcZPv0CijJBsGk1exEWeC3QPNs/Gm+BnGjC+BhznlFLhsCU OaFhA1aB9VNTGXzmbIhUC7Khm9a2bC5idGg96mQrJLJjP17TrsJFZWMwY fOfaePhQ0N9tqYKQ5B2mriGr4MWpRNqdcH5bOwt2S/KN3cO7IUH+okWZw zqUJqnO0OtXh61HdFOdiclOVavM3XbEcVWH9DuB3QjhcY4MbF0mpwZ/kN g==; X-CSE-ConnectionGUID: uLzxjKZLQD2w0eO2KCfhmw== X-CSE-MsgGUID: G+9W/iT1ReiyI8RTCdnWjA== X-IronPort-AV: E=McAfee;i="6800,10657,11893"; a="91287111" X-IronPort-AV: E=Sophos;i="6.25,257,1779174000"; d="scan'208";a="91287111" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2026 23:01:09 -0700 X-CSE-ConnectionGUID: 8BboPIKiQX60QPFL8h1p+Q== X-CSE-MsgGUID: J34KwcEYSM6A4SahyVFplw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,257,1779174000"; d="scan'208";a="294141256" Received: from unknown (HELO [10.238.2.33]) ([10.238.2.33]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2026 23:00:55 -0700 Message-ID: <7f524b1e-8a3a-401e-9e33-f655b7fc0cc4@linux.intel.com> Date: Wed, 2 Sep 2026 14:00:52 +0800 Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v12 12/45] KVM: guest_memfd: Always fault from guest_memfd if in-place conversion is enabled To: ackerleytng@google.com 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, 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 , John Hubbard , Peter Xu , tarunsahu@google.com, Randy Dunlap , Lorenzo Stoakes , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Fuad Tabba , 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 References: <20260830-gmem-inplace-conversion-v12-0-85e5fd25252a@google.com> <20260830-gmem-inplace-conversion-v12-12-85e5fd25252a@google.com> Content-Language: en-US From: Binbin Wu In-Reply-To: <20260830-gmem-inplace-conversion-v12-12-85e5fd25252a@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 8/31/2026 8:25 AM, Ackerley Tng via B4 Relay wrote: > From: Ackerley Tng > > If a guest_memfd memslot is created but the guest_memfd does not have the > GUEST_MEMFD_FLAG_MMAP set, KVM still fulfils guest faults by looking up the > memslot's userspace_addr. > > Set KVM_MEMSLOT_GMEM_ONLY if in-place conversion is enabled so that the > guest_memfd's memory will be used for both shared and private memory. With > in-place conversion, guest_memfd will be the only backing memory for the > memslot. > > No validation is performed to require userspace_addr to be a mapping from > the associated guest_memfd because even after validation, userspace is free > to remap something else at the provided userspace_addr. > > userspace_addr will still be used by functions like kvm_read_guest(), and > if userspace_addr does not match up with the corresponding memory in the > memslot's guest_memfd (whether userspace_addr points to the wrong offset or > some non-guest_memfd memory, etc), that is a user error. > > Requiring both shared and private memory to come from the only associated > guest_memfd simplifies invalidation in stage 2 page tables. On a PUNCH_HOLE > operation on a guest_memfd, the invalidation is now guaranteed to be > invalidating only memory mapped from the given guest_memfd. > > Suggested-by: Sean Christopherson > Signed-off-by: Ackerley Tng Reviewed-by: Binbin Wu