[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bd975860-8872-8bf9-0bd6-da69c2f2973d@huawei.com>
Date: Thu, 28 Mar 2024 17:49:58 +0800
From: Jason Yan <yanaijie@...wei.com>
To: Yihang Li <liyihang9@...wei.com>, <john.g.garry@...cle.com>,
<jejb@...ux.ibm.com>, <martin.petersen@...cle.com>, <dlemoal@...nel.org>,
<chenxiang66@...ilicon.com>
CC: <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linuxarm@...wei.com>, <prime.zeng@...wei.com>, <yangxingui@...wei.com>
Subject: Re: [PATCH v4] scsi: libsas: Allocation SMP request is aligned to
ARCH_DMA_MINALIGN
On 2024/3/28 17:06, Yihang Li wrote:
> This series [1] reducing the kmalloc() minimum alignment on arm64 to 8
> (from 128). In libsas, this will cause SMP requests to be 8-byte-aligned
> through kmalloc() allocation. However, for the hisi_sas hardware, all
> commands address must be 16-byte-aligned. Otherwise, the commands fail to
> be executed.
>
> ARCH_DMA_MINALIGN represents the minimum (static) alignment for safe DMA
> operations, so use ARCH_DMA_MINALIGN as the alignment for SMP request.
>
> Link: https://lkml.kernel.org/r/20230612153201.554742-1-catalin.marinas@arm.com [1]
> Signed-off-by: Yihang Li <liyihang9@...wei.com>
> Reviewed-by: Damien Le Moal <dlemoal@...nel.org>
> ---
> Changes since v3:
> - Still aligned to ARCH_DMA_MINALIGN for safe DMA operations.
>
> Changes since v2:
> - Use 16B as alignment for SMP requests instead of ARCH_DMA_MINALIGN.
>
> Changes since v1:
> - Directly modify alloc_smp_req() instead of using handler callback.
> ---
> drivers/scsi/libsas/sas_expander.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
> index a2204674b680..c989d182fc75 100644
> --- a/drivers/scsi/libsas/sas_expander.c
> +++ b/drivers/scsi/libsas/sas_expander.c
> @@ -135,7 +135,7 @@ static int smp_execute_task(struct domain_device *dev, void *req, int req_size,
>
> static inline void *alloc_smp_req(int size)
> {
> - u8 *p = kzalloc(size, GFP_KERNEL);
> + u8 *p = kzalloc(ALIGN(size, ARCH_DMA_MINALIGN), GFP_KERNEL);
> if (p)
> p[0] = SMP_REQUEST;
> return p;
>
Reviewed-by: Jason Yan <yanaijie@...wei.com>
Thanks,
Jason
Powered by blists - more mailing lists