[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v9 6/8] xen/arm: unpopulate memory when domain is static


  • To: Penny Zheng <Penny.Zheng@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 26 Jul 2022 08:43:56 +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=JodecHY5wlWk92we986JthwxWXbstFcsY1oybc9Sdqk=; b=PiYk1xr/Fyy2FAm9N1noMf7bH7NW4M+Lc9ub2zO+QbzqvAGA1Hf96oNCCHorqhkuxVdwVhPyBAfsEwcioyclTfjCWj6SafiMJVSXZ6VSPMc6wsFQQzMO+B0pNDcftEMG75UVcOmqSaQ6Dl4NgkM2Fps6m2/qL98mOz7i66IYFxXcLY0u0FxPIfTup8EdgrePn/pY0JZGn/IvMW0YeNmYs0ph+980uZFKvtFJ4WuToEUHTRtpS/w7c5CKQmODGNzhwRGXsxItpupn/83XAkHIp6rmIKuzvggP34GCqmRsSU0b9mAK0AK9UQ217x2Mqlk0ZNRURI3g2uV0q3542036dQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oMsUdrqHBBS+GlHzQ9Zn7IAR22Ac8GZwf4iYInjfuDzMUUNTusAnovwvpvZvGvPtkuVVt/o9Q00FhKnx17ioXzhH875sVVl6SXb17XOSgZJt67ZVlhUhucZ43BI9nQKqF2iahfUQIJkkmW6gotHSOj/uXH0TPtKkayhQU4RUJiBU5JEGk50j6cauJvAJmu2RrS5luHY//GS4mXcvw4rDiUQb5gJLW1nS2ESr1V4XhTLwNYTAaNUV7NvFOAOQFcLYVudBdOWse+pUpozhF6Yt2t6CpCHXXPcERMR19IVipbX/xIk34YqYAldiSU/Bu8MubUiTo+ZsQDv7uvUDzrVvmg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.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: Tue, 26 Jul 2022 06:44:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.07.2022 04:57, Penny Zheng wrote:
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@xxxxxxxx>
>> Sent: Monday, July 25, 2022 11:36 PM
>>
>> On 20.07.2022 07:46, Penny Zheng wrote:
>>> Today when a domain unpopulates the memory on runtime, they will
>>> always hand the memory back to the heap allocator. And it will be a
>>> problem if domain is static.
>>>
>>> Pages as guest RAM for static domain shall be reserved to only this
>>> domain and not be used for any other purposes, so they shall never go
>>> back to heap allocator.
>>>
>>> This commit puts reserved pages on the new list resv_page_list only
>>> after having taken them off the "normal" list, when the last ref dropped.
>>
>> I guess this wording somehow relates to ...
>>
>>> --- a/xen/common/page_alloc.c
>>> +++ b/xen/common/page_alloc.c
>>> @@ -2674,10 +2674,14 @@ void free_domstatic_page(struct page_info
>>> *page)
>>>
>>>      drop_dom_ref = !domain_adjust_tot_pages(d, -1);
>>>
>>> -    spin_unlock_recursive(&d->page_alloc_lock);
>>> -
>>>      free_staticmem_pages(page, 1, scrub_debug);
>>>
>>> +    /* Add page on the resv_page_list *after* it has been freed. */
>>> +    if ( !drop_dom_ref )
>>> +        page_list_add_tail(page, &d->resv_page_list);
>>
>> ... the conditional used here. I cannot, however, figure why there is this
>> conditional (and said part of the description also doesn't help me figure it
>> out).
>>
> 
> I was thinking that if drop_dom_ref true, then later the whole domain struct
> will be released, then there is no need to add the page to d->resv_page_list

If that was the intention, then it should have been spelled out imo. But I
think it's not a good idea to skip the list addition in that one special
case, when keeping things uniform is actually cheaper _and_ more consistent.
In the end I expect sooner or later there'll be a desire to restart DomU-s
which have crashed, which would include re-using their designated static
memory. Then you want to avoid leaking pages like it would happen with your
approach.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.