kernel drivers and ioctls and mutexes?

Benjamin Herrenschmidt benh at kernel.crashing.org
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
>re-entered.

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 ;)

Ben.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list