Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp363834imm; Thu, 14 Jun 2018 22:16:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJhTQVZ2GmqQqVHuygu5GI2VUhYkADka7ZR93fAZ/ZJggvM5ntC3eHx0ItnJfrJig47rp/l X-Received: by 2002:a65:608d:: with SMTP id t13-v6mr189689pgu.266.1529039795393; Thu, 14 Jun 2018 22:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529039795; cv=none; d=google.com; s=arc-20160816; b=vaCPJF7aF+xSInvCd8AbKo367mOHWtrPe5LSHmezEQJ1IpNbeux47rkW4Zld7kJZZk 7dQQUX67NSvPkL8h6DCIUou1uW2mDtnQDQteuUks3CnyOPxY2BvQtSQKwnS/lJsWfLFZ HM5o542e7IKguK8Khccd1/KB6ipd+vR7uS0J59/KOPkCt539Dcc3FqDdeDQ2uhnKawMG J9cJwSjcbpc77ZeYFT65eCiddIcsdd/+qQOz2VXEVTR+HelsMBUMyRmTpgovjudW7M8X mz+k0jKqJGN/pHv06/dPZekNF8meDPJpAakwq2KOztQkZGzpf9PdhkXWIm3lPdhbqOeQ ovJg== 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 :arc-authentication-results; bh=TZKokBkol+B0awicJ3SWKYxWBNZORSwca+/0I4ASPmE=; b=xKVBHHwVFbrOK11gaqf4Rt1LPz7rZffuez6uFrPW4n3SQUjPz5IolPT9jKrccWQ6FD B/+Zu/YxOoGVkO/bjz7EeInc7kCsQ0lEcTA3WbWxbr0PMyavNHCngYsCYGxEa/MMjO9h vmeM28xfnIjF1CZs9goTMw3lpXRo0kTTmTvsNDiOIE97BSBy8pLYgzxIFywn1r6mxscQ klhY1a1Ls8bBhq5EgYpMHfPLG7pliCjiUJzIoxA4xK2lRkOf2WoC0iRXwsUwIYK9A/iA SFn6+b5ajXgwYYSu7l5o/nAd/Od8RiF7f62dIAqUXixt/8/QTahr6GZoJGCYf2JKtBIT +Sjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=kL5b+Vtd; 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 x16-v6si6576422pfh.354.2018.06.14.22.15.50; Thu, 14 Jun 2018 22:16:35 -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-2017-10-26 header.b=kL5b+Vtd; 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 S1755864AbeFOFKB (ORCPT + 99 others); Fri, 15 Jun 2018 01:10:01 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:48530 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754165AbeFOFJ5 (ORCPT ); Fri, 15 Jun 2018 01:09:57 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5F59Gr2101777; Fri, 15 Jun 2018 05:09:51 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-2017-10-26; bh=TZKokBkol+B0awicJ3SWKYxWBNZORSwca+/0I4ASPmE=; b=kL5b+VtdLlVsW5LZYpwXOprpi9ukFK2Y+95GC85KYGfZLE4Fu4smTFTFuf1t8+Rfy9oo ir/uW74QGg8rwLYsI0uYj9PaVFQ88rTO1w0pVL67JjMYw3Kwa8/+2ZbCzjsqFP305sqL jQRGrTBWx0wnVElVP9LfQgFhW9focQTzfaHJMVYBvFl1je4HdBf6a7VmligH7vEOnskM jRceZhuJRegPqv0VUOnH/jTSTLz4Udf9sXcZ3S2rLuxlv80DvBwuCV+dqT3iwGCSA1tO tTwU9LCFneN6DQ1huSdesQfE8lNC0BS/UMcRFJhrI8UhVuxWEexevtWu9hdxxhJIrPFw zw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2jk0xrfgqk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jun 2018 05:09:51 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w5F59odk007017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jun 2018 05:09:50 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5F59naa031918; Fri, 15 Jun 2018 05:09:49 GMT Received: from [10.182.69.179] (/10.182.69.179) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Jun 2018 22:09:49 -0700 Subject: Re: [PATCH 1/2] block: export __blk_complete_request To: Ming Lei Cc: Jens Axboe , Christoph Hellwig , James Bottomley , "Martin K. Petersen" , linux-block , Linux SCSI List , Linux Kernel Mailing List References: <1529027847-29085-1-git-send-email-jianchao.w.wang@oracle.com> <3dd3f82a-5b68-f039-3a8a-7c5fe4e24c3e@oracle.com> <3970fdc7-52d9-d05b-4118-059d48bf4f2d@oracle.com> <7a77829a-ba5f-8975-edb0-ffdf25dc71d6@oracle.com> From: "jianchao.wang" Message-ID: Date: Fri, 15 Jun 2018 13:10:00 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 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=8924 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=677 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806150054 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ming Thanks for your kindly response On 06/15/2018 12:03 PM, Ming Lei wrote: > On Fri, Jun 15, 2018 at 11:26 AM, jianchao.wang > wrote: >> Hi Ming >> >> On 06/15/2018 11:20 AM, Ming Lei wrote: >>> On Fri, Jun 15, 2018 at 11:04 AM, jianchao.wang >>> wrote: >>>> Hi Ming >>>> >>>> Thanks for your kindly response. >>>> >>>> On 06/15/2018 10:56 AM, Ming Lei wrote: >>>>>>> IMO, ref-counter is just to fix the blk-mq req life recycle issue. >>>>>>> It cannot replace the blk_mark_rq_complete which could avoid the race between >>>>>>> timeout and io completion path. >>>>>> The .timeout return BLK_EH_DONE doesn't always mean the request has been completed. >>>>>> Such as scsi-mid layer, its .timeout callback return BLK_EH_DONE but the timed out >>>>>> request is still in abort or eh process. What if a completion irq come during that ? >>>>> For blk-mq, it is avoided by the atomic state change in >>>>> __blk_mq_complete_request(), >>>>> that is why I mentioned the question in my last reply. >>>>> >>>> >>>> but blk_mq_check_expired doesn't do that. >>>> do I miss anything ? >>> >>> Right, that is the difference between blk-mq and legacy now, >> >> Sorry, I cannot follow your point. >> blk_mq_check_expired doesn't do a atmoc state change from IN-FLIGHT to COMPLETE. >> __blk_mq_complete_request could still proceed to complete a timed out request >> which is in scsi abort or eh process. Is it really OK ? > > That is the idea of Christoph's patchset of 'complete requests from ->timeout', Yes, I used to read that mail thread. > then drivers need to cover race between timeout and normal completeion. > > But at least the request won't be completed twice because of the atomic > state change in __blk_mq_complete_request(). Yes > > So what is your real concern about blk-mq's timeout? I concern whether the current drivers have bee ready for taking this task currently. At least, for scsi, if I try to trigger timeout and completion path concurrently, system would crash. 4.17.rc7 or 4.18 with a patch that change state in blk_mq_check_expired will survive. Thanks jianchao > > Thanks, > Ming >