Re: Robust futex patch for Linux 2.6.15

From: Matan Peled
Date: Sat Jan 14 2006 - 11:12:38 EST


Andrew Morton wrote:
Please send the patch to this mailing list with a full description, as per
http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt. And by "full" I
mean something which tells us what a "robust futex" actually is (it's been
a year since I thought about them) and why we would want such a thing.

This code looks racy:

+static int futex_deadlock(struct rt_mutex *lock)
+{
+ DEFINE_WAIT(wait);
+
+ _raw_spin_unlock(&lock->wait_lock);
+ _raw_spin_unlock(&current->pi_lock);
+
+ prepare_to_wait(&deadlocked_futex, &wait, TASK_INTERRUPTIBLE);
+ schedule();
+ finish_wait(&deadlocked_futex, &wait);
+
+ return -EDEADLK;
+}

If the spin_unlocks happened after the prepare_to_wait then it would be
more idoimatic, but without having analysed the wakeup path, I wonder if a
wakeup which occurs after the spin_unlocks and before the prepare_to_wait()
will get lost.

Andrew, I'm looking at this:

http://source.mvista.com/~dsingleton/robust-futex-1

And it doesn't seem to have a futex_deadlock function at all. In fact, its seems to have a rather lengthy description about robust futexes and why they're a Good Thing(TM).

What are you looking at?

--
[Name ] :: [Matan I. Peled ]
[Location ] :: [Israel ]
[Public Key] :: [0xD6F42CA5 ]
[Keyserver ] :: [keyserver.kjsl.com]
encrypted/signed plain text preferred

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/