buf_ring in HEAD is racy

Adrian Chadd adrian at freebsd.org
Wed Dec 18 20:57:06 UTC 2013


On 17 December 2013 19:37, Ryan Stone <rysto32 at gmail.com> wrote:

> The trick with this is that if ALTQ is enabled then we will use if_snd
> queue instead of the buf ring, and if that queue drops then ifq_drops
> will be incremented.  With this patch if ALTQ is in use then we will
> not count any drops (as you will be overwriting the drop count from
> the queue).

Right. Well, that means it's a problem for at least the chelsio driver as well.

Hm, guess we could save the previous value of the sampled drops
counters and add the delta to the send queue?

Oh it gets more interesting - ip_output() also increments it if the
queue structure itself can't hold it. It doesn't even hold any locks
when it does that check so it's racy anyway. Aieee...

Let me think about it a bit more.

Thanks,



-adrian


More information about the freebsd-net mailing list