Page MenuHomeFreeBSD

kernel: Change SYSINITs and SYSUNINITs to pass callback arguments AS-IS
Needs ReviewPublic

Authored by hselasky on Jun 7 2023, 11:32 AM.
Tags
None
Referenced Files
F102599332: D40450.diff
Thu, Nov 14, 2:57 PM
Unknown Object (File)
Oct 7 2024, 4:16 AM
Unknown Object (File)
Sep 24 2024, 9:48 PM
Unknown Object (File)
Sep 24 2024, 9:48 PM
Unknown Object (File)
Sep 24 2024, 9:48 PM
Unknown Object (File)
Sep 24 2024, 9:48 PM
Unknown Object (File)
Sep 24 2024, 9:35 PM
Unknown Object (File)
Sep 12 2024, 6:38 PM

Details

Reviewers
jhb
imp
bz
kib
gnn
manu
melifaro
Group Reviewers
transport
cam
Summary

When the SYSINIT and SYSUNINIT callback function argument is stored as a
pointer, it is difficult to preserve pointer type information. This
basically leads to several problems like having to use techniques similar
to DEVOLATILE() and DECONST(). By generation a small shim function
to call the callback function passing the provided arguments, type
safety can be achieved and the need for casts can be entirely avoided.

This change factors out all the SYSINIT and SYSUNINIT variants in kernel.h
into a common __SI_REGISTER() macro.

This change also update existing SYSINITs and SYSUNINTs to fix compilation
errors resulting from bad usage, like callback argument type issues and
also one instance of a SYSINIT and SYSUNINIT inside a function block,
see mlx4en(4).

Update the SYSINIT(9) manual page to reflect the changes made.

No functional change intended.

MFC after: 1 week
Sponsored by: NVIDIA Networking

Test Plan

The change is roughly what I want it to be. Some build and run testing remains.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Removed some VNET related changes (not related to this change).

Verified compilation passes for amd64 LINT at least.

make buildkernel KERNCONF=LINT TARGET_ARCH=amd64

Will do a universe build before final commit.

Fix wording. SYSUNINITs are only called on module unload.