lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+Sunn-C-pcG3utPQsx4qykYJ9kLvS2FVZPMELALcq0UA@mail.gmail.com>
Date:   Tue, 10 Jan 2023 09:35:20 +0100
From:   Eric Dumazet <edumazet@...gle.com>
To:     Geethasowjanya Akula <gakula@...vell.com>
Cc:     Leon Romanovsky <leon@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        Subbaraya Sundeep Bhatta <sbhatta@...vell.com>,
        Hariprasad Kelam <hkelam@...vell.com>,
        Sunil Kovvuri Goutham <sgoutham@...vell.com>
Subject: Re: [net PATCH] octeontx2-pf: Use GFP_ATOMIC in atomic context

On Tue, Jan 10, 2023 at 8:54 AM Geethasowjanya Akula <gakula@...vell.com> wrote:
>
>
>
> -----Original Message-----
> From: Leon Romanovsky <leon@...nel.org>
> Sent: Sunday, January 8, 2023 6:39 PM
> To: Geethasowjanya Akula <gakula@...vell.com>
> Cc: netdev@...r.kernel.org; linux-kernel@...r.kernel.org; kuba@...nel.org; pabeni@...hat.com; davem@...emloft.net; edumazet@...gle.com; Subbaraya Sundeep Bhatta <sbhatta@...vell.com>; Hariprasad Kelam <hkelam@...vell.com>; Sunil Kovvuri Goutham <sgoutham@...vell.com>
> Subject: [EXT] Re: [net PATCH] octeontx2-pf: Use GFP_ATOMIC in atomic context
>
> 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 = 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 possible.

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 88f8772a61cd527c2ab138fb5a996470a7dfd456..2e628e12cd1ff92756f054639abd777ea185680f
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 = 0; qidx < hw->tot_tx_queues; qidx++) {
                pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx);
@@ -1388,13 +1387,17 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf)
                        err = 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++] = (u64)bufptr;
                }
        }

 err_mem:
-       put_cpu();
        return err ? -ENOMEM : 0;

 fail:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