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 8A68E4218B5; Wed, 4 Feb 2026 14:59:48 +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=1770217188; cv=none; b=NOnW//fCoRKNSYFwnyPoNdHYbbfbu/DxqFweyaGl11oLehjbeQbVKBlDKWNH/CluvwjraW+FGjcUJVBFdYQQPjO/Igvc2GSDnNzEUkYd9aZi0+4hBoipqo6N0/YT+zBy8azYiW6j0/b9xdZ8xvsmEUiVnM74mMPh9Hc+nzPRtcM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217188; c=relaxed/simple; bh=Id9dEH4mAyYoseVuQD5KFGS4i3dYd7tj74Pf6CvCf9A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=je5Se5uLdf37sDMqRVkHOK7k+My7djrBv2IAFzCh5HpWKuUt0ptlX3rfs6VEZYj3FfOZfv7zTvEIjXlULFo+kC+asgRqUSKOVK2bhmMCoO8pe9t6yKVZfpuueVIJejN/R14JQXTNt2QxfXffgGPL0YaZfujY18NsxcL/zaEA9oI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hr9owZAg; 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="hr9owZAg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04632C4CEF7; Wed, 4 Feb 2026 14:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770217188; bh=Id9dEH4mAyYoseVuQD5KFGS4i3dYd7tj74Pf6CvCf9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hr9owZAgiQMLrSbGuQEPerjVps9gD4BEM6DR8CRF3Bm8sgdqBgGJ4ToAzKP4TjwcZ gatXqCEGkcd3KM+DDeHVZ1zuVn2FgJDS7SB+D/TsofTgG9F4CsqcdYTUk/sI/lZFUS N67pXRwE1QLN5Z90i/BSrokRYoeJll0m6iSdr2BU= 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 5.15 150/206] dma/pool: distinguish between missing and exhausted atomic pools Date: Wed, 4 Feb 2026 15:39:41 +0100 Message-ID: <20260204143903.607667485@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143858.193781818@linuxfoundation.org> References: <20260204143858.193781818@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 5.15-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