[Devel] [PATCH RHEL COMMIT] bnx2x: Suppress warnings on DMA memory allocation

Konstantin Khorenko khorenko at virtuozzo.com
Thu Sep 30 16:04:02 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit de6c13eb7ca898b6e414941efffd43143ed5cc99
Author: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Date:   Thu Sep 30 16:04:02 2021 +0300

    bnx2x: Suppress warnings on DMA memory allocation
    
    Suppress all allocator's warnings to skip checking for high page order,
    and re-raise own warning if the allocation failed.
    
    https://jira.sw.ru/browse/HCI-140
    
    Signed-off-by: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
    
    Acked-by: Denis V. Lunev <den at openvz.org>
    
    Rebased to vz8:
     - dma_zalloc_coherent -> dma_alloc_coherent since it is now zeroing memory
    
    (cherry-picked from vz7 commit 8c91e519af93 ("bnx2x: suppress warnings on DMA
    memory allocation"))
    
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
    
    khorenko@: replaced generic flag __GFP_NOWARN with vz specific
    __GFP_ORDER_NOWARN.
    
    (cherry picked from vz8 commit 6d8af521756464a73eee319ca6e329454c452db3)
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index d8b1824c334d..d805feaf419f 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -52,22 +52,26 @@ extern int bnx2x_num_queues;
 
 #define BNX2X_PCI_ALLOC(y, size)					\
 ({									\
-	void *x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
+	void *x = dma_alloc_coherent(&bp->pdev->dev, size, y,		\
+				      GFP_KERNEL | __GFP_ORDER_NOWARN);	\
 	if (x)								\
 		DP(NETIF_MSG_HW,					\
 		   "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n",	\
 		   (unsigned long long)(*y), x);			\
+	WARN_ON(!x);							\
 	x;								\
 })
 #define BNX2X_PCI_FALLOC(y, size)					\
 ({									\
-	void *x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
+	void *x = dma_alloc_coherent(&bp->pdev->dev, size, y,		\
+				     GFP_KERNEL | __GFP_ORDER_NOWARN);	\
 	if (x) {							\
 		memset(x, 0xff, size);					\
 		DP(NETIF_MSG_HW,					\
 		   "BNX2X_PCI_FALLOC: Physical %Lx Virtual %p\n",	\
 		   (unsigned long long)(*y), x);			\
 	}								\
+	WARN_ON(!x);							\
 	x;								\
 })
 


More information about the Devel mailing list