On 18.04.2022 14:22, Penny Zheng wrote:
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -35,6 +35,10 @@
>  #include <asm/guest.h>
>  #endif
>  
> +#ifndef is_domain_static
> +#define is_domain_static(d) ((void)(d), false)
> +#endif

I think this might better live in a header. I wonder why you add it
though, considering ...

> @@ -245,6 +249,31 @@ static void populate_physmap(struct memop_args *a)
>  
>                  mfn = _mfn(gpfn);
>              }
> +#ifdef CONFIG_STATIC_MEMORY
> +            else if ( is_domain_static(d) )

... its use sits inside an #ifdef which ought to guarantee it's defined.
That said, even better would imo be if no new #ifdef-ary appeared here.

> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -2770,6 +2770,34 @@ int __init acquire_domstatic_pages(struct domain *d, 
> mfn_t smfn,
>  
>      return 0;
>  }
> +
> +/*
> + * Acquire a page from reserved page list(resv_page_list), when populating
> + * memory for static domain on runtime.
> + */
> +mfn_t acquire_reserved_page(struct domain *d, unsigned int memflags)
> +{
> +    struct page_info *page;
> +    mfn_t smfn;
> +
> +    /* Acquire a page from reserved page list(resv_page_list). */
> +    page = page_list_remove_head(&d->resv_page_list);
> +    if ( unlikely(!page) )
> +    {
> +        printk(XENLOG_ERR
> +               "%pd: failed to acquire a reserved page %"PRI_mfn".\n",
> +               d, mfn_x(page_to_mfn(page)));

"page" is NULL, so page_to_mfn(page) is meaningless.

Jan


Reply via email to