Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Yonatan Nachum <ynachum@amazon.com>,
	"yanjun.zhu@linux.dev" <yanjun.zhu@linux.dev>
Cc: jgg@nvidia.com, leon@kernel.org, linux-rdma@vger.kernel.org,
	mrgolin@amazon.com, sleybo@amazon.com, matua@amazon.com,
	gal.pressman@linux.dev, Firas Jahjah <firasj@amazon.com>
Subject: Re: [PATCH for-next v2 1/2] RDMA/efa: Add initialization of AH cache rhashtable
Date: Thu, 14 May 2026 22:09:11 -0700	[thread overview]
Message-ID: <ac4a8f98-7986-42d3-b6ca-28f514791b79@linux.dev> (raw)
In-Reply-To: <20260514100214.GA22423@dev-dsk-ynachum-1b-aa121316.eu-west-1.amazon.com>


在 2026/5/14 3:02, Yonatan Nachum 写道:
> On Wed, May 13, 2026 at 10:12:01PM -0700, Zhu Yanjun wrote:
>> 在 2026/5/11 23:11, Yonatan Nachum 写道:
>>> New EFA devices don't support the creation of multiple address handles
>>> to the same remote on the same PD.
>>> To overcome this limitation, introduce an AH cache rhashtable which will
>>> store the refcounts of the same AH creation on the same PD and will
>>> allow the driver to manage AH reuse. The hashtable key is the
>>> combination of PD and GID. Add initialization and teardown logic for the
>>> rhashtable.
>>>
>>> Reviewed-by: Firas Jahjah <firasj@amazon.com>
>>> Reviewed-by: Michael Margolin <mrgolin@amazon.com>
>>> Signed-off-by: Yonatan Nachum <ynachum@amazon.com>
>>> ---
>>>   drivers/infiniband/hw/efa/Makefile       |  4 +--
>>>   drivers/infiniband/hw/efa/efa_ah_cache.c | 30 ++++++++++++++++++++
>>>   drivers/infiniband/hw/efa/efa_ah_cache.h | 36 ++++++++++++++++++++++++
>>>   drivers/infiniband/hw/efa/efa_com.c      | 12 +++++++-
>>>   drivers/infiniband/hw/efa/efa_com.h      |  5 +++-
>>>   5 files changed, 83 insertions(+), 4 deletions(-)
>>>   create mode 100644 drivers/infiniband/hw/efa/efa_ah_cache.c
>>>   create mode 100644 drivers/infiniband/hw/efa/efa_ah_cache.h
>>>
>>> diff --git a/drivers/infiniband/hw/efa/efa_ah_cache.h b/drivers/infiniband/hw/efa/efa_ah_cache.h
>>> new file mode 100644
>>> index 000000000000..25288fdf778a
>>> --- /dev/null
>>> +++ b/drivers/infiniband/hw/efa/efa_ah_cache.h
>>> @@ -0,0 +1,36 @@
>>> +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
>>> +/*
>>> + * Copyright 2026 Amazon.com, Inc. or its affiliates. All rights reserved.
>>> + */
>>> +
>>> +#ifndef _EFA_AH_CACHE_H_
>>> +#define _EFA_AH_CACHE_H_
>>> +
>>> +#include <linux/refcount.h>
>>> +#include <linux/rhashtable.h>
>>> +
>>> +#define EFA_AH_GID_SIZE 16
>>> +
>>> +struct efa_ah_cache_key {
>>> +	u8 gid[EFA_AH_GID_SIZE];
>>> +	u16 pd;
>>> +};
>> I am not sure if we add __packed to avoid memory hole.
>>
>> Zhu Yanjun
> Currently there is no holes in the struct (verified using pahole) and we
> Zero-initialize AH cache key so I don't think packed is really needed.

I’m wondering whether you’ve tested this on all architectures.

Explicitly using `__packed` or ensuring proper memory alignment

would likely be a better solution to avoid memory holes in the key 
structure.

Zhu Yanjun


>
> Thanks

-- 
Best Regards,
Yanjun.Zhu


  reply	other threads:[~2026-05-15  5:09 UTC|newest]

Thread overview: 6+ 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 [this message]
2026-05-12  6:11 ` [PATCH for-next v2 2/2] RDMA/efa: Add AH cache handling on create and destroy AH Yonatan Nachum

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=ac4a8f98-7986-42d3-b6ca-28f514791b79@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=firasj@amazon.com \
    --cc=gal.pressman@linux.dev \
    --cc=jgg@nvidia.com \
    --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