[079/200] powerpc/pseries: Make query_cpu_stopped callable outside hotplug cpu
diff mbox series

Message ID 20100701174253.083176764@clark.site
State New, archived
Headers show
Series
  • 2.6.34.1 stable review
Related show

Commit Message

Greg KH July 1, 2010, 5:42 p.m. UTC
2.6.34-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michael Neuling <mikey@neuling.org>

commit f8b67691828321f5c85bb853283aa101ae673130 upstream.

This moves query_cpu_stopped() out of the hotplug cpu code and into
smp.c so it can called in other places and renames it to
smp_query_cpu_stopped().

It also cleans up the return values by adding some #defines

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/powerpc/platforms/pseries/hotplug-cpu.c    |   30 +++---------------------
 arch/powerpc/platforms/pseries/plpar_wrappers.h |    8 ++++++
 arch/powerpc/platforms/pseries/smp.c            |   22 +++++++++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Comments

Michael Neuling July 2, 2010, 12:15 a.m. UTC | #1
Greg,

This won't break ppc64, but it pointless without:
aef40e87d866355ffd279ab21021de733242d0d5 powerpc/pseries: Make
query_cpu_stopped callable outside hotplug cpu

There are two patches that can be put in stable, f8b676918 and
aef40e87d.  In this batch of stable releases you have:
 
  2.6.27.48 : aef40e87d only (breaks ppc64)
  2.6.32.16 : aef40e87d only (breaks ppc64)
  2.6.33.6  : aef40e87d & f8b676918 (works!)
  2.6.34.1  : f8b676918 only (does nothing)

Mikey

