From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.34.181.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 592FC26AF4 for ; Mon, 8 Jun 2026 07:16:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.34.181.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780903017; cv=none; b=npeLaJ+yMZD9P55x5fDEsvBWP7tltirxWoUbuiE2MN/RKn7h0bll/xNE+S1sMSwPKzFAdXO0bNjeQZJTy1T7Wpwm7/YT9obJULVBxZdzVxtDMbDX3eA40SOas5A+nS60BEqMxAd5xjqzCInsg0FGsgp/pJneypj3fWZu+ThEtdw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780903017; c=relaxed/simple; bh=wcbLfZOZtX3OsDA9i9dsioayiXfmFen+5tVT27eSKX4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=PEAsnEu/d8ub+lIbDsJS3ha80+Xhjf+uK5PlObmDFxcrHvExig+Eyphd6pRBT0NSEI+HTwZrpVfC21oQlh8n6ytTxbcImP0ZbN87dSiNavUQwf0a658UNEuvLJpXuOT2zygNqhZMTtIMWZmx+5BkG/ytyqopZgHgJ0yxeQwbCzk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=D39uL/MJ; arc=none smtp.client-ip=52.34.181.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="D39uL/MJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1780903016; x=1812439016; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=vbWJwTeALB0dL2aCal4ttyPevFvhtMcO1J1VAsbP69E=; b=D39uL/MJDyiWaI7RJ0DVzzANdL1bwqw1ZV8aaWjQH8zOAkXcMNvU1MNf P7VrdiBckP5wiXCtTHg+yhifxEI+/bFJLz6RPyPwwDlT4ALt0hAkSYIn2 KytBQnokIo6XepsCeAuUb2gQJYCWR4otsg1bE2S+anoNU0uCbr+FpOcHk 773sFWZasaE2ZVeH9ty+ANFqm7Ht+UVr1lMG2bOwmbco8qrXBRMKJ9oTL TBSsVHmNMu3btDtTwRGucyYOiJmogoXLi1D6xCvhB2KrUhorA4omw2U7u yymp8+Gm5fEko7FxcQHFRZdif4FTZHHFmZAcPunaTyKb2MzBNFw4pUaR0 Q==; X-CSE-ConnectionGUID: CdpljmjoRliHgzw3Y7CL8A== X-CSE-MsgGUID: uGIFg/yMRPSMpRVSJ2JRYA== X-IronPort-AV: E=Sophos;i="6.24,194,1774310400"; d="scan'208";a="21292146" Received: from ip-10-5-12-219.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.12.219]) by internal-pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2026 07:16:53 +0000 Received: from EX19MTAUWC002.ant.amazon.com [205.251.233.111:16473] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.58.234:2525] with esmtp (Farcaster) id 4a0af1d8-6835-4850-a270-5637fca6b04b; Mon, 8 Jun 2026 07:16:53 +0000 (UTC) X-Farcaster-Flow-ID: 4a0af1d8-6835-4850-a270-5637fca6b04b Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC002.ant.amazon.com (10.250.64.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Mon, 8 Jun 2026 07:16:53 +0000 Received: from dev-dsk-ynachum-1b-0ecf7b87.eu-west-1.amazon.com (10.13.226.176) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Mon, 8 Jun 2026 07:16:51 +0000 From: Yonatan Nachum To: , , CC: , , , , Yonatan Nachum Subject: [PATCH for-next v4 0/2] RDMA/efa: Add AH cache for AH reuse Date: Mon, 8 Jun 2026 07:16:18 +0000 Message-ID: <20260608071620.1909543-1-ynachum@amazon.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D035UWA002.ant.amazon.com (10.13.139.60) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Changelog: v4: * Use kzalloc_obj for AH cache entry allocation instead of kzalloc v3: https://lore.kernel.org/all/20260607161753.1607559-1-ynachum@amazon.com/ * Address Sashiko comments in: https://sashiko.dev/#/patchset/20260512061121.2177521-1-ynachum%40amazon.com v2: https://lore.kernel.org/all/20260512061121.2177521-1-ynachum@amazon.com/ * 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 | 163 +++++++++++++++++++++++ drivers/infiniband/hw/efa/efa_ah_cache.h | 42 ++++++ drivers/infiniband/hw/efa/efa_com.c | 12 +- drivers/infiniband/hw/efa/efa_com.h | 3 + drivers/infiniband/hw/efa/efa_com_cmd.c | 73 +++++++--- drivers/infiniband/hw/efa/efa_com_cmd.h | 1 + drivers/infiniband/hw/efa/efa_verbs.c | 9 +- 8 files changed, 281 insertions(+), 26 deletions(-) create mode 100644 drivers/infiniband/hw/efa/efa_ah_cache.c create mode 100644 drivers/infiniband/hw/efa/efa_ah_cache.h -- 2.50.1