On 1/28/19 11:01 PM, Reza Arbab wrote:
In htab_convert_pte_flags(), _PAGE_CACHE_CTL is used to check for the
_PAGE_SAO flag:

   else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_SAO)
           rflags |= (HPTE_R_W | HPTE_R_I | HPTE_R_M);

But, it isn't defined to include that flag:

   #define _PAGE_CACHE_CTL (_PAGE_NON_IDEMPOTENT | _PAGE_TOLERANT)

This happens to work, but only because of the flag values:

   #define _PAGE_SAO               0x00010 /* Strong access order */
   #define _PAGE_NON_IDEMPOTENT    0x00020 /* non idempotent memory */
   #define _PAGE_TOLERANT          0x00030 /* tolerant memory, cache inhibited 
*/

To prevent any issues if these particulars ever change, add _PAGE_SAO to
the mask.


Not sure what the fix is about. We set the related hash pte flags via

        if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_TOLERANT)
                rflags |= HPTE_R_I;
        else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_NON_IDEMPOTENT)
                rflags |= (HPTE_R_I | HPTE_R_G);
        else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_SAO)
                rflags |= (HPTE_R_W | HPTE_R_I | HPTE_R_M);
        else
                /*
                 * Add memory coherence if cache inhibited is not set
                 */
                rflags |= HPTE_R_M;




Suggested-by: Charles Johns <crjo...@us.ibm.com>
Signed-off-by: Reza Arbab <ar...@linux.ibm.com>
---
  arch/powerpc/include/asm/book3s/64/pgtable.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h 
b/arch/powerpc/include/asm/book3s/64/pgtable.h
index 2e6ada2..1d97a28 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -811,7 +811,7 @@ static inline void __set_pte_at(struct mm_struct *mm, 
unsigned long addr,
        return hash__set_pte_at(mm, addr, ptep, pte, percpu);
  }
-#define _PAGE_CACHE_CTL (_PAGE_NON_IDEMPOTENT | _PAGE_TOLERANT)
+#define _PAGE_CACHE_CTL        (_PAGE_SAO | _PAGE_NON_IDEMPOTENT | 
_PAGE_TOLERANT)
#define pgprot_noncached pgprot_noncached
  static inline pgprot_t pgprot_noncached(pgprot_t prot)


Reply via email to