Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2282203imm; Wed, 16 May 2018 10:27:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrkYKiPjW6Hdmeea4ihcVsHerLbMMYJdIwsrh1bro1U13oZ8xmmmgmpH84CQrwYWmjsTARe X-Received: by 2002:a63:6e05:: with SMTP id j5-v6mr1449438pgc.150.1526491675978; Wed, 16 May 2018 10:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526491675; cv=none; d=google.com; s=arc-20160816; b=a0hjMtw4b2N+q8iVN69UTg4bdUYe8ov1/U/ZTw5NDsB0Qzsi/xKbhmVKF8FE1eacRP 9L+8vIEkFQzHRWqMufqyFL7/vcosOf5Y3T8oTgY/3i4io7k0Y9ejNbabXhadv/uWypN6 2AOOzGUwKQat1bMYoAicOOB/MeGnlfUI43FabTz1B5YHXAFkwCc7mkl0K5l2wmszNlN+ wo0sOaEQi+BV/l9He5TN5CG5quAhGRtSZcs9uEr5TPnwIB33Z2vXx2aEkF+DusqoxIb/ bysz1dehefp6mTWE+wALIR3aEIM5Sm5lz5nnF3eKajrIF+Fexqog8JwtGw0haVTYuaMQ qZxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=tOQWkZUCRvL8gP5hkLN3T9YQRKZeOLjYpKTYzrHevPE=; b=VNZOpJ0huj522l9AV4Pvk+3NDURhGYm68/7mmz8yk2Sy09WcsiibS4fg4Ca5lXSXjG i/MAs1oNze9x6rJ8x5byBIx0bMQvsSP1GPOlfKFSrLMyL7R6xxTut3//onzpwYyMJc89 ml6D5IwDGkpZ2EbrQkNjJYDNl+vXG8qN/o1nu408w99Cpo5yu3vDoLS+rlhAdZSzf4V4 X9osaHYUn7y7X+GhtoU+le8z6ThqxvC4XXnz/cTH//US9GRpqM+czOmq52EyP4bMiWje 5B1si8iaC8YWnVTzKKas1yLOXFtwx5gSG3E71qRAUUA0S0g3HArvO6DAnMtD1+NYo4t/ FltQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e184-v6si2401111pgc.475.2018.05.16.10.27.41; Wed, 16 May 2018 10:27:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751321AbeEPR1b (ORCPT + 99 others); Wed, 16 May 2018 13:27:31 -0400 Received: from verein.lst.de ([213.95.11.211]:48772 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbeEPR13 (ORCPT ); Wed, 16 May 2018 13:27:29 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 3671A7F0DE; Wed, 16 May 2018 19:31:58 +0200 (CEST) Date: Wed, 16 May 2018 19:31:58 +0200 From: "hch@lst.de" To: Bart Van Assche Cc: "hch@lst.de" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "israelr@mellanox.com" , "sagi@grimberg.me" , "sebott@linux.ibm.com" , "axboe@kernel.dk" , "ming.lei@redhat.com" , "jianchao.w.wang@oracle.com" , "maxg@mellanox.com" , "tj@kernel.org" Subject: Re: [PATCH v9 2/2] blk-mq: Rework blk-mq timeout handling again Message-ID: <20180516173158.GA6022@lst.de> References: <20180515225124.20428-1-bart.vanassche@wdc.com> <20180515225124.20428-6-bart.vanassche@wdc.com> <20180516125110.GA32078@lst.de> <8058d72fef475caffa78c962bc4220f5f8fa3dde.camel@wdc.com> <20180516162432.GA4398@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 16, 2018 at 04:47:54PM +0000, Bart Van Assche wrote: > I think your patch changes the order of changing the request state and > calling mod_timer(). In my patch the request state and the deadline are > updated first and mod_timer() is called afterwards. I think your patch > changes the order of these operations into the following: > (1) __blk_mq_start_request() sets the request deadline. > (2) __blk_mq_start_request() calls __blk_add_timer() which in turn calls > mod_timer(). > (3) __blk_mq_start_request() changes the request state into MQ_RQ_IN_FLIGHT. > > In the unlikely event of a significant delay between (2) and (3) it can > happen that the timer fires and examines and ignores the request because > its state differs from MQ_RQ_IN_FLIGHT. If the request for which this > happened times out its timeout will only be handled the next time > blk_mq_timeout_work() is called. Is this the behavior you intended? We can move the timer manipulation after the change easily I think. It would make sense to add comments explaining the ordering.