kernel drivers and ioctls and mutexes?

Benjamin Herrenschmidt benh at
Thu Nov 29 21:58:07 EST 2001

>Can anyone tell me if your need mutexes to prevent problems when ioctls
>initiated from userland that change dev structure values are used in
>kernel drivers?
>For example in NIC modules a broken link can cause nway_start on some
>cards but a userland ioctl can (asynchronously) cause the same things to
>happen?  Should I be using mutexes inside the driver to prevent this or is
>there some synchronization mechanism I am missing here?  Given how nway
>negotiations are started and given them may take a few seconds to
>complete, something should shield the nway start routine from being

It depends on your driver, mutexes may or may not be the right solution.

I've implemented ethtool ioctl support in sungem and have done my own
synchronisation mecanism, basically the ioctl to restart autoneg will
interrupt any pending autoneg and restart one, there should be no
re-entrancy, except if I missed a case ;)


** Sent via the linuxppc-dev mail list. See

More information about the Linuxppc-dev mailing list