[PATCH] Use only tasks on online CPUs for bt -a

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Dave,

Currently for "bt -a" also swapper tasks on offline CPUs are printed
(at least on s390). Wouldn't it be better to only print a backtrace,
when the task is running on an online CPU?

My suggestion would be to implement that with the following patch
by only setting the panic threads for online CPUs. I also attached a
second alternative patch that fills the active set array only with
tasks on online CPUs.

What do you think?

Michael
---
 task.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/task.c
+++ b/task.c
@@ -5658,8 +5658,12 @@ populate_panic_threads(void)
         struct task_context *tc;
 
 	if (get_active_set()) {
-		for (i = 0; i < NR_CPUS; i++) 
-			tt->panic_threads[i] = tt->active_set[i];
+		for (i = 0; i < NR_CPUS; i++) {
+			if (kt->cpu_flags[i] & ONLINE)
+				tt->panic_threads[i] = tt->active_set[i];
+			else
+				tt->panic_threads[i] = 0;
+		}
 		return;
 	}
---
 task.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/task.c
+++ b/task.c
@@ -5658,8 +5658,12 @@ populate_panic_threads(void)
         struct task_context *tc;
 
 	if (get_active_set()) {
-		for (i = 0; i < NR_CPUS; i++) 
-			tt->panic_threads[i] = tt->active_set[i];
+		for (i = 0; i < NR_CPUS; i++) {
+			if (kt->cpu_flags[i] & ONLINE)
+				tt->panic_threads[i] = tt->active_set[i];
+			else
+				tt->panic_threads[i] = 0;
+		}
 		return;
 	}
 
---
 task.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/task.c
+++ b/task.c
@@ -6286,6 +6286,8 @@ get_active_set(void)
 		vcpu_struct_buf = GETBUF(SIZE(vcpu_struct));
 
 		for (i = 0; i < kt->cpus; i++, runq += SIZE(pcpu_info)) {
+			if (!(kt->cpu_flags[i] & ONLINE))
+				continue;
 			readmem(runq, KVADDR, pcpu_info_buf, 
 				SIZE(pcpu_info), "pcpu_info", FAULT_ON_ERROR);
 			vcpu_struct= ULONG(pcpu_info_buf +
@@ -6302,6 +6304,8 @@ get_active_set(void)
 		FREEBUF(vcpu_struct_buf);
 	} else if (VALID_MEMBER(runqueue_curr) && rq_sp) {
                	for (i = 0; i < kt->cpus; i++) {
+			if (!(kt->cpu_flags[i] & ONLINE))
+				continue;
                         if ((kt->flags & SMP) && (kt->flags & PER_CPU_OFF))
                                 runq = rq_sp->value + kt->__per_cpu_offset[i];
                         else
@@ -6319,6 +6323,8 @@ get_active_set(void)
 	} else if (VALID_MEMBER(runqueue_curr)) {
 	        for (i = 0; i < MAX(kt->cpus, kt->kernel_NR_CPUS); i++, 
 		    runq += SIZE(runqueue)) {
+			if (!(kt->cpu_flags[i] & ONLINE))
+				continue;
 	                readmem(runq, KVADDR, runqbuf,
 	                	SIZE(runqueue), "(old) runqueues curr",
 	                        FAULT_ON_ERROR);
@@ -6329,6 +6335,8 @@ get_active_set(void)
 		}
         } else if (VALID_MEMBER(runqueue_cpu)) {
 		for (i = 0; i < kt->cpus; i++) {
+			if (!(kt->cpu_flags[i] & ONLINE))
+				continue;
                         runqaddr = runq + (SIZE(runqueue) * rq_idx(i));
                         readmem(runqaddr, KVADDR, runqbuf,
                                 SIZE(runqueue), "runqueues curr",
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux