Re: how to resolve the 2.0.33 kernel hangs

Andrea Arcangeli (arcangeli@mbox.queen.it)
Mon, 9 Mar 1998 01:22:42 +0100 (CET)


On Sun, 8 Mar 1998, Andrea Arcangeli wrote:

>I backported the print_eip part of the patch-ikd from Ingo to 2.0.33. This

I added a new feature to the patch that give us also the information of
which is the last function executed and in general the execution order.
You will see two boxes per processor and you will need to specify in the
report the last function executed (the one with the greater index in the
second box).

By the way if you have a screen with more than 25 rows you can increase
the #define HISTORY in linux/kernel/debug/profiler.c .

Please apply this patch against the last one before begin a long kernel
running (there will not be other feature_add patches).

Excuse me for the double message (I should add this feature with the first
patch).

Andrea[s] Arcangeli

--- linux-2.0.33-clean/kernel/debug/profiler.c Mon Mar 9 01:07:31 1998
+++ linux/kernel/debug/profiler.c Mon Mar 9 01:02:23 1998
@@ -55,6 +55,8 @@
#endif
}

+#ifdef CONFIG_PRINT_EIP
+
/*
* this (64 bytes) is twice as big as cachelines, but we cannot
* guarantee cacheline alignment ... too bad. So we waste two
@@ -66,8 +68,6 @@
*/
struct cacheline_t { unsigned int i; int __dummy[15]; };

-#ifdef CONFIG_PRINT_EIP
-
/*
* Use this as last resort, when nothing else helps. If a hard lockup
* happens then you can decode the last EIP from the binary coded
@@ -78,59 +78,85 @@

static __inline__ void print_eip(unsigned int eip)
{
- int i, value;
-
#define video ((short int *)0x000b8000)
#define HISTORY 24
#define ALIGN __attribute__((aligned(4)))

+ int i, value;
+ unsigned int tmp;
+ static unsigned int count = 0;
+
/*
* We split the codepath in a dumb way, to get speed and proper
* per-CPU execution.
*/
if (!smp_processor_id()) {
- static struct cacheline_t curr_pos_0 ALIGN ={HISTORY*80,};
+ static struct cacheline_t curr_pos_0 ALIGN ={0,};
/*
* we cover 1M of code currently ... should be enuff
*/
- *(video+curr_pos_0.i) = 0;
- if (!(curr_pos_0.i -= 80))
- curr_pos_0.i = HISTORY*80;
- *(video+curr_pos_0.i) = 0xffff;
+ if ((curr_pos_0.i += 80) == HISTORY*80)
+ curr_pos_0.i = 0;

- for (i=8; i; i--) {
+ for (i=7; i>=0; i--) {
/*
* mask off the hexa digits one by one.
*/
value = eip & 0xf;
if (value<10)
- *(video+1+i+curr_pos_0.i) = 0x5400 + (value+'0');
+ *(video+i+curr_pos_0.i) = 0x5400 + (value+'0');
else
- *(video+1+i+curr_pos_0.i) = 0x5400 + (value-10+'a');
+ *(video+i+curr_pos_0.i) = 0x5400 + (value-10+'a');
eip >>= 4;
}
+ /* *(video+8+curr_pos_0.i) = 0x5400 + '=';*/
+ tmp = count;
+ for (i=7; i>=0; i--) {
+ /*
+ * mask off the hexa digits one by one.
+ */
+ value = tmp & 0xf;
+ if (value<10)
+ *(video+i+9+curr_pos_0.i) = 0x5400 + (value+'0');
+ else
+ *(video+i+9+curr_pos_0.i) = 0x5400 + (value-10+'a');
+ tmp >>= 4;
+ }
} else {
- static struct cacheline_t curr_pos_1 ALIGN ={HISTORY*80,};
+ static struct cacheline_t curr_pos_1 ALIGN ={0,};
/*
* we cover 1M of code currently ... should be enuff
*/
- *(video+40+curr_pos_1.i) = 0;
- if (!(curr_pos_1.i -= 80))
- curr_pos_1.i = HISTORY*80;
- *(video+40+curr_pos_1.i) = 0xffff;

- for (i=8; i; i--) {
+ if ((curr_pos_1.i += 80) == HISTORY*80)
+ curr_pos_1.i = 0;
+
+ for (i=7; i>=0; i--) {
/*
* mask off the hexa digits one by one.
*/
value = eip & 0xf;
if (value<10)
- *(video+41+i+curr_pos_1.i) = 0x6400 + (value+'0');
+ *(video+40+i+curr_pos_1.i) = 0x6400 + (value+'0');
else
- *(video+41+i+curr_pos_1.i) = 0x6400 + (value-10+'a');
+ *(video+40+i+curr_pos_1.i) = 0x6400 + (value-10+'a');
eip >>= 4;
}
+ /* *(video+48+curr_pos_1.i) = 0x6400 + '=';*/
+ tmp = count;
+ for (i=7; i>=0; i--) {
+ /*
+ * mask off the hexa digits one by one.
+ */
+ value = tmp & 0xf;
+ if (value<10)
+ *(video+i+49+curr_pos_1.i) = 0x6400 + (value+'0');
+ else
+ *(video+i+49+curr_pos_1.i) = 0x6400 + (value-10+'a');
+ tmp >>= 4;
+ }
}
+ count++;

#undef ALIGN
#undef HISTORY

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu