Re: [RFC PATCH v5 30/45] x86/virt/tdx: Add API to demote a 2MB mapping to 512 4KB mappings
From: Edgecombe, Rick P
Date: Tue Jun 30 2026 - 12:40:12 EST
On Tue, 2026-06-30 at 10:36 +0800, Yan Zhao wrote:
> > It feels kind of hacky. The refcount stuff is already a bit hard to follow.
> After demotion, there would be 512 4KB mappings for this 2MB range.
> Then, in later tdx_sept_remove_leaf_spte(), tdx_pamt_put() would be invoked
> for 512 times. That's why we need to set the refcount to 512 after a
> successful
> demotion here.
Oops, I thought I deleted it before I sent the mail. After thinking more, it
seems reasonable. But I didn't check it thoroughly with the other flows yet.