Page MenuHomeFreeBSD

Reduce the vnet_set module size of ip_mroute to allow loading as a module.
ClosedPublic

Authored by bz on Nov 19 2019, 1:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 4:05 PM
Unknown Object (File)
Mar 18 2024, 12:37 AM
Unknown Object (File)
Dec 22 2023, 10:05 PM
Unknown Object (File)
Dec 19 2023, 6:28 PM
Unknown Object (File)
Oct 30 2023, 12:34 AM
Unknown Object (File)
Oct 29 2023, 7:26 AM
Unknown Object (File)
Sep 7 2023, 5:32 AM
Unknown Object (File)
Sep 7 2023, 5:18 AM
Subscribers

Details

Summary

With VIMAGE kernels modules get special treatment as they need
to also keep the original values and make copies for each instance.
For that a few pages of vnet modspace are provided and the
kernel-linker and the VNET framework know how to deal with things.
When the modspace is (almost) full, other modules which would
overflow the modspace cannot be loaded and kldload will fail.

ip_mroute uses a lot of variable space, mostly be four big arrays:
set_vnet 0000000000000510 vnet_entry_multicast_register_if
set_vnet 0000000000000700 vnet_entry_viftable
set_vnet 0000000000002000 vnet_entry_bw_meter_timers
set_vnet 0000000000002800 vnet_entry_bw_upcalls

Dynamically malloc the three big ones for each instance we need
and free them again on vnet teardown (the 4th is an ifnet).
That way they only need module space for a single pointer and
allow a lot more modules using virtualized variables to be loaded
on a VNET kernel.

PR: 206583

Diff Detail

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

Event Timeline

kp added inline comments.
sys/netinet/ip_mroute.c
189 ↗(On Diff #64571)

Doesn't this change the sizeof() to be sizeof(struct vif) where it used to be sizeof(struct vif) * MAXVIFS?

Address kp's catch of the SYSCTL_OPAQUE size.

bz marked an inline comment as done.Nov 19 2019, 2:14 PM
bz added inline comments.
sys/netinet/ip_mroute.c
189 ↗(On Diff #64571)

Good catch. Fixed.

Sorry, I won’t be able to help with testing this, as I no longer have the multicast routing setup that I previously had when I reported this bug. Thanks for following up on it though!

Looks good to me.

Technically you could put all the fixed-size fields into a single structure and allocate all at once.

This revision is now accepted and ready to land.Nov 19 2019, 2:24 PM
This revision was automatically updated to reflect the committed changes.
bz marked an inline comment as done.