Page MenuHomeFreeBSD

Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (M of N)
ClosedPublic

Authored by kaktus on Feb 11 2020, 9:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 1, 3:16 AM
Unknown Object (File)
Feb 21 2024, 10:50 AM
Unknown Object (File)
Feb 21 2024, 10:50 AM
Unknown Object (File)
Feb 21 2024, 10:50 AM
Unknown Object (File)
Feb 8 2024, 6:09 PM
Unknown Object (File)
Jan 30 2024, 2:06 AM
Unknown Object (File)
Jan 15 2024, 7:25 AM
Unknown Object (File)
Jan 14 2024, 5:37 AM

Details

Summary

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes.
This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags.
Mark all low hanging fruits as MPSAFE.

You’re asked for a review based on src/MAINTAINERS entry.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/dev/ath/ah_osdep.c
241 ↗(On Diff #68138)

I don't think Giant helps this function. ath_hal_reg_(read|write)() don't acquire it, so it is not synchronizing anything.

sys/dev/ath/ath_rate/sample/sample.c
1376 ↗(On Diff #68138)

Ditto. There are no references to Giant in ath(9) so I am quite sure these can be marked MPSAFE.

sys/net80211/ieee80211_hwmp.c
196 ↗(On Diff #68138)

None of these variables have accesses synchronized with Giant, and ieee80211_sysctl_msecs_ticks() does not require Giant.

kaktus edited the summary of this revision. (Show Details)

Address comments.

Upload the correct patch.

sys/dev/ath/ath_rate/sample/sample.c
1376 ↗(On Diff #68138)

So shouldn't we explicitly add CTLFLAG_MPSAFE?

sys/dev/ath/ath_rate/sample/sample.c
1376 ↗(On Diff #68138)

We absolutely should.

I am fairly confident that none of the sysctls in this review require Giant, if only because Giant is not referenced at all in ath(9) or the ieee80211 stack. It is just a matter of going through and convincing oneself in each case. I did a few more, but if you prefer to just commit and revisit later, it is ok with me.

sys/net80211/ieee80211_freebsd.c
262 ↗(On Diff #68596)

ieee80211_sysctl_inact() does a pure conversion, there is no need for Giant.

sys/net80211/ieee80211_hwmp.c
218 ↗(On Diff #68596)

This does not need Giant, the proc is just doing a ms->ticks unit conversion.

sys/net80211/ieee80211_mesh.c
134 ↗(On Diff #68596)

None of these need Giant. They are field accessors that just convert to a ticks value.

This revision is now accepted and ready to land.Feb 21 2020, 2:53 PM

That is the plan - document current state now, review and fix what have to be fixed later. The flag itself doesn't change anything, it's just a more explicit way of showing that the handler may be not-MPSAFE.