On Mon, 2025-05-19 at 14:39 +0800, Yan Zhao wrote: > > It sounds like Kirill is suggesting we do have to have demotion in the fault > > path. IIRC it adds a lock, but the cost to skip fault path demotion seems to > > be > > adding up. > Yes, though Kirill is suggesting to support demotion in the fault path, I > still > think that using tdx_gmem_private_max_mapping_level() might be more friendly > to > other potential scenarios, such as when the KVM core MMU requests TDX to > perform > page promotion, and TDX finds that promotion would consistently fail on a GFN. > > Another important reason for not passing a max_fault_level into the fault > struct > is that the KVM MMU now has the hook private_max_mapping_level to determine a > private fault's maximum level, which was introduced by commit f32fb32820b1 > ("KVM: x86: Add hook for determining max NPT mapping level"). We'd better not > to > introduce another mechanism if the same job can be accomplished via the > private_max_mapping_level hook. How about the alternative discussed on the thread with Kai? I don't think Kirill was suggesting #VE based TDs need huge pages, just that they need to work with 4k accepts. Let's continue the discussion on that thread, because I think they are all related. Once we conclude there we can iron out any remaining issues on this specific patch. > > The code in TDX huge page v8 [1][2] simply inherited the old implementation > from > its v1 [3], where the private_max_mapping_level hook had not yet been > introduced > for private faults.