[Xen-devel] [PATCH v3 2/6] x86 / p2m: remove page_list check in p2m_alloc_table

pdurrant@amzn.com posted 6 patches 5 years, 11 months ago
There is a newer version of this series
[Xen-devel] [PATCH v3 2/6] x86 / p2m: remove page_list check in p2m_alloc_table
Posted by pdurrant@amzn.com 5 years, 11 months ago
From: Paul Durrant <pdurrant@amazon.com>

There does not seem to be any justification for refusing to create the
domain's p2m table simply because it may have assigned pages. Particularly
it prevents the prior allocation of PGC_extra pages.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
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>

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

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 3719deae77..9fd4b115be 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -695,14 +695,6 @@ int p2m_alloc_table(struct p2m_domain *p2m)
 
     p2m_lock(p2m);
 
-    if ( p2m_is_hostp2m(p2m)
-         && !page_list_empty(&d->page_list) )
-    {
-        P2M_ERROR("dom %d already has memory allocated\n", d->domain_id);
-        p2m_unlock(p2m);
-        return -EINVAL;
-    }
-
     if ( pagetable_get_pfn(p2m_get_pagetable(p2m)) != 0 )
     {
         P2M_ERROR("p2m already allocated for this domain\n");
-- 
2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v3 2/6] x86 / p2m: remove page_list check in p2m_alloc_table
Posted by Jan Beulich 5 years, 11 months ago
On 05.03.2020 13:45, pdurrant@amzn.com wrote:
> From: Paul Durrant <pdurrant@amazon.com>
> 
> There does not seem to be any justification for refusing to create the
> domain's p2m table simply because it may have assigned pages.

I think there is: If any such allocation had happened before, how
would it be represented in the domain's p2m?

> Particularly
> it prevents the prior allocation of PGC_extra pages.

That's unfortunate, but will need taking care of differently then:

> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -695,14 +695,6 @@ int p2m_alloc_table(struct p2m_domain *p2m)
>  
>      p2m_lock(p2m);
>  
> -    if ( p2m_is_hostp2m(p2m)
> -         && !page_list_empty(&d->page_list) )
> -    {
> -        P2M_ERROR("dom %d already has memory allocated\n", d->domain_id);
> -        p2m_unlock(p2m);
> -        return -EINVAL;
> -    }

Instead of checking the list to be empty, how about checking
domain_tot_pages() to return zero?

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel