Re: drm_vm.c:drm_mmap: possible circular locking dependency detected (was: Re: Linux 2.6.33-rc2 - Merry Christmas ...)
From: Eric W. Biederman
Date: Wed Dec 30 2009 - 16:34:54 EST
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:
> We've seen it several times (yes, mostly with drm, but it's been seen with
> others too), and it's very annoying. It can be fixed by having very
> careful readdir implementations, but I really would blame sysfs in
> particular for having a very annoying lock reversal issue when used
> reasonably.
Maybe. The mnmap_sem has some interesting issues all of it's own.
What reasonable thing is the drm doing that is causing problems?
> So the optimal situation would be for sysfs to not have that annoying lock
> dependency, and it would really have to be sysfs_readdir() that drops the
> sysfs_mutex around the filldir call (and that obviously implies having to
> re-validate and be really careful).
>
> Added Eric and Greg to the cc, in case the sysfs people want to solve it.
There are scalability reasons for dropping the sysfs_mutex in sysfs_readdir
and I have some tenative patches for that. I will take a look after I
come back from the holidays, in a couple of days. I don't understand
the issue as described.
> And yes, one option would be to just fix drm - by avoiding calling any
> sysfs functions while holding the mmap_lock (either in the mmap callback
> or the page fault paths). However, as mentioned, I really do think that
> the blame can be laid on sysfs for trying to be a nice generic interface,
> but having a damn inconvenient locking model.
Could be. I have simplified the sysfs locking quite a bit this last
round. I don't know if there is much more than corner cases left to
improve.
Eric
--
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/