[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 9/9] xen: retrieve reserved pages on populate_physmap
- To: Penny Zheng <Penny.Zheng@xxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Tue, 7 Jun 2022 09:58:15 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hP7yVvo9zlakhizZ+biJ02m01sYJKs/TzFLtYZT6wO0=; b=T4SX2H2rbi+9odP3pmFGiup7/7DWoJDG4eje1ZMZ/as+NxQ4ywci94+IsKExBAlc5fp51Dp5VRW6ki1L5gDqFokrYqBKweowb3VLgcuKuytxepg01ZCc2BN99AEWExcU0Z8ac0QoSqneDlmvnmJaJXz5RkDX6iYxzC+2qsN0zFWggJ0+JqAfQCdiubtj0eHqJ65cgJwErrH44TXMfiZF571GhRtzJ70hs7U2WNzyb3YTPWtrCHt9m8Obgidjixg8ggiFbJZkukyTuyCg0Q0NgJqySzSEAfH/Zffq/jjC7hHDB3Ye0kdC0M794THCNo+dHByGXdhuMdZuceOoxp4lFA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Efj7rFc6WExoH0YcStL7WLDd6E56KopzDTv+8ntv+GGM3BuJKHr7HQTPuygTP41O+pTskS3+Xs+jsAj5XnPxg0L879a/GBMN0Qj2rq96nhCGKkSWhrNjdR6wJpgypMNJ/PtsQRhKyDsx+D6e1cdrJua6kPs9LvUjk4pPGWePFy3KshJSy53/QRrm/9Ft0IxFICrM07mBOC/XbUkBf8V5fkoQRI9dwngOqs+sIVvBrpyyxGRSf9f2YTMDEe9UVGz5dHzjj5oOZOqQqTX5YWoA44jgz9BVYim2RtwnVGrU1NGXnZstFoNLQQSc1QsRhT6WKnz3A/SWmKv4sXd8HDWzLg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: wei.chen@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Tue, 07 Jun 2022 07:58:22 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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?
Jan
|