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: jgg@ziepe.ca, linux-rdma@vger.kernel.org, linuxarm@huawei.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH for-next 9/9] RDMA/hns: Fix different dgids mapping to the same dip_idx
Date: Tue, 29 Oct 2024 14:40:29 +0200	[thread overview]
Message-ID: <20241029124029.GM1615717@unreal> (raw)
In-Reply-To: <cd7ae683-c9b9-cb1c-c5fc-739d66c303ec@hisilicon.com>

On Thu, Oct 17, 2024 at 09:21:45PM +0800, Junxian Huang wrote:
> 
> 
> On 2024/9/10 21:12, Leon Romanovsky wrote:
> > On Fri, Sep 06, 2024 at 05:34:44PM +0800, Junxian Huang wrote:
> >> From: Feng Fang <fangfeng4@huawei.com>
> >>
> >> DIP algorithm requires a one-to-one mapping between dgid and dip_idx.
> >> Currently a queue 'spare_idx' is used to store QPN of QPs that use
> >> DIP algorithm. For a new dgid, use a QPN from spare_idx as dip_idx.
> >> This method lacks a mechanism for deduplicating QPN, which may result
> >> in different dgids sharing the same dip_idx and break the one-to-one
> >> mapping requirement.
> >>
> >> This patch replaces spare_idx with two new bitmaps: qpn_bitmap to record
> >> QPN that is not being used as dip_idx, and dip_idx_map to record QPN
> >> that is being used. Besides, introduce a reference count of a dip_idx
> >> to indicate the number of QPs that using this dip_idx. When creating
> >> a DIP QP, if it has a new dgid, set the corresponding bit in dip_idx_map,
> >> otherwise add 1 to the reference count of the reused dip_idx and set bit
> >> in qpn_bitmap. When destroying a DIP QP, decrement the reference count
> >> by 1. If it becomes 0, set bit in qpn_bitmap and clear bit in dip_idx_map.
> >>
> >> Fixes: eb653eda1e91 ("RDMA/hns: Bugfix for incorrect association between dip_idx and dgid")
> >> Fixes: f91696f2f053 ("RDMA/hns: Support congestion control type selection according to the FW")
> >> Signed-off-by: Feng Fang <fangfeng4@huawei.com>
> >> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
> >> ---
> >>  drivers/infiniband/hw/hns/hns_roce_device.h |  6 +--
> >>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c  | 58 ++++++++++++++++++---
> >>  drivers/infiniband/hw/hns/hns_roce_hw_v2.h  |  1 +
> >>  drivers/infiniband/hw/hns/hns_roce_qp.c     | 16 ++++--
> >>  4 files changed, 67 insertions(+), 14 deletions(-)
> > 
> > It is strange implementation, double bitmap and refcount looks like
> > open-coding of some basic coding patterns. Let's wait with applying it
> > for now.
> > 
> 
> Hi Leon, it's been a while since this patch was sent. Is it okay to be applied?

Not in this implementation. I think that xarray + tag will give you what
you are looking without the need to open-code it.

Thanks

> 
> Regarding your question about the double bitmaps, that's because we have 3 states
> to track:
> 1) the context hasn't been created
> 2) the context has been created but not used as dip_ctx
> 3) the context is being used as dip_ctx.
> 
> Junxian
> 
> > Thanks
> > 
> 

  reply	other threads:[~2024-10-29 12:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  9:34 [PATCH for-next 0/9] RDMA/hns: Bugfixes and one improvement Junxian Huang
2024-09-06  9:34 ` [PATCH for-next 1/9] RDMA/hns: Don't modify rq next block addr in HIP09 QPC Junxian Huang
2024-09-06  9:34 ` [PATCH for-next 2/9] RDMA/hns: Fix Use-After-Free of rsv_qp on HIP08 Junxian Huang
2024-09-06  9:34 ` [PATCH for-next 3/9] RDMA/hns: Fix cpu stuck caused by printings during reset Junxian Huang
2024-09-10 13:09   ` Leon Romanovsky
2024-09-11  1:34     ` Junxian Huang
2024-09-11 13:25       ` Leon Romanovsky
2024-09-12  1:04         ` Junxian Huang
2024-09-06  9:34 ` [PATCH for-next 4/9] RDMA/hns: Fix the overflow risk of hem_list_calc_ba_range() Junxian Huang
2024-09-06  9:34 ` [PATCH for-next 5/9] RDMA/hns: Fix spin_unlock_irqrestore() called with IRQs enabled Junxian Huang
2024-09-06  9:34 ` [PATCH for-next 6/9] RDMA/hns: Fix VF triggering PF reset in abnormal interrupt handler Junxian Huang
2024-09-06  9:34 ` [PATCH for-next 7/9] RDMA/hns: Fix 1bit-ECC recovery address in non-4K OS Junxian Huang
2024-09-06  9:34 ` [PATCH for-next 8/9] RDMA/hns: Optimize hem allocation performance Junxian Huang
2024-09-06  9:34 ` [PATCH for-next 9/9] RDMA/hns: Fix different dgids mapping to the same dip_idx Junxian Huang
2024-09-10 13:12   ` Leon Romanovsky
2024-10-17 13:21     ` Junxian Huang
2024-10-29 12:40       ` Leon Romanovsky [this message]
2024-09-10 13:13 ` [PATCH for-next 0/9] RDMA/hns: Bugfixes and one improvement Leon Romanovsky
2024-09-10 13:13 ` (subset) " Leon Romanovsky

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=20241029124029.GM1615717@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 \
    /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