Page MenuHomeFreeBSD

Defer vlan register/deregister operations in mlxen.
AbandonedPublic

Authored by mjoras on Apr 4 2016, 5:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 31, 11:59 PM
Unknown Object (File)
Wed, Dec 31, 11:59 PM
Unknown Object (File)
Mon, Dec 29, 11:17 AM
Unknown Object (File)
Fri, Dec 26, 7:42 PM
Unknown Object (File)
Dec 15 2025, 2:13 AM
Unknown Object (File)
Nov 21 2025, 6:58 PM
Unknown Object (File)
Nov 5 2025, 6:15 PM
Unknown Object (File)
Oct 21 2025, 4:01 AM
Subscribers

Details

Reviewers
hselasky
Summary

This needs to be done to avoid a locking incompatibility with if_vlan's
rmlock(9).

Test Plan

ifconfig create/remove stress testing, internal vlan creation/removal tests.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 3126
Build 3159: arc lint + arc unit

Event Timeline

mjoras retitled this revision from to Defer vlan register/deregister operations in mlxen..
mjoras updated this object.
mjoras edited the test plan for this revision. (Show Details)
mjoras added a reviewer: hselasky.

Hi,

What code paths cannot sleep in the vlan filter callbacks?

This also affects mlx5en I believe. Would it be better to fix the caller than all of the clients?

--HPS

What code paths cannot sleep in the vlan filter callbacks?

This also affects mlx5en I believe. Would it be better to fix the caller than all of the clients?

With the non-sleepable rmlock(9) in both if_lagg and if_vlan, any vlan_config/unconfig event handler cannot sleep. Further, even if both of those rmlocks were changed to sleepable locks, the if_lagg vlan_config (see lagg_register_vlan) caller happens under a shared lock, not an exclusive lock, so it can never sleep per rmlock(9). This might be fixable by making the locks sleepable and making all calls to the vlan_config/unconfig event handlers under exclusive locks, but that seemed like a heavy-handed solution.

I hadn't looked at mlx5en, but you're right, it does the same thing, so it would need to be fixed there as well.

This comment was removed by mjoras.

Can this be fixed in the VLAN / LAGG code instead?

Can this be fixed in the VLAN / LAGG code instead?

I believe it could be fixed there. The same thing could be done, except instead of defering a driver-specific action it would defer the event handler calls to vlan_config/vlan_unconfig. However what I'm imagining is more complex than the driver-specific patch. It doesn't seem unreasonable to fix this in the drivers that sleep while setting their filters, but it's possible that it would be worth it to address it generically in if_vlan so that the underlying drivers have the flexibility to sleep if they need to for some reason.

I've talked to rstone@ about this and he thinks that a wider discussion is probably warranted here, i.e. with -net or -current.