diff mbox

[For,Xen-4.10,RFC,2/3] arm: p2m: Prevent redundant icache flushes

Message ID 20170331102424.11869-3-punit.agrawal@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Punit Agrawal March 31, 2017, 10:24 a.m. UTC
When toolstack requests flushing the caches, flush_page_to_ram() is
called for each page of the requested domain. This needs to unnecessary
icache invalidation operations.

Let's take the responsibility of performing icache operations and use
the recently introduced flag to prevent redundant icache operations by
flush_page_to_ram().

Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
---
 xen/arch/arm/p2m.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Stefano Stabellini March 31, 2017, 11:54 p.m. UTC | #1
On Fri, 31 Mar 2017, Punit Agrawal wrote:
> When toolstack requests flushing the caches, flush_page_to_ram() is
> called for each page of the requested domain. This needs to unnecessary
> icache invalidation operations.
> 
> Let's take the responsibility of performing icache operations and use
> the recently introduced flag to prevent redundant icache operations by
> flush_page_to_ram().
> 
> Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/arch/arm/p2m.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index 76cd1c34f3..8136522ed8 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -1400,13 +1400,15 @@ int p2m_cache_flush(struct domain *d, gfn_t start, unsigned long nr)
>          /* XXX: Implement preemption */
>          while ( gfn_x(start) < gfn_x(next_gfn) )
>          {
> -            flush_page_to_ram(mfn_x(mfn), true);
> +            flush_page_to_ram(mfn_x(mfn), false);
>  
>              start = gfn_add(start, 1);
>              mfn = mfn_add(mfn, 1);
>          }
>      }
>  
> +    invalidate_icache();
> +
>      p2m_read_unlock(p2m);
>  
>      return 0;
> -- 
> 2.11.0
>
Punit Agrawal April 3, 2017, 10:45 a.m. UTC | #2
Hi Stefano,

Stefano Stabellini <sstabellini@kernel.org> writes:

> On Fri, 31 Mar 2017, Punit Agrawal wrote:
>> When toolstack requests flushing the caches, flush_page_to_ram() is
>> called for each page of the requested domain. This needs to unnecessary
>> icache invalidation operations.
>> 
>> Let's take the responsibility of performing icache operations and use
>> the recently introduced flag to prevent redundant icache operations by
>> flush_page_to_ram().
>> 
>> Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
>
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Thanks for the review and comments on the other patches. I've now
addressed them locally.

I'll wait to see if there are anymore comments before posting an update.

Regards,
Punit

>
>
>> ---
>>  xen/arch/arm/p2m.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
>> index 76cd1c34f3..8136522ed8 100644
>> --- a/xen/arch/arm/p2m.c
>> +++ b/xen/arch/arm/p2m.c
>> @@ -1400,13 +1400,15 @@ int p2m_cache_flush(struct domain *d, gfn_t start, unsigned long nr)
>>          /* XXX: Implement preemption */
>>          while ( gfn_x(start) < gfn_x(next_gfn) )
>>          {
>> -            flush_page_to_ram(mfn_x(mfn), true);
>> +            flush_page_to_ram(mfn_x(mfn), false);
>>  
>>              start = gfn_add(start, 1);
>>              mfn = mfn_add(mfn, 1);
>>          }
>>      }
>>  
>> +    invalidate_icache();
>> +
>>      p2m_read_unlock(p2m);
>>  
>>      return 0;
>> -- 
>> 2.11.0
>>
diff mbox

Patch

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 76cd1c34f3..8136522ed8 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1400,13 +1400,15 @@  int p2m_cache_flush(struct domain *d, gfn_t start, unsigned long nr)
         /* XXX: Implement preemption */
         while ( gfn_x(start) < gfn_x(next_gfn) )
         {
-            flush_page_to_ram(mfn_x(mfn), true);
+            flush_page_to_ram(mfn_x(mfn), false);
 
             start = gfn_add(start, 1);
             mfn = mfn_add(mfn, 1);
         }
     }
 
+    invalidate_icache();
+
     p2m_read_unlock(p2m);
 
     return 0;