Skip to contentSkip to conversation

Xenlinux oops and crashes with nbd, Xen no longer boots

DISCUSSION Keir Fraser 6 participants 8 messages Jul 13, 2004 – Aug 4, 2004 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Okay, detangling the backtrace....

 Entry EIP    Function                  Caller's return EIP
 ---------    --------                  -------------------
 0xc00c1220   alloc_skb(1656,GFP_NOIO)  0xc00ddd58
 0xc00dd4b0   tcp_sendmsg               0xc00fa9a1
 0xc00fa960   inet_sendmsg              0xc00bde23
 0xc00bddb0   sock_sendmsg              0xc3cad25f
 unknown      nbd_xmit                  0xc3cad511
 unknown      nbd_send_req              0xc3cad91c
 unknown      do_nbd_request            0xc008fc46
 0xc008fbe0   generic_unplug_device     0xc000c342
 0xc000c2e0   __run_task_queue          n/a (tail call)
 0xc00b8f20   io_schedule               0xc000c0a8
 0xc000c050   tasklet_action            0xc000be9e
 0xc000bdc0   do_softirq                0xc006f2c0
 0xc006f220   do_IRQ(133,-)             0xc007395e
 0xc00738c0   evtchn_do_upcall          0xc006dcd7
 0xc006dca4   hypervisor_callback       n/a (async callback)

I see the problem. Well hidden because the key function (io_schedule) ends in a tail call. The problem is that we are scheduling I/O requests in interrupt context rather than deferring to a process context --- a known issue that hasn't bitten until now. I'll have to think about a fix.

-- Keir

Quoted 88 lines

Down not across
ksymoops 2.4.9 on i686 2.4.26-xen0. Options used
-v ./vmlinux (specified)
-k /proc/ksyms (default)
-l /proc/modules (default)
-o /lib/modules/2.4.26-xen0/ (default)
-M (specified)

invalid operand: 0000
CPU:    0
EIP:    0819:[<c00c133b>]    Not tainted

Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00213286
eax: 0000003a ebx: c048f040 ecx: c0178000 edx: 00000000
esi: 00000030 edi: c048f160 ebp: c0179cd0 esp: c0179cc0
ds: 0821 es: 0821 ss: 0821
Process swapper (pid: 0, stackpage=c0179000)<1>

Stack: c012c920 c00ddd58 c048f040 c048f040 c0179d48 c00ddd58 00000678 00000030 
       00000004 00000008 0000000e c27f9b24 c0179d18 c00cc1cc c05dac00 c05dac00 
       c05d000e c0179d28 c002097c c048f098 c0179ea8 0000001c 00000000 000005a8 
       00004000 00000000 c048f160 c0179ddc c37fe4e0 c05dac00 7fffffff c048f040 
       c0179e5c c0179d78 c0179d60 c00fa9a1 c048f040 c0179e5c 0000001c 00000000 
       c0179da4 c00bde23 c0d7bf0c c0179e5c 0000001c c0179d78 00000000 00000000 
       00000000 00000000 00000000 c37fe3d8 c218e000 c218ede8 c0179ea8 c0d7bf0c 
       0000001c c0179e88 c3cad25f c0d7bf0c c0179e5c 0000001c c1eaa538 c35581dc 
       c1d13960 00000000 00000000 00000000 ffffffff c0179ea8 0000001c c1eaa538
       00000000 00000030 c35581dc c0179e10 c00bbe62 c01c5444 c35581dc c250e000
       00000000 c1d13800 c1eaa538 10000000 c0179e28 c00c550f c1eaa538 c1d13800
       00000040 c1eaa538 c0179e6c c3c0fa28 c1eaa538 00000010 00000000 00000006
       c0179e90 0000003a c22997ac 00000002 c0179e6c 00000000 c0179e6c 00000000
       00000000 c0179dd4 00000001 00000000 00000000 00004000 00000002 c3caf440
       c0d7bf0c c3caf420 c0179ed4 c3cad511 00000001 c0d7bf0c c0179ea8 0000001c
       00000000 c0d7bf0c 13956025 00000000 c2478c64 c0109f58 00000000 00040000
       00040000 c010b1d4 c2478c64 c3caf420 00000000 c0179ef0 c3cad91c c3caf420
       c2478c64 00000000 c0179f0c fffffff7 c0179f00 c008fc46 c01ab6a4 c0179f0c
       c0179f1c c000c342 c01ab6a4 c01ab704 c01ab704 00000000 c01881d8 c0179f2c
       c000c0a8 c0147510 00000001 c0179f48 c000be9e c01881d8 00000001 c018a400
       c1d4bbec 00002140 c0179f68 c006f2c0 00000085 c0179f9c c1d4bbec 00000000
       00000000 fbff9000 c0179f90 c007395e 00000085 c0179f9c 00000001 00000000
       c0179f9c c0178000 c0178000 00000006 c0179fe4 c006dcd7 c0179f9c 00000001
       39854980 38ecb300 c0178000 00000006 c0179fe4 00000006 00000821 00000821
       00000006 c006bcc2 00000819 00203246 c0179fe4 c0178000 00000000 c01e2200
       c01983a0 c0179ffc c017a57c c0116f40 c01986a0 00000000 c01985a0 00000000
Call Trace: [<c00ddd58>] [<c00ddd58>] [<c00cc1cc>] [<c002097c>] [<c00fa9a1>]
   [<c00bde23>] [<c3cad25f>] [<c00bbe62>] [<c00c550f>] [<c3c0fa28>] [<c3caf440>]
   [<c3caf420>] [<c3cad511>] [<c0109f58>] [<c010b1d4>] [<c3caf420>] [<c3cad91c>]
   [<c3caf420>] [<c008fc46>] [<c000c342>] [<c000c0a8>] [<c000be9e>] [<c006f2c0>]
   [<c007395e>] [<c006dcd7>] [<c006bcc2>]
 <0>Kernel panic: Aiee, killing interrupt handler!

Warning (Oops_read): Code line not seen, dumping what data is available

Quoted 7 lines
Quoted 7 lines

EIP; c00c133b <alloc_skb+11b/130> <=====

ebx; c048f040 <_end+2bd130/3a2e170>
ecx; c0178000 <init_task_union+0/2000>
edi; c048f160 <_end+2bd250/3a2e170>
ebp; c0179cd0 <init_task_union+1cd0/2000>
esp; c0179cc0 <init_task_union+1cc0/2000>

Trace; c00ddd58 <tcp_sendmsg+8a8/f40>
Trace; c00ddd58 <tcp_sendmsg+8a8/f40>
Trace; c00cc1cc <rtnetlink_put_metrics+9c/150>
Trace; c002097c <kmem_cache_free_one+ec/200>
Trace; c00fa9a1 <inet_sendmsg+41/50>
Trace; c00bde23 <sock_sendmsg+73/b0>
Trace; c3cad25f <[nbd]nbd_xmit+11f/2e0>
Trace; c00bbe62 <netif_be_start_xmit+122/180>
Trace; c00c550f <dev_queue_xmit+9f/270>
Trace; c3c0fa28 <[ipv6]ndisc_send_rs+1a8/230>
Trace; c3caf440 <[nbd].data.end+a59/3699>
Trace; c3caf420 <[nbd].data.end+a39/3699>
Trace; c3cad511 <[nbd]nbd_send_req+f1/180>
Trace; c0109f58 <br_config_bpdu_generation+38/40>
Trace; c010b1d4 <br_hello_timer_expired+14/30>
Trace; c3caf420 <[nbd].data.end+a39/3699>
Trace; c3cad91c <[nbd]do_nbd_request+fc/1d0>
Trace; c3caf420 <[nbd].data.end+a39/3699>
Trace; c008fc46 <generic_unplug_device+66/70>
Trace; c000c342 <__run_task_queue+62/80>
Trace; c000c0a8 <tasklet_action+58/b0>
Trace; c000be9e <do_softirq+de/100>
Trace; c006f2c0 <do_IRQ+a0/b0>
Trace; c007395e <evtchn_do_upcall+9e/100>
Trace; c006dcd7 <hypervisor_callback+33/49>
Trace; c006bcc2 <cpu_idle+62/c0>

