Skip to contentSkip to conversation

powerpc/mm: Add a parameter to disable 1TB segs

PATCH Superseded Oliver O'Halloran 4 participants 5 messages Jul 4, 2016 – Jul 5, 2016 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/mm: Add a parameter to disable 1TB segs

This patch adds the kernel command line parameter "no_tb_segs" which forces the kernel to use 256MB rather than 1TB segments. Forcing the use of 256MB segments makes it considerably easier to test code that depends on an SLB miss occurring.

---
 arch/powerpc/mm/hash_utils_64.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/powerpc/mm/hash_utils_64.c +15 -0
index 5b22ba0b58bc..6da1a9d18e15 100644
@@ -321,6 +321,15 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
 	return ret;
 }
 
+static bool no_tb_segs = false;
+
+static int __init parse_no_tb_segs(char *p)
+{
+	no_tb_segs = true;
+	return 0;
+}
+early_param("no_tb_segs", parse_no_tb_segs);
+
 static int __init htab_dt_scan_seg_sizes(unsigned long node,
 					 const char *uname, int depth,
 					 void *data)
@@ -339,6 +348,12 @@ static int __init htab_dt_scan_seg_sizes(unsigned long node,
 	for (; size >= 4; size -= 4, ++prop) {
 		if (be32_to_cpu(prop[0]) == 40) {
 			DBG("1T segment support detected\n");
+
+			if (no_tb_segs) {
+				DBG("Forcing 256MB segments\n");
+				break;
+			}
+
 			cur_cpu_spec->mmu_features |= MMU_FTR_1T_SEGMENT;
 			return 1;
 		}
Signature · 1 line
2.5.5
Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Oliver O'Halloran

This patch adds the kernel command line parameter "no_tb_segs" which forces the kernel to use 256MB rather than 1TB segments. Forcing the use of 256MB segments makes it considerably easier to test code that depends on an SLB miss occurring.

---
 arch/powerpc/mm/hash_utils_64.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/powerpc/mm/hash_utils_64.c +0 -0
index 5b22ba0b58bc..6da1a9d18e15 100644
@@ -321,6 +321,15 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
 	return ret;

arch/powerpc/mm/hash_utils_64.c int htab_remove_mapping(unsigned long vstart, unsigned long vend, · line 331

Quoted 10 lines
arch/powerpc/mm/hash_utils_64.c +8 -0
 }
 
+static bool no_tb_segs = false;
+
+static int __init parse_no_tb_segs(char *p)
+{
+	no_tb_segs = true;
+	return 0;
+}
+early_param("no_tb_segs", parse_no_tb_segs);

Please update Documentation/kernel-paramaters.txt as well and document the use case and the fact that this for debugging.

Quoted 8 lines
arch/powerpc/mm/hash_utils_64.c +1 -0
+
 static int __init htab_dt_scan_seg_sizes(unsigned long node,
 					 const char *uname, int depth,
 					 void *data)
@@ -339,6 +348,12 @@ static int __init htab_dt_scan_seg_sizes(unsigned long node,
 	for (; size >= 4; size -= 4, ++prop) {
 		if (be32_to_cpu(prop[0]) == 40) {

arch/powerpc/mm/hash_utils_64.c static int __init htab_dt_scan_seg_sizes(unsigned long node, · line 359

Quoted 10 lines
arch/powerpc/mm/hash_utils_64.c +6 -0
 			DBG("1T segment support detected\n");
+
+			if (no_tb_segs) {
+				DBG("Forcing 256MB segments\n");
+				break;
+			}
+
 			cur_cpu_spec->mmu_features |= MMU_FTR_1T_SEGMENT;
 			return 1;
 		}

Otherwise

Balbir

#2 lore raw
In reply to Oliver O'Halloran
Quoted 4 lines · Oliver O'Halloran

This patch adds the kernel command line parameter "no_tb_segs" which forces the kernel to use 256MB rather than 1TB segments. Forcing the use of 256MB segments makes it considerably easier to test code that depends on an SLB miss occurring.

That's a fairly awful name :)

Can you call it "disable_1T_segments" ?

It should also be mentioned in Documentation/kernel-parameters.txt, with emphasis that it's a debug option and powerpc only.

cheers

#3 lore raw
Quoted 8 lines · Michael Ellerman
Quoted 7 lines · Oliver O'Halloran

=20
This patch adds the kernel command line parameter "no_tb_segs" which forces the kernel to use 256MB rather than 1TB segments. Forcing the use
of 256MB segments makes it considerably easier to test code that depends
on an SLB miss occurring.

Quoted 7 lines

That's a fairly awful name :)
=20
Can you call it "disable_1T_segments" ?
=C2=A0
=20
It should also be mentioned in Documentation/kernel-parameters.txt, with emphasis that it's a debug option and powerpc only.

To that end, should we add "powerpc_" at the start of the option?

Mikey

author
#4 lore raw
Quoted 11 lines · Michael Neuling
Quoted 10 lines · Michael Ellerman
Quoted 7 lines · Oliver O'Halloran

This patch adds the kernel command line parameter "no_tb_segs" which forces the kernel to use 256MB rather than 1TB segments. Forcing the use
of 256MB segments makes it considerably easier to test code that depends
on an SLB miss occurring.

That's a fairly awful name :)

Quoted 7 lines
Quoted 5 lines

Can you call it "disable_1T_segments" ?

It should also be mentioned in Documentation/kernel-parameters.txt, with emphasis that it's a debug option and powerpc only.

To that end, should we add "powerpc_" at the start of the option?

I don't think it's necessary. There are annotations in kernel-parameters.txt that indicate what options are arch specific and it looks like none of the existing architecture specific options are prefixed.

Quoted 2 lines

Mikey