Skip to contentSkip to conversation

sparc64: swapper_tsb and swapper_4m_tsb phys correction

PATCH In review Bob Picco 2 participants 21 messages Sep 16, 2014 – Sep 25, 2014 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

Bob Picco

author
#0 lore raw

PATCH 1/1 sparc64: swapper_tsb and swapper_4m_tsb phys correction

From: bob picco <[email protected]>

For physical address larger than 47 bits the computed physical address was insufficient within KERN_TSB_LOOKUP_TL1. This resulted in a vmlinux loaded above 47 bits of physical address unable to boot in spectacular ways.

For now we've expanded the physical address range to 52 bits at the cost of two instructions. Older sparc64 incur two nop-s.

The two new instructions from this patch and the former KTSB_PHYS_SHIFT can potentially be eliminated using memblock aligning large and constraining the physical limit. Essentially use the "sethi" for a physical manipulated address and replacing the "or" at patch time with a "sllx". This would leave the tsb within head_64.S unused and possibly not a good solution for Cheetah+. We'll comtemplate this more in another round.

---
 arch/sparc/include/asm/tsb.h    |   33 ++++++++++++++++++++++++++++++++-
 arch/sparc/kernel/vmlinux.lds.S |   10 ++++++++++
 arch/sparc/mm/init_64.c         |   35 +++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+), 1 deletions(-)
arch/sparc/include/asm/tsb.h +32 -1
index 90916f9..d4e09c5 100644
@@ -246,7 +246,24 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	(KERNEL_TSB_SIZE_BYTES / 16)
 #define KERNEL_TSB4M_NENTRIES	4096
 
-#define KTSB_PHYS_SHIFT		15
+	/* This is required for more than 47 bits of physical address.
+	 * It is a memory versus instruction count choice. I chose two
+	 * more instructions which is two nops for not participating sparc64.
+	 * Should we increase the swapper_tsb size and/or swapper_4m_tsb size
+	 * then this choice should be reconsidered.
+	 */
+#define KTSB_PHYS_SHIFT		20
+#define	KTSB_PHYS_MASK_LOW_1MB	(~((1UL << KTSB_PHYS_SHIFT) - 1))
+#ifndef	__ASSEMBLY__
+struct tsb_phys_patch_low_1mb_entry {
+	unsigned int	addr;
+	unsigned int	inst[2];
+};
+extern struct tsb_phys_patch_low_1mb_entry
+	__swapper_phys_low_1mb_patch, __swapper_phys_low_1mb_patch_end,
+	__swapper_4m_phys_low_1mb_patch, __swapper_4m_phys_low_1mb_patch_end;
+#endif
+
 
 	/* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL
 	 * on TSB hit.  REG1, REG2, REG3, and REG4 are used as temporaries
@@ -267,6 +284,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
 	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
 	.previous; \
+661:	nop; \
+	nop; \
+	.section	.swapper_phys_low_1mb_patch, "ax"; \
+	.word		661b; \
+	sethi		0, REG2; \
+	or		REG2, REG1, REG1; \
+	.previous; \
 	srlx		VADDR, PAGE_SHIFT, REG2; \
 	and		REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \
 	sllx		REG2, 4, REG2; \
@@ -292,6 +316,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
 	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
 	.previous; \
+661:	nop; \
+	nop; \
+	.section	.swapper_4m_phys_low_1mb_patch, "ax"; \
+	.word		661b; \
+	sethi		0, REG2; \
+	or		REG2, REG1, REG1; \
+	.previous; \
 	and		TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \
 	sllx		REG2, 4, REG2; \
 	add		REG1, REG2, REG2; \
arch/sparc/kernel/vmlinux.lds.S +10 -0
index 932ff90..2da4f39 100644
@@ -127,6 +127,16 @@ SECTIONS
 		*(.page_offset_shift_patch)
 		__page_offset_shift_patch_end = .;
 	}
+	.swapper_phys_low_1mb_patch : {
+		__swapper_phys_low_1mb_patch = .;
+		*(.swapper_phys_low_1mb_patch)
+		__swapper_phys_low_1mb_patch_end = .;
+	}
+	.swapper_4m_phys_low_1mb_patch : {
+		__swapper_4m_phys_low_1mb_patch = .;
+		*(.swapper_4m_phys_low_1mb_patch)
+		__swapper_4m_phys_low_1mb_patch_end = .;
+	}
 	.popc_3insn_patch : {
 		__popc_3insn_patch = .;
 		*(.popc_3insn_patch)
arch/sparc/mm/init_64.c +35 -0
index 87047fb..1bf4643 100644
@@ -1722,6 +1722,36 @@ static void patch_one_ktsb_phys(unsigned int *start, unsigned int *end, unsigned
 	}
 }
 
+/* We know this patch correctly functions for swapper_tsb and swapper_4m_tsb
+ * because of their respective data alignment. That is bits [31:10] are within
+ * the alignment. The physical address is shifted right 20 which clips the
+ * low bits within thirty two bits.
+ */
+static void
+patch_one_ktsb_phys_low_1mb(struct tsb_phys_patch_low_1mb_entry *entry,
+			    struct tsb_phys_patch_low_1mb_entry *end,
+			    unsigned long phys)
+{
+	unsigned long phys_low_1mb = phys & ~KTSB_PHYS_MASK_LOW_1MB;
+
+	while (entry < end) {
+		unsigned long addr = entry->addr;
+		unsigned int *inst = (unsigned int *)(unsigned long) addr;
+
+		inst[0] = entry->inst[0] | (phys_low_1mb >> 10);
+		__asm__ __volatile__("flush %0\n\t"
+			: /* no outputs */
+			: "r" (inst));
+
+		inst[1] = entry->inst[1];
+		__asm__ __volatile__("flush %0\n\t"
+			: /* no outputs */
+			: "r" (inst + 1));
+
+		entry++;
+	}
+}
+
 static void ktsb_phys_patch(void)
 {
 	extern unsigned int __swapper_tsb_phys_patch;
@@ -1731,6 +1761,8 @@ static void ktsb_phys_patch(void)
 	ktsb_pa = kern_base + ((unsigned long)&swapper_tsb[0] - KERNBASE);
 	patch_one_ktsb_phys(&__swapper_tsb_phys_patch,
 			    &__swapper_tsb_phys_patch_end, ktsb_pa);
+	patch_one_ktsb_phys_low_1mb(&__swapper_phys_low_1mb_patch,
+				    &__swapper_phys_low_1mb_patch_end, ktsb_pa);
 #ifndef CONFIG_DEBUG_PAGEALLOC
 	{
 	extern unsigned int __swapper_4m_tsb_phys_patch;
@@ -1739,6 +1771,9 @@ static void ktsb_phys_patch(void)
 		   ((unsigned long)&swapper_4m_tsb[0] - KERNBASE));
 	patch_one_ktsb_phys(&__swapper_4m_tsb_phys_patch,
 			    &__swapper_4m_tsb_phys_patch_end, ktsb_pa);
+	patch_one_ktsb_phys_low_1mb(&__swapper_4m_phys_low_1mb_patch,
+				    &__swapper_4m_phys_low_1mb_patch_end,
+				    ktsb_pa);
 	}
 #endif
 }
Signature · 1 line
1.7.1
maintainer
#1 lore raw

From: Bob Picco <[email protected]>
Date: Tue, 16 Sep 2014 12:50:39 -0400

Quoted 17 lines

From: bob picco <[email protected]>

For physical address larger than 47 bits the computed physical address was insufficient within KERN_TSB_LOOKUP_TL1. This resulted in a vmlinux loaded above 47 bits of physical address unable to boot in spectacular ways.

For now we've expanded the physical address range to 52 bits at the cost of two instructions. Older sparc64 incur two nop-s.

The two new instructions from this patch and the former KTSB_PHYS_SHIFT can potentially be eliminated using memblock aligning large and constraining the physical limit. Essentially use the "sethi" for a physical manipulated address and replacing the "or" at patch time with a "sllx". This would leave the tsb within head_64.S unused and possibly not a good solution for Cheetah+. We'll comtemplate this more in another round.

Quoted 2 lines

Bob, thanks for doing this work to support up to 49-bits of physical addressing.

There are a lot of tradeoffs and thorny issues involved here, so I'm going to take some time reviewing this set of patches.

I'll try to get back to you on these changes in a reasonable amount of time, thanks for your patience.

author
#2 lore raw
In reply to Bob Picco

David Miller wrote: [Tue Sep 16 2014, 09:48:03PM EDT]

Quoted 20 lines

From: Bob Picco <[email protected]>
Date: Tue, 16 Sep 2014 12:50:39 -0400

Quoted 17 lines

From: bob picco <[email protected]>

For physical address larger than 47 bits the computed physical address was insufficient within KERN_TSB_LOOKUP_TL1. This resulted in a vmlinux loaded above 47 bits of physical address unable to boot in spectacular ways.

For now we've expanded the physical address range to 52 bits at the cost of two instructions. Older sparc64 incur two nop-s.

The two new instructions from this patch and the former KTSB_PHYS_SHIFT can potentially be eliminated using memblock aligning large and constraining the physical limit. Essentially use the "sethi" for a physical manipulated address and replacing the "or" at patch time with a "sllx". This would leave the tsb within head_64.S unused and possibly not a good solution for Cheetah+. We'll comtemplate this more in another round.

Quoted 5 lines
Quoted 2 lines

Bob, thanks for doing this work to support up to 49-bits of physical addressing.

You are very welcome.

Quoted 3 lines

There are a lot of tradeoffs and thorny issues involved here, so I'm going to take some time reviewing this set of patches.

Indeed many tricky issues. I took a first stab at it.

Quoted 3 lines

I'll try to get back to you on these changes in a reasonable amount of time, thanks for your patience.

No hurry and thanx.

maintainer
#3 lore raw
In reply to Bob Picco

From: Bob Picco <[email protected]>
Date: Tue, 16 Sep 2014 12:50:39 -0400

Quoted 17 lines

From: bob picco <[email protected]>

For physical address larger than 47 bits the computed physical address was insufficient within KERN_TSB_LOOKUP_TL1. This resulted in a vmlinux loaded above 47 bits of physical address unable to boot in spectacular ways.

For now we've expanded the physical address range to 52 bits at the cost of two instructions. Older sparc64 incur two nop-s.

The two new instructions from this patch and the former KTSB_PHYS_SHIFT can potentially be eliminated using memblock aligning large and constraining the physical limit. Essentially use the "sethi" for a physical manipulated address and replacing the "or" at patch time with a "sllx". This would leave the tsb within head_64.S unused and possibly not a good solution for Cheetah+. We'll comtemplate this more in another round.

Quoted 2 lines

Bob, I think we can do this with a 4 instruction sequence, basically "sethi, sethi, sllx, or". The two sethi's give us 22 bits each, and we again take advantage of the 32K+ alignment of both kernel TSBs.

Can you give this patch below a quick test on your machine that hits this issue?

Thanks.

==========
[PATCH] sparc64: Adjust KTSB assembler to support larger physical addresses.

As currently coded the KTSB accesses in the kernel only support up to 47 bits of physical addressing.

Adjust the instruction and patching sequence in order to increase it to 54 bits.

Validate that the KTSB physical address will work with this scheme, at run time, so that we fail gracefully instead of crapping all over memory randomly.

---
 arch/sparc/include/asm/tsb.h | 26 ++++++++------------------
 arch/sparc/mm/init_64.c      | 44 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 49 insertions(+), 21 deletions(-)
arch/sparc/include/asm/tsb.h +8 -18
index 90916f9..def62ed4 100644
@@ -246,8 +246,6 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	(KERNEL_TSB_SIZE_BYTES / 16)
 #define KERNEL_TSB4M_NENTRIES	4096
 
-#define KTSB_PHYS_SHIFT		15
-
 	/* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL
 	 * on TSB hit.  REG1, REG2, REG3, and REG4 are used as temporaries
 	 * and the found TTE will be left in REG1.  REG3 and REG4 must
@@ -256,17 +254,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	 * VADDR and TAG will be preserved and not clobbered by this macro.
 	 */
 #define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
-661:	sethi		%hi(swapper_tsb), REG1;			\
-	or		REG1, %lo(swapper_tsb), REG1; \
+661:	sethi		%hi(0), REG1; \
+	sethi		%hi(swapper_tsb), REG2; \
 	.section	.swapper_tsb_phys_patch, "ax"; \
 	.word		661b; \
 	.previous; \
-661:	nop; \
-	.section	.tsb_ldquad_phys_patch, "ax"; \
-	.word		661b; \
-	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
-	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
-	.previous; \
+	sllx		REG1, 32, REG1; \
+	or		REG1, REG2, REG1; \
 	srlx		VADDR, PAGE_SHIFT, REG2; \
 	and		REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \
 	sllx		REG2, 4, REG2; \
@@ -281,17 +275,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	 * we can make use of that for the index computation.
 	 */
 #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
-661:	sethi		%hi(swapper_4m_tsb), REG1;	     \
-	or		REG1, %lo(swapper_4m_tsb), REG1; \
+661:	sethi		%hi(0), REG1; \
+	sethi		%hi(swapper_4m_tsb), REG2; \
 	.section	.swapper_4m_tsb_phys_patch, "ax"; \
 	.word		661b; \
 	.previous; \
-661:	nop; \
-	.section	.tsb_ldquad_phys_patch, "ax"; \
-	.word		661b; \
-	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
-	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
-	.previous; \
+	sllx		REG1, 32, REG1; \
+	or		REG1, REG2, REG1; \
 	and		TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \
 	sllx		REG2, 4, REG2; \
 	add		REG1, REG2, REG2; \
arch/sparc/mm/init_64.c +41 -3

58 lines not on this page · raw message

Signature · 1 line
1.8.1.2
author
#4 lore raw
In reply to Bob Picco

David Miller wrote: [Wed Sep 17 2014, 01:16:22PM EDT]

Quoted 23 lines

From: Bob Picco <[email protected]>
Date: Tue, 16 Sep 2014 12:50:39 -0400

Quoted 17 lines

From: bob picco <[email protected]>

For physical address larger than 47 bits the computed physical address was insufficient within KERN_TSB_LOOKUP_TL1. This resulted in a vmlinux loaded above 47 bits of physical address unable to boot in spectacular ways.

For now we've expanded the physical address range to 52 bits at the cost of two instructions. Older sparc64 incur two nop-s.

The two new instructions from this patch and the former KTSB_PHYS_SHIFT can potentially be eliminated using memblock aligning large and constraining the physical limit. Essentially use the "sethi" for a physical manipulated address and replacing the "or" at patch time with a "sllx". This would leave the tsb within head_64.S unused and possibly not a good solution for Cheetah+. We'll comtemplate this more in another round.

Quoted 2 lines
Quoted 6 lines

Bob, I think we can do this with a 4 instruction sequence, basically "sethi, sethi, sllx, or". The two sethi's give us 22 bits each, and we again take advantage of the 32K+ alignment of both kernel TSBs.

Can you give this patch below a quick test on your machine that hits this issue?

Yes, please give me until later tomorrow. One, I haven't wrapped my head around this code in a bit. The other, the machine is possibly closer to you than me and can be temperamental.

Quoted 2 lines

Thanks.

you're welcome,

bob

maintainer
#5 lore raw
In reply to Bob Picco

From: Bob Picco <[email protected]>
Date: Wed, 17 Sep 2014 15:22:37 -0400

Quoted 2 lines

Yes, please give me until later tomorrow. One, I haven't wrapped my head around this code in a bit.

No problem.

Quoted 2 lines

The other, the machine is possibly closer to you than me and can be temperamental.

Probably it isn't, I'm in NYC at the moment.

author
#6 lore raw
In reply to Bob Picco

David Miller wrote: [Wed Sep 17 2014, 04:04:25PM EDT]

Quoted 7 lines

From: Bob Picco <[email protected]>
Date: Wed, 17 Sep 2014 15:22:37 -0400

Quoted 2 lines

Yes, please give me until later tomorrow. One, I haven't wrapped my head around this code in a bit.

No problem.

Okay.

Quoted 5 lines
Quoted 3 lines

The other, the machine is possibly closer to you than me and can be temperamental.

Probably it isn't, I'm in NYC at the moment.

Ah but you are. I'm in Manchester, NH.

The bloody machine decided to hemorrhage. I'm in repair mode and it usually recovers without issue.

Quoted 2 lines
author
#7 lore raw
In reply to Bob Picco

Hi,
Bob Picco wrote: [Wed Sep 17 2014, 05:00:35PM EDT]

Quoted 10 lines

David Miller wrote: [Wed Sep 17 2014, 04:04:25PM EDT]

Quoted 7 lines

From: Bob Picco <[email protected]>
Date: Wed, 17 Sep 2014 15:22:37 -0400

Quoted 2 lines

Yes, please give me until later tomorrow. One, I haven't wrapped my head around this code in a bit.

No problem.

Okay.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The other, the machine is possibly closer to you than me and can be temperamental.

Probably it isn't, I'm in NYC at the moment.

Ah but you are. I'm in Manchester, NH.

The bloody machine decided to hemorrhage. I'm in repair mode and it usually recovers without issue.

The machine hung after remapping. It could have been my mistake. Please let me investigate.

I have two appointments today. One I forgot about and was reminded with a call late yesterday.

Quoted 6 lines
Quoted 2 lines

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#8 lore raw
In reply to Bob Picco

From: Bob Picco <[email protected]>
Date: Thu, 18 Sep 2014 06:09:12 -0400

Quoted 2 lines

The machine hung after remapping. It could have been my mistake. Please let me investigate.

I was hoping this would have been the simplest of the patches :-)

If you get stuck just print some debugging information with prom_printf() (the physical address of the KTSB, and the final instruction values after patching) then prom_halt() so it doesn't hang and you can reset more quickly.

maintainer
#9 lore raw
In reply to Bob Picco

From: David Miller <[email protected]>
Date: Wed, 17 Sep 2014 13:16:22 -0400 (EDT)

Quoted 1 line

[PATCH] sparc64: Adjust KTSB assembler to support larger physical addresses.

Bob, just a quick update.

I've adjusted this patch of mine to support arbitrary physical addresses, not just up to 54-bits.

With the other related changes being discussed, we will have no limitations to deal with wrt. physical addressing ever again and honestly I don't want to have to play with this area any more :)

--------------------
[PATCH] sparc64: Adjust KTSB assembler to support larger physical addresses.

