Page MenuHomeFreeBSD

bhyve(8): allow cpu pinning using N-M:X-Y ranges
AcceptedPublic

Authored by antranigv_freebsd.am on Thu, Jan 29, 4:50 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 29, 5:51 PM
Unknown Object (File)
Thu, Jan 29, 3:52 PM
Unknown Object (File)
Thu, Jan 29, 3:43 PM
Unknown Object (File)
Thu, Jan 29, 3:31 PM
Unknown Object (File)
Thu, Jan 29, 1:57 PM
Unknown Object (File)
Thu, Jan 29, 1:02 PM

Details

Reviewers
andrew
corvink
markj
Group Reviewers
bhyve
Summary

bhyve's -p allows to pin guest's virtual CPU vcpu to hostcpu, however
this becomes very tedious work when you have to pin more than a single
CPU.

This allows to pass a range to -p, e.g. -p 0-3:4-7 which will pin the
cpus 0:4, 1:5, 2:6, 3:7. The ranges must be equal and the CPU numbers
must be ascending.

TODO: Updating the man page.

Sponsored by: Armenian Bioinformatics Institute

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 70204
Build 67087: arc lint + arc unit

Event Timeline

corvink added a subscriber: corvink.
corvink added inline comments.
usr.sbin/bhyve/aarch64/bhyverun_machdep.c
103
usr.sbin/bhyve/amd64/bhyverun_machdep.c
81
usr.sbin/bhyve/riscv/bhyverun_machdep.c
98
This revision is now accepted and ready to land.Thu, Jan 29, 7:46 AM
markj added inline comments.
usr.sbin/bhyve/bhyverun.c
397

libutil has cpuset_parselist(). Can we use that here?

usr.sbin/bhyve/bhyverun.c
397

I can add it as a separate feature, but to my knowledge that’s not the same as CPU pinning, which pins specific vcpu’s to hostcpu’s (or in cpuset terminology: specific bhyve thread to a specific CPU).

I think it would be nice to set a cpuset on the fly using another flag (maybe -P if we’re not using it), instead of creating and using a cpuset every time.

I hope I understood your question correctly.

markj added inline comments.
usr.sbin/bhyve/bhyverun.c
397

I meant that you could use it to parse the CPU lists. It would make it easier to write something like -p 0-3:0,2,4,6 to pin 0->0, 1->2, 2->4, 3->6. But ok, this is fine for now.

413