A different KGDB stub
A message that is not in the archive (sent off-list or not yet received): [email protected]
Tom Rini <[email protected]> writes:
Andrew, please don't add this broken version.
Review line 222
Quoted 6 lines
(quoted diff) +1
-1@@ -219,7 +219,7 @@ jnc sysret_signal sti pushq %rdi - call schedule + call user_schedule
I really don't like this change. It is completely useless because you can get the pt_regs as well from the stack. Please don't add it. George's stub also didn't need it.
Review line 224
Quoted 2 lines
(quoted diff) +2
-0+#ifdef CONFIG_KGDB_THREAD +ENTRY(kern_schedule)
Similar. No such crap please.
Review line 328
Quoted 13 lines
(quoted diff) +8
-1@@ -317,13 +318,26 @@ return; sum = read_pda(apic_timer_irqs); - if (last_irq_sums[cpu] == sum) { + if (atomic_read(&debugger_active)) { + + /* + * The machine is in debugger, hold this cpu if already + * not held. + */ + debugger_nmihook(cpu, regs); + alert_counter[cpu] = 0;
This should be a notify_die.
Review line 340
Quoted 12 lines
(quoted diff) +5
-0+ } else if (last_irq_sums[cpu] == sum) { + /* * Ayiee, looks like this CPU is stuck ... * wait a few IRQs (5 seconds) before doing the oops ... */ alert_counter[cpu]++; if (alert_counter[cpu] == 5*nmi_hz) { + + CHK_DEBUGGER(2,SIGSEGV,0,regs,) + if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_BAD) {
That's complete crap. You have a debugger hook and you add your own hook one line before it. Please fix that.
I note that the old stub in -mm* didn't need such wards.
Review line 343
Quoted 4 lines
(quoted diff) +1
-0void die(const char * str, struct pt_regs * regs, long err) { + CHK_DEBUGGER(1,SIGTRAP,err,regs,)
Same issue here. All the CHK_DEBUGGER are redundant with notify_die.
include/asm-x86_64/processor.h line 256
Quoted 8 lines
include/asm-x86_64/processor.h +1
-0@@ -252,6 +252,7 @@unsigned long *io_bitmap_ptr;/* cached TLS descriptors. */ u64 tls_array[GDT_ENTRY_TLS_ENTRIES ]; +void *debuggerinfo; };
This should not be needed
include/asm-x86_64/system.h line 27
Quoted 13 lines
include/asm-x86_64/processor.h +0
-0#define INIT_THREAD {}include/asm-x86_64/system.h +6
-0@@ -19,6 +19,56 @@#define __SAVE (reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t"#define __RESTORE (reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" +/* #ifdef CONFIG_KGDB */ + +/* full frame for the debug stub */ +/* Should be replaced with a dwarf2 cie/fde description, then gdb could +figure it out all by itself. */ +struct save_context_frame {
That's completely broken too. We have a full CFI description in the kernel now, so this isn't needed anymore.
-Andi
Quoted 15 lines · Andi Kleen
Tom Rini <[email protected]> writes:
Andrew, please don't add this broken version.
Review line 222
Quoted 6 lines
(quoted diff) +1
-1@@ -219,7 +219,7 @@ jnc sysret_signal sti pushq %rdi - call schedule + call user_scheduleI really don't like this change. It is completely useless because you can get the
pt_regsas well from the stack. Please don't add it. George's stub also didn't need it.
Quoted 4 lines
Review line 224
Quoted 2 lines
(quoted diff) +2
-0+#ifdef CONFIG_KGDB_THREAD +ENTRY(kern_schedule)Similar. No such crap please.
Amit? I seem to recall you and George (and Andi?) talking about how to get rid of these bits, did you ever write any of it up?
Quoted 15 lines
Review line 328
Quoted 13 lines
(quoted diff) +8
-1@@ -317,13 +318,26 @@ return; sum = read_pda(apic_timer_irqs); - if (last_irq_sums[cpu] == sum) { + if (atomic_read(&debugger_active)) { + + /* + * The machine is in debugger, hold this cpu if already + * not held. + */ + debugger_nmihook(cpu, regs); + alert_counter[cpu] = 0;This should be a
notify_die.
Not being firmiliar with x86_64, do you mean:
/* * The machine is in debugger, hold this cpu if already * not held. */ notify_die(cpu, regs);
? Or so?
Quoted 7 lines
Quoted 7 lines
(quoted diff) +2
-0+ } else if (last_irq_sums[cpu] == sum) { + /* * Ayiee, looks like this CPU is stuck ... * wait a few IRQs (5 seconds) before doing the oops ... */ alert_counter[cpu]++;
Quoted 8 lines
Review line 340
Quoted 5 lines
(quoted diff) +3
-0if (alert_counter[cpu] == 5*nmi_hz) { + + CHK_DEBUGGER(2,SIGSEGV,0,regs,) + if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_BAD) {That's complete crap. You have a debugger hook and you add your own hook one line before it. Please fix that.
Yes, Amit's version does this on PPC32 as well, and I'd like to change it, but I've been cleaning up other things.
Quoted 10 lines
include/asm-x86_64/processor.h line 256
Quoted 8 lines
include/asm-x86_64/processor.h +1
-0@@ -252,6 +252,7 @@unsigned long *io_bitmap_ptr;/* cached TLS descriptors. */ u64 tls_array[GDT_ENTRY_TLS_ENTRIES ]; +void *debuggerinfo; };This should not be needed
What would be used instead to pass around the pt_regs?
Quoted 6 lines
Quoted 6 lines
include/asm-x86_64/system.h +0
-0@@ -19,6 +19,56 @@#define __SAVE (reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t"#define __RESTORE (reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
Quoted 9 lines
include/asm-x86_64/system.h line 27
Quoted 6 lines
include/asm-x86_64/system.h +6
-0+/* #ifdef CONFIG_KGDB */ + +/* full frame for the debug stub */ +/* Should be replaced with a dwarf2 cie/fde description, then gdb could +figure it out all by itself. */ +struct save_context_frame {That's completely broken too. We have a full CFI description in the kernel now, so this isn't needed anymore.
Part of why I'm trying to get this into -mm is so that someone who has the hw and knowledge can try and merge some of the things that the other stubs got right into the stub that every arch can use.
Signature · 2 lines
Tom Rini http://gate.crashing.org/~trini/
Quoted 4 lines · On Thu, 12 Feb 2004 08:50:55 -0700 Tom Rini <[email protected]> wrote:
Part of why I'm trying to get this into -mm is so that someone who has the hw and knowledge can try and merge some of the things that the other stubs got right into the stub that every arch can use.
The kgdb stub in current -mm* does all the things I mentioned correctly.
-Andi
Quoted 8 lines · Andi Kleen
Quoted 4 lines · On Thu, 12 Feb 2004 08:50:55 -0700 Tom Rini <[email protected]> wrote:
Part of why I'm trying to get this into -mm is so that someone who has the hw and knowledge can try and merge some of the things that the other stubs got right into the stub that every arch can use.
The kgdb stub in current -mm* does all the things I mentioned correctly.
Yes, and it also makes every arch implement the entire stub and provide its own serial driver. Having said that, I'll try and pull out more of the things that the other stub gets right, but I don't have any x86_64 hw (nor toolchain) so I can't test any of the x86_64 changes I make.
Signature · 2 lines
Tom Rini http://gate.crashing.org/~trini/
Hi!
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
Part of why I'm trying to get this into -mm is so that someone who has the hw and knowledge can try and merge some of the things that the other stubs got right into the stub that every arch can use.
The kgdb stub in current -mm* does all the things I mentioned correctly.
Yes, and it also makes every arch implement the entire stub and provide its own serial driver. Having said that, I'll try and pull out more of the things that the other stub gets right, but I don't have any
x86_64hw (nor toolchain) so I can't test any of thex86_64changes I make.
I think I can help with that...
Pavel
Signature · 2 lines
When do you have a heart between your knees? [Johanka's followup: and *two* hearts?]
Quoted 1 line · Andi Kleen
Tom Rini <[email protected]> writes:
[snip]
Quoted 10 lines
include/asm-x86_64/processor.h line 256
Quoted 8 lines
include/asm-x86_64/processor.h +1
-0@@ -252,6 +252,7 @@unsigned long *io_bitmap_ptr;/* cached TLS descriptors. */ u64 tls_array[GDT_ENTRY_TLS_ENTRIES ]; +void *debuggerinfo; };This should not be needed
OK. Unless there is a difference in this respect on i386 vs x86_64 in 2.6.3-rc2-mm1, this is needed for the thread support which is in this version, but not the -mm version. OTOH, if there is a cleaner way of doing this, and there indeed might be (I need to sit down and re-read some of the previous threads), I'm all ears, not tied to doing it that way, etc, etc.
Signature · 2 lines
Tom Rini http://gate.crashing.org/~trini/