diff mbox series

[v4,2/6] x86 / p2m: remove page_list check in p2m_alloc_table...

Message ID 20200309093511.1727-3-paul@xen.org (mailing list archive)
State Superseded
Headers show
Series remove one more shared xenheap page: shared_info | expand

Commit Message

Paul Durrant March 9, 2020, 9:35 a.m. UTC
From: Paul Durrant <pdurrant@amazon.com>

... and replace with a check of domain_tot_pages().

The check of page_list prevents the prior allocation of PGC_extra pages,
whereas what the code is trying to verify is that the toolstack has not
already RAM for the domain.

Signed-off-by: Paul Durrant <paul@xen.org>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>

v4:
 - Re-worked so as not to completely remove the check

v2:
 - New in v2
---
 xen/arch/x86/mm/p2m.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jan Beulich March 9, 2020, 9:59 a.m. UTC | #1
On 09.03.2020 10:35, paul@xen.org wrote:
> From: Paul Durrant <pdurrant@amazon.com>
> 
> ... and replace with a check of domain_tot_pages().
> 
> The check of page_list prevents the prior allocation of PGC_extra pages,
> whereas what the code is trying to verify is that the toolstack has not
> already RAM for the domain.
> 
> Signed-off-by: Paul Durrant <paul@xen.org>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
preferably with "remove" in the subject replaced by the "replace"
currently at the beginning of the description. (It also looks as
if there was "allocated" or some such missing near the end of the
description.)

Jan
Paul Durrant March 9, 2020, 10:07 a.m. UTC | #2
> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: 09 March 2020 09:59
> To: paul@xen.org
> Cc: xen-devel@lists.xenproject.org; Paul Durrant <pdurrant@amazon.com>; Andrew Cooper
> <andrew.cooper3@citrix.com>; George Dunlap <george.dunlap@citrix.com>; Wei Liu <wl@xen.org>; Roger Pau
> Monné <roger.pau@citrix.com>
> Subject: Re: [PATCH v4 2/6] x86 / p2m: remove page_list check in p2m_alloc_table...
> 
> On 09.03.2020 10:35, paul@xen.org wrote:
> > From: Paul Durrant <pdurrant@amazon.com>
> >
> > ... and replace with a check of domain_tot_pages().
> >
> > The check of page_list prevents the prior allocation of PGC_extra pages,
> > whereas what the code is trying to verify is that the toolstack has not
> > already RAM for the domain.
> >
> > Signed-off-by: Paul Durrant <paul@xen.org>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thnaks.

> preferably with "remove" in the subject replaced by the "replace"
> currently at the beginning of the description. (It also looks as
> if there was "allocated" or some such missing near the end of the
> description.)
> 

Ok, I'll fix in v5.

  Paul
diff mbox series

Patch

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 3719deae77..9f51370327 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -695,8 +695,7 @@  int p2m_alloc_table(struct p2m_domain *p2m)
 
     p2m_lock(p2m);
 
-    if ( p2m_is_hostp2m(p2m)
-         && !page_list_empty(&d->page_list) )
+    if ( p2m_is_hostp2m(p2m) && domain_tot_pages(d) )
     {
         P2M_ERROR("dom %d already has memory allocated\n", d->domain_id);
         p2m_unlock(p2m);