linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/powernv/memtrace: Fix dcache flushing
@ 2021-04-30  7:55 Sandipan Das
  2021-04-30  8:03 ` Aneesh Kumar K.V
  2021-04-30  8:42 ` Christophe Leroy
  0 siblings, 2 replies; 4+ messages in thread
From: Sandipan Das @ 2021-04-30  7:55 UTC (permalink / raw)
  To: mpe; +Cc: aneesh.kumar, rashmica.g, david, linuxppc-dev, jniethe5

Trace memory is cleared and the corresponding dcache lines
are flushed after allocation. However, this should not be
done using the PFN. This adds the missing __va() conversion.

Fixes: 2ac02e5ecec0 ("powerpc/mm: Remove dcache flush from memory remove.")
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
---
 arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
index 71c1262589fe..a31f13814f2e 100644
--- a/arch/powerpc/platforms/powernv/memtrace.c
+++ b/arch/powerpc/platforms/powernv/memtrace.c
@@ -104,8 +104,8 @@ static void memtrace_clear_range(unsigned long start_pfn,
 	 * Before we go ahead and use this range as cache inhibited range
 	 * flush the cache.
 	 */
-	flush_dcache_range_chunked(PFN_PHYS(start_pfn),
-				   PFN_PHYS(start_pfn + nr_pages),
+	flush_dcache_range_chunked((unsigned long)__va(PFN_PHYS(start_pfn)),
+				   (unsigned long)__va(PFN_PHYS(start_pfn + nr_pages)),
 				   FLUSH_CHUNK_SIZE);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/powernv/memtrace: Fix dcache flushing
  2021-04-30  7:55 [PATCH] powerpc/powernv/memtrace: Fix dcache flushing Sandipan Das
@ 2021-04-30  8:03 ` Aneesh Kumar K.V
  2021-04-30  8:42 ` Christophe Leroy
  1 sibling, 0 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2021-04-30  8:03 UTC (permalink / raw)
  To: Sandipan Das, mpe; +Cc: jniethe5, rashmica.g, linuxppc-dev, david

Sandipan Das <sandipan@linux.ibm.com> writes:

> Trace memory is cleared and the corresponding dcache lines
> are flushed after allocation. However, this should not be
> done using the PFN. This adds the missing __va() conversion.

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

>
> Fixes: 2ac02e5ecec0 ("powerpc/mm: Remove dcache flush from memory remove.")
> Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
> ---
>  arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
> index 71c1262589fe..a31f13814f2e 100644
> --- a/arch/powerpc/platforms/powernv/memtrace.c
> +++ b/arch/powerpc/platforms/powernv/memtrace.c
> @@ -104,8 +104,8 @@ static void memtrace_clear_range(unsigned long start_pfn,
>  	 * Before we go ahead and use this range as cache inhibited range
>  	 * flush the cache.
>  	 */
> -	flush_dcache_range_chunked(PFN_PHYS(start_pfn),
> -				   PFN_PHYS(start_pfn + nr_pages),
> +	flush_dcache_range_chunked((unsigned long)__va(PFN_PHYS(start_pfn)),
> +				   (unsigned long)__va(PFN_PHYS(start_pfn + nr_pages)),
>  				   FLUSH_CHUNK_SIZE);
>  }
>  
> -- 
> 2.25.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/powernv/memtrace: Fix dcache flushing
  2021-04-30  7:55 [PATCH] powerpc/powernv/memtrace: Fix dcache flushing Sandipan Das
  2021-04-30  8:03 ` Aneesh Kumar K.V
@ 2021-04-30  8:42 ` Christophe Leroy
  2021-05-01 15:31   ` Sandipan Das
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy @ 2021-04-30  8:42 UTC (permalink / raw)
  To: Sandipan Das, mpe; +Cc: aneesh.kumar, rashmica.g, jniethe5, linuxppc-dev, david



Le 30/04/2021 à 09:55, Sandipan Das a écrit :
> Trace memory is cleared and the corresponding dcache lines
> are flushed after allocation. However, this should not be
> done using the PFN. This adds the missing __va() conversion.
> 
> Fixes: 2ac02e5ecec0 ("powerpc/mm: Remove dcache flush from memory remove.")
> Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
> ---
>   arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
> index 71c1262589fe..a31f13814f2e 100644
> --- a/arch/powerpc/platforms/powernv/memtrace.c
> +++ b/arch/powerpc/platforms/powernv/memtrace.c
> @@ -104,8 +104,8 @@ static void memtrace_clear_range(unsigned long start_pfn,
>   	 * Before we go ahead and use this range as cache inhibited range
>   	 * flush the cache.
>   	 */
> -	flush_dcache_range_chunked(PFN_PHYS(start_pfn),
> -				   PFN_PHYS(start_pfn + nr_pages),
> +	flush_dcache_range_chunked((unsigned long)__va(PFN_PHYS(start_pfn)),
> +				   (unsigned long)__va(PFN_PHYS(start_pfn + nr_pages)),

Can you use pfn_to_virt() instead ?

>   				   FLUSH_CHUNK_SIZE);
>   }
>   
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/powernv/memtrace: Fix dcache flushing
  2021-04-30  8:42 ` Christophe Leroy
@ 2021-05-01 15:31   ` Sandipan Das
  0 siblings, 0 replies; 4+ messages in thread
From: Sandipan Das @ 2021-05-01 15:31 UTC (permalink / raw)
  To: Christophe Leroy, mpe
  Cc: aneesh.kumar, rashmica.g, jniethe5, linuxppc-dev, david


On 30/04/21 2:12 pm, Christophe Leroy wrote:
> 
> 
> Le 30/04/2021 à 09:55, Sandipan Das a écrit :
>> Trace memory is cleared and the corresponding dcache lines
>> are flushed after allocation. However, this should not be
>> done using the PFN. This adds the missing __va() conversion.
>>
>> Fixes: 2ac02e5ecec0 ("powerpc/mm: Remove dcache flush from memory remove.")
>> Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
>> ---
>>   arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
>> index 71c1262589fe..a31f13814f2e 100644
>> --- a/arch/powerpc/platforms/powernv/memtrace.c
>> +++ b/arch/powerpc/platforms/powernv/memtrace.c
>> @@ -104,8 +104,8 @@ static void memtrace_clear_range(unsigned long start_pfn,
>>        * Before we go ahead and use this range as cache inhibited range
>>        * flush the cache.
>>        */
>> -    flush_dcache_range_chunked(PFN_PHYS(start_pfn),
>> -                   PFN_PHYS(start_pfn + nr_pages),
>> +    flush_dcache_range_chunked((unsigned long)__va(PFN_PHYS(start_pfn)),
>> +                   (unsigned long)__va(PFN_PHYS(start_pfn + nr_pages)),
> 
> Can you use pfn_to_virt() instead ?
> 
>>                      FLUSH_CHUNK_SIZE);
>>   }
>>  

Sure, that looks cleaner. Thanks for the suggestion.

- Sandipan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-01 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30  7:55 [PATCH] powerpc/powernv/memtrace: Fix dcache flushing Sandipan Das
2021-04-30  8:03 ` Aneesh Kumar K.V
2021-04-30  8:42 ` Christophe Leroy
2021-05-01 15:31   ` Sandipan Das

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).