[PTLsim-devel] Simulator livelocks on while aquiring the lock

Stephan Diestelhorst
Tue Nov 6 10:08:14 EST 2007


This is a bug that has been in PTLsim for quite a while now. I have 
finally gotten around finding and fixing it. Will post a patch (after 
cleanup) soon!

Cheers,
  Stephan
> Hi.
>
> I am running PTLSim (r219) with 4 simulated smtcores.
> In my test program, I fork 4 threads that try to acquire the same
> lock. Afters some time simulation stops (livelocks) on the
> instruction with the address 0x45a775.
> This can be seen from the log:
> Completed       4141384 cycles,       2935184 commits:    109269
> cycles/sec,     29379, insns/sec: rip 0x45a775 0x45a775 0x45a775
> 0x45a775 Completed       4163250 cycles,       2941048 commits:   
> 109329 cycles/sec,     29319, insns/sec: rip 0x45a775 0x45a775
> 0x45a775 0x45a775 Completed       4185117 cycles,       2946904
> commits:    109329 cycles/sec,     29278, insns/sec: rip 0x45a775
> 0x45a775 0x45a775 0x45a775
>
> Is there any particular reason why non of the threads are able to
> acquire the lock?
>
> Tnx,
> Srdjan
>
> P.S.
> The code that gets the lock looks like this:
> 000000000045a770 <lock_stm>:
>   45a770:       31 d2                   xor    %edx,%edx
>   45a772:       48 89 d0                mov    %rdx,%rax
>   45a775:       f0 48 0f b1 3d 8a 12    lock cmpxchg
> %rdi,1184394(%rip)        # 57ba08 <smp_locked>
>   45a77c:       12 00
>   45a77e:       48 85 c0                test   %rax,%rax
>   45a781:       75 ef                   jne    45a772
> <lock_stm+0x2> 45a783:       f3 c3                   repz retq
>   45a785:       66                      data16
>   45a786:       66                      data16
>   45a787:       66                      data16
>   45a788:       90                      nop
>   45a789:       66                      data16
>   45a78a:       66                      data16
>   45a78b:       66                      data16
>   45a78c:       90                      nop
>   45a78d:       66                      data16
>   45a78e:       66                      data16
>   45a78f:       90                      nop
>
> 000000000045a790 <unlock_stm>:
>   45a790:       48 c7 05 6d 12 12 00    movq   $0x0,1184365(%rip)  
>      # 57ba08 <smp_locked>
>   45a797:       00 00 00 00
>   45a79b:       c3                      retq
>   45a79c:       66                      data16
>   45a79d:       66                      data16
>   45a79e:       66                      data16
>   45a79f:       90                      nop



-- 
Stephan Diestelhorst, AMD Operating System Research Center
stephan.diestelhorst at amd.com, Tel.   (AMD: 8-4903)

AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, 
Deutschland
Registergericht Dresden: HRA 4896

vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, 
Delaware, USA)
Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy




More information about the PTLsim-devel mailing list