Re: [PATCH 01/30] infiniband: update workqueue usage

From: David Dillow
Date: Thu Dec 23 2010 - 17:12:16 EST


On Thu, 2010-12-16 at 17:50 +0100, Tejun Heo wrote:
> On 12/15/2010 07:33 PM, Roland Dreier wrote:
> >
> > > * qib_wq is removed and ib_wq is used instead.
> >
> > You obviously looked at the comment
> >
> > - /*
> > - * We create our own workqueue mainly because we want to be
> > - * able to flush it when devices are being removed. We can't
> > - * use schedule_work()/flush_scheduled_work() because both
> > - * unregister_netdev() and linkwatch_event take the rtnl lock,
> > - * so flush_scheduled_work() can deadlock during device
> > - * removal.
> > - */
> > - qib_wq = create_workqueue("qib");
> >
> > and know that with the new workqueue stuff, this issue no longer
> > exists. But for both my education and also the clarity of the changelog
> > for this patch, perhaps you could expand on why ib_wq is safe here.
>
> I think I got confused. I thought the comment was indicating the
> separation between qib_wq and qib_cq_wq. It's between system_wq and
> qib_wq, right? I'll drop this part from the series, but then again
> what's the difference from ib_srp, which flushes the common workqueue?
> Why doesn't ib_srp have the same problem?

Looking at qib, I'm not sure the comment isn't confused -- the only
place I see where qib_wq or qib_cq_wq get flushed is by
destroy_workqueue() when the module is being unloaded. And we shouldn't
be there with rtnl_lock held by the caller.

Roland, please let me know how plan to proceed -- I need to update
ib_srp to get rid of *scheduled_work(), and I can either use the IB
core's queue, or define my own. Since it's cheap, I don't suppose it
matters much, but I think I'd prefer to share if possible.

Thanks,
Dave


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