Quoted 1 line

1 warning issued. Results may not be reliable.

 -=- MIME -=- 

--u3/rZRmxL6MmkK24
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Quoted 5 lines · Keir Fraser

Even better, recompile your DOM0 kernel with arch/xen/kernel/traps.c modified with 'kstack_depth_to_print' changed to a larger value like
240. This will give a fuller stack backtrace (it's currently less useful because it's truncated). Then provide the backtrace and the vmlinux file.

OK I've done that the vmlinux file is at
http://www.yuri.org.uk/~murble/vmlinux-xen

New Oops file should be attached.

cheers

bill

Signature · 57 lines
Bill Boughton		<murble(at)@yuri.org.uk>
 			<bill@(at)xencat.murble.org.uk>
Down not across

--u3/rZRmxL6MmkK24
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=xen0-oops

ksymoops 2.4.9 on i686 2.4.26-xen0.  Options used
     -v ./vmlinux (specified)
     -k /proc/ksyms (default)
     -l /proc/modules (default)
     -o /lib/modules/2.4.26-xen0/ (default)
     -M (specified)

invalid operand: 0000
CPU:    0
EIP:    0819:[<c00c133b>]    Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00213286
eax: 0000003a   ebx: c048f040   ecx: c0178000   edx: 00000000
esi: 00000030   edi: c048f160   ebp: c0179cd0   esp: c0179cc0
ds: 0821   es: 0821   ss: 0821
Process swapper (pid: 0, stackpage=c0179000)<1>
Stack: c012c920 c00ddd58 c048f040 c048f040 c0179d48 c00ddd58 00000678 00000030 
       00000004 00000008 0000000e c27f9b24 c0179d18 c00cc1cc c05dac00 c05dac00 
       c05d000e c0179d28 c002097c c048f098 c0179ea8 0000001c 00000000 000005a8 
       00004000 00000000 c048f160 c0179ddc c37fe4e0 c05dac00 7fffffff c048f040 
       c0179e5c c0179d78 c0179d60 c00fa9a1 c048f040 c0179e5c 0000001c 00000000 
       c0179da4 c00bde23 c0d7bf0c c0179e5c 0000001c c0179d78 00000000 00000000 
       00000000 00000000 00000000 c37fe3d8 c218e000 c218ede8 c0179ea8 c0d7bf0c 
       0000001c c0179e88 c3cad25f c0d7bf0c c0179e5c 0000001c c1eaa538 c35581dc 
       c1d13960 00000000 00000000 00000000 ffffffff c0179ea8 0000001c c1eaa538
       00000000 00000030 c35581dc c0179e10 c00bbe62 c01c5444 c35581dc c250e000
       00000000 c1d13800 c1eaa538 10000000 c0179e28 c00c550f c1eaa538 c1d13800
       00000040 c1eaa538 c0179e6c c3c0fa28 c1eaa538 00000010 00000000 00000006
       c0179e90 0000003a c22997ac 00000002 c0179e6c 00000000 c0179e6c 00000000
       00000000 c0179dd4 00000001 00000000 00000000 00004000 00000002 c3caf440
       c0d7bf0c c3caf420 c0179ed4 c3cad511 00000001 c0d7bf0c c0179ea8 0000001c
       00000000 c0d7bf0c 13956025 00000000 c2478c64 c0109f58 00000000 00040000
       00040000 c010b1d4 c2478c64 c3caf420 00000000 c0179ef0 c3cad91c c3caf420
       c2478c64 00000000 c0179f0c fffffff7 c0179f00 c008fc46 c01ab6a4 c0179f0c
       c0179f1c c000c342 c01ab6a4 c01ab704 c01ab704 00000000 c01881d8 c0179f2c
       c000c0a8 c0147510 00000001 c0179f48 c000be9e c01881d8 00000001 c018a400
       c1d4bbec 00002140 c0179f68 c006f2c0 00000085 c0179f9c c1d4bbec 00000000
       00000000 fbff9000 c0179f90 c007395e 00000085 c0179f9c 00000001 00000000
       c0179f9c c0178000 c0178000 00000006 c0179fe4 c006dcd7 c0179f9c 00000001
       39854980 38ecb300 c0178000 00000006 c0179fe4 00000006 00000821 00000821
       00000006 c006bcc2 00000819 00203246 c0179fe4 c0178000 00000000 c01e2200
       c01983a0 c0179ffc c017a57c c0116f40 c01986a0 00000000 c01985a0 00000000
