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 0DACD2BE03C; Wed, 4 Feb 2026 15:14:35 +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=1770218075; cv=none; b=TPrClety76+Hwkc3CbjD/oDOqsBJobacWLYt8ZcwCokBeow3ZKuapOdF13XVnqs/cAWnV9eWrGsp1fqSMku3KiaPnZsr2whii/Q1J7ZUKuyzhRz9wRA4sP2HDZLiBrx0Un2E/QP0xaQw1iJHK6HpFdIH4llpmqDq1McLv0e1Idw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218075; c=relaxed/simple; bh=DBvbAyevE239JXESMDYh6N6RY29fNAh1rR8jnOH4Ln0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=awCg4lUCu2gBdjDxnXugrxdCa2ZSyy/o19RDeNb3uduM+iMCLJDZHuLLqpkkshmEgnCwGI+tm7uJELHiAS3gZeXu6Ducz6H/DDwNBubvX3GMJXuP+YePVXrylCbqD1iVhbdEoaStGA9qNqJZjG0Cz/xGF15gfjGZdRekDC8MXr0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uV50p0jJ; 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="uV50p0jJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEC0FC4CEF7; Wed, 4 Feb 2026 15:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770218074; bh=DBvbAyevE239JXESMDYh6N6RY29fNAh1rR8jnOH4Ln0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uV50p0jJv3AR+XM98nKBmie9THyM0AnR4Hr2b1nriaVyRSjINanhrwcfTYUu70ZRF EgbIDT3f29icDMCqW9idCS2gG7eRT26QeKCtkzEQmjKwbYLUyAnTcLOX8tEc4kIDgW f6Kytsnr/M9r+tkBWZQp0TVz3OTRQsrfLOSrEr7c= 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.1 205/280] dma/pool: distinguish between missing and exhausted atomic pools Date: Wed, 4 Feb 2026 15:39:39 +0100 Message-ID: <20260204143916.977969320@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143909.614719725@linuxfoundation.org> References: <20260204143909.614719725@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.1-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 1e9d4cb018693..8fc6e3b8f8372 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