|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v5 9/9] xen: retrieve reserved pages on populate_physmap
On 31.05.2022 05:12, Penny Zheng wrote:
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -245,6 +245,29 @@ static void populate_physmap(struct memop_args *a)
>
> mfn = _mfn(gpfn);
> }
> + else if ( is_domain_using_staticmem(d) )
> + {
> + /*
> + * No easy way to guarantee the retrieved pages are
> contiguous,
> + * so forbid non-zero-order requests here.
> + */
> + if ( a->extent_order != 0 )
> + {
> + gdprintk(XENLOG_WARNING,
> + "Cannot allocate static order-%u pages for
> static %pd\n",
> + a->extent_order, d);
> + goto out;
> + }
> +
> + mfn = acquire_reserved_page(d, a->memflags);
> + if ( mfn_eq(mfn, INVALID_MFN) )
> + {
> + gdprintk(XENLOG_WARNING,
> + "%pd: failed to retrieve a reserved page\n",
> + d);
> + goto out;
> + }
> + }
I'm not convinced of having these gdprintk()s here. The adjacent
is_domain_direct_mapped() code is somewhat different - iirc only Dom0
can be direct-mapped, and Dom0 having a problem can certainly be worth
a log message.
> +/*
> + * 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;
> +
> + spin_lock(&d->page_alloc_lock);
> + /* Acquire a page from reserved page list(resv_page_list). */
> + page = page_list_remove_head(&d->resv_page_list);
> + if ( unlikely(!page) )
> + return INVALID_MFN;
> + spin_unlock(&d->page_alloc_lock);
You want to drop the lock before returning.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |