Message ID | 20230103040917.16151-1-gakula@marvell.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4433103wrt; Mon, 2 Jan 2023 20:17:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXuMY6VWndUs2Yvql2Mw8y1lsQjWIwBNxOWA1w9/wWd9NcOS5Kd5HVlZvQI088ukFAjP0+Sn X-Received: by 2002:a17:907:7da1:b0:7c0:d6b6:1ee9 with SMTP id oz33-20020a1709077da100b007c0d6b61ee9mr45282208ejc.11.1672719426163; Mon, 02 Jan 2023 20:17:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672719426; cv=none; d=google.com; s=arc-20160816; b=tYJCmcHbsuf8s2CqWE8nD+KKNXA8/Y7nouL451RKET9uypFhBT+WGHh+b3m+0akrwF OyD/ml1qoe1Glpw21XWOWLBOoip99da0C7KoLcretVefJYcdIGxswPwyfNusaoK2pV0w +7TNehc6cxfSYg2iMyiMXWZHuThSpX6zx7jIv4dyz/B0AqmEgYhcT9YuO/vtilSIrTo0 60elwjcU3QIm1K8xjJGvTCoaG1q4OpjYWEZFt57ImBJKMU89LWfkkbcK89dH+mpvGfuq B/szihDdJhRkSNPkZyKaAn4T4DqKqfs71E/MEgmj3coXfKxEMvtx9dVrq8ItuFLAUwpo jFQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=80oMAZ+XdV0nAXdYCOgANs9JArpVFoeo/x/Rs+bA+QM=; b=WKqtzZENKeoDr2ErIV3Bc1f6VxC5QyTIZRnDgsUANqypL82hTMF6vPcxgN1jnC4luD CvhbTDDrn/f/4xR9w3x6TIeEM1TTPh8cmRr4eLiyXTynHAZLIBYV8OVHHLiD4DOpoH0g 09ADHG4ZabxRoMYSLGOHX3bvGXdMpUqEvNLxS37vw21ytLPzba3AuM9BoC19IT2oRWPl F1F+0UIozMNfybSAeqiM1rHwB9qtF17iUczSDtrcWy/ax1l9Cg/t/D6ICaygFWw+fEql due+QiWQVsLJDNv3ZWhNJHfq4+rjhckXM/gvyJjzXKlIQ/ASv8rKLmTeE1gmp4kAB8WR m6mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Hjwa5AAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xf6-20020a17090731c600b007c0eb3849adsi26706782ejb.716.2023.01.02.20.16.41; Mon, 02 Jan 2023 20:17:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Hjwa5AAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236662AbjACEJk (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Mon, 2 Jan 2023 23:09:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230071AbjACEJg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 2 Jan 2023 23:09:36 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6801BB8; Mon, 2 Jan 2023 20:09:34 -0800 (PST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3033dlcX007869; Mon, 2 Jan 2023 20:09:27 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=80oMAZ+XdV0nAXdYCOgANs9JArpVFoeo/x/Rs+bA+QM=; b=Hjwa5AAEqFqcCVuwGvbUZX8Ys1ifrNho1DhWfUA4RfK5O2M8DFtuLZ4VEfrl8aJ8C3z9 DkfSlbQQI5Q8vkC8PJs4u/sdOfv/dZ2W7yCP5MSH8uV5XnmBcslB6jv9P9na5xtoUxkB XgJm1lKK+DXUSR/J0YHjaY5QPW9+b5NoJnFa5epaMzZFvqjWDhmC0QX0xFcyUwXoIiKI EJHbj1gZudyU/dO8MLIXiOIh885hkPWKvrM48fZWqpKChlkorrdpcGPvcB885BucBTbw x3ZgnuMemOCXeQ/cR0WHVV5agw+yYHNlSIVqJwJ470E0e30GoCeHMVkvPE6WwKsPhw9X SA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mtkauv9vs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 02 Jan 2023 20:09:27 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 2 Jan 2023 20:09:25 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Mon, 2 Jan 2023 20:09:25 -0800 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 636493F7050; Mon, 2 Jan 2023 20:09:22 -0800 (PST) From: Geetha sowjanya <gakula@marvell.com> To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <kuba@kernel.org>, <pabeni@redhat.com>, <davem@davemloft.net>, <edumazet@google.com>, <sbhatta@marvell.com>, <hkelam@marvell.com>, <gakula@marvell.com>, <sgoutham@marvell.com> Subject: [PATCH net] octeontx2-af: Fix QMEM struct memory allocation Date: Tue, 3 Jan 2023 09:39:17 +0530 Message-ID: <20230103040917.16151-1-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: gjDOZzwf_FQCzxah32j_04eGWyzPyoBn X-Proofpoint-ORIG-GUID: gjDOZzwf_FQCzxah32j_04eGWyzPyoBn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-02_14,2022-12-30_01,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753973445249439424?= X-GMAIL-MSGID: =?utf-8?q?1753973445249439424?= |
Series |
[net] octeontx2-af: Fix QMEM struct memory allocation
|
|
Commit Message
Geetha sowjanya
Jan. 3, 2023, 4:09 a.m. UTC
Currently NIX, NPA queue context memory is being allocated using GFP_KERNEL flag which inturns allocates from memory reserved for CMA_DMA. Sizing CMA_DMA memory is getting difficult due to this dependency, the more number of interfaces enabled the more the CMA_DMA memory requirement. To address this issue, GFP_KERNEL flag is replaced with GFP_ATOMIC, with this memory will be allocated from unreserved memory. Fixes: 7a37245ef23f ("octeontx2-af: NPA block admin queue init") Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Signed-off-by: Geetha sowjanya <gakula@marvell.com> --- drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Jan 3, 2023 at 9:39 AM Geetha sowjanya <gakula@marvell.com> wrote: > > Currently NIX, NPA queue context memory is being allocated using > GFP_KERNEL flag which inturns allocates from memory reserved for > CMA_DMA. Sizing CMA_DMA memory is getting difficult due to this > dependency, the more number of interfaces enabled the more the > CMA_DMA memory requirement. > > To address this issue, GFP_KERNEL flag is replaced with GFP_ATOMIC, > with this memory will be allocated from unreserved memory. > > Fixes: 7a37245ef23f ("octeontx2-af: NPA block admin queue init") > Signed-off-by: Sunil Goutham <sgoutham@marvell.com> > Signed-off-by: Geetha sowjanya <gakula@marvell.com> > --- > drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/common.h b/drivers/net/ethernet/marvell/octeontx2/af/common.h > index 8931864ee110..4b4be9ca4d2f 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/af/common.h > +++ b/drivers/net/ethernet/marvell/octeontx2/af/common.h > @@ -61,7 +61,7 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q, > qmem->entry_sz = entry_sz; > qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN; > qmem->base = dma_alloc_attrs(dev, qmem->alloc_sz, &qmem->iova, > - GFP_KERNEL, DMA_ATTR_FORCE_CONTIGUOUS); > + GFP_ATOMIC, DMA_ATTR_FORCE_CONTIGUOUS); I am not understanding the problem this change is solving. Can you describe the issue in some detail? What do you mean when you say GFP_ATOMIC allocates the memory from unreserved memory? > if (!qmem->base) > return -ENOMEM; > > -- > 2.25.1 >
On Tue, Jan 03, 2023 at 09:39:17AM +0530, Geetha sowjanya wrote: > Currently NIX, NPA queue context memory is being allocated using > GFP_KERNEL flag which inturns allocates from memory reserved for > CMA_DMA. Sizing CMA_DMA memory is getting difficult due to this > dependency, the more number of interfaces enabled the more the > CMA_DMA memory requirement. > > To address this issue, GFP_KERNEL flag is replaced with GFP_ATOMIC, > with this memory will be allocated from unreserved memory. No, GFP_ATOMIC is for memory allocations in atomic context and not for separation between reserved and unreserved memory. There is no any explanation to use GFP_ATOMIC except being in atomic context. Thanks
On Tue, 3 Jan 2023 12:05:51 +0200 Leon Romanovsky wrote: > No, GFP_ATOMIC is for memory allocations in atomic context and not for > separation between reserved and unreserved memory. Indeed, using ATOMIC to avoid CMA seems like an odd hack. I haven't encountered this before.
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/common.h b/drivers/net/ethernet/marvell/octeontx2/af/common.h index 8931864ee110..4b4be9ca4d2f 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/common.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/common.h @@ -61,7 +61,7 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q, qmem->entry_sz = entry_sz; qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN; qmem->base = dma_alloc_attrs(dev, qmem->alloc_sz, &qmem->iova, - GFP_KERNEL, DMA_ATTR_FORCE_CONTIGUOUS); + GFP_ATOMIC, DMA_ATTR_FORCE_CONTIGUOUS); if (!qmem->base) return -ENOMEM;