[Bug 284057] vmxnet3/iflib: crash in vmxnet3_isc_txd_credits_update

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 21 Jan 2025 15:36:00 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284057

--- Comment #11 from Andriy Gapon <avg@FreeBSD.org> ---
(In reply to Mark Johnston from comment #10)
The spin-lock should be a straightforward and sure-fire way to ensure race-free
execution.
Thank you for the suggestion.

At the same time I've been wondering if my earlier patch broke things because
of vxcr_gen.
I see that in other drivers isc_txd_credits_update methods are also not
protected from races.
But they try to not change things until the very end which probably reduces the
window
where any inconsistency can be observed.
But vmxnet3 changes vcxr_next, vxtxr_next and vxcr_gen in each iteration.

I am also still concerned that some fundamental assumption in iflib is broken
either by iflib itself or by vmxnet3.
Code in the transmit path gives an impression that it was not supposed to be
executed concurrently.

Returning back to your proposal, my immediate concern is where to put the
spinlock, where
to init it and where to destroy it.
I think that struct vmxnet3_txqueue may be a good place for it.
Then, vmxnet3_init_txq seems like a natural place to initialize the lock.
But I am a bit stuck figuring out where to destroy it.

-- 
You are receiving this mail because:
You are the assignee for the bug.