On Fri, Jan 13, 2023, Zhi Wang wrote: > On Thu, 12 Jan 2023 08:31:26 -0800 isaku.yamahata@xxxxxxxxx wrote: > > +static void tdx_reclaim_td_page(unsigned long td_page_pa) > > +{ > > + if (!td_page_pa) > > + return; > > + /* > > + * TDCX are being reclaimed. TDX module maps TDCX with HKID > > + * assigned to the TD. Here the cache associated to the TD > > + * was already flushed by TDH.PHYMEM.CACHE.WB before here, So > > + * cache doesn't need to be flushed again. > > + */ > > + if (WARN_ON(tdx_reclaim_page(td_page_pa, false, 0))) The WARN_ON() can go, tdx_reclaim_page() has WARN_ON_ONCE() + pr_tdx_error() in all error paths. > > + /* If reclaim failed, leak the page. */ > > Better add a FIXME: here as this has to be fixed later. No, leaking the page is all KVM can reasonably do here. An improved comment would be helpful, but no code change is required. tdx_reclaim_page() returns an error if and only if there's an unexpected, fatal error, e.g. a SEAMCALL with bad params, incorrect concurrency in KVM, a TDX Module bug, etc. Retrying at a later point is highly unlikely to be successful.