Hi Jan > -----Original Message----- > From: Jan Beulich <[email protected]> > Sent: Tuesday, June 7, 2022 3:58 PM > To: Penny Zheng <[email protected]> > Cc: Wei Chen <[email protected]>; Andrew Cooper > <[email protected]>; George Dunlap <[email protected]>; > Julien Grall <[email protected]>; Stefano Stabellini <[email protected]>; > Wei > Liu <[email protected]>; [email protected] > Subject: Re: [PATCH v6 9/9] xen: retrieve reserved pages on populate_physmap > > On 07.06.2022 09:30, Penny Zheng wrote: > > +/* > > + * 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); > > + spin_unlock(&d->page_alloc_lock); > > With page removal done under lock, ... > > > + if ( unlikely(!page) ) > > + return INVALID_MFN; > > + > > + if ( !prepare_staticmem_pages(page, 1, memflags) ) > > + goto fail; > > + > > + if ( assign_domstatic_pages(d, page, 1, memflags) ) > > + goto fail; > > + > > + return page_to_mfn(page); > > + > > + fail: > > + page_list_add_tail(page, &d->resv_page_list); > > + return INVALID_MFN; > > ... doesn't re-adding the page to the list also need to be done with the lock > held?
True, Sorry about that. Like I said in another thread with Julien, I'll add the missing half part " For freeing part, I shall get the lock at arch_free_heap_page(), where we insert the page to the rsv_page_list, and release the lock at the end of the free_staticmem_page " > > Jan
