Skip to contentSkip to conversation

Livelock with the shmctl04 test program from linux test project

DISCUSSION Manfred Spraul 2 participants 3 messages Oct 22, 2004 – Oct 28, 2004

lore
Share & tools
lore
#0 lore raw

Hi Alexander,

Quoted 2 lines

I'm seeing some sort of livelock on my dual amd64 with the shmctl04 test program

What do you mean with "sort of livelock"? Does it recover after a few minutes, does it recover if you send a signal to the shmctl04 test app? What is the contents of /proc/sysvipc/shm while xfce4 is running/not running? --
Manfred

#1 lore raw
Quoted 8 lines

Hi Alexander,

Quoted 2 lines

I'm seeing some sort of livelock on my dual amd64 with the shmctl04 test program

What do you mean with "sort of livelock"? Does it recover after a few minutes, does it recover if you send a signal to the shmctl04 test app? What is the contents of /proc/sysvipc/shm while xfce4 is running/not running?

Sorry for late reply, but I just can't understand why & how this happens, been trying to grasp the IPC/SHM part but I'm missing something. One processor gets locked up and never released. I did:

printk("taking lock\n");
spin_lock(&info->lock);
printk("lock taken\n");

and it never prints out "lock taken" so i know where it locks up. Now the fun part, spinlock debugging doesn't catch it, but I did a simple patch to show who is holding a lock at the current time, and it appears noone has taken the lock. I really don't get this.

With xfce4 running:

       key      shmid perms       size  cpid  lpid nattch   uid   gid  cuid  cgid      atime      dtime      ctime
         0      32768  1600                393216   629   608      2  1000  1000  1000  1000 1098960009          0 1098960009
         0      65537  1600                196608   644   608      2  1000  1000  1000  1000 1098960009          0 1098960009
         0      98306  1600                393216   646   668      2  1000  1000  1000  1000 1098960014 1098960014 1098960009
         0     131075  1600                393216   648   608      2  1000  1000  1000  1000 1098960021          0 1098960021
         0     163844  1600                393216   666   700      2  1000  1000  1000  1000 1098960029 1098960029 1098960023
         0     196613  1600                196608   666   700      2  1000  1000  1000  1000 1098960029 1098960029 1098960023
         0     229382  1600                393216   643   608      2  1000  1000  1000  1000 1098960023          0 1098960023
         0     262151  1600                393216   668   681      2  1000  1000  1000  1000 1098960025 1098960025 1098960025
         0     294920  1600                196608   648   608      2  1000  1000  1000  1000 1098960026          0 1098960026
         0     360457  1600                393216   706   711      2  1000  1000  1000  1000 1098960036 1098960036 1098960035
         0     425994  1600                393216   715   716      2  1000  1000  1000  1000 1098960039 1098960084 1098960039
         0     458763  1600                196608   715   608      2  1000  1000  1000  1000 1098960041          0 1098960041
         0     491532  1600                393216   642   608      2  1000  1000  1000  1000 1098960059          0 1098960059

Console only:
key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime

#2 lore raw
Quoted 4 lines · Alexander Nyberg

Sorry for late reply, but I just can't understand why & how this happens, been trying to grasp the IPC/SHM part but I'm missing something. One processor gets locked up and never released.

Ok - that's a deadlock.

Quoted 8 lines

I did:

printk("taking lock\n"); spin_lock(&info->lock);
printk("lock taken\n");

and it never prints out "lock taken" so i know where it locks up. Now the fun part, spinlock debugging doesn't catch it,

That's not surprising: the full debug code is only active for uniprocessor kernels. On SMP, only a simple check for unitialized spinlocks is performed. Btw, I'd use
printk("thread %d, struct %p: taking lock", current->pid, info);
Then you are certain that you are not fooled by multiple concurrent operations.

Quoted 5 lines

but I did a simple patch to show who is holding a lock
at the current time, and it appears noone has taken the lock. I really don't get this.

I must think about it. Who's printed as the last owner that released the lock? Perhaps there is a race with segment destruction: The structures are protected by RCU.

Could you enable debug spinlocks and slab debugging? I would have expected an error message from spinlock debugging due to bad magic.

--
Manfred