Re: AS spin lock bugs

From: Jens Axboe
Date: Thu Nov 13 2003 - 06:01:00 EST


On Thu, Nov 13 2003, Nick Piggin wrote:
>
>
> Jens Axboe wrote:
>
> >Hi,
> >
> >Was looking at io tracking for cfq, and I think I found some spin lock
> >bugs in current as (current BK). as_update_iohist() runs from
> >add_request which is typically in process context. It could be run with
> >interrupts disabled though, either driver private stuff or using the
> >generic block layer tagging.
> >
> >Anyways, as_update_iohist() grabs aic->lock without disabling
> >interrupts, while as_completed_request() typically runs at interrupt
> >time and grabs the same lock. Deadlock.
> >
> >To be safe, both need to use the flags saving lock variants.
> >
>
> Hi Jens,
> I was hoping everything ran under the queue lock which should always
> have interrupts off on the local CPU. The lock in question is to prevent
> a as_completed_request on one queue from racing with as_update_iohist
> on another. Each would be on a different CPU.

Ah yes you are right. The queue lock will be held in both places.

> Maybe I'm wrong, did you actually see misbehaviour?

Nope, just looking over the code. What about the second lock, why is
that needed? I don't see that protecting anything.

--
Jens Axboe

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