Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp606307ima; Fri, 15 Mar 2019 09:50:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwShYV4GERO4OobPRmLKCr8JFeMjn5H1JHu8Exw9SjLd1Zj0D3LMvfBMHKetgt2z10LuonU X-Received: by 2002:a62:6e05:: with SMTP id j5mr5140684pfc.158.1552668623919; Fri, 15 Mar 2019 09:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552668623; cv=none; d=google.com; s=arc-20160816; b=I5sQBXg5vVeWEhTozbLq8fxGNV7tFR1KnjYi7X86+g+L4Zq89kDW0sqV70Lg6xaBCz cGMxMC/Yk0htRtyinYr/GJclbKpCCE4b2mjJA/71beTbJQU8by1u1sIbJSP5ZBnM9cWf K67HJMomzxblAlIhMCCjpG2cxrMP/yCuUsUy9hed4HUbI/Nozz10svFT4ZT8kfhHham+ CQ+V7L9iHYFvJWY9JkVXU6rr/vSxCl7E6CCExryOVwhUmBDY6PxMQXa+Fd1iszg5q7M1 m/3dSspwXjy9S/I9gveb/gvUVQWzCmlnxP7sBy3q6v8qLBnVDnErCoRdn+Zo/rwN5+OC gXiQ== 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; bh=v76h30cULNSyIc1o65Kty8dBM2yLIb1cACcdB6MKNrI=; b=XozmbBQOqDLhCL+HMUpx23c0TjGIbkY9DHN1FVa64+jqUIBVT11aM5ndipjwydXu7H 6CimsqfU8TcSgBkVybkoudyEyfgb6pIwIMuZP4WN+AuqEWPDjHC3lTowimyzjr/op/2b 869GuWDr34e644u6TXZ2pKgGY6zatVBZEYbLJZixDkUPYJ5v/ML0jSaGkIjEJa3QEO/x U/WNkvjUCNFssd3k1HV3aRP3iDqZS++jnsB34tvywdvSUX8TJw03UBSCAeDJ8GqszgVi mn02ah3NHMcanE91wE5mYRvczQqANg2qmSBXveX4Sp7iGqnTNN1U/2ZGvp3L4L3YKgH4 LkZg== 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 3si2260353plb.138.2019.03.15.09.50.07; Fri, 15 Mar 2019 09:50:23 -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 S1729617AbfCOQtZ (ORCPT + 99 others); Fri, 15 Mar 2019 12:49:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:47876 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729192AbfCOQtZ (ORCPT ); Fri, 15 Mar 2019 12:49:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DF151AE6E; Fri, 15 Mar 2019 16:49:23 +0000 (UTC) Subject: Re: [PATCH 7/8] nvme: use blk_mq_queue_tag_busy_iter To: James Smart , James Smart , Jianchao Wang , axboe@kernel.dk Cc: linux-block@vger.kernel.org, sagi@grimberg.me, josef@toxicpanda.com, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, keith.busch@intel.com, jthumshirn@suse.de, hch@lst.de, bvanassche@acm.org References: <1552640264-26101-1-git-send-email-jianchao.w.wang@oracle.com> <1552640264-26101-8-git-send-email-jianchao.w.wang@oracle.com> <62de99e8-0d8d-910a-bfdc-649f734b152c@gmail.com> From: Hannes Reinecke Message-ID: <5def1025-a48b-f2a4-d58c-d37135177b0f@suse.de> Date: Fri, 15 Mar 2019 17:49:20 +0100 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; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/15/19 5:39 PM, James Smart wrote: > > > On 3/15/2019 9:33 AM, James Smart wrote: >> On 3/15/2019 1:57 AM, Jianchao Wang wrote: >>> blk_mq_tagset_busy_iter is not safe that it could get stale request >>> in tags->rqs[]. Use blk_mq_queue_tag_busy_iter here. A new helper >>> interface nvme_iterate_inflight_rqs is introduced to iterate >>> all of the ns under a ctrl. >>> >>> Signed-off-by: Jianchao Wang >>> --- >>>   drivers/nvme/host/core.c   | 12 ++++++++++++ >>>   drivers/nvme/host/fc.c     | 12 ++++++------ >>>   drivers/nvme/host/nvme.h   |  2 ++ >>>   drivers/nvme/host/pci.c    |  5 +++-- >>>   drivers/nvme/host/rdma.c   |  6 +++--- >>>   drivers/nvme/host/tcp.c    |  5 +++-- >>>   drivers/nvme/target/loop.c |  6 +++--- >>>   7 files changed, 32 insertions(+), 16 deletions(-) >>> >>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c >>> index 6a9dd68..5760fad 100644 >>> --- a/drivers/nvme/host/core.c >>> +++ b/drivers/nvme/host/core.c >>> @@ -3816,6 +3816,18 @@ void nvme_start_queues(struct nvme_ctrl *ctrl) >>>   } >>>   EXPORT_SYMBOL_GPL(nvme_start_queues); >>>   +void nvme_iterate_inflight_rqs(struct nvme_ctrl *ctrl, >>> +        busy_iter_fn *fn, void *data) >>> +{ >>> +    struct nvme_ns *ns; >>> + >>> +    down_read(&ctrl->namespaces_rwsem); >>> +    list_for_each_entry(ns, &ctrl->namespaces, list) >>> +        blk_mq_queue_tag_busy_iter(ns->queue, fn, data, true); >>> +    up_read(&ctrl->namespaces_rwsem); >>> +} >>> +EXPORT_SYMBOL_GPL(nvme_iterate_inflight_rqs); >> >> Hmm... so this aborts ios for namespaces. How about ios that aren't >> for a namespace but rather for the controller itself.  For example, >> anything on the admin queue ?   Rather critical for those ios be >> terminated as well. > NVM - didn't look at which tag set.  but it does highlight - doesn't > cover anything issued by core/transport on the io queues. > Actually, I would consider that an error. _All_ commands on io queues (internal or block-layer generated) whould be tracked sbitmap and hence the tag iterator. That's what we have the 'private' tags for, and why the iter callback has this ominous 'bool' argument... Cheers, Hannes