Re: [PATCH] spi: Push the BKL down into the drivers

From: Alan Cox
Date: Fri May 23 2008 - 07:22:54 EST

On Thu, 22 May 2008 17:40:50 -0700
David Brownell <david-b@xxxxxxxxxxx> wrote:

> On Thursday 22 May 2008, Alan Cox wrote:
> > Another step to removing ->ioctl and to removing the BKL
> This happens to not apply with the latest patches; I'll
> address that.
> Where is the writeup about exactly what lock_kernel() is
> supposed to have been protecting against in ioctl code?

There isn't one. The big problem we have is that the ioctl methods were
implicitly called under the big kernel lock. Without pushing them down
into drivers we can't take the step of actually thinking at the driver
level "is this needed". Historically therefore we've never documented
*why* or *if* it was needed - it's just there. Pushing them into the
driver means the subsystem owner gets to see the implicit locking and can
actually ask the right questions with internal driver knowledge.

Whether it is needed is dependant on the internal locking model of the
driver - does it handle parallel ioctls correctly, are there races
against other functions in the driver (eg hot unplugs). That can't be
evaluated at a high level.

It's also made harder by the fact lots of drivers have buggy assumptions
about ioctl locking (watchdog was a fine example).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at