public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Junxian Huang <huangjunxian6@hisilicon.com>
Cc: Zhu Yanjun <yanjun.zhu@linux.dev>,
	jgg@ziepe.ca, linux-rdma@vger.kernel.org, linuxarm@huawei.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH for-rc 5/9] RDMA/hns: Fix missing pagesize and alignment check in FRMR
Date: Mon, 8 Jul 2024 08:41:44 +0300	[thread overview]
Message-ID: <20240708054144.GB6788@unreal> (raw)
In-Reply-To: <849ed8b9-e826-7211-3e90-7fdeff9d945a@hisilicon.com>

On Mon, Jul 08, 2024 at 10:44:52AM +0800, Junxian Huang wrote:
> 
> 
> On 2024/7/7 17:16, Zhu Yanjun wrote:
> > 在 2024/7/5 16:59, Junxian Huang 写道:
> >> From: Chengchang Tang <tangchengchang@huawei.com>
> >>
> >> The offset requires 128B alignment and the page size ranges from
> >> 4K to 128M.
> >>
> >> Fixes: 68a997c5d28c ("RDMA/hns: Add FRMR support for hip08")
> > 
> > https://patchwork.kernel.org/project/linux-rdma/patch/2eee7e35-504e-4f2a-a364-527e90669108@CMEXHTCAS1.ad.emulex.com/
> > In the above link, from Bart, it seems that FRMR is renamed to FRWR.
> > "
> > There are already a few drivers upstream in which the fast register
> > memory region work request is abbreviated as FRWR. Please consider
> > renaming FRMR into FRWR in order to avoid confusion and in order to
> > make it easier to find related code with grep in the kernel tree.
> > "
> > 
> > So is it possible to rename FRMR to FRWR?
> > 
> 
> I think the rename is irrelevant to this bugfix, and if it needs to be done,
> we'll need a single patch to rename all existing 'FRMR' in hns driver.
> 
> So let's leave it as is for now.

+1

> 
> Thanks,
> Junxian
> 
> >> Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
> >> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
> >> ---
> >>   drivers/infiniband/hw/hns/hns_roce_device.h | 4 ++++
> >>   drivers/infiniband/hw/hns/hns_roce_mr.c     | 5 +++++
> >>   2 files changed, 9 insertions(+)
> >>
> >> diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
> >> index 5a2445f357ab..15b3b978a601 100644
> >> --- a/drivers/infiniband/hw/hns/hns_roce_device.h
> >> +++ b/drivers/infiniband/hw/hns/hns_roce_device.h
> >> @@ -83,6 +83,7 @@
> >>   #define MR_TYPE_DMA                0x03
> >>     #define HNS_ROCE_FRMR_MAX_PA            512
> >> +#define HNS_ROCE_FRMR_ALIGN_SIZE        128
> >>     #define PKEY_ID                    0xffff
> >>   #define NODE_DESC_SIZE                64
> >> @@ -189,6 +190,9 @@ enum {
> >>   #define HNS_HW_PAGE_SHIFT            12
> >>   #define HNS_HW_PAGE_SIZE            (1 << HNS_HW_PAGE_SHIFT)
> >>   +#define HNS_HW_MAX_PAGE_SHIFT            27
> >> +#define HNS_HW_MAX_PAGE_SIZE            (1 << HNS_HW_MAX_PAGE_SHIFT)
> >> +
> >>   struct hns_roce_uar {
> >>       u64        pfn;
> >>       unsigned long    index;
> >> diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
> >> index 1a61dceb3319..846da8c78b8b 100644
> >> --- a/drivers/infiniband/hw/hns/hns_roce_mr.c
> >> +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
> >> @@ -443,6 +443,11 @@ int hns_roce_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,
> >>       struct hns_roce_mtr *mtr = &mr->pbl_mtr;
> >>       int ret, sg_num = 0;
> >>   +    if (!IS_ALIGNED(*sg_offset, HNS_ROCE_FRMR_ALIGN_SIZE) ||
> >> +        ibmr->page_size < HNS_HW_PAGE_SIZE ||
> >> +        ibmr->page_size > HNS_HW_MAX_PAGE_SIZE)
> >> +        return sg_num;
> >> +
> >>       mr->npages = 0;
> >>       mr->page_list = kvcalloc(mr->pbl_mtr.hem_cfg.buf_pg_count,
> >>                    sizeof(dma_addr_t), GFP_KERNEL);
> > 

  reply	other threads:[~2024-07-08  5:41 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-05  8:59 [PATCH for-rc 0/9] RDMA/hns: Bugfixes Junxian Huang
2024-07-05  8:59 ` [PATCH for-rc 1/9] RDMA/hns: Check atomic wr length Junxian Huang
2024-07-07  8:24   ` Leon Romanovsky
2024-07-08  2:27     ` Junxian Huang
2024-07-05  8:59 ` [PATCH for-rc 2/9] RDMA/hns: Fix a long wait for cmdq event during reset Junxian Huang
2024-07-07  8:30   ` Leon Romanovsky
2024-07-08  2:29     ` Junxian Huang
2024-07-08  5:38       ` Leon Romanovsky
2024-07-08  6:50         ` Junxian Huang
2024-07-08  7:33           ` Leon Romanovsky
2024-07-08  7:46             ` Junxian Huang
2024-07-08  8:27               ` Leon Romanovsky
2024-07-08  8:45                 ` Junxian Huang
2024-07-08  8:59                   ` Leon Romanovsky
2024-07-08  9:30                     ` Junxian Huang
2024-07-08 11:16                       ` Leon Romanovsky
2024-07-09  6:21                         ` Junxian Huang
2024-07-09  7:22                           ` Leon Romanovsky
2024-07-09  7:49                             ` Junxian Huang
2024-07-05  8:59 ` [PATCH for-rc 3/9] RDMA/hns: Fix soft lockup under heavy CEQE load Junxian Huang
2024-07-05 10:47   ` Zhu Yanjun
2024-07-08  2:30     ` Junxian Huang
2024-07-05  8:59 ` [PATCH for-rc 4/9] RDMA/hns: Fix unmatch exception handling when init eq table fails Junxian Huang
2024-07-05  8:59 ` [PATCH for-rc 5/9] RDMA/hns: Fix missing pagesize and alignment check in FRMR Junxian Huang
2024-07-07  9:16   ` Zhu Yanjun
2024-07-08  2:44     ` Junxian Huang
2024-07-08  5:41       ` Leon Romanovsky [this message]
2024-07-08  7:57       ` Zhu Yanjun
2024-07-08  8:33         ` Leon Romanovsky
2024-07-05  8:59 ` [PATCH for-rc 6/9] RDMA/hns: Fix shift-out-bounds when max_inline_data is 0 Junxian Huang
2024-07-05  8:59 ` [PATCH for-rc 7/9] RDMA/hns: Fix undifined behavior caused by invalid max_sge Junxian Huang
2024-07-05  8:59 ` [PATCH for-rc 8/9] RDMA/hns: Fix insufficient extend DB for VFs Junxian Huang
2024-07-05  8:59 ` [PATCH for-rc 9/9] RDMA/hns: Fix mbx timing out before CMD execution is completed Junxian Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240708054144.GB6788@unreal \
    --to=leon@kernel.org \
    --cc=huangjunxian6@hisilicon.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=yanjun.zhu@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox