linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Donate dedicated CPU cycles
@ 2007-05-31 19:14 Jake Moilanen
  2007-05-31 20:14 ` Olof Johansson
  2007-06-06  4:25 ` Paul Mackerras
  0 siblings, 2 replies; 6+ messages in thread
From: Jake Moilanen @ 2007-05-31 19:14 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

A Power6 can give up CPU cycles on a dedicated CPU (as opposed to a
shared CPU) to other shared processors if the administrator asks for it
(via the HMC).

This patch enables that to work properly on P6.

This just involves setting a bit in the CAS structure as well as the
VPA.  To donate cycles, a CPU has to have all SMT threads idle and w/
donate bit set in the VPA.  Then call H_CEDE.

Signed-off-by: Jake Moilanen <moilanen@austin.ibm.com>

--
 arch/powerpc/kernel/prom_init.c        |    4 +++-
 arch/powerpc/platforms/pseries/setup.c |    2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

Index: powerpc/arch/powerpc/kernel/prom_init.c
===================================================================
--- powerpc.orig/arch/powerpc/kernel/prom_init.c
+++ powerpc/arch/powerpc/kernel/prom_init.c
@@ -635,6 +635,7 @@ static void __init early_cmdline_parse(v
 /* ibm,dynamic-reconfiguration-memory property supported */
 #define OV5_DRCONF_MEMORY	0x20
 #define OV5_LARGE_PAGES		0x10	/* large pages supported */
+#define OV5_DONATE_DEDICATE_CPU 0x02	/* donate dedicated CPU support */
 /* PCIe/MSI support.  Without MSI full PCIe is not supported */
 #ifdef CONFIG_PCI_MSI
 #define OV5_MSI			0x01	/* PCIe/MSI support */
@@ -685,7 +686,8 @@ static unsigned char ibm_architecture_ve
 	/* option vector 5: PAPR/OF options */
 	3 - 2,				/* length */
 	0,				/* don't ignore, don't halt */
-	OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY | OV5_MSI,
+	OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY |
+	OV5_DONATE_DEDICATE_CPU | OV5_MSI,
 };
 
 /* Old method - ELF header with PT_NOTE sections */
Index: powerpc/arch/powerpc/platforms/pseries/setup.c
===================================================================
--- powerpc.orig/arch/powerpc/platforms/pseries/setup.c
+++ powerpc/arch/powerpc/platforms/pseries/setup.c
@@ -399,6 +399,7 @@ static void pseries_dedicated_idle_sleep
 	 * a good time to find other work to dispatch.
 	 */
 	get_lppaca()->idle = 1;
