Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3030799img; Mon, 25 Mar 2019 02:13:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSm6mxI3vTtB8dfpA4YNA+TWyHSUfYpNMUO0klxCixQ7k2eteuRgQeuXUJoF5Pn49mkK4J X-Received: by 2002:a62:2046:: with SMTP id g67mr17899902pfg.121.1553505236861; Mon, 25 Mar 2019 02:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553505236; cv=none; d=google.com; s=arc-20160816; b=A+yYUQadi0qHxUusXwm6BqyysKJyYm80VwR3rXmiaapwr7a7jttx+W62EQ0q0euPUt qluDX/C+8apkRhISMqUGVKPzEneH0CCujunr8km/a5bL94zqwZ8Xz5JXS2HfXxkFO/+y ioOgP/4Drn2zFqRp88cCxasC7xHlsBuDtVebNifw1/mWnLdqAvdm7mqoDr2K7JZKmiiU DiuNl1ztc0fNVqn5ZKx3WJFIW9XFNZ6Q9Oz86V1cUpEQqMMno4i14cs+SeJcexTtXi3M tecL44iicBI/xcLzKseaeYaVhu1LfS9ktRLH+hG0cemLucN0uAUsbUj0uY8T/oEbiW5d f7VA== 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=kGkBM9kpb2lfL1AANt3V6cK+WL12X/5xhvwtkBe6mX0=; b=oy24XHEOGb14q+kbNpbZ9qEsiDIQhYmpyabVuqIGhgOBJGRk5E4ucpqOuFatdajraE Yp4DfJ6iKHf+klosKHxJYRwOd5T1yXf7Urrb5mrKn3mrIfzBAwmxy1NlnremrikUacQm QYvhdcoczzG9HKr8a3xjsTINeyaV91eZBEZpr1p3Cbwe4Bz4f/QbulByXQRA3boelsQf NGS0GWvadqRksQPGccYPnM+wKWHg0bnmLMqjQHYXrBz0TcmSpND67MsHGtL36A069O2/ 3ctb/SRvdrYTs8aC79WQbNyv3LMDursq911EqWDDzL/uzNxgCP6iVsuDU4X0LLVKs4BH 25+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=4oltJLb4; 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 d10si13952857pla.42.2019.03.25.02.13.41; Mon, 25 Mar 2019 02:13:56 -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=4oltJLb4; 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 S1730182AbfCYJMr (ORCPT + 99 others); Mon, 25 Mar 2019 05:12:47 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:43340 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730029AbfCYJMr (ORCPT ); Mon, 25 Mar 2019 05:12:47 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2P98NZp178088; Mon, 25 Mar 2019 09:12:20 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=kGkBM9kpb2lfL1AANt3V6cK+WL12X/5xhvwtkBe6mX0=; b=4oltJLb4fgsTPreh5E/71yhPIJGyNiACE2SIsr8EIAqWoj6ojK88XJVSblZl0Ow17EH+ 319HtAnZQGV9NaUJwJGHyRAvADWH7GZVr58VgbXzkik4M2NsGjxbatxS+GvTFIEWdl93 tP6X55e9YalsXfwzW71wa87S+lLi7nMjSl1LnyAzWdTOL3VLDTc/WmBBli91sJ2ZlcVK Fege3pWrZX+L6MW6moZoj72+dnxOWxrbXJMHudDnkfsl3Nefd8RZzMT44osXIi+f6PQs Gxh/Uq7JFHyXKPdsGniBGPngPE+14/Z8ySXcQKX9ZA0FXxta55ykG2wWs7vYzepC8SjO RA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2re6g0tssp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Mar 2019 09:12:20 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x2P9CJ8E019218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Mar 2019 09:12:19 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x2P9CJe4012974; Mon, 25 Mar 2019 09:12:19 GMT Received: from [10.182.71.8] (/10.182.71.8) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 25 Mar 2019 02:12:18 -0700 Subject: Re: [PATCH V2 8/8] blk-mq: remove blk_mq_tagset_busy_iter To: Hannes Reinecke , axboe@kernel.dk Cc: keith.busch@intel.com, jsmart2021@gmail.com, sagi@grimberg.me, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, josef@toxicpanda.com, linux-block@vger.kernel.org, jthumshirn@suse.de, hch@lst.de, bvanassche@acm.org References: <1553492318-1810-1-git-send-email-jianchao.w.wang@oracle.com> <1553492318-1810-9-git-send-email-jianchao.w.wang@oracle.com> <47fe0e2a-f427-0e3e-e15b-a9e2bffb502f@suse.de> <15fa9443-776b-bb75-0e20-538609d34eba@suse.de> From: "jianchao.wang" Message-ID: <5b8025dc-3aeb-c704-b539-9a2a926c2f02@oracle.com> Date: Mon, 25 Mar 2019 17:12:17 +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: <15fa9443-776b-bb75-0e20-538609d34eba@suse.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9205 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 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-1903250070 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/25/19 4:25 PM, Hannes Reinecke wrote: > On 3/25/19 8:37 AM, jianchao.wang wrote: >> Hi Hannes >> >> On 3/25/19 3:18 PM, Hannes Reinecke wrote: >>> On 3/25/19 6:38 AM, Jianchao Wang wrote: >>>> As nobody uses blk_mq_tagset_busy_iter, remove it. >>>> >>>> Signed-off-by: Jianchao Wang >>>> --- >>>>    block/blk-mq-tag.c     | 95 -------------------------------------------------- >>>>    include/linux/blk-mq.h |  2 -- >>>>    2 files changed, 97 deletions(-) >>>> >>> Please, don't. >>> >>> I'm currently implementing reserved commands for SCSI and reworking the SCSI error handling where I rely on >>> this interface quite heavily. >> >> >> blk_mq_tagset_busy_iter could access some stale requests which maybe freed due to io scheduler switching, >> request_queue cleanup (shared tagset) >> when there is someone submits io and gets driver tag. When io scheduler attached, even quiesce ^^^^ s/When/Without >> request_queue won't work. >> >> If this patchset is accepted, blk_mq_tagset_busy_iter could be replaced with blk_mq_queue_inflight_tag_iter >> which needs to be invoked by every request_queue that shares the tagset. >> > The point is, at that time I do _not_ have a request queue to work with. > > Most SCSI drivers have a host-wide shared tagset, which is used by all request queues on that host. > Iterating over the shared tagset is far more efficient than to traverse over all devices and the attached request queues. > > If I had to traverse all request queues I would need to add additional locking to ensure this traversal is race-free, making it a really cumbersome interface to use. Yes, the new interface int this patchset is indeed not convenient to use with shared tagset case. Perhaps we could introduce a interface to iterate all of the request_queue that shares a same tagset, such as, mutex_lock(&set->tag_list_lock) list_for_each_entry(q, &set->tag_list, tag_set_list) ... mutex_unlock(&set->tag_list_lock) > > Plus the tagset iter is understood to be used only in cases where I/O is stopped from the upper layers (ie no new I/O will be submitted). The window is during get driver tag and store the rq into tags->rqs[]. w/ io-scheduler attached, we need to quiesce the request_queue to stop the driver tag allocation attempts. w/o io-scheduler attached, quiesce request_queue cannot work, we need to freeze the queue and drain all of tasks that enters blk_mq_make_request to rule out all of attempts of allocating driver tags. Unfortunately, we cannot distinguish between the task entering .make_request and allocated requests both of which occupies q_usage_counter. So to stop all of the attmpts of allocating driver tag, we have freeze & drain and quiesce the request_queue. Thanks Jianchao > So here we only need to protect against I/O being completed, which is not what this patchset is about. > > So my objection still stands: Please, don't. > > Cheers, > > Hannes