Call Trace: [<c00ddd58>] [<c00ddd58>] [<c00cc1cc>] [<c002097c>] [<c00fa9a1>]
   [<c00bde23>] [<c3cad25f>] [<c00bbe62>] [<c00c550f>] [<c3c0fa28>] [<c3caf440>]
   [<c3caf420>] [<c3cad511>] [<c0109f58>] [<c010b1d4>] [<c3caf420>] [<c3cad91c>]
   [<c3caf420>] [<c008fc46>] [<c000c342>] [<c000c0a8>] [<c000be9e>] [<c006f2c0>]
   [<c007395e>] [<c006dcd7>] [<c006bcc2>]
 <0>Kernel panic: Aiee, killing interrupt handler!
Warning (Oops_read): Code line not seen, dumping what data is available
Quoted 7 lines
Quoted 7 lines

EIP; c00c133b <alloc_skb+11b/130> <=====

ebx; c048f040 <_end+2bd130/3a2e170>
ecx; c0178000 <init_task_union+0/2000>
edi; c048f160 <_end+2bd250/3a2e170>
ebp; c0179cd0 <init_task_union+1cd0/2000>
esp; c0179cc0 <init_task_union+1cc0/2000>

Trace; c00ddd58 <tcp_sendmsg+8a8/f40>
Trace; c00ddd58 <tcp_sendmsg+8a8/f40>
Trace; c00cc1cc <rtnetlink_put_metrics+9c/150>
Trace; c002097c <kmem_cache_free_one+ec/200>
Trace; c00fa9a1 <inet_sendmsg+41/50>
Trace; c00bde23 <sock_sendmsg+73/b0>
Trace; c3cad25f <[nbd]nbd_xmit+11f/2e0>
Trace; c00bbe62 <netif_be_start_xmit+122/180>
Trace; c00c550f <dev_queue_xmit+9f/270>
Trace; c3c0fa28 <[ipv6]ndisc_send_rs+1a8/230>
Trace; c3caf440 <[nbd].data.end+a59/3699>
Trace; c3caf420 <[nbd].data.end+a39/3699>
Trace; c3cad511 <[nbd]nbd_send_req+f1/180>
Trace; c0109f58 <br_config_bpdu_generation+38/40>
Trace; c010b1d4 <br_hello_timer_expired+14/30>
Trace; c3caf420 <[nbd].data.end+a39/3699>
Trace; c3cad91c <[nbd]do_nbd_request+fc/1d0>
Trace; c3caf420 <[nbd].data.end+a39/3699>
Trace; c008fc46 <generic_unplug_device+66/70>
Trace; c000c342 <__run_task_queue+62/80>
Trace; c000c0a8 <tasklet_action+58/b0>
Trace; c000be9e <do_softirq+de/100>
Trace; c006f2c0 <do_IRQ+a0/b0>
Trace; c007395e <evtchn_do_upcall+9e/100>
Trace; c006dcd7 <hypervisor_callback+33/49>
Trace; c006bcc2 <cpu_idle+62/c0>

