Messages in this thread | | | Date | Wed, 30 Sep 2015 19:32:11 +0900 | Subject | Re: [PATCH v4 6/7] blk-mq: fix freeze queue race | From | Akinobu Mita <> |
| |
2015-09-30 6:50 GMT+09:00 Tejun Heo <tj@kernel.org>: > Hello, > > On Tue, Sep 29, 2015 at 11:03:46AM -0400, Tejun Heo wrote: >> On Tue, Sep 29, 2015 at 09:01:31AM -0600, Jens Axboe wrote: >> > I think that would be very useful, it seems sort of half-assed if the caller >> > side has to provide serialization for that. >> >> Yeah, the thing is init/exit are usually caller synchronized but >> percpu_rwsem's kill/reinit are more of mode-switching operations which >> can be performed concurrently during operation so I think the right >> thing to do here is making it synchronize itself. Will spin a patch. > > Patchset posted > > http://lkml.kernel.org/g/1443563240-29306-1-git-send-email-tj@kernel.org
Thanks. So far it's working well without any problems.
Note that we still need a part of patch 6/7. Quoted from this patch description:
When unfreezing queue, there is a small window between decrementing q->mq_freeze_depth to zero and percpu_ref_reinit() call with q->mq_usage_counter. If the other calls blk_mq_freeze_queue_start() in the window, q->mq_freeze_depth is increased from zero to one and percpu_ref_kill() is called with q->mq_usage_counter which is already killed. percpu refcount should be re-initialized before killed again.
So we don't need to protect percpu_ref_switch_to_percpu() in blk_mq_finish_init() anymore by your percpu_ref patchset, but we still need to serialize blk_mq_freeze_queue_start() and blk_mq_unfreeze_queue(). (As you suggested earlier in this thread, q->mq_freeze_depth don't have to be atomic_t anymore)
| |