---
 s390.c  |   57 ++++++++++++++-------------------------------------------
 s390x.c |   57 ++++++++++++++-------------------------------------------
 2 files changed, 28 insertions(+), 86 deletions(-)

--- a/s390.c
+++ b/s390.c
@@ -542,46 +542,17 @@ s390_cpu_of_task(unsigned long task)
 }
 
 /*
- * returns true, if task currently is executed by a cpu
+ * returns true, if task of bt currently is executed by a cpu
  */ 
 static int 
-s390_has_cpu(unsigned long task)
+s390_has_cpu(struct bt_info *bt)
 {
-	if(VALID_MEMBER(task_struct_cpus_runnable)){
-                /* Linux 2.4 */
-                unsigned long cpus_runnable;
-                readmem(task+OFFSET(task_struct_cpus_runnable),KVADDR,
-                        &cpus_runnable,sizeof(cpus_runnable),
-                        "cpus_runnable", FAULT_ON_ERROR);
-                if(cpus_runnable != ~0U)
-                        return TRUE;
-                else
-                        return FALSE;
-        } else {
-		/* Linux 2.6 */
-		unsigned long runqueue_addr, runqueue_offset;
-		unsigned long cpu_offset, per_cpu_offset_addr, running_task;
-		char *runqueue;
-		int cpu;
-
-		cpu = s390_cpu_of_task(task);
-		runqueue = GETBUF(SIZE(runqueue));
-
-		runqueue_offset=symbol_value("per_cpu__runqueues");
-		per_cpu_offset_addr=symbol_value("__per_cpu_offset");
-		readmem(per_cpu_offset_addr + cpu * sizeof(long),KVADDR,
-			&cpu_offset, sizeof(long),"per_cpu_offset",
-			FAULT_ON_ERROR);
-		runqueue_addr=runqueue_offset + cpu_offset;
-		readmem(runqueue_addr,KVADDR,runqueue,SIZE(runqueue),
-			"runqueue", FAULT_ON_ERROR);
-		running_task = ULONG(runqueue + OFFSET(runqueue_curr));
-		FREEBUF(runqueue);
-		if(running_task == task)
-			return TRUE;
-		else
-			return FALSE;
-	}
+	int cpu = bt->tc->processor;
+
+	if (is_task_active(bt->task) && (kt->cpu_flags[cpu] & ONLINE))
+		return TRUE;
+	else
+		return FALSE;
 }
 
 /*
@@ -635,7 +606,7 @@ s390_back_trace_cmd(struct bt_info *bt)
 	ksp = bt->stkptr;
 
 	/* print lowcore and get async stack when task has cpu */
-	if(s390_has_cpu(bt->task)){
+	if(s390_has_cpu(bt)){
 		char lowcore[LOWCORE_SIZE];
 		unsigned long psw_flags;
 		int cpu = s390_cpu_of_task(bt->task);
@@ -687,7 +658,7 @@ s390_back_trace_cmd(struct bt_info *bt)
 			stack = bt->stackbuf;
 			stack_base = stack_start;
 		} else if((backchain > async_start) && (backchain < async_end)
-			  && s390_has_cpu(bt->task)){
+			  && s390_has_cpu(bt)){
 			stack = async_stack;
 			stack_base = async_start;
 		} else {
@@ -903,12 +874,12 @@ s390_get_stack_frame(struct bt_info *bt,
 	int r14_offset;
 	char lowcore[LOWCORE_SIZE];
 
-	if(s390_has_cpu(bt->task))
+	if(s390_has_cpu(bt))
 		s390_get_lowcore(s390_cpu_of_task(bt->task),lowcore);
 
 	/* get the stack pointer */
 	if(esp){
-		if(s390_has_cpu(bt->task)){
+		if(s390_has_cpu(bt)){
 			ksp = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
 				"gpregs_save_area") + (15 * S390_WORD_SIZE));
 		} else {
@@ -926,7 +897,7 @@ s390_get_stack_frame(struct bt_info *bt,
 	if(!eip)
 		return;
 
-	if(s390_has_cpu(bt->task) && esp){
+	if(s390_has_cpu(bt) && esp){
 		*eip = ULONG(lowcore + OFFSET(s390_lowcore_psw_save_area) +
 			S390_WORD_SIZE) & S390_ADDR_MASK;
 	} else {
@@ -1015,7 +986,7 @@ s390_dis_filter(ulong vaddr, char *inbuf
 int
 s390_get_smp_cpus(void)
 {
-	return get_cpus_online();
+	return (get_highest_cpu_online() + 1);
 }
 
 /*
--- a/s390x.c
+++ b/s390x.c
@@ -554,46 +554,17 @@ s390x_cpu_of_task(unsigned long task)
 }
 
 /*
- * returns true, if task currently is executed by a cpu
+ * returns true, if task of bt currently is executed by a cpu
  */ 
 static int 
-s390x_has_cpu(unsigned long task)
+s390x_has_cpu(struct bt_info *bt)
 {
-	if(VALID_MEMBER(task_struct_cpus_runnable)){
-		/* Linux 2.4 */
-		unsigned long cpus_runnable;
-		readmem(task+OFFSET(task_struct_cpus_runnable),KVADDR,
-			&cpus_runnable,sizeof(cpus_runnable),
-			"cpus_runnable", FAULT_ON_ERROR);
-		if(cpus_runnable != ~0ULL)
-			return TRUE;
-		else
-			return FALSE;
-	} else {
-		/* Linux 2.6 */
-		unsigned long runqueue_addr, runqueue_offset;
-		unsigned long cpu_offset, per_cpu_offset_addr, running_task;
-		char *runqueue;
-		int cpu;
-
-		cpu = s390x_cpu_of_task(task);
-		runqueue = GETBUF(SIZE(runqueue));
-
-		runqueue_offset=symbol_value("per_cpu__runqueues");
-		per_cpu_offset_addr=symbol_value("__per_cpu_offset");
-		readmem(per_cpu_offset_addr + cpu * sizeof(long),KVADDR,
-			&cpu_offset, sizeof(long),"per_cpu_offset",
-			FAULT_ON_ERROR);
-		runqueue_addr=runqueue_offset + cpu_offset;
-		readmem(runqueue_addr,KVADDR,runqueue,SIZE(runqueue),
-			"runqueue", FAULT_ON_ERROR);
-		running_task = ULONG(runqueue + OFFSET(runqueue_curr));
-		FREEBUF(runqueue);
-		if(running_task == task)
-			return TRUE; 
-		else
-			return FALSE;
-	}
+	int cpu = bt->tc->processor;
+
+	if (is_task_active(bt->task) && (kt->cpu_flags[cpu] & ONLINE))
+		return TRUE;
+	else
+		return FALSE;
 }
 
 /*
@@ -647,7 +618,7 @@ s390x_back_trace_cmd(struct bt_info *bt)
 	ksp = bt->stkptr;
 
 	/* print lowcore and get async stack when task has cpu */
-	if(s390x_has_cpu(bt->task)){
+	if(s390x_has_cpu(bt)){
 		char lowcore[LOWCORE_SIZE];
 		unsigned long psw_flags;
 		int cpu = s390x_cpu_of_task(bt->task);
@@ -700,7 +671,7 @@ s390x_back_trace_cmd(struct bt_info *bt)
 			stack = bt->stackbuf;
 			stack_base = stack_start;
 		} else if((backchain > async_start) && (backchain < async_end)
-			  && s390x_has_cpu(bt->task)){
+			  && s390x_has_cpu(bt)){
 			stack = async_stack;
 			stack_base = async_start;
 		} else {
@@ -936,12 +907,12 @@ s390x_get_stack_frame(struct bt_info *bt
 	int r14_offset;
 	char lowcore[LOWCORE_SIZE];
 
-	if(s390x_has_cpu(bt->task))
+	if(s390x_has_cpu(bt))
 		s390x_get_lowcore(s390x_cpu_of_task(bt->task),lowcore);
 
 	/* get the stack pointer */
 	if(esp){
-		if(s390x_has_cpu(bt->task)){
+		if(s390x_has_cpu(bt)){
 			ksp = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
 				"gpregs_save_area") + (15 * S390X_WORD_SIZE));
 		} else {
@@ -959,7 +930,7 @@ s390x_get_stack_frame(struct bt_info *bt
 	if(!eip)
 		return;
 
-	if(s390x_has_cpu(bt->task) && esp){
+	if(s390x_has_cpu(bt) && esp){
 		*eip = ULONG(lowcore + OFFSET(s390_lowcore_psw_save_area) +
 			S390X_WORD_SIZE);
 	} else {
@@ -1048,7 +1019,7 @@ s390x_dis_filter(ulong vaddr, char *inbu
 int
 s390x_get_smp_cpus(void)
 {
-	return get_cpus_online();
+	return (get_highest_cpu_online() + 1);
 }
 
 /*
