Re: [PATCH 07/10] block: reorganize throtl_get_tg() andblk_throtl_bio()

From: Tejun Heo
Date: Wed Oct 19 2011 - 13:49:57 EST


Hello,

On Wed, Oct 19, 2011 at 01:45:56PM -0400, Vivek Goyal wrote:
> > Hmmmm, yeah, right, switching itself would be racy. Maybe not sharing
> > is the solution, I don't know. There's a way to make the switching
> > safe tho. Sth like the following.
> >
> > lock_queue(q, flags)
> > {
> > spinlock_t *lock;
> >
> > local_irq_save(flags);
> > lock = rcu_dereference_sched(q->queue_lock);
> > spin_lock(lock);
> > }
> >
> > and on cleanup, do synchronize_sched() after lock switching. But yeah
> > it still stinks.
>
> rcu protected spinlocks. Interesting. :-)

:)

> IIUC, it still leaves the window open that two callers think they have
> the spinlock. One is holding the driver provided lock and other is holding
> the queue private lock.

On blk_cleanup_queue() completion, the two are disjoint, so that
shouldn't be a problem. Block layer won't call into low level drivers
and low level drivers aren't supposed to call into block layer either.

Thanks.

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