[PATCH] net: stmmac: protect statistics updates with a spinlock

Andrew Lunn andrew at lunn.ch
Fri Jan 5 09:36:45 PST 2024


> This only leaves an atomic_t in hard irq context. I have tried to find
> something that could relax the requirement, but AFAICS at least some
> setups use several interrupts that can be delivered to different CPUs
> simultaneously, and all of them will walk over all channels. So we're
> left with an atomic_t here.

You might want to consider per CPU statistics. Since each CPU has its
own structure of statistics, you don't need atomic.

The code actually using the statistics then needs to sum up the per
CPU statistics, and using syncp should be sufficient for that.

Maybe look at mvneta.c for inspiration.

      Andrew



More information about the linux-arm-kernel mailing list