Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3063426pxf; Sun, 14 Mar 2021 23:40:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjKPsv/nDXnyammUfkortq2KqOE8LZEojri/kVedaa7l7DBj1LuxfzroIqjn2I6wQPRwzd X-Received: by 2002:a05:6402:1517:: with SMTP id f23mr28831969edw.272.1615790401634; Sun, 14 Mar 2021 23:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615790401; cv=none; d=google.com; s=arc-20160816; b=T4wTlD7Oa4L3vpVA+XI7eiicIt39qIx08GbjuuNP/PK5R2OYx8Ym0mvO5twvqySebk Hpm/4FTkZ4Ur4H9y7gTRn3E17s3IfWnTOIGkg9cUHckXuAkxuZH9s5C6Y1bRFFaSb/qq dMk5KmPssLWZ3xAGFSQzRi/UyzHV0mhaJ746gQ9TmNiR82avq6R1CafEKbXG01P0WlpR jHS/1wmOuiWx/RiEifH4ymqTkmEaR2hEuReXtaNWUMCFRM+GMWuOA8RF4WMsXLxKJj3x 5w6KEdrCfBG9f7v3/42demLRkOB1/nIqIE9Lnr2eTL/UXkskQ+DvNdyTGXoPS7bxi41l xoKQ== 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=UnMKnQ0upwcZQULIAzy6S4QOxI40VwQxQnJKEVcsB7M=; b=nulnPOSrByW8kuZt9SpIPBKWvBTnmP5zSboEqLjyXc6AUJ92dz9LqxCLNz44C5lFWC S2dDHEjW0iTMzrkH+hwuNyuwfa3036tYAWA5dlsfVxOK/ZIh2W/GVlSnERfKwL/e/7h8 LnK0wRObRSsnvSZrMAx4rUWePHjhQL/zMOAFY7X1Ov1zpPXtIKOQbPjZnQ31jJeAt+ht XvZ2Rvn7mrE0ZVyuJqqzQMdyflgEfrMLnWs33YNsmUnu81F3/xKZ2mS90/R9FE0COCoh ohRAOr0GoSSwjXuylmb9LlvuYEoEpP+FCgB9vRPKFZGWnVspRj59rbRrdXwomiRkTb9T 6MWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=gjCKXj+5; 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 j19si9936181edp.531.2021.03.14.23.39.38; Sun, 14 Mar 2021 23:40:01 -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=gjCKXj+5; 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 S229924AbhCOGg7 (ORCPT + 99 others); Mon, 15 Mar 2021 02:36:59 -0400 Received: from m42-2.mailgun.net ([69.72.42.2]:62944 "EHLO m42-2.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbhCOGg7 (ORCPT ); Mon, 15 Mar 2021 02:36:59 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1615790219; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=UnMKnQ0upwcZQULIAzy6S4QOxI40VwQxQnJKEVcsB7M=; b=gjCKXj+5eK+ysyep/+B0yOB3Oj328trOtPxb3R+zwIi3BkSXq4FIVsSQq/knTyNQIvM8W4bV cGMdoKZ19F3KtGLFFVZv5hB5WZwo8AGDHZnn+bcFgx1NsKEYHppR2wzt6nHUPoSmmOuLZhiM sRcA/phwVmHiZd2MBqawqlDtVpY= X-Mailgun-Sending-Ip: 69.72.42.2 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-n03.prod.us-east-1.postgun.com with SMTP id 604f00884db3bb6801eee79f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 15 Mar 2021 06:36:56 GMT Sender: cang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 13E90C43464; Mon, 15 Mar 2021 06:36:56 +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 1A670C433CA; Mon, 15 Mar 2021 06:36:55 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 15 Mar 2021 14:36:55 +0800 From: Can Guo To: daejun7.park@samsung.com Cc: Greg KH , avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, asutoshd@codeaurora.org, stanley.chu@mediatek.com, bvanassche@acm.org, huobean@gmail.com, ALIM AKHTAR , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, JinHwan Park , Javier Gonzalez , SEUNGUK SHIN , Sung-Jun Park , Jinyoung CHOI , BoRam Shin Subject: Re: [PATCH v29 4/4] scsi: ufs: Add HPB 2.0 support In-Reply-To: <20210315013137epcms2p861f06e66be9faff32b6648401778434a@epcms2p8> References: <20210315012850epcms2p361447b689e925561c48aa9ca54434eb5@epcms2p3> <20210315013137epcms2p861f06e66be9faff32b6648401778434a@epcms2p8> Message-ID: <9eb5f8385f830bdec25828f17527c73f@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-15 09:31, Daejun Park wrote: > This patch supports the HPB 2.0. > > The HPB 2.0 supports read of varying sizes from 4KB to 512KB. > In the case of Read (<= 32KB) is supported as single HPB read. > In the case of Read (36KB ~ 512KB) is supported by as a combination of > write buffer command and HPB read command to deliver more PPN. > The write buffer commands may not be issued immediately due to busy > tags. > To use HPB read more aggressively, the driver can requeue the write > buffer > command. The requeue threshold is implemented as timeout and can be > modified with requeue_timeout_ms entry in sysfs. > > Signed-off-by: Daejun Park > --- > +static int ufshpb_issue_pre_req(struct ufshpb_lu *hpb, struct > scsi_cmnd *cmd, > + int *read_id) > +{ > + struct ufshpb_req *pre_req; > + struct request *req = NULL; > + struct bio *bio = NULL; > + unsigned long flags; > + int _read_id; > + int ret = 0; > + > + req = blk_get_request(cmd->device->request_queue, To keep symmetry with ufshpb_get_req(), can we use hpb->sdev_ufs_lu->request_queue? Thanks, Can Guo. > + REQ_OP_SCSI_OUT | REQ_SYNC, BLK_MQ_REQ_NOWAIT); > + if (IS_ERR(req)) > + return -EAGAIN; > + > + bio = bio_alloc(GFP_ATOMIC, 1); > + if (!bio) { > + blk_put_request(req); > + return -EAGAIN; > + } > + > + spin_lock_irqsave(&hpb->rgn_state_lock, flags); > + pre_req = ufshpb_get_pre_req(hpb); > + if (!pre_req) { > + ret = -EAGAIN; > + goto unlock_out; > + } > + _read_id = ufshpb_get_read_id(hpb); > + spin_unlock_irqrestore(&hpb->rgn_state_lock, flags); > + > + pre_req->req = req; > + pre_req->bio = bio; > + > + ret = ufshpb_execute_pre_req(hpb, cmd, pre_req, _read_id); > + if (ret) > + goto free_pre_req; > + > + *read_id = _read_id; > + > + return ret; > +free_pre_req: > + spin_lock_irqsave(&hpb->rgn_state_lock, flags); > + ufshpb_put_pre_req(hpb, pre_req); > +unlock_out: > + spin_unlock_irqrestore(&hpb->rgn_state_lock, flags); > + bio_put(bio); > + blk_put_request(req); > + return ret; > +} > +