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

RE: [PATCH 04/10] xen/arm: static memory initialization


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Thu, 20 May 2021 09:04:15 +0000
  • Accept-language: en-US
  • 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=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-SenderADCheck; bh=bwPz95NhtCV37vbe+vi/Qn9VoI07rjzr2lu7RSjYEfk=; b=REy8WCaX3RaaqzOzggj3EOaGWBgqSZJt/q3eBTuma/yomoTIRMbgFj87fDsDAZepNK2h96dm1FnUiddvAwG7Y9QNotVbm8/Ug9twHlT3P8cire1KQiVnAb7h9vWuXkj8uV5idFtI9Gc/LKkku/HqW4R/AvTxsMXjgJvq31rxX2GNEX64r8zzVcQhO1yPV95mOvy5MtVT4pgSPygBGtPn2sYQp3qtSX5bD48KPpTTJDmGq0cdB0I5DUyy0KXLX07PBkEmzmUeOhykxAbuXfgmMi/48CwHFL7fZO4nD9tZ1YfzWtz4ADuGcUhENHpiTb0KiXvJD9POFyILfzvhuY4AYQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=buU7t/fXWLKqWsCEaf5y86A4wotaB9wvLGh9iiPyiHqUjw0EISCdvodxX+jVdr/xt/kjGkDXHdm7cKMZF2kyUNhC9zExuzQhWpi1QH5IMWKzAenP0L445gymV6hW+MHKgfRWoRj/A47ggyDl/QT1T3f9Tx2N5bw0MlIK020HDgk5migL49LmOjQE8KpeUOqEQjmsjiEmpLW4YJsJ6u9hq2xOaPD+Ak+RDjGEIivQIlN70Q1GBpYE0TRyxlARC7+/p26ikkdSoAqvn4ptMAXK0jg1Vo3Sg4lCo2emLpQS6st2FaKuTNq2s7fuVvlZvsMApZiGRmg+1XTPIhK7N3F1Cw==
  • Authentication-results-original: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, nd <nd@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>
  • Delivery-date: Thu, 20 May 2021 09:04:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXS6WzoKPo0e3K4EKgzRPDOGKP8Kro0+kAgAAm7iCAABMkgIADBSKg
  • Thread-topic: [PATCH 04/10] xen/arm: static memory initialization

Hi Jan

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Tuesday, May 18, 2021 6:43 PM
> To: Penny Zheng <Penny.Zheng@xxxxxxx>
> Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>; Wei Chen
> <Wei.Chen@xxxxxxx>; nd <nd@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx;
> sstabellini@xxxxxxxxxx; julien@xxxxxxx
> Subject: Re: [PATCH 04/10] xen/arm: static memory initialization
> 
> On 18.05.2021 11:51, Penny Zheng wrote:
> >> From: Jan Beulich <jbeulich@xxxxxxxx>
> >> Sent: Tuesday, May 18, 2021 3:16 PM
> >>
> >> On 18.05.2021 07:21, Penny Zheng wrote:
> >>> This patch introduces static memory initialization, during system
> >>> RAM boot
> >> up.
> >>>
> >>> New func init_staticmem_pages is the equivalent of init_heap_pages,
> >>> responsible for static memory initialization.
> >>>
> >>> Helper func free_staticmem_pages is the equivalent of
> >>> free_heap_pages, to free nr_pfns pages of static memory.
> >>> For each page, it includes the following steps:
> >>> 1. change page state from in-use(also initialization state) to free
> >>> state and grant PGC_reserved.
> >>> 2. set its owner NULL and make sure this page is not a guest frame
> >>> any more
> >>
> >> But isn't the goal (as per the previous patch) to associate such
> >> pages with a _specific_ domain?
> >>
> >
> > Free_staticmem_pages are alike free_heap_pages, are not used only for
> initialization.
> > Freeing used pages to unused are also included.
> > Here, setting its owner NULL is to set owner in used field NULL.
> 
> I'm afraid I still don't understand.
> 

When initializing heap, xen is using free_heap_pages to do the initialization.
And also when normal domain get destroyed/rebooted, xen is using 
free_domheap_pages,
which calls free_heap_pages to free the pages.

So here, since free_staticmem_pages is the equivalent of the free_heap_pages 
for static
memory, I'm also considering both two scenarios here. And if it is domain get 
destroyed/rebooted,
Page state is in inuse state(PGC_inuse), and the page_info.v.inuse.domain is 
holding the
domain owner.
When freeing then, we need to switch the page state to free state(PGC_free) and 
set its inuse owner to NULL.

I'll clarify it more clearly in commit message.

> > Still, I need to add more explanation here.
> 
> Yes please.
> 
> >>> @@ -1512,6 +1515,49 @@ static void free_heap_pages(
> >>>      spin_unlock(&heap_lock);
> >>>  }
> >>>
> >>> +/* Equivalent of free_heap_pages to free nr_pfns pages of static
> >>> +memory. */ static void free_staticmem_pages(struct page_info *pg,
> >> unsigned long nr_pfns,
> >>> +                                 bool need_scrub)
> >>
> >> Right now this function gets called only from an __init one. Unless
> >> it is intended to gain further callers, it should be marked __init itself 
> >> then.
> >> Otherwise it should be made sure that other architectures don't
> >> include this (dead there) code.
> >>
> >
> > Sure, I'll add __init. Thx.
> 
> Didn't I see a 2nd call to the function later in the series? That one doesn't
> permit the function to be __init, iirc.
> 
> Jan

Cheers

Penny

 


Rackspace

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