From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (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 602CD307494 for ; Tue, 6 Jan 2026 21:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767735522; cv=none; b=s249ZyIJfcbZRc1FLpyzZvxCM2t7coLxZ7o/zJfHHrQPrHJHhcAFB2nZaZTU3y9BHViapu+KCFQiZKv5B/sXNPR6mWKSvOc3l5ulU8JzBIE7ADotAp+OMgLcmkl/H8xicUqsqSU/AyLofqPGQ/XbljIVpATxHfjZkMq/LCtHiOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767735522; c=relaxed/simple; bh=J7kkeY+hAmd8ZJE+y/yQQSRW9C3r05g/nEqKrrOm59o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ExewvrzJIg7O4JwfsYsMRyWow/o5V8L4dLZR+G5NgcUI6oKQ0bQW0YdLLlH3J4ZBXVNpwIKJ2hqJHzBG4B+9IowlPf5bOwSGd7lhkp9CWQAOBbY9Gmu2K/jqs/zxkmu1rY/VnCxlSLdBOdvdZrKIo/CtCv3bUCNVfY8fjG1WTfQ= 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=yXj/DqNJ; arc=none smtp.client-ip=209.85.210.202 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="yXj/DqNJ" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-81b299128b8so310076b3a.1 for ; Tue, 06 Jan 2026 13:38:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767735521; x=1768340321; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=50uasNaeRc9hCyxVG7sj5DtGwxMSQDJAHl63m0HDP5g=; b=yXj/DqNJI2Wj9SlKVesykbuJPGt6GXfomAdgRu2lW1k0pPppc753bHXTC/TN33dOaF UpXhiD9O3wsTiCkEyZI8acK3OXJfLxtcFGBDqgFIDoiSypRsb0gEBgtXu2AtE6JxL9xu PxRx1gfjyiQspVMaaGUitMVoT5VfaVmWNsZ7lVQiDpaXZeTTFOFQvm0rreEd3GmHoM+b /Phy2FJdNpUW+yKk+ufdnQ0L4wKH92m+ZWD4+HWbmvOUj8rG8btwieAJQZeHJfxB0gK8 cWwEptFcsJ2veG94Udhm1RACs22CXYk4zdesJVE/9OphUReyyIi0RTODJDVoLEzLIGuN ilqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767735521; x=1768340321; h=content-transfer-encoding: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=50uasNaeRc9hCyxVG7sj5DtGwxMSQDJAHl63m0HDP5g=; b=cAvAUoH7qYrPmYxairaxT5TxVqWVyOckFa/jGzGVd1dGGJzEYhqo7UHI2GTWKhHKEd Avnf5ej2uCGLw7E5p+lm47qCdUoSH8urvlyxjF+vFm5L1IPZwBashKfKX2oWqeVJEPba lMhTzkT1o23ZZjVkggRZY0V88fPFViwQ8Awl+YyhdAnaDzXS9mtUu0xxFsMhYflZ6kt5 X9zh67KoEiTJcg5QV55S5FajA8ziaRA00QatjxDVAzoWVbBFWY1ppNHq2wthxvTZHY1g KeRrukCwNCnmqgKCVZ2x+WqdynB+nMPK0Fx3q0NKg3IqCLNDJEOTTE2xNwutl2WTDI4O JT+Q== X-Forwarded-Encrypted: i=1; AJvYcCUBTopQVQaWjxDEK9+px+phxZEKtvreSLn5Lu1tl2veTvXHdFl4oLnnBxUz2KqyO+bWq/7+dSBsfwq3TYI=@vger.kernel.org X-Gm-Message-State: AOJu0YxPlTYaRVkqcjrWMpBoehVqJ6fcUrTXUDjSgLduc0kuoMswiHrF ka4ScYqp/jE2Vf+xAvphqsltml07XFadJL0T6fWMrEQBlCSsdjyo1Gwc50M3AC48NHF+16+mbzf uv+rsnA== X-Google-Smtp-Source: AGHT+IF+J0Gou9Jb6Tj1TDLI/Yg74+cghYLKcJ8f4D9z+OGLD50JSyYPIIKIVG/K1dduNczGyWLQlIfl6fw= X-Received: from pfnx22.prod.google.com ([2002:aa7:84d6:0:b0:812:1701:e769]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:a111:b0:7e8:4471:8d4 with SMTP id d2e1a72fcca58-81b7f6e4fe6mr422971b3a.53.1767735520683; Tue, 06 Jan 2026 13:38:40 -0800 (PST) Date: Tue, 6 Jan 2026 13:38:39 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260106101646.24809-1-yan.y.zhao@intel.com> Message-ID: Subject: Re: [PATCH v3 00/24] KVM: TDX huge page support for private memory From: Sean Christopherson To: Ackerley Tng Cc: Vishal Annapurve , Yan Zhao , pbonzini@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, rick.p.edgecombe@intel.com, dave.hansen@intel.com, kas@kernel.org, tabba@google.com, michael.roth@amd.com, david@kernel.org, sagis@google.com, vbabka@suse.cz, thomas.lendacky@amd.com, nik.borisov@suse.com, pgonda@google.com, fan.du@intel.com, jun.miao@intel.com, francescolavra.fl@gmail.com, jgross@suse.com, ira.weiny@intel.com, isaku.yamahata@intel.com, xiaoyao.li@intel.com, kai.huang@intel.com, binbin.wu@linux.intel.com, chao.p.peng@intel.com, chao.gao@intel.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tue, Jan 06, 2026, Ackerley Tng wrote: > Vishal Annapurve writes: >=20 > > On Tue, Jan 6, 2026 at 2:19=E2=80=AFAM Yan Zhao = wrote: > >> > >> - EPT mapping size and folio size > >> > >> This series is built upon the rule in KVM that the mapping size in t= he > >> KVM-managed secondary MMU is no larger than the backend folio size. > >> >=20 > I'm not familiar with this rule and would like to find out more. Why is > this rule imposed?=20 Because it's the only sane way to safely map memory into the guest? :-D > Is this rule there just because traditionally folio sizes also define the > limit of contiguity, and so the mapping size must not be greater than fol= io > size in case the block of memory represented by the folio is not contiguo= us? Pre-guest_memfd, KVM didn't care about folios. KVM's mapping size was (and= still is) strictly bound by the host mapping size. That's handles contiguous add= resses, but it _also_ handles contiguous protections (e.g. RWX) and other attribute= s. > In guest_memfd's case, even if the folio is split (just for refcount > tracking purposese on private to shared conversion), the memory is still > contiguous up to the original folio's size. Will the contiguity address > the concerns? Not really? Why would the folio be split if the memory _and its attributes= _ are fully contiguous? If the attributes are mixed, KVM must not create a mappi= ng spanning mixed ranges, i.e. with multiple folios.