All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Penny Zheng <Penny.Zheng@arm.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Wei Chen <Wei.Chen@arm.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH v7 9/9] xen: retrieve reserved pages on populate_physmap
Date: Mon, 27 Jun 2022 11:54:14 +0100	[thread overview]
Message-ID: <724524cd-7cb1-4cb9-e636-7a5ea3d78a71@xen.org> (raw)
In-Reply-To: <DU2PR08MB732533C0E687B1A27417E54AF7B99@DU2PR08MB7325.eurprd08.prod.outlook.com>

Hi Penny,

On 27/06/2022 11:11, Penny Zheng wrote:
>> -----Original Message-----
>> From: Julien Grall <julien@xen.org>
>> Sent: Saturday, June 25, 2022 3:51 AM
>> To: Penny Zheng <Penny.Zheng@arm.com>; xen-devel@lists.xenproject.org
>> Cc: Wei Chen <Wei.Chen@arm.com>; Andrew Cooper
>> <andrew.cooper3@citrix.com>; George Dunlap <george.dunlap@citrix.com>;
>> Jan Beulich <jbeulich@suse.com>; Stefano Stabellini <sstabellini@kernel.org>;
>> Wei Liu <wl@xen.org>
>> Subject: Re: [PATCH v7 9/9] xen: retrieve reserved pages on
>> populate_physmap
>>
>> Hi Penny,
>>
>> On 20/06/2022 03:44, Penny Zheng wrote:
>>> When a static domain populates memory through populate_physmap at
>>> runtime, it shall retrieve reserved pages from resv_page_list to make
>>> sure that guest RAM is still restricted in statically configured memory
>> regions.
>>> This commit also introduces a new helper acquire_reserved_page to make
>> it work.
>>>
>>> Signed-off-by: Penny Zheng <penny.zheng@arm.com>
>>> ---
>>> v7 changes:
>>> - remove the lock, since we add the page to rsv_page_list after it has
>>> been totally freed.
>>
>> Hmmm... Adding the page after it has been totally freed doesn't mean you
>> can get away with the lock. AFAICT you can still have concurrent free/allocate
>> that could modify the list.
>>
>> Therefore if you add/remove pages without the list, you would end up to
>> corrupt the list.
>>
>> If you disagree, then please point out which lock (or mechanism) will prevent
>> concurrent access.
>>
> 
> Ok. Combined with the last serie comments, actually, you suggest that we need to add
> two locks, right?

We at least need the second lock (i.e. d->page_alloc_lock). The first 
lock (i.e.) may not be necessary if all the static memory are allocated 
for a domain. So you can guarantee ordering by adding to the resv_page_list.

Unless there are an ordering issue between the locks, I would for now 
suggest to keep both. We can refine this afterwards.

Cheers,

-- 
Julien Grall


      reply	other threads:[~2022-06-27 10:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  2:43 [PATCH v7 0/9] populate/unpopulate memory when domain on static allocation Penny Zheng
2022-06-20  2:44 ` [PATCH v7 1/9] xen/arm: rename PGC_reserved to PGC_static Penny Zheng
2022-06-20  2:44 ` [PATCH v7 2/9] xen: do not free reserved memory into heap Penny Zheng
2022-06-20  2:44 ` [PATCH v7 3/9] xen: update SUPPORT.md for static allocation Penny Zheng
2022-06-20  2:44 ` [PATCH v7 4/9] xen: do not merge reserved pages in free_heap_pages() Penny Zheng
2022-06-20  2:44 ` [PATCH v7 5/9] xen: add field "flags" to cover all internal CDF_XXX Penny Zheng
2022-06-20  2:44 ` [PATCH v7 6/9] xen/arm: introduce CDF_staticmem Penny Zheng
2022-06-22  9:12   ` Jan Beulich
2022-06-20  2:44 ` [PATCH v7 7/9] xen/arm: unpopulate memory when domain is static Penny Zheng
2022-06-22  9:24   ` Jan Beulich
2022-06-27 10:03     ` Penny Zheng
2022-06-27 10:19       ` Julien Grall
2022-06-29  3:12         ` Penny Zheng
2022-06-29  5:55           ` Jan Beulich
2022-06-29  6:08             ` Penny Zheng
2022-06-29  6:19               ` Jan Beulich
2022-06-29 10:49                 ` Julien Grall
2022-06-27 13:09       ` Jan Beulich
2022-06-20  2:44 ` [PATCH v7 8/9] xen: introduce prepare_staticmem_pages Penny Zheng
2022-06-20  2:44 ` [PATCH v7 9/9] xen: retrieve reserved pages on populate_physmap Penny Zheng
2022-06-22  9:26   ` Jan Beulich
2022-06-24 19:50   ` Julien Grall
2022-06-27 10:11     ` Penny Zheng
2022-06-27 10:54       ` Julien Grall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=724524cd-7cb1-4cb9-e636-7a5ea3d78a71@xen.org \
    --to=julien@xen.org \
    --cc=Penny.Zheng@arm.com \
    --cc=Wei.Chen@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.