As currently coded the KTSB accesses in the kernel only support up to 47 bits of physical addressing.

Adjust the instruction and patching sequence in order to support arbitrary 64 bits addresses.

---
 arch/sparc/include/asm/tsb.h | 30 ++++++++++++------------------
 arch/sparc/mm/init_64.c      | 28 +++++++++++++++++++++++++---
 2 files changed, 37 insertions(+), 21 deletions(-)
arch/sparc/include/asm/tsb.h +12 -18
index 90916f9..11c5047 100644
@@ -246,8 +246,6 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	(KERNEL_TSB_SIZE_BYTES / 16)
 #define KERNEL_TSB4M_NENTRIES	4096
 
-#define KTSB_PHYS_SHIFT		15
-
 	/* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL
 	 * on TSB hit.  REG1, REG2, REG3, and REG4 are used as temporaries
 	 * and the found TTE will be left in REG1.  REG3 and REG4 must
@@ -256,17 +254,15 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	 * VADDR and TAG will be preserved and not clobbered by this macro.
 	 */
 #define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
-661:	sethi		%hi(swapper_tsb), REG1;			\
-	or		REG1, %lo(swapper_tsb), REG1; \
+661:	sethi		%uhi(swapper_tsb), REG1; \
+	sethi		%hi(swapper_tsb), REG2; \
+	or		REG1, %ulo(swapper_tsb), REG1; \
+	or		REG2, %lo(swapper_tsb), REG2; \
 	.section	.swapper_tsb_phys_patch, "ax"; \
 	.word		661b; \
 	.previous; \
-661:	nop; \
-	.section	.tsb_ldquad_phys_patch, "ax"; \
-	.word		661b; \
-	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
-	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
-	.previous; \
+	sllx		REG1, 32, REG1; \
+	or		REG1, REG2, REG1; \
 	srlx		VADDR, PAGE_SHIFT, REG2; \
 	and		REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \
 	sllx		REG2, 4, REG2; \
@@ -281,17 +277,15 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	 * we can make use of that for the index computation.
 	 */
 #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
-661:	sethi		%hi(swapper_4m_tsb), REG1;	     \
-	or		REG1, %lo(swapper_4m_tsb), REG1; \
+661:	sethi		%uhi(swapper_4m_tsb), REG1; \
+	sethi		%hi(swapper_4m_tsb), REG2; \
+	or		REG1, %ulo(swapper_4m_tsb), REG1; \
+	or		REG2, %lo(swapper_4m_tsb), REG2; \
 	.section	.swapper_4m_tsb_phys_patch, "ax"; \
 	.word		661b; \
 	.previous; \
-661:	nop; \
-	.section	.tsb_ldquad_phys_patch, "ax"; \
-	.word		661b; \
-	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
-	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \
-	.previous; \
+	sllx		REG1, 32, REG1; \
+	or		REG1, REG2, REG1; \
 	and		TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \
 	sllx		REG2, 4, REG2; \
 	add		REG1, REG2, REG2; \
arch/sparc/mm/init_64.c +25 -3
index c8bccaf..971ac36 100644
@@ -1705,19 +1705,41 @@ static void __init tsb_phys_patch(void)
 static struct hv_tsb_descr ktsb_descr[NUM_KTSB_DESCR];
 extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES];
 
+/* The swapper TSBs are loaded with a base sequence of:
+ *
+ *	sethi	%uhi(SYMBOL), REG1
+ *	sethi	%hi(SYMBOL), REG2
+ *	or	REG1, %ulo(SYMBOL), REG1
+ *	or	REG2, %lo(SYMBOL), REG2
+ *	sllx	REG1, 32, REG1
+ *	or	REG1, REG2, REG1
+ *
+ * When we use physical addressing for the TSB accesses, we patch the
+ * first four instructions in the above sequence.
+ */
+
 static void patch_one_ktsb_phys(unsigned int *start, unsigned int *end, unsigned long pa)
 {
-	pa >>= KTSB_PHYS_SHIFT;
+	unsigned long high_bits, low_bits;
+
+	high_bits = (pa >> 32) & 0xffffffff;
+	low_bits = (pa >> 0) & 0xffffffff;
 
 	while (start < end) {
 		unsigned int *ia = (unsigned int *)(unsigned long)*start;
 
-		ia[0] = (ia[0] & ~0x3fffff) | (pa >> 10);
+		ia[0] = (ia[0] & ~0x3fffff) | (high_bits >> 10);
 		__asm__ __volatile__("flush	%0" : : "r" (ia));
 
-		ia[1] = (ia[1] & ~0x3ff) | (pa & 0x3ff);
+		ia[1] = (ia[1] & ~0x3fffff) | (low_bits >> 10);
 		__asm__ __volatile__("flush	%0" : : "r" (ia + 1));
 
+		ia[2] = (ia[2] & ~0x1fff) | (high_bits & 0x3ff);
+		__asm__ __volatile__("flush	%0" : : "r" (ia + 2));
+
+		ia[3] = (ia[3] & ~0x1fff) | (low_bits & 0x3ff);
+		__asm__ __volatile__("flush	%0" : : "r" (ia + 3));
+
 		start++;
 	}
 }
Signature · 1 line
1.8.1.2
author
#10 lore raw
In reply to Bob Picco

Hi,
David Miller wrote: [Thu Sep 18 2014, 01:08:08PM EDT]

Quoted 6 lines

From: Bob Picco <[email protected]>
Date: Thu, 18 Sep 2014 06:09:12 -0400

Quoted 2 lines

The machine hung after remapping. It could have been my mistake. Please let me investigate.

Quoted 7 lines

I was hoping this would have been the simplest of the patches :-)

If you get stuck just print some debugging information with prom_printf() (the physical address of the KTSB, and the final instruction values after patching) then prom_halt() so it doesn't hang and you can reset more quickly.

Sorry I was being yanked all over the place today. This boots on T5-2. Now I'll look at your second version.

arch/sparc/include/asm/tsb.h +2 -2
diff -u b/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
@@ -259,7 +259,7 @@
 	.section	.swapper_tsb_phys_patch, "ax"; \
 	.word		661b; \
 	.previous; \
-	sllx		REG1, 32, REG1; \
+	sllx		REG1, 22, REG1; \
 	or		REG1, REG2, REG1; \
 	srlx		VADDR, PAGE_SHIFT, REG2; \
 	and		REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \
@@ -280,7 +280,7 @@
 	.section	.swapper_4m_tsb_phys_patch, "ax"; \
 	.word		661b; \
 	.previous; \
-	sllx		REG1, 32, REG1; \
+	sllx		REG1, 22, REG1; \
 	or		REG1, REG2, REG1; \
 	and		TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \
 	sllx		REG2, 4, REG2; \
author
#11 lore raw
In reply to Bob Picco

David Miller wrote: [Thu Sep 18 2014, 03:43:12PM EDT]

Quoted 5 lines

From: David Miller <[email protected]>
Date: Wed, 17 Sep 2014 13:16:22 -0400 (EDT)

Quoted 1 line

[PATCH] sparc64: Adjust KTSB assembler to support larger physical addresses.

Quoted 8 lines

Bob, just a quick update.

I've adjusted this patch of mine to support arbitrary physical addresses, not just up to 54-bits.

With the other related changes being discussed, we will have no limitations to deal with wrt. physical addressing ever again and honestly I don't want to have to play with this area any more :)

Honestly, me too :) It boots fine on T5-2. I'll hopefully take it for a test drive on M7-4 tomorrow.

maintainer
#12 lore raw
In reply to Bob Picco

From: Bob Picco <[email protected]>
Date: Thu, 18 Sep 2014 18:15:30 -0400

Quoted 8 lines

David Miller wrote: [Thu Sep 18 2014, 03:43:12PM EDT]

Quoted 7 lines

From: David Miller <[email protected]>
Date: Wed, 17 Sep 2014 13:16:22 -0400 (EDT)

Quoted 1 line

[PATCH] sparc64: Adjust KTSB assembler to support larger physical addresses.

Bob, just a quick update.

Quoted 8 lines
Quoted 6 lines

I've adjusted this patch of mine to support arbitrary physical addresses, not just up to 54-bits.

With the other related changes being discussed, we will have no limitations to deal with wrt. physical addressing ever again and honestly I don't want to have to play with this area any more :)

Honestly, me too :) It boots fine on T5-2. I'll hopefully take it for a test drive on M7-4 tomorrow.

Thanks for all of your help and testing so far.

So I'll consider this patch good to go.

I'm half-way done with the "use kernel page tables for everything" patch, and will post once I have something that at least work for me.

BTW, with all of the static table removals, my images currently fit in just 2 locked TLB entries :-)

maintainer
#13 lore raw
In reply to Bob Picco

From: David Miller <[email protected]>
Date: Thu, 18 Sep 2014 19:16:37 -0400 (EDT)

Quoted 3 lines

I'm half-way done with the "use kernel page tables for everything" patch, and will post once I have something that at least work for me.

Bob, I ran into a major roadblock which is going to delay this work a little bit.

In fact it pointed out a bug we introduced when increasing max phys bits to 47. We broke DEBUG_PAGEALLOC completely. The issue is that the page table layout only supports up to 43-bits.

I'll brain storm about this over the weekend.

author
#14 lore raw
In reply to Bob Picco

Hi,
David Miller wrote: [Fri Sep 19 2014, 03:28:46PM EDT]

Quoted 9 lines

From: David Miller <[email protected]>
Date: Thu, 18 Sep 2014 19:16:37 -0400 (EDT)

Quoted 3 lines

I'm half-way done with the "use kernel page tables for everything" patch, and will post once I have something that at least work for me.

Bob, I ran into a major roadblock which is going to delay this work a little bit.

Okay.

Quoted 4 lines

In fact it pointed out a bug we introduced when increasing max phys bits to 47. We broke DEBUG_PAGEALLOC completely. The issue is that the page table layout only supports up to 43-bits.

Oh bugger yes. I recall testing this when first introducting four level page table layout in late 2012 and early 2013. It just isn't an everyday thought but VERY nice to have.

Quoted 2 lines

I'll brain storm about this over the weekend.

Me too.

maintainer
#15 lore raw
In reply to Bob Picco

From: Bob Picco <[email protected]>
Date: Fri, 19 Sep 2014 15:57:31 -0400

Quoted 16 lines

Hi,
David Miller wrote: [Fri Sep 19 2014, 03:28:46PM EDT]

Quoted 9 lines

From: David Miller <[email protected]>
Date: Thu, 18 Sep 2014 19:16:37 -0400 (EDT)

Quoted 3 lines

I'm half-way done with the "use kernel page tables for everything" patch, and will post once I have something that at least work for me.

Bob, I ran into a major roadblock which is going to delay this work a little bit.

Okay.

Quoted 4 lines

In fact it pointed out a bug we introduced when increasing max phys bits to 47. We broke DEBUG_PAGEALLOC completely. The issue is that the page table layout only supports up to 43-bits.

Quoted 6 lines

Oh bugger yes. I recall testing this when first introducting four level page table layout in late 2012 and early 2013. It just isn't an everyday thought but VERY nice to have.

Quoted 2 lines

I'll brain storm about this over the weekend.

Me too.

Ok, here is what I have so far and I just got it working.

The long and short of it is that we have a 4-level page table but only for the PAGE_OFFSET linear kernel mappings.

To the rest of the kernel this is transparent, because all vmalloc et al. mappings have virtual addresses which index to swapper_pg_dir.

The only thing I have to do is bring back 256MB et al. mapping usage for suitable aligned PAGE_OFFSET linear areas. It's only using 4MB mappings at the moment.

arch/sparc/include/asm/page_64.h +0 -3
index bf10998..4af4e69 100644
@@ -129,9 +129,6 @@ extern unsigned long PAGE_OFFSET;
  */
 #define MAX_PHYS_ADDRESS_BITS	47
 
-/* These two shift counts are used when indexing sparc64_valid_addr_bitmap
- * and kpte_linear_bitmap.
- */
 #define ILOG2_4MB		22
 #define ILOG2_256MB		28
 
arch/sparc/include/asm/pgtable_64.h +19 -27

103 lines not on this page · raw message

arch/sparc/include/asm/tsb.h +24 -6
index 11c5047..e570894 100644
@@ -133,27 +133,45 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	sub	TSB, 0x8, TSB;   \
 	TSB_STORE(TSB, TAG);
 
-	/* Do a kernel page table walk.  Leaves physical PTE pointer in
+	/* Do a kernel page table walk.  Leaves valid PTE value in
 	 * REG1.  Jumps to FAIL_LABEL on early page table walk termination.
 	 * VADDR will not be clobbered, but REG2 will.
 	 */
 #define KERN_PGTABLE_WALK(VADDR, REG1, REG2, FAIL_LABEL)	\
-	sethi		%hi(swapper_pg_dir), REG1; \
-	or		REG1, %lo(swapper_pg_dir), REG1; \
-	sllx		VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
+	sethi		%hi(kpgd_demux), REG1; \
+	or		REG1, %lo(kpgd_demux), REG1; \
+	sllx		VADDR, 64 - (KPGD_SHIFT + KPGD_BITS), REG2; \
 	srlx		REG2, 64 - PAGE_SHIFT, REG2; \
 	andn		REG2, 0x7, REG2; \
 	ldx		[REG1 + REG2], REG1; \
 	brz,pn		REG1, FAIL_LABEL; \
+	 sllx		VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
+	srlx		REG2, 64 - PAGE_SHIFT, REG2; \
+	andn		REG2, 0x7, REG2; \
+	ldxa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
+	brz,pn		REG1, FAIL_LABEL; \
 	 sllx		VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
 	srlx		REG2, 64 - PAGE_SHIFT, REG2; \
 	andn		REG2, 0x7, REG2; \
 	ldxa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
+	sethi		%uhi(_PAGE_PMD_HUGE), REG2; \
 	brz,pn		REG1, FAIL_LABEL; \
-	 sllx		VADDR, 64 - PMD_SHIFT, REG2; \
+	 sllx		REG2, 32, REG2; \
+	andcc		REG1, REG2, %g0; \
+	be,pn		%xcc, 698f; \
+	 sethi		%hi(4 * 1024 * 1024), REG2; \
+	brgez,pn	REG1, FAIL_LABEL; \
+	 andn		REG1, REG2, REG1; \
+	and		VADDR, REG2, REG2; \
+	ba,pt		%xcc, 699f; \
+	 or		REG1, REG2, REG1; \
+698:	sllx		VADDR, 64 - PMD_SHIFT, REG2; \
 	srlx		REG2, 64 - PAGE_SHIFT, REG2; \
 	andn		REG2, 0x7, REG2; \
-	add		REG1, REG2, REG1;
+	ldxa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
+	brgez,pn	REG1, FAIL_LABEL; \
+	 nop; \
+699:
 
 	/* PMD has been loaded into REG1, interpret the value, seeing
 	 * if it is a HUGE PMD or a normal one.  If it is not valid
arch/sparc/kernel/ktlb.S +9 -99

134 lines not on this page · raw message

arch/sparc/mm/init_64.c +68 -178

342 lines not on this page · raw message

arch/sparc/mm/init_64.h +0 -7
index 0668b36..29ff73f 100644
@@ -8,15 +8,8 @@
  */
 
 #define MAX_PHYS_ADDRESS	(1UL << MAX_PHYS_ADDRESS_BITS)
-#define KPTE_BITMAP_CHUNK_SZ		(256UL * 1024UL * 1024UL)
-#define KPTE_BITMAP_BYTES	\
-	((MAX_PHYS_ADDRESS / KPTE_BITMAP_CHUNK_SZ) / 4)
-#define VALID_ADDR_BITMAP_CHUNK_SZ	(4UL * 1024UL * 1024UL)
-#define VALID_ADDR_BITMAP_BYTES	\
-	((MAX_PHYS_ADDRESS / VALID_ADDR_BITMAP_CHUNK_SZ) / 8)
 
 extern unsigned long kern_linear_pte_xor[4];
-extern unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)];
 extern unsigned int sparc64_highest_unlocked_tlb_ent;
 extern unsigned long sparc64_kern_pri_context;
 extern unsigned long sparc64_kern_pri_nuc_bits;
author
#16 lore raw
In reply to Bob Picco

Hi,
David Miller wrote: [Mon Sep 22 2014, 12:22:46AM EDT]

Quoted 19 lines

From: Bob Picco <[email protected]>
Date: Fri, 19 Sep 2014 15:57:31 -0400

Quoted 16 lines

Hi,
David Miller wrote: [Fri Sep 19 2014, 03:28:46PM EDT]

Quoted 9 lines

From: David Miller <[email protected]>
Date: Thu, 18 Sep 2014 19:16:37 -0400 (EDT)

Quoted 3 lines

I'm half-way done with the "use kernel page tables for everything" patch, and will post once I have something that at least work for me.

Bob, I ran into a major roadblock which is going to delay this work a little bit.

Okay.

Quoted 4 lines

In fact it pointed out a bug we introduced when increasing max phys bits to 47. We broke DEBUG_PAGEALLOC completely. The issue is that the page table layout only supports up to 43-bits.

Quoted 8 lines
Quoted 6 lines

Oh bugger yes. I recall testing this when first introducting four level page table layout in late 2012 and early 2013. It just isn't an everyday thought but VERY nice to have.

Quoted 2 lines

I'll brain storm about this over the weekend.

Me too.

Ok, here is what I have so far and I just got it working.

I thought about this issue some over the weekend and PRIQ. Most variants considered for this issue were not appealing.

Quoted 3 lines

The long and short of it is that we have a 4-level page table but only for the PAGE_OFFSET linear kernel mappings.

This is the variant that seems good to me. It should prevent future issues for at least another core revision - me hopes.

Quoted 4 lines

To the rest of the kernel this is transparent, because all vmalloc et al. mappings have virtual addresses which index to swapper_pg_dir.

Yes, I reviewed most of the code before attempting to use it :)

Jalap?no and T5-2 seem happy. From T5-2:

[    0.000000] Kernel: Using 3 locked TLB entries for main kernel image.
Quoted 4 lines

The only thing I have to do is bring back 256MB et al. mapping usage for suitable aligned PAGE_OFFSET linear areas. It's only using 4MB mappings at the moment.

Okay.

I'll review more.

Oh and boot with DEBUG_PAGEALLOC at some point.
Alright, need to chase a DEBUG_PAGEALLOC issue with prom_halt() blink:
[bpicco@zareason ~]$ cat /tmp/t5-blink.txt

[23233.728105] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[23233.753380] SUN4V-DTLB: Error at TPC[446930], tl 1
[23233.762729] SUN4V-DTLB: TPC<dma_4v_map_page+0x10/0x220>
[23233.773124] SUN4V-DTLB: O7[55206c]
[23233.779910] SUN4V-DTLB: O7<cache_grow+0x12c/0x200>
[23233.789455] SUN4V-DTLB: vaddr[1103f23e000] ctx[0] pte[0] error[2]

. We were nearly at the console login prompt. Hm, maybe turn off LDOMS config :)

thanx and nice!

maintainer
#17 lore raw
In reply to Bob Picco

From: Bob Picco <[email protected]>
Date: Mon, 22 Sep 2014 14:56:31 -0400

Quoted 11 lines

David Miller wrote: [Mon Sep 22 2014, 12:22:46AM EDT]

Quoted 6 lines

From: Bob Picco <[email protected]>
Date: Fri, 19 Sep 2014 15:57:31 -0400

To the rest of the kernel this is transparent, because all vmalloc et al. mappings have virtual addresses which index to swapper_pg_dir.

Yes, I reviewed most of the code before attempting to use it :)

Jalap?no and T5-2 seem happy. From T5-2:

[    0.000000] Kernel: Using 3 locked TLB entries for main kernel image.

Yeah we only get down to 2 locked TLB entries when we deal with ditching the vmemmap table too, which I'll work on combining into this work.

Quoted 10 lines

Alright, need to chase a DEBUG_PAGEALLOC issue with prom_halt() blink:
[bpicco@zareason ~]$ cat /tmp/t5-blink.txt

[23233.728105] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[23233.753380] SUN4V-DTLB: Error at TPC[446930], tl 1
[23233.762729] SUN4V-DTLB: TPC<dma_4v_map_page+0x10/0x220>
[23233.773124] SUN4V-DTLB: O7[55206c]
[23233.779910] SUN4V-DTLB: O7<cache_grow+0x12c/0x200>
[23233.789455] SUN4V-DTLB: vaddr[1103f23e000] ctx[0] pte[0] error[2]

. We were nearly at the console login prompt. Hm, maybe turn off LDOMS config :)

Hmmm...

maintainer
#18 lore raw
In reply to Bob Picco

From: Bob Picco <[email protected]>
Date: Mon, 22 Sep 2014 14:56:31 -0400

Quoted 11 lines

I'll review more.

Oh and boot with DEBUG_PAGEALLOC at some point.
Alright, need to chase a DEBUG_PAGEALLOC issue with prom_halt() blink:
[bpicco@zareason ~]$ cat /tmp/t5-blink.txt

[23233.728105] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[23233.753380] SUN4V-DTLB: Error at TPC[446930], tl 1
[23233.762729] SUN4V-DTLB: TPC<dma_4v_map_page+0x10/0x220>
[23233.773124] SUN4V-DTLB: O7[55206c]
[23233.779910] SUN4V-DTLB: O7<cache_grow+0x12c/0x200>
[23233.789455] SUN4V-DTLB: vaddr[1103f23e000] ctx[0] pte[0] error[2]
Quoted 4 lines

. We were nearly at the console login prompt. Hm, maybe turn off LDOMS config :)

thanx and nice!

Bob, here is what I have now, can you please help me test it?

It should restore 256MB/2GB/16GB page size usage.

The biggest bug was that I wasn't flushing the kernel TSB(s) after building the kernel page tables and NOP'ing out that instruction in kernel_physical_mapping_init().

Once I fixed that everything runs smoothly so far :-)

I haven't gotten to testing DEBUG_PAGEALLOC yet, but I suspect it probably works now.

Thanks!

arch/sparc/include/asm/page_64.h +0 -3
index bf10998..4af4e69 100644
@@ -129,9 +129,6 @@ extern unsigned long PAGE_OFFSET;
  */
 #define MAX_PHYS_ADDRESS_BITS	47
 
-/* These two shift counts are used when indexing sparc64_valid_addr_bitmap
- * and kpte_linear_bitmap.
- */
 #define ILOG2_4MB		22
 #define ILOG2_256MB		28
 
arch/sparc/include/asm/pgtable_64.h +34 -27

127 lines not on this page · raw message

arch/sparc/include/asm/tsb.h +29 -6
index 11c5047..1a18148 100644
@@ -133,27 +133,50 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	sub	TSB, 0x8, TSB;   \
 	TSB_STORE(TSB, TAG);
 
-	/* Do a kernel page table walk.  Leaves physical PTE pointer in
+	/* Do a kernel page table walk.  Leaves valid PTE value in
 	 * REG1.  Jumps to FAIL_LABEL on early page table walk termination.
 	 * VADDR will not be clobbered, but REG2 will.
 	 */
 #define KERN_PGTABLE_WALK(VADDR, REG1, REG2, FAIL_LABEL)	\
-	sethi		%hi(swapper_pg_dir), REG1; \
-	or		REG1, %lo(swapper_pg_dir), REG1; \
-	sllx		VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
+	sethi		%hi(kpgd_demux), REG1; \
+	or		REG1, %lo(kpgd_demux), REG1; \
+	sllx		VADDR, 64 - (KPGD_SHIFT + KPGD_BITS), REG2; \
 	srlx		REG2, 64 - PAGE_SHIFT, REG2; \
 	andn		REG2, 0x7, REG2; \
 	ldx		[REG1 + REG2], REG1; \
 	brz,pn		REG1, FAIL_LABEL; \
+	 sllx		VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
+	srlx		REG2, 64 - PAGE_SHIFT, REG2; \
+	andn		REG2, 0x7, REG2; \
+	ldxa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
+	sethi		%uhi(_PAGE_PUD_HUGE), REG2; \
+	brz,pn		REG1, FAIL_LABEL; \
+	 sllx		REG2, 32, REG2; \
+	andcc		REG1, REG2, %g0; \
+	bne,pt		%xcc, 697f; \
 	 sllx		VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
 	srlx		REG2, 64 - PAGE_SHIFT, REG2; \
 	andn		REG2, 0x7, REG2; \
 	ldxa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
+	sethi		%uhi(_PAGE_PMD_HUGE), REG2; \
 	brz,pn		REG1, FAIL_LABEL; \
-	 sllx		VADDR, 64 - PMD_SHIFT, REG2; \
+	 sllx		REG2, 32, REG2; \
+	andcc		REG1, REG2, %g0; \
+	be,pn		%xcc, 698f; \
+697:	 sethi		%hi(0xffe00000), REG2; \
+	sllx		REG2, 1, REG2; \
+	brgez,pn	REG1, FAIL_LABEL; \
+	 andn		REG1, REG2, REG1; \
+	and		VADDR, REG2, REG2; \
+	ba,pt		%xcc, 699f; \
+	 or		REG1, REG2, REG1; \
+698:	sllx		VADDR, 64 - PMD_SHIFT, REG2; \
 	srlx		REG2, 64 - PAGE_SHIFT, REG2; \
 	andn		REG2, 0x7, REG2; \
-	add		REG1, REG2, REG1;
+	ldxa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
+	brgez,pn	REG1, FAIL_LABEL; \
+	 nop; \
+699:
 
 	/* PMD has been loaded into REG1, interpret the value, seeing
 	 * if it is a HUGE PMD or a normal one.  If it is not valid
arch/sparc/kernel/ktlb.S +9 -99

134 lines not on this page · raw message

arch/sparc/mm/init_64.c +175 -173

471 lines not on this page · raw message

arch/sparc/mm/init_64.h +0 -7
index 0668b36..29ff73f 100644
@@ -8,15 +8,8 @@
  */
 
 #define MAX_PHYS_ADDRESS	(1UL << MAX_PHYS_ADDRESS_BITS)
-#define KPTE_BITMAP_CHUNK_SZ		(256UL * 1024UL * 1024UL)
-#define KPTE_BITMAP_BYTES	\
-	((MAX_PHYS_ADDRESS / KPTE_BITMAP_CHUNK_SZ) / 4)
-#define VALID_ADDR_BITMAP_CHUNK_SZ	(4UL * 1024UL * 1024UL)
-#define VALID_ADDR_BITMAP_BYTES	\
-	((MAX_PHYS_ADDRESS / VALID_ADDR_BITMAP_CHUNK_SZ) / 8)
 
 extern unsigned long kern_linear_pte_xor[4];
-extern unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)];
 extern unsigned int sparc64_highest_unlocked_tlb_ent;
 extern unsigned long sparc64_kern_pri_context;
 extern unsigned long sparc64_kern_pri_nuc_bits;
author
#19 lore raw
In reply to Bob Picco

Hi,
David Miller wrote: [Wed Sep 24 2014, 06:26:51PM EDT]

Quoted 17 lines

From: Bob Picco <[email protected]>
Date: Mon, 22 Sep 2014 14:56:31 -0400

Quoted 14 lines

I'll review more.

Oh and boot with DEBUG_PAGEALLOC at some point.
Alright, need to chase a DEBUG_PAGEALLOC issue with prom_halt() blink:
[bpicco@zareason ~]$ cat /tmp/t5-blink.txt

[23233.728105] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[23233.753380] SUN4V-DTLB: Error at TPC[446930], tl 1
[23233.762729] SUN4V-DTLB: TPC<dma_4v_map_page+0x10/0x220>
[23233.773124] SUN4V-DTLB: O7[55206c]
[23233.779910] SUN4V-DTLB: O7<cache_grow+0x12c/0x200>
[23233.789455] SUN4V-DTLB: vaddr[1103f23e000] ctx[0] pte[0] error[2]

. We were nearly at the console login prompt. Hm, maybe turn off LDOMS config :)

Quoted 3 lines
Quoted 1 line

thanx and nice!

Bob, here is what I have now, can you please help me test it?

Absolutely. I'm slightly exhausted at the moment and productivity would be uncertain.

Quoted 6 lines

It should restore 256MB/2GB/16GB page size usage.

The biggest bug was that I wasn't flushing the kernel TSB(s) after building the kernel page tables and NOP'ing out that instruction in kernel_physical_mapping_init().

Okay.

Quoted 2 lines

Once I fixed that everything runs smoothly so far :-)

Good.

Quoted 3 lines

I haven't gotten to testing DEBUG_PAGEALLOC yet, but I suspect it probably works now.

Ah, I didn't return to this. In fact I've been busy with other things. I will help.

Quoted 2 lines

Thanks!

you're welcome!

author
#20 lore raw
In reply to Bob Picco

David Miller wrote: [Wed Sep 24 2014, 06:26:51PM EDT]

Quoted 27 lines

From: Bob Picco <[email protected]>
Date: Mon, 22 Sep 2014 14:56:31 -0400

Quoted 11 lines

I'll review more.

Oh and boot with DEBUG_PAGEALLOC at some point.
Alright, need to chase a DEBUG_PAGEALLOC issue with prom_halt() blink:
[bpicco@zareason ~]$ cat /tmp/t5-blink.txt

[23233.728105] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[23233.753380] SUN4V-DTLB: Error at TPC[446930], tl 1
[23233.762729] SUN4V-DTLB: TPC<dma_4v_map_page+0x10/0x220>
[23233.773124] SUN4V-DTLB: O7[55206c]
[23233.779910] SUN4V-DTLB: O7<cache_grow+0x12c/0x200>
[23233.789455] SUN4V-DTLB: vaddr[1103f23e000] ctx[0] pte[0] error[2]
Quoted 4 lines

. We were nearly at the console login prompt. Hm, maybe turn off LDOMS config :)

thanx and nice!

Bob, here is what I have now, can you please help me test it?

It should restore 256MB/2GB/16GB page size usage.

The biggest bug was that I wasn't flushing the kernel TSB(s) after building the kernel page tables and NOP'ing out that instruction in kernel_physical_mapping_init().

Quoted 6 lines

Once I fixed that everything runs smoothly so far :-)

I haven't gotten to testing DEBUG_PAGEALLOC yet, but I suspect it probably works now.

Thanks!

Boots up !DEBUG_PAGEALLOC on T5-2. Review is in progress and looks good so far. This is important to have correct as we both know. I will attempt DEBUG_PAGEALLOC, hopefully later today, locally.

We should give it a spin on M7. Though it is scheduled for a core upgrade today and one never knows :)