diff mbox

[02/13] powerpc: hugetlb: fix huge_ptep_set_access_flags return value

Message ID 13182798643553-git-send-email-beckyb@kernel.crashing.org (mailing list archive)
State Accepted, archived
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Becky Bruce Oct. 10, 2011, 8:50 p.m. UTC
From: Becky Bruce <beckyb@kernel.crashing.org>

There was an unconditional return of "1" in the original code
from David Gibson, and I dropped it because it wasn't needed
for FSL BOOKE 32-bit.  However, not all systems (including 64-bit
FSL BOOKE) do loading of the hpte from the fault handler asm
and depend on this function returning 1, which causes a call
to update_mmu_cache() that writes an entry into the tlb.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 arch/powerpc/include/asm/hugetlb.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Comments

Benjamin Herrenschmidt Nov. 29, 2011, 3:58 a.m. UTC | #1
On Mon, 2011-10-10 at 15:50 -0500, Becky Bruce wrote:

> diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
> index 8600493..70f9885 100644
> --- a/arch/powerpc/include/asm/hugetlb.h
> +++ b/arch/powerpc/include/asm/hugetlb.h
> @@ -124,7 +124,18 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
>  					     unsigned long addr, pte_t *ptep,
>  					     pte_t pte, int dirty)
>  {
> +#if defined(CONFIG_PPC_MMU_NOHASH) && \
> +	!(defined(CONFIG_PPC_FSL_BOOK3E) && defined(CONFIG_PPC32))

The above conditional makes my brain hurt. Can you change that to
instead

#ifdef HUGETLB_NEED_PRELOAD

 ... or something like that, which you then #define in the right
mmu-xxxx.h header ?

Cheers,
Ben.


> +	/*
> +	 * The "return 1" forces a call of update_mmu_cache, which will write a
> +	 * TLB entry.  Without this, platforms that don't do a write of the TLB
> +	 * entry in the TLB miss handler asm will fault ad infinitum.
> +	 */
> +	ptep_set_access_flags(vma, addr, ptep, pte, dirty);
> +	return 1;
> +#else
>  	return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
> +#endif
>  }
>  
>  static inline pte_t huge_ptep_get(pte_t *ptep)
Becky Bruce Nov. 29, 2011, 4:52 p.m. UTC | #2
On Nov 28, 2011, at 9:58 PM, Benjamin Herrenschmidt wrote:

> On Mon, 2011-10-10 at 15:50 -0500, Becky Bruce wrote:
> 
>> diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
>> index 8600493..70f9885 100644
>> --- a/arch/powerpc/include/asm/hugetlb.h
>> +++ b/arch/powerpc/include/asm/hugetlb.h
>> @@ -124,7 +124,18 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
>> 					     unsigned long addr, pte_t *ptep,
>> 					     pte_t pte, int dirty)
>> {
>> +#if defined(CONFIG_PPC_MMU_NOHASH) && \
>> +	!(defined(CONFIG_PPC_FSL_BOOK3E) && defined(CONFIG_PPC32))
> 
> The above conditional makes my brain hurt. Can you change that to
> instead
> 
> #ifdef HUGETLB_NEED_PRELOAD
> 
> ... or something like that, which you then #define in the right
> mmu-xxxx.h header ?

Sure.

Can I publish this as a followup instead of rebasing?  We're trying to stay sync'ed with what's in our BSP and it would be easier for me/Kumar to deal with.

Cheers,
B

> 
> Cheers,
> Ben.
> 
> 
>> +	/*
>> +	 * The "return 1" forces a call of update_mmu_cache, which will write a
>> +	 * TLB entry.  Without this, platforms that don't do a write of the TLB
>> +	 * entry in the TLB miss handler asm will fault ad infinitum.
>> +	 */
>> +	ptep_set_access_flags(vma, addr, ptep, pte, dirty);
>> +	return 1;
>> +#else
>> 	return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
>> +#endif
>> }
>> 
>> static inline pte_t huge_ptep_get(pte_t *ptep)
>
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index 8600493..70f9885 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -124,7 +124,18 @@  static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
 					     unsigned long addr, pte_t *ptep,
 					     pte_t pte, int dirty)
 {
+#if defined(CONFIG_PPC_MMU_NOHASH) && \
+	!(defined(CONFIG_PPC_FSL_BOOK3E) && defined(CONFIG_PPC32))
+	/*
+	 * The "return 1" forces a call of update_mmu_cache, which will write a
+	 * TLB entry.  Without this, platforms that don't do a write of the TLB
+	 * entry in the TLB miss handler asm will fault ad infinitum.
+	 */
+	ptep_set_access_flags(vma, addr, ptep, pte, dirty);
+	return 1;
+#else
 	return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
+#endif
 }
 
 static inline pte_t huge_ptep_get(pte_t *ptep)