Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp246901pxf; Wed, 24 Mar 2021 04:17:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxgqT5AQaEq1nkYYXWFBMpSud0xVMrjv9HT0vNIsYQwnNrcnMw8Ma8Ccg997R5/X6kncur X-Received: by 2002:a17:906:a2d3:: with SMTP id by19mr3049828ejb.98.1616584644055; Wed, 24 Mar 2021 04:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616584644; cv=none; d=google.com; s=arc-20160816; b=ElwX1TdcdsHWgq1gWObYjsuDX+sTYbWkYh0LW+I5Sx8RGMsOLzmgHu4AC+aZyJrzOJ efT32m4cLKSxguYwloSeGcgAuKKO4h/1sYZ5LkumCawl+J/VfGt7zPtL1Pqx2+9mmlFw 5JU8g0x2nfBIRbvRNAmI/MMG/vGE7VQIJYKvFbhbCbAV0o/HWLJiZHMvQnK/3bVAq23G lIlOR1s2TsxffC0KExcGGhTbkBVAv0MBDB70sa3s+yP0Qrdazx5u0GI2BfTQsT9tuy/A H89nwlameqvqQOVZVMbdGEkWgeMIdTp3RUjIo8OygeGMEgYyi8PgDNKV5GsmUHamuwDH Uu4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=G/7AKqbcGLiiUbHBI1tp1jgz9yJGJZEtHUsROzGoGjk=; b=bmVH75SVpET98IStAJ3Q1D2/23ajV/p19EL+Ys4gMGdatAH5LOMH0XjjrUOd+o5tot BtunVG/GlSZeAfjI4b92fey+OFN6QNmKmekaFV2I/HBROTKw0A4ine8ZDK1T5xhzHGGa JdPSrdle+7mC5nbhcGGso72VQ64fshdCdvnKLwPmL4X4zaAgL6KmDy01JUgPhfNn+jr0 +WYk5lKoCLap9j5PZa0zL8P6GVxDNQAeXlwViprQ7gi585CLm/cSYZLh1FHSAlGak0Es P7ORMTLxOrI1kxcaDTKj7KCSqIHIW2A5kTyQnm3x1iiOsvt9A84h5C7Wz+W5EMigxHy8 Q3rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="ge9G/btL"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f18si1520021eja.587.2021.03.24.04.17.00; Wed, 24 Mar 2021 04:17:24 -0700 (PDT) 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=@mg.codeaurora.org header.s=smtp header.b="ge9G/btL"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232405AbhCXJiZ (ORCPT + 99 others); Wed, 24 Mar 2021 05:38:25 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:18839 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbhCXJiA (ORCPT ); Wed, 24 Mar 2021 05:38:00 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1616578680; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=G/7AKqbcGLiiUbHBI1tp1jgz9yJGJZEtHUsROzGoGjk=; b=ge9G/btLHv5PAz1Mepnlu+0SV/uFWGMvXN9hBD9obSyTDXrAV0xceEInJ8zRUZqqquFHZkAd 13HXBvXALshasUNWKU7nSwRp24FVVtFrhRqUaa3zEb60amlpQNZq9n/lih1r/sbGmgCpswGF mWFgwM4G9DpDk7DYrraLVv+PhQo= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-west-2.postgun.com with SMTP id 605b0870e2200c0a0d3d955f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 24 Mar 2021 09:37:52 GMT Sender: cang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0E802C43464; Wed, 24 Mar 2021 09:37:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5B94BC433CA; Wed, 24 Mar 2021 09:37:50 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 24 Mar 2021 17:37:50 +0800 From: Can Guo To: Bean Huo Cc: Avri Altman , daejun7.park@samsung.com, Greg KH , jejb@linux.ibm.com, martin.petersen@oracle.com, asutoshd@codeaurora.org, stanley.chu@mediatek.com, bvanassche@acm.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, ALIM AKHTAR , JinHwan Park , Javier Gonzalez , Sung-Jun Park , Jinyoung CHOI , Dukhyun Kwon , Keoseong Park , Jaemyung Lee , Jieon Seol Subject: Re: [PATCH v31 2/4] scsi: ufs: L2P map management for HPB read In-Reply-To: <7bfcc7d6cedd1d674172722f8cc074dac9c2a640.camel@gmail.com> References: <1df7bb51dc481c3141cdcf85105d3a5b@codeaurora.org> <20210322065127epcms2p5021a61416a6b427c62fcaf5d8b660860@epcms2p5> <20210322065410epcms2p431f73262f508e9e3e16bd4995db56a4b@epcms2p4> <75df140d2167eadf1089d014f571d711a9aeb6a5.camel@gmail.com> <20210323053731epcms2p70788f357b546e9ca21248175a8884554@epcms2p7> <20210323061922epcms2p739666492ebb458d70deab026d074caf4@epcms2p7> <20210323063726epcms2p28aadb16bb96943ade1d2b288bb634811@epcms2p2> <020853d32271f0a16b26a343a72fd930e9505ffe.camel@gmail.com> <5f68a41406b157f4ed4b3765e1d8e032@codeaurora.org> <7bfcc7d6cedd1d674172722f8cc074dac9c2a640.camel@gmail.com> Message-ID: <74b808bd7fe9e45173e2a63f7ca3e009@codeaurora.org> X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-03-24 17:33, Bean Huo wrote: > On Wed, 2021-03-24 at 17:24 +0800, Can Guo wrote: >> On 2021-03-24 16:37, Bean Huo wrote: >> > On Wed, 2021-03-24 at 09:45 +0800, Can Guo wrote: >> > > On 2021-03-23 20:48, Avri Altman wrote: >> > > >> > > > > On 2021-03-23 14:37, Daejun Park wrote: >> > > > > > > On 2021-03-23 14:19, Daejun Park wrote: >> > > > > > > > > On 2021-03-23 13:37, Daejun Park wrote: >> > > > > > > > > > > On 2021-03-23 12:22, Can Guo wrote: >> > > > > > > > > > > > On 2021-03-22 17:11, Bean Huo wrote: >> > > > > > > > > > > > > On Mon, 2021-03-22 at 15:54 +0900, Daejun >> > > > > > > > > > > > > Park >> > > > > > > > > > > > > wrote: >> > > > > > > > > > > > > > + switch (rsp_field->hpb_op) { >> > > > > > > > > > > > > > + case HPB_RSP_REQ_REGION_UPDATE: >> > > > > > > > > > > > > > + if (data_seg_len != >> > > > > > > > > > > > > > DEV_DATA_SEG_LEN) >> > > > > > > > > > > > > > + dev_warn(&hpb- >> > > > > > > > > > > > > > > sdev_ufs_lu->sdev_dev, >> > > > > > > > > > > > > > + "%s: data >> > > > > > > > > > > > > > seg >> > > > > > > > > > > > > > length is not >> > > > > > > > > > > > > > same.\n", >> > > > > > > > > > > > > > + __func__); >> > > > > > > > > > > > > > + >> > > > > > > > > > > > > > ufshpb_rsp_req_region_update(hpb, >> > > > > > > > > > > > > > rsp_field); >> > > > > > > > > > > > > > + break; >> > > > > > > > > > > > > > + case HPB_RSP_DEV_RESET: >> > > > > > > > > > > > > > + dev_warn(&hpb->sdev_ufs_lu- >> > > > > > > > > > > > > > > sdev_dev, >> > > > > > > > > > > > > > + "UFS device lost >> > > > > > > > > > > > > > HPB >> > > > > > > > > > > > > > information >> > > > > > > > > > > > > > during >> > > > > > > > > > > > > > PM.\n"); >> > > > > > > > > > > > > > + break; >> > > > > > > > > > > > > Hi Deajun, >> > > > > > > > > > > > > This series looks good to me. Just here I >> > > > > > > > > > > > > have >> > > > > > > > > > > > > one question. You >> > > > > > > > > > > > > didn't >> > > > > > > > > > > > > handle HPB_RSP_DEV_RESET, just a >> > > > > > > > > > > > > warning. Based >> > > > > > > > > > > > > on your SS UFS, >> > > > > > > > > > > > > how >> > > > > > > > > > > > > to >> > > > > > > > > > > > > handle HPB_RSP_DEV_RESET from the host side? >> > > > > > > > > > > > > Do >> > > > > > > > > > > > > you think we >> > > > > > > > > > > > > shoud >> > > > > > > > > > > > > reset host side HPB entry as well or what >> > > > > > > > > > > > > else? >> > > > > > > > > > > > > Bean >> > > > > > > > > > > > Same question here - I am still collecting >> > > > > > > > > > > > feedbacks from flash >> > > > > > > > > > > > vendors >> > > > > > > > > > > > about >> > > > > > > > > > > > what is recommanded host behavior on reception >> > > > > > > > > > > > of >> > > > > > > > > > > > HPB Op code >> > > > > > > > > > > > 0x2, >> > > > > > > > > > > > since it >> > > > > > > > > > > > is not cleared defined in HPB2.0 specs. >> > > > > > > > > > > > Can Guo. >> > > > > > > > > > > I think the question should be asked in the >> > > > > > > > > > > HPB2.0 >> > > > > > > > > > > patch, since in >> > > > > > > > > > > HPB1.0 device >> > > > > > > > > > > control mode, a HPB reset in device side does not >> > > > > > > > > > > impact anything >> > > > > > > > > > > in >> > > > > > > > > > > host side - >> > > > > > > > > > > host is not writing back any HPB entries to >> > > > > > > > > > > device >> > > > > > > > > > > anyways and HPB >> > > > > > > > > > > Read >> > > > > > > > > > > cmd with >> > > > > > > > > > > invalid HPB entries shall be treated as normal >> > > > > > > > > > > Read(10) cmd >> > > > > > > > > > > without >> > > > > > > > > > > any >> > > > > > > > > > > problems. >> > > > > > > > > > Yes, UFS device will process read command even the >> > > > > > > > > > HPB >> > > > > > > > > > entries are >> > > > > > > > > > valid or >> > > > > > > > > > not. So it is warning about read performance drop >> > > > > > > > > > by >> > > > > > > > > > dev reset. >> > > > > > > > > Yeah, but still I am 100% sure about what should host >> > > > > > > > > do >> > > > > > > > > in case of >> > > > > > > > > HPB2.0 >> > > > > > > > > when it receives HPB Op code 0x2, I am waiting for >> > > > > > > > > feedbacks. >> > > > > > > > I think the host has two choices when it receives 0x2. >> > > > > > > > One is nothing on host. >> > > > > > > > The other is discarding all HPB entries in the host. >> > > > > > > > In the JEDEC HPB spec, it as follows: >> > > > > > > > When the device is powered off by the host, the device >> > > > > > > > may >> > > > > > > > restore >> > > > > > > > L2P >> > > > > > > > map >> > > > > > > > data upon power up or build from the host’s HPB READ >> > > > > > > > command. >> > > > > > > > If some UFS builds L2P map data from the host's HPB >> > > > > > > > READ >> > > > > > > > commands, we >> > > > > > > > don't >> > > > > > > > have to discard HPB entries in the host. >> > > > > > > > So I thinks there is nothing to do when it receives >> > > > > > > > 0x2. >> > > > > > > But in HPB2.0, if we do nothing to active regions in host >> > > > > > > side, host >> > > > > > > can >> > > > > > > write >> > > > > > > HPB entries (which host thinks valid, but actually >> > > > > > > invalid in >> > > > > > > device >> > > > > > > side since >> > > > > > > reset happened) back to device through HPB Write Buffer >> > > > > > > cmds >> > > > > > > (BUFFER >> > > > > > > ID >> > > > > > > = 0x2). >> > > > > > > My question is that are all UFSs OK with this? >> > > > > > Yes, it must be OK. >> > > > > > Please refer the following the HPB 2.0 spec: >> > > > > > If the HPB Entries sent by HPB WRITE BUFFER are removed by >> > > > > > the >> > > > > > device, >> > > > > > for example, because they are not consumed for a long >> > > > > > enough >> > > > > > period of >> > > > > > time, >> > > > > > then the HPB READ command for the removed HPB entries shall >> > > > > > be >> > > > > > handled >> > > > > > as a >> > > > > > normal READ command. >> > > > > No, it is talking about the subsequent HPB READ cmd sent >> > > > > after a >> > > > > HPB >> > > > > WRITE BUFFER cmd, >> > > > > but not the HPB WRITE BUFFER cmd itself... >> > > > Looks like this discussion is going the same way as we had in >> > > > host >> > > > mode. >> > > > HPB-WRITE-BUFFER 0x2, if exist, is always a companion to HPB- >> > > > READ. >> > > > You shouldn't consider them separately. >> > > > The device is expected to handle invalid ppn by itself, and >> > > > specifically for this case, >> > > > As Daejun explained, Handle each HPB-READ (and its companion >> > > > HPB-WRITE-BUFFER) like READ10. >> > > > For device mode, doing nothing in case of dev reset, seems to >> > > > me >> > > > like >> > > > the right thing to do. >> > > >> > > I just got some feedbacks from other flash vendors, they all >> > > commit >> > > that >> > > >> > > their devices can work well in this scenario [1]. Some of them >> > > proposed >> > > >> > > even complicated (maybe better) principles of handling the "HPB >> > > reset", >> > > >> > > but since the device works well in [1], I am OK with current >> > > (simpler) >> > > >> > > handling of "HPB reset" - in device mode doing nothing, in host >> > > mode >> > > >> > > re-activate regions that host is trying to do a read to. >> > > >> > > >> > > >> > >> > Our suggestion on this indication 0x2: >> > >> > 1. If current mode is device control mode, we suggest host just >> > deactivate all active regions and don't send HPB READ BUFFER >> > command to >> > device unless device indicate host to activate certain region in >> > later >> > response. In another way, it is a signal telling host to reset host >> > side L2P entry and to rebuild the L2P mapping entry in host memroy. >> > >> > 2. If current mode is host control mode, we suggest host send HPB >> > READ >> > BUFFER command before it wants to send read command on this region, >> > rather than sending HPB READ BUFFER commands on all regions at the >> > same >> > time. >> > >> > >> > Bean >> >> Hi Bean, >> >> I got this proposal from your side too, after that I've checked with >> Leon Ge from your side and he confirmed that it is fine that host >> just >> ignores the "HPB reset" indication. We can leave it as it is as of >> now >> and revisit it if any UFS needs extra care. What do you say? >> >> Thanks, >> Can Guo. > > Hi Can, > > Agree. Current handling is ok to us, but if we want to change it, we > hope it is the same with the above suggestion. We can keep current > implementation, seeing if need changes in the near future based on the > feedback or new updates in the Spec. > Sure. BTW, do you have plans to make the proposal into JEDEC specs? Thanks, Can Guo. > Thanks, > Bean > > > >> >> > > Thanks, >> > > >> > > Can Guo.