Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3839722img; Mon, 25 Mar 2019 20:07:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaXopubES7BZZ5tQHNKtcZ9iOt1PCofAgC/t8m9xBRaHfePn2vUCrwx84gZaQRBCLT9CVA X-Received: by 2002:a17:902:15a8:: with SMTP id m37mr29749594pla.178.1553569635447; Mon, 25 Mar 2019 20:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553569635; cv=none; d=google.com; s=arc-20160816; b=f/ts12kDU+Tm4ej+i/C43oSe8avrT9w3mF1pTPJLJ/HPA8nT0JHdAP0ufqWlgdDBdn 3+vKPGXKa+k8Ofg5lAIcsA9xSwZ0AanKI1CBlBW3jR6iGLIWn1AkklN4sNDjL7lBzpf1 xc4Ecw5IgKyfEOc3TeezdfCkd0lQ8iZEWXmCNg6YzAVrM6aA4YRwCHG+T/F4AAFy4mLn Dc/VxbkqMLvO7uAVMlph3xR/UMCfPfpqxJu0C5tM6jNIvAkTlBg8UPg4cAF8bAfQXWiu 4JC3eUGUFPR5ULugxSMpyCEUNcfqBn5WUKIVEQ8KWMMJQd1nEdd1WKrCmPTcVEGVVrat hE8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=AikLAY3/yF5f7CFUPqFi56k+5aRsUE/ZO0XGmUjmvdA=; b=OAjZWhJkyUZ9Fomz+9fqOy+pS3TGVZclcsM4Xn3aVCctxfOlQeaFQwKHfh1WdUGQ0F +RBcZzYN7ACk+v5iBNcDrVa57/wbZMHoo1nXlbBNizFmrw1o16zeaqyypx4XmFMjAAKt 93WS/aDELxmwLZaQwITbj7Ag4nVvo3FnXabvSsFZ72E2LPKWP5gu/GM/SRhLv/HxHAqS YEfORo9OvZCM5H0TLHbBfRLV0m25ihswmyF2EEcwZ+fTcvkvOq7Q3bLU8VYzU1HtLHfF i16oUwzwg5W63mRhC/28Oy/D/ipvJ0eQU79xXM8wwlm+ydW4XbWWn6j7GS1jSoVMrOwA cHXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=kBbnCu6J; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q63si15379170pfb.154.2019.03.25.20.07.00; Mon, 25 Mar 2019 20:07:15 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=kBbnCu6J; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730605AbfCZDG0 (ORCPT + 99 others); Mon, 25 Mar 2019 23:06:26 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:59218 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727394AbfCZDGZ (ORCPT ); Mon, 25 Mar 2019 23:06:25 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2Q2sEqo096804; Tue, 26 Mar 2019 03:06:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=AikLAY3/yF5f7CFUPqFi56k+5aRsUE/ZO0XGmUjmvdA=; b=kBbnCu6JrcJnIh+dMyMS0YRoV57YCFIdC0+Prn94Ye/BvzAZ7pySB8FGu85xX8YjmwQ/ BsfwITBnZKsLrKplhxRlOYla3MHJEyOL6sZQOWx9Gf9/d045QYAaduxDuJPg0X5fmVJh /S9s5vuQQ/1MNgHSmTOlqfzc+nv7PVwfweEDYIqsUCnyfkbVx9+2XTjZgWMIfZ/0708Y ccv7DKHhjIRUBnsxIzjYu1UZT78LDtNTOlPWn4AagFnTJazWPB2+sBD3swqodtF3dRkf oUQHzj43/u2GbOQSPNV7fG9+H58djp98ZOgWUXr1j3ftvPDJJHBbJspRsrAnXxmsb21P 2w== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2re6dj7reu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Mar 2019 03:06:03 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x2Q35ust024426 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Mar 2019 03:05:56 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x2Q35snL019610; Tue, 26 Mar 2019 03:05:54 GMT Received: from [10.182.69.118] (/10.182.69.118) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 25 Mar 2019 20:05:53 -0700 Subject: Re: [PATCH V2 7/8] nvme: use blk_mq_queue_tag_inflight_iter To: Ming Lei Cc: Keith Busch , Jens Axboe , Keith Busch , James Smart , Bart Van Assche , Josef Bacik , linux-nvme , Linux Kernel Mailing List , linux-block , Hannes Reinecke , Johannes Thumshirn , Christoph Hellwig , Sagi Grimberg References: <1553492318-1810-1-git-send-email-jianchao.w.wang@oracle.com> <1553492318-1810-8-git-send-email-jianchao.w.wang@oracle.com> <20190325134917.GA4328@localhost.localdomain> <70e14e12-2ffc-37db-dd8f-229bc580546e@oracle.com> From: "jianchao.wang" Message-ID: Date: Tue, 26 Mar 2019 11:05:53 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9206 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903260021 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/26/19 10:41 AM, Ming Lei wrote: > On Tue, Mar 26, 2019 at 9:18 AM jianchao.wang > wrote: >> >> Hi Keith >> >> On 3/25/19 9:49 PM, Keith Busch wrote: >>> On Mon, Mar 25, 2019 at 01:38:37PM +0800, Jianchao Wang wrote: >>>> blk_mq_tagset_inflight_iter is not safe that it could get stale request >>>> in tags->rqs[]. Use blk_mq_queue_tag_inflight_iter here. A new helper >>>> interface nvme_iterate_inflight_rqs is introduced to iterate >>>> all of the ns under a ctrl. >>> >>> Nak, NVMe only iterates tags when new requests can't enter, allocated >>> requests can't dispatch, and dispatched commands can't complete. So >>> it is perfectly safe to iterate if the driver takes reasonable steps >>> beforehand. >> >> nvme_dev_disable just quiesce and freeze the request_queue, but not drain the enters. >> So there still could be someone escapes the queue freeze checking and tries to allocate >> request. > > The rq->state is just IDLE for these allocated request, so there > shouldn't be issue > in NVMe's case. What if there used to be a io scheduler and leave some stale requests of sched tags ? Or the nr_hw_queues was decreased and leave the hctx->fq->flush_rq ? The stable request could be some tings freed and used by others and the state field happen to be overwritten to non-zero... Thanks Jianchao