+	get_lppaca()->cpuctls_task_attrs = 1;
 
 	/*
 	 * We come in with interrupts disabled, and need_resched()
@@ -431,6 +432,7 @@ static void pseries_dedicated_idle_sleep
 
 out:
 	HMT_medium();
+	get_lppaca()->cpuctls_task_attrs = 0;
 	get_lppaca()->idle = 0;
 }
 

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

* Re: [PATCH] Donate dedicated CPU cycles
  2007-05-31 19:14 [PATCH] Donate dedicated CPU cycles Jake Moilanen
@ 2007-05-31 20:14 ` Olof Johansson
  2007-06-06  4:25 ` Paul Mackerras
  1 sibling, 0 replies; 6+ messages in thread
From: Olof Johansson @ 2007-05-31 20:14 UTC (permalink / raw)
  To: Jake Moilanen; +Cc: linuxppc-dev, Paul Mackerras

Hi,

On Thu, May 31, 2007 at 02:14:45PM -0500, Jake Moilanen wrote:
> A Power6 can give up CPU cycles on a dedicated CPU (as opposed to a
> shared CPU) to other shared processors if the administrator asks for it
> (via the HMC).
> 
> This patch enables that to work properly on P6.
> 
> This just involves setting a bit in the CAS structure as well as the
> VPA.  To donate cycles, a CPU has to have all SMT threads idle and w/
> donate bit set in the VPA.  Then call H_CEDE.

[...]

> Index: powerpc/arch/powerpc/platforms/pseries/setup.c
> ===================================================================
> --- powerpc.orig/arch/powerpc/platforms/pseries/setup.c
> +++ powerpc/arch/powerpc/platforms/pseries/setup.c
> @@ -399,6 +399,7 @@ static void pseries_dedicated_idle_sleep
>  	 * a good time to find other work to dispatch.
>  	 */
>  	get_lppaca()->idle = 1;
> +	get_lppaca()->cpuctls_task_attrs = 1;
>  
>  	/*
>  	 * We come in with interrupts disabled, and need_resched()
> @@ -431,6 +432,7 @@ static void pseries_dedicated_idle_sleep
>  
>  out:
>  	HMT_medium();
> +	get_lppaca()->cpuctls_task_attrs = 0;
>  	get_lppaca()->idle = 0;
>  }

Is this really the cpu controls task attribute field any more?  If this
is not just a flag (stored in a byte), the variable should be renamed
accordingly. If it is truly an attribute bitfield, then the attributes
should be named and constants used instead.


-Olof

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

* Re: [PATCH] Donate dedicated CPU cycles
  2007-05-31 19:14 [PATCH] Donate dedicated CPU cycles Jake Moilanen
  2007-05-31 20:14 ` Olof Johansson
@ 2007-06-06  4:25 ` Paul Mackerras
  2007-06-07 21:24   ` Jake Moilanen
                     ` (2 more replies)
  1 sibling, 3 replies; 6+ messages in thread
From: Paul Mackerras @ 2007-06-06  4:25 UTC (permalink / raw)
  To: Jake Moilanen; +Cc: linuxppc-dev

Jake Moilanen writes:

> A Power6 can give up CPU cycles on a dedicated CPU (as opposed to a
> shared CPU) to other shared processors if the administrator asks for it
> (via the HMC).
> 
> This patch enables that to work properly on P6.

Is this something that needs to be controlled from userland, e.g. by a
sysctl or something in /sys?

Paul.

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

* Re: [PATCH] Donate dedicated CPU cycles
  2007-06-06  4:25 ` Paul Mackerras
@ 2007-06-07 21:24   ` Jake Moilanen
  2007-06-07 21:27   ` [PATCH 1/2] " Jake Moilanen
  2007-06-07 21:30   ` [PATCH 2/2] " Jake Moilanen
  2 siblings, 0 replies; 6+ messages in thread
From: Jake Moilanen @ 2007-06-07 21:24 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

On Wed, 2007-06-06 at 14:25 +1000, Paul Mackerras wrote:
> Jake Moilanen writes:
> 
> > A Power6 can give up CPU cycles on a dedicated CPU (as opposed to a
> > shared CPU) to other shared processors if the administrator asks for it
> > (via the HMC).
> > 
> > This patch enables that to work properly on P6.
> 
> Is this something that needs to be controlled from userland, e.g. by a
> sysctl or something in /sys?

The turning on of donating of dedicated CPU cycles is done via the HMC.
IHMO, it would be a bit redundant to do it in two places.

The reason why this is better than just shared processors is the
partitions w/ dedicated CPUs are guaranteed an actual processor, yet the
system is still able to increase the capacity of the shared CPU pool.

I have an updated patch come w/ a rename of the VPA field.

Jake

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

* [PATCH 1/2] Donate dedicated CPU cycles
  2007-06-06  4:25 ` Paul Mackerras
  2007-06-07 21:24   ` Jake Moilanen
@ 2007-06-07 21:27   ` Jake Moilanen
  2007-06-07 21:30   ` [PATCH 2/2] " Jake Moilanen
  2 siblings, 0 replies; 6+ messages in thread
From: Jake Moilanen @ 2007-06-07 21:27 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Rename the VPA's cpuctls_task_attrs field to a more accurate name.

Signed-off-by: Jake Moilanen <moilanen@austin.ibm.com>

--

 include/asm-powerpc/lppaca.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: powerpc/include/asm-powerpc/lppaca.h
===================================================================
--- powerpc.orig/include/asm-powerpc/lppaca.h
+++ powerpc/include/asm-powerpc/lppaca.h
@@ -98,7 +98,7 @@ struct lppaca {
 	u64	saved_gpr5;		// Saved GPR5                   x30-x37
 
 	u8	reserved4;		// Reserved			x38-x38
-	u8	cpuctls_task_attrs;	// Task attributes for cpuctls  x39-x39
+	u8	donate_dedicated_cpu;	// Donate dedicated CPU cycles  x39-x39
 	u8	fpregs_in_use;		// FP regs in use               x3A-x3A
 	u8	pmcregs_in_use;		// PMC regs in use              x3B-x3B
 	volatile u32 saved_decr;	// Saved Decr Value             x3C-x3F

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

* [PATCH 2/2] Donate dedicated CPU cycles
  2007-06-06  4:25 ` Paul Mackerras
  2007-06-07 21:24   ` Jake Moilanen
  2007-06-07 21:27   ` [PATCH 1/2] " Jake Moilanen
@ 2007-06-07 21:30   ` Jake Moilanen
  2 siblings, 0 replies; 6+ messages in thread
From: Jake Moilanen @ 2007-06-07 21:30 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

A Power6 can give up CPU cycles on a dedicated CPU (as opposed to a
shared CPU) to other shared processors if the administrator asks for it
(via the HMC).

This patch enables that to work properly on P6.

This just involves setting a bit in the CAS structure as well as the
VPA.  To donate cycles, a CPU has to have all SMT threads idle and w/
donate bit set in the VPA.  Then call H_CEDE.

The reason why shared processors just aren't used is because dedicated
CPUs are guaranteed an actual processor, yet the system is still able to
increase the capacity of the shared CPU pool.

Signed-off-by: Jake Moilanen <moilanen@austin.ibm.com>

--

 arch/powerpc/kernel/prom_init.c        |    4 +++-
 arch/powerpc/platforms/pseries/setup.c |    2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

Index: powerpc/arch/powerpc/kernel/prom_init.c
===================================================================
--- powerpc.orig/arch/powerpc/kernel/prom_init.c
+++ powerpc/arch/powerpc/kernel/prom_init.c
@@ -635,6 +635,7 @@ static void __init early_cmdline_parse(v
 /* ibm,dynamic-reconfiguration-memory property supported */
 #define OV5_DRCONF_MEMORY	0x20
 #define OV5_LARGE_PAGES		0x10	/* large pages supported */