In message <20100701174253.083176764@clark.site> you wrote:
> 2.6.34-stable review patch.  If anyone has any objections, please let me know
.
> 
> ------------------
> 
> From: Michael Neuling <mikey@neuling.org>
> 
> commit f8b67691828321f5c85bb853283aa101ae673130 upstream.
> 
> This moves query_cpu_stopped() out of the hotplug cpu code and into
> smp.c so it can called in other places and renames it to
> smp_query_cpu_stopped().
> 
> It also cleans up the return values by adding some #defines
> 
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> 
> ---
>  arch/powerpc/platforms/pseries/hotplug-cpu.c    |   30 +++------------------
---
>  arch/powerpc/platforms/pseries/plpar_wrappers.h |    8 ++++++
>  arch/powerpc/platforms/pseries/smp.c            |   22 +++++++++++++++++
>  3 files changed, 34 insertions(+), 26 deletions(-)
> 
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -154,30 +154,6 @@ static void pseries_mach_cpu_die(void)
>  	for(;;);
>  }
>  
> -static int qcss_tok;	/* query-cpu-stopped-state token */
> -
> -/* Get state of physical CPU.
> - * Return codes:
> - *	0	- The processor is in the RTAS stopped state
> - *	1	- stop-self is in progress
> - *	2	- The processor is not in the RTAS stopped state
> - *	-1	- Hardware Error
> - *	-2	- Hardware Busy, Try again later.
> - */
> -static int query_cpu_stopped(unsigned int pcpu)
> -{
> -	int cpu_status, status;
> -
> -	status = rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu);
> -	if (status != 0) {
> -		printk(KERN_ERR
> -		       "RTAS query-cpu-stopped-state failed: %i\n", status);
> -		return status;
> -	}
> -
> -	return cpu_status;
> -}
> -
>  static int pseries_cpu_disable(void)
>  {
>  	int cpu = smp_processor_id();
> @@ -224,8 +200,9 @@ static void pseries_cpu_die(unsigned int
>  	} else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
>  
>  		for (tries = 0; tries < 25; tries++) {
> -			cpu_status = query_cpu_stopped(pcpu);
> -			if (cpu_status == 0 || cpu_status == -1)
> +			cpu_status = smp_query_cpu_stopped(pcpu);
> +			if (cpu_status == QCSS_STOPPED ||
> +			    cpu_status == QCSS_HARDWARE_ERROR)
>  				break;
>  			cpu_relax();
>  		}
> @@ -388,6 +365,7 @@ static int __init pseries_cpu_hotplug_in
>  	struct device_node *np;
>  	const char *typep;
>  	int cpu;
> +	int qcss_tok;
>  
>  	for_each_node_by_name(np, "interrupt-controller") {
>  		typep = of_get_property(np, "compatible", NULL);
> --- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
> +++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
> @@ -4,6 +4,14 @@
>  #include <asm/hvcall.h>
>  #include <asm/page.h>
>  
> +/* Get state of physical CPU from query_cpu_stopped */
> +int smp_query_cpu_stopped(unsigned int pcpu);
> +#define QCSS_STOPPED 0
> +#define QCSS_STOPPING 1
> +#define QCSS_NOT_STOPPED 2
> +#define QCSS_HARDWARE_ERROR -1
> +#define QCSS_HARDWARE_BUSY -2
> +
>  static inline long poll_pending(void)
>  {
>  	return plpar_hcall_norets(H_POLL_PENDING);
> --- a/arch/powerpc/platforms/pseries/smp.c
> +++ b/arch/powerpc/platforms/pseries/smp.c
> @@ -57,6 +57,28 @@
>   */
>  static cpumask_t of_spin_map;
>  
> +/* Query where a cpu is now.  Return codes #defined in plpar_wrappers.h */
> +int smp_query_cpu_stopped(unsigned int pcpu)
> +{
> +	int cpu_status, status;
> +	int qcss_tok = rtas_token("query-cpu-stopped-state");
> +
> +	if (qcss_tok == RTAS_UNKNOWN_SERVICE) {
> +		printk(KERN_INFO "Firmware doesn't support "
> +				"query-cpu-stopped-state\n");
> +		return QCSS_HARDWARE_ERROR;
> +	}
> +
> +	status = rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu);
> +	if (status != 0) {
> +		printk(KERN_ERR
> +		       "RTAS query-cpu-stopped-state failed: %i\n", status);
> +		return status;
> +	}
> +
> +	return cpu_status;
> +}
> +
>  /**
>   * smp_startup_cpu() - start the given cpu
>   *
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Greg KH July 3, 2010, 1:58 a.m. UTC | #2
On Fri, Jul 02, 2010 at 10:15:18AM +1000, Michael Neuling wrote:
> Greg,
> 
> This won't break ppc64, but it pointless without:
> aef40e87d866355ffd279ab21021de733242d0d5 powerpc/pseries: Make
> query_cpu_stopped callable outside hotplug cpu

That patch does not apply to the .34 tree, as it seems to be already
included there.  If not, can you please send me a backported version?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Michael Neuling July 3, 2010, 7:55 a.m. UTC | #3
> > Greg,
> > 
> > This won't break ppc64, but it pointless without:
> > aef40e87d866355ffd279ab21021de733242d0d5 powerpc/pseries: Make
> > query_cpu_stopped callable outside hotplug cpu
> 
> That patch does not apply to the .34 tree, as it seems to be already
> included there.  If not, can you please send me a backported version?

Sorry, my bad. 

aef40e87d866355ffd279ab21021de733242d0d5 is 078/200 in this series
(seemed to escape my inbox).  All is good.

Thanks,
Mikey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Greg KH July 5, 2010, 5:04 p.m. UTC | #4
On Sat, Jul 03, 2010 at 05:55:12PM +1000, Michael Neuling wrote:
> > > Greg,
> > > 
> > > This won't break ppc64, but it pointless without:
> > > aef40e87d866355ffd279ab21021de733242d0d5 powerpc/pseries: Make
> > > query_cpu_stopped callable outside hotplug cpu
> > 
> > That patch does not apply to the .34 tree, as it seems to be already
> > included there.  If not, can you please send me a backported version?
> 
> Sorry, my bad. 
> 
> aef40e87d866355ffd279ab21021de733242d0d5 is 078/200 in this series
> (seemed to escape my inbox).  All is good.

Great, thanks for verifying.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Patch
diff mbox series

--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -154,30 +154,6 @@  static void pseries_mach_cpu_die(void)
 	for(;;);
 }
 
-static int qcss_tok;	/* query-cpu-stopped-state token */
-
-/* Get state of physical CPU.
- * Return codes:
- *	0	- The processor is in the RTAS stopped state
- *	1	- stop-self is in progress
- *	2	- The processor is not in the RTAS stopped state
- *	-1	- Hardware Error
- *	-2	- Hardware Busy, Try again later.
- */
-static int query_cpu_stopped(unsigned int pcpu)
-{
-	int cpu_status, status;
-
-	status = rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu);
-	if (status != 0) {
-		printk(KERN_ERR
-		       "RTAS query-cpu-stopped-state failed: %i\n", status);
-		return status;
-	}
-
-	return cpu_status;
-}
-
 static int pseries_cpu_disable(void)
 {
 	int cpu = smp_processor_id();
@@ -224,8 +200,9 @@  static void pseries_cpu_die(unsigned int
 	} else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
 
 		for (tries = 0; tries < 25; tries++) {
-			cpu_status = query_cpu_stopped(pcpu);
-			if (cpu_status == 0 || cpu_status == -1)
+			cpu_status = smp_query_cpu_stopped(pcpu);
+			if (cpu_status == QCSS_STOPPED ||
+			    cpu_status == QCSS_HARDWARE_ERROR)
 				break;
 			cpu_relax();
 		}
@@ -388,6 +365,7 @@  static int __init pseries_cpu_hotplug_in
 	struct device_node *np;
 	const char *typep;
 	int cpu;
+	int qcss_tok;
 
 	for_each_node_by_name(np, "interrupt-controller") {
 		typep = of_get_property(np, "compatible", NULL);
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -4,6 +4,14 @@ 
 #include <asm/hvcall.h>
 #include <asm/page.h>
 
+/* Get state of physical CPU from query_cpu_stopped */
+int smp_query_cpu_stopped(unsigned int pcpu);
+#define QCSS_STOPPED 0
+#define QCSS_STOPPING 1
+#define QCSS_NOT_STOPPED 2
+#define QCSS_HARDWARE_ERROR -1
+#define QCSS_HARDWARE_BUSY -2
+
 static inline long poll_pending(void)
 {
 	return plpar_hcall_norets(H_POLL_PENDING);
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -57,6 +57,28 @@ 
  */
 static cpumask_t of_spin_map;
 
+/* Query where a cpu is now.  Return codes #defined in plpar_wrappers.h */
+int smp_query_cpu_stopped(unsigned int pcpu)
+{
+	int cpu_status, status;
+	int qcss_tok = rtas_token("query-cpu-stopped-state");
+
+	if (qcss_tok == RTAS_UNKNOWN_SERVICE) {
+		printk(KERN_INFO "Firmware doesn't support "
+				"query-cpu-stopped-state\n");
+		return QCSS_HARDWARE_ERROR;
+	}
+
+	status = rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu);
+	if (status != 0) {
+		printk(KERN_ERR
+		       "RTAS query-cpu-stopped-state failed: %i\n", status);
+		return status;
+	}
+
+	return cpu_status;
+}
+
 /**
  * smp_startup_cpu() - start the given cpu
  *