[PATCH v5 5/9] powerpc/mm/book3s64: Update tlb flush routines to take a page walk cache flush argument

Aneesh Kumar K.V aneesh.kumar at linux.ibm.com
Mon May 17 18:40:03 AEST 2021


On 5/15/21 10:05 PM, Guenter Roeck wrote:
> On Thu, Apr 22, 2021 at 11:13:19AM +0530, Aneesh Kumar K.V wrote:
>> No functional change in this patch
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.ibm.com>
>> ---
>>   .../include/asm/book3s/64/tlbflush-radix.h    | 19 +++++++-----
>>   arch/powerpc/include/asm/book3s/64/tlbflush.h | 23 ++++++++++++---
>>   arch/powerpc/mm/book3s64/radix_hugetlbpage.c  |  4 +--
>>   arch/powerpc/mm/book3s64/radix_tlb.c          | 29 +++++++------------
>>   4 files changed, 42 insertions(+), 33 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
>> index 8b33601cdb9d..171441a43b35 100644
>> --- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
>> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
>> @@ -56,15 +56,18 @@ static inline void radix__flush_all_lpid_guest(unsigned int lpid)
>>   }
>>   #endif
>>   
>> -extern void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma,
>> -					   unsigned long start, unsigned long end);
>> -extern void radix__flush_tlb_range_psize(struct mm_struct *mm, unsigned long start,
>> -					 unsigned long end, int psize);
>> -extern void radix__flush_pmd_tlb_range(struct vm_area_struct *vma,
>> -				       unsigned long start, unsigned long end);
>> -extern void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
>> +void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma,
>> +				    unsigned long start, unsigned long end,
>> +				    bool flush_pwc);
>> +void radix__flush_pmd_tlb_range(struct vm_area_struct *vma,
>> +				unsigned long start, unsigned long end,
>> +				bool flush_pwc);
>> +void radix__flush_tlb_pwc_range_psize(struct mm_struct *mm, unsigned long start,
>> +				      unsigned long end, int psize, bool flush_pwc);
>> +void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
>>   			    unsigned long end);
>> -extern void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end);
>> +void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end);
>> +
>>   
>>   extern void radix__local_flush_tlb_mm(struct mm_struct *mm);
>>   extern void radix__local_flush_all_mm(struct mm_struct *mm);
>> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush.h b/arch/powerpc/include/asm/book3s/64/tlbflush.h
>> index 215973b4cb26..f9f8a3a264f7 100644
>> --- a/arch/powerpc/include/asm/book3s/64/tlbflush.h
>> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush.h
>> @@ -45,13 +45,30 @@ static inline void tlbiel_all_lpid(bool radix)
>>   		hash__tlbiel_all(TLB_INVAL_SCOPE_LPID);
>>   }
>>   
>> +static inline void flush_pmd_tlb_pwc_range(struct vm_area_struct *vma,
>                   ^^^^
>> +					   unsigned long start,
>> +					   unsigned long end,
>> +					   bool flush_pwc)
>> +{
>> +	if (radix_enabled())
>> +		return radix__flush_pmd_tlb_range(vma, start, end, flush_pwc);
>> +	return hash__flush_tlb_range(vma, start, end);
>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
>> +}

In this specific case we won't have  build errors because,

static inline void hash__flush_tlb_range(struct vm_area_struct *vma,
				     unsigned long start, unsigned long end)
{


But I agree the below is better to read.

static inline void flush_pmd_tlb_pwc_range(struct vm_area_struct *vma,
					   unsigned long start,
					   unsigned long end,
					   bool flush_pwc)
{
	if (radix_enabled())
		radix__flush_pmd_tlb_range(vma, start, end, flush_pwc);
	else
		hash__flush_tlb_range(vma, start, end);
	return
}

> 
>>   
>>   #define __HAVE_ARCH_FLUSH_PMD_TLB_RANGE
>>   static inline void flush_pmd_tlb_range(struct vm_area_struct *vma,
>                   ^^^^
>>   				       unsigned long start, unsigned long end)
>> +{
>> +	return flush_pmd_tlb_pwc_range(vma, start, end, false);
>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Doesn't that cause build warnings/errors all over the place ?
> 
> Guenter
> 


-aneesh


More information about the Linuxppc-dev mailing list