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

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 25 12:16:42 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.33
------>
commit 8310450b0d3ae51dee4b2934e24320abdee641dc
Author: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Date:   Tue May 25 12:16:42 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.
---
 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 5ae3c97ea685..8c1887dddf60 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