Subject: Re: mutex fault
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Kazushi (Jam) Marukawa <jam@pobox.com>
List: port-xen
Date: 11/25/2007 17:48:14
   On Nov 25, 14:24, Kazushi (Jam) Marukawa wrote:
   > Subject: Re: mutex fault
   >    On Nov 24, 17:59, Manuel Bouyer wrote:
   >    > Also please build a kernel with 
   >    > makeoptions DEBUG="-g"
   >    > 
   >    > and use gdb to see where callout_softclock+0x24d (or whatever adress is given
   >    > by ddb with this kernel on panic) is. On my kernel image it points to
   >    > a mutex_enter which doens't make much sense ...
   > 
   > I'll try that.  Thanks.

Here is a disassembled output of netbsd.gdb I compiled with
the same source and with -g option.

The codes around callout_softclock+0x24d
(callout_softclock+589) are like following.

  0xc0431515 <callout_softclock+581>:     je     0xc043151d <callout_softclock+589>
  0xc0431517 <callout_softclock+583>:     mov    %edi,(%esp)
  0xc043151a <callout_softclock+586>:     call   *0xffffffec(%ebp)
  0xc043151d <callout_softclock+589>:     movl   $0xc098d594,(%esp)
  0xc0431524 <callout_softclock+596>:     call   0xc04db580 <mutex_spin_enter>
  0xc0431529 <callout_softclock+601>:     mov    0xffffffe8(%ebp),%eax

Whole disassemble of callout_softclock function is below.
Thanks.

