Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F161718141
D54937.id179283.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D54937.id179283.diff
View Options
diff --git a/usr.sbin/bhyve/aarch64/bhyverun_machdep.c b/usr.sbin/bhyve/aarch64/bhyverun_machdep.c
--- a/usr.sbin/bhyve/aarch64/bhyverun_machdep.c
+++ b/usr.sbin/bhyve/aarch64/bhyverun_machdep.c
@@ -100,7 +100,8 @@
"Usage: %s [-CDHhSW]\n"
" %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n"
" %*s [-k config_file] [-m mem] [-o var=value]\n"
- " %*s [-p vcpu:hostcpu] [-r file] [-s pci] [-U uuid] vmname\n"
+ " %*s [-p vcpuN[-vcpuM]]:hostcpuX[-hostcpuY]\n"
+ " %*s [-r file] [-s pci] [-U uuid] vmname\n"
" -C: include guest memory in core file\n"
" -c: number of CPUs and/or topology specification\n"
" -D: destroy on power-off\n"
@@ -116,7 +117,7 @@
" -U: UUID\n"
" -W: force virtio to use single-vector MSI\n",
progname, (int)strlen(progname), "", (int)strlen(progname), "",
- (int)strlen(progname), "");
+ (int)strlen(progname), "", (int)strlen(progname), "");
exit(code);
}
diff --git a/usr.sbin/bhyve/amd64/bhyverun_machdep.c b/usr.sbin/bhyve/amd64/bhyverun_machdep.c
--- a/usr.sbin/bhyve/amd64/bhyverun_machdep.c
+++ b/usr.sbin/bhyve/amd64/bhyverun_machdep.c
@@ -78,7 +78,8 @@
"Usage: %s [-aCDeHhPSuWwxY]\n"
" %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n"
" %*s [-G port] [-k config_file] [-l lpc] [-m mem] [-o var=value]\n"
- " %*s [-p vcpu:hostcpu] [-r file] [-s pci] [-U uuid] vmname\n"
+ " %*s [-p vcpuN[-vcpuM]]:hostcpuX[-hostcpuY]\n"
+ " %*s [-r file] [-s pci] [-U uuid] vmname\n"
" -a: local apic is in xAPIC mode (deprecated)\n"
" -C: include guest memory in core file\n"
" -c: number of CPUs and/or topology specification\n"
@@ -108,7 +109,7 @@
" -x: local APIC is in x2APIC mode\n"
" -Y: disable MPtable generation\n",
progname, (int)strlen(progname), "", (int)strlen(progname), "",
- (int)strlen(progname), "");
+ (int)strlen(progname), "", (int)strlen(progname), "");
exit(code);
}
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -357,18 +357,12 @@
guest_ncpus = ncpus;
}
-int
-bhyve_pincpu_parse(const char *opt)
+static int
+bhyve_pincpu(int vcpu, int pcpu)
{
const char *value;
char *newval;
char key[16];
- int vcpu, pcpu;
-
- if (sscanf(opt, "%d:%d", &vcpu, &pcpu) != 2) {
- fprintf(stderr, "invalid format: %s\n", opt);
- return (-1);
- }
if (vcpu < 0) {
fprintf(stderr, "invalid vcpu '%d'\n", vcpu);
@@ -395,6 +389,34 @@
return (0);
}
+int
+bhyve_pincpu_parse(const char *opt)
+{
+ int vcpu_first, vcpu_last, pcpu_first, pcpu_last;
+ int vcpu, pcpu;
+
+ if (sscanf(opt, "%d-%d:%d-%d", &vcpu_first, &vcpu_last, &pcpu_first, &pcpu_last) == 4) {
+ if (vcpu_first > vcpu_last || pcpu_first > pcpu_last) {
+ fprintf(stderr, "invalid range (must be ascending): %s\n", opt);
+ return (-1);
+ }
+ if ((vcpu_last - vcpu_first) != (pcpu_last - pcpu_first)) {
+ fprintf(stderr, "range sizes do not match: %s\n", opt);
+ return (-1);
+ }
+ for (vcpu = vcpu_first, pcpu = pcpu_first; vcpu <= vcpu_last; vcpu++, pcpu++)
+ if (bhyve_pincpu(vcpu, pcpu) != 0)
+ return (-1);
+ return (0);
+ }
+
+ if (sscanf(opt, "%d:%d", &vcpu, &pcpu) == 2)
+ return (bhyve_pincpu(vcpu, pcpu));
+
+ fprintf(stderr, "invalid format: %s\n", opt);
+ return (-1);
+}
+
static void
parse_cpuset(int vcpu, const char *list, cpuset_t *set)
{
diff --git a/usr.sbin/bhyve/riscv/bhyverun_machdep.c b/usr.sbin/bhyve/riscv/bhyverun_machdep.c
--- a/usr.sbin/bhyve/riscv/bhyverun_machdep.c
+++ b/usr.sbin/bhyve/riscv/bhyverun_machdep.c
@@ -95,7 +95,8 @@
"Usage: %s [-CDHhSW]\n"
" %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n"
" %*s [-k config_file] [-m mem] [-o var=value]\n"
- " %*s [-p vcpu:hostcpu] [-r file] [-s pci] [-U uuid] vmname\n"
+ " %*s [-p vcpuN[-vcpuM]]:hostcpuX[-hostcpuY]\n"
+ " %*s [-r file] [-s pci] [-U uuid] vmname\n"
" -C: include guest memory in core file\n"
" -c: number of CPUs and/or topology specification\n"
" -D: destroy on power-off\n"
@@ -110,7 +111,7 @@
" -U: UUID\n"
" -W: force virtio to use single-vector MSI\n",
progname, (int)strlen(progname), "", (int)strlen(progname), "",
- (int)strlen(progname), "");
+ (int)strlen(progname), "", (int)strlen(progname), "");
exit(code);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jul 7, 5:22 AM (15 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34785713
Default Alt Text
D54937.id179283.diff (4 KB)
Attached To
Mode
D54937: bhyve(8): allow cpu pinning using N-M:X-Y ranges
Attached
Detach File
Event Timeline
Log In to Comment