From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932085AbdLONvH (ORCPT ); Fri, 15 Dec 2017 08:51:07 -0500 Received: from mail-qt0-f177.google.com ([209.85.216.177]:40819 "EHLO mail-qt0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755566AbdLONvD (ORCPT ); Fri, 15 Dec 2017 08:51:03 -0500 X-Google-Smtp-Source: ACJfBotmKQowWdwhShayio38BJVnP0/8FeszOjUcfTmE7qvZsHpVjW4J76YF8vhw9vP/0hm2HbhKEA== Date: Fri, 15 Dec 2017 05:50:59 -0800 From: "tj@kernel.org" To: Peter Zijlstra Cc: Bart Van Assche , "axboe@kernel.dk" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "kernel-team@fb.com" , "oleg@redhat.com" , "hch@lst.de" , "jianchao.w.wang@oracle.com" , "osandov@fb.com" Subject: Re: [PATCH 2/6] blk-mq: replace timeout synchronization with a RCU and generation based scheme Message-ID: <20171215135059.GJ3919388@devbig577.frc2.facebook.com> References: <20171212190134.535941-1-tj@kernel.org> <20171212190134.535941-3-tj@kernel.org> <1513277469.2475.43.camel@wdc.com> <20171214202042.GG3326@worktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171214202042.GG3326@worktop> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); > > read_seqcount_begin() > while (seq & 1) > cpurelax(); > // life-lock > > 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