Re: [PATCH v2 net] net: enetc: survive memory pressure without crashing

From: Vladimir Oltean
Date: Thu Oct 27 2022 - 14:03:05 EST


On Thu, Oct 27, 2022 at 10:58:24AM -0700, Jakub Kicinski wrote:
> On Wed, 26 Oct 2022 15:13:30 +0300 Vladimir Oltean wrote:
> > To fix this problem, memset the DMA coherent area used for RX buffer
> > descriptors in enetc_dma_alloc_bdr(). This makes all BDs be "not ready"
> > by default, which makes enetc_clean_rx_ring() exit early from the BD
> > processing loop when there is no valid buffer available.
>
> IIRC dma_alloc_coherent() always zeros, and I'd guess there is a cocci
> script that checks this judging but the number of "fixes" we got for
> this in the past.
>
> scripts/coccinelle/api/alloc/zalloc-simple.cocci ?

Yeah, ok, fair, I guess only the producer/consumer indices were the problem,
then. The "junk" I was seeing in the buffer descriptors was the "Ready"
bit caused by the hardware thinking it owns all BDs when in fact it
owned none of them.

Is there a chance the patch makes it for this week's PR if I amend it
really quick?