Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795055293; b=TCgtQjpNxM5Ot8DU4NNFXwpj88AUeAa3SZHtAa4lBKNSFf0+50/2fO7eDQKSsWcmcKDm 06pqfWL2nnmro0gkCwzH2VrpSsTXNMxJM5idV/8AEUUDMzfX7zOTUgUmjjhZHfM0KcMkp Qy6HkUBxjXxP6G3gYTBAxV56ZWaDkfCQsuxyvMHPLdKDSD3iH95cqhGAuU0e7j8TP6git eZl51i1B49E5x+/d7SYTZElfCbKy8sJRVyZW3iQ3rR9Yw0qDwEm99Cbl6RsjP3diIwTKU /6z7HgGSlmuuQGNRkNK+wtkQhoXBDTLapp66bAnOFg4AkDZ3PCp4hP+DYDR0ju1reSQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795055293; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=mdQ1MofT+816Gzu9l3+xUHQJNbg1EKu8l3cdDdO5j2k=; b=LLYVdRzX/3ICnfZZENeohy+RthwEbinN87E6IpM/e4jIQ8BlqgSMToIWTSWIEw5+GUls MjDYieiDqQkQt83ROuuP4F9Psud81Xe82gE/jwQzSTrgLJPeM/wh+tSvdlGahBRZ7liv+ AtEBUdrS4Mta6e27Sh9abvpNggLeikUgywC4qCj/I8cE4uLI+rrkXhoagGxOdD3Lxb98Q i/NvLUCmVf9B7neea6xMsFlv6Yn4ICsYsq/sxJbPmSn099IdTnprzly2EiT0ZVt66KjMf ONnf46L+toq9XVu/3GKNk6lMVB12NbMw70ZGEdbHD6aCEK57BYrATuptCtCq6ENvHVQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=uaCqPZsk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A27B160A2602; Thu, 19 Nov 2026 02:28:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=uaCqPZsk Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9F3E1F000C5; Thu, 19 Nov 2026 02:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795055293; bh=mdQ1MofT+816Gzu9l3+xUHQJNbg1EKu8l3cdDdO5j2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uaCqPZskuypa8kl/oLZW0Y5378t+xGJcRzaIriks6KEtX40v4Uc9X/OCcSl1GNs3p sonLessRUAFExOVvWELDVytpCJJX2oWfG1c6OBN5pz7wrSamImaaROzZLc42Rc+9Iq Mb4vqqWakufZ8PRD3mzppZDRV5P+yllnoifrYW1s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jeremy Bongio , Jacob Moroni , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 1552/2214] RDMA/irdma: Use kvzalloc for lvl2 leafmem allocation Date: Wed, 18 Nov 2026 15:53:48 +0100 Message-ID: <20261118150114.195100422@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150009.797899913@linuxfoundation.org> References: <20261118150009.797899913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeremy Bongio [ Upstream commit 9c40f13a63a4b87177de3e8c318af25068fc6ab4 ] During VM live migration or when registering large memory regions (e.g., guest memory >= 256 GB backed by 4 KiB pages), get_lvl2_pble() calculates total leaves exceeding ~131,072. The memory required for lvl2->leafmem.va exceeds 4 MiB (sizeof(*leaf) * total > 5.24 MiB). Because kzalloc() requires physically contiguous pages, requests larger than MAX_PAGE_ORDER (4 MiB on x86_64) fail and trigger a warning: WARNING: CPU: 123 PID: 119906 at mm/page_alloc.c:5997 __alloc_frozen_pages_noprof+0x50c/0x1050 Call Trace: alloc_frozen_pages_noprof+0xc0/0x240 ___kmalloc_large_node+0x3d/0xd0 __kmalloc_large_node_noprof+0x1b/0x90 __kmalloc_noprof+0x254/0x660 get_lvl1_lvl2_pble+0xbc/0x270 [irdma] irdma_get_pble+0x44/0xc0 [irdma] irdma_setup_pbles+0x46/0x1d0 [irdma] irdma_reg_user_mr_type_mem+0x41/0x230 [irdma] irdma_reg_user_mr+0x194/0x1c0 [irdma] ib_uverbs_reg_mr+0x1b0/0x2c0 [ib_uverbs] The leafmem array is purely host software tracking structures (struct irdma_pble_info) and does not require physically contiguous memory. Switch the allocation from kzalloc() to kvzalloc() and free it with kvfree() so that requests exceeding MAX_PAGE_ORDER fall back to virtually contiguous memory via vmalloc. Fixes: e8c4dbc2fcac ("RDMA/irdma: Add PBLE resource manager") Assisted-by: LLM Signed-off-by: Jeremy Bongio Link: https://patch.msgid.link/20260916173203.2555458-1-jbongio@google.com Tested-by: Jacob Moroni Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/irdma/pble.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/irdma/pble.c b/drivers/infiniband/hw/irdma/pble.c index f4d5d1cee681f..965b84c0bc1ec 100644 --- a/drivers/infiniband/hw/irdma/pble.c +++ b/drivers/infiniband/hw/irdma/pble.c @@ -328,7 +328,7 @@ static void free_lvl2(struct irdma_hmc_pble_rsrc *pble_rsrc, if (root->addr) irdma_prm_return_pbles(&pble_rsrc->pinfo, &root->chunkinfo); - kfree(lvl2->leafmem.va); + kvfree(lvl2->leafmem.va); lvl2->leaf = NULL; } @@ -357,7 +357,7 @@ get_lvl2_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, lvl2->leaf_cnt = total; lvl2->leafmem.size = (sizeof(*leaf) * total); - lvl2->leafmem.va = kzalloc(lvl2->leafmem.size, GFP_KERNEL); + lvl2->leafmem.va = kvzalloc(lvl2->leafmem.size, GFP_KERNEL); if (!lvl2->leafmem.va) return IRDMA_ERR_NO_MEMORY; @@ -366,7 +366,7 @@ get_lvl2_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, ret_code = irdma_prm_get_pbles(&pble_rsrc->pinfo, &root->chunkinfo, total << 3, &root->addr, &fpm_addr); if (ret_code) { - kfree(lvl2->leafmem.va); + kvfree(lvl2->leafmem.va); lvl2->leaf = NULL; return IRDMA_ERR_NO_MEMORY; } -- 2.53.0