diff mbox series

[3/3] powerpc/mm: call H_BLOCK_REMOVE when supported

Message ID 20190830120712.22971-4-ldufour@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series powerpc/mm: Conditionally call H_BLOCK_REMOVE | expand

Commit Message

Laurent Dufour Aug. 30, 2019, 12:07 p.m. UTC
Instead of calling H_BLOCK_REMOVE all the time when the feature is
exhibited, call this hcall only when the couple base page size, page size
is supported as reported by the TLB Invalidate Characteristics.

For regular pages and hugetlb, the assumption is made that the page size is
equal to the base page size. For THP the page size is assumed to be 16M.

Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/lpar.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Aneesh Kumar K.V Sept. 12, 2019, 2:20 p.m. UTC | #1
On 8/30/19 5:37 PM, Laurent Dufour wrote:
> Instead of calling H_BLOCK_REMOVE all the time when the feature is
> exhibited, call this hcall only when the couple base page size, page size
> is supported as reported by the TLB Invalidate Characteristics.
> 

supported is not actually what we are checking here. We are checking 
whether the base page size actual page size remove can be done in chunks 
of 8 blocks. If we don't support 8 block you fallback to bulk 
invalidate. May be update the commit message accordingly?


> For regular pages and hugetlb, the assumption is made that the page size is
> equal to the base page size. For THP the page size is assumed to be 16M.
> 
> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
> ---
>   arch/powerpc/platforms/pseries/lpar.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
> index 375e19b3cf53..ef3dbf108a65 100644
> --- a/arch/powerpc/platforms/pseries/lpar.c
> +++ b/arch/powerpc/platforms/pseries/lpar.c
> @@ -1143,7 +1143,11 @@ static inline void __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
>   	if (lock_tlbie)
>   		spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
>   
> -	if (firmware_has_feature(FW_FEATURE_BLOCK_REMOVE))
> +	/*
> +	 * Assuming THP size is 16M, and we only support 8 bytes size buffer
> +	 * for the momment.
> +	 */
> +	if (mmu_psize_defs[psize].hblk[MMU_PAGE_16M] == 8)
>   		hugepage_block_invalidate(slot, vpn, count, psize, ssize);
>   	else
>   		hugepage_bulk_invalidate(slot, vpn, count, psize, ssize);



So we don't use block invalidate if blocksize is != 8.


> @@ -1437,7 +1441,10 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
>   	if (lock_tlbie)
>   		spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
>   
> -	if (firmware_has_feature(FW_FEATURE_BLOCK_REMOVE)) {
> +	/*
> +	 * Currently, we only support 8 bytes size buffer in do_block_remove().
> +	 */
> +	if (mmu_psize_defs[batch->psize].hblk[batch->psize] == 8) {
>   		do_block_remove(number, batch, param);
>   		goto out;
>   	}
> 

-aneesh
Laurent Dufour Sept. 13, 2019, 1:16 p.m. UTC | #2
Le 12/09/2019 à 16:20, Aneesh Kumar K.V a écrit :
> On 8/30/19 5:37 PM, Laurent Dufour wrote:
>> Instead of calling H_BLOCK_REMOVE all the time when the feature is
>> exhibited, call this hcall only when the couple base page size, page size
>> is supported as reported by the TLB Invalidate Characteristics.
>>
> 
> supported is not actually what we are checking here. We are checking 
> whether the base page size actual page size remove can be done in chunks of 
> 8 blocks. If we don't support 8 block you fallback to bulk invalidate. May 
> be update the commit message accordingly?

Yes that's correct.

I think I should also put the warning message displayed when reading the 
characteristic in that commit and explicitly mentioned that we only support 
8 entries size block for this hcall.
This way the limitation is limited to this commit.

> 
>> For regular pages and hugetlb, the assumption is made that the page size is
>> equal to the base page size. For THP the page size is assumed to be 16M.
>>
>> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
>> ---
>>   arch/powerpc/platforms/pseries/lpar.c | 11 +++++++++--
>>   1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/pseries/lpar.c 
>> b/arch/powerpc/platforms/pseries/lpar.c
>> index 375e19b3cf53..ef3dbf108a65 100644
>> --- a/arch/powerpc/platforms/pseries/lpar.c
>> +++ b/arch/powerpc/platforms/pseries/lpar.c
>> @@ -1143,7 +1143,11 @@ static inline void 
>> __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
>>       if (lock_tlbie)
>>           spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
>> -    if (firmware_has_feature(FW_FEATURE_BLOCK_REMOVE))
>> +    /*
>> +     * Assuming THP size is 16M, and we only support 8 bytes size buffer
>> +     * for the momment.
>> +     */
>> +    if (mmu_psize_defs[psize].hblk[MMU_PAGE_16M] == 8)
>>           hugepage_block_invalidate(slot, vpn, count, psize, ssize);
>>       else
>>           hugepage_bulk_invalidate(slot, vpn, count, psize, ssize);
> 
> 
> 
> So we don't use block invalidate if blocksize is != 8.

yes

> 
> 
>> @@ -1437,7 +1441,10 @@ static void pSeries_lpar_flush_hash_range(unsigned 
>> long number, int local)
>>       if (lock_tlbie)
>>           spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
>> -    if (firmware_has_feature(FW_FEATURE_BLOCK_REMOVE)) {
>> +    /*
>> +     * Currently, we only support 8 bytes size buffer in do_block_remove().
>> +     */
>> +    if (mmu_psize_defs[batch->psize].hblk[batch->psize] == 8) {
>>           do_block_remove(number, batch, param);
>>           goto out;
>>       }
>>
> 
> -aneesh
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 375e19b3cf53..ef3dbf108a65 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -1143,7 +1143,11 @@  static inline void __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
 	if (lock_tlbie)
 		spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
 
-	if (firmware_has_feature(FW_FEATURE_BLOCK_REMOVE))
+	/*
+	 * Assuming THP size is 16M, and we only support 8 bytes size buffer
+	 * for the momment.
+	 */
+	if (mmu_psize_defs[psize].hblk[MMU_PAGE_16M] == 8)
 		hugepage_block_invalidate(slot, vpn, count, psize, ssize);
 	else
 		hugepage_bulk_invalidate(slot, vpn, count, psize, ssize);
@@ -1437,7 +1441,10 @@  static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
 	if (lock_tlbie)
 		spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
 
-	if (firmware_has_feature(FW_FEATURE_BLOCK_REMOVE)) {
+	/*
+	 * Currently, we only support 8 bytes size buffer in do_block_remove().
+	 */
+	if (mmu_psize_defs[batch->psize].hblk[batch->psize] == 8) {
 		do_block_remove(number, batch, param);
 		goto out;
 	}