Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7464260rwl; Tue, 10 Jan 2023 00:51:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXvteAc5/TDs8uRgioicIA5hT0oYq6KqCBET9qTXkXQbsDtFfqlkmpJN6b5zEh8s3xNH+0C8 X-Received: by 2002:a17:90a:930f:b0:225:be98:f5b5 with SMTP id p15-20020a17090a930f00b00225be98f5b5mr62471800pjo.23.1673340668193; Tue, 10 Jan 2023 00:51:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673340668; cv=none; d=google.com; s=arc-20160816; b=lEJkwMMwkYVmTIf9HQ8S9Pn7+dW8QxxzPgGgKjY/9SezUnAOtm6cKsH9fqrjIXaaVT uKhbf2+Pxjdrfd16IuzPk+uArxVTI2y1rUy4dPCh0gJTKq1jxZMZLR1vH4xZ77KbBLwi pCWkksSUk5JpRWhKg1gv2B8g5ZHXeZFmJfbsLG0y42hiZQQuxZDNViOdOaGvokhLRRlk IUYeXxtTi9ajYbmgAb4bgWt/6np26gE5ZfqDDfSkQDk9jXymEyKxqDHlRwZcwlyXsnWR cCYyRTyFb9dqb50AkD3sieJx0DWSyWjfnN+046b/n2NtArfjy9crRJRXUXp03YhSX0tP GYkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=iut40nCHyytrA7iXMWilpOeK2BSxhph4VUkz02uA4d8=; b=zlWpKQkIbVi95cuUTSzbSETN7xNURhcvsWEyyIbaAFWXAb7xpF3WRJPsqnhm/C5zBk vfLl7H6YX62ynOm5Xm9wDgc+QJwiJPIwb/WI1uZ+AGE65/TsrdDuvyxU17z6kQoVbYfC MWgMdB0UFYQ2Sx112G6sIZ6RAq9v2K7u0FNcFL2A3Q5+VSFEW0ZrVoqpBbvCiSSezrCC nGXO+6VsHxAnrhNjb9fDwPXGeHyg+VpgawTK74lZNN9m83YGIV+AtNidzLlXtYmmN+Q2 BsEJOvNLoGqI6ZXyw78V7rBTez+BbFTNF8tHk1ZpBEGAtTw4iwiBS7tJuiS5OfkLkC9p rlAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=L5eoPVPo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr18-20020a17090b4b9200b00228cb3af4aasi1534972pjb.99.2023.01.10.00.51.01; Tue, 10 Jan 2023 00:51:08 -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=@google.com header.s=20210112 header.b=L5eoPVPo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237961AbjAJIgB (ORCPT + 53 others); Tue, 10 Jan 2023 03:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237458AbjAJIfo (ORCPT ); Tue, 10 Jan 2023 03:35:44 -0500 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB9E4D4AA for ; Tue, 10 Jan 2023 00:35:32 -0800 (PST) Received: by mail-yb1-xb2d.google.com with SMTP id 16so11118389ybc.0 for ; Tue, 10 Jan 2023 00:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iut40nCHyytrA7iXMWilpOeK2BSxhph4VUkz02uA4d8=; b=L5eoPVPo7ZAZ7gklj8aJC5o9QP/VoFpQtXh7YLZkM40XlrlyrBY4vjBnObDmHe0ZwP eaVDCUbgOC4v0ul4LF6Ff0CmJqbJ3dsYH0obFDYNf5Yi7QXQ9Bx9Pz+CMtgr4q5QyQaQ Jhi0Bszh7MbQBYYprBwqdCLbABBPmfmwmtMGw2O4HJcadFKbQos9zixOWIMe0isu50Yl /PmqTon95rNbIL8EPPIga3aSe4fX4g7yqIbBIfFKOCZjhaZoz1rCI83+X7WP4JXjzc75 VVm6SWJKiOR0Hs6wm0yD8MYD7mHVBS+3JnvwQIe4OsCsit3FUoVnbsknsMC23QsZJitg yPAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iut40nCHyytrA7iXMWilpOeK2BSxhph4VUkz02uA4d8=; b=tEnFvLi5nJRX76ueocfPBTvgoTZfqzrep3TVfWPfKwPY8WV5OjbC4aTRHYOmqpg+7G pgXGVPDm76NS0XpgZnKe6S9AD1FPNmG5JAvlFCc3fgKOUieRCu74VSYdHykEVbDHeCGr z+PjA9CmDA6SRW0HELATdajidi5zf+dmZ2KegIrrCOT9nVmPLfkAlNpYg4AKr5yMq/Op Xkki4Kme4hanuybJAgAfJ1+/gfsSqjM79+9FtjSp1w6SPPxDLA6pyDnn6kQp2MeiWCDg jcMP6zcII3xQcYM1JwUJV15LGEopvrtFU2KejYs7cxR0zAtzCEjWV6Er2HQlzQD6Oeqy jljA== X-Gm-Message-State: AFqh2koIdVGWBcWucbCTuiUY1UEeIsJzO2QIv/kS4opEms60tsF7Fbzy ULx6rGtM/qNoW47p+2HXuEq7jaPume753+ryMDoKmQ== X-Received: by 2002:a25:8f89:0:b0:7b3:bb8:9daf with SMTP id u9-20020a258f89000000b007b30bb89dafmr1307710ybl.427.1673339731765; Tue, 10 Jan 2023 00:35:31 -0800 (PST) MIME-Version: 1.0 References: <20230107044139.25787-1-gakula@marvell.com> In-Reply-To: From: Eric Dumazet Date: Tue, 10 Jan 2023 09:35:20 +0100 Message-ID: Subject: Re: [net PATCH] octeontx2-pf: Use GFP_ATOMIC in atomic context To: Geethasowjanya Akula Cc: Leon Romanovsky , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kuba@kernel.org" , "pabeni@redhat.com" , "davem@davemloft.net" , Subbaraya Sundeep Bhatta , Hariprasad Kelam , Sunil Kovvuri Goutham Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 10, 2023 at 8:54 AM Geethasowjanya Akula w= rote: > > > > -----Original Message----- > From: Leon Romanovsky > Sent: Sunday, January 8, 2023 6:39 PM > To: Geethasowjanya Akula > Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; kuba@kernel.org= ; pabeni@redhat.com; davem@davemloft.net; edumazet@google.com; Subbaraya Su= ndeep Bhatta ; Hariprasad Kelam ; = Sunil Kovvuri Goutham > Subject: [EXT] Re: [net PATCH] octeontx2-pf: Use GFP_ATOMIC in atomic con= text > > External Email > > ---------------------------------------------------------------------- > On Sat, Jan 07, 2023 at 10:11:39AM +0530, Geetha sowjanya wrote: > >> Use GFP_ATOMIC flag instead of GFP_KERNEL while allocating memory in > >> atomic context. > > >Awesome, but the changed functions don't run in atomic context. > > drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c > 1368 /* Flush accumulated messages */ > 1369 err =3D otx2_sync_mbox_msg(&pfvf->mbox); > 1370 if (err) > 1371 goto fail; > 1372 > 1373 get_cpu(); > ^^^^^^^^^ > The get_cpu() disables preemption. Forcing GFP_ATOMIC in init functions is not desirable. Please move around the get_cpu() so that we keep GFP_KERNEL whenever possib= le. diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c index 88f8772a61cd527c2ab138fb5a996470a7dfd456..2e628e12cd1ff92756f054639ab= d777ea185680f 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c @@ -1370,7 +1370,6 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) if (err) goto fail; - get_cpu(); /* Allocate pointers and free them to aura/pool */ for (qidx =3D 0; qidx < hw->tot_tx_queues; qidx++) { pool_id =3D otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx); @@ -1388,13 +1387,17 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) err =3D otx2_alloc_rbuf(pfvf, pool, &bufptr); if (err) goto err_mem; + /* __cn10k_aura_freeptr() needs to be called + * with preemption disabled. + */ + get_cpu(); pfvf->hw_ops->aura_freeptr(pfvf, pool_id, bufptr); + put_cpu(); sq->sqb_ptrs[sq->sqb_count++] =3D (u64)bufptr; } } err_mem: - put_cpu(); return err ? -ENOMEM : 0; fail: