Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Yonatan Nachum <ynachum@amazon.com>
Cc: leon@kernel.org, linux-rdma@vger.kernel.org, mrgolin@amazon.com,
	sleybo@amazon.com, matua@amazon.com, gal.pressman@linux.dev
Subject: Re: [PATCH for-next v2 0/2] RDMA/efa: Add AH cache for AH reuse
Date: Wed, 3 Jun 2026 14:44:34 -0300	[thread overview]
Message-ID: <20260603174434.GA1552272@nvidia.com> (raw)
In-Reply-To: <20260512061121.2177521-1-ynachum@amazon.com>

On Tue, May 12, 2026 at 06:11:19AM +0000, Yonatan Nachum wrote:
> Changelog:
> v2:
>  * Zero-initialize AH cache key on cache lookup.
> v1: https://lore.kernel.org/all/20260510083035.458081-1-ynachum@amazon.com/
> 
> -------------------------------------------------------------------------
> New EFA devices don't support the creation of multiple AHs to the same
> remote on the same PD. To overcome this limitation, introduce an AH
> cache that manages AH reuse transparently.
> 
> The cache uses an rhashtable keyed by (PD, GID) to track active address
> handles with refcounts. On create AH, the driver returns an existing AH
> number if one is already cached, or creates a new one and caches it. On
> destroy AH, the driver only issues the device destroy command when the
> last reference is dropped.
> 
> A per-entry mutex serializes concurrent device commands on the same
> cache entry, preventing create-before-destroy races on the device.
> 
> Yonatan Nachum (2):
>   RDMA/efa: Add initialization of AH cache rhashtable
>   RDMA/efa: Add AH cache handling on create and destroy AH
> 
>  drivers/infiniband/hw/efa/Makefile       |   4 +-
>  drivers/infiniband/hw/efa/efa_ah_cache.c | 154 +++++++++++++++++++++++
>  drivers/infiniband/hw/efa/efa_ah_cache.h |  41 ++++++
>  drivers/infiniband/hw/efa/efa_com.c      |  12 +-
>  drivers/infiniband/hw/efa/efa_com.h      |   5 +-
>  drivers/infiniband/hw/efa/efa_com_cmd.c  |  27 ++++
>  drivers/infiniband/hw/efa/efa_com_cmd.h  |   1 +
>  drivers/infiniband/hw/efa/efa_verbs.c    |   9 +-
>  8 files changed, 245 insertions(+), 8 deletions(-)
>  create mode 100644 drivers/infiniband/hw/efa/efa_ah_cache.c
>  create mode 100644 drivers/infiniband/hw/efa/efa_ah_cache.h

The sashiko comments seem quite serious, please fix some of them up..

https://sashiko.dev/#/patchset/20260512061121.2177521-1-ynachum%40amazon.com

I would not do the GFP_ACCOUNT suggestion, we don't do that in RDMA
(though perhaps we should)

The races look right, the mis-use of the API looks right, and IDK
about the leak on cache_destroy, either clean it up or stick a WARN_ON
that it must be empty.

Jason


      parent reply	other threads:[~2026-06-03 17:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  6:11 [PATCH for-next v2 0/2] RDMA/efa: Add AH cache for AH reuse Yonatan Nachum
2026-05-12  6:11 ` [PATCH for-next v2 1/2] RDMA/efa: Add initialization of AH cache rhashtable Yonatan Nachum
2026-05-14  5:12   ` Zhu Yanjun
2026-05-14 10:02     ` Yonatan Nachum
2026-05-15  5:09       ` Zhu Yanjun
2026-05-17  7:06         ` Yonatan Nachum
2026-05-19 13:07   ` Leon Romanovsky
2026-05-20  6:53     ` Yonatan Nachum
2026-05-25  6:30     ` Yonatan Nachum
2026-06-01  9:14       ` Yonatan Nachum
2026-05-12  6:11 ` [PATCH for-next v2 2/2] RDMA/efa: Add AH cache handling on create and destroy AH Yonatan Nachum
2026-05-19 13:38   ` Leon Romanovsky
2026-05-20  7:03     ` Yonatan Nachum
2026-05-25  6:34     ` Yonatan Nachum
2026-06-03 17:44 ` Jason Gunthorpe [this message]

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=20260603174434.GA1552272@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=gal.pressman@linux.dev \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matua@amazon.com \
    --cc=mrgolin@amazon.com \
    --cc=sleybo@amazon.com \
    --cc=ynachum@amazon.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