Re: [PATCH v3 net] net: solve a NAPI race
From: Eric Dumazet <hidden>
Date: 2017-02-28 13:10:33
On Tue, 2017-02-28 at 10:14 +0000, David Laight wrote:
From: Eric Dumazetquoted
Sent: 27 February 2017 22:35 On Mon, 2017-02-27 at 14:14 -0800, Stephen Hemminger wrote:quoted
The original design (as Davem mentioned) was that IRQ's must be disabled during device polling. If that was true, then the race above would be impossible.I would love to see an alternative patch.Can you test for 'receive data available' after telling the NAPI logic that you've finished? You'd then need to force a reschedule. I think your proposed patch will do a reschedule if any packet arrives during the receive processing, not just when one arrives right at the end. You might want to 'unset' the reschedule flag before each check of the receive ring. I also wonder about the cost of processing the MSI-X (I guess) interrupts compared to the cost of posted PCIe writes to disable and/or mask the interrupt generation. Clearly you don't want to do PCIe reads.
Have you seen the mlx4 patch I provided ? Then, I did not want to review 100+ NAPI drivers and provide patches for them. This generic solution is basically free. Same number of atomic operations. Given it took more than 2 years to even spot the bug, I have no idea how people on netdev expect me to review all drivers. This is crazy.