Page MenuHomeFreeBSD

vmm: Convert VM_MAXCPU into a loader tunable hw.vmm.maxcpu.
ClosedPublic

Authored by jhb on Oct 27 2022, 3:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 10:03 AM
Unknown Object (File)
Sun, Apr 21, 8:18 PM
Unknown Object (File)
Sun, Apr 21, 8:18 PM
Unknown Object (File)
Sun, Apr 21, 8:16 PM
Unknown Object (File)
Sun, Apr 21, 8:16 PM
Unknown Object (File)
Sun, Apr 21, 8:16 PM
Unknown Object (File)
Sat, Apr 20, 5:43 AM
Unknown Object (File)
Mar 17 2024, 4:15 AM

Details

Summary

The default is now the number of physical CPUs in the system rather
than 16.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Oct 27 2022, 3:06 PM
corvink added a subscriber: corvink.
corvink added inline comments.
sys/amd64/vmm/vmm.c
311

Just a suggestion!

604

Shouldn't we check if this malloc was successfully?

This revision is now accepted and ready to land.Nov 11 2022, 11:56 AM
sys/amd64/vmm/vmm.c
320

Maybe print a message if the value is clamped?

324

vmm doesn't use SYSINITs anywhere else except for stats; all initialization is done from vmm_init(). Why deviate from that?

SI_SUB_TUNABLE is also kind of strange to me: mp_ncpus isn't initialized at that stage of the kernel's boot. I understand that it works because vmm is always a kernel module and their sysinits are processed later even if preloaded, but if some soul tries to compile vmm into the kernel, this will bite them.

604

malloc(M_WAITOK) is guaranteed to not return a NULL pointer.

jhb marked an inline comment as done.Nov 11 2022, 5:59 PM
jhb added inline comments.
sys/amd64/vmm/vmm.c
324

Hmm, just used to using SI_SUB_TUNABLES out of habit for tunable, but yes, mp_ncpus isn't valid then. I can move it.

jhb marked 2 inline comments as done.Nov 11 2022, 6:00 PM
This revision now requires review to proceed.Nov 11 2022, 10:55 PM
This revision is now accepted and ready to land.Nov 11 2022, 10:58 PM
sys/amd64/vmm/vmm.c
311

I think I should probably explain better the reason for - 1. I think it's to ensure we have at least one free pid value, or maybe it's to permit the use of '-1' for vcpu values (though I've mostly removed those uses I think).

Add comment for -1 in VM_MAXCPU

This revision now requires review to proceed.Nov 14 2022, 6:36 PM
sys/amd64/vmm/vmm.c
311

Your comment explains that the number of maxcpus is limited by the uint16_t type. So, the intention of my suggestion was to use the UINT16_MAX macro. You don't have to use it. It's just a suggestion.

This revision is now accepted and ready to land.Nov 15 2022, 6:41 AM