Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp133755ybc; Mon, 18 Nov 2019 21:54:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxiTRrxa0o8BaYfdBoRw9ubMxxZlD1zcMjLPwPdxY0MpV1SK9jUvmVId91+YdF2Lw4eoVZp X-Received: by 2002:a17:906:4d99:: with SMTP id s25mr33270538eju.187.1574142887718; Mon, 18 Nov 2019 21:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574142887; cv=none; d=google.com; s=arc-20160816; b=Q5VfQYshm/Pyu+QyGF7BQkRNU/GSWH5nB41iBJiQeOPxMEQZsVdRxI7KrfdXe1Vz/u oAHaAStlOabgy8XLPQvK0aFGxXTjb1FRRlKVtBmvwC/UTZ+puzDgX96zGIiYersCybZc xCwHG+aTieSmcjH5bJ33P4CJ91QSug1vTC62gE8gOM7kwhwoLEKRp09zwtIUClu3TLEY vL//K+2nfxtdTqN60NFMNbH9hqUkIVbbsgSrPZPMqaJTGXRgI9AXkP0NiCkI/fV2swEg HaeHNH52o4JecjAXDdWt5t67KJ5mi3ufj+9j/q2+iGo4hC21zkzPFyXwZxpWwN5bzjXk ec6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fEVfkirnuBmbLGiQ+zKxMqn7gHcc7AqOfr01eO+Xrto=; b=OQbAxJr1Pz/+r/PvcM48YyXyO6Q4gImyYGmeZbJrQMN0tEVrI/eQAGeYMmISYrjHam PvweKcx6xA1pvgyqf4X9TgPGH+Fy7wNGITJX2B8CYv6V42JfSKMyHFHv3XT/TAP2vJnd 9PUFEdbD3icQPnEqdPnF62KScyxokwEq3cPG4QTksBsx/bWzAQeio66yZ3SZczY4ftOK dcXhSuZ6z8Jz48dFX9ZrOY8Vfmac63B0XhIBB8HGoYFHyBl+NlLK9ete5OAdJYmYzu5K PGRJ4x1j/cSkFUhdvfiAtUiXiF2XuE06AVnxZJALueVs9Gp7xoIytRo17lxsJY6FYY6W RG3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EjrftUXJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gu7si13249398ejb.405.2019.11.18.21.54.23; Mon, 18 Nov 2019 21:54:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EjrftUXJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731717AbfKSFvC (ORCPT + 99 others); Tue, 19 Nov 2019 00:51:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:48282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731362AbfKSFu7 (ORCPT ); Tue, 19 Nov 2019 00:50:59 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 11F6B20862; Tue, 19 Nov 2019 05:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142658; bh=M2yOs9afGDUJ0xsdPlqgFgcEldyZBxj7OSIeQV5vXzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EjrftUXJ9ruN+Z11DJt1ckeNLnpySrNt3vJG8+uHCd/HKey9cJVO/O4gBpdIjOkcm z8mJ6T0tS9Y6vLn0uRrtgB/H4CgcEZf/ur5wDzPBcpZ9l9lwjL97tHvGdiwZEEX7t3 j/hdiEkxP6OJklsksAMi4t3k9sAOOEzZQdvA89Ik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Dirk van der Merwe , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 155/239] nfp: provide a better warning when ring allocation fails Date: Tue, 19 Nov 2019 06:19:15 +0100 Message-Id: <20191119051332.996563602@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski [ Upstream commit 23d9f5531c7c28546954b0bf332134a9b8a38c0a ] NFP supports fairly enormous ring sizes (up to 256k descriptors). In commit 466271703867 ("nfp: use kvcalloc() to allocate SW buffer descriptor arrays") we have started using kvcalloc() functions to make sure the allocation of software state arrays doesn't hit the MAX_ORDER limit. Unfortunately, we can't use virtual mappings for the DMA region holding HW descriptors. In case this allocation fails instead of the generic (and fairly scary) warning/splat in the logs print a helpful message explaining what happened and suggesting how to fix it. Signed-off-by: Jakub Kicinski Reviewed-by: Dirk van der Merwe Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../net/ethernet/netronome/nfp/nfp_net_common.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 6df2c8b2ce6f3..bffa25d6dc294 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -2169,9 +2169,13 @@ nfp_net_tx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring) tx_ring->size = sizeof(*tx_ring->txds) * tx_ring->cnt; tx_ring->txds = dma_zalloc_coherent(dp->dev, tx_ring->size, - &tx_ring->dma, GFP_KERNEL); - if (!tx_ring->txds) + &tx_ring->dma, + GFP_KERNEL | __GFP_NOWARN); + if (!tx_ring->txds) { + netdev_warn(dp->netdev, "failed to allocate TX descriptor ring memory, requested descriptor count: %d, consider lowering descriptor count\n", + tx_ring->cnt); goto err_alloc; + } sz = sizeof(*tx_ring->txbufs) * tx_ring->cnt; tx_ring->txbufs = kzalloc(sz, GFP_KERNEL); @@ -2314,9 +2318,13 @@ nfp_net_rx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_rx_ring *rx_ring) rx_ring->cnt = dp->rxd_cnt; rx_ring->size = sizeof(*rx_ring->rxds) * rx_ring->cnt; rx_ring->rxds = dma_zalloc_coherent(dp->dev, rx_ring->size, - &rx_ring->dma, GFP_KERNEL); - if (!rx_ring->rxds) + &rx_ring->dma, + GFP_KERNEL | __GFP_NOWARN); + if (!rx_ring->rxds) { + netdev_warn(dp->netdev, "failed to allocate RX descriptor ring memory, requested descriptor count: %d, consider lowering descriptor count\n", + rx_ring->cnt); goto err_alloc; + } sz = sizeof(*rx_ring->rxbufs) * rx_ring->cnt; rx_ring->rxbufs = kzalloc(sz, GFP_KERNEL); -- 2.20.1