[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v8 9/9] xen: retrieve reserved pages on populate_physmap
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Penny Zheng <Penny.Zheng@xxxxxxx>
- Date: Mon, 18 Jul 2022 06:55:15 +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=c29vz3kTNv/RXNVhzO6kc8mAWheac5OoKcFAF1JWE4g=; b=GzlPZ/Df4CZ4074BpDFHwLInKvbDus2505VBvj5t1u63+SF0fTzH/2STpTrY5UblqVSutu/QwroSofEX4RM371TXN/fYft31Q9LNR+kQPJzkYSnSkID8mY/KK6swUTkNzFShAFpCi4JGFyyGHpsWGVbiWuHm0OYEF6kK/GZjJChK6l02+uTsKEzsGIwBZmTN2clnd6zH7h6m9gV/M1bDNn5Vlbf3qkqfioVQzjPg+saDHWpHca2i+TH35U4vzlMpoZJIrBJZ60mOmP3ubejDr2z815jyvnhPFiweS3VdLFjOLBHan9y3+uDngop3eGmcrJsIyov6VQFOqrmNxArn0g==
- 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=c29vz3kTNv/RXNVhzO6kc8mAWheac5OoKcFAF1JWE4g=; b=VN5shFLLgyCmZZJ480sIM2xxSwcOgPz9O60MjpqLmKO2mVS+1t0V7QAx5ZCWW0SGtB/StG2dMVRKgGewgouA8s7vief0ttQViJjHJUkDfCb4wKH6iyX6jN1/dmZp6La9Vv0kOjS0eG8hA6CS7KtLqEC/HJvSTgg9QMENpU7jiWWKizHJ1y1zPQWLc7Mzo2XykP7mMBlHeN1LaNVHvqqBc+8WXVC+/k+721mt0zTmicKJ72wfbvRrUPHioEdEGb2OgPlrx9HyQ9lXCwBdHC/AvKnCk+D/BXYm2hVKnwPvoIE5+pkbUaYbqO5EYjaY8ApOXyWlDAND4C928ynIFjI4UQ==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=hywb9ODP8k3Wy/wWyZV6lsDjAeiCjUEQiO6GsjySDWvK4h3HgGI3j12ag8WUu4AYwZJa/yFQs7ETVoJ2INPvzgN1mlAxTUuWiHyNKgfy6qd4tCBbjhvMKzqSB1NUA1O6+ElBJHufbJmlTSmrMM79HxIdIHcpLdaMFGF+ITvutmeDnxrcWHZzgfjo4KMnT2jyko8zPbAlaqVqRBy29NU9rJLw+D9SIHGIkWxIQ9+jby2hVGA2MnK/LHLluW+72uDcyFIfV505fesC8nn6qib5U3CFmErOByQ1AIlirdou3LzXU+bOEuHKu07NbEgKWT/awTgMvsf0d44QvXfkowaoog==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nyeF6tzaU65xy4rDjhweaZGgsPn2mus1A9DragFmecYzVlYV0AmDCpR5ZwOgEk9kBn/e/BHJ5mRYN2wQoSdxdxDVwIiUTC6V/6FVW1xn7OsOOPGfriChOzdD/Qkr3C8bh07WsaaMKbt1OXhTiVdWP0UDRscUhKtGReYoI6k7U5XeNpxg9xsti/RdM8RAowP8pDUhf5Byye46FImKrqfY5Run/GJBEt/3DPO//lypwJgGlANBnQ4suQAEXeSUEez+wtLwVqFoYBDbm7qZgQagZmoK1CA21mFrhEDy1NjLUhguSNS0iRP3ED8HLYgSErzM6sVV6hirr4P/6ukUIsJ2ig==
- 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, 18 Jul 2022 06:55:47 +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: AQHYkeNFlB68JC6RfEmkKZyT8Sz16q10c0gAgA9MCTA=
- Thread-topic: [PATCH v8 9/9] xen: retrieve reserved pages on populate_physmap
Hi Jan
> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Friday, July 8, 2022 9:06 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 v8 9/9] xen: retrieve reserved pages on
> populate_physmap
>
> On 07.07.2022 11:22, 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);
>
> I'm probably wrong in thinking that I did point out before that there's no
> real
> reason to have "static" twice in the message. Or am I mistaken in my
> understanding that only static domains can ever have static pages?
>
Sorry for omitting the comment, I'll only keep one static here.
You're right, only static domains can have static pages at the moment.
> > @@ -2818,6 +2805,55 @@ 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;
>
> Use ASSERT_ALLOC_CONTEXT() here as well?
>
Sure,
> > + /* 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;
>
> Don't you need to undo what this did if ...
>
> > + if ( assign_domstatic_pages(d, page, 1, memflags) )
> > + goto fail;
>
> ... this fails?
Yes, thanks for pointing out.
free_staticmem_pages is needed to do the reversal when it fails
>
> Jan
|