All of lore.kernel.org
 help / color / mirror / Atom feed
* Query about UCD allocation
       [not found] <CGME20240126053128epcas2p41cf6ee4ff361ff89f7f1dd2f190aba6e@epcas2p4.samsung.com>
@ 2024-01-26  5:31 ` Kiwoong Kim
  2024-01-26  9:46   ` [EXT] " Bean Huo
  0 siblings, 1 reply; 2+ messages in thread
From: Kiwoong Kim @ 2024-01-26  5:31 UTC (permalink / raw)
  To: linux-scsi, alim.akhtar, avri.altman, bvanassche, jejb,
	martin.petersen, beanhuo, adrian.hunter, h10.kim, hy50.seo,
	sh425.lee, 민광원

Form a certain time, UFS drivers set the value of 'max_sectors' like below, meaning 1MB.
And the size of PRDT part of UCD per one slot is decided with SG_ALL(128) multiplied by PRDT entry size, 16 bytes if 4DW of PRDT is used.

If there is another knob to make it smaller to split a request, it seems UFS driver can receive 1MB of chunk.
And when 4KB page is used, 256 PRDT entries are necessary to describe data area.
Thus, it seems that the driver has been allocating less than it needs.

If my understanding is wrong, please correct me.

--
static const struct scsi_host_template ufshcd_driver_template = {
..
.max_sectors            = SZ_1M / SECTOR_SIZE,

static int ufshcd_memory_alloc(struct ufs_hba *hba)
..
        ucdl_size = ufshcd_get_ucd_size(hba) * hba->nutrs;

static inline size_t ufshcd_get_ucd_size(const struct ufs_hba *hba)
{
        return sizeof(struct utp_transfer_cmd_desc) + SG_ALL * ufshcd_sg_entry_size(hba);

Thanks.
Kiwoong Kim



^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [EXT] Query about UCD allocation
  2024-01-26  5:31 ` Query about UCD allocation Kiwoong Kim
@ 2024-01-26  9:46   ` Bean Huo
  0 siblings, 0 replies; 2+ messages in thread
From: Bean Huo @ 2024-01-26  9:46 UTC (permalink / raw)
  To: Kiwoong Kim, linux-scsi, alim.akhtar, avri.altman, bvanassche,
	jejb, martin.petersen, adrian.hunter, h10.kim, hy50.seo,
	sh425.lee, kwangwon.min

> 
> Form a certain time, UFS drivers set the value of 'max_sectors' like below,
> meaning 1MB.
> And the size of PRDT part of UCD per one slot is decided with SG_ALL(128)
> multiplied by PRDT entry size, 16 bytes if 4DW of PRDT is used.
> 
> If there is another knob to make it smaller to split a request, it seems UFS
> driver can receive 1MB of chunk.
> And when 4KB page is used, 256 PRDT entries are necessary to describe data
> area.
> Thus, it seems that the driver has been allocating less than it needs.
> 
> If my understanding is wrong, please correct me.
> 
> --
> static const struct scsi_host_template ufshcd_driver_template = { ..
> .max_sectors            = SZ_1M / SECTOR_SIZE,
> 
> static int ufshcd_memory_alloc(struct ufs_hba *hba) ..
>         ucdl_size = ufshcd_get_ucd_size(hba) * hba->nutrs;
> 
> static inline size_t ufshcd_get_ucd_size(const struct ufs_hba *hba) {
>         return sizeof(struct utp_transfer_cmd_desc) + SG_ALL *
> ufshcd_sg_entry_size(hba);
> 
> Thanks.
> Kiwoong Kim
> 

The current UFS Spec each PRDR entry can support the maximum data size 256KB, but if the host side system somehow cannon make
256KB per PRDR entry, and split 4KB per scatter gather list, 128 is not enough. This is my understanding.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-26  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20240126053128epcas2p41cf6ee4ff361ff89f7f1dd2f190aba6e@epcas2p4.samsung.com>
2024-01-26  5:31 ` Query about UCD allocation Kiwoong Kim
2024-01-26  9:46   ` [EXT] " Bean Huo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.