xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Cc: tim@xen.org, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH 3/3] xen: arm: correctly handle removing a subset of a superpage mapping.
Date: Mon, 14 Jul 2014 19:34:08 +0100	[thread overview]
Message-ID: <53C422A0.5070405@linaro.org> (raw)
In-Reply-To: <1405355225-4623-3-git-send-email-ian.campbell@citrix.com>

Hi Ian,

On 07/14/2014 05:27 PM, Ian Campbell wrote:
> This can be exercised for example via ballooning which will remove 4K
> regions fromanywhere in the address space.

Missing space between "from" and "anywhere"

> 
> Reported-by: Julien Grall <julien.grall@linaro.org>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
>  xen/arch/arm/p2m.c |   29 +++++++++++++++++++++++++++--
>  1 file changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index a10cbaf..68a19bd 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -604,8 +604,33 @@ static int apply_one_level(struct domain *d,
>              return P2M_ONE_PROGRESS_NOP;
>          }
>  
> -        if ( level < 3 && p2m_table(orig_pte) )
> -            return P2M_ONE_DESCEND;
> +        if ( level < 3 )
> +        {
> +            if ( p2m_table(orig_pte) )
> +                return P2M_ONE_DESCEND;
> +
> +            if ( op == REMOVE &&
> +                 !is_mapping_aligned(*addr, end_gpaddr,
> +                                     0, /* maddr doesn't matter for remove */
> +                                     level_size) )
> +            {
> +                /*
> +                 * Removing a mapping from the middle of a superpage. Shatter
> +                 * and descend.
> +                 */
> +                *flush = true;
> +                rc = p2m_create_table(d, entry,
> +                                      level_shift - PAGE_SHIFT, flush_cache);
> +                if ( rc < 0 )
> +                    return rc;
> +
> +                p2m->stats.shattered[level]++;
> +                p2m->stats.mappings[level]--;
> +                p2m->stats.mappings[level+1] += LPAE_ENTRIES;
> +
> +                return P2M_ONE_DESCEND;
> +            }
> +        }

I would put the code below (which is only for level3) in the else part.
This will also remove now useless "if ( level == 3 )".

>          *flush = true;
>  
> 

Regards,

-- 
Julien Grall

  reply	other threads:[~2014-07-14 18:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 16:26 [PATCH 0/3] xen: arm: various p2m handling fixups Ian Campbell
2014-07-14 16:27 ` [PATCH 1/3] xen: arm: avoid reusing incorrect mappings when walking the p2m Ian Campbell
2014-07-14 18:17   ` Julien Grall
2014-07-15  9:36     ` Ian Campbell
2014-07-14 16:27 ` [PATCH 2/3] xen: arm: when ALLOCATING p2m entries maddr is meaningless Ian Campbell
2014-07-14 18:29   ` Julien Grall
2014-07-18 13:38     ` Ian Campbell
2014-07-14 16:27 ` [PATCH 3/3] xen: arm: correctly handle removing a subset of a superpage mapping Ian Campbell
2014-07-14 18:34   ` Julien Grall [this message]
2014-07-15  9:38     ` Ian Campbell
2014-07-15 12:13       ` Julien Grall
2014-07-18 12:51         ` Ian Campbell

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=53C422A0.5070405@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).