1 warning issued. Results may not be reliable.

--u3/rZRmxL6MmkK24--

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#2 lore raw

Now fixed. You've been able to hit this more reliably than anyone else, so I'll be interested to hear confirmation that the problem really has now gone away.

-- Keir

Quoted 21 lines

Okay, detangling the backtrace....

 Entry EIP    Function                  Caller's return EIP
 ---------    --------                  -------------------
 0xc00c1220   alloc_skb(1656,GFP_NOIO)  0xc00ddd58
 0xc00dd4b0   tcp_sendmsg               0xc00fa9a1
 0xc00fa960   inet_sendmsg              0xc00bde23
 0xc00bddb0   sock_sendmsg              0xc3cad25f
 unknown      nbd_xmit                  0xc3cad511
 unknown      nbd_send_req              0xc3cad91c
 unknown      do_nbd_request            0xc008fc46
 0xc008fbe0   generic_unplug_device     0xc000c342
 0xc000c2e0   __run_task_queue          n/a (tail call)
 0xc00b8f20   io_schedule               0xc000c0a8
 0xc000c050   tasklet_action            0xc000be9e
 0xc000bdc0   do_softirq                0xc006f2c0
 0xc006f220   do_IRQ(133,-)             0xc007395e
 0xc00738c0   evtchn_do_upcall          0xc006dcd7
 0xc006dca4   hypervisor_callback       n/a (async callback)
Quoted 7 lines

I see the problem. Well hidden because the key function (io_schedule) ends in a tail call. The problem is that we are scheduling I/O requests in interrupt context rather than deferring to a process context --- a known issue that hasn't bitten until now. I'll have to think about a fix.

-- Keir

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#3 lore raw
Quoted 4 lines · Keir Fraser

Now fixed. You've been able to hit this more reliably than anyone else, so I'll be interested to hear confirmation that the problem really has now gone away.

I've not been abel to hit it and am now happily booting XenLinux instances over nbd.

thanks

bill

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#4 lore raw

Hi Bill,

Quoted 2 lines · Wm Boughton

I've not been abel to hit it and am now happily booting XenLinux instances over nbd.

Which NBD are you using? The kernel NBD, ENBD, or GNBD?

Steve

Signature · 11 lines
Stephen G. Traugott  (KG6HDQ)
UNIX/Linux Infrastructure Architect, TerraLuna LLC
[email protected] 
http://www.stevegt.com -- http://Infrastructures.Org 


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
#5 lore raw

how to debug xen?

hi there,

How to debug xen? just use the nsplitd as XenDebugger-HOWTO said? It seems quite tricky. I believe lots of people are doing development on xen, so usually how to debug it?

Thanks
Yan

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click

#6 lore raw

Re: how to debug xen?

" How to debug xen? just use the nsplitd as XenDebugger-HOWTO said? It seems " quite tricky. I believe lots of people are doing development on xen, so " usually how to debug it?

This is how I debug xen. The starting point is reading
xeno-unstable.bk/docs/HOWTOs/XenDebugger-HOWTO
I do not use nsplitd.

First, build debug kernels.
For xen, in the xeno-unstable.bk/xen directory add this to arch/x86/Rules.mk
CFLAGS += -g
and build xen saying
make debugger=y
For xenolinux, in xeno-unstable.bk/linux-2.4.26-xen0
turn on CONFIG_FRAME_POINTER (in the Kernel Hacking section of
menuconfig or xconfig)
in Makefile put -g into CFLAGS_KERNEL (line 52)
CFLAGS_KERNEL = -g
and build xenolinux with
make ARCH=xen bzImage

