[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v10 8/9] xen: retrieve reserved pages on populate_physmap
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Penny Zheng <Penny.Zheng@xxxxxxx>
- Date: Mon, 5 Sep 2022 07:08:45 +0000
- Accept-language: en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; 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=81EhxXJ+tLHvtuckNf5+P5UUedJHfF0Tr48WNZ+OcjM=; b=hw7QXHp0TVNuxawpetCkN4Mh63nEbkN7ZfkN+7yKwMm+h00SYf6YFt1dc2clRZpDHMzIoABtQEDBmzTL86GUVpLaQ0AoA7ZrcDKxPprHIr2WJVNEBRqu8BhyehJGgJ4dWALgcxRL8Cu/4lcGiOZI/7gQXaWG2c6QYSKrLlp6Cnsv6Y+2UyibCRsjYx+fn80dG4K4rTYntnE7DkbKmwzX3ZgigH5WcWxZB88MA3Vb5dQrK3jfQpnBPT/fuJwLtSpetIE/NZtFGqhyNDL1Hp+TCxxPl4x184Ur/sBfWxUUTRnHX4w0m2uJBgDgCQ34KZfcqK8/Rf9AXwFveXNGX4qaWQ==
- 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=81EhxXJ+tLHvtuckNf5+P5UUedJHfF0Tr48WNZ+OcjM=; b=MylNE34wSFtbNnG4cIZaldN9EcKiGEn2gSm5Ca7OZ3NN6YnUDunzgeW6c2Ef8SmsYJ53h2e7iMUM16l0BacFldYjSdOoFoLzcbgA/1Ak7Clsq99co0ulgWX7hktOtRX1hq1oQJ6XvMU2Vyc/xi8q278PI4HxCFlku3HyDk/UBi2GgsbT8R7R/m45TlFJun+1U1VjlJWT8dBl8k7weFl9qjh+Ug0cF9KPvhqRtMY+1sw9rL4Q6C1TRVzjJexW2nfaWjKTTliPM+JqCSInJ145wjkPydU8jhwNoXneyUhjxFRHuaKM+NYiC/neRwJ9AKX96bb1ghlLgw710Fnr+bjGJA==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=afvDgb6RuGwykpHzY0NTwO2rLsZU4YPbbMb4ze3imRXYc6imd0KJtFp0cENMXneEZJy1O+TWWkdqzyO1yYZ7+65F7i9DWXVW92T7p/gLDSbz0es22lsr/Iijt76wS+eMghsp+sX5xV8mcqhrMXgPsJsa6Wu9ZKLkWNno3UXWKkk6WPV/tDDnxLrVvAUEafDnqy4wOyEDmXG+6pkyQU//BDPuYJCAbz1OVWl7ocmsByWwE0LyIqcqnPWwAhBG6dp38OLFYVGEIUvjfObY7oktYXaRtCFKQ3dj9BP6X7E/7btZrw+cYpVZqjxsS/vcdB31xxJLoiqXuKgsDl3SAyuwPw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=du/jDcKlJjOcXFu1hZHFw9c9qGpvEEPrQcgjQItliHsIgjIljGvP0rvGBP/TQislTVkl7r8J4uluYXlbegz9ruW55spTwqcNBRCfxPPS2SbLE8Lc3uc0OEujfY4mywKO2+aw9dO4C5XTkXh8eN6jjcENxgYYgVrHSjTBBL7RfgKuReI8M0/j1Z60jvFavCvEMhT/qCi3MHw32QEBPrQUio/j2CndxMzzuRu5VA6XWvjBRVUTlT4XQCsPhk0WF7JTydkOHiSP2stFfX2IuSl2bfYzUsf776P1syNLphz9jOt5TauX+VgPMmXkpxQUpINZ9ohfcwBd0JV5HMMGFUSCYA==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Wei Chen <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" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Mon, 05 Sep 2022 07:09:08 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHYsRk4bhBJQxIp9UysK0xEJzOLuK2y32KAgB2pAvA=
- Thread-topic: [PATCH v10 8/9] xen: retrieve reserved pages on populate_physmap
Hi jan
> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Wednesday, August 17, 2022 6:05 PM
> To: Penny Zheng <Penny.Zheng@xxxxxxx>
> Cc: Wei Chen <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
> Subject: Re: [PATCH v10 8/9] xen: retrieve reserved pages on
> populate_physmap
>
> On 16.08.2022 04:36, Penny Zheng wrote:
> > @@ -2867,6 +2854,61 @@ int __init acquire_domstatic_pages(struct
> > domain *d, mfn_t smfn,
> >
> > return 0;
> > }
> > +
> > +/*
> > + * Acquire nr_mfns contiguous pages, starting at #smfn, of static
> > +memory,
> > + * then assign them to one specific domain #d.
> > + */
> > +int __init acquire_domstatic_pages(struct domain *d, mfn_t smfn,
> > + unsigned int nr_mfns, unsigned int
> > +memflags) {
> > + struct page_info *pg;
> > +
> > + ASSERT_ALLOC_CONTEXT();
> > +
> > + pg = acquire_staticmem_pages(smfn, nr_mfns, memflags);
> > + if ( !pg )
> > + return -ENOENT;
> > +
> > + if ( assign_domstatic_pages(d, pg, nr_mfns, memflags) )
> > + return -EINVAL;
> > +
> > + 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;
> > +
> > + ASSERT_ALLOC_CONTEXT();
> > +
> > + /* Acquire a page from reserved page list(resv_page_list). */
> > + spin_lock(&d->page_alloc_lock);
> > + page = page_list_remove_head(&d->resv_page_list);
> > + spin_unlock(&d->page_alloc_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_assign;
> > +
> > + return page_to_mfn(page);
> > +
> > + fail_assign:
> > + free_staticmem_pages(page, 1, memflags & MEMF_no_scrub);
>
> Doesn't this need to be !(memflags & MEMF_no_scrub)? And then - with
I got a bit confused about this flag MEMF_no_scrub, does it mean no need
to scrub?
Since I saw that in alloc_domheap_pages(...)
if ( assign_page(pg, order, d, memflags) )
{
free_heap_pages(pg, order, memflags & MEMF_no_scrub);
return NULL;
}
It doesn't contain exclamation mark too...
> assignment having failed and with it being just a single page we're talking
> about, the page was not exposed to the guest at any point afaict. So I don't
> see the need for scrubbing in the first place.
>
> Also I think the rename of the function would better be done first, since then
> you wouldn't need to touch this line again right in the next patch, and the
> prepare/unprepare pairing would also be visible right here. This would then
> also better fit with the introduction of prepare_*() in the previous patch
> (which, afaic, the name change could also be merged into; FTAOD I don't
> mind it to be separate).
>
> Jan
|