Re: [Qemu-devel] [PATCH v2 00/19] Monitor: split HMP and QMP dispatch tables
Luiz Capitulino lcapitul...@redhat.com writes: This is a respin with the following small changes: v1 - v2: o Renamed qemu-monitor-qmp.hx to qmp-commands.hx o Added a new patch which renames qemu-monitor.hx to hmp-commands.hx o Other minor changes ACK
Re: [Qemu-devel] QEMU throughput is down with SMP
On Thu, Sep 30, 2010 at 8:19 PM, Venkateswararao Jujjuri (JV) jv...@linux.vnet.ibm.com wrote: On 9/30/2010 2:13 AM, Stefan Hajnoczi wrote: On Thu, Sep 30, 2010 at 1:50 AM, Venkateswararao Jujjuri (JV) jv...@linux.vnet.ibm.com wrote: Code: Mainline QEMU (git://git.qemu.org/qemu.git) Machine: LS21 blade. Disk: Local disk through VirtIO. Did not select any cache option. Defaulting to writethrough. Command tested: 3 parallel instances of : dd if=/dev/zero of=/pmnt/my_pw bs=4k count=10 QEMU with smp=1 19.3 MB/s + 19.2 MB/s + 18.6 MB/s = 57.1 MB/s QEMU with smp=4 15.3 MB/s + 14.1 MB/s + 13.6 MB/s = 43.0 MB/s Is this expected? Did you configure with --enable-io-thread? Yes I did. Also, try using dd oflag=direct to eliminate effects introduced by the guest page cache and really hit the disk. With oflag=direct , I see no difference and the throughput is so slow and I would not expect to see any difference. It is 225 kb/s for each thread either with smp=1 or with smp=4. If I understand correctly you are getting: QEMU oflag=direct with smp=1 225 KB/s + 225 KB/s + 225 KB/s = 675 KB/s QEMU oflag=direct with smp=4 225 KB/s + 225 KB/s + 225 KB/s = 675 KB/s This suggests the degradation for smp=4 is guest kernel page cache or buffered I/O related. Perhaps lockholder preemption? Stefan
[Qemu-devel] Re: [PATCH 10/19] QMP: Introduce query commands dispatch table
On 09/30/2010 03:56 PM, Luiz Capitulino wrote: The new table is a copy of HMP's table, containing only QObject handlers. In the near future HMP will be making QMP calls and then we will be able to drop QObject handlers from HMP's table. From now on, QMP and HMP have different query command dispatch tables. I like this series a lot and I think it's ready to merge. But I wonder, why have a separate qmp_query_cmds table? Why not just fold the query commands into qmp_cmds? Regards, Anthony Liguori Signed-off-by: Luiz Capitulinolcapitul...@redhat.com --- monitor.c | 130 - 1 files changed, 128 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index 8f58e18..7cb66df 100644 --- a/monitor.c +++ b/monitor.c @@ -190,6 +190,7 @@ static const mon_cmd_t mon_cmds[]; static const mon_cmd_t info_cmds[]; static const mon_cmd_t qmp_cmds[]; +static const mon_cmd_t qmp_query_cmds[]; Monitor *cur_mon; Monitor *default_mon; @@ -751,7 +752,7 @@ static void do_info_commands(Monitor *mon, QObject **ret_data) } } -for (cmd = info_cmds; cmd-name != NULL; cmd++) { +for (cmd = qmp_query_cmds; cmd-name != NULL; cmd++) { if (monitor_handler_ported(cmd) !monitor_cmd_user_only(cmd)) { char buf[128]; snprintf(buf, sizeof(buf), query-%s, cmd-name); @@ -2639,6 +2640,131 @@ static const mon_cmd_t qmp_cmds[] = { { /* NULL */ }, }; +static const mon_cmd_t qmp_query_cmds[] = { +{ +.name = version, +.args_type = , +.params = , +.help = show the version of QEMU, +.user_print = do_info_version_print, +.mhandler.info_new = do_info_version, +}, +{ +.name = commands, +.args_type = , +.params = , +.help = list QMP available commands, +.user_print = monitor_user_noop, +.mhandler.info_new = do_info_commands, +}, +{ +.name = chardev, +.args_type = , +.params = , +.help = show the character devices, +.user_print = qemu_chr_info_print, +.mhandler.info_new = qemu_chr_info, +}, +{ +.name = block, +.args_type = , +.params = , +.help = show the block devices, +.user_print = bdrv_info_print, +.mhandler.info_new = bdrv_info, +}, +{ +.name = blockstats, +.args_type = , +.params = , +.help = show block device statistics, +.user_print = bdrv_stats_print, +.mhandler.info_new = bdrv_info_stats, +}, +{ +.name = cpus, +.args_type = , +.params = , +.help = show infos for each CPU, +.user_print = monitor_print_cpus, +.mhandler.info_new = do_info_cpus, +}, +{ +.name = pci, +.args_type = , +.params = , +.help = show PCI info, +.user_print = do_pci_info_print, +.mhandler.info_new = do_pci_info, +}, +{ +.name = kvm, +.args_type = , +.params = , +.help = show KVM information, +.user_print = do_info_kvm_print, +.mhandler.info_new = do_info_kvm, +}, +{ +.name = status, +.args_type = , +.params = , +.help = show the current VM status (running|paused), +.user_print = do_info_status_print, +.mhandler.info_new = do_info_status, +}, +{ +.name = mice, +.args_type = , +.params = , +.help = show which guest mouse is receiving events, +.user_print = do_info_mice_print, +.mhandler.info_new = do_info_mice, +}, +{ +.name = vnc, +.args_type = , +.params = , +.help = show the vnc server status, +.user_print = do_info_vnc_print, +.mhandler.info_new = do_info_vnc, +}, +{ +.name = name, +.args_type = , +.params = , +.help = show the current VM name, +.user_print = do_info_name_print, +.mhandler.info_new = do_info_name, +}, +{ +.name = uuid, +.args_type = , +.params = , +.help = show the current VM UUID, +.user_print = do_info_uuid_print, +.mhandler.info_new = do_info_uuid, +}, +{ +.name = migrate, +.args_type = , +.params = , +.help = show migration status, +.user_print = do_info_migrate_print, +.mhandler.info_new = do_info_migrate, +}, +{ +.name = balloon, +.args_type = , +.params = , +.help = show balloon information, +.user_print =
Re: [Qemu-devel] QEMU throughput is down with SMP
* Stefan Hajnoczi stefa...@gmail.com [2010-10-01 03:48]: On Thu, Sep 30, 2010 at 8:19 PM, Venkateswararao Jujjuri (JV) jv...@linux.vnet.ibm.com wrote: On 9/30/2010 2:13 AM, Stefan Hajnoczi wrote: On Thu, Sep 30, 2010 at 1:50 AM, Venkateswararao Jujjuri (JV) jv...@linux.vnet.ibm.com wrote: Code: Mainline QEMU (git://git.qemu.org/qemu.git) Machine: LS21 blade. Disk: Local disk through VirtIO. Did not select any cache option. Defaulting to writethrough. Command tested: 3 parallel instances of : dd if=/dev/zero of=/pmnt/my_pw bs=4k count=10 QEMU with smp=1 19.3 MB/s + 19.2 MB/s + 18.6 MB/s = 57.1 MB/s QEMU with smp=4 15.3 MB/s + 14.1 MB/s + 13.6 MB/s = 43.0 MB/s Is this expected? Did you configure with --enable-io-thread? Yes I did. Also, try using dd oflag=direct to eliminate effects introduced by the guest page cache and really hit the disk. With oflag=direct , I see no difference and the throughput is so slow and I would not expect to see any difference. It is 225 kb/s for each thread either with smp=1 or with smp=4. If I understand correctly you are getting: QEMU oflag=direct with smp=1 225 KB/s + 225 KB/s + 225 KB/s = 675 KB/s QEMU oflag=direct with smp=4 225 KB/s + 225 KB/s + 225 KB/s = 675 KB/s This suggests the degradation for smp=4 is guest kernel page cache or buffered I/O related. Perhaps lockholder preemption? or just a single spindle maxed out because the blade hard drive doesn't have writecache enabled (it's disabled by default). -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ry...@us.ibm.com
[Qemu-devel] Re: [PATCH 10/19] QMP: Introduce query commands dispatch table
On Fri, 01 Oct 2010 08:31:11 -0500 Anthony Liguori aligu...@linux.vnet.ibm.com wrote: On 09/30/2010 03:56 PM, Luiz Capitulino wrote: The new table is a copy of HMP's table, containing only QObject handlers. In the near future HMP will be making QMP calls and then we will be able to drop QObject handlers from HMP's table. From now on, QMP and HMP have different query command dispatch tables. I like this series a lot and I think it's ready to merge. But I wonder, why have a separate qmp_query_cmds table? Why not just fold the query commands into qmp_cmds? Yes, that will be done shortly, but in a different series. I'm not doing it in this series because it's necessary to change the signature of all those functions which would make this series too large and harder to review. On a related note: I have more monitor patches in my queue. I'm building and testing them right now. I'm planning to send a pull request of all pending monitor patches later today. So, if you prefer, you can wait for that pull request instead of merging this series alone. It will generate some noise on the list though, as I think it's good practice to resend patches in a pull request to the list.
[Qemu-devel] Re: [PATCH 10/19] QMP: Introduce query commands dispatch table
On 10/01/2010 08:49 AM, Luiz Capitulino wrote: On Fri, 01 Oct 2010 08:31:11 -0500 Anthony Liguorialigu...@linux.vnet.ibm.com wrote: On 09/30/2010 03:56 PM, Luiz Capitulino wrote: The new table is a copy of HMP's table, containing only QObject handlers. In the near future HMP will be making QMP calls and then we will be able to drop QObject handlers from HMP's table. From now on, QMP and HMP have different query command dispatch tables. I like this series a lot and I think it's ready to merge. But I wonder, why have a separate qmp_query_cmds table? Why not just fold the query commands into qmp_cmds? Yes, that will be done shortly, but in a different series. Perfect :-) I'm not doing it in this series because it's necessary to change the signature of all those functions which would make this series too large and harder to review. On a related note: I have more monitor patches in my queue. I'm building and testing them right now. I'm planning to send a pull request of all pending monitor patches later today. So, if you prefer, you can wait for that pull request instead of merging this series alone. Yes, let's do that. This whole series: Reviewed-by: Anthony Liguori aligu...@us.ibm.com Regards, Anthony Liguori It will generate some noise on the list though, as I think it's good practice to resend patches in a pull request to the list.
[Qemu-devel] [Bug 652293] Re: Linux for SPARC does not work
It looks like the version of OpenBIOS in Debian sqeeze is buggy. Thank you very much. I downloaded version from your link, and it works. -- Linux for SPARC does not work https://bugs.launchpad.net/bugs/652293 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: New Bug description: I tried to use debian for sparc. I downloaded Debain Lenny 5.06 sparc netinst (file name: debian-506-sparc-netinst.iso). I tried to boot it by command: qemu-system-sparc -cdrom debian-506-sparc-netinst.iso -boot d It printed some messages to screen. The last 2 was: entry point is 0x4000 Jumping to entry point... I tried to run it as sparc64 (debian.org sais that debian runs fine on sparc32, but i tried): qemu-system-sparc64 -cdrom debian-506-sparc-netinst.iso -boot d It loaded SILO. When i press enter or print kernel commandline, it starts booting, writes, that it loaded kernel 2.6.26, initrd, and after it i get black screen. System does not boot. I went to google and found that debian lenny can not run on sparc32 (it uses sparc64 kernel, but 32-bit userspace). People recomended me to try debian 4. I downloaded file debian-40r8-sparc-netinst.iso. But i got the same bug with qemu-system-sparc. With sparc64 i did not get black screen.It finished by string: Remapping the kernel... done. What is it? QEMU 0.12.5, from debian repositories. i386 and x86-64 emulation works fine. My computer: Celeron 1.8 Ghz, DDR 1.25 Gb, NVIDIA GeForce 4 MX. As host i use debian squeeze (kernel updated to 2.6.35).
Re: [Qemu-devel] QEMU throughput is down with SMP
On 10/1/2010 6:38 AM, Ryan Harper wrote: * Stefan Hajnoczistefa...@gmail.com [2010-10-01 03:48]: On Thu, Sep 30, 2010 at 8:19 PM, Venkateswararao Jujjuri (JV) jv...@linux.vnet.ibm.com wrote: On 9/30/2010 2:13 AM, Stefan Hajnoczi wrote: On Thu, Sep 30, 2010 at 1:50 AM, Venkateswararao Jujjuri (JV) jv...@linux.vnet.ibm.comwrote: Code: Mainline QEMU (git://git.qemu.org/qemu.git) Machine: LS21 blade. Disk: Local disk through VirtIO. Did not select any cache option. Defaulting to writethrough. Command tested: 3 parallel instances of : dd if=/dev/zero of=/pmnt/my_pw bs=4k count=10 QEMU with smp=1 19.3 MB/s + 19.2 MB/s + 18.6 MB/s = 57.1 MB/s QEMU with smp=4 15.3 MB/s + 14.1 MB/s + 13.6 MB/s = 43.0 MB/s Is this expected? Did you configure with --enable-io-thread? Yes I did. Also, try using dd oflag=direct to eliminate effects introduced by the guest page cache and really hit the disk. With oflag=direct , I see no difference and the throughput is so slow and I would not expect to see any difference. It is 225 kb/s for each thread either with smp=1 or with smp=4. If I understand correctly you are getting: QEMU oflag=direct with smp=1 225 KB/s + 225 KB/s + 225 KB/s = 675 KB/s QEMU oflag=direct with smp=4 225 KB/s + 225 KB/s + 225 KB/s = 675 KB/s This suggests the degradation for smp=4 is guest kernel page cache or buffered I/O related. Perhaps lockholder preemption? or just a single spindle maxed out because the blade hard drive doesn't have writecache enabled (it's disabled by default). Yes, I am sure we are hitting the max limit on the blade local disk. Question is why the smp=4 degraded the performance in the cached mode. I am running latest kernel from upstream on the guest(2.6.36-rc5)..and using block IO. Do we have any know issues in there which could explain performance degradation? I am trying to get to a test which proves that the QEMU SMP improves/scales. I would like to use it in validating our new VirtFS threading code (yet to hit mailing list). Thanks, JV
Re: [Qemu-devel] QEMU throughput is down with SMP
On Fri, Oct 1, 2010 at 4:04 PM, Venkateswararao Jujjuri (JV) jv...@linux.vnet.ibm.com wrote: On 10/1/2010 6:38 AM, Ryan Harper wrote: * Stefan Hajnoczistefa...@gmail.com [2010-10-01 03:48]: On Thu, Sep 30, 2010 at 8:19 PM, Venkateswararao Jujjuri (JV) jv...@linux.vnet.ibm.com wrote: On 9/30/2010 2:13 AM, Stefan Hajnoczi wrote: On Thu, Sep 30, 2010 at 1:50 AM, Venkateswararao Jujjuri (JV) jv...@linux.vnet.ibm.com wrote: Code: Mainline QEMU (git://git.qemu.org/qemu.git) Machine: LS21 blade. Disk: Local disk through VirtIO. Did not select any cache option. Defaulting to writethrough. Command tested: 3 parallel instances of : dd if=/dev/zero of=/pmnt/my_pw bs=4k count=10 QEMU with smp=1 19.3 MB/s + 19.2 MB/s + 18.6 MB/s = 57.1 MB/s QEMU with smp=4 15.3 MB/s + 14.1 MB/s + 13.6 MB/s = 43.0 MB/s Is this expected? Did you configure with --enable-io-thread? Yes I did. Also, try using dd oflag=direct to eliminate effects introduced by the guest page cache and really hit the disk. With oflag=direct , I see no difference and the throughput is so slow and I would not expect to see any difference. It is 225 kb/s for each thread either with smp=1 or with smp=4. If I understand correctly you are getting: QEMU oflag=direct with smp=1 225 KB/s + 225 KB/s + 225 KB/s = 675 KB/s QEMU oflag=direct with smp=4 225 KB/s + 225 KB/s + 225 KB/s = 675 KB/s This suggests the degradation for smp=4 is guest kernel page cache or buffered I/O related. Perhaps lockholder preemption? or just a single spindle maxed out because the blade hard drive doesn't have writecache enabled (it's disabled by default). Yes, I am sure we are hitting the max limit on the blade local disk. Question is why the smp=4 degraded the performance in the cached mode. I am running latest kernel from upstream on the guest(2.6.36-rc5)..and using block IO. Do we have any know issues in there which could explain performance degradation? I suggested that lockholder preemption might be the issue. If you check /proc/lock_stat in a guest debug kernel after seeing poor performance, do the lock statistics look suspicious (very long hold times)? Stefan
[Qemu-devel] [Bug 423910] Re: openbios-sparc has no installation candidate
Packaging problem in Ubuntu, not upstream. ** Also affects: qemu-kvm (Ubuntu) Importance: Undecided Status: New ** Changed in: qemu Status: New = Invalid -- openbios-sparc has no installation candidate https://bugs.launchpad.net/bugs/423910 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: Invalid Status in “openbios-sparc” package in Ubuntu: New Status in “qemu-kvm” package in Ubuntu: New Bug description: When installing Qemu through apt-get, openbios-sparc is recommended, but, Package openbios-sparc is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package openbios-sparc has no installation candidate
[Qemu-devel] [Bug 568053] Re: requires MSYS coreutils ext sub-package to build on Windows
pc-bios/optionrom/signrom.sh uses 'dd'. ** Changed in: qemu Status: New = Confirmed -- requires MSYS coreutils ext sub-package to build on Windows https://bugs.launchpad.net/bugs/568053 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: Confirmed Bug description: When I try to build QEMU on Windows without the MSYS coreutils ext sub-package installed, the build fails because it cannot find dd.
[Qemu-devel] [Bug 592028] Re: sparc32plus user test failed
Cross-OS emulation is not supported for user emulators. ** Changed in: qemu Status: New = Invalid ** Changed in: qemu Assignee: (unassigned) = blueswirl (blauwirbel) -- sparc32plus user test failed https://bugs.launchpad.net/bugs/592028 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: Invalid Bug description: Hello, I try to execute on linux machine sparc binary (simple hello word application) using qemu-sparc32plus and get segfault.Before test I copy all libraries and headers (/usr/lib, /lib/, /usr/local/lib /usr/include /usr/local/include) from original solaris workstation to separate directory on linux machine: /usr/cross/sysroot I also copy statically builded qemu binaries and hello_world app in /usr/cross/sysroot/bin and start app as: chroot /usr/cross/sysroot qemu-sparc32plus bin/hello_world but also I get segfault. As I see all necessary shared libs and interpreter (/usr/lib/ld.so.1) exists in apropriate directories: /usr/lib, /lib/, /usr/local/lib under new sysroot = /usr/cross/sysroot. I also try to run simple sparc32 app using qemu-sparc32plus but also get segfault. After that I try to run tests from linux-user-test-0.3 packet but they also fail with qemu-sparc32plus emulation. I try to perform such test on different type of systems (see further) and several version of qemu (builded from sources qemu-0.12.4 qemu-0.11.1 with configure make ). Probably I miss something in configuration or perform some wrong step with qemu-sparc32plus, could you please clarify is sparc32plus user mode emulation is sucessfuly exists in the latest versions of qemu? configuration of original Solaris sparc station where I build app: bash-3.00# uname -a SunOS fs650 5.10 Generic_137111-07 sun4us sparc FJSV,GPUZC-M bash-3.00# gcc --version gcc (GCC) 3.4.6 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. bash-3.00# psrinfo -v Status of virtual processor 0 as of: 05/27/2010 12:23:06 on-line since 05/13/2010 18:40:47. The sparcv9 processor operates at 1889 MHz, and has a sparcv9 floating point processor. skipped 1 - 6. Status of virtual processor 7 as of: 05/27/2010 12:23:06 on-line since 05/13/2010 18:41:14. The sparcv9 processor operates at 1889 MHz, and has a sparcv9 floating point processor. source: bash-3.00# cat sample.c #include stdio.h int main(int argc, char* argv[]) { printf(Hello word!\n); return 0; } compilation string: bash-3.00# g++ -m32 -mcpu=v9 sample.c bash-3.00# file a.out a.out: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped, no debugging information available configuration of 1st test machine - Debian Testing : /home/dima# uname -a Linux T291-2 2.6.32-trunk-686 #1 SMP Sun Jan 10 06:32:16 UTC 2010 i686 GNU/Linux /home/dima# cat /etc/issue Debian GNU/Linux squeeze/sid /home/dima# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz stepping: 13 cpu MHz : 1799.624 cache size : 1024 KB physical id : 0 siblings: 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fdiv_bug: no hlt_bug : no f00f_bug: no coma_bug: no fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm bogomips: 3599.24 clflush size: 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: processor : 1 ...skipped.. address sizes : 36 bits physical, 48 bits virtual power management: configuration of 2nd test machine - Debian Lenny stable: d...@debian:~/Desktop/linux-user-test-0.3$ uname -a Linux debian 2.6.26-1-686 #1 SMP Sat Jan 10 18:29:31 UTC 2009 i686 GNU/Linux d...@debian:~/Desktop/linux-user-test-0.3$ gcc --version gcc (Debian 4.3.2-1.1) 4.3.2 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. cpu - intel q6600 configuration of 3rd test machine: vmware image of SLES 11 cat /etc/issue Welcome to SUSE Linux Enterprise Server 11 (x86_64) - Kernel \r (\l). cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU
[Qemu-devel] [PATCH v2] es1370: Fix compiler warnings for debug code
The patch fixes these gcc warnings: ./hw/es1370.c: In function ‘es1370_update_voices’: ./hw/es1370.c:411: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’ ./hw/es1370.c: In function ‘es1370_writel’: ./hw/es1370.c:579: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’ ./hw/es1370.c:589: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’ ./hw/es1370.c:606: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’ ./hw/es1370.c: In function ‘es1370_readl’: ./hw/es1370.c:748: error: suggest braces around empty body in an ‘if’ statement v2 * Use %zd for pointer differences (ptrdiff_t or ssize_t). The gcc error message (long int) was misleading. Malc, thank you for this hint. Cc: Blue Swirl blauwir...@gmail.com Cc: malc av1...@comtv.ru Signed-off-by: Stefan Weil w...@mail.berlios.de --- hw/es1370.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/es1370.c b/hw/es1370.c index 40cb48c..591dbd0 100644 --- a/hw/es1370.c +++ b/hw/es1370.c @@ -408,7 +408,7 @@ static void es1370_update_voices (ES1370State *s, uint32_t ctl, uint32_t sctl) if ((old_fmt != new_fmt) || (old_freq != new_freq)) { d-shift = (new_fmt 1) + (new_fmt 1); -ldebug (channel %d, freq = %d, nchannels %d, fmt %d, shift %d\n, +ldebug (channel %zu, freq = %d, nchannels %d, fmt %d, shift %d\n, i, new_freq, 1 (new_fmt 1), @@ -576,7 +576,7 @@ IO_WRITE_PROTO (es1370_writel) d++; case ES1370_REG_DAC1_SCOUNT: d-scount = (val 0x) | (d-scount ~0x); -ldebug (chan %d CURR_SAMP_CT %d, SAMP_CT %d\n, +ldebug (chan %zd CURR_SAMP_CT %d, SAMP_CT %d\n, d - s-chan[0], val 16, (val 0x)); break; @@ -586,7 +586,7 @@ IO_WRITE_PROTO (es1370_writel) d++; case ES1370_REG_DAC1_FRAMEADR: d-frame_addr = val; -ldebug (chan %d frame address %#x\n, d - s-chan[0], val); +ldebug (chan %zd frame address %#x\n, d - s-chan[0], val); break; case ES1370_REG_PHANTOM_FRAMECNT: @@ -603,7 +603,7 @@ IO_WRITE_PROTO (es1370_writel) case ES1370_REG_DAC1_FRAMECNT: d-frame_cnt = val; d-leftover = 0; -ldebug (chan %d frame count %d, buffer size %d\n, +ldebug (chan %zd frame count %d, buffer size %d\n, d - s-chan[0], val 16, val 0x); break; @@ -743,9 +743,10 @@ IO_READ_PROTO (es1370_readl) { uint32_t size = ((d-frame_cnt 0x) + 1) 2; uint32_t curr = ((d-frame_cnt 16) + 1) 2; -if (curr size) +if (curr size) { dolog (read framecnt curr %d, size %d %d\n, curr, size, curr size); +} } #endif break; -- 1.7.1
[Qemu-devel] [PATCH] fix '/' and '|' on russian keymap
Patch from Oleg L. Sadov. Removes broken 'slash' and 'bar' definitions (that were duplicated) from the 'ru' keymap. I can't test it myself, but the the fix was reported to be working, at: https://bugzilla.redhat.com/show_bug.cgi?id=580637 Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- pc-bios/keymaps/ru |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/pc-bios/keymaps/ru b/pc-bios/keymaps/ru index b3e7d24..70a68f4 100644 --- a/pc-bios/keymaps/ru +++ b/pc-bios/keymaps/ru @@ -105,5 +105,3 @@ Cyrillic_yu 0x34 altgr Cyrillic_YU 0x34 shift altgr slash 0x35 question 0x35 shift -slash 0x56 altgr -bar 0x56 shift altgr -- 1.7.2.1
[Qemu-devel] [PULL 00/23]: Monitor queue
Hi Anthony, The following patches have been sent to the list and look good to me, I've also tested them. The changes (since 2c50e26efdb7e405ecacf89e6a57a60179226dd8) are available in the following repository: git://repo.or.cz/qemu/qmp-unstable.git for-anthony Daniel P. Berrange (2): Add support for JSON pretty printing Add option to turn on JSON pretty printing in monitor Eduardo Habkost (1): disable guest-provided stats on info balloon command Luiz Capitulino (20): Monitor: Introduce search_dispatch_table() QMP: handle_qmp_command(): Move 'cmd' sanity check QMP: Don't use do_info() Monitor: Drop QMP bits from do_info() Monitor: Drop is_async_return() Monitor: Convert do_info() back to HMP Monitor: Introduce the qmp-commands.hx file QMP: Introduce qmp_find_cmd() QMP: Introduce command dispatch table QMP: Introduce query commands dispatch table QMP: Simplify do_info_commands() QMP: Small cleanup in handle_qmp_command() Monitor: Drop QMP info from the qemu-monitor.hx file Monitor: Drop monitor_cmd_user_only() Monitor: Rename monitor_handler_ported() Monitor: Rename monitor_handler_is_async() Monitor: Directly call QObject handlers QMP: Introduce qmp_call_cmd() Monitor: Rename the qemu-monitor.hx file QMP/README: Update QMP homepage address Makefile|4 +- Makefile.target |9 +- QMP/README |4 +- hmp-commands.hx | 1216 hw/virtio-balloon.c |8 +- monitor.c | 366 +--- monitor.h |2 +- qemu-config.c |3 + qemu-monitor.hx | 2575 --- qjson.c | 55 +- qjson.h |1 + qmp-commands.hx | 1541 ++ vl.c|3 + 13 files changed, 3061 insertions(+), 2726 deletions(-)
[Qemu-devel] [PATCH 01/23] Add support for JSON pretty printing
From: Daniel P. Berrange berra...@redhat.com The monitor does not pretty-print JSON output, so that everything will be on a single line reply. When JSON docs get large this is quite unpleasant to read. For the future command line capabilities query ability, huge JSON docs will be available. This needs the ability to pretty-print. This introduces a new API qobject_to_json_pretty() that does a minimal indentation of list and dict members. As an example, this makes {QMP: {version: {micro: 50, minor: 12, package: , major: 0}, capabilities: []}} Output as { QMP: { version: { micro: 50, minor: 12, package: , major: 0 }, capabilities: [ ] } } NB: this is not turned on for the QMP monitor. Signed-off-by: Daniel P. Berrange berra...@redhat.com Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- qjson.c | 55 +++ qjson.h |1 + 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/qjson.c b/qjson.c index e4ee433..f9c8e77 100644 --- a/qjson.c +++ b/qjson.c @@ -72,43 +72,57 @@ QObject *qobject_from_jsonf(const char *string, ...) typedef struct ToJsonIterState { +int indent; +int pretty; int count; QString *str; } ToJsonIterState; -static void to_json(const QObject *obj, QString *str); +static void to_json(const QObject *obj, QString *str, int pretty, int indent); static void to_json_dict_iter(const char *key, QObject *obj, void *opaque) { ToJsonIterState *s = opaque; QString *qkey; +int j; -if (s-count) { +if (s-count) qstring_append(s-str, , ); + +if (s-pretty) { +qstring_append(s-str, \n); +for (j = 0 ; j s-indent ; j++) +qstring_append(s-str, ); } qkey = qstring_from_str(key); -to_json(QOBJECT(qkey), s-str); +to_json(QOBJECT(qkey), s-str, s-pretty, s-indent); QDECREF(qkey); qstring_append(s-str, : ); -to_json(obj, s-str); +to_json(obj, s-str, s-pretty, s-indent); s-count++; } static void to_json_list_iter(QObject *obj, void *opaque) { ToJsonIterState *s = opaque; +int j; -if (s-count) { +if (s-count) qstring_append(s-str, , ); + +if (s-pretty) { +qstring_append(s-str, \n); +for (j = 0 ; j s-indent ; j++) +qstring_append(s-str, ); } -to_json(obj, s-str); +to_json(obj, s-str, s-pretty, s-indent); s-count++; } -static void to_json(const QObject *obj, QString *str) +static void to_json(const QObject *obj, QString *str, int pretty, int indent) { switch (qobject_type(obj)) { case QTYPE_QINT: { @@ -193,8 +207,16 @@ static void to_json(const QObject *obj, QString *str) s.count = 0; s.str = str; +s.indent = indent + 1; +s.pretty = pretty; qstring_append(str, {); qdict_iter(val, to_json_dict_iter, s); +if (pretty) { +int j; +qstring_append(str, \n); +for (j = 0 ; j indent ; j++) +qstring_append(str, ); +} qstring_append(str, }); break; } @@ -204,8 +226,16 @@ static void to_json(const QObject *obj, QString *str) s.count = 0; s.str = str; +s.indent = indent + 1; +s.pretty = pretty; qstring_append(str, [); qlist_iter(val, (void *)to_json_list_iter, s); +if (pretty) { +int j; +qstring_append(str, \n); +for (j = 0 ; j indent ; j++) +qstring_append(str, ); +} qstring_append(str, ]); break; } @@ -249,7 +279,16 @@ QString *qobject_to_json(const QObject *obj) { QString *str = qstring_new(); -to_json(obj, str); +to_json(obj, str, 0, 0); + +return str; +} + +QString *qobject_to_json_pretty(const QObject *obj) +{ +QString *str = qstring_new(); + +to_json(obj, str, 1, 0); return str; } diff --git a/qjson.h b/qjson.h index 7afec2e..cd60e0b 100644 --- a/qjson.h +++ b/qjson.h @@ -24,5 +24,6 @@ QObject *qobject_from_jsonf(const char *string, ...) QObject *qobject_from_jsonv(const char *string, va_list *ap); QString *qobject_to_json(const QObject *obj); +QString *qobject_to_json_pretty(const QObject *obj); #endif /* QJSON_H */ -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 06/23] QMP: Don't use do_info()
Since its inception, QMP has been using HMP's do_info() function to run query commands. This was a bad choice, as it made do_info() more complex and contributed to couple QMP and HMP. This commit fixes that by doing the following changes: 1. Introduce qmp_find_query_cmd() and use it to directly lookup the info_cmds table 2. Introduce qmp_call_query_cmd() so that QMP code is able to call query handlers without using do_info() 3. Drop do_info() usage (via monitor_find_command(info)) We need all the three changes in one shot so that we don't break the calling of query commands in QMP. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 39 +++ 1 files changed, 31 insertions(+), 8 deletions(-) diff --git a/monitor.c b/monitor.c index 2efff8a..ff65f38 100644 --- a/monitor.c +++ b/monitor.c @@ -3390,6 +3390,11 @@ static const mon_cmd_t *monitor_find_command(const char *cmdname) return search_dispatch_table(mon_cmds, cmdname); } +static const mon_cmd_t *qmp_find_query_cmd(const char *info_item) +{ +return search_dispatch_table(info_cmds, info_item); +} + static const mon_cmd_t *monitor_parse_command(Monitor *mon, const char *cmdline, QDict *qdict) @@ -4329,6 +4334,24 @@ static QDict *qmp_check_input_obj(QObject *input_obj) return input_dict; } +static void qmp_call_query_cmd(Monitor *mon, const mon_cmd_t *cmd) +{ +QObject *ret_data = NULL; + +if (monitor_handler_is_async(cmd)) { +qmp_async_info_handler(mon, cmd); +if (monitor_has_error(mon)) { +monitor_protocol_emitter(mon, NULL); +} +} else { +cmd-mhandler.info_new(mon, ret_data); +if (ret_data) { +monitor_protocol_emitter(mon, ret_data); +qobject_decref(ret_data); +} +} +} + static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) { int err; @@ -4336,8 +4359,9 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) QDict *input, *args; const mon_cmd_t *cmd; Monitor *mon = cur_mon; -const char *cmd_name, *info_item; +const char *cmd_name, *query_cmd; +query_cmd = NULL; args = input = NULL; obj = json_parser_parse(tokens, NULL); @@ -4363,16 +4387,13 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) } /* - * XXX: We need this special case until we get info handlers - * converted into 'query-' commands + * XXX: We need this special case until QMP has its own dispatch table */ if (compare_cmd(cmd_name, info)) { qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name); goto err_out; -} else if (strstart(cmd_name, query-, info_item)) { -cmd = monitor_find_command(info); -qdict_put_obj(input, arguments, - qobject_from_jsonf({ 'item': %s }, info_item)); +} else if (strstart(cmd_name, query-, query_cmd)) { +cmd = qmp_find_query_cmd(query_cmd); } else { cmd = monitor_find_command(cmd_name); } @@ -4395,7 +4416,9 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) goto err_out; } -if (monitor_handler_is_async(cmd)) { +if (query_cmd) { +qmp_call_query_cmd(mon, cmd); +} else if (monitor_handler_is_async(cmd)) { err = qmp_async_cmd_handler(mon, cmd, args); if (err) { /* emit the error response */ -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 02/23] Add option to turn on JSON pretty printing in monitor
From: Daniel P. Berrange berra...@redhat.com Expaned '-mon' arg to allow a 'pretty=on' flag. This makes the monitor pretty print its replies to easy human debugging / reading Signed-off-by: Daniel P. Berrange berra...@redhat.com Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c |5 - monitor.h |1 + qemu-config.c |3 +++ vl.c |3 +++ 4 files changed, 11 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index e602480..a33cdc2 100644 --- a/monitor.c +++ b/monitor.c @@ -351,7 +351,10 @@ static void monitor_json_emitter(Monitor *mon, const QObject *data) { QString *json; -json = qobject_to_json(data); +if (mon-flags MONITOR_USE_PRETTY) + json = qobject_to_json_pretty(data); +else + json = qobject_to_json(data); assert(json != NULL); qstring_append_chr(json, '\n'); diff --git a/monitor.h b/monitor.h index 38b22a4..f2122b5 100644 --- a/monitor.h +++ b/monitor.h @@ -14,6 +14,7 @@ extern Monitor *default_mon; #define MONITOR_IS_DEFAULT0x01 #define MONITOR_USE_READLINE 0x02 #define MONITOR_USE_CONTROL 0x04 +#define MONITOR_USE_PRETTY0x08 /* flags for monitor commands */ #define MONITOR_CMD_ASYNC 0x0001 diff --git a/qemu-config.c b/qemu-config.c index e3b746c..6052a28 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -283,6 +283,9 @@ static QemuOptsList qemu_mon_opts = { },{ .name = default, .type = QEMU_OPT_BOOL, +},{ +.name = pretty, +.type = QEMU_OPT_BOOL, }, { /* end of list */ } }, diff --git a/vl.c b/vl.c index d352d18..939ee87 100644 --- a/vl.c +++ b/vl.c @@ -1562,6 +1562,9 @@ static int mon_init_func(QemuOpts *opts, void *opaque) exit(1); } +if (qemu_opt_get_bool(opts, pretty, 0)) +flags |= MONITOR_USE_PRETTY; + if (qemu_opt_get_bool(opts, default, 0)) flags |= MONITOR_IS_DEFAULT; -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 09/23] Monitor: Convert do_info() back to HMP
This is a HMP specific handler, it makes no sense to have it under QMP. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c |5 ++--- qemu-monitor.hx |3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index 7f2af49..f0854c4 100644 --- a/monitor.c +++ b/monitor.c @@ -636,7 +636,7 @@ static void user_async_info_handler(Monitor *mon, const mon_cmd_t *cmd) } } -static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) +static void do_info(Monitor *mon, const QDict *qdict) { const mon_cmd_t *cmd; const char *item = qdict_get_try_str(qdict, item); @@ -668,11 +668,10 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) cmd-mhandler.info(mon); } -return 0; +return; help: help_cmd(mon, info); -return 0; } static void do_info_version_print(Monitor *mon, const QObject *data) diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 49bcd8d..57d28ac 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -1654,8 +1654,7 @@ EQMP .args_type = item:s?, .params = [subcommand], .help = show various information about the system state, -.user_print = monitor_user_noop, -.mhandler.cmd_new = do_info, +.mhandler.cmd = do_info, }, STEXI -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 07/23] Monitor: Drop QMP bits from do_info()
As of last commit, QMP doesn't use do_info() anymore. Simplify it. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 39 --- 1 files changed, 8 insertions(+), 31 deletions(-) diff --git a/monitor.c b/monitor.c index ff65f38..4fc0ad3 100644 --- a/monitor.c +++ b/monitor.c @@ -642,7 +642,6 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) const char *item = qdict_get_try_str(qdict, item); if (!item) { -assert(monitor_ctrl_mode(mon) == 0); goto help; } @@ -652,24 +651,11 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) } if (cmd-name == NULL) { -if (monitor_ctrl_mode(mon)) { -qerror_report(QERR_COMMAND_NOT_FOUND, item); -return -1; -} goto help; } -if (monitor_ctrl_mode(mon) monitor_cmd_user_only(cmd)) { -qerror_report(QERR_COMMAND_NOT_FOUND, item); -return -1; -} - if (monitor_handler_is_async(cmd)) { -if (monitor_ctrl_mode(mon)) { -qmp_async_info_handler(mon, cmd); -} else { -user_async_info_handler(mon, cmd); -} +user_async_info_handler(mon, cmd); /* * Indicate that this command is asynchronous and will not return any * data (not even empty). Instead, the data will be returned via a @@ -677,24 +663,15 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) */ *ret_data = qobject_from_jsonf({ '__mon_async': 'return' }); } else if (monitor_handler_ported(cmd)) { -cmd-mhandler.info_new(mon, ret_data); +QObject *info_data = NULL; -if (!monitor_ctrl_mode(mon)) { -/* - * User Protocol function is called here, Monitor Protocol is - * handled by monitor_call_handler() - */ -if (*ret_data) -cmd-user_print(mon, *ret_data); +cmd-mhandler.info_new(mon, info_data); +if (info_data) { +cmd-user_print(mon, info_data); +qobject_decref(info_data); } } else { -if (monitor_ctrl_mode(mon)) { -/* handler not converted yet */ -qerror_report(QERR_COMMAND_NOT_FOUND, item); -return -1; -} else { -cmd-mhandler.info(mon); -} +cmd-mhandler.info(mon); } return 0; -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 04/23] Monitor: Introduce search_dispatch_table()
It's a generic version of monitor_find_command() which searches the dispatch table passed as an argument. Future commits will introduce new dispatch tables, so we need common code to search them. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index a33cdc2..da76eab 100644 --- a/monitor.c +++ b/monitor.c @@ -3371,11 +3371,12 @@ static int is_valid_option(const char *c, const char *typestr) return (typestr != NULL); } -static const mon_cmd_t *monitor_find_command(const char *cmdname) +static const mon_cmd_t *search_dispatch_table(const mon_cmd_t *disp_table, + const char *cmdname) { const mon_cmd_t *cmd; -for (cmd = mon_cmds; cmd-name != NULL; cmd++) { +for (cmd = disp_table; cmd-name != NULL; cmd++) { if (compare_cmd(cmdname, cmd-name)) { return cmd; } @@ -3384,6 +3385,11 @@ static const mon_cmd_t *monitor_find_command(const char *cmdname) return NULL; } +static const mon_cmd_t *monitor_find_command(const char *cmdname) +{ +return search_dispatch_table(mon_cmds, cmdname); +} + static const mon_cmd_t *monitor_parse_command(Monitor *mon, const char *cmdline, QDict *qdict) -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 03/23] disable guest-provided stats on info balloon command
From: Eduardo Habkost ehabk...@redhat.com The addition of memory stats reporting to the virtio balloon causes the 'info balloon' command to become asynchronous. This is a regression because in some cases it can hang the user monitor. This is an alternative to Adam Litke's patch. Adam's patch disabled the corresponding (guest-visible) virtio feature bit, causing issues for migration. Original discussion is available at: http://marc.info/?l=qemu-develm=128448124328314w=2 Signed-off-by: Eduardo Habkost ehabk...@redhat.com Acked-by: Adam Litke a...@us.ibm.com Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- hw/virtio-balloon.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c index 1e74674..8adddea 100644 --- a/hw/virtio-balloon.c +++ b/hw/virtio-balloon.c @@ -29,6 +29,10 @@ #include sys/mman.h #endif +/* Disable guest-provided stats by now (https://bugzilla.redhat.com/show_bug.cgi?id=623903) */ +#define ENABLE_GUEST_STATS 0 + + typedef struct VirtIOBalloon { VirtIODevice vdev; @@ -83,12 +87,14 @@ static QObject *get_stats_qobject(VirtIOBalloon *dev) VIRTIO_BALLOON_PFN_SHIFT); stat_put(dict, actual, actual); +#if ENABLE_GUEST_STATS stat_put(dict, mem_swapped_in, dev-stats[VIRTIO_BALLOON_S_SWAP_IN]); stat_put(dict, mem_swapped_out, dev-stats[VIRTIO_BALLOON_S_SWAP_OUT]); stat_put(dict, major_page_faults, dev-stats[VIRTIO_BALLOON_S_MAJFLT]); stat_put(dict, minor_page_faults, dev-stats[VIRTIO_BALLOON_S_MINFLT]); stat_put(dict, free_mem, dev-stats[VIRTIO_BALLOON_S_MEMFREE]); stat_put(dict, total_mem, dev-stats[VIRTIO_BALLOON_S_MEMTOT]); +#endif return QOBJECT(dict); } @@ -214,7 +220,7 @@ static void virtio_balloon_to_target(void *opaque, ram_addr_t target, } dev-stats_callback = cb; dev-stats_opaque_callback_data = cb_data; -if (dev-vdev.guest_features (1 VIRTIO_BALLOON_F_STATS_VQ)) { +if (ENABLE_GUEST_STATS (dev-vdev.guest_features (1 VIRTIO_BALLOON_F_STATS_VQ))) { virtqueue_push(dev-svq, dev-stats_vq_elem, dev-stats_vq_offset); virtio_notify(dev-vdev, dev-svq); } else { -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 05/23] QMP: handle_qmp_command(): Move 'cmd' sanity check
Next commit will change how query commands are handled in a way that the 'cmd' sanity check is also going to be needed for query commands handling. Let's move it out of the else body then. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index da76eab..2efff8a 100644 --- a/monitor.c +++ b/monitor.c @@ -4375,11 +4375,11 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) qobject_from_jsonf({ 'item': %s }, info_item)); } else { cmd = monitor_find_command(cmd_name); -if (!cmd || !monitor_handler_ported(cmd) -|| monitor_cmd_user_only(cmd)) { -qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name); -goto err_out; -} +} + +if (!cmd || !monitor_handler_ported(cmd) || monitor_cmd_user_only(cmd)) { +qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name); +goto err_out; } obj = qdict_get(input, arguments); -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 20/23] Monitor: Directly call QObject handlers
This avoids handle_user_command() calling monitor_call_handler(), which is currently shared with QMP. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index 7959504..03f3c18 100644 --- a/monitor.c +++ b/monitor.c @@ -3917,7 +3917,15 @@ static void handle_user_command(Monitor *mon, const char *cmdline) if (handler_is_async(cmd)) { user_async_cmd_handler(mon, cmd, qdict); } else if (handler_is_qobject(cmd)) { -monitor_call_handler(mon, cmd, qdict); +QObject *data = NULL; + +/* XXX: ignores the error code */ +cmd-mhandler.cmd_new(mon, qdict, data); +assert(!monitor_has_error(mon)); +if (data) { +cmd-user_print(mon, data); +qobject_decref(data); +} } else { cmd-mhandler.cmd(mon, qdict); } -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 08/23] Monitor: Drop is_async_return()
If I understood it correcty, the is_async_return() logic was only used to prevent QMP from issuing duplicated success responses for asynchronous handlers. However, QMP doesn't use do_info() anymore so this is dead logic and (hopefully) can be safely dropped. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 25 + 1 files changed, 1 insertions(+), 24 deletions(-) diff --git a/monitor.c b/monitor.c index 4fc0ad3..7f2af49 100644 --- a/monitor.c +++ b/monitor.c @@ -656,12 +656,6 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) if (monitor_handler_is_async(cmd)) { user_async_info_handler(mon, cmd); -/* - * Indicate that this command is asynchronous and will not return any - * data (not even empty). Instead, the data will be returned via a - * completion callback. - */ -*ret_data = qobject_from_jsonf({ '__mon_async': 'return' }); } else if (monitor_handler_ported(cmd)) { QObject *info_data = NULL; @@ -3720,15 +3714,6 @@ void monitor_set_error(Monitor *mon, QError *qerror) } } -static int is_async_return(const QObject *data) -{ -if (data qobject_type(data) == QTYPE_QDICT) { -return qdict_haskey(qobject_to_qdict(data), __mon_async); -} - -return 0; -} - static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret) { if (monitor_ctrl_mode(mon)) { @@ -3787,15 +3772,7 @@ static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd, ret = cmd-mhandler.cmd_new(mon, params, data); handler_audit(mon, cmd, ret); -if (is_async_return(data)) { -/* - * Asynchronous commands have no initial return data but they can - * generate errors. Data is returned via the async completion handler. - */ -if (monitor_ctrl_mode(mon) monitor_has_error(mon)) { -monitor_protocol_emitter(mon, NULL); -} -} else if (monitor_ctrl_mode(mon)) { +if (monitor_ctrl_mode(mon)) { /* Monitor Protocol */ monitor_protocol_emitter(mon, data); } else { -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 14/23] QMP: Simplify do_info_commands()
We now iterate over QMP's dispatch tables, no need to check for QMP-only handlers anymore. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 13 - 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/monitor.c b/monitor.c index bf5da50..612ee56 100644 --- a/monitor.c +++ b/monitor.c @@ -749,18 +749,13 @@ static void do_info_commands(Monitor *mon, QObject **ret_data) cmd_list = qlist_new(); for (cmd = qmp_cmds; cmd-name != NULL; cmd++) { -if (monitor_handler_ported(cmd) !monitor_cmd_user_only(cmd) -!compare_cmd(cmd-name, info)) { -qlist_append_obj(cmd_list, get_cmd_dict(cmd-name)); -} +qlist_append_obj(cmd_list, get_cmd_dict(cmd-name)); } for (cmd = qmp_query_cmds; cmd-name != NULL; cmd++) { -if (monitor_handler_ported(cmd) !monitor_cmd_user_only(cmd)) { -char buf[128]; -snprintf(buf, sizeof(buf), query-%s, cmd-name); -qlist_append_obj(cmd_list, get_cmd_dict(buf)); -} +char buf[128]; +snprintf(buf, sizeof(buf), query-%s, cmd-name); +qlist_append_obj(cmd_list, get_cmd_dict(buf)); } *ret_data = QOBJECT(cmd_list); -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 17/23] Monitor: Drop monitor_cmd_user_only()
This function was only needed when QMP and HMP were sharing dispatch tables, this is no longer true so just drop it. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c |5 - monitor.h |1 - 2 files changed, 0 insertions(+), 6 deletions(-) diff --git a/monitor.c b/monitor.c index b43277e..8f90250 100644 --- a/monitor.c +++ b/monitor.c @@ -340,11 +340,6 @@ static inline bool monitor_handler_is_async(const mon_cmd_t *cmd) return cmd-flags MONITOR_CMD_ASYNC; } -static inline bool monitor_cmd_user_only(const mon_cmd_t *cmd) -{ -return (cmd-flags MONITOR_CMD_USER_ONLY); -} - static inline int monitor_has_error(const Monitor *mon) { return mon-error != NULL; diff --git a/monitor.h b/monitor.h index f2122b5..44c3625 100644 --- a/monitor.h +++ b/monitor.h @@ -18,7 +18,6 @@ extern Monitor *default_mon; /* flags for monitor commands */ #define MONITOR_CMD_ASYNC 0x0001 -#define MONITOR_CMD_USER_ONLY 0x0002 /* QMP events */ typedef enum MonitorEvent { -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 12/23] QMP: Introduce command dispatch table
Also update QMP functions to use it. The table is generated from the qmp-commands.hx file. From now on, QMP and HMP have different command dispatch tables. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- Makefile.target |7 +-- monitor.c | 11 +-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile.target b/Makefile.target index 91d0381..3a1fa7e 100644 --- a/Makefile.target +++ b/Makefile.target @@ -307,7 +307,7 @@ obj-alpha-y = alpha_palcode.o main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) -monitor.o: qemu-monitor.h +monitor.o: qemu-monitor.h qmp-commands.h $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) @@ -331,10 +331,13 @@ gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx $(call quiet-command,sh $(SRC_PATH)/hxtool -h $ $@, GEN $(TARGET_DIR)$@) +qmp-commands.h: $(SRC_PATH)/qmp-commands.hx + $(call quiet-command,sh $(SRC_PATH)/hxtool -h $ $@, GEN $(TARGET_DIR)$@) + clean: rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o rm -f *.d */*.d tcg/*.o ide/*.o - rm -f qemu-monitor.h gdbstub-xml.c + rm -f qemu-monitor.h qmp-commands.h gdbstub-xml.c install: all ifneq ($(PROGS),) diff --git a/monitor.c b/monitor.c index f62c34a..06141a5 100644 --- a/monitor.c +++ b/monitor.c @@ -189,6 +189,8 @@ static QLIST_HEAD(mon_list, Monitor) mon_list; static const mon_cmd_t mon_cmds[]; static const mon_cmd_t info_cmds[]; +static const mon_cmd_t qmp_cmds[]; + Monitor *cur_mon; Monitor *default_mon; @@ -745,7 +747,7 @@ static void do_info_commands(Monitor *mon, QObject **ret_data) cmd_list = qlist_new(); -for (cmd = mon_cmds; cmd-name != NULL; cmd++) { +for (cmd = qmp_cmds; cmd-name != NULL; cmd++) { if (monitor_handler_ported(cmd) !monitor_cmd_user_only(cmd) !compare_cmd(cmd-name, info)) { qlist_append_obj(cmd_list, get_cmd_dict(cmd-name)); @@ -2635,6 +2637,11 @@ static const mon_cmd_t info_cmds[] = { }, }; +static const mon_cmd_t qmp_cmds[] = { +#include qmp-commands.h +{ /* NULL */ }, +}; + /***/ static const char *pch; @@ -3367,7 +3374,7 @@ static const mon_cmd_t *qmp_find_query_cmd(const char *info_item) static const mon_cmd_t *qmp_find_cmd(const char *cmdname) { -return search_dispatch_table(mon_cmds, cmdname); +return search_dispatch_table(qmp_cmds, cmdname); } static const mon_cmd_t *monitor_parse_command(Monitor *mon, -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 11/23] QMP: Introduce qmp_find_cmd()
Next commit needs this new function: it will introduce the the QMP's command dispatch table and qmp_find_cmd() will be used to search on it. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index f0854c4..f62c34a 100644 --- a/monitor.c +++ b/monitor.c @@ -3365,6 +3365,11 @@ static const mon_cmd_t *qmp_find_query_cmd(const char *info_item) return search_dispatch_table(info_cmds, info_item); } +static const mon_cmd_t *qmp_find_cmd(const char *cmdname) +{ +return search_dispatch_table(mon_cmds, cmdname); +} + static const mon_cmd_t *monitor_parse_command(Monitor *mon, const char *cmdline, QDict *qdict) @@ -4348,7 +4353,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) } else if (strstart(cmd_name, query-, query_cmd)) { cmd = qmp_find_query_cmd(query_cmd); } else { -cmd = monitor_find_command(cmd_name); +cmd = qmp_find_cmd(cmd_name); } if (!cmd || !monitor_handler_ported(cmd) || monitor_cmd_user_only(cmd)) { -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 16/23] Monitor: Drop QMP info from the qemu-monitor.hx file
QMP has its own dispatch table and documentation file (qmp-commands.hx), we can now drop the following QMP specific info from qemu-monitor.hx: o SQMP/EQMP sections o The qmp_capabilities command o The query-commands command However, note that QObject handlers entries are not being removed. This will only happen when we introduce a proper QMP call interface. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c |8 - qemu-monitor.hx | 1358 --- 2 files changed, 0 insertions(+), 1366 deletions(-) diff --git a/monitor.c b/monitor.c index 6e62643..b43277e 100644 --- a/monitor.c +++ b/monitor.c @@ -2352,14 +2352,6 @@ static const mon_cmd_t info_cmds[] = { .mhandler.info_new = do_info_version, }, { -.name = commands, -.args_type = , -.params = , -.help = list QMP available commands, -.user_print = monitor_user_noop, -.mhandler.info_new = do_info_commands, -}, -{ .name = network, .args_type = , .params = , diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 57d28ac..81999aa 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -1,70 +1,10 @@ HXCOMM Use DEFHEADING() to define headings in both help text and texi HXCOMM Text between STEXI and ETEXI are copied to texi version and HXCOMM discarded from C version -HXCOMM Text between SQMP and EQMP is copied to the QMP documention file and -HXCOMM does not show up in the other formats. HXCOMM DEF(command, args, callback, arg_string, help) is used to construct HXCOMM monitor commands HXCOMM HXCOMM can be used for comments, discarded from both texi and C -SQMP -QMP Supported Commands --- - -This document describes all commands currently supported by QMP. - -Most of the time their usage is exactly the same as in the user Monitor, this -means that any other document which also describe commands (the manpage, -QEMU's manual, etc) can and should be consulted. - -QMP has two types of commands: regular and query commands. Regular commands -usually change the Virtual Machine's state someway, while query commands just -return information. The sections below are divided accordingly. - -It's important to observe that all communication examples are formatted in -a reader-friendly way, so that they're easier to understand. However, in real -protocol usage, they're emitted as a single line. - -Also, the following notation is used to denote data flow: - -- data issued by the Client -- Server data response - -Please, refer to the QMP specification (QMP/qmp-spec.txt) for detailed -information on the Server command and response formats. - -NOTE: This document is temporary and will be replaced soon. - -1. Stability Considerations -=== - -The current QMP command set (described in this file) may be useful for a -number of use cases, however it's limited and several commands have bad -defined semantics, specially with regard to command completion. - -These problems are going to be solved incrementally in the next QEMU releases -and we're going to establish a deprecation policy for badly defined commands. - -If you're planning to adopt QMP, please observe the following: - -1. The deprecation policy will take efect and be documented soon, please - check the documentation of each used command as soon as a new release of - QEMU is available - -2. DO NOT rely on anything which is not explicit documented - -3. Errors, in special, are not documented. Applications should NOT check - for specific errors classes or data (it's strongly recommended to only - check for the error key) - -2. Regular Commands -=== - -Server's responses in the examples below are always a success response, please -refer to the QMP specification for more details on error responses. - -EQMP - STEXI @table @option ETEXI @@ -111,20 +51,6 @@ STEXI @findex quit Quit the emulator. ETEXI -SQMP -quit - - -Quit the emulator. - -Arguments: None. - -Example: - -- { execute: quit } -- { return: {} } - -EQMP { .name = eject, @@ -140,25 +66,6 @@ STEXI @findex eject Eject a removable medium (use -f to force it). ETEXI -SQMP -eject -- - -Eject a removable medium. - -Arguments: - -- force: force ejection (json-bool, optional) -- device: device name (json-string) - -Example: - -- { execute: eject, arguments: { device: ide1-cd0 } } -- { return: {} } - -Note: The force argument defaults to false. - -EQMP { .name = change, @@ -206,35 +113,6 @@ Password: @end table ETEXI -SQMP -change --- - -Change a removable medium or VNC configuration. - -Arguments: - -- device: device name (json-string) -- target: filename or item (json-string) -- arg: additional argument (json-string, optional) - -Examples: - -1.
[Qemu-devel] [PATCH 23/23] QMP/README: Update QMP homepage address
Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- QMP/README |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/QMP/README b/QMP/README index 7e2b51a..80503f2 100644 --- a/QMP/README +++ b/QMP/README @@ -88,4 +88,4 @@ doing any code change. This is so because: Homepage -http://www.linux-kvm.org/page/MonitorProtocol +http://wiki.qemu.org/QMP -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 10/23] Monitor: Introduce the qmp-commands.hx file
This file contains a copy of the following information from the qemu-monitor.hx file: o QObject handlers entries o QMP documentation (all SQMP/EQMP sections) Right now it's only used to generate the QMP docs in QMP/, but next commits will turn this into QMP's command dispatch table. It's important to note that QObject handlers entries are going to get duplicated: they will exist in both QMP's and HMP's dispatch tables. This will be fixed in the near future, when we add a proper QMP call interface and HMP is converted to use it. This way we can completely drop QObject handlers entries from HMP's tables. NOTE: HMP specific constructions, like q|quit, have been dropped. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- Makefile|2 +- QMP/README |2 +- qmp-commands.hx | 1541 +++ 3 files changed, 1543 insertions(+), 2 deletions(-) create mode 100644 qmp-commands.hx diff --git a/Makefile b/Makefile index fca1e7a..938d88b 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,7 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx $(call quiet-command,sh $(SRC_PATH)/hxtool -t $ $@, GEN $@) -QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx +QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx $(call quiet-command,sh $(SRC_PATH)/hxtool -q $ $@, GEN $@) qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx diff --git a/QMP/README b/QMP/README index 948d445..7e2b51a 100644 --- a/QMP/README +++ b/QMP/README @@ -82,7 +82,7 @@ doing any code change. This is so because: 2. Review can improve your interface. Letting that happen before you implement it can save you work. -* The qmp-commands.txt file is generated from the qemu-monitor.hx one, which +* The qmp-commands.txt file is generated from the qmp-commands.hx one, which is the file that should be edited. Homepage diff --git a/qmp-commands.hx b/qmp-commands.hx new file mode 100644 index 000..793cf1c --- /dev/null +++ b/qmp-commands.hx @@ -0,0 +1,1541 @@ +HXCOMM QMP dispatch table and documentation +HXCOMM Text between SQMP and EQMP is copied to the QMP documention file and +HXCOMM does not show up in the other formats. + +SQMP +QMP Supported Commands +-- + +This document describes all commands currently supported by QMP. + +Most of the time their usage is exactly the same as in the user Monitor, this +means that any other document which also describe commands (the manpage, +QEMU's manual, etc) can and should be consulted. + +QMP has two types of commands: regular and query commands. Regular commands +usually change the Virtual Machine's state someway, while query commands just +return information. The sections below are divided accordingly. + +It's important to observe that all communication examples are formatted in +a reader-friendly way, so that they're easier to understand. However, in real +protocol usage, they're emitted as a single line. + +Also, the following notation is used to denote data flow: + +- data issued by the Client +- Server data response + +Please, refer to the QMP specification (QMP/qmp-spec.txt) for detailed +information on the Server command and response formats. + +NOTE: This document is temporary and will be replaced soon. + +1. Stability Considerations +=== + +The current QMP command set (described in this file) may be useful for a +number of use cases, however it's limited and several commands have bad +defined semantics, specially with regard to command completion. + +These problems are going to be solved incrementally in the next QEMU releases +and we're going to establish a deprecation policy for badly defined commands. + +If you're planning to adopt QMP, please observe the following: + +1. The deprecation policy will take efect and be documented soon, please + check the documentation of each used command as soon as a new release of + QEMU is available + +2. DO NOT rely on anything which is not explicit documented + +3. Errors, in special, are not documented. Applications should NOT check + for specific errors classes or data (it's strongly recommended to only + check for the error key) + +2. Regular Commands +=== + +Server's responses in the examples below are always a success response, please +refer to the QMP specification for more details on error responses. + +EQMP + +{ +.name = quit, +.args_type = , +.params = , +.help = quit the emulator, +.user_print = monitor_user_noop, +.mhandler.cmd_new = do_quit, +}, + +SQMP +quit + + +Quit the emulator. + +Arguments: None. + +Example: + +- { execute: quit } +- { return: {} } + +EQMP + +{ +.name = eject, +.args_type = force:-f,device:B, +.params = [-f]
[Qemu-devel] [PATCH 21/23] QMP: Introduce qmp_call_cmd()
Calls a QObject handler and emits the QMP response, also drops monitor_call_handler() which is now unused. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 39 +++ 1 files changed, 15 insertions(+), 24 deletions(-) diff --git a/monitor.c b/monitor.c index 03f3c18..3f3c9bf 100644 --- a/monitor.c +++ b/monitor.c @@ -3880,29 +3880,6 @@ static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret) } } -static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd, - const QDict *params) -{ -int ret; -QObject *data = NULL; - -mon_print_count_init(mon); - -ret = cmd-mhandler.cmd_new(mon, params, data); -handler_audit(mon, cmd, ret); - -if (monitor_ctrl_mode(mon)) { -/* Monitor Protocol */ -monitor_protocol_emitter(mon, data); -} else { -/* User Protocol */ - if (data) -cmd-user_print(mon, data); -} - -qobject_decref(data); -} - static void handle_user_command(Monitor *mon, const char *cmdline) { QDict *qdict; @@ -4433,6 +4410,20 @@ static void qmp_call_query_cmd(Monitor *mon, const mon_cmd_t *cmd) } } +static void qmp_call_cmd(Monitor *mon, const mon_cmd_t *cmd, + const QDict *params) +{ +int ret; +QObject *data = NULL; + +mon_print_count_init(mon); + +ret = cmd-mhandler.cmd_new(mon, params, data); +handler_audit(mon, cmd, ret); +monitor_protocol_emitter(mon, data); +qobject_decref(data); +} + static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) { int err; @@ -4500,7 +4491,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) goto err_out; } } else { -monitor_call_handler(mon, cmd, args); +qmp_call_cmd(mon, cmd, args); } goto out; -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 15/23] QMP: Small cleanup in handle_qmp_command()
QMP has its own dispatch tables, we can now drop the following checks: o 'info' command: this command doesn't exist in QMP's dispatch table, the right thing will happen when it's issued by a client (ie. command not found error) o monitor_handler_ported(): all QMP handlers are 'ported', no need to check for that o monitor_cmd_user_only(): no HMP handler will exist in QMP's dispatch tables, that's why we have split them after all :-) Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 10 ++ 1 files changed, 2 insertions(+), 8 deletions(-) diff --git a/monitor.c b/monitor.c index 612ee56..6e62643 100644 --- a/monitor.c +++ b/monitor.c @@ -4472,19 +4472,13 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) goto err_out; } -/* - * XXX: We need this special case until QMP has its own dispatch table - */ -if (compare_cmd(cmd_name, info)) { -qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name); -goto err_out; -} else if (strstart(cmd_name, query-, query_cmd)) { +if (strstart(cmd_name, query-, query_cmd)) { cmd = qmp_find_query_cmd(query_cmd); } else { cmd = qmp_find_cmd(cmd_name); } -if (!cmd || !monitor_handler_ported(cmd) || monitor_cmd_user_only(cmd)) { +if (!cmd) { qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name); goto err_out; } -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 19/23] Monitor: Rename monitor_handler_is_async()
Let's follow the convention introduced by the previous commit and call it handler_is_async(). Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index b9dab78..7959504 100644 --- a/monitor.c +++ b/monitor.c @@ -335,7 +335,7 @@ static inline int handler_is_qobject(const mon_cmd_t *cmd) return cmd-user_print != NULL; } -static inline bool monitor_handler_is_async(const mon_cmd_t *cmd) +static inline bool handler_is_async(const mon_cmd_t *cmd) { return cmd-flags MONITOR_CMD_ASYNC; } @@ -652,7 +652,7 @@ static void do_info(Monitor *mon, const QDict *qdict) goto help; } -if (monitor_handler_is_async(cmd)) { +if (handler_is_async(cmd)) { user_async_info_handler(mon, cmd); } else if (handler_is_qobject(cmd)) { QObject *info_data = NULL; @@ -3914,7 +3914,7 @@ static void handle_user_command(Monitor *mon, const char *cmdline) if (!cmd) goto out; -if (monitor_handler_is_async(cmd)) { +if (handler_is_async(cmd)) { user_async_cmd_handler(mon, cmd, qdict); } else if (handler_is_qobject(cmd)) { monitor_call_handler(mon, cmd, qdict); @@ -4411,7 +4411,7 @@ static void qmp_call_query_cmd(Monitor *mon, const mon_cmd_t *cmd) { QObject *ret_data = NULL; -if (monitor_handler_is_async(cmd)) { +if (handler_is_async(cmd)) { qmp_async_info_handler(mon, cmd); if (monitor_has_error(mon)) { monitor_protocol_emitter(mon, NULL); @@ -4485,7 +4485,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) if (query_cmd) { qmp_call_query_cmd(mon, cmd); -} else if (monitor_handler_is_async(cmd)) { +} else if (handler_is_async(cmd)) { err = qmp_async_cmd_handler(mon, cmd, args); if (err) { /* emit the error response */ -- 1.7.3.1.50.g1e633
[Qemu-devel] [PATCH 18/23] Monitor: Rename monitor_handler_ported()
That name makes no sense anymore, as dispatch tables have been split, a better name is handler_is_qobject(), which really communicates the handler's type. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index 8f90250..b9dab78 100644 --- a/monitor.c +++ b/monitor.c @@ -330,7 +330,7 @@ static int monitor_fprintf(FILE *stream, const char *fmt, ...) static void monitor_user_noop(Monitor *mon, const QObject *data) { } -static inline int monitor_handler_ported(const mon_cmd_t *cmd) +static inline int handler_is_qobject(const mon_cmd_t *cmd) { return cmd-user_print != NULL; } @@ -654,7 +654,7 @@ static void do_info(Monitor *mon, const QDict *qdict) if (monitor_handler_is_async(cmd)) { user_async_info_handler(mon, cmd); -} else if (monitor_handler_ported(cmd)) { +} else if (handler_is_qobject(cmd)) { QObject *info_data = NULL; cmd-mhandler.info_new(mon, info_data); @@ -3916,7 +3916,7 @@ static void handle_user_command(Monitor *mon, const char *cmdline) if (monitor_handler_is_async(cmd)) { user_async_cmd_handler(mon, cmd, qdict); -} else if (monitor_handler_ported(cmd)) { +} else if (handler_is_qobject(cmd)) { monitor_call_handler(mon, cmd, qdict); } else { cmd-mhandler.cmd(mon, qdict); -- 1.7.3.1.50.g1e633
[Qemu-devel] [Bug 597402] Re: qemu does not call unlink() on temp files in snapshot mode
Does not seem to happen anymore: strace -etrace=unlink -esignal= -f ./qemu -drive file=/dev/null,snapshot=on unlink(/tmp/vl.jUbLWz)= 0 ** Changed in: qemu Status: New = Fix Committed -- qemu does not call unlink() on temp files in snapshot mode https://bugs.launchpad.net/bugs/597402 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: Fix Committed Bug description: == overview == When booting guests in snapshot mode qemu never calls unlink() on the files storing changes to the images. This results in large amounts of disk space being used over time. This bug seems to have been introduced by qemu git commit b6ce07aa83bdee3cfd2610f270a0ce304e78df95 == steps to reproduce == 1) Boot a guest like so: qemu -m 512 -drive file=/scratch/images/mdroth/rhel54_64_base.raw,snapshot=on == actual results == /tmp/vl.* files are created and never unlinked/deleted. for example: mdr...@illuin:~/dev/kvm/qemu-build$ x86_64-softmmu/qemu-system-x86_64 -m 512 -drive file=/media/secondary/vm/fc12_64_base.raw,snapshot=on [1] 24080 mdr...@illuin:~/dev/kvm/qemu-build$ ls -l /tmp/vl* -rw--- 1 mdroth mdroth 262144 2010-06-22 14:21 /tmp/vl.tFSAmR mdr...@illuin:~/dev/kvm/qemu-build$ fuser /tmp/vl* /tmp/vl.tFSAmR: 24080 == expected results == temporary files should immediately be unlink()'ed and not be present in the file listing. == system details == mdr...@illuin:~/dev/kvm/qemu-build$ uname -a Linux illuin 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 17:01:44 UTC 2009 x86_64 GNU/Linux latest commit (cada87c432e3b9cd55869a24055baf2b7bc0b70c) from qemu.git master branch: mdr...@illuin:~/dev/kvm/qemu-build$ x86_64-softmmu/qemu-system-x86_64 --version QEMU emulator version 0.12.50, Copyright (c) 2003-2008 Fabrice Bellard
[Qemu-devel] [Bug 652293] Re: Linux for SPARC does not work
** Also affects: openbios-sparc (Debian) Importance: Undecided Status: New ** Changed in: qemu Status: New = Invalid ** Changed in: qemu Assignee: (unassigned) = blueswirl (blauwirbel) -- Linux for SPARC does not work https://bugs.launchpad.net/bugs/652293 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: Invalid Status in “openbios-sparc” package in Debian: New Bug description: I tried to use debian for sparc. I downloaded Debain Lenny 5.06 sparc netinst (file name: debian-506-sparc-netinst.iso). I tried to boot it by command: qemu-system-sparc -cdrom debian-506-sparc-netinst.iso -boot d It printed some messages to screen. The last 2 was: entry point is 0x4000 Jumping to entry point... I tried to run it as sparc64 (debian.org sais that debian runs fine on sparc32, but i tried): qemu-system-sparc64 -cdrom debian-506-sparc-netinst.iso -boot d It loaded SILO. When i press enter or print kernel commandline, it starts booting, writes, that it loaded kernel 2.6.26, initrd, and after it i get black screen. System does not boot. I went to google and found that debian lenny can not run on sparc32 (it uses sparc64 kernel, but 32-bit userspace). People recomended me to try debian 4. I downloaded file debian-40r8-sparc-netinst.iso. But i got the same bug with qemu-system-sparc. With sparc64 i did not get black screen.It finished by string: Remapping the kernel... done. What is it? QEMU 0.12.5, from debian repositories. i386 and x86-64 emulation works fine. My computer: Celeron 1.8 Ghz, DDR 1.25 Gb, NVIDIA GeForce 4 MX. As host i use debian squeeze (kernel updated to 2.6.35).
[Qemu-devel] [PATCH 13/23] QMP: Introduce query commands dispatch table
The new table is a copy of HMP's table, containing only QObject handlers. In the near future HMP will be making QMP calls and then we will be able to drop QObject handlers from HMP's table. From now on, QMP and HMP have different query command dispatch tables. Signed-off-by: Luiz Capitulino lcapitul...@redhat.com --- monitor.c | 130 - 1 files changed, 128 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index 06141a5..bf5da50 100644 --- a/monitor.c +++ b/monitor.c @@ -190,6 +190,7 @@ static const mon_cmd_t mon_cmds[]; static const mon_cmd_t info_cmds[]; static const mon_cmd_t qmp_cmds[]; +static const mon_cmd_t qmp_query_cmds[]; Monitor *cur_mon; Monitor *default_mon; @@ -754,7 +755,7 @@ static void do_info_commands(Monitor *mon, QObject **ret_data) } } -for (cmd = info_cmds; cmd-name != NULL; cmd++) { +for (cmd = qmp_query_cmds; cmd-name != NULL; cmd++) { if (monitor_handler_ported(cmd) !monitor_cmd_user_only(cmd)) { char buf[128]; snprintf(buf, sizeof(buf), query-%s, cmd-name); @@ -2642,6 +2643,131 @@ static const mon_cmd_t qmp_cmds[] = { { /* NULL */ }, }; +static const mon_cmd_t qmp_query_cmds[] = { +{ +.name = version, +.args_type = , +.params = , +.help = show the version of QEMU, +.user_print = do_info_version_print, +.mhandler.info_new = do_info_version, +}, +{ +.name = commands, +.args_type = , +.params = , +.help = list QMP available commands, +.user_print = monitor_user_noop, +.mhandler.info_new = do_info_commands, +}, +{ +.name = chardev, +.args_type = , +.params = , +.help = show the character devices, +.user_print = qemu_chr_info_print, +.mhandler.info_new = qemu_chr_info, +}, +{ +.name = block, +.args_type = , +.params = , +.help = show the block devices, +.user_print = bdrv_info_print, +.mhandler.info_new = bdrv_info, +}, +{ +.name = blockstats, +.args_type = , +.params = , +.help = show block device statistics, +.user_print = bdrv_stats_print, +.mhandler.info_new = bdrv_info_stats, +}, +{ +.name = cpus, +.args_type = , +.params = , +.help = show infos for each CPU, +.user_print = monitor_print_cpus, +.mhandler.info_new = do_info_cpus, +}, +{ +.name = pci, +.args_type = , +.params = , +.help = show PCI info, +.user_print = do_pci_info_print, +.mhandler.info_new = do_pci_info, +}, +{ +.name = kvm, +.args_type = , +.params = , +.help = show KVM information, +.user_print = do_info_kvm_print, +.mhandler.info_new = do_info_kvm, +}, +{ +.name = status, +.args_type = , +.params = , +.help = show the current VM status (running|paused), +.user_print = do_info_status_print, +.mhandler.info_new = do_info_status, +}, +{ +.name = mice, +.args_type = , +.params = , +.help = show which guest mouse is receiving events, +.user_print = do_info_mice_print, +.mhandler.info_new = do_info_mice, +}, +{ +.name = vnc, +.args_type = , +.params = , +.help = show the vnc server status, +.user_print = do_info_vnc_print, +.mhandler.info_new = do_info_vnc, +}, +{ +.name = name, +.args_type = , +.params = , +.help = show the current VM name, +.user_print = do_info_name_print, +.mhandler.info_new = do_info_name, +}, +{ +.name = uuid, +.args_type = , +.params = , +.help = show the current VM UUID, +.user_print = do_info_uuid_print, +.mhandler.info_new = do_info_uuid, +}, +{ +.name = migrate, +.args_type = , +.params = , +.help = show migration status, +.user_print = do_info_migrate_print, +.mhandler.info_new = do_info_migrate, +}, +{ +.name = balloon, +.args_type = , +.params = , +.help = show balloon information, +.user_print = monitor_print_balloon, +.mhandler.info_async = do_info_balloon, +.flags = MONITOR_CMD_ASYNC, +}, +{ /* NULL */ }, +}; + /***/ static const char *pch; @@ -3369,7 +3495,7 @@ static
Re: [Qemu-devel] [PATCH v2] es1370: Fix compiler warnings for debug code
Stefan Weil w...@mail.berlios.de writes: The patch fixes these gcc warnings: ./hw/es1370.c: In function ‘es1370_update_voices’: ./hw/es1370.c:411: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’ ./hw/es1370.c: In function ‘es1370_writel’: ./hw/es1370.c:579: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’ ./hw/es1370.c:589: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’ ./hw/es1370.c:606: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’ ./hw/es1370.c: In function ‘es1370_readl’: ./hw/es1370.c:748: error: suggest braces around empty body in an ‘if’ statement v2 * Use %zd for pointer differences (ptrdiff_t or ssize_t). The gcc error message (long int) was misleading. Malc, thank you for this hint. The correct length modifier for ptrdiff_t is 't', not 'z'. ISO/IEC 9899:1999 7.19.6.1: zSpecifies that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument. tSpecifies that a following d, i, o, u, x, or X conversion specifier applies to a ptrdiff_t or the corresponding unsigned integer type argument; or that a following n conversion specifier applies to a pointer to a ptrdiff_t argument. Not that it makes a difference in practice.
[Qemu-devel] [Bug 532733] Re: apt/dpkg in qemu-system-arm hangs if a big task is installed
This should help a little: I can confirm that this is a problem in rootstock, not just inside qemu or qemu/kvm. Reproducible on host system. System output from uname : u...@lucid:~/kvm$ uname -a Linux lucid 2.6.32-25-generic #44-Ubuntu SMP Fri Sep 17 20:05:27 UTC 2010 x86_64 GNU/Linux Rootstock command used : u...@lucid:~/kvm$ sudo rootstock --fqdn nexus --login user --password psswd --imagesize 8G --seed ubuntu-netbook,build-essential,openssh- server,nano This has failed three times in a row, hanging upon : Unpacking iso-codes (from .../iso-codes_3.12.1-1_all.deb) ... This essential just hangs the bash shell, terminal still responsive to ctrl-C, utilizes 100% of 1 (one) of my dual cores. Is there any open issues on rootstock related to this? Thanks- DrTheFugitive -- apt/dpkg in qemu-system-arm hangs if a big task is installed https://bugs.launchpad.net/bugs/532733 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: Invalid Status in “qemu-kvm” package in Ubuntu: Incomplete Status in “qemu-kvm” source package in Lucid: Incomplete Bug description: Binary package hint: qemu-kvm running rootstock and installing ubuntu-netbook^ makes the VM hang in unpacking iso-codes this is reproducable every time in rootstock as well as in a standard qemu-system-arm vm that contains a minimal ubuntu with running apt-get install ubuntu-netbook
[Qemu-devel] [Bug 532733] Re: apt/dpkg in qemu-system-arm hangs if a big task is installed
What fails is qemu-arm-static, as rootstock uses it internally to install the packages. -- apt/dpkg in qemu-system-arm hangs if a big task is installed https://bugs.launchpad.net/bugs/532733 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: Invalid Status in “qemu-kvm” package in Ubuntu: Incomplete Status in “qemu-kvm” source package in Lucid: Incomplete Bug description: Binary package hint: qemu-kvm running rootstock and installing ubuntu-netbook^ makes the VM hang in unpacking iso-codes this is reproducable every time in rootstock as well as in a standard qemu-system-arm vm that contains a minimal ubuntu with running apt-get install ubuntu-netbook
[Qemu-devel] Minor MMU fixes for PowerPC 40x emulation
Hello, I found I had to make a few minor changes to the MMU code for the PowerPC 40x emulation to get NetBSD to run on a virtual PowerPC 405 core with qemu-system-ppcemb. The 'tlbre' instruction was not working, and permission checking for a TLB entry was not as strict as it should be. Diffs are included below. Thank you. - John Clark diff --git a/target-ppc/helper.c b/target-ppc/helper.c index 3bc8a34..a8c1802 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -1172,9 +1172,9 @@ static int mmu40x_get_physical_address (CPUState *env, mmu_ctx_t *ctx, case 0x1: check_perms: /* Check from TLB entry */ -/* XXX: there is a problem here or in the TLB fill code... */ +/* There is no longer a need to force PAGE_EXEC permission here */ +/* because of the tlb-attr fix in helper_4xx_tlbwe_lo() */ ctx-prot = tlb-prot; -ctx-prot |= PAGE_EXEC; ret = check_prot(ctx-prot, rw, access_type); if (ret == -2) env-spr[SPR_40x_ESR] = 0; diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 3e6db85..54356e8 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -3929,7 +3929,7 @@ static inline int booke_page_size_to_tlb(target_ulong page_size) } /* Helpers for 4xx TLB management */ -target_ulong helper_4xx_tlbre_lo (target_ulong entry) +target_ulong helper_4xx_tlbre_hi (target_ulong entry) { ppcemb_tlb_t *tlb; target_ulong ret; @@ -3939,7 +3939,7 @@ target_ulong helper_4xx_tlbre_lo (target_ulong entry) tlb = env-tlb[entry].tlbe; ret = tlb-EPN; if (tlb-prot PAGE_VALID) -ret |= 0x400; +ret |= 0x40;/* V bit is 0x40, not 0x400 */ size = booke_page_size_to_tlb(tlb-size); if (size 0 || size 0x7) size = 1; @@ -3948,7 +3948,7 @@ target_ulong helper_4xx_tlbre_lo (target_ulong entry) return ret; } -target_ulong helper_4xx_tlbre_hi (target_ulong entry) +target_ulong helper_4xx_tlbre_lo (target_ulong entry) { ppcemb_tlb_t *tlb; target_ulong ret;