Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp125913pxb; Mon, 8 Feb 2021 17:29:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0VnYRVeothZ4BAZ/DT/NK705tf2RFI+5LJHjhjR1MmjyEW2n3bK1pV4LPMqzXJDmtlArb X-Received: by 2002:a17:906:158c:: with SMTP id k12mr20191334ejd.119.1612834170321; Mon, 08 Feb 2021 17:29:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612834170; cv=none; d=google.com; s=arc-20160816; b=ZhTii3UbS0imS7RS3T3idx/kbLzSD/uRzNkcCJ8A4+h81IWVkVYLRbvrkw9T3slRY0 UBel3vLiWAAACmY35i0QbNkBMe6J87oEQo25co6wCon97ofxmrxeyLmIx47fwV2Tyekf L3H8IRw9z2FC8YqjREhkOmpFAMCnQcwyIEjx0+FAzlLYoz1rujidrcnWAVDs3d8ZhoeX jgNVE/KOAW/IikxGSNvYLDZ61oVtFOt5CRCKZX8mquQ4pFEtwZn53F6Us0L3ExmJ8MLn HSi5TsHX1uJpP9l5abA2C5pjpsfyjW2wmQG9O/tPSGfG/+gEdlrLt2DiX14D8fEtp7HW jZrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:cc:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=IVTi1/fqkT4P2V5ja0EkF1goxEb7HDWuBTmQvwKKMc4=; b=qeyv4tPkQsHb9q1i0q8e3WYgWm4Y3C9dI7g9Da19VDpoZwfr86PFlcBVL4BjzXWmsF 6IwpZxPNfzzHNyZ4Gjua00Iv0SEK6L3jF1xLWlanWbfriPseXJqY/nBs1ictgnL0DPOD sC0h3zP/1GAiRqbI9xQIftjtuDhjg2ZM8PEWWazFI5JH8dBKRGl0ohWfCGm342ELUAv8 pqBWrtnzGxK1Gy8ivEoNsdMvajYHXXEF5Dpzx03hww00ue8S8SyP2PpkdR0hOfB3GcY+ EXslGG2JSOlOoiXSO/Mb51yl6/ilTJXwO+QFzQA9yDhi1UbOiVlPjMkbdtfUhHLdLR/k ogqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=SaMUCF+E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b21si13863116edx.44.2021.02.08.17.29.06; Mon, 08 Feb 2021 17:29:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=SaMUCF+E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229733AbhBIB2c (ORCPT + 99 others); Mon, 8 Feb 2021 20:28:32 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:41215 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbhBIB2X (ORCPT ); Mon, 8 Feb 2021 20:28:23 -0500 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210209012739epoutp03b085fb4043aad46f9075f4df7ae3b692~h8AgiwBZo2869928699epoutp03R for ; Tue, 9 Feb 2021 01:27:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210209012739epoutp03b085fb4043aad46f9075f4df7ae3b692~h8AgiwBZo2869928699epoutp03R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1612834059; bh=IVTi1/fqkT4P2V5ja0EkF1goxEb7HDWuBTmQvwKKMc4=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=SaMUCF+ETp+bg7gCRr+WyNSsifS+GMzDCPZuLc0qeYPTCtQ/B+E3t+CE5gO/LAGY/ kMaDpSsn3cy+pCn+QZtzINJm84oJvUMPAgOlcaL0EE3VMCeLJq0XZXR8EcIgOU12cT SrKv0Hy/kO5jSzpGvqb61HnICEU86th6XZgllGPM= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20210209012738epcas2p47972312b144c2a8fd813774bb82dcc3e~h8AfyJhrg0963409634epcas2p49; Tue, 9 Feb 2021 01:27:38 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.40.182]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4DZQHX0wQDz4x9QD; Tue, 9 Feb 2021 01:27:36 +0000 (GMT) X-AuditID: b6c32a46-1d9ff7000000dbf8-42-6021e5074975 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 03.60.56312.705E1206; Tue, 9 Feb 2021 10:27:35 +0900 (KST) Mime-Version: 1.0 Subject: RE: Re: [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read Reply-To: daejun7.park@samsung.com Sender: Daejun Park From: Daejun Park To: Can Guo , Daejun Park CC: Greg KH , "avri.altman@wdc.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "asutoshd@codeaurora.org" , "stanley.chu@mediatek.com" , "huobean@gmail.com" , "bvanassche@acm.org" , ALIM AKHTAR , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Sung-Jun Park , yongmyung lee , Jinyoung CHOI , BoRam Shin , SEUNGUK SHIN X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <5b9f5edbe26930765ee4adaa786db7da@codeaurora.org> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20210209012734epcms2p8354347b1dd71601e74b505c715d36af0@epcms2p8> Date: Tue, 09 Feb 2021 10:27:34 +0900 X-CMS-MailID: 20210209012734epcms2p8354347b1dd71601e74b505c715d36af0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrELsWRmVeSWpSXmKPExsWy7bCmhS77U8UEgxv9vBYP5m1js9jbdoLd 4uXPq2wWh2+/Y7eY9uEns8Wn9ctYLV4e0rRY9SDconnxejaLOWcbmCx6+7eyWSy6sY3J4vKu OWwW3dd3sFksP/6PyeL2Fi6LpVtvMlp0Tl/DYrFo4W4WB2GPy1e8PS739TJ57Jx1l91jwqID jB77565h92g5uZ/F4+PTWywefVtWMXp83iTn0X6gmymAK6qB0SaxKDkjsyxVITUvOT8lMy/d Vik0xE3XQkkhI7+4xFYp2tDCSM/Q0lTPxFLPyDzWytDAwMhUSSEvMTfVVqlCF6pbSaEouQCo uiS1uKQoNTkVKFTkUFySmJ6qV5yYW1yal66XnJ+rpFCWmFMK1Kekb2eTkZqYklqkkPCEMWPx 7k72go3CFVum3WNtYHzA18XIySEhYCLRsnEiM4gtJLCDUeJKv0AXIwcHr4CgxN8dwiBhYQFv iV/dTUwQJUoS6y/OYoeI60nceriGEcRmE9CRmH7iPlhcRMBT4uvk1axdjFwczAINbBJtp5az QuzilZjR/pQFwpaW2L58K1gzp4CdxONHR6DiGhI/lvUyQ9iiEjdXv2WHsd8fm88IYYtItN47 C1UjKPHg526ouKTEsd0fmCDseomtd34xghwhIdDDKHF45y2oI/QlrnVsZIF40lfixMQokDCL gKrEwd3boWa6SLz7NgFsL7OAvMT2t3OYQcqZBTQl1u/SBzElBJQljtxigfmqYeNvdnQ2swCf RMfhv3DxHfOeQF2mJrHu53qmCYzKsxABPQvJrlkIuxYwMq9iFEstKM5NTy02KjBCjuZNjOB0 r+W2g3HK2w96hxiZOBgPMUpwMCuJ8AZ2yiUI8aYkVlalFuXHF5XmpBYfYqwC+nIis5Rocj4w 4+SVxBuaGRiZmRqbGBubmpiSLWxqZGZmYGlqYWpmZKEkzlts8CBeSCA9sSQ1OzW1ILUIZjkT B6dUA9Nm89+mkXfv8m0wtGR93rtjyo29V6cpSltIXnwl7fkjv+5a5fSYwh/GWedmSqjNZVPn yS465SOsnf+gUY2f4YinjV9KnLuvoE9d63Y1wdcnePsEjk65pOnmOi39p8V9ix8POxUy+V83 rZj5eg7fIrak219FnundcLtte7EnpnjCajcxZYu770/Mz11teyz62pfvS7WP3d5942ax5PTY pMTT/SI/d2Rwc6vYxm+c8NsgM+iy2O/eeIGIrRyKp798s5q42sJK9m3miqOHf8yM38PpXFzA dKJIsPqUeeNLuRNB/bmPu/jeakw60FWsz/Hpplblr/mmz5Zs/yogox4ebxNS4cQV+Vz53Z6q r937fyqxFGckGmoxFxUnAgDw+NemxQQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210129052848epcms2p6e5797efd94e6282b76ad9ae6c99e3ab5 References: <5b9f5edbe26930765ee4adaa786db7da@codeaurora.org> <88b608e2e133ba7ccd5bb452898848fd@codeaurora.org> <5bd43da52369a56f18867fa18efb3020@codeaurora.org> <20210129052848epcms2p6e5797efd94e6282b76ad9ae6c99e3ab5@epcms2p6> <20210129053005epcms2p323338fbb83459d2786fc0ef92701b147@epcms2p3> <20210208080333epcms2p59403f0acbc9730c9a605d265836a956d@epcms2p5> <20210208085346epcms2p1c11b70be9d258df66cb2ca4542835fac@epcms2p1> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>>> @@ -342,13 +1208,14 @@ void ufshpb_suspend(struct ufs_hba *hba) >>>>> > struct scsi_device *sdev; >>>>> > >>>>> > shost_for_each_device(sdev, hba->host) { >>>>> > - hpb = sdev->hostdata; >>>>> > + hpb = ufshpb_get_hpb_data(sdev); >>>>> > if (!hpb) >>>>> > continue; >>>>> > >>>>> > if (ufshpb_get_state(hpb) != HPB_PRESENT) >>>>> > continue; >>>>> > ufshpb_set_state(hpb, HPB_SUSPEND); >>>>> > + ufshpb_cancel_jobs(hpb); >>>>> >>>>> Here may have a dead lock problem - in the case of runtime suspend, >>>>> when ufshpb_suspend() is invoked, all of hba's children scsi devices >>>>> are in RPM_SUSPENDED state. When this line tries to cancel a running >>>>> map work, i.e. when ufshpb_get_map_req() calls below lines, it will >>>>> be stuck at blk_queue_enter(). >>>>> >>>>> req = blk_get_request(hpb->sdev_ufs_lu->request_queue, >>>>> REQ_OP_SCSI_IN, 0); >>>>> >>>>> Please check block layer power management, and see also commit >>>>> d55d15a33 >>>>> ("scsi: block: Do not accept any requests while suspended"). >>>> >>>> I am agree with your comment. >>>> How about add BLK_MQ_REQ_NOWAIT flag on blk_get_request() to avoid >>>> hang? >>>> >>> >>> That won't work - BLK_MQ_REQ_NOWAIT allows one to fast fail from >>> blk_mq_get_tag(), >>> but blk_queue_enter() comes before __blk_mq_alloc_request(); >>> >> In blk_queue_enter(), BLK_MQ_REQ_NOWAIT flag can make error than wait >> rpm >> resume. Please refer following code. > >Oops, sorry, my memory needs to be refreshed on that part. > >But will BLK_MQ_REQ_NOWAIT flag breaks your original purpose? When >runtime suspend is out of the picture, if traffic is heavy on the >request queue, map_work() will be stopped frequently once it is >not able to get a request from the queue - that shall pull down the >efficiency of one map_work(), that may hurt random performance... I think deadlock prevention is the most important. So I want to add BLK_MQ_REQ_NOWAIT flag. Starvation of map request can be distinguish by return value of blk_get_request(). -EWOULDBLOCK means there is no available tags for this request. -EBUSY means failed on blk_queue_enter(). To overcome starvation of map request, we can try N times in heavy traffic situation (maybe N=3?). Thanks, Daejun