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 01FD73B6BFF for ; Tue, 25 Aug 2026 18:55:57 +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=1787684160; cv=none; b=cpl6PMUwxVy2gRQiBUXLVkzcNDEOWYgkiPHP/NkhiuH7GUcyQyVbFLHLx5YwICvBxs5JWGOwuSHVtIFnRAlE4NyAC9Rn38wuEFNJsmDYzyOToV6qfDnKl+pjLig2KXYL/7OXrjMyFhORVwaRKHMcTKnVL9nyHV+vX1UJCap1Lss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787684160; c=relaxed/simple; bh=v81i0R08OhPbKwodLqy3PT8ECRERns8YsJia2mMgPmU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=PHO8jAWaHoFheKW/GHmGdJgW6J5SV91EcPWggifGttWaWAOYkzWihiB1VuHakAwR146U1G3nyljK30SPAysRCtqdanC9SXZkYhACq3VN9IZY4IGoPEJjf+N0Ib6KLfP5ehreqkAe+VwxoE4FOpkz5GNmldeM0S6jxGGJW+iLMpg= 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=W266J65T; 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="W266J65T" Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2ce7dff6253so12280155ad.1 for ; Tue, 25 Aug 2026 11:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1787684155; x=1788288955; darn=lists.linux.dev; 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=xccKXo6SW1SbkIzehhqjd8J3GgWcAs1E82/+Xs14ta0=; b=W266J65TvTUAku/Zi0ZbkwXoc0kDBYMG6g6MxyNyI8pCjePbSqn/egZxVS+jIVKg6f sAOAQ8bS2O66rc6KWhSM0Rd+PzQqMClBs+ixXN8tA7j/wINu99m8E2bTgNcp1NXbpPva X6gwk7YdJt8csO35ueNJpmrypbTHWTiQZq9fE0hbUF040TvjhtNCvxKRoFTWkWUj7G1b 7mffu8UI4mFuJRPBK8P1sHrAGar/LGcPzeeS1r6Idl80NG6ZPdfb4xwiEMRHvct6tNv8 HBjwXcZ/fx+yadM2X3BHKE2QTUqqncZAje+fTzz4RByjFK8vGAFbQzd+au4y9AVUxnwP gsxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787684155; x=1788288955; 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=xccKXo6SW1SbkIzehhqjd8J3GgWcAs1E82/+Xs14ta0=; b=jq2WajqnfKN3lmoNb7dRZFaUpDmV/3FLEejQffGHuYGXaLpg33MGsTsyFrePFp7kf5 Awsl0tliY/uD+Paq/1qxxJb+wtjtShXpJtEodl+Cuu0FPAJHBXU8dW4hm2vi8xO1ihjW j33pW9OY6l8CAPHGHpje6JKAPot32pg4glg503MG+Cpp2HvXnmXLx8mB3U0bsXMcU93j ZWjXvyk9vbI0RuD0oWKfN3gxEwAStWgBTY3Dyb+kf4O55UKfXy9Ouh0aXpZBkop2qjzw lkvP9QMKnKgRgQBwcoP/raL0rR0H28H91ZpM/o4tpY8IbK6ZuIJyltCP00znvy4wTCmI xiuA== X-Forwarded-Encrypted: i=1; AHgh+RqEttB2d2OmfQEdDAkBYKuy+xFunglXGBtwAneFsy6D+7Uy0mftqmv+lZ6C1NeJ1JxZeTvNMOi3H+N4@lists.linux.dev X-Gm-Message-State: AFuF++nwU/9GEClZeKv1+ZIHHX/Sn8A6/5aSXDpX/0IBmdCj+a7vElto mRuWGAlPcLXubRmOmFHM+8Buwlk5vkE5Pwoa410yH8qxMTuAUzh35FzDTEEIl6gD36H4DQq9jgk vDKBsGA== X-Received: from pgbdm4.prod.google.com ([2002:a05:6a02:d84:b0:c79:39f0:12f2]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:1398:b0:3bf:8de9:c64e with SMTP id adf61e73a8af0-3ceed381cdcmr1617377637.2.1787684154733; Tue, 25 Aug 2026 11:55:54 -0700 (PDT) Date: Tue, 25 Aug 2026 11:55:54 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev 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-9-2fc18ee6d3ba@google.com> <13ca60c6-e154-4397-8092-09f861e90fe0@kernel.org> <7eba513d-cdae-4832-abac-038dcdd88517@intel.com> Message-ID: Subject: Re: [PATCH v10 09/41] KVM: guest_memfd: Filter both shared and private when invalidating From: Sean Christopherson To: Michael Roth Cc: Xiaoyao Li , Ackerley Tng , Suzuki K Poulose , "David Hildenbrand (Arm)" , 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, 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, 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 Content-Type: text/plain; charset="us-ascii" On Tue, Aug 25, 2026, Michael Roth wrote: > On Wed, Aug 26, 2026 at 12:13:47AM +0800, Xiaoyao Li wrote: > > On 8/20/2026 9:32 AM, Sean Christopherson wrote: > > > And vice versa, a PUNCH_HOLE on a SHARED gmem (if userspace is > > > using an INIT_SHARED gmem for the shared branch of a memslot) could invalidate the > > > PRIVATE mappings (of a different gmem instance). > > > > I'm wondering now how this could happen. > > > > the requirement for PUNCH_HOLE on gmem to trigger mapping invalidation is > > the gmem is bound with the memslot. But how can a memslot bound with two > > gmem instances? > > I think this is for when userspace uses an mmap'able guest_memfd instance > to handle shared memory, and a 'normal' guest_memfd instance for private > memory. Each instance is bound to the same memslot/GPA range, and > KVM_SET_MEMORY_ATTRIBUTES handles switching between the 2. Yep, exactly.