Page MenuHomeFreeBSD

Add __smpused
AbandonedPublic

Authored by ehem_freebsd_m5p.com on Jan 11 2022, 5:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 9, 8:09 AM
Unknown Object (File)
Wed, Apr 17, 7:09 PM
Unknown Object (File)
Dec 23 2023, 6:20 AM
Unknown Object (File)
Dec 10 2023, 8:30 PM
Unknown Object (File)
Sep 6 2023, 7:06 AM
Unknown Object (File)
Aug 21 2023, 8:22 AM
Unknown Object (File)
Aug 16 2023, 8:45 AM
Unknown Object (File)
Aug 16 2023, 7:29 AM
Subscribers

Details

Reviewers
kib
markj
Summary

Similar to __diagused (D31185) this macro is for variables which are
only used in SMP configurations. This should ease the burdon of
handling variables which are unused in non-SMP configurations.

Diff Detail

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

Event Timeline

How many applications of this do you (plan to) have? If it ubiquitous situation, then yes, adding specific marker is useful. But I doubt it, I suspect there would be just several cases when it is useful, literally a dozen at best.

For similar cases, where kernel was compiled with one-off option, I believe I put __unused directly.

I believe it is mostly an issue of how often non-SMP builds are done. I've already observed several places in a single file where having this would distinctly reduce the need for #ifdef SMP to avoid write-only variable warnings if those were enabled (kind of looks like something of an audit job is being done, there a plan to enable warnings/errors?). I suspect this isn't the only case, but I cannot state with certainty this whether this would be a major gain.

The real case for this is variables which are set in multiple places in a function, but only used once near the end. To much such compile cleanly, the variable declaration and every point where it is set would need #ifdef SMP. While with this the variable could be marked __smpused and only the use at the end would need #ifdef SMP.

I don't have a count of how often this might get used, but I suspect there are many.

The real case for this is variables which are set in multiple places in a function, but only used once near the end. To much such compile cleanly, the variable declaration and every point where it is set would need #ifdef SMP. While with this the variable could be marked __smpused and only the use at the end would need #ifdef SMP.

I don't have a count of how often this might get used, but I suspect there are many.

So provide the patch that fixes that 'many' places.

In D33818#771982, @kib wrote:

So provide the patch that fixes that 'many' places.

Wasn't an issue of fixing many places, but there are plenty of places where it would be handier to use __smpused instead of wrapping variables in #ifdef SMP/#endif. One such is sys/dev/xen/bus/xen_intr.c the function xen_intr_rebind_isrc() where cpu and error are unused for non-SMP.

Though non-SMP is likely the next hardware feature to lose support. This seemed potentially better in places, but at this point...