(gdb) disassemble callout_softclock
Dump of assembler code for function callout_softclock:
0xc04312d0 <callout_softclock+0>:       push   %ebp
0xc04312d1 <callout_softclock+1>:       mov    %esp,%ebp
0xc04312d3 <callout_softclock+3>:       push   %edi
0xc04312d4 <callout_softclock+4>:       push   %esi
0xc04312d5 <callout_softclock+5>:       push   %ebx
0xc04312d6 <callout_softclock+6>:       sub    $0x1c,%esp
0xc04312d9 <callout_softclock+9>:       mov    0xc092a578,%eax
0xc04312de <callout_softclock+14>:      mov    %eax,0xfffffff0(%ebp)
0xc04312e1 <callout_softclock+17>:      mov    0xc(%eax),%edx
0xc04312e4 <callout_softclock+20>:      mov    %edx,0xffffffe8(%ebp)
0xc04312e7 <callout_softclock+23>:      movl   $0xc098d594,(%esp)
0xc04312ee <callout_softclock+30>:      call   0xc04db580 <mutex_spin_enter>
0xc04312f3 <callout_softclock+35>:      cmpl   $0xc09623c0,0xc09623c0
0xc04312fd <callout_softclock+45>:      je     0xc0431443 <callout_softclock+371>
0xc0431303 <callout_softclock+51>:      lea    0x0(%esi),%esi
0xc0431309 <callout_softclock+57>:      lea    0x0(%edi),%edi
0xc0431310 <callout_softclock+64>:      mov    0xc09623c0,%esi
0xc0431316 <callout_softclock+70>:      cmpl   $0x11deeba1,0x24(%esi)
0xc043131d <callout_softclock+77>:      jne    0xc04315f2 <callout_softclock+802>
0xc0431323 <callout_softclock+83>:      mov    0x8(%esi),%ecx
0xc0431326 <callout_softclock+86>:      test   %ecx,%ecx
0xc0431328 <callout_softclock+88>:      je     0xc043161e <callout_softclock+846>
0xc043132e <callout_softclock+94>:      testb  $0x2,0x1c(%esi)
0xc0431332 <callout_softclock+98>:      je     0xc043164a <callout_softclock+890>
0xc0431338 <callout_softclock+104>:     testb  $0x4,0x1c(%esi)
0xc043133c <callout_softclock+108>:     jne    0xc0431676 <callout_softclock+934>
0xc0431342 <callout_softclock+114>:     mov    (%esi),%eax
0xc0431344 <callout_softclock+116>:     mov    0x4(%esi),%edx
0xc0431347 <callout_softclock+119>:     mov    %edx,0x4(%eax)
0xc043134a <callout_softclock+122>:     mov    0x4(%esi),%edx
0xc043134d <callout_softclock+125>:     mov    %eax,(%edx)
0xc043134f <callout_softclock+127>:     mov    0x18(%esi),%edx
0xc0431352 <callout_softclock+130>:     mov    0xc098ac20,%ecx
0xc0431358 <callout_softclock+136>:     mov    %edx,%eax
0xc043135a <callout_softclock+138>:     sub    %ecx,%eax
0xc043135c <callout_softclock+140>:     cmp    $0x0,%eax
0xc043135f <callout_softclock+143>:     jle    0xc04314d0 <callout_softclock+512>
0xc0431365 <callout_softclock+149>:     cmp    $0x10000,%eax
0xc043136a <callout_softclock+154>:     jg     0xc04314b0 <callout_softclock+480>
0xc0431370 <callout_softclock+160>:     cmp    $0x100,%eax
0xc0431375 <callout_softclock+165>:     jg     0xc04315b0 <callout_softclock+736>
0xc043137b <callout_softclock+171>:     movzbl %dl,%eax
0xc043137e <callout_softclock+174>:     lea    0xc09603c0(,%eax,8),%eax
0xc0431385 <callout_softclock+181>:     lea    0x0(%esi),%esi
0xc0431389 <callout_softclock+185>:     lea    0x0(%edi),%edi
0xc0431390 <callout_softclock+192>:     mov    0x4(%eax),%eax
0xc0431393 <callout_softclock+195>:     mov    %eax,0x4(%esi)
0xc0431396 <callout_softclock+198>:     mov    %edx,%eax
0xc0431398 <callout_softclock+200>:     mov    0xc098ac20,%edi
0xc043139e <callout_softclock+206>:     sub    %edi,%eax
0xc04313a0 <callout_softclock+208>:     cmp    $0x10000,%eax
0xc04313a5 <callout_softclock+213>:     jg     0xc0431490 <callout_softclock+448>
0xc04313ab <callout_softclock+219>:     cmp    $0x100,%eax
0xc04313b0 <callout_softclock+224>:     jg     0xc0431592 <callout_softclock+706>
0xc04313b6 <callout_softclock+230>:     movzbl %dl,%eax
0xc04313b9 <callout_softclock+233>:     lea    0xc09603c0(,%eax,8),%eax
0xc04313c0 <callout_softclock+240>:     mov    %eax,(%esi)
0xc04313c2 <callout_softclock+242>:     mov    %edx,%eax
0xc04313c4 <callout_softclock+244>:     mov    0xc098ac20,%ebx
0xc04313ca <callout_softclock+250>:     sub    %ebx,%eax
0xc04313cc <callout_softclock+252>:     cmp    $0x10000,%eax
0xc04313d1 <callout_softclock+257>:     jg     0xc0431471 <callout_softclock+417>
0xc04313d7 <callout_softclock+263>:     cmp    $0x100,%eax
0xc04313dc <callout_softclock+268>:     jg     0xc0431583 <callout_softclock+691>
0xc04313e2 <callout_softclock+274>:     movzbl %dl,%eax
0xc04313e5 <callout_softclock+277>:     lea    0xc09603c0(,%eax,8),%eax
0xc04313ec <callout_softclock+284>:     lea    0x0(%esi),%esi
0xc04313f0 <callout_softclock+288>:     mov    0x4(%eax),%eax
0xc04313f3 <callout_softclock+291>:     mov    %esi,(%eax)
0xc04313f5 <callout_softclock+293>:     mov    0x18(%esi),%eax
0xc04313f8 <callout_softclock+296>:     mov    0xc098ac20,%ecx
0xc04313fe <callout_softclock+302>:     mov    %eax,%edx
0xc0431400 <callout_softclock+304>:     sub    %ecx,%edx
0xc0431402 <callout_softclock+306>:     cmp    $0x10000,%edx
0xc0431408 <callout_softclock+312>:     jg     0xc0431456 <callout_softclock+390>
0xc043140a <callout_softclock+314>:     cmp    $0x100,%edx
0xc0431410 <callout_softclock+320>:     jg     0xc0431574 <callout_softclock+676>
0xc0431416 <callout_softclock+326>:     and    $0xff,%eax
0xc043141b <callout_softclock+331>:     lea    0xc09603c0(,%eax,8),%eax
0xc0431422 <callout_softclock+338>:     lea    0x0(%esi),%esi
0xc0431429 <callout_softclock+345>:     lea    0x0(%edi),%edi
0xc0431430 <callout_softclock+352>:     cmpl   $0xc09623c0,0xc09623c0
0xc043143a <callout_softclock+362>:     mov    %esi,0x4(%eax)
0xc043143d <callout_softclock+365>:     jne    0xc0431310 <callout_softclock+64>
0xc0431443 <callout_softclock+371>:     movl   $0xc098d594,0x8(%ebp)
0xc043144a <callout_softclock+378>:     add    $0x1c,%esp
0xc043144d <callout_softclock+381>:     pop    %ebx
0xc043144e <callout_softclock+382>:     pop    %esi
0xc043144f <callout_softclock+383>:     pop    %edi
0xc0431450 <callout_softclock+384>:     pop    %ebp
0xc0431451 <callout_softclock+385>:     jmp    0xc04db5a0 <mutex_spin_exit>
0xc0431456 <callout_softclock+390>:     cmp    $0x1000000,%edx
0xc043145c <callout_softclock+396>:     jg     0xc04315a1 <callout_softclock+721>
0xc0431462 <callout_softclock+402>:     shr    $0xd,%eax
0xc0431465 <callout_softclock+405>:     and    $0x7f8,%eax
0xc043146a <callout_softclock+410>:     add    $0xc09613c0,%eax
0xc043146f <callout_softclock+415>:     jmp    0xc0431430 <callout_softclock+352>
0xc0431471 <callout_softclock+417>:     cmp    $0x1000000,%eax
0xc0431476 <callout_softclock+422>:     jg     0xc04315c0 <callout_softclock+752>
0xc043147c <callout_softclock+428>:     shr    $0xd,%edx
0xc043147f <callout_softclock+431>:     and    $0x7f8,%edx
0xc0431485 <callout_softclock+437>:     lea    0xc09613c0(%edx),%eax
0xc043148b <callout_softclock+443>:     jmp    0xc04313f0 <callout_softclock+288>
0xc0431490 <callout_softclock+448>:     cmp    $0x1000000,%eax
0xc0431495 <callout_softclock+453>:     jg     0xc04315d0 <callout_softclock+768>
0xc043149b <callout_softclock+459>:     mov    %edx,%eax
0xc043149d <callout_softclock+461>:     shr    $0xd,%eax
0xc04314a0 <callout_softclock+464>:     and    $0x7f8,%eax
0xc04314a5 <callout_softclock+469>:     add    $0xc09613c0,%eax
0xc04314aa <callout_softclock+474>:     jmp    0xc04313c0 <callout_softclock+240>
0xc04314af <callout_softclock+479>:     nop
0xc04314b0 <callout_softclock+480>:     cmp    $0x1000000,%eax
0xc04314b5 <callout_softclock+485>:     jg     0xc04315e1 <callout_softclock+785>
0xc04314bb <callout_softclock+491>:     mov    %edx,%eax
0xc04314bd <callout_softclock+493>:     shr    $0xd,%eax
0xc04314c0 <callout_softclock+496>:     and    $0x7f8,%eax
0xc04314c5 <callout_softclock+501>:     add    $0xc09613c0,%eax
0xc04314ca <callout_softclock+506>:     jmp    0xc0431390 <callout_softclock+192>
0xc04314cf <callout_softclock+511>:     nop
0xc04314d0 <callout_softclock+512>:     je     0xc04314e0 <callout_softclock+528>
0xc04314d2 <callout_softclock+514>:     addl   $0x1,0xc09623e0
0xc04314d9 <callout_softclock+521>:     adcl   $0x0,0xc09623e4
0xc04314e0 <callout_softclock+528>:     mov    0x1c(%esi),%ebx
0xc04314e3 <callout_softclock+531>:     mov    0x8(%esi),%eax
0xc04314e6 <callout_softclock+534>:     xor    $0x6,%ebx
0xc04314e9 <callout_softclock+537>:     mov    %ebx,0x1c(%esi)
0xc04314ec <callout_softclock+540>:     mov    0xffffffe8(%ebp),%edx
0xc04314ef <callout_softclock+543>:     mov    %eax,0xffffffec(%ebp)
0xc04314f2 <callout_softclock+546>:     mov    0xc(%esi),%edi
0xc04314f5 <callout_softclock+549>:     mov    %edx,0x10(%esi)
0xc04314f8 <callout_softclock+552>:     mov    0xfffffff0(%ebp),%eax
0xc04314fb <callout_softclock+555>:     mov    %eax,0x14(%esi)
0xc04314fe <callout_softclock+558>:     movl   $0xc098d594,(%esp)
0xc0431505 <callout_softclock+565>:     call   0xc04db5a0 <mutex_spin_exit>
0xc043150a <callout_softclock+570>:     test   $0x1,%bh
0xc043150d <callout_softclock+573>:     jne    0xc0431517 <callout_softclock+583>
0xc043150f <callout_softclock+575>:     mov    0xffffffe8(%ebp),%edx
0xc0431512 <callout_softclock+578>:     cmp    0x30(%edx),%esi
0xc0431515 <callout_softclock+581>:     je     0xc043151d <callout_softclock+589>
0xc0431517 <callout_softclock+583>:     mov    %edi,(%esp)
0xc043151a <callout_softclock+586>:     call   *0xffffffec(%ebp)
0xc043151d <callout_softclock+589>:     movl   $0xc098d594,(%esp)
0xc0431524 <callout_softclock+596>:     call   0xc04db580 <mutex_spin_enter>
0xc0431529 <callout_softclock+601>:     mov    0xffffffe8(%ebp),%eax
0xc043152c <callout_softclock+604>:     movl   $0x0,0x30(%eax)
0xc0431533 <callout_softclock+611>:     movl   $0x0,0x2c(%eax)
0xc043153a <callout_softclock+618>:     mov    0xffffffe8(%ebp),%edx
0xc043153d <callout_softclock+621>:     mov    0x34(%edx),%eax
0xc0431540 <callout_softclock+624>:     test   %eax,%eax
0xc0431542 <callout_softclock+626>:     je     0xc04312f3 <callout_softclock+35>
0xc0431548 <callout_softclock+632>:     movl   $0x0,0x34(%edx)
0xc043154f <callout_softclock+639>:     mov    %eax,0x8(%esp)
0xc0431553 <callout_softclock+643>:     mov    %edx,0x4(%esp)
0xc0431557 <callout_softclock+647>:     movl   $0xc098d59c,(%esp)
0xc043155e <callout_softclock+654>:     call   0xc0426000 <sleepq_wake>
0xc0431563 <callout_softclock+659>:     movl   $0xc098d594,(%esp)
0xc043156a <callout_softclock+666>:     call   0xc04db580 <mutex_spin_enter>
0xc043156f <callout_softclock+671>:     jmp    0xc04312f3 <callout_softclock+35>
0xc0431574 <callout_softclock+676>:     movzbl %ah,%eax
0xc0431577 <callout_softclock+679>:     lea    0xc0960bc0(,%eax,8),%eax
0xc043157e <callout_softclock+686>:     jmp    0xc0431430 <callout_softclock+352>
0xc0431583 <callout_softclock+691>:     movzbl %dh,%eax
0xc0431586 <callout_softclock+694>:     lea    0xc0960bc0(,%eax,8),%eax
0xc043158d <callout_softclock+701>:     jmp    0xc04313f0 <callout_softclock+288>
0xc0431592 <callout_softclock+706>:     movzbl %dh,%eax
0xc0431595 <callout_softclock+709>:     lea    0xc0960bc0(,%eax,8),%eax
0xc043159c <callout_softclock+716>:     jmp    0xc04313c0 <callout_softclock+240>
0xc04315a1 <callout_softclock+721>:     shr    $0x18,%eax
0xc04315a4 <callout_softclock+724>:     lea    0xc0961bc0(,%eax,8),%eax
0xc04315ab <callout_softclock+731>:     jmp    0xc0431430 <callout_softclock+352>
0xc04315b0 <callout_softclock+736>:     movzbl %dh,%eax
0xc04315b3 <callout_softclock+739>:     lea    0xc0960bc0(,%eax,8),%eax
0xc04315ba <callout_softclock+746>:     jmp    0xc0431390 <callout_softclock+192>
0xc04315bf <callout_softclock+751>:     nop
0xc04315c0 <callout_softclock+752>:     shr    $0x18,%edx
0xc04315c3 <callout_softclock+755>:     lea    0xc0961bc0(,%edx,8),%eax
0xc04315ca <callout_softclock+762>:     jmp    0xc04313f0 <callout_softclock+288>
0xc04315cf <callout_softclock+767>:     nop
0xc04315d0 <callout_softclock+768>:     mov    %edx,%eax
0xc04315d2 <callout_softclock+770>:     shr    $0x18,%eax
0xc04315d5 <callout_softclock+773>:     lea    0xc0961bc0(,%eax,8),%eax
0xc04315dc <callout_softclock+780>:     jmp    0xc04313c0 <callout_softclock+240>
0xc04315e1 <callout_softclock+785>:     mov    %edx,%eax
0xc04315e3 <callout_softclock+787>:     shr    $0x18,%eax
0xc04315e6 <callout_softclock+790>:     lea    0xc0961bc0(,%eax,8),%eax
0xc04315ed <callout_softclock+797>:     jmp    0xc0431390 <callout_softclock+192>
0xc04315f2 <callout_softclock+802>:     mov    $0xc08784a1,%eax
0xc04315f7 <callout_softclock+807>:     mov    $0x240,%edi
0xc04315fc <callout_softclock+812>:     mov    $0xc0878524,%ebx
0xc0431601 <callout_softclock+817>:     mov    %eax,0xc(%esp)
0xc0431605 <callout_softclock+821>:     mov    %edi,0x8(%esp)
0xc0431609 <callout_softclock+825>:     mov    %ebx,0x4(%esp)
0xc043160d <callout_softclock+829>:     movl   $0xc083716d,(%esp)
0xc0431614 <callout_softclock+836>:     call   0xc06d14e0 <__kernassert>
0xc0431619 <callout_softclock+841>:     jmp    0xc0431323 <callout_softclock+83>
0xc043161e <callout_softclock+846>:     mov    $0x241,%eax
0xc0431623 <callout_softclock+851>:     mov    $0xc08784cb,%edx
0xc0431628 <callout_softclock+856>:     mov    %eax,0x8(%esp)
0xc043162c <callout_softclock+860>:     mov    $0xc0878524,%eax
0xc0431631 <callout_softclock+865>:     mov    %edx,0xc(%esp)
0xc0431635 <callout_softclock+869>:     mov    %eax,0x4(%esp)
0xc0431639 <callout_softclock+873>:     movl   $0xc083716d,(%esp)
0xc0431640 <callout_softclock+880>:     call   0xc06d14e0 <__kernassert>
0xc0431645 <callout_softclock+885>:     jmp    0xc043132e <callout_softclock+94>
0xc043164a <callout_softclock+890>:     mov    $0xc08785fc,%eax
0xc043164f <callout_softclock+895>:     mov    %eax,0xc(%esp)
0xc0431653 <callout_softclock+899>:     mov    $0x242,%eax
0xc0431658 <callout_softclock+904>:     mov    %eax,0x8(%esp)
0xc043165c <callout_softclock+908>:     mov    $0xc0878524,%eax
0xc0431661 <callout_softclock+913>:     mov    %eax,0x4(%esp)
0xc0431665 <callout_softclock+917>:     movl   $0xc083716d,(%esp)
0xc043166c <callout_softclock+924>:     call   0xc06d14e0 <__kernassert>
0xc0431671 <callout_softclock+929>:     jmp    0xc0431338 <callout_softclock+104>
0xc0431676 <callout_softclock+934>:     mov    $0xc0878620,%eax
0xc043167b <callout_softclock+939>:     mov    $0x243,%edi
0xc0431680 <callout_softclock+944>:     mov    $0xc0878524,%ebx
0xc0431685 <callout_softclock+949>:     mov    %eax,0xc(%esp)
0xc0431689 <callout_softclock+953>:     mov    %edi,0x8(%esp)
0xc043168d <callout_softclock+957>:     mov    %ebx,0x4(%esp)
0xc0431691 <callout_softclock+961>:     movl   $0xc083716d,(%esp)
0xc0431698 <callout_softclock+968>:     call   0xc06d14e0 <__kernassert>
0xc043169d <callout_softclock+973>:     jmp    0xc0431342 <callout_softclock+114>
End of assembler dump.

-- Kazushsi
Speak softly and carry a +6 two-handed sword.