diff mbox

[v3] arm/p2m: Fix regression during domain shutdown with active mem_access

Message ID 20170125161201.20062-1-tamas.lengyel@zentific.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tamas Lengyel Jan. 25, 2017, 4:12 p.m. UTC
The change in commit 438c5fe4f0c introduced a regression for domains where
mem_acces is or was active. When relinquish_p2m_mapping attempts to clear
a page where the order is not 0 the following ASSERT is triggered:

    ASSERT(!p2m->mem_access_enabled || page_order == 0);

This regression was unfortunately not caught during testing in preparation
for the 4.8 release.

In this patch we adjust the ASSERT to not trip when the domain
is being shutdown.

Ideally this fix would be part of Xen 4.8.1.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
---
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Julien Grall <julien.grall@arm.com>

v3: Minor adjustments
---
 xen/arch/arm/p2m.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Julien Grall Jan. 25, 2017, 10:29 p.m. UTC | #1
Hi Tamas,

On 25/01/2017 16:12, Tamas K Lengyel wrote:
> The change in commit 438c5fe4f0c introduced a regression for domains where
> mem_acces is or was active. When relinquish_p2m_mapping attempts to clear
> a page where the order is not 0 the following ASSERT is triggered:
>
>     ASSERT(!p2m->mem_access_enabled || page_order == 0);
>
> This regression was unfortunately not caught during testing in preparation
> for the 4.8 release.
>
> In this patch we adjust the ASSERT to not trip when the domain
> is being shutdown.
>
> Ideally this fix would be part of Xen 4.8.1.

+1 for the backport.


>
> Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>

Acked-by: Julien Grall <julien.grall@arm.com>

Cheers,

> ---
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Julien Grall <julien.grall@arm.com>
>
> v3: Minor adjustments
> ---
>  xen/arch/arm/p2m.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index 09ceb378a5..7762f453f5 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -991,9 +991,10 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
>
>      /*
>       * The radix-tree can only work on 4KB. This is only used when
> -     * memaccess is enabled.
> +     * memaccess is enabled and during shutdown.
>       */
> -    ASSERT(!p2m->mem_access_enabled || page_order == 0);
> +    ASSERT(!p2m->mem_access_enabled || page_order == 0 ||
> +           p2m->domain->is_dying);
>      /*
>       * The access type should always be p2m_access_rwx when the mapping
>       * is removed.
>
Stefano Stabellini Jan. 27, 2017, 1:45 a.m. UTC | #2
On Wed, 25 Jan 2017, Julien Grall wrote:
> Hi Tamas,
> 
> On 25/01/2017 16:12, Tamas K Lengyel wrote:
> > The change in commit 438c5fe4f0c introduced a regression for domains where
> > mem_acces is or was active. When relinquish_p2m_mapping attempts to clear
> > a page where the order is not 0 the following ASSERT is triggered:
> > 
> >     ASSERT(!p2m->mem_access_enabled || page_order == 0);
> > 
> > This regression was unfortunately not caught during testing in preparation
> > for the 4.8 release.
> > 
> > In this patch we adjust the ASSERT to not trip when the domain
> > is being shutdown.
> > 
> > Ideally this fix would be part of Xen 4.8.1.
> 
> +1 for the backport.
> 
> 
> > 
> > Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
> 
> Acked-by: Julien Grall <julien.grall@arm.com>
> 

Done

> 
> > ---
> > Cc: Stefano Stabellini <sstabellini@kernel.org>
> > Cc: Julien Grall <julien.grall@arm.com>
> > 
> > v3: Minor adjustments
> > ---
> >  xen/arch/arm/p2m.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> > index 09ceb378a5..7762f453f5 100644
> > --- a/xen/arch/arm/p2m.c
> > +++ b/xen/arch/arm/p2m.c
> > @@ -991,9 +991,10 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
> > 
> >      /*
> >       * The radix-tree can only work on 4KB. This is only used when
> > -     * memaccess is enabled.
> > +     * memaccess is enabled and during shutdown.
> >       */
> > -    ASSERT(!p2m->mem_access_enabled || page_order == 0);
> > +    ASSERT(!p2m->mem_access_enabled || page_order == 0 ||
> > +           p2m->domain->is_dying);
> >      /*
> >       * The access type should always be p2m_access_rwx when the mapping
> >       * is removed.
> > 
> 
> -- 
> Julien Grall
>
diff mbox

Patch

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 09ceb378a5..7762f453f5 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -991,9 +991,10 @@  static int __p2m_set_entry(struct p2m_domain *p2m,
 
     /*
      * The radix-tree can only work on 4KB. This is only used when
-     * memaccess is enabled.
+     * memaccess is enabled and during shutdown.
      */
-    ASSERT(!p2m->mem_access_enabled || page_order == 0);
+    ASSERT(!p2m->mem_access_enabled || page_order == 0 ||
+           p2m->domain->is_dying);
     /*
      * The access type should always be p2m_access_rwx when the mapping
      * is removed.