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
Unknown Object (File)
Thu, May 2, 10:40 PM
Unknown Object (File)
Thu, May 2, 10:40 PM
Unknown Object (File)
Thu, May 2, 10:40 PM
Unknown Object (File)
Thu, May 2, 10:40 PM
Unknown Object (File)
Thu, May 2, 9:06 PM
Unknown Object (File)
Tue, Apr 23, 10:36 AM
Unknown Object (File)
Sat, Apr 6, 2:26 PM
Unknown Object (File)
Sat, Apr 6, 12:20 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.