Re: [PATCH v5 05/22] x86/virt/seamldr: Retrieve P-SEAMLDR information

From: Kiryl Shutsemau

Date: Tue Mar 17 2026 - 06:06:03 EST


On Tue, Mar 17, 2026 at 09:05:50AM +0800, Chao Gao wrote:
> >> +
> >> +int seamldr_get_info(struct seamldr_info *seamldr_info)
> >> +{
> >> + /*
> >> + * Use slow_virt_to_phys() since @seamldr_info may be allocated on
> >> + * the stack.
> >> + */
> >> + struct tdx_module_args args = { .rcx = slow_virt_to_phys(seamldr_info) };
> >> +
> >> + return seamldr_call(P_SEAMLDR_INFO, &args);
> >
> >On what condition this information can change?
>
> After each update, the num_remaining_updates field will change.
>
> >
> >I see the next patch calls this on every _show operation. Would we
> >benefit from caching the response?
>
> Yes, caching would save a few cycles, but adds complexity. we'd need to keep
> the cache synchronized and invalidate it when values change, likely requiring
> additional state tracking.
>
> Dave recommended allocating the structure on the stack [*] when I raised the
> caching idea.
>
> This isn't a hot path, so I prefer keeping it "simple and stupid".

Fair enough.

Reviewed-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>

--
Kiryl Shutsemau / Kirill A. Shutemov