Re: [PATCH v4 03/16] x86/virt/tdx: Simplify tdmr_get_pamt_sz()
From: Edgecombe, Rick P
Date: Mon Nov 24 2025 - 14:48:16 EST
On Mon, 2025-11-24 at 17:26 +0800, Binbin Wu wrote:
> Reviewed-by: Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx>
Thanks.
>
> One nit below.
>
> [...]
> > @@ -535,26 +518,18 @@ static int tdmr_set_up_pamt(struct tdmr_info *tdmr,
> > * in overlapped TDMRs.
> > */
> > pamt = alloc_contig_pages(tdmr_pamt_size >> PAGE_SHIFT, GFP_KERNEL,
> > - nid, &node_online_map);
> > - if (!pamt)
> > + nid, &node_online_map);
> > + if (!pamt) {
> > + /*
> > + * tdmr->pamt_4k_base is zero so the
> > + * error path will skip freeing.
> > + */
> > return -ENOMEM;
> Nit:
> Do you think it's OK to move the comment up so to avoid multiple lines of
> comments as well as the curly braces?
Yea, I think that is a good point. But I'm also thinking that this comment is
not clear enough. There is no error path to speak of in this function, so maybe:
/*
* tdmr->pamt_4k_base is still zero so the error
* path of the caller will skip freeing the pamt.
*/
If you agree I will keep your RB.
>
> /* tdmr->pamt_4k_base is zero so the error path will skip freeing. */
> if (!pamt)
> return -ENOMEM;