Re: Robust futex patch for Linux 2.6.15

From: Andrew Morton
Date: Fri Jan 13 2006 - 16:26:06 EST


David Singleton <daviado@xxxxxxxxx> wrote:
>
> Andrew and Ingo,
>
> here is a patchthat I'd like to see tested in the mm kernel. The patch
> supports robust futexes for Linux without any RT support.
> Ulrich Drepper has been asking me for a while for a patch that just has
> robustness
> in it, no RT or PI or PQ. He'd like to see it in Linux and said he'd
> support
> it in glibc if/when it gets in.
>
> This patch was originally done by Todd Kneisel for the robust-mutex SIG
> at
> OSDL. I've fixed a few bugs and added slab support.
>
> The patch is at
>
> http://source.mvista.com/~dsingleton/patch-2.6.15-robust-futex-1
>
> There are also some simple tests for robustness in the same directory
> in robust-tests.tar.gz. These simple tests test register, deregister,
> waiting,
> timed waiting, waiting for robustness from a dieing thread to wake,
> etc.
>

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.
-
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/