xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Andrii Tseglytskyi <andrii.tseglytskyi@globallogic.com>,
	xen-devel@lists.xen.org, Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Tim Deegan <tim@xen.org>
Subject: Re: [PATCH] xen: arm: invalidate caches after map_domain_page done
Date: Fri, 01 Aug 2014 10:23:20 +0100	[thread overview]
Message-ID: <53DB5C88.8030602@linaro.org> (raw)
In-Reply-To: <1406877914-31583-1-git-send-email-andrii.tseglytskyi@globallogic.com>

Hi Andrii,

On 01/08/14 08:25, Andrii Tseglytskyi wrote:
> In some cases, memory page returned by map_domain_page() contains
> invalid data. Issue is observed when map_domain_page() is used
> immediately after p2m_lookup() function, when random page of
> guest domain memory is need to be mapped to xen. Data on this
> already memory page may be not valid. Issue is fixed when
> caches are invalidated after mapping is done.
>
> Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@globallogic.com>
> ---
>   xen/arch/arm/mm.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 0a243b0..085780a 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -304,7 +304,7 @@ void *map_domain_page(unsigned long mfn)
>        * We may not have flushed this specific subpage at map time,
>        * since we only flush the 4k page not the superpage
>        */
> -    flush_xen_data_tlb_range_va_local(va, PAGE_SIZE);

Why did you remove the flush TLB? It's requirement to make sure the VA 
will pointed to the right PA.

> +    clean_and_invalidate_xen_dcache_va_range((void *)va, PAGE_SIZE);

This is not the right approach, map_domain_page is heavily used to map 
hypercall data page. Those pages must reside in normal inner-cacheable
memory. So cleaning the cache is useless and time consuming.

If you want to clean and invalidate the cache, even though I don't think 
this right by reading the commit message, you have to introduce a new 
helper.

>       return (void *)va;
>   }
>

Regards,

-- 
Julien Grall

  reply	other threads:[~2014-08-01  9:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  7:25 [PATCH] xen: arm: invalidate caches after map_domain_page done Andrii Tseglytskyi
2014-08-01  9:23 ` Julien Grall [this message]
2014-08-01 10:01   ` Andrii Tseglytskyi
2014-08-01 10:28     ` Julien Grall
2014-08-01 10:50       ` Andrii Tseglytskyi
2014-08-01 10:58         ` Julien Grall
2014-08-01 11:37           ` Andrii Tseglytskyi
2014-08-01 14:01             ` Julien Grall
2014-08-01 15:06               ` Andrii Tseglytskyi
2014-08-01 17:49                 ` Julien Grall
2014-08-01 18:54                   ` Andrii Tseglytskyi
2014-08-05 14:33                     ` 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=53DB5C88.8030602@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=andrii.tseglytskyi@globallogic.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@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).