From: Paul Mackerras <hidden> Date: 2016-02-20 06:12:54
This patch series modifies the Linux PTE format used on 64-bit Book3S
processors (i.e. POWER server processors) to make the bits line up
with the PTE format used in the radix trees defined in PowerISA v3.0.
This will reduce the amount of further change required to make a
kernel that can run with either a radix MMU or a hashed page table
(HPT) MMU.
This also changes the upper levels of the tree to use real addresses
rather than kernel virtual addresses - that is, we no longer have the
0xc000... at the top of each PGD/PUD/PMD entry. I made this change
for all 64-bit machines, both embedded and server.
The patch series is against v4.5-rc4 plus Aneesh's "powerpc/mm/hash:
Clear the invalid slot information correctly" patch.
I have compiled this for all the defconfigs in the tree, without
error. I have tested this, with the fixes branch of the powerpc tree
merged in, both running bare-metal on a POWER8 and in a KVM guest on
that POWER8 system. In the guest I tested both 4k and 64k configs,
with THP enabled; in the host I tested with 64k page size and THP
enabled. All these tests ran fine, including running a KVM guest on
the bare-metal system. So far I have done kernel compiles in a loop
as the test, but I plan to run LTP and possibly some other tests.
Comments welcome.
Paul.
arch/powerpc/include/asm/book3s/64/hash-4k.h | 5 ++-
arch/powerpc/include/asm/book3s/64/hash-64k.h | 24 ++++++-----
arch/powerpc/include/asm/book3s/64/hash.h | 54 ++++++++++++-------------
arch/powerpc/include/asm/book3s/64/pgtable.h | 6 +--
arch/powerpc/include/asm/nohash/64/pgtable-4k.h | 2 +-
arch/powerpc/include/asm/nohash/64/pgtable.h | 10 ++---
arch/powerpc/include/asm/pgalloc-64.h | 16 ++++----
arch/powerpc/mm/hash64_64k.c | 3 +-
arch/powerpc/mm/hash_utils_64.c | 10 ++---
arch/powerpc/mm/hugetlbpage-hash64.c | 5 ++-
arch/powerpc/mm/mmu_decl.h | 2 +-
arch/powerpc/mm/pgtable_64.c | 4 +-
12 files changed, 71 insertions(+), 70 deletions(-)
@@ -14,13 +13,13 @@*Wecouldcreateseparatekernelread-onlyifweusedthe3PPbits*combinationsthatnewerprocessorsprovidebutwecurrentlydon't.*/-#define _PAGE_PTE 0x00001+#define _PAGE_PTE 0x00001 /* distinguishes PTEs from pointers */#define _PAGE_PRESENT 0x00002 /* software: pte contains a translation */#define _PAGE_BIT_SWAP_TYPE 2-#define _PAGE_USER 0x00004 /* matches one of the PP bits */-#define _PAGE_EXEC 0x00008 /* No execute on POWER4 and newer (we invert) */-#define _PAGE_GUARDED 0x00010-/* We can derive Memory coherence from _PAGE_NO_CACHE */+#define _PAGE_USER 0x00004 /* page may be accessed by userspace */+#define _PAGE_EXEC 0x00008 /* execute permission */+#define _PAGE_GUARDED 0x00010 /* G: guarded (side-effect) page */+/* M (memory coherence) is always set in the HPTE, so we don't need it here */#define _PAGE_COHERENT 0x0#define _PAGE_NO_CACHE 0x00020 /* I: cache inhibit */#define _PAGE_WRITETHRU 0x00040 /* W: cache write-through */
@@ -249,8 +249,7 @@ int __hash_page_64K(unsigned long ea, unsigned long access,return0;/**TrytolockthePTE,addACCESSEDandDIRTYifitwas-*awriteaccess.Sincethisis4Kinsertof64Kpagesize-*alsoadd_PAGE_COMBO+*awriteaccess.*/new_pte=old_pte|_PAGE_BUSY|_PAGE_ACCESSED;if(access&_PAGE_RW)
@@ -168,11 +168,11 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags)rflags|=HPTE_R_N;/**PPbits:-*Linuxuseslbkey0forkerneland1foruser.-*kernelareasaremappedbyPPbits00-*andandthereisnokernelRO(_PAGE_KERNEL_RO).-*Userareamappedby0x2andreadonlyuseby-*0x3.+*Linuxusesslbkey0forkerneland1foruser.+*kernelareasaremappedwithPP=00+*andthereisnokernelRO(_PAGE_KERNEL_RO).+*UserareaismappedwithPP=0x2forread/write+*orPP=0x3forread-only(includingwriteablebutcleanpages).*/if(pteflags&_PAGE_USER){rflags|=0x2;
From: Paul Mackerras <hidden> Date: 2016-02-20 06:13:12
This frees up bits 57-63 in the Linux PTE on 64-bit Book 3S machines.
In the 4k page case, this is done just by reducing the size of the
RPN field to 39 bits, giving 51-bit real addresses. In the 64k page
case, we had 10 unused bits in the middle of the PTE, so this moves
the RPN field down 10 bits to make use of those unused bits. This
means the RPN field is now 3 bits larger at 37 bits, giving 53-bit
real addresses in the normal case, or 49-bit real addresses for the
special 4k PFN case.
We are doing this in order to be able to move some other PTE bits
into the positions where PowerISA V3.0 processors will expect to
find them in radix-tree mode. Ultimately we will be able to move
the RPN field to lower bit positions and make it larger.
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash-4k.h | 1 +
arch/powerpc/include/asm/book3s/64/hash-64k.h | 10 ++++++----
arch/powerpc/include/asm/book3s/64/hash.h | 6 +++---
arch/powerpc/include/asm/book3s/64/pgtable.h | 6 +++---
arch/powerpc/mm/pgtable_64.c | 2 +-
5 files changed, 14 insertions(+), 11 deletions(-)
@@ -53,6 +53,7 @@/* shift to put page number into pte */#define PTE_RPN_SHIFT (18)+#define PTE_RPN_SIZE (39) /* gives 51-bit real addresses */#define _PAGE_4K_PFN 0#ifndef __ASSEMBLY__
@@ -39,10 +39,12 @@/* Shift to put page number into pte.*-*ThatgivesusamaxRPNof34bits,whichmeansamaxof50bits-*ofaddressablephysicalspace,or46bitsforthespecial4kPFNs.+*ThatgivesusamaxRPNof37bits,whichmeansamaxof53bits+*ofaddressablephysicalspace,or49bitsforthespecial4kPFNs.*/-#define PTE_RPN_SHIFT (30)+#define PTE_RPN_SHIFT (20)+#define PTE_RPN_SIZE (37)+/**wesupport16fragmentsperPTEpageof64Ksize.*/
This frees up bits 57-63 in the Linux PTE on 64-bit Book 3S machines.
In the 4k page case, this is done just by reducing the size of the
RPN field to 39 bits, giving 51-bit real addresses. In the 64k page
case, we had 10 unused bits in the middle of the PTE, so this moves
the RPN field down 10 bits to make use of those unused bits. This
means the RPN field is now 3 bits larger at 37 bits, giving 53-bit
real addresses in the normal case, or 49-bit real addresses for the
special 4k PFN case.
Is it ok to have different real address bits between 4k and 64k linux
config ?
-aneesh
From: Paul Mackerras <hidden> Date: 2016-02-21 22:46:13
On Sat, Feb 20, 2016 at 09:46:19PM +0530, Aneesh Kumar K.V wrote:
Paul Mackerras [off-list ref] writes:
quoted
This frees up bits 57-63 in the Linux PTE on 64-bit Book 3S machines.
In the 4k page case, this is done just by reducing the size of the
RPN field to 39 bits, giving 51-bit real addresses. In the 64k page
case, we had 10 unused bits in the middle of the PTE, so this moves
the RPN field down 10 bits to make use of those unused bits. This
means the RPN field is now 3 bits larger at 37 bits, giving 53-bit
real addresses in the normal case, or 49-bit real addresses for the
special 4k PFN case.
Is it ok to have different real address bits between 4k and 64k linux
config ?
Do you mean a different number of address bits, or a different
location? In fact both were different before this patch anyway.
Paul.
From: Paul Mackerras <hidden> Date: 2016-02-20 06:13:14
This changes the Linux page tables to store physical addresses
rather than kernel virtual addresses in the upper levels of the
tree (pgd, pud and pmd) for all 64-bit machines.
This frees up some high order bits, and will be needed with book3s
PowerISA v3.0 machines which read the page table tree in hardware
in radix mode.
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash-4k.h | 2 +-
arch/powerpc/include/asm/book3s/64/hash.h | 10 ++++------
arch/powerpc/include/asm/nohash/64/pgtable-4k.h | 2 +-
arch/powerpc/include/asm/nohash/64/pgtable.h | 10 ++++------
arch/powerpc/include/asm/pgalloc-64.h | 16 ++++++++--------
5 files changed, 18 insertions(+), 22 deletions(-)
This changes the Linux page tables to store physical addresses
rather than kernel virtual addresses in the upper levels of the
tree (pgd, pud and pmd) for all 64-bit machines.
This frees up some high order bits, and will be needed with book3s
PowerISA v3.0 machines which read the page table tree in hardware
in radix mode.
From: Paul Mackerras <hidden> Date: 2016-02-21 22:46:13
On Sat, Feb 20, 2016 at 10:05:58PM +0530, Aneesh Kumar K.V wrote:
Paul Mackerras [off-list ref] writes:
quoted
This changes the Linux page tables to store physical addresses
rather than kernel virtual addresses in the upper levels of the
tree (pgd, pud and pmd) for all 64-bit machines.
This frees up some high order bits, and will be needed with book3s
PowerISA v3.0 machines which read the page table tree in hardware
in radix mode.
Should we not update pmd_pgtable ?
Not sure what you mean by this - the patch does update pmd_pgtable
for the 64k page case (the 4k case is already fine).
From: Paul Mackerras <hidden> Date: 2016-02-20 06:13:14
This changes _PAGE_PRESENT for 64-bit Book 3S processors from 0x2 to
0x8000_0000_0000_0000, because that is where PowerISA v3.0 CPUs in
radix mode will expect to find it.
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash-64k.h | 10 +++++-----
arch/powerpc/include/asm/book3s/64/hash.h | 5 +++--
arch/powerpc/mm/mmu_decl.h | 2 +-
arch/powerpc/mm/pgtable_64.c | 2 +-
4 files changed, 10 insertions(+), 9 deletions(-)
@@ -399,7 +400,7 @@ static inline int pte_protnone(pte_t pte)staticinlineintpte_present(pte_tpte){-returnpte_val(pte)&_PAGE_PRESENT;+return!!(pte_val(pte)&_PAGE_PRESENT);}/* Conversion functions: convert a page and protection to a page entry,
From: kbuild test robot <hidden> Date: 2016-02-20 08:34:42
Hi Paul,
[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.5-rc4 next-20160219]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Paul-Mackerras-via-Linuxppc-dev/powerpc-mm-Restructure-Linux-PTE-on-Book3S-64-to-radix-format/20160220-143050
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allmodconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
All error/warnings (new ones prefixed by >>):
In file included from arch/powerpc/include/asm/thread_info.h:34:0,
from include/linux/thread_info.h:54,
from include/asm-generic/preempt.h:4,
from arch/powerpc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/powerpc/mm/pgtable_64.c:25:
arch/powerpc/mm/pgtable_64.c: In function 'map_kernel_page':
quoted
arch/powerpc/include/asm/page.h:335:35: error: incompatible types when initializing type 'long unsigned int' using type 'pgprot_t {aka struct <anonymous>}'
#define __pgprot(x) ((pgprot_t) { (x) })
^
quoted
arch/powerpc/mm/pgtable_64.c:110:10: note: in expansion of macro '__pgprot'
__pgprot(flags)));
^
quoted
arch/powerpc/mm/pgtable_64.c:143:49: error: incompatible type for argument 4 of 'htab_bolt_mapping'
if (htab_bolt_mapping(ea, ea + PAGE_SIZE, pa, flags,
^
In file included from arch/powerpc/include/asm/mmu.h:185:0,
from arch/powerpc/include/asm/lppaca.h:36,
from arch/powerpc/include/asm/paca.h:21,
from arch/powerpc/include/asm/hw_irq.h:42,
from arch/powerpc/include/asm/irqflags.h:11,
from include/linux/irqflags.h:15,
from include/linux/spinlock.h:53,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/powerpc/mm/pgtable_64.c:25:
arch/powerpc/include/asm/mmu-hash64.h:358:12: note: expected 'long unsigned int' but argument is of type 'pgprot_t {aka struct <anonymous>}'
extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
^
arch/powerpc/mm/pgtable_64.c: In function '__ioremap_at':
quoted
arch/powerpc/mm/pgtable_64.c:183:50: error: incompatible type for argument 3 of 'map_kernel_page'
if (map_kernel_page((unsigned long)ea+i, pa+i, flags))
^
arch/powerpc/mm/pgtable_64.c:91:5: note: expected 'pgprot_t {aka struct <anonymous>}' but argument is of type 'long unsigned int'
int map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t flags)
^
vim +/htab_bolt_mapping +143 arch/powerpc/mm/pgtable_64.c
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 19 * as published by the Free Software Foundation; either version
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 20 * 2 of the License, or (at your option) any later version.
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 21 *
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 22 */
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 23
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 24 #include <linux/signal.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 @25 #include <linux/sched.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 26 #include <linux/kernel.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 27 #include <linux/errno.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 28 #include <linux/string.h>
66b15db6 arch/powerpc/mm/pgtable_64.c Paul Gortmaker 2011-05-27 29 #include <linux/export.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 30 #include <linux/types.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 31 #include <linux/mman.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 32 #include <linux/mm.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 33 #include <linux/swap.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 34 #include <linux/stddef.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 35 #include <linux/vmalloc.h>
95f72d1e arch/powerpc/mm/pgtable_64.c Yinghai Lu 2010-07-12 36 #include <linux/memblock.h>
5a0e3ad6 arch/powerpc/mm/pgtable_64.c Tejun Heo 2010-03-24 37 #include <linux/slab.h>
06743521 arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2014-11-05 38 #include <linux/hugetlb.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 39
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 40 #include <asm/pgalloc.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 41 #include <asm/page.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 42 #include <asm/prom.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 43 #include <asm/io.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 44 #include <asm/mmu_context.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 45 #include <asm/pgtable.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 46 #include <asm/mmu.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 47 #include <asm/smp.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 48 #include <asm/machdep.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 49 #include <asm/tlb.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 50 #include <asm/processor.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 51 #include <asm/cputable.h>
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 52 #include <asm/sections.h>
5e203d68 arch/powerpc/mm/pgtable_64.c Stephen Rothwell 2006-09-25 53 #include <asm/firmware.h>
68cf0d64 arch/powerpc/mm/pgtable_64.c Anton Blanchard 2014-09-17 54 #include <asm/dma.h>
800fc3ee arch/powerpc/mm/pgtable_64.c David Gibson 2005-11-16 55
800fc3ee arch/powerpc/mm/pgtable_64.c David Gibson 2005-11-16 56 #include "mmu_decl.h"
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 57
9e813308 arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2014-08-13 58 #define CREATE_TRACE_POINTS
9e813308 arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2014-08-13 59 #include <trace/events/thp.h>
9e813308 arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2014-08-13 60
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 61 /* Some sanity checking */
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 62 #if TASK_SIZE_USER64 > PGTABLE_RANGE
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 63 #error TASK_SIZE_USER64 exceeds pagetable range
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 64 #endif
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 65
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 66 #ifdef CONFIG_PPC_STD_MMU_64
af81d787 arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2013-03-13 67 #if TASK_SIZE_USER64 > (1UL << (ESID_BITS + SID_SHIFT))
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 68 #error TASK_SIZE_USER64 exceeds user VSID range
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 69 #endif
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 70 #endif
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 71
78f1dbde arch/powerpc/mm/pgtable_64.c Aneesh Kumar K.V 2012-09-10 72 unsigned long ioremap_bot = IOREMAP_BASE;
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 73
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 74 #ifdef CONFIG_PPC_MMU_NOHASH
7d176221 arch/powerpc/mm/pgtable_64.c Scott Wood 2014-08-01 75 static __ref void *early_alloc_pgtable(unsigned long size)
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 76 {
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 77 void *pt;
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 78
10239733 arch/powerpc/mm/pgtable_64.c Anton Blanchard 2014-09-17 79 pt = __va(memblock_alloc_base(size, size, __pa(MAX_DMA_ADDRESS)));
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 80 memset(pt, 0, size);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 81
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 82 return pt;
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 83 }
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 84 #endif /* CONFIG_PPC_MMU_NOHASH */
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 85
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 86 /*
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 87 * map_kernel_page currently only called by __ioremap
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 88 * map_kernel_page adds an entry to the ioremap page table
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 89 * and adds an entry to the HPT, possibly bolting it
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 90 */
be212f32 arch/powerpc/mm/pgtable_64.c Paul Mackerras via Linuxppc-dev 2016-02-20 91 int map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t flags)
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 92 {
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 93 pgd_t *pgdp;
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 94 pud_t *pudp;
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 95 pmd_t *pmdp;
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 96 pte_t *ptep;
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 97
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 98 if (slab_is_available()) {
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 99 pgdp = pgd_offset_k(ea);
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 100 pudp = pud_alloc(&init_mm, pgdp, ea);
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 101 if (!pudp)
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 102 return -ENOMEM;
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 103 pmdp = pmd_alloc(&init_mm, pudp, ea);
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 104 if (!pmdp)
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 105 return -ENOMEM;
23fd0775 arch/powerpc/mm/pgtable_64.c Paul Mackerras 2005-10-31 106 ptep = pte_alloc_kernel(pmdp, ea);
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 107 if (!ptep)
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 108 return -ENOMEM;
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 109 set_pte_at(&init_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT,
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 @110 __pgprot(flags)));
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 111 } else {
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 112 #ifdef CONFIG_PPC_MMU_NOHASH
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 113 pgdp = pgd_offset_k(ea);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 114 #ifdef PUD_TABLE_SIZE
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 115 if (pgd_none(*pgdp)) {
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 116 pudp = early_alloc_pgtable(PUD_TABLE_SIZE);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 117 BUG_ON(pudp == NULL);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 118 pgd_populate(&init_mm, pgdp, pudp);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 119 }
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 120 #endif /* PUD_TABLE_SIZE */
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 121 pudp = pud_offset(pgdp, ea);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 122 if (pud_none(*pudp)) {
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 123 pmdp = early_alloc_pgtable(PMD_TABLE_SIZE);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 124 BUG_ON(pmdp == NULL);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 125 pud_populate(&init_mm, pudp, pmdp);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 126 }
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 127 pmdp = pmd_offset(pudp, ea);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 128 if (!pmd_present(*pmdp)) {
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 129 ptep = early_alloc_pgtable(PAGE_SIZE);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 130 BUG_ON(ptep == NULL);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 131 pmd_populate_kernel(&init_mm, pmdp, ptep);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 132 }
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 133 ptep = pte_offset_kernel(pmdp, ea);
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 134 set_pte_at(&init_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT,
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 135 __pgprot(flags)));
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 136 #else /* CONFIG_PPC_MMU_NOHASH */
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 137 /*
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 138 * If the mm subsystem is not fully up, we cannot create a
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 139 * linux page table entry for this mapping. Simply bolt an
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 140 * entry in the hardware page table.
3c726f8d arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2005-11-07 141 *
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 142 */
1189be65 arch/powerpc/mm/pgtable_64.c Paul Mackerras 2007-10-11 @143 if (htab_bolt_mapping(ea, ea + PAGE_SIZE, pa, flags,
1189be65 arch/powerpc/mm/pgtable_64.c Paul Mackerras 2007-10-11 144 mmu_io_psize, mmu_kernel_ssize)) {
77ac166f arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2005-11-10 145 printk(KERN_ERR "Failed to do bolted mapping IO "
77ac166f arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2005-11-10 146 "memory at %016lx !\n", pa);
77ac166f arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2005-11-10 147 return -ENOMEM;
77ac166f arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2005-11-10 148 }
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 149 #endif /* !CONFIG_PPC_MMU_NOHASH */
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 150 }
47ce8af4 arch/powerpc/mm/pgtable_64.c Scott Wood 2013-10-11 151
47ce8af4 arch/powerpc/mm/pgtable_64.c Scott Wood 2013-10-11 152 smp_wmb();
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 153 return 0;
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 154 }
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 155
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 156
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 157 /**
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 158 * __ioremap_at - Low level function to establish the page tables
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 159 * for an IO mapping
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 160 */
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 161 void __iomem * __ioremap_at(phys_addr_t pa, void *ea, unsigned long size,
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 162 unsigned long flags)
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 163 {
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 164 unsigned long i;
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 165
a1f242ff arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2008-07-23 166 /* Make sure we have the base flags */
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 167 if ((flags & _PAGE_PRESENT) == 0)
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 168 flags |= pgprot_val(PAGE_KERNEL);
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 169
a1f242ff arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2008-07-23 170 /* Non-cacheable page cannot be coherent */
a1f242ff arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2008-07-23 171 if (flags & _PAGE_NO_CACHE)
a1f242ff arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2008-07-23 172 flags &= ~_PAGE_COHERENT;
a1f242ff arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2008-07-23 173
a1f242ff arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2008-07-23 174 /* We don't support the 4K PFN hack with ioremap */
a1f242ff arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2008-07-23 175 if (flags & _PAGE_4K_PFN)
a1f242ff arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2008-07-23 176 return NULL;
a1f242ff arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2008-07-23 177
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 178 WARN_ON(pa & ~PAGE_MASK);
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 179 WARN_ON(((unsigned long)ea) & ~PAGE_MASK);
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 180 WARN_ON(size & ~PAGE_MASK);
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 181
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 182 for (i = 0; i < size; i += PAGE_SIZE)
a245067e arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2009-07-23 @183 if (map_kernel_page((unsigned long)ea+i, pa+i, flags))
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 184 return NULL;
14cf11af arch/powerpc/mm/pgtable64.c Paul Mackerras 2005-09-26 185
3d5134ee arch/powerpc/mm/pgtable_64.c Benjamin Herrenschmidt 2007-06-04 186 return (void __iomem *)ea;
:::::: The code at line 143 was first introduced by commit
:::::: 1189be6508d45183013ddb82b18f4934193de274 [POWERPC] Use 1TB segments
:::::: TO: Paul Mackerras [off-list ref]
:::::: CC: Paul Mackerras [off-list ref]
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
This changes _PAGE_PRESENT for 64-bit Book 3S processors from 0x2 to
0x8000_0000_0000_0000, because that is where PowerISA v3.0 CPUs in
radix mode will expect to find it.
All the changes in this patch related to _PAGE_PRESENT movement or are
they cleanup that got added to this patch. I am looking at the hpte slot
array changes and wondering how that is related to _PAGE_PRESENT.
@@ -399,7 +400,7 @@ static inline int pte_protnone(pte_t pte)staticinlineintpte_present(pte_tpte){-returnpte_val(pte)&_PAGE_PRESENT;+return!!(pte_val(pte)&_PAGE_PRESENT);}/* Conversion functions: convert a page and protection to a page entry,
From: Paul Mackerras <hidden> Date: 2016-02-21 22:46:13
On Sat, Feb 20, 2016 at 10:11:14PM +0530, Aneesh Kumar K.V wrote:
Paul Mackerras [off-list ref] writes:
quoted
This changes _PAGE_PRESENT for 64-bit Book 3S processors from 0x2 to
0x8000_0000_0000_0000, because that is where PowerISA v3.0 CPUs in
radix mode will expect to find it.
All the changes in this patch related to _PAGE_PRESENT movement or are
they cleanup that got added to this patch. I am looking at the hpte slot
array changes and wondering how that is related to _PAGE_PRESENT.
I was preserving the property mentioned in this comment:
quoted
/*
* The linux hugepage PMD now include the pmd entries followed by the address
* to the stashed pgtable_t. The stashed pgtable_t contains the hpte bits.
- * [ 1 bit secondary | 3 bit hidx | 1 bit valid | 000]. We use one byte per
+ * [ 000 | 1 bit secondary | 3 bit hidx | 1 bit valid]. We use one byte per
* each HPTE entry. With 16MB hugepage and 64K HPTE we need 256 entries and
* with 4K HPTE we need 4096 entries. Both will fit in a 4K pgtable_t.
*
- * The last three bits are intentionally left to zero. This memory location
+ * The top three bits are intentionally left as zero. This memory location
* are also used as normal page PTE pointers. So if we have any pointers
* left around while we collapse a hugepage, we need to make sure
* _PAGE_PRESENT bit of that is zero when we look at them
I don't know if this comment still applies, but now that _PAGE_PRESENT
is the top bit of a byte rather than one of the low bits, then to avoid
having _PAGE_PRESENT overlap these HPTE location bits in a byte, we
need to move the location bits.
It seems pretty bogus to me that we might interpret an array of these
bytes as a PTE, and if you're sure we never do that, we can drop this
change (and the now-misleading comment).
Paul.
From: Paul Mackerras <hidden> Date: 2016-02-20 06:13:15
This changes _PAGE_PTE for 64-bit Book 3S processors from 0x1 to
0x4000_0000_0000_0000, because that bit is used as the L (leaf)
bit by PowerISA v3.0 CPUs in radix mode. The "leaf" bit indicates
that the PTE points to a page directly rather than another radix
level, which is what the _PAGE_PTE bit means.
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Paul Mackerras <hidden> Date: 2016-02-20 06:13:16
This moves the _PAGE_HASHPTE, _PAGE_F_GIX and _PAGE_F_SECOND fields in
the Linux PTE on 64-bit Book 3S systems to the most significant byte.
Of the 5 bits, one is a software-use bit and the other four are
reserved bit positions in the PowerISA v3.0 radix PTE format.
Using these bits is OK because these bits are all to do with tracking
the HPTE(s) associated with the Linux PTE, and therefore won't be
needed in radix mode. This frees up bit positions in the lower two
bytes.
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash.h | 8 ++++----
arch/powerpc/mm/hugetlbpage-hash64.c | 5 +++--
2 files changed, 7 insertions(+), 6 deletions(-)
@@ -76,7 +76,7 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,if(old_pte&_PAGE_F_SECOND)hash=~hash;slot=(hash&htab_hash_mask)*HPTES_PER_GROUP;-slot+=(old_pte&_PAGE_F_GIX)>>12;+slot+=(old_pte&_PAGE_F_GIX)>>_PAGE_F_GIX_SHIFT;if(ppc_md.hpte_updatepp(slot,rflags,vpn,mmu_psize,mmu_psize,ssize,flags)==-1)
@@ -105,7 +105,8 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,return-1;}-new_pte|=(slot<<12)&(_PAGE_F_SECOND|_PAGE_F_GIX);+new_pte|=(slot<<_PAGE_F_GIX_SHIFT)&+(_PAGE_F_SECOND|_PAGE_F_GIX);}/*
From: Paul Mackerras <hidden> Date: 2016-02-20 06:13:17
This moves the _PAGE_EXEC, _PAGE_RW and _PAGE_USER bits around in
the Linux PTE on 64-bit Book 3S systems to correspond with the bit
positions used in radix mode by PowerISA v3.0 CPUs. This also adds
a _PAGE_READ bit corresponding to the read permission bit in the
radix PTE. _PAGE_READ is currently unused but could possibly be used
in future to improve pte_protnone().
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
This moves the _PAGE_EXEC, _PAGE_RW and _PAGE_USER bits around in
the Linux PTE on 64-bit Book 3S systems to correspond with the bit
positions used in radix mode by PowerISA v3.0 CPUs. This also adds
a _PAGE_READ bit corresponding to the read permission bit in the
radix PTE. _PAGE_READ is currently unused but could possibly be used
in future to improve pte_protnone().
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
For radix, _PAGE_USER is the inverse of this right ?. Ie, we set that
bit position to 1 to indicate privileged access only.
Also can you use constants like
#define _PAGE_USER PPC_BIT(60)
-aneesh
From: Paul Mackerras <hidden> Date: 2016-02-21 22:46:13
On Sun, Feb 21, 2016 at 01:00:54PM +0530, Aneesh Kumar K.V wrote:
Paul Mackerras [off-list ref] writes:
quoted
This moves the _PAGE_EXEC, _PAGE_RW and _PAGE_USER bits around in
the Linux PTE on 64-bit Book 3S systems to correspond with the bit
positions used in radix mode by PowerISA v3.0 CPUs. This also adds
a _PAGE_READ bit corresponding to the read permission bit in the
radix PTE. _PAGE_READ is currently unused but could possibly be used
in future to improve pte_protnone().
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
For radix, _PAGE_USER is the inverse of this right ?. Ie, we set that
bit position to 1 to indicate privileged access only.
Right, we'll need a follow-on patch that changes this to a _PAGE_PRIV
bit and changes the logic that uses _PAGE_USER either that or a
_PAGE_PRIV bit. But at least we have the bit position reserved now.
Also can you use constants like
#define _PAGE_USER PPC_BIT(60)
I'd really rather not - that is harder for the casual reader to parse,
because they then have to go off and find out what exactly PPC_BIT
does. The only time that using PPC_BIT would help is when checking
that the bit definitions match the Power ISA, and that's presumably
done by intelligent people that can handle backwards bit numbering in
their heads. :)
Paul.
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-02-22 00:27:37
On Mon, 2016-02-22 at 09:36 +1100, Paul Mackerras wrote:
On Sun, Feb 21, 2016 at 01:00:54PM +0530, Aneesh Kumar K.V wrote:
quoted
Paul Mackerras [off-list ref] writes:
Also can you use constants like
#define _PAGE_USER PPC_BIT(60)
I'd really rather not - that is harder for the casual reader to parse,
because they then have to go off and find out what exactly PPC_BIT
does. The only time that using PPC_BIT would help is when checking
that the bit definitions match the Power ISA, and that's presumably
done by intelligent people that can handle backwards bit numbering in
their heads. :)
Yep agree 100%.
Using PPC_BIT() means every time someone sees that defintion they need to think
about what the conversion is and whether it's right, ie. for the entire future
history of this code.
On the other hand not using PPC_BIT() means the person who writes the
definition needs to think about it and do the correct conversion, but only
once.
cheers
From: Paul Mackerras <hidden> Date: 2016-02-20 06:13:18
This moves the _PAGE_BUSY, _PAGE_SPECIAL and _PAGE_SOFT_DIRTY bits
in the Linux PTE on 64-bit Book 3S systems to bit positions which
are designated for software use in the radix PTE format used by
PowerISA v3.0 CPUs in radix mode.
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
From: Paul Mackerras <hidden> Date: 2016-02-20 06:13:18
Now that other PTE fields have been moved out of the way, we can
expand the RPN field of the PTE on 64-bit Book 3S systems and align
it with the RPN field in the radix PTE format used by PowerISA v3.0
CPUs in radix mode. For 64k page size, this means we need to move
the _PAGE_COMBO and _PAGE_4K_PFN bits.
Signed-off-by: Paul Mackerras <redacted>
---
arch/powerpc/include/asm/book3s/64/hash-4k.h | 4 ++--
arch/powerpc/include/asm/book3s/64/hash-64k.h | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
@@ -25,8 +25,8 @@#define PGDIR_SIZE (1UL << PGDIR_SHIFT)#define PGDIR_MASK (~(PGDIR_SIZE-1))-#define _PAGE_COMBO 0x00040000 /* this is a combo 4k page */-#define _PAGE_4K_PFN 0x00080000 /* PFN is for a single 4k page */+#define _PAGE_COMBO 0x00001000 /* this is a combo 4k page */+#define _PAGE_4K_PFN 0x00002000 /* PFN is for a single 4k page *//**Usedtotracksubpagegroupvalidif_PAGE_COMBOisset*Thisoverloads_PAGE_F_GIXand_PAGE_F_SECOND
@@ -39,11 +39,11 @@/* Shift to put page number into pte.*-*ThatgivesusamaxRPNof37bits,whichmeansamaxof53bits-*ofaddressablephysicalspace,or49bitsforthespecial4kPFNs.+*ThatgivesusamaxRPNof41bits,whichmeansamaxof57bits+*ofaddressablephysicalspace,or53bitsforthespecial4kPFNs.*/-#define PTE_RPN_SHIFT (20)-#define PTE_RPN_SIZE (37)+#define PTE_RPN_SHIFT (16)+#define PTE_RPN_SIZE (41)/**wesupport16fragmentsperPTEpageof64Ksize.
This patch series modifies the Linux PTE format used on 64-bit Book3S
processors (i.e. POWER server processors) to make the bits line up
with the PTE format used in the radix trees defined in PowerISA v3.0.
This will reduce the amount of further change required to make a
kernel that can run with either a radix MMU or a hashed page table
(HPT) MMU.
This also changes the upper levels of the tree to use real addresses
rather than kernel virtual addresses - that is, we no longer have the
0xc000... at the top of each PGD/PUD/PMD entry. I made this change
for all 64-bit machines, both embedded and server.
The patch series is against v4.5-rc4 plus Aneesh's "powerpc/mm/hash:
Clear the invalid slot information correctly" patch.
I have compiled this for all the defconfigs in the tree, without
error. I have tested this, with the fixes branch of the powerpc tree
merged in, both running bare-metal on a POWER8 and in a KVM guest on
that POWER8 system. In the guest I tested both 4k and 64k configs,
with THP enabled; in the host I tested with 64k page size and THP
enabled. All these tests ran fine, including running a KVM guest on
the bare-metal system. So far I have done kernel compiles in a loop
as the test, but I plan to run LTP and possibly some other tests.
Comments welcome.
I was expecting some complex changes in asm and other part of the code. That
is one of the reason I was holding of a series like this till I get the
radix merged. I should have really tried the radix/hash linux page table
consolidation to see the impact.
Now how do we want to go with this series ?. If we are taking this
series before the books3 hash linux abstraction series, I will have to
redo that series now on top of this.
-aneesh
This patch series modifies the Linux PTE format used on 64-bit Book3S
processors (i.e. POWER server processors) to make the bits line up
with the PTE format used in the radix trees defined in PowerISA v3.0.
This will reduce the amount of further change required to make a
kernel that can run with either a radix MMU or a hashed page table
(HPT) MMU.
This also changes the upper levels of the tree to use real addresses
rather than kernel virtual addresses - that is, we no longer have the
0xc000... at the top of each PGD/PUD/PMD entry. I made this change
for all 64-bit machines, both embedded and server.
The patch series is against v4.5-rc4 plus Aneesh's "powerpc/mm/hash:
Clear the invalid slot information correctly" patch.
I have compiled this for all the defconfigs in the tree, without
error. I have tested this, with the fixes branch of the powerpc tree
merged in, both running bare-metal on a POWER8 and in a KVM guest on
that POWER8 system. In the guest I tested both 4k and 64k configs,
with THP enabled; in the host I tested with 64k page size and THP
enabled. All these tests ran fine, including running a KVM guest on
the bare-metal system. So far I have done kernel compiles in a loop
as the test, but I plan to run LTP and possibly some other tests.
Comments welcome.
I was expecting some complex changes in asm and other part of the code. That
is one of the reason I was holding of a series like this till I get the
radix merged. I should have really tried the radix/hash linux page table
consolidation to see the impact.
Now how do we want to go with this series ?. If we are taking this
series before the books3 hash linux abstraction series, I will have to
redo that series now on top of this.
Another option is to do this on top of book3s hash linux abstraction
series. I can drop the core patch
mm: Some arch may want to use HPAGE_PMD related values as variables
and rest goes in as it is. Later with this patch series we undo some of
abstraction added. With that approach with each pte bit that we are
moving we also document which part of radix won't need an update.
-aneesh
This patch series modifies the Linux PTE format used on 64-bit Book3S
processors (i.e. POWER server processors) to make the bits line up
with the PTE format used in the radix trees defined in PowerISA v3.0.
This will reduce the amount of further change required to make a
kernel that can run with either a radix MMU or a hashed page table
(HPT) MMU.
This also changes the upper levels of the tree to use real addresses
rather than kernel virtual addresses - that is, we no longer have the
0xc000... at the top of each PGD/PUD/PMD entry. I made this change
for all 64-bit machines, both embedded and server.
The patch series is against v4.5-rc4 plus Aneesh's "powerpc/mm/hash:
Clear the invalid slot information correctly" patch.
I have compiled this for all the defconfigs in the tree, without
error. I have tested this, with the fixes branch of the powerpc tree
merged in, both running bare-metal on a POWER8 and in a KVM guest on
that POWER8 system. In the guest I tested both 4k and 64k configs,
with THP enabled; in the host I tested with 64k page size and THP
enabled. All these tests ran fine, including running a KVM guest on
the bare-metal system. So far I have done kernel compiles in a loop
as the test, but I plan to run LTP and possibly some other tests.
Comments welcome.
I was expecting some complex changes in asm and other part of the code. That
is one of the reason I was holding of a series like this till I get the
radix merged. I should have really tried the radix/hash linux page table
consolidation to see the impact.
One of the details that i hit last time with _PAGE_PTE was the usage of
@h symbol in asm code. I did a quick look and I guess we are ok. But it
will be good to double check. pmdp_splitting_flush (which got removed)
had usages like %4@h etc
-aneesh
From: Paul Mackerras <hidden> Date: 2016-02-21 22:46:13
On Sun, Feb 21, 2016 at 01:11:17PM +0530, Aneesh Kumar K.V wrote:
"Aneesh Kumar K.V" [off-list ref] writes:
quoted
Paul Mackerras [off-list ref] writes:
quoted
This patch series modifies the Linux PTE format used on 64-bit Book3S
processors (i.e. POWER server processors) to make the bits line up
with the PTE format used in the radix trees defined in PowerISA v3.0.
This will reduce the amount of further change required to make a
kernel that can run with either a radix MMU or a hashed page table
(HPT) MMU.
This also changes the upper levels of the tree to use real addresses
rather than kernel virtual addresses - that is, we no longer have the
0xc000... at the top of each PGD/PUD/PMD entry. I made this change
for all 64-bit machines, both embedded and server.
The patch series is against v4.5-rc4 plus Aneesh's "powerpc/mm/hash:
Clear the invalid slot information correctly" patch.
I have compiled this for all the defconfigs in the tree, without
error. I have tested this, with the fixes branch of the powerpc tree
merged in, both running bare-metal on a POWER8 and in a KVM guest on
that POWER8 system. In the guest I tested both 4k and 64k configs,
with THP enabled; in the host I tested with 64k page size and THP
enabled. All these tests ran fine, including running a KVM guest on
the bare-metal system. So far I have done kernel compiles in a loop
as the test, but I plan to run LTP and possibly some other tests.
Comments welcome.
I was expecting some complex changes in asm and other part of the code. That
is one of the reason I was holding of a series like this till I get the
radix merged. I should have really tried the radix/hash linux page table
consolidation to see the impact.
One of the details that i hit last time with _PAGE_PTE was the usage of
@h symbol in asm code. I did a quick look and I guess we are ok. But it
will be good to double check. pmdp_splitting_flush (which got removed)
had usages like %4@h etc
I have done some pretty thorough grepping in arch/powerpc. There is
no assembly code left that manipulates Linux PTEs (on 64-bit Book 3S,
that is), because you converted it all to C code. :) There are a
couple of bits of inline asm, but the only bit that is used as an
immediate value is _PAGE_BUSY, which goes from 0x800 to 0x200, and
could actually stay at 0x800 in fact.
Paul.
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-02-22 00:30:47
On Sat, 2016-02-20 at 20:10 +0530, Aneesh Kumar K.V wrote:
Paul Mackerras [off-list ref] writes:
quoted
This patch series modifies the Linux PTE format used on 64-bit Book3S
processors (i.e. POWER server processors) to make the bits line up
with the PTE format used in the radix trees defined in PowerISA v3.0.
This will reduce the amount of further change required to make a
kernel that can run with either a radix MMU or a hashed page table
(HPT) MMU.
This also changes the upper levels of the tree to use real addresses
rather than kernel virtual addresses - that is, we no longer have the
0xc000... at the top of each PGD/PUD/PMD entry. I made this change
for all 64-bit machines, both embedded and server.
The patch series is against v4.5-rc4 plus Aneesh's "powerpc/mm/hash:
Clear the invalid slot information correctly" patch.
I have compiled this for all the defconfigs in the tree, without
error. I have tested this, with the fixes branch of the powerpc tree
merged in, both running bare-metal on a POWER8 and in a KVM guest on
that POWER8 system. In the guest I tested both 4k and 64k configs,
with THP enabled; in the host I tested with 64k page size and THP
enabled. All these tests ran fine, including running a KVM guest on
the bare-metal system. So far I have done kernel compiles in a loop
as the test, but I plan to run LTP and possibly some other tests.
Comments welcome.
I was expecting some complex changes in asm and other part of the code. That
is one of the reason I was holding of a series like this till I get the
radix merged.
Yeah, but you actually rewrote most/all of that code in C as part of your
earlier refactoring :)
Now how do we want to go with this series ?. If we are taking this
series before the books3 hash linux abstraction series, I will have to
redo that series now on top of this.
I'd prefer to merge this first.
I know you'll have to redo your series, but hopefully some of your series can
just go away, because we don't need to abstract the PTE bits anymore.
cheers