Re: [PATCH v7 06/11] scsi: ufshpb: Region inactivation in host mode

2021-04-05 Thread Can Guo
ill you fix it in next version? warning: variable 'flags' is uninitialized when used here [-Wuninitialized] Yeah - I will pass it to __ufshpb_evict_region and drop the lockdep_assert call. Please paste the sample code/change here so that I can move forward quickly. I don't w

Re: [PATCH 1/2] scsi: ufs: Introduce hba performance monitor sysfs nodes

2021-04-05 Thread Can Guo
On 2021-04-06 13:58, Daejun Park wrote: Hi Can Guo, Hi Daejun, On 2021-04-06 12:11, Daejun Park wrote: Hi Can Guo, +static ssize_t monitor_enable_store(struct device *dev, +struct device_attribute *attr, +const char

Re: [PATCH v7 06/11] scsi: ufshpb: Region inactivation in host mode

2021-04-05 Thread Can Guo
Checked on my setup, this lead to compilation error. Will you fix it in next version? warning: variable 'flags' is uninitialized when used here [-Wuninitialized] Thanks, Can Guo. Thanks, Avri Thanks, Can Guo. > + ret = ufshpb_issue_umap_single_req(hpb, rgn); &

Re: [PATCH 1/2] scsi: ufs: Introduce hba performance monitor sysfs nodes

2021-04-05 Thread Can Guo
On 2021-04-06 13:37, Can Guo wrote: Hi Daejun, On 2021-04-06 12:11, Daejun Park wrote: Hi Can Guo, +static ssize_t monitor_enable_store(struct device *dev, +struct device_attribute *attr, +const char *buf, size_t count

Re: [PATCH 1/2] scsi: ufs: Introduce hba performance monitor sysfs nodes

2021-04-05 Thread Can Guo
Hi Daejun, On 2021-04-06 12:11, Daejun Park wrote: Hi Can Guo, +static ssize_t monitor_enable_store(struct device *dev, +struct device_attribute *attr, +const char *buf, size_t count) +{ +struct ufs_hba *hba

Re: [PATCH v7 06/11] scsi: ufshpb: Region inactivation in host mode

2021-04-05 Thread Can Guo
gn_state_lock, flags); Never seen a usage like this... Here flags is used without being intialized. The flag is needed when spin_unlock_irqrestore -> local_irq_restore(flags) to restore the DAIF register (in terms of ARM). Thanks, Can Guo. + ret = ufshpb_issue_u

[PATCH v5 2/2] scsi: ufs: Fix wrong Task Tag used in task management request UPIUs

2021-04-01 Thread Can Guo
In __ufshcd_issue_tm_cmd(), it is not right to use hba->nutrs + req->tag as the Task Tag in one TMR UPIU. Directly use req->tag as the Task Tag. Fixes: e293313262d3 ("scsi: ufs: Fix broken task management command implementation") Reviewed-by: Bart Van Assche Sig

[PATCH v5 1/2] scsi: ufs: Fix task management request completion timeout

2021-04-01 Thread Can Guo
calling blk_mq_start_request() in __ufshcd_issue_tm_cmd(). Fixes: 69a6c269c097 ("scsi: ufs: Use blk_{get,put}_request() to allocate and free TMFs") Signed-off-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/dr

Re: [PATCH v4 2/2] scsi: ufs: Fix wrong Task Tag used in task management request UPIUs

2021-04-01 Thread Can Guo
On 2021-04-01 14:44, Daejun Park wrote: Hi, Can Guo diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c ... req->end_io_data = &wait; - free_slot = req->tag; WARN_ON_ONCE(free_slot < 0 || free_slot >= hba->nutmrs); I think this lin

[PATCH 2/2] scsi: ufs: Add support for hba performance monitor

2021-03-31 Thread Can Guo
Add a new sysfs group which has nodes to monitor data/request transfer performance. This sysfs group has nodes showing total sectors/requests transferred, total busy time spent and max/min/avg/sum latencies. Signed-off-by: Can Guo diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b

[PATCH 1/2] scsi: ufs: Introduce hba performance monitor sysfs nodes

2021-03-31 Thread Can Guo
during runtime. Signed-off-by: Can Guo diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index acc54f5..348df0e 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -278,6 +278,242 @@ static const struct attribute_group ufs_sysfs_default_group

[PATCH 2/2] scsi: ufs: Add support for hba performance monitor

2021-03-31 Thread Can Guo
Add a new sysfs group which has nodes to monitor data/request transfer performance. This sysfs group has nodes showing total sectors/requests transferred, total busy time spent and max/min/avg/sum latencies. Signed-off-by: Can Guo diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b

[PATCH 1/2] scsi: ufs: Introduce hba performance monitor sysfs nodes

2021-03-31 Thread Can Guo
during runtime. Signed-off-by: Can Guo diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index acc54f5..1f93f3e 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -278,6 +278,242 @@ static const struct attribute_group ufs_sysfs_default_group

Re: [PATCH v4 1/2] scsi: ufs: Fix task management request completion timeout

2021-03-31 Thread Can Guo
ends up with completion timeout. Fix it by calling blk_mq_start_request() in __ufshcd_issue_tm_cmd(). Fixes: 69a6c269c097 ("scsi: ufs: Use blk_{get,put}_request() to allocate and free TMFs") Signed-off-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 1 + 1 file changed, 1 insertio

[PATCH v4 2/2] scsi: ufs: Fix wrong Task Tag used in task management request UPIUs

2021-03-30 Thread Can Guo
In __ufshcd_issue_tm_cmd(), it is not right to use hba->nutrs + req->tag as the Task Tag in one TMR UPIU. Directly use req->tag as the Task Tag. Fixes: e293313262d3 ("scsi: ufs: Fix broken task management command implementation") Reviewed-by: Bart Van Assche Sig

[PATCH v4 1/2] scsi: ufs: Fix task management request completion timeout

2021-03-30 Thread Can Guo
calling blk_mq_start_request() in __ufshcd_issue_tm_cmd(). Fixes: 69a6c269c097 ("scsi: ufs: Use blk_{get,put}_request() to allocate and free TMFs") Signed-off-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/dr

Re: [PATCH v32 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-30 Thread Can Guo
in sysfs. Reviewed-by: Can Guo Reviewed-by: Bean Huo Signed-off-by: Daejun Park --- Please allow me a few more days in April to have this whole series tested one more time. Thanks, Can Guo.

[PATCH v2 1/2] scsi: ufs: Introduce hba performance monitor sysfs nodes

2021-03-30 Thread Can Guo
during runtime. Signed-off-by: Can Guo --- drivers/scsi/ufs/ufs-sysfs.c | 237 +++ drivers/scsi/ufs/ufshcd.c| 62 +++ drivers/scsi/ufs/ufshcd.h| 21 3 files changed, 320 insertions(+) diff --git a/drivers/scsi/ufs/ufs-sysfs.c b

[PATCH v2 2/2] scsi: ufs: Add support for hba performance monitor

2021-03-30 Thread Can Guo
Add a new sysfs group which has nodes to monitor data/request transfer performance. This sysfs group has nodes showing total sectors/requests transferred, total busy time spent and max/min/avg/sum latencies. Signed-off-by: Can Guo --- Documentation/ABI/testing/sysfs-driver-ufs | 126

Re: [PATCH v31 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-25 Thread Can Guo
dx, srgn_idx, srgn_offset, > transfer_len); > spin_unlock_irqrestore(&hpb->rgn_state_lock, flags); > -return; > +return 0; > } > > -if (!ufshpb_is_support_chunk(transfe

Re: [PATCH v6 04/10] scsi: ufshpb: Make eviction depends on region's reads

2021-03-24 Thread Can Guo
A rgn which host chooses to activate, is in INACTIVE state now, if its rgn->reads < 256, then don't activate it. Could you please elaborate? Thanks, Can Guo. victim_rgn = ufshpb_victim_lru_info(hpb); if (!victim_rgn) { dev_warn(&hpb->sdev_ufs_lu->sdev_dev,

Re: [PATCH v31 2/4] scsi: ufs: L2P map management for HPB read

2021-03-24 Thread Can Guo
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 wr

Re: [PATCH v6 03/10] scsi: ufshpb: Add region's reads counter

2021-03-24 Thread Can Guo
n->rgn_lock); + if (activate) { + spin_lock_irqsave(&hpb->rsp_list_lock, flags); + ufshpb_update_active_info(hpb, rgn_idx, srgn_idx); If a transfer_len (possible with HPB2.0) sits accross two regions/sub-regions, here it only

Re: [PATCH v31 2/4] scsi: ufs: L2P map management for HPB read

2021-03-24 Thread Can Guo
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

Re: [PATCH v31 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-23 Thread Can Guo
nsfer_len); + ufshpb_set_hpb_read_to_upiu(hpb, lrbp, lpn, ppn, transfer_len, read_id); hpb->stats.hit_cnt++; + return 0; } -static struct ufshpb_req *ufshpb_get_map_req(struct ufshpb_lu *hpb, -struct ufshpb_subregion *srgn

Re: [PATCH v6 02/10] scsi: ufshpb: Add host control mode support to rsp_upiu

2021-03-23 Thread Can Guo
tions from device, because the bkops would make the ppn invalid, is that right? Right, but ONLY recommandations to ACTIVE regions are of host's interest in host control mode. For those inactive regions, host makes its own decisions. Can Guo. dev_dbg(&hpb-&

Re: [PATCH v31 2/4] scsi: ufs: L2P map management for HPB read

2021-03-23 Thread Can Guo
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

Re: [PATCH v31 2/4] scsi: ufs: L2P map management for HPB read

2021-03-22 Thread Can Guo
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

Re: [PATCH v31 2/4] scsi: ufs: L2P map management for HPB read

2021-03-22 Thread Can Guo
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_UPD

Re: [PATCH v31 2/4] scsi: ufs: L2P map management for HPB read

2021-03-22 Thread Can Guo
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_

Re: [PATCH v31 2/4] scsi: ufs: L2P map management for HPB read

2021-03-22 Thread Can Guo
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_w

Re: [PATCH] drivers: scsi: Remove duplicate include of blkdev.h

2021-03-22 Thread Can Guo
e you - check https://git.kernel.org/mkp/scsi/c/b4388e3db56a Can Guo.

Re: [PATCH v31 2/4] scsi: ufs: L2P map management for HPB read

2021-03-22 Thread Can Guo
SP_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.

Re: [PATCH] scsi: ufs: Add selector to ufshcd_query_flag* APIs

2021-03-17 Thread Can Guo
On 2021-03-17 11:31, Daejun Park wrote: Unlike other query APIs in UFS, ufshcd_query_flag has a fixed selector as 0. This patch allows ufshcd_query_flag API to choose selector value by parameter. Signed-off-by: Daejun Park Reviewed-by: Can Guo --- drivers/scsi/ufs/ufs-sysfs.c | 2

Re: [PATCH v29 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-17 Thread Can Guo
On 2021-03-18 10:02, Daejun Park wrote: On 2021-03-17 09:42, Daejun Park wrote: On 2021-03-15 15:23, Can Guo wrote: On 2021-03-15 15:07, 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)

Re: [PATCH v29 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-17 Thread Can Guo
On 2021-03-18 10:02, Daejun Park wrote: On 2021-03-17 09:42, Daejun Park wrote: On 2021-03-15 15:23, Can Guo wrote: On 2021-03-15 15:07, 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)

Re: [PATCH v5 06/10] scsi: ufshpb: Add hpb dev reset response

2021-03-17 Thread Can Guo
> The device send device reset so it is aware that all the L2P cache is > invalid. > Any HPB_READ is treated like normal READ10. > > Only once HPB-READ-BUFFER is completed, > the device will relate back to the physical address. What about HPB-WRITE-BUFFER (buffer id = 0x2) cmds?

Re: [PATCH v5 06/10] scsi: ufshpb: Add hpb dev reset response

2021-03-17 Thread Can Guo
o do in that case. Then it means that all the clean (without DIRTY flag set) HPB entries (ppns) in active rgns in host memory side may not be valid to the device anymore. Please correct me if I am wrong. > We thought that in host mode, it make sense to update all the active > regions. But

Re: [PATCH v5 06/10] scsi: ufshpb: Add hpb dev reset response

2021-03-17 Thread Can Guo
ve regions as UPDATE. Although one of subsequent read cmds shall put the sub-region back to activate_list, ufshpb_test_ppn_dirty() can still return false, thus these read cmds still think the ppns are valid and they shall move forward to send HPB Write Buffer (buffer id = 0x2, in case of HP

Re: [PATCH v5 06/10] scsi: ufshpb: Add hpb dev reset response

2021-03-17 Thread Can Guo
work? I don't know, I never even consider of doing this. The active region list may contain up to few thousands of regions - It is not rare to see configurations that covers the entire device. Yes, true, it can be a huge list. But what does the ops "HPB_RSP_DEV_RESET" really mean? The specs

Re: [PATCH v5 06/10] scsi: ufshpb: Add hpb dev reset response

2021-03-17 Thread Can Guo
run_inactive_region_list(struct ufshpb_lu *hpb) spin_unlock_irqrestore(&hpb->rsp_list_lock, flags); } +static void ufshpb_reset_work_handler(struct work_struct *work) Just curious, directly doing below things inside ufshpb_rsp_upiu() does not seem a problem to me, does this

Re: [PATCH v5 05/10] scsi: ufshpb: Region inactivation in host mode

2021-03-16 Thread Can Guo
eq_cache, GFP_KERNEL) has the GFP_KERNEL flag, scheduling while atomic??? I think your comment applies to ufshpb_issue_umap_all_req as well, Which is called from slave_configure/scsi_add_lun. Since the host-mode series is utilizing the framework laid by the device-mode, Maybe you can add this com

Re: [PATCH v5 05/10] scsi: ufshpb: Region inactivation in host mode

2021-03-16 Thread Can Guo
p_req_cache, GFP_KERNEL) has the GFP_KERNEL flag, scheduling while atomic??? I think your comment applies to ufshpb_issue_umap_all_req as well, Which is called from slave_configure/scsi_add_lun. Since the host-mode series is utilizing the framework laid by the device-mode, Maybe you can add

Re: [PATCH v29 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-16 Thread Can Guo
On 2021-03-17 09:42, Daejun Park wrote: On 2021-03-15 15:23, Can Guo wrote: On 2021-03-15 15:07, 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 R

Re: [PATCH v5 07/10] scsi: ufshpb: Add "Cold" regions timer

2021-03-16 Thread Can Guo
leting it. The timeout handler, being a delayed work, is meant to run every polling period. Originally, I had it protected from 2 handlers running concurrently, But I removed it following Daejun's comment, which I accepted, Since it is always scheduled using the sa

Re: [PATCH v5 05/10] scsi: ufshpb: Region inactivation in host mode

2021-03-16 Thread Can Guo
p_req_cache, GFP_KERNEL) has the GFP_KERNEL flag, scheduling while atomic??? I think your comment applies to ufshpb_issue_umap_all_req as well, Which is called from slave_configure/scsi_add_lun. ufshpb_issue_umap_all_req() is not called from atomic contexts, so ufshpb_issue_umap_all_req() is fi

Re: [PATCH v5 07/10] scsi: ufshpb: Add "Cold" regions timer

2021-03-15 Thread Can Guo
list, it shall become a dead loop here. And, which lock is protecting rgn->list_expired_rgn? If two read_to_handler works are running in parallel, one can be inserting it to its expired_list while another can be deleting it. Can Guo. + list_del_init(&r

Re: [PATCH v5 03/10] scsi: ufshpb: Add region's reads counter

2021-03-15 Thread Can Guo
ll definitely cause you error... Can Guo. Thanks, Avri Thanks, Can Guo. > + rgn->reads = 0; > + spin_unlock_irqrestore(&rgn->rgn_lock, flags); > + } > + > return 0; > } > > if (!ufshp

Re: [PATCH v5 03/10] scsi: ufshpb: Add region's reads counter

2021-03-15 Thread Can Guo
rgn->reads) + continue; + + /* if region is active but has no reads - inactivate it */ + spin_lock(&hpb->rsp_list_lock); + ufshpb_update_inactive_info(hpb, rgn->rgn_idx); Miss a hpb->stats.rb_inactive_cnt++ here? Tha

Re: [PATCH v5 08/10] scsi: ufshpb: Limit the number of inflight map requests

2021-03-15 Thread Can Guo
On 2021-03-02 21:25, Avri Altman wrote: in host control mode the host is the originator of map requests. To not in -> In Thanks, Can Guo. flood the device with map requests, use a simple throttling mechanism that limits the number of inflight map requests. Signed-off-by: Avri Alt

Re: [PATCH v5 04/10] scsi: ufshpb: Make eviction depends on region's reads

2021-03-15 Thread Can Guo
Maybe merge the new comments with the original comments above? Thanks, Can Guo. + if (hpb->is_hcm && rgn->reads < EVICTION_THRESHOLD) { + ret = -EACCES; + goto out; + } +

Re: [PATCH v29 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-15 Thread Can Guo
On 2021-03-15 15:23, Can Guo wrote: On 2021-03-15 15:07, 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 a

Re: [PATCH v5 05/10] scsi: ufshpb: Region inactivation in host mode

2021-03-15 Thread Can Guo
On 2021-03-15 12:02, Can Guo wrote: On 2021-03-02 21:24, Avri Altman wrote: I host mode, the host is expected to send HPB-WRITE-BUFFER with buffer-id = 0x1 when it inactivates a region. Use the map-requests pool as there is no point in assigning a designated cache for umap-requests. Signed

Re: [PATCH v29 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-15 Thread Can Guo
, it just only for first pre_req. I meant removing the bio_alloc() in ufshpb_issue_pre_req() and bio_put() in ufshpb_pre_req_compl_fn(). bios, in pre_req's case, just hold a page. So, prepare 16 (if queue depth is 32) bios here, just use them along with wb.m_page and call bio_reset() in ufshpb_pre_req

Re: [PATCH v5 06/10] scsi: ufshpb: Add hpb dev reset response

2021-03-14 Thread Can Guo
On 2021-03-15 09:34, Can Guo wrote: On 2021-03-02 21:24, Avri Altman wrote: The spec does not define what is the host's recommended response when the device send hpb dev reset response (oper 0x2). We will update all active hpb regions: mark them and do that on the next read. Signed-o

Re: [PATCH v29 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-14 Thread Can Guo
ags; + 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, BL

Re: [PATCH v29 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-14 Thread Can Guo
_req->list_req); + pre_req->req = NULL; + pre_req->bio = NULL; Why don't prepare bio as same as wb.m_page? Won't that save more time for ufshpb_issue_pre_req()? Thanks, Can Guo. + + pre_req->wb.m_page = al

Re: [PATCH v5 05/10] scsi: ufshpb: Region inactivation in host mode

2021-03-14 Thread Can Guo
nd_io_fn *done) { WARN_ON(irqs_disabled()); ... Thanks. Can Guo. + return; + lru_info = &hpb->lru_info; dev_dbg(&hpb->sdev_ufs_lu->sdev_dev, "evict region %d\n", rgn->rgn_idx); @@ -1855,6 +1866,7 @@ ufshpb_sysfs_attr_show_func(rb_noti_cnt)

Re: [PATCH v5 03/10] scsi: ufshpb: Add region's reads counter

2021-03-14 Thread Can Guo
so no need of irqsave and irqrestore everywhere, which can impact performance. Please correct me if I am wrong. Meanwhile, have you ever initialized the rgn_lock before use it??? Thanks, Can Guo. + rgn->reads = 0; + spin_unlock_irqrestore(&a

Re: [PATCH v26 2/4] scsi: ufs: L2P map management for HPB read

2021-03-14 Thread Can Guo
- regions to be inactivated, and > hpb->lh_act_srgn - subregions to be activated > Those lists are maintained on IO completion. > > Reviewed-by: Bart Van Assche > Reviewed-by: Can Guo > Acked-by: Avri Altman > Tested-by: Bean H

Re: [PATCH v5 07/10] scsi: ufshpb: Add "Cold" regions timer

2021-03-14 Thread Can Guo
ead_to_work.work); usually we use this to get data of a delayed work. + struct victim_select_info *lru_info; struct victim_select_info *lru_info = &hpb->lru_info; This can save some lines. Thanks, Can Guo. + struct ufshpb_region *rgn; + unsigned long flags; +

Re: [PATCH v5 06/10] scsi: ufshpb: Add hpb dev reset response

2021-03-14 Thread Can Guo
; + struct victim_select_info *lru_info; struct victim_select_info *lru_info = &hpb->lru_info; This can save some lines. Thanks, Can Guo. + struct ufshpb_region *rgn; + unsigned long flags; + + spin_lock_irqsave(&hpb->rgn_state_lock, flag

Re: [PATCH v26 2/4] scsi: ufs: L2P map management for HPB read

2021-03-11 Thread Can Guo
- regions to be inactivated, and > hpb->lh_act_srgn - subregions to be activated > Those lists are maintained on IO completion. > > Reviewed-by: Bart Van Assche > Reviewed-by: Can Guo > Acked-by: Avri Altman > Tested-by: Bean H

Re: [PATCH v11 2/2] ufs: sysfs: Resume the proper scsi device

2021-03-11 Thread Can Guo
On 2021-03-12 06:19, Asutosh Das wrote: Resumes the actual scsi device the unit descriptor of which is being accessed instead of the hba alone. Signed-off-by: Asutosh Das You lost my reviewed-by: reviewed-by: Can Guo --- drivers/scsi/ufs/ufs-sysfs.c | 30

Re: [PATCH v26 3/4] scsi: ufs: Prepare HPB read for cached sub-region

2021-03-11 Thread Can Guo
SCSI command. In the HPB version 1.0, the maximum read I/O size that can be converted to HPB read is 4KB. The dirty map of the active sub-region prevents an incorrect HPB read that has stale physical page number which is updated by previous write I/O. Reviewed-by: Can Guo Reviewed-by: Bart Van

Re: [PATCH v26 2/4] scsi: ufs: L2P map management for HPB read

2021-03-11 Thread Can Guo
The map_work manages active/inactive by 2 "to-do" lists. Each hpb lun maintains 2 "to-do" lists: hpb->lh_inact_rgn - regions to be inactivated, and hpb->lh_act_srgn - subregions to be activated Those lists are maintained on IO completion. Reviewed-by: Bart Van Assche R

Re: [PATCH v26 2/4] scsi: ufs: L2P map management for HPB read

2021-03-11 Thread Can Guo
The map_work manages active/inactive by 2 "to-do" lists. Each hpb lun maintains 2 "to-do" lists: hpb->lh_inact_rgn - regions to be inactivated, and hpb->lh_act_srgn - subregions to be activated Those lists are maintained on IO completion. Reviewed-by: Bart Van Assche R

Re: [PATCH v5 05/10] scsi: ufshpb: Region inactivation in host mode

2021-03-11 Thread Can Guo
urn ufshpb_issue_umap_req(hpb, NULL); @@ -1115,6 +1122,10 @@ static void __ufshpb_evict_region(struct ufshpb_lu *hpb, struct ufshpb_subregion *srgn; int srgn_idx; + No need of this blank line. Regards, Can Guo. + if (hpb->is_hcm && ufshpb_issue_umap_single_req(hpb, rgn)) +

Re: [PATCH v5 03/10] scsi: ufshpb: Add region's reads counter

2021-03-11 Thread Can Guo
#include "../sd.h" > > +#define ACTIVATION_THRESHOLD 4 /* 4 IOs */ Can this param be added as a sysfs entry? Yes. Daejun asked me that as well, so the last patch makes all logic parameter configurable. Thanks, Avri Ok, thanks. I haven't reach the last one, absorbing them one by one. Can Guo. Thanks, Can Guo

Re: [PATCH v5 04/10] scsi: ufshpb: Make eviction depends on region's reads

2021-03-10 Thread Can Guo
4 /* 4 IOs */ +#define EVICTION_THRESHOLD (ACTIVATION_THRESHOLD << 6) /* 256 IOs */ Same here, can this be added as a sysfs entry? Thanks, Can Guo. /* memory management */ static struct kmem_cache *ufshpb_mctx_cache; @@ -1050,6 +1051,13 @@ static struct ufshpb_region *ufshpb_victim_lru_info(

Re: [PATCH v5 03/10] scsi: ufshpb: Add region's reads counter

2021-03-10 Thread Can Guo
rivers/scsi/ufs/ufshpb.c index 044fec9854a0..a8f8d13af21a 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -16,6 +16,8 @@ #include "ufshpb.h" #include "../sd.h" +#define ACTIVATION_THRESHOLD 4 /* 4 IOs */ Can this param be added as a sysfs entry? Thanks

Re: [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-10 Thread Can Guo
Hi Daejun, On 2021-03-09 09:38, Can Guo wrote: Hi Daejun, If you are about to push Ver.27, please hold on. I run into OCP issues on VCCQ every time after apply this patch. The issue can be work around by disabling runtime PM. Before you or we figure out where the BUG is, it is pointless to

Re: [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-08 Thread Can Guo
Hi Daejun, If you are about to push Ver.27, please hold on. I run into OCP issues on VCCQ every time after apply this patch. The issue can be work around by disabling runtime PM. Before you or we figure out where the BUG is, it is pointless to push next version. Regards, Can Guo. On 2021-03-03

Re: [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-04 Thread Can Guo
On 2021-03-03 22:50, Bean Huo wrote: On Wed, 2021-03-03 at 15:29 +0900, Daejun Park wrote: + +static inline void ufshpb_put_pre_req(struct ufshpb_lu *hpb, + struct ufshpb_req *pre_req) +{ + pre_req->req = NULL; + pre_req->bio = NULL; + list_a

Re: [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-04 Thread Can Guo
= 0x11, + QUERY_FLAG_IDN_HPB_EN = 0x12, Also add this flag to sysfs? Thanks, Can Guo. }; /* Attribute idn for Query requests */ enum attr_idn { QUERY_ATTR_IDN_BOOT_LU_EN = 0x00, - QUERY_ATTR_IDN_RESERVED

Re: [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-03 Thread Can Guo
ut the checks in ufshpb_is_support_chunk()? Thanks, Can Guo.

Re: [PATCH] scsi: ufs: Fix incorrect ufshcd_state after ufshcd_reset_and_restore()

2021-03-03 Thread Can Guo
rnel.org/patchwork/patch/1383817/ Thanks, Can Guo.

Re: [PATCH] scsi: ufs: Fix incorrect ufshcd_state after ufshcd_reset_and_restore()

2021-03-03 Thread Can Guo
by: Adrian Hunter I think that CanG recent series addressed that issue as well, can you take a look? https://lore.kernel.org/lkml/1614145010-36079-2-git-send-email-c...@codeaurora.org/ Yes, there it is mixed in with other changes. However it is probably better as a separate patch. Can Guo, w

Re: [PATCH v2 1/3] scsi: ufs: Minor adjustments to error handling

2021-03-03 Thread Can Guo
On 2021-03-03 18:03, Can Guo wrote: Hi Avri, On 2021-03-03 15:22, Avri Altman wrote: In error handling prepare stage, after SCSI requests are blocked, do a down/up_write(clk_scaling_lock) to clean up the queuecommand() path. Meanwhile, stop eeh_work in case it disturbs error recovery

Re: [PATCH v2 1/3] scsi: ufs: Minor adjustments to error handling

2021-03-03 Thread Can Guo
entrance of ufshcd_probe_hba(), since it may be called multiple times during error recovery. Signed-off-by: Can Guo I noticed that you tagged Adrian's patch - https://lore.kernel.org/lkml/20210301191940.15247-1-adrian.hun...@intel.com/ So this patch needs to be adjusted accordingly? Thank

Re: [PATCH v10 2/2] ufs: sysfs: Resume the proper scsi device

2021-03-03 Thread Can Guo
On 2021-03-03 06:52, Asutosh Das wrote: Resumes the actual scsi device the unit descriptor of which is being accessed instead of the hba alone. Signed-off-by: Asutosh Das Reviewed-by: Can Guo --- drivers/scsi/ufs/ufs-sysfs.c | 30 +- 1 file changed, 17

Re: [PATCH v25 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-03 Thread Can Guo
On 2021-02-26 15:35, 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 HP

Re: [PATCH v2 2/3] scsi: ufs-qcom: Disable interrupt in reset path

2021-03-03 Thread Can Guo
On 2021-02-28 22:23, Avri Altman wrote: From: Nitin Rawat Disable interrupt in reset path to flush pending IRQ handler in order to avoid possible NoC issues. Signed-off-by: Nitin Rawat Signed-off-by: Can Guo --- drivers/scsi/ufs/ufs-qcom.c | 10 ++ 1 file changed, 10 insertions

Re: [PATCH v25 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-03 Thread Can Guo
re_req_max_tr_len; In the case of HPB1.0, this is wrong - you are allowing transfer_len > 1 for HPB1.0 devices. Can Guo. +} + +/* + * In this driver, WRITE_BUFFER CMD support 36KB (len=9) ~ 512KB (len=128) as + * default. It is possible to change range of transfer_len through sysfs. +

[PATCH v2 2/3] scsi: ufs-qcom: Disable interrupt in reset path

2021-02-23 Thread Can Guo
From: Nitin Rawat Disable interrupt in reset path to flush pending IRQ handler in order to avoid possible NoC issues. Signed-off-by: Nitin Rawat Signed-off-by: Can Guo --- drivers/scsi/ufs/ufs-qcom.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/ufs/ufs-qcom.c

[PATCH v2 1/3] scsi: ufs: Minor adjustments to error handling

2021-02-23 Thread Can Guo
multiple times during error recovery. Signed-off-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 80620c8..013eb73 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b

[PATCH v2 3/3] scsi: ufs: Remove redundant checks of !hba in suspend/resume callbacks

2021-02-23 Thread Can Guo
Runtime and system suspend/resume can only come after hba probe invokes platform_set_drvdata(pdev, hba), meaning hba cannot be NULL in these PM callbacks, so remove the checks of !hba. Signed-off-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 21 - 1 file changed, 21 deletions

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-09 Thread Can Guo
ed to fix it before move on - all the UFS3.1 HPB parts which I tested over the last few weeks are screwed due to this... I don't care where/how you want to get it fixed in next version. In my case, which may not be a valid fix, I simply hack the code as below and it works for me. - put_unaligned_be64(ppn, &cdb[6]); + memcpy(&cdb[6], &ppn, sizeof(u64)); Thanks, Can Guo. thanks, Bean

Re: [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read

2021-02-08 Thread Can Guo
t(). -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?). LGTM. You make the call. Regards, Can Guo. Thanks, Daejun

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-08 Thread Can Guo
On 2021-02-08 16:16, Bean Huo wrote: On Fri, 2021-02-05 at 11:29 +0800, Can Guo wrote: > + return ppn_table[offset]; > +} > + > +static void > +ufshpb_get_pos_from_lpn(struct ufshpb_lu *hpb, unsigned long lpn, > int > *rgn_idx, > + in

Re: [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read

2021-02-08 Thread Can Guo
o get a request from the queue - that shall pull down the efficiency of one map_work(), that may hurt random performance... Can Guo. int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags) { const bool pm = flags & BLK_MQ_REQ_PM; while (true

Re: [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read

2021-02-08 Thread Can Guo
id 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(); Regards, Can Guo. Thanks, Daejun

Re: [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read

2021-02-07 Thread Can Guo
The map_work manages active/inactive by 2 "to-do" lists. Each hpb lun maintains 2 "to-do" lists: hpb->lh_inact_rgn - regions to be inactivated, and hpb->lh_act_srgn - subregions to be activated Those lists are maintained on IO completion. Reviewed-by: Bart Van Assche R

Re: [PATCH v2 6/9] scsi: ufshpb: Add hpb dev reset response

2021-02-07 Thread Can Guo
struct ufshpb_lu *h; + struct scsi_device *sdev; + + shost_for_each_device(sdev, hba->host) { I haven't test it yet, but this line shall cause recursive spin lock - in current code base, ufshpb_rsp_upiu() is called with host_lock held. Regards, Can Guo. +

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-06 Thread Can Guo
quot;HPB Buffer Read" cmd are in big-endian byte ordering. If Micron FW team is right, I am pretty sure that you would have seen random read performance regression on Micron UFS devices caused by invalid HPB entry format in HPB Read cmd UPIU (which leads to L2P cache miss in device side all the time) during your test. Can Guo. Thanks, Bean Thanks, Avri

Re: [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read

2021-02-05 Thread Can Guo
The map_work manages active/inactive by 2 "to-do" lists. Each hpb lun maintains 2 "to-do" lists: hpb->lh_inact_rgn - regions to be inactivated, and hpb->lh_act_srgn - subregions to be activated Those lists are maintained on IO completion. Reviewed-by: Bart Van Assche R

Re: [PATCH v3 3/3] scsi: ufs: Fix wrong Task Tag used in task management request UPIUs

2021-02-04 Thread Can Guo
On 2021-02-01 10:39, Bart Van Assche wrote: On 1/28/21 9:57 PM, Can Guo wrote: On 2021-01-29 11:15, Bart Van Assche wrote: On 1/27/21 8:16 PM, Can Guo wrote: In __ufshcd_issue_tm_cmd(), it is not right to use hba->nutrs + req->tag as the Task Tag in one TMR UPIU. Directly use req->t

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-04 Thread Can Guo
SCSI command. In the HPB version 1.0, the maximum read I/O size that can be converted to HPB read is 4KB. The dirty map of the active sub-region prevents an incorrect HPB read that has stale physical page number which is updated by previous write I/O. Reviewed-by: Can Guo Reviewed-by: Bart Van

Re: [PATCH v3 2/3] scsi: ufs: Fix a race condition btw task management request send and compl

2021-01-28 Thread Can Guo
On 2021-01-29 14:06, Can Guo wrote: On 2021-01-29 11:20, Bart Van Assche wrote: On 1/27/21 8:16 PM, Can Guo wrote: ufshcd_compl_tm() looks for all 0 bits in the REG_UTP_TASK_REQ_DOOR_BELL and call complete() for each req who has the req->end_io_data set. There can be a race condition btw

Re: [PATCH v3 2/3] scsi: ufs: Fix a race condition btw task management request send and compl

2021-01-28 Thread Can Guo
On 2021-01-29 11:20, Bart Van Assche wrote: On 1/27/21 8:16 PM, Can Guo wrote: ufshcd_compl_tm() looks for all 0 bits in the REG_UTP_TASK_REQ_DOOR_BELL and call complete() for each req who has the req->end_io_data set. There can be a race condition btw tmc send/compl, because the

  1   2   3   4   5   6   >