diff mbox

[RFC,05/14] sparc64: Add PAGE_SHR_CTX flag

Message ID 1481913337-9331-6-git-send-email-mike.kravetz@oracle.com
State RFC
Delegated to: David Miller
Headers show

Commit Message

Mike Kravetz Dec. 16, 2016, 6:35 p.m. UTC
This new page flag is used to identify pages which are associated with
a shared context ID.  It is needed at page fault time when we only
have access to the PTE and need to determine whether the associated
TSB entry should be associated with the regular ot shared context TSB.

A new helper routine is_sharedctx_pte() is also added.

Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
---
 arch/sparc/include/asm/pgtable_64.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

David Miller Dec. 18, 2016, 3:12 a.m. UTC | #1
From: Mike Kravetz <mike.kravetz@oracle.com>
Date: Fri, 16 Dec 2016 10:35:28 -0800

> @@ -166,6 +166,7 @@ bool kern_addr_valid(unsigned long addr);
>  #define _PAGE_EXEC_4V	  _AC(0x0000000000000080,UL) /* Executable Page      */
>  #define _PAGE_W_4V	  _AC(0x0000000000000040,UL) /* Writable             */
>  #define _PAGE_SOFT_4V	  _AC(0x0000000000000030,UL) /* Software bits        */
> +#define _PAGE_SHR_CTX_4V  _AC(0x0000000000000020,UL) /* Shared Context       */
>  #define _PAGE_PRESENT_4V  _AC(0x0000000000000010,UL) /* Present              */
>  #define _PAGE_RESV_4V	  _AC(0x0000000000000008,UL) /* Reserved             */
>  #define _PAGE_SZ16GB_4V	  _AC(0x0000000000000007,UL) /* 16GB Page            */

You really don't need this.

The VMA is available, and you can obtain the information you need
about whether this is a shared mapping or not from the. It just isn't
being passed down into things like set_huge_pte_at().  Simply make it
do so.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mike Kravetz Dec. 19, 2016, 12:42 a.m. UTC | #2
On 12/17/2016 07:12 PM, David Miller wrote:
> From: Mike Kravetz <mike.kravetz@oracle.com>
> Date: Fri, 16 Dec 2016 10:35:28 -0800
> 
>> @@ -166,6 +166,7 @@ bool kern_addr_valid(unsigned long addr);
>>  #define _PAGE_EXEC_4V	  _AC(0x0000000000000080,UL) /* Executable Page      */
>>  #define _PAGE_W_4V	  _AC(0x0000000000000040,UL) /* Writable             */
>>  #define _PAGE_SOFT_4V	  _AC(0x0000000000000030,UL) /* Software bits        */
>> +#define _PAGE_SHR_CTX_4V  _AC(0x0000000000000020,UL) /* Shared Context       */
>>  #define _PAGE_PRESENT_4V  _AC(0x0000000000000010,UL) /* Present              */
>>  #define _PAGE_RESV_4V	  _AC(0x0000000000000008,UL) /* Reserved             */
>>  #define _PAGE_SZ16GB_4V	  _AC(0x0000000000000007,UL) /* 16GB Page            */
> 
> You really don't need this.
> 
> The VMA is available, and you can obtain the information you need
> about whether this is a shared mapping or not from the. It just isn't
> being passed down into things like set_huge_pte_at().  Simply make it
> do so.
> 

I was more concerned about the page table walk code at tlb/tsb miss time.
Specifically, the code after tsb_miss_page_table_walk_sun4v_fastpath in
tsb.S.  AFAICT, the tsb entries should have been created when the pte entries
were created.  Yet, this code is still walking the page table and creating
tsb entries.  We do not have a pointer to the vma here, and I thought it
would be somewhat difficult to get access.  This is the reason why I went
down the path of a page flag.
David Miller Dec. 20, 2016, 6:33 p.m. UTC | #3
From: Mike Kravetz <mike.kravetz@oracle.com>
Date: Sun, 18 Dec 2016 16:42:52 -0800

> On 12/17/2016 07:12 PM, David Miller wrote:
>> From: Mike Kravetz <mike.kravetz@oracle.com>
>> Date: Fri, 16 Dec 2016 10:35:28 -0800
>> 
>>> @@ -166,6 +166,7 @@ bool kern_addr_valid(unsigned long addr);
>>>  #define _PAGE_EXEC_4V	  _AC(0x0000000000000080,UL) /* Executable Page      */
>>>  #define _PAGE_W_4V	  _AC(0x0000000000000040,UL) /* Writable             */
>>>  #define _PAGE_SOFT_4V	  _AC(0x0000000000000030,UL) /* Software bits        */
>>> +#define _PAGE_SHR_CTX_4V  _AC(0x0000000000000020,UL) /* Shared Context       */
>>>  #define _PAGE_PRESENT_4V  _AC(0x0000000000000010,UL) /* Present              */
>>>  #define _PAGE_RESV_4V	  _AC(0x0000000000000008,UL) /* Reserved             */
>>>  #define _PAGE_SZ16GB_4V	  _AC(0x0000000000000007,UL) /* 16GB Page            */
>> 
>> You really don't need this.
>> 
>> The VMA is available, and you can obtain the information you need
>> about whether this is a shared mapping or not from the. It just isn't
>> being passed down into things like set_huge_pte_at().  Simply make it
>> do so.
>> 
> 
> I was more concerned about the page table walk code at tlb/tsb miss time.
> Specifically, the code after tsb_miss_page_table_walk_sun4v_fastpath in
> tsb.S.  AFAICT, the tsb entries should have been created when the pte entries
> were created.  Yet, this code is still walking the page table and creating
> tsb entries.  We do not have a pointer to the vma here, and I thought it
> would be somewhat difficult to get access.  This is the reason why I went
> down the path of a page flag.

You are right, you will need a page flag for that part.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 1fb317f..f2fd088 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -166,6 +166,7 @@  bool kern_addr_valid(unsigned long addr);
 #define _PAGE_EXEC_4V	  _AC(0x0000000000000080,UL) /* Executable Page      */
 #define _PAGE_W_4V	  _AC(0x0000000000000040,UL) /* Writable             */
 #define _PAGE_SOFT_4V	  _AC(0x0000000000000030,UL) /* Software bits        */
+#define _PAGE_SHR_CTX_4V  _AC(0x0000000000000020,UL) /* Shared Context       */
 #define _PAGE_PRESENT_4V  _AC(0x0000000000000010,UL) /* Present              */
 #define _PAGE_RESV_4V	  _AC(0x0000000000000008,UL) /* Reserved             */
 #define _PAGE_SZ16GB_4V	  _AC(0x0000000000000007,UL) /* 16GB Page            */
@@ -426,6 +427,18 @@  static inline bool is_hugetlb_pte(pte_t pte)
 }
 #endif
 
+#if defined(CONFIG_SHARED_MMU_CTX)
+static inline bool is_sharedctx_pte(pte_t pte)
+{
+	return !!(pte_val(pte) & _PAGE_SHR_CTX_4V);
+}
+#else
+static inline bool is_sharedctx_pte(pte_t pte)
+{
+	return false;
+}
+#endif
+
 static inline pte_t pte_mkdirty(pte_t pte)
 {
 	unsigned long val = pte_val(pte), tmp;