[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: Tue, 18 May 2021 09:51:25 +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=ACcCiPpJf1X/XpSp4DB6Km0XuczRENrQcuj3msIh8v0=; b=jFiVEUxR2I3jBQJC1fltHnpd7p31BpwcV2wkAkLJqZrQJ8zA8jaa43ADw6piCRxwwQSZmtvjqc1EXNei+VySvduuF89mA6GEbtd1iff79Y7Sv6UweY+NwNahE2RS5amBj+j9Goq4Nht/GBRS2zY7wAs7Mm22cxQ2WrGQXeOlueeQbJi86sWSQK/pCA1i8jaa2C4wFiE9up8LyWq7kGHUvJghJsinDgzt66H0d2bdUIT4AyhYP92+QXXuBspKFgq4ycWChlMHF9hqEiLpXH5PDIGwuql4BNfpI6lwOB9aRf3GIJYfr1w2LdB+XqEaJE613pjFfEo488K8EXQOQ5EALA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hky4kD/YGWCvBw/uMbIVSMLxLg5C9rVT/VN/I0H+z5xiyhxBNW2Lm/rAYlAA09hF2ABwXKaJSXzol8Y64RiNBuAEzWJrT/c2I9FmfGJjlafhZuSPWsz1gOaPBuK4Nvg9QE4FO0ekNawv51+istEi34r84IF9J7hFBCCw6KuohT00XskHPeudbB70NH84xWd8WOBFrCnX+Ti6pFQZkPP5P128OzpyRlAR7bpid2/qyO63fkXt0fkd1+Z2nBCtXqST/aMbL4B4IxmAafoCYCRgwl5gl1jIjRn9dPZwL9f8mPDHDFjea9wDl7XzmrzOuh7uHIMqAyjg7kikKVDiBdMpDQ==
  • 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: Tue, 18 May 2021 09:51:45 +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+kAgAAm7iA=
  • Thread-topic: [PATCH 04/10] xen/arm: static memory initialization

Hi Jan

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Tuesday, May 18, 2021 3:16 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 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.
Still, I need to add more explanation here.

> > --- a/xen/common/page_alloc.c
> > +++ b/xen/common/page_alloc.c
> > @@ -150,6 +150,9 @@
> >  #define p2m_pod_offline_or_broken_hit(pg) 0  #define
> > p2m_pod_offline_or_broken_replace(pg) BUG_ON(pg != NULL)  #endif
> > +#ifdef CONFIG_ARM_64
> > +#include <asm/setup.h>
> > +#endif
> 
> Whatever it is that's needed from this header suggests the code won't build
> for other architectures. I think init_staticmem_pages() in its current shape
> shouldn't live in this (common) file.
> 

Yes, I should include them all both under one specific config, maybe like
CONFIG_STATIC_MEM, and this config is arm-specific.

> > @@ -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.

> > +{
> > +    mfn_t mfn = page_to_mfn(pg);
> > +    int i;
> 
> This type doesn't fit nr_pfns'es.
> 

Sure, nr_mfns is better in also many other places.

> Jan

 


Rackspace

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