lkml.org 
[lkml]   [2017]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/6] blk-mq: replace timeout synchronization with a RCU and generation based scheme
Hello,

On Tue, Dec 12, 2017 at 12:56:57PM +0100, Peter Zijlstra wrote:
> On Sat, Dec 09, 2017 at 11:25:21AM -0800, Tejun Heo wrote:
> > +static inline void blk_mq_rq_update_state(struct request *rq,
> > + enum mq_rq_state state)
> > +{
> > + u64 new_val = (rq->gstate & ~MQ_RQ_STATE_MASK) | state;
> > +
> > + if (state == MQ_RQ_IN_FLIGHT) {
> > + WARN_ON_ONCE(blk_mq_rq_state(rq) != MQ_RQ_IDLE);
> > + new_val += MQ_RQ_GEN_INC;
> > + }
> > +
> > + /* avoid exposing interim values */
>
> My paranoia would like to see READ_ONCE() on the rq->gstate load above
> as well, that makes it a fully explicit load-store operation.

Right now, only the request owner can update the field so there's no
data coherency issue but then again there's nothing to lose by adding
READ_ONCE there. Will add it.

Thanks.

--
tejun

\
 
 \ /
  Last update: 2017-12-12 19:05    [W:0.088 / U:0.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site