From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BB95B421EE4; Wed, 4 Feb 2026 15:20:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218407; cv=none; b=clCYtsv3z4udYHPP+GA3DjH4/gb5uO2VUrfUUO8GvV3niKBdrb8shmO+s1cweLWdwSnAX5pbfLmyg2YtsCXiuXbj+qHpJ05F5olHwNCTtHVi9Q6+cPFpSCx/u4/fjIItSNJ3Mnordos6STO6BcGzekPm7CJUzsvS11tPVs7bX2Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218407; c=relaxed/simple; bh=2kjt4KJHIKgAoUuPiVuH8dvR4ayng5/vMLiBx3zD3Ic=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gHFw3+ISv9rvHM5REcZLoSl4gfTcXZHxpx0SzxAnE2d9kUva/CjNel+XZrF/Qn7koNAgPoJHWlSTNDvSCHUCci1BF+AGJkAJrWGWyTTUOIFXaiEOn5D2PFb5moB2ZieY86ScuZAh0S+8QE6nCVerDWCkkIw5Xdx4WCrAPxUQNag= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YyULthLK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YyULthLK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BB05C2BC9E; Wed, 4 Feb 2026 15:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770218407; bh=2kjt4KJHIKgAoUuPiVuH8dvR4ayng5/vMLiBx3zD3Ic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YyULthLKcmpgbYnRbN88C9Gpjg/Hm4mVCYbRZigF59zGRH7RzhdHnnWrkumnvcu6f yCyJl/Ty0iOV90shjEmW3D3XrLmu9A8pZjQAhhpDQnDvPxGNcz7Y/rdCntKw8Lyk2p MNl5oIM2iGhHKqgPz/RhG66F8dEw9fp9UGG9r5o4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sai Sree Kartheek Adivi , Robin Murphy , Marek Szyprowski , Sasha Levin Subject: [PATCH 6.6 22/72] dma/pool: distinguish between missing and exhausted atomic pools Date: Wed, 4 Feb 2026 15:40:25 +0100 Message-ID: <20260204143846.428114002@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143845.603454952@linuxfoundation.org> References: <20260204143845.603454952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sai Sree Kartheek Adivi [ Upstream commit 56c430c7f06d838fe3b2077dbbc4cc0bf992312b ] Currently, dma_alloc_from_pool() unconditionally warns and dumps a stack trace when an allocation fails, with the message "Failed to get suitable pool". This conflates two distinct failure modes: 1. Configuration error: No atomic pool is available for the requested DMA mask (a fundamental system setup issue) 2. Resource Exhaustion: A suitable pool exists but is currently full (a recoverable runtime state) This lack of distinction prevents drivers from using __GFP_NOWARN to suppress error messages during temporary pressure spikes, such as when awaiting synchronous reclaim of descriptors. Refactor the error handling to distinguish these cases: - If no suitable pool is found, keep the unconditional WARN regarding the missing pool. - If a pool was found but is exhausted, respect __GFP_NOWARN and update the warning message to explicitly state "DMA pool exhausted". Fixes: 9420139f516d ("dma-pool: fix coherent pool allocations for IOMMU mappings") Signed-off-by: Sai Sree Kartheek Adivi Reviewed-by: Robin Murphy Signed-off-by: Marek Szyprowski Link: https://lore.kernel.org/r/20260128133554.3056582-1-s-adivi@ti.com Signed-off-by: Sasha Levin --- kernel/dma/pool.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c index b3b9c7ec5fc54..8a15b5008b20c 100644 --- a/kernel/dma/pool.c +++ b/kernel/dma/pool.c @@ -268,15 +268,20 @@ struct page *dma_alloc_from_pool(struct device *dev, size_t size, { struct gen_pool *pool = NULL; struct page *page; + bool pool_found = false; while ((pool = dma_guess_pool(pool, gfp))) { + pool_found = true; page = __dma_alloc_from_pool(dev, size, pool, cpu_addr, phys_addr_ok); if (page) return page; } - WARN(1, "Failed to get suitable pool for %s\n", dev_name(dev)); + if (pool_found) + WARN(!(gfp & __GFP_NOWARN), "DMA pool exhausted for %s\n", dev_name(dev)); + else + WARN(1, "Failed to get suitable pool for %s\n", dev_name(dev)); return NULL; } -- 2.51.0