Re: [PATCH 2/6] blk-mq: replace timeout synchronization with a RCU and generation based scheme

From: tj@xxxxxxxxxx
Date: Fri Dec 15 2017 - 08:51:11 EST


Hello, Peter.

On Thu, Dec 14, 2017 at 09:20:42PM +0100, Peter Zijlstra wrote:
> But now that I look at this again, TJ, why can't the below happen?
>
> write_seqlock_begin();
> blk_mq_rq_update_state(rq, IN_FLIGHT);
> blk_add_timer(rq);
> <timer-irq>
> read_seqcount_begin()
> while (seq & 1)
> cpurelax();
> // life-lock
> </timer-irq>
> write_seqlock_end();

Ah, you're right. For both gstate_seq and aborted_gstate_sync, we can
push all synchronization to the timeout side - ie. gstate_seq read can
yield, pause or synchronize_rcu and hte aborted_gstate_sync can
disable irq around update.

Thanks.

--
tejun