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: <fca00e5f-638b-4457-8832-f8458899ecc8@amd.com>
Date: Mon, 9 Sep 2024 17:56:01 -0700
From: "Nelson, Shannon" <shannon.nelson@....com>
To: Sean Anderson <sean.anderson@...ux.dev>,
 Radhey Shyam Pandey <radhey.shyam.pandey@....com>,
 "David S . Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org
Cc: Robert Hancock <robert.hancock@...ian.com>, linux-kernel@...r.kernel.org,
 Michal Simek <michal.simek@....com>, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH net] net: xilinx: axienet: Schedule NAPI in two steps

On 9/9/2024 4:19 PM, Sean Anderson wrote:
> 
> As advised by Documentation/networking/napi.rst, masking IRQs after
> calling napi_schedule can be racy. Avoid this by only masking/scheduling
> if napi_schedule_prep returns true. Additionally, since we are running
> in an IRQ context we can use the irqoff variant as well.
> 
> Fixes: 9e2bc267e780 ("net: axienet: Use NAPI for TX completion path")
> Fixes: cc37610caaf8 ("net: axienet: implement NAPI and GRO receive")
> Signed-off-by: Sean Anderson <sean.anderson@...ux.dev>

Reviewed-by: Shannon Nelson <shannon.nelson@....com>

> ---
> 
>   drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 9eb300fc3590..4f67072d5149 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -1222,9 +1222,10 @@ static irqreturn_t axienet_tx_irq(int irq, void *_ndev)
>                  u32 cr = lp->tx_dma_cr;
> 
>                  cr &= ~(XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_DELAY_MASK);
> -               axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, cr);
> -
> -               napi_schedule(&lp->napi_tx);
> +               if (napi_schedule_prep(&lp->napi_tx)) {
> +                       axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, cr);
> +                       __napi_schedule_irqoff(&lp->napi_tx);
> +               }
>          }
> 
>          return IRQ_HANDLED;
> @@ -1266,9 +1267,10 @@ static irqreturn_t axienet_rx_irq(int irq, void *_ndev)
>                  u32 cr = lp->rx_dma_cr;
> 
>                  cr &= ~(XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_DELAY_MASK);
> -               axienet_dma_out32(lp, XAXIDMA_RX_CR_OFFSET, cr);
> -
> -               napi_schedule(&lp->napi_rx);
> +               if (napi_schedule_prep(&lp->napi_rx)) {
> +                       axienet_dma_out32(lp, XAXIDMA_RX_CR_OFFSET, cr);
> +                       __napi_schedule_irqoff(&lp->napi_rx);
> +               }
>          }
> 
>          return IRQ_HANDLED;
> --
> 2.35.1.1320.gc452695387.dirty
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