[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen: arm: invalidate caches after map_domain_page done



Hi Julien,

On Fri, Aug 1, 2014 at 5:01 PM, Julien Grall <julien.grall@xxxxxxxxxx> wrote:
>
>
> On 01/08/14 12:37, Andrii Tseglytskyi wrote:
>>>
>>> The page you are trying to map belongs to a guest, right? When the guest
>>> writes data in this page. Does it map with cacheable attribute or not? I
>>> suspect no.
>>
>>
>> Hard to say. This page is allocated using usual kernel API such as
>> kmalloc(). Then its pfn is stored in MMU 1-st level translation
>> pagetable.
>
>
> If it's allocated from kmalloc then the page is allocated with cacheable
> attribute.
>
>
>> Before storing - kernel driver flush corresponding cache ranges.
>
>
> Clean and invalidate the cache, right?
>

Looks like invalidate only. See my next comment.

>
>> After
>>
>> this - remoteproc_iommu framework translates pfns to mfns.
>> So - I would expect that after map_domain_page() function call all
>> data will be valid.
>
>
> Actually with your explanation me too. :)
>
> I'm run out of idea. Maybe Ian or Stefano have any clue.
>

Looks like I see where is the issue:
After mapping done kernel driver calls flush_tlb_all() function, which
just invalidates cache, it does the similar command, as the following
Xen macros:

#define DTLBIALL        p15,0,c8,c6,0   /* Invalidate data TLB */

Then after mapping done, remoteproc_iommu starts translation, calls
map_domain_page() -> flush_xen_data_tlb_range_va_local(),
which is described with following macros:

#define TLBIMVAH        p15,4,c8,c7,1   /* Invalidate Unified Hyp. TLB by MVA */

So, I got 2 invalidates and no cleans. And when I started using
clean_and_invalidate_xen_dcache_va_range() I got both:

#define DCCIMVAC        p15,0,c7,c14,1  /* Data cache clean and
invalidate by MVA */

I need both - clean and invalidate. If I don't have clean - data may
still present in cache and not flushed to RAM - I will see invalid
data after map_domain_page() call

>
>>>
>>> I think your current problem is the cache contains stall data. In this
>>> case
>>> you have to only invalidate the cache.
>>>
>>
>> May work. But it looks like new helper should be introduced in this
>> case. I see that only clean_and_invalidate_xen_dcache_va_range API is
>> present, no standalone API for invalidating only.
>
>
> You can add a new helper. I suspect it will be necessary sooner or later in
> other places.

I think wrapper which just cleans cache after map_domain_page() will
be good enough. Will check.

>
> Regards,
>
> --
> Julien Grall



-- 

Andrii Tseglytskyi | Embedded Dev
GlobalLogic
www.globallogic.com

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.