Second, find a target machine with some serial lines.
I prefer virtual machines and use VMware Workstation 4.5 on Linux (4.0 didn't work, btw). In the vmware Machine Settings, config both com1 and com2 to be named pipes with "This end is the client" and "The other end is a
virtual machine". Run two socat jobs in the background
to convert the pipes to ptys:
socat UNIX-LISTEN:/tmp/com1pipe,unlink-early,fork pty,link=/tmp/com1 & socat UNIX-LISTEN:/tmp/com2pipe,unlink-early,fork pty,link=/tmp/com2 &

Third, boot the target machine and connect the debugger.
Put the debug xen and xenolinux on the machine. In the grub menu.lst
file, add the serial lines and pdb to the xen command line:
kernel /boot/xen.gz.debug dom0_mem=100000 ifname=eth0 com1=9600,8n1 com2=9600,8n1 pdb=com2
Boot it up and connect to the console. In my vmware setup, I connect
to com1 from the machine hosting VMware with
kermit -c -l /tmp/com1
Then on com1 type ^A^A^A to make xen listen to console cmds.
At this point type 'h' and see if the 'D' command is listed. If not,
pdb is missing so make sure the xen being run was built with debugger=y.
Hit 'D' on the console to make xen drop into the debugger.

Quoted 1 line

From the machine listening to the serial lines, connect to the target machine

with gdb and the xen-syms file and check if was built with -g by trying to list a function:

    $ gdb xeno-unstable.bk/xen/xen-syms
    (gdb) list do_dom0_op 
    26      extern unsigned int alloc_new_dom_mem(struct domain *,
    unsigned int);
    27      extern long arch_do_dom0_op(dom0_op_t *op, dom0_op_t
    *u_dom0_op);
    28      extern void arch_getdomaininfo_ctxt(struct domain *,
    full_execution_context_t *);
    29      
    30      long do_dom0_op(dom0_op_t *u_dom0_op)
    31      {
    32          long ret = 0;
    33          dom0_op_t curop, *op = &curop;
    34      
    35          if ( !IS_PRIV(current) )
    (gdb) target remote /tmp/com2
Now you can debug xen itself.  Note that the breakpoint is in xenolinux
so gdb will be cryptic about the current function and stacktrace.  Put a
breakpoint in xen somewhere and continue to get gdb to a function is can
decode.

To debug xenolinux, drop to the debugger:
(gdb) set pdb_ctx.domain=0
(gdb) set pdb_ctx.valid=1
(gdb) add-symbol-file xeno-unstable.bk/linux-2.4.26-xen0/vmlinux
Now you can debug vmlinux itself (except where the xen and linux symbols clash).

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click

#7 lore raw

Re: how to debug xen?

One non-obvious thing that I didn't see in the docs is that if you use multiple nsplitds they have to be spaced 4 ports apart not 2.

-Kip

Quoted 78 lines · David Becker

" How to debug xen? just use the nsplitd as XenDebugger-HOWTO said? It seems " quite tricky. I believe lots of people are doing development on xen, so " usually how to debug it?

This is how I debug xen. The starting point is reading
xeno-unstable.bk/docs/HOWTOs/XenDebugger-HOWTO
I do not use nsplitd.

First, build debug kernels.
For xen, in the xeno-unstable.bk/xen directory add this to arch/x86/Rules.mk
CFLAGS += -g
and build xen saying
make debugger=y
For xenolinux, in xeno-unstable.bk/linux-2.4.26-xen0
turn on CONFIG_FRAME_POINTER (in the Kernel Hacking section of
menuconfig or xconfig)
in Makefile put -g into CFLAGS_KERNEL (line 52)
CFLAGS_KERNEL = -g
and build xenolinux with
make ARCH=xen bzImage

Second, find a target machine with some serial lines.
I prefer virtual machines and use VMware Workstation 4.5 on Linux (4.0 didn't work, btw). In the vmware Machine Settings, config both com1 and com2 to be named pipes with "This end is the client" and "The other end is a
virtual machine". Run two socat jobs in the background
to convert the pipes to ptys:
socat UNIX-LISTEN:/tmp/com1pipe,unlink-early,fork pty,link=/tmp/com1 & socat UNIX-LISTEN:/tmp/com2pipe,unlink-early,fork pty,link=/tmp/com2 &

Third, boot the target machine and connect the debugger. Put the debug xen and xenolinux on the machine. In the grub menu.lst file, add the serial lines and pdb to the xen command line:

   kernel /boot/xen.gz.debug dom0_mem=100000 ifname=eth0 com1=9600,8n1 com2=9600,8n1 pdb=com2

Boot it up and connect to the console. In my vmware setup, I connect to com1 from the machine hosting VMware with
kermit -c -l /tmp/com1
Then on com1 type ^A^A^A to make xen listen to console cmds. At this point type 'h' and see if the 'D' command is listed. If not, pdb is missing so make sure the xen being run was built with debugger=y. Hit 'D' on the console to make xen drop into the debugger.

Quoted 1 line

From the machine listening to the serial lines, connect to the target machine

with gdb and the xen-syms file and check if was built with -g by trying to list a function:

    $ gdb xeno-unstable.bk/xen/xen-syms
    (gdb) list do_dom0_op
    26      extern unsigned int alloc_new_dom_mem(struct domain *,
    unsigned int);
    27      extern long arch_do_dom0_op(dom0_op_t *op, dom0_op_t
    *u_dom0_op);
    28      extern void arch_getdomaininfo_ctxt(struct domain *,
    full_execution_context_t *);
    29
    30      long do_dom0_op(dom0_op_t *u_dom0_op)
    31      {
    32          long ret = 0;
    33          dom0_op_t curop, *op = &curop;
    34
    35          if ( !IS_PRIV(current) )
    (gdb) target remote /tmp/com2
Now you can debug xen itself.  Note that the breakpoint is in xenolinux
so gdb will be cryptic about the current function and stacktrace.  Put a
breakpoint in xen somewhere and continue to get gdb to a function is can
decode.

To debug xenolinux, drop to the debugger:
(gdb) set pdb_ctx.domain=0
(gdb) set pdb_ctx.valid=1
(gdb) add-symbol-file xeno-unstable.bk/linux-2.4.26-xen0/vmlinux
Now you can debug vmlinux itself (except where the xen and linux symbols clash).

Quoted 10 lines

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Xen-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/xen-devel

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click

#8 lore raw

Re: how to debug xen?

hi

Thanks,but now I'm stuck. I wanna try nsplitd first. so I do it according to the Debugger-howto. I built xen and xeno with -g added and fomit-frame-pointer
disabled.

The problem is I'm really confused by the configuration of nsplitd.

1.it said set 'pdb=xxx'. How can I tell which port I'm connecting to?

2.in nsplitd configuration.
what are the /etc/xinetd.d/nsplit and all the 'wcons00', 'wanda remote
console,
stuff? I'm asuming it's in configuration in their working machine. Then
can
anyone tell me what does this mean?
The whole nsplitd configuration section,please let me know the details
about it.
I totally have no idea what's going on there.

For example, I have two machines, A.x.x.x, B.x.x.x, I'm running xen on
machine A,
using machine B to connect to the serial line. What should all the
settings look
like?

btw, David, is the socat just this one: http://www.socat.org/?

Thanks a lot!

Q
----- Original Message -----
From: "Kip Macy" <[email protected]>
To: "David Becker" <[email protected]>
Cc: "Yan Li" <[email protected]>; <[email protected]>
Sent: Friday, July 23, 2004 8:08 AM
Subject: Re: [Xen-devel] how to debug xen?

Quoted 11 lines

One non-obvious thing that I didn't see in the docs is that if you use multiple nsplitds they have to be spaced 4 ports apart not 2.

-Kip

Quoted 2 lines · David Becker

" How to debug xen? just use the nsplitd as XenDebugger-HOWTO said? It

seems

Quoted 1 line
Quoted 1 line

" quite tricky. I believe lots of people are doing development on xen,

so

Quoted 8 lines
Quoted 8 lines

" usually how to debug it?

This is how I debug xen. The starting point is reading
xeno-unstable.bk/docs/HOWTOs/XenDebugger-HOWTO
I do not use nsplitd.

First, build debug kernels.
For xen, in the xeno-unstable.bk/xen directory add this to

arch/x86/Rules.mk

Quoted 12 lines
Quoted 12 lines

CFLAGS += -g
and build xen saying
make debugger=y
For xenolinux, in xeno-unstable.bk/linux-2.4.26-xen0
turn on CONFIG_FRAME_POINTER (in the Kernel Hacking section of
menuconfig or xconfig)
in Makefile put -g into CFLAGS_KERNEL (line 52)
CFLAGS_KERNEL = -g
and build xenolinux with
make ARCH=xen bzImage

Quoted 2 lines
Quoted 2 lines

Second, find a target machine with some serial lines.
I prefer virtual machines and use VMware Workstation 4.5 on Linux (4.0

didn't

Quoted 5 lines
Quoted 5 lines

work, btw). In the vmware Machine Settings, config both com1 and com2 to be named pipes with "This end is the client" and "The other end is a
virtual machine". Run two socat jobs in the background
to convert the pipes to ptys:
socat UNIX-LISTEN:/tmp/com1pipe,unlink-early,fork pty,link=/tmp/com1

&

Quoted 1 line
Quoted 1 line

socat UNIX-LISTEN:/tmp/com2pipe,unlink-early,fork pty,link=/tmp/com2

&

Quoted 6 lines
Quoted 6 lines

Third, boot the target machine and connect the debugger. Put the debug xen and xenolinux on the machine. In the grub menu.lst file, add the serial lines and pdb to the xen command line:

   kernel /boot/xen.gz.debug dom0_mem=100000 ifname=eth0 com1=9600,8n1

com2=9600,8n1 pdb=com2

Quoted 9 lines
Quoted 9 lines

Boot it up and connect to the console. In my vmware setup, I connect to com1 from the machine hosting VMware with
kermit -c -l /tmp/com1
Then on com1 type ^A^A^A to make xen listen to console cmds. At this point type 'h' and see if the 'D' command is listed. If not, pdb is missing so make sure the xen being run was built with debugger=y. Hit 'D' on the console to make xen drop into the debugger.

Quoted 1 line

From the machine listening to the serial lines, connect to the target

machine

Quoted 1 line
Quoted 1 line

with gdb and the xen-syms file and check if was built with -g by trying

to

Quoted 31 lines
Quoted 31 lines

list a function:

    $ gdb xeno-unstable.bk/xen/xen-syms
    (gdb) list do_dom0_op
    26      extern unsigned int alloc_new_dom_mem(struct domain *,
    unsigned int);
    27      extern long arch_do_dom0_op(dom0_op_t *op, dom0_op_t
    *u_dom0_op);
    28      extern void arch_getdomaininfo_ctxt(struct domain *,
    full_execution_context_t *);
    29
    30      long do_dom0_op(dom0_op_t *u_dom0_op)
    31      {
    32          long ret = 0;
    33          dom0_op_t curop, *op = &curop;
    34
    35          if ( !IS_PRIV(current) )
    (gdb) target remote /tmp/com2
Now you can debug xen itself.  Note that the breakpoint is in xenolinux
so gdb will be cryptic about the current function and stacktrace.  Put a
breakpoint in xen somewhere and continue to get gdb to a function is can
decode.

To debug xenolinux, drop to the debugger:
(gdb) set pdb_ctx.domain=0
(gdb) set pdb_ctx.valid=1
(gdb) add-symbol-file xeno-unstable.bk/linux-2.4.26-xen0/vmlinux
Now you can debug vmlinux itself (except where the xen and linux symbols clash).

Quoted 11 lines
Quoted 10 lines

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Xen-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/xen-devel

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com