[Qemu-devel] [PATCH v1] spapr.c: Update qemu's maxcpus for pseries machine.
Need to adjust the max cpus supported number from error message since it was conflicting with KVM's. Steps to Reproduce: 1.boot up with "-smp 64,maxcpus=102464,cores=8,threads=1,sockets=8" qemu-kvm: Number of SMP CPUs requested (102464) exceeds max CPUs supported by machine 'pseries-rhel7.4.0alt' (1024) 2. On KVM machine it shows boot up with "-m 6G,maxmem=300G,slots=256 -smp 64,maxcpus=1024,cores=8,threads=1 ,sockets=128" Number of hotpluggable cpus requested (1024) exceeds the maximum cpus supported by KVM (240) It seemed that 1024 was useless since KVM only support 240 so far. Hence,we need to adjust it to an reasonable value 240. Signed-off-by: Seeteena Thoufeek <s1see...@linux.vnet.ibm.com> --- hw/ppc/spapr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9efddea..c753254 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3691,6 +3691,7 @@ static const TypeInfo spapr_machine_info = { if (latest) {\ mc->alias = "pseries"; \ mc->is_default = 1; \ +mc->max_cpus = 240; \ }\ }\ static void spapr_machine_##suffix##_instance_init(Object *obj) \ -- 1.8.3.1
[Qemu-devel] [PATCH v1] hmp: 'info snapshots' not showing the id
(qemu) info snapshots List of snapshots present on all disks: IDTAG VM SIZEDATE VM CLOCK -- 1 314M 2017-11-15 15:22:18 00:02:25.695 -- 2 319M 2017-11-15 15:23:03 00:02:45.970 -- 3 319M 2017-11-15 15:23:37 00:02:56.328 ID field is showing -- with no information. Signed-off-by: Seeteena Thoufeek <s1see...@linux.vnet.ibm.com> --- hmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hmp.c b/hmp.c index 35a7041..1921b3b 100644 --- a/hmp.c +++ b/hmp.c @@ -1454,7 +1454,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict) /* The ID is not guaranteed to be the same on all images, so * overwrite it. */ -pstrcpy(sn->id_str, sizeof(sn->id_str), "--"); +pstrcpy(sn->id_str, sizeof(sn->id_str), sn->id_str); bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, sn); monitor_printf(mon, "\n"); } -- 1.8.3.1
[Qemu-devel] [PATCH v1] spapr_pci: fix the path while fetching loc-code from host DT
The function spapr_phb_vfio_get_loc_code uses wrong path for fetching loc-code from host DT this is the call that needs to be fixed: /* Construct and read from host device tree the loc-code */ path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf); Signed-off-by: Seeteena Thoufeek <s1see...@linux.vnet.ibm.com> --- hw/ppc/spapr_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 5a3122a..ae86322 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -762,7 +762,7 @@ static char *spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb, PCIDevice *pdev) g_free(path); /* Construct and read from host device tree the loc-code */ -path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf); +path = g_strdup_printf("/proc/device-tree/%s/ibm,loc-code", buf); g_free(buf); if (!g_file_get_contents(path, , NULL, NULL)) { goto err_out; -- 1.8.3.1
[Qemu-devel] [PATCH v5] vl: exit if maxcpus is negative
---Steps to Reproduce--- When passed a negative number to 'maxcpus' parameter, Qemu aborts with a core dump. Run the following command with maxcpus argument as negative number ppc64-softmmu/qemu-system-ppc64 --nographic -vga none -machine pseries,accel=kvm,kvm-type=HV -m size=200g -device virtio-blk-pci, drive=rootdisk -drive file=/home/images/pegas-1.0-ppc64le.qcow2, if=none,cache=none,id=rootdisk,format=qcow2 -monitor telnet :127.0.0.1:1234,server,nowait -net nic,model=virtio -net user -redir tcp:2000::22 -device nec-usb-xhci -smp 8,cores=1, threads=1,maxcpus=-12 (process:12149): GLib-ERROR **: gmem.c:130: failed to allocate 18446744073709550568 bytes Trace/breakpoint trap Reported-by: R.Nageswara Sastry <rnsas...@linux.vnet.ibm.com> Signed-off-by: Seeteena Thoufeek <s1see...@linux.vnet.ibm.com> --- v1 -> v2: - Fix the error check in vl.c to make it generic. v2 -> v3: - Fix coding style pointed out by patchew. - Fix check for "<= 0" instead of just "< 0". v3 -> v4: - Fix subject line. - Removed space before ":" from vl.c:1248 - Removed Reviewed-by: flag v4-> v5: - Code rework to declare max_cpus as unsigned int in sysemu.h - Remove the error check in vl.c referred in v2. - declare max_cpus as unsigned int in vl.c --- include/sysemu/sysemu.h | 2 +- vl.c| 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index b213696..c083869 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -113,7 +113,7 @@ extern int win2k_install_hack; extern int alt_grab; extern int ctrl_grab; extern int smp_cpus; -extern int max_cpus; +extern unsigned int max_cpus; extern int cursor_hide; extern int graphic_rotate; extern int no_quit; diff --git a/vl.c b/vl.c index 8e247cc..1470c21 100644 --- a/vl.c +++ b/vl.c @@ -164,7 +164,7 @@ Chardev *sclp_hds[MAX_SCLP_CONSOLES]; int win2k_install_hack = 0; int singlestep = 0; int smp_cpus = 1; -int max_cpus = 1; +unsigned int max_cpus = 1; int smp_cores = 1; int smp_threads = 1; int acpi_enabled = 1; @@ -4233,8 +4233,8 @@ int main(int argc, char **argv, char **envp) machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */ if (max_cpus > machine_class->max_cpus) { -error_report("Number of SMP CPUs requested (%d) exceeds max CPUs " - "supported by machine '%s' (%d)", max_cpus, +error_report("Invalid SMP CPUs %d. The max CPUs " + "supported by machine '%s' is %d", max_cpus, machine_class->name, machine_class->max_cpus); exit(1); } -- 1.8.3.1
[Qemu-devel] [PATCH v4] vl: exit if maxcpus is negative
---Steps to Reproduce--- When passed a negative number to 'maxcpus' parameter, Qemu aborts with a core dump. Run the following command with maxcpus argument as negative number ppc64-softmmu/qemu-system-ppc64 --nographic -vga none -machine pseries,accel=kvm,kvm-type=HV -m size=200g -device virtio-blk-pci, drive=rootdisk -drive file=/home/images/pegas-1.0-ppc64le.qcow2, if=none,cache=none,id=rootdisk,format=qcow2 -monitor telnet :127.0.0.1:1234,server,nowait -net nic,model=virtio -net user -redir tcp:2000::22 -device nec-usb-xhci -smp 8,cores=1, threads=1,maxcpus=-12 (process:12149): GLib-ERROR **: gmem.c:130: failed to allocate 18446744073709550568 bytes Trace/breakpoint trap Reported-by: R.Nageswara Sastry <rnsas...@linux.vnet.ibm.com> Signed-off-by: Seeteena Thoufeek <s1see...@linux.vnet.ibm.com> --- v1 -> v2: - Fix the error check in vl.c to make it generic. v2 -> v3: - Fix coding style pointed out by patchew. - Fix check for "<= 0" instead of just "< 0". v3 -> v4: - Fix subject line. - Removed space before ":" from vl.c:1248 - Removed Reviewed-by: flag. --- vl.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 8e247cc..2d9e73d 100644 --- a/vl.c +++ b/vl.c @@ -1244,7 +1244,10 @@ static void smp_parse(QemuOpts *opts) } max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus); - +if (max_cpus <= 0) { +error_report("Invalid max_cpus: %d", max_cpus); +exit(1); +} if (max_cpus < cpus) { error_report("maxcpus must be equal to or greater than smp"); exit(1); -- 1.8.3.1
[Qemu-devel] [PATCH v3] qemu crashes when a negative number used for 'maxcpus'
---Steps to Reproduce--- When passed a negative number to 'maxcpus' parameter, Qemu aborts with a core dump. Run the following command with maxcpus argument as negative number ppc64-softmmu/qemu-system-ppc64 --nographic -vga none -machine pseries,accel=kvm,kvm-type=HV -m size=200g -device virtio-blk-pci, drive=rootdisk -drive file=/home/images/pegas-1.0-ppc64le.qcow2, if=none,cache=none,id=rootdisk,format=qcow2 -monitor telnet :127.0.0.1:1234,server,nowait -net nic,model=virtio -net user -redir tcp:2000::22 -device nec-usb-xhci -smp 8,cores=1, threads=1,maxcpus=-12 (process:12149): GLib-ERROR **: gmem.c:130: failed to allocate 18446744073709550568 bytes Trace/breakpoint trap Reported-by: R.Nageswara Sastry <rnsas...@linux.vnet.ibm.com> Signed-off-by: Seeteena Thoufeek <s1see...@linux.vnet.ibm.com> Reviewed-by: Bharata B Rao <bhar...@linux.vnet.ibm.com> --- vl.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 8e247cc..fb45b6d 100644 --- a/vl.c +++ b/vl.c @@ -1244,7 +1244,10 @@ static void smp_parse(QemuOpts *opts) } max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus); - +if (max_cpus <= 0) { +error_report("Invalid max_cpus : %d", max_cpus); +exit(1); +} if (max_cpus < cpus) { error_report("maxcpus must be equal to or greater than smp"); exit(1); -- 1.8.3.1
[Qemu-devel] [PATCH v2] qemu crashes when a negative number used for 'maxcpus'
---Steps to Reproduce--- When passed a negative number to 'maxcpus' parameter, Qemu aborts with a core dump. Run the following command with maxcpus argument as negative number ppc64-softmmu/qemu-system-ppc64 --nographic -vga none -machine pseries,accel=kvm,kvm-type=HV -m size=200g -device virtio-blk-pci, drive=rootdisk -drive file=/home/images/pegas-1.0-ppc64le.qcow2, if=none,cache=none,id=rootdisk,format=qcow2 -monitor telnet :127.0.0.1:1234,server,nowait -net nic,model=virtio -net user -redir tcp:2000::22 -device nec-usb-xhci -smp 8,cores=1, threads=1,maxcpus=-12 (process:12149): GLib-ERROR **: gmem.c:130: failed to allocate 18446744073709550568 bytes Trace/breakpoint trap Reported-by: R.Nageswara Sastry <rnsas...@linux.vnet.ibm.com> Signed-off-by: Seeteena Thoufeek <s1see...@linux.vnet.ibm.com> Reviewed-by: Bharata B Rao <bhar...@linux.vnet.ibm.com> --- vl.c | 5 + 1 file changed, 5 insertions(+) diff --git a/vl.c b/vl.c index 8e247cc..042714f 100644 --- a/vl.c +++ b/vl.c @@ -1244,6 +1244,11 @@ static void smp_parse(QemuOpts *opts) } max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus); + + if (max_cpus < 0) { + error_report("Invalid max_cpus : %d", max_cpus); + exit(1); + } if (max_cpus < cpus) { error_report("maxcpus must be equal to or greater than smp"); -- 1.8.3.1