+#define OV5_DONATE_DEDICATE_CPU 0x02	/* donate dedicated CPU support */
 /* PCIe/MSI support.  Without MSI full PCIe is not supported */
 #ifdef CONFIG_PCI_MSI
 #define OV5_MSI			0x01	/* PCIe/MSI support */
@@ -685,7 +686,8 @@ static unsigned char ibm_architecture_ve
 	/* option vector 5: PAPR/OF options */
 	3 - 2,				/* length */
 	0,				/* don't ignore, don't halt */
-	OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY | OV5_MSI,
+	OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY |
+	OV5_DONATE_DEDICATE_CPU | OV5_MSI,
 };
 
 /* Old method - ELF header with PT_NOTE sections */
Index: powerpc/arch/powerpc/platforms/pseries/setup.c
===================================================================
--- powerpc.orig/arch/powerpc/platforms/pseries/setup.c
+++ powerpc/arch/powerpc/platforms/pseries/setup.c
@@ -399,6 +399,7 @@ static void pseries_dedicated_idle_sleep
 	 * a good time to find other work to dispatch.
 	 */
 	get_lppaca()->idle = 1;
+	get_lppaca()->donate_dedicated_cpu = 1;
 
 	/*
 	 * We come in with interrupts disabled, and need_resched()
@@ -431,6 +432,7 @@ static void pseries_dedicated_idle_sleep
 
 out:
 	HMT_medium();
+	get_lppaca()->donate_dedicated_cpu = 0;
 	get_lppaca()->idle = 0;
 }
 

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

end of thread, other threads:[~2007-06-07 21:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-31 19:14 [PATCH] Donate dedicated CPU cycles Jake Moilanen
2007-05-31 20:14 ` Olof Johansson
2007-06-06  4:25 ` Paul Mackerras
2007-06-07 21:24   ` Jake Moilanen
2007-06-07 21:27   ` [PATCH 1/2] " Jake Moilanen
2007-06-07 21:30   ` [PATCH 2/2] " Jake Moilanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).