From 51727dfc6aea3ad52e08fac2dcfefb73a87456e0 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Date: Sat, 23 Aug 2014 10:19:32 +0800
Subject: [PATCH 03/23] x86_64: modify bt -E only to display online cpu's data

bt -E will search all irq stacks and exception stacks for possible
exception frames. With this patch offline cpus will be ignore.

This patch also fix x86_64_in_exception_stack and x86_64_in_irqstack.
Only online cpus' exception stacks and irq stacks will be searched.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
---
 x86_64.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/x86_64.c b/x86_64.c
index 98c587f..439e447 100755
--- a/x86_64.c
+++ b/x86_64.c
@@ -2346,6 +2346,9 @@ x86_64_eframe_search(struct bt_info *bt)
         	ms = machdep->machspec;
 
         	for (c = 0; c < kt->cpus; c++) {
+			if (check_offline_cpu(c))
+				continue;
+
                 	if (ms->stkinfo.ibase[c] == 0)
                         	break;
                                 bt->hp->esp = ms->stkinfo.ibase[c];
@@ -2357,6 +2360,9 @@ x86_64_eframe_search(struct bt_info *bt)
                 }
 
         	for (c = 0; c < kt->cpus; c++) {
+			if (check_offline_cpu(c))
+				continue;
+
                 	for (i = 0; i < MAX_EXCEPTION_STACKS; i++) {
                         	if (ms->stkinfo.ebase[c][i] == 0)
                                 	break;
@@ -2794,6 +2800,9 @@ x86_64_in_exception_stack(struct bt_info *bt, int *estack_index)
 	estack = 0;
 
         for (c = 0; !estack && (c < kt->cpus); c++) {
+		if (check_offline_cpu(c))
+			continue;
+
 		for (i = 0; i < MAX_EXCEPTION_STACKS; i++) {
 			if (ms->stkinfo.ebase[c][i] == 0)
 				break;
@@ -2831,6 +2840,9 @@ x86_64_in_irqstack(struct bt_info *bt)
         irqstack = 0;
 
         for (c = 0; !irqstack && (c < kt->cpus); c++) {
+		if (check_offline_cpu(c))
+			continue;
+
                 if (ms->stkinfo.ibase[c] == 0)
                  	break;
                 if ((rsp >= ms->stkinfo.ibase[c]) &&
-- 
1.8.5.3

