All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: Add a parameter to disable 1TB segs
@ 2016-07-04  0:44 Oliver O'Halloran
  2016-07-04  4:59 ` Balbir Singh
  2016-07-04  6:09 ` Michael Ellerman
  0 siblings, 2 replies; 5+ messages in thread
From: Oliver O'Halloran @ 2016-07-04  0:44 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mikey, mpe, 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.

Suggested-by: Michael Neuling <mikey@neuling.org>
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 arch/powerpc/mm/hash_utils_64.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 5b22ba0b58bc..6da1a9d18e15 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -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;
 		}
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/mm: Add a parameter to disable 1TB segs
  2016-07-04  0:44 [PATCH] powerpc/mm: Add a parameter to disable 1TB segs Oliver O'Halloran
@ 2016-07-04  4:59 ` Balbir Singh
  2016-07-04  6:09 ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Balbir Singh @ 2016-07-04  4:59 UTC (permalink / raw)
  To: Oliver O'Halloran, linuxppc-dev; +Cc: mikey



On 04/07/16 10:44, Oliver O'Halloran wrote:
> 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.
> 
> Suggested-by: Michael Neuling <mikey@neuling.org>
> Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  arch/powerpc/mm/hash_utils_64.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index 5b22ba0b58bc..6da1a9d18e15 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -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);


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

> +
>  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;
>  		}
> 

Otherwise

Acked-by: Balbir Singh <bsingharora@gmail.com>

Balbir

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc/mm: Add a parameter to disable 1TB segs
  2016-07-04  0:44 [PATCH] powerpc/mm: Add a parameter to disable 1TB segs Oliver O'Halloran
  2016-07-04  4:59 ` Balbir Singh
@ 2016-07-04  6:09 ` Michael Ellerman
  2016-07-05  0:24   ` Michael Neuling
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2016-07-04  6:09 UTC (permalink / raw)
  To: Oliver O'Halloran, linuxppc-dev; +Cc: mikey, Oliver O'Halloran

On Mon, 2016-04-07 at 00:44:04 UTC, Oliver O'Halloran wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc/mm: Add a parameter to disable 1TB segs
  2016-07-04  6:09 ` Michael Ellerman
@ 2016-07-05  0:24   ` Michael Neuling
  2016-07-05  0:53     ` oliver
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Neuling @ 2016-07-05  0:24 UTC (permalink / raw)
  To: Michael Ellerman, Oliver O'Halloran, linuxppc-dev

On Mon, 2016-07-04 at 16:09 +1000, Michael Ellerman wrote:
> On Mon, 2016-04-07 at 00:44:04 UTC, Oliver O'Halloran wrote:
> >=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.
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc/mm: Add a parameter to disable 1TB segs
  2016-07-05  0:24   ` Michael Neuling
@ 2016-07-05  0:53     ` oliver
  0 siblings, 0 replies; 5+ messages in thread
From: oliver @ 2016-07-05  0:53 UTC (permalink / raw)
  To: Michael Neuling; +Cc: Michael Ellerman, linuxppc-dev

On Tue, Jul 5, 2016 at 10:24 AM, Michael Neuling <mikey@neuling.org> wrote:
> On Mon, 2016-07-04 at 16:09 +1000, Michael Ellerman wrote:
>> On Mon, 2016-04-07 at 00:44:04 UTC, Oliver O'Halloran wrote:
>> >
>> > 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.
>
> 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.

>
> Mikey

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-05  0:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-04  0:44 [PATCH] powerpc/mm: Add a parameter to disable 1TB segs Oliver O'Halloran
2016-07-04  4:59 ` Balbir Singh
2016-07-04  6:09 ` Michael Ellerman
2016-07-05  0:24   ` Michael Neuling
2016-07-05  0:53     ` oliver

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.