aboutsummaryrefslogtreecommitdiffstats
path: root/monitor.c
AgeCommit message (Collapse)AuthorFilesLines
2011-10-04qapi: convert query-nameAnthony Liguori1-28/+3
A simple example conversion 'info name'. This also adds the new files for QMP and HMP. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-04qapi: use middle mode in QMP serverAnthony Liguori1-5/+4
Use the new middle mode within the existing QMP server. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-03trace: trace monitor qmp dispatch/completionStefan Hajnoczi1-1/+4
Add trace events for handle_qmp_command(), which dispatches qmp commands, and monitor_protocol_emitter(), which produces the reply to a qmp command. Also remove duplicate #include "trace/control.h". Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-10-03hmp: re-enable trace-file commandMichael Roth1-1/+1
Commit 31965ae27bc11e90674be12584bb201b83df5aef reverted a previous renaming of CONFIG_SIMPLE_TRACE->CONFIG_TRACE_SIMPLE in a couple spots, leading to trace-file currently being unavailable. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-10-02memory: simple memory tree printerBlue Swirl1-0/+13
Add a monitor command 'info mtree' to show the memory hierarchy much like /proc/iomem in Linux. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-15HMP: info status: Print the VM stateLuiz Capitulino1-0/+6
Today our printf format for the "info status" command is: VM status: %s Where the string can be "running", "running (single step mode)" or "paused". This commit extends it to: VM status: %s (%s) The second string corresponds to the "status" field as returned by the query-status QMP command and it's only printed if "status" is not "running" or "paused". Example: VM status: paused (shutdown) PS: libvirt uses "info status" when using HMP, but the new format should not break it. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-15QMP: query-status: Introduce 'status' keyLuiz Capitulino1-2/+1
This new key reports the current VM status to clients. Please, check the documentation being added in this commit for more details. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-15Monitor/QMP: Don't allow cont on bad VM stateLuiz Capitulino1-0/+5
We have two states where issuing cont before system_reset can cause problems: RSTATE_SHUTDOWN (when -no-shutdown is used) and RSTATE_PANICKED (which only happens with kvm). This commit fixes that by doing the following when state is RSTATE_SHUTDOWN or RSTATE_PANICKED: 1. returning an error to the user/client if cont is issued 2. automatically transition to RSTATE_PAUSED during system_reset Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-15Drop the vm_running global variableLuiz Capitulino1-2/+2
Use runstate_is_running() instead, which is introduced by this commit. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-15Drop the incoming_expected global variableLuiz Capitulino1-1/+1
Test against RSTATE_IN_MIGRATE instead. Please, note that the RSTATE_IN_MIGRATE state is only set when all the initial VM setup is done, while 'incoming_expected' was set right in the beginning when parsing command-line options. Shouldn't be a problem as far as I could check. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-15Replace the VMSTOP macros with a proper state typeLuiz Capitulino1-2/+2
Today, when notifying a VM state change with vm_state_notify(), we pass a VMSTOP macro as the 'reason' argument. This is not ideal because the VMSTOP macros tell why qemu stopped and not exactly what the current VM state is. One example to demonstrate this problem is that vm_start() calls vm_state_notify() with reason=0, which turns out to be VMSTOP_USER. This commit fixes that by replacing the VMSTOP macros with a proper state type called RunState. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-09SPARC: Trivial patch to clean up npc monitor outputNathan Kunkee1-1/+1
This patch fixes the spacing of the PC output from 'info cpus' for SPARC. Signed-off-by: Nathan Kunkee <nkunkee42@hotmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-01trace: always compile support for controlling and querying trace event statesLluís1-4/+5
The current interface is generic for this small set of operations, and thus other backends can easily modify the "trace/control.c" file to add their own implementation. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
2011-09-01trace: separate trace event control and query routines from the simple backendLluís1-5/+6
Generalize the 'st_print_trace_events' and 'st_change_trace_event_state' into backend-specific 'trace_print_events' and 'trace_event_set_state' (respectively) in the "trace/control.h" file. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
2011-09-01trace: [configure] rename CONFIG_*_TRACE into CONFIG_TRACE_*Lluís1-4/+4
Provides a more hierarchical view of the variable domain. Also adds the CONFIG_TRACE_* variables for all backends. [Stefan added missing 'test' in stap if statement] Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-08-25monitor: fix build breakage for !CONFIG_VNCJamie Iles1-1/+1
Commit c62f6d1 (monitor: fix build breakage with --disable-vnc) conditionalised some VNC setup code but left an unused variable. Move the variable into the conditional code to fix the build breakage. Cc: Luiz Capitulino <lcapitulino@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Jamie Iles <jamie@jamieiles.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-08-22char: rename qemu_chr_get_msgfd() -> qemu_chr_fe_get_msgfd()Anthony Liguori1-1/+1
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22char: rename qemu_chr_set_echo() -> qemu_chr_fe_set_echo()Anthony Liguori1-1/+1
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22char: rename qemu_chr_write() -> qemu_chr_fe_write()Anthony Liguori1-1/+1
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-21monitor: Prevent sign-extension of 32-bit addresses printed by info tlbAustin Clements1-2/+2
This is the same fix that was recently applied to info mem. Before this change, info tlb output looked like: ffffffffffffc000: 000000000fffc000 --------W ffffffffffffd000: 000000000fffd000 --------W ffffffffffffe000: 000000000fffe000 --------W fffffffffffff000: 000000000ffff000 --------W With this change, it looks like 00000000ffffc000: 000000000fffc000 --------W 00000000ffffd000: 000000000fffd000 --------W 00000000ffffe000: 000000000fffe000 --------W 00000000fffff000: 000000000ffff000 --------W Signed-off-by: Austin Clements <amdragon@mit.edu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21monitor: Show combined protection bits in "info mem"Austin Clements1-3/+7
Previously, "info mem" considered and displayed only the last-level protection bits for a memory range, which doesn't accurrately represent the protection of that range. Now it shows the combined protection. Signed-off-by: Austin Clements <amdragon@mit.edu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21monitor: Fix "info mem" to print the last memory rangeAustin Clements1-0/+6
"info mem" groups its output into contiguous ranges with identical protection bits, but previously forgot to print the last range. Signed-off-by: Austin Clements <amdragon@mit.edu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21monitor: Prevent sign-extension of 32-bit addresses printed by info memAustin Clements1-2/+4
Previously, on 32-bit i386, info mem used signed 32-bit int's to store the page table indexes. As a result, address calculation was done in 32 bits and then incorrectly sign-extended to 64 bits, yielding output like ffffffffef000000-ffffffffef031000 0000000000031000 ur- ffffffffef7bc000-ffffffffef7bd000 0000000000001000 urw ffffffffef7bd000-ffffffffef7be000 0000000000001000 ur- This makes these indexes unsigned, which yields correct output 00000000ef000000-00000000ef031000 0000000000031000 ur- 00000000ef7bc000-00000000ef7bd000 0000000000001000 urw 00000000ef7bd000-00000000ef7be000 0000000000001000 ur- Signed-off-by: Austin Clements <amdragon@mit.edu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-22/+22
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-29monitor: fix build breakage with --disable-vncTeLeMan1-0/+2
The breakage was introduced by the commit 13661089810d3e59931f3e80d7cb541b99af7071 Signed-off-by: TeLeMan <geleman@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-23Introduce a 'client_add' monitor command accepting an open FDDaniel P. Berrange1-0/+32
Allow client connections for VNC and socket based character devices to be passed in over the monitor using SCM_RIGHTS. One intended usage scenario is to start QEMU with VNC on a UNIX domain socket. An unprivileged user which cannot access the UNIX domain socket, can then connect to QEMU's VNC server by passing an open FD to libvirt, which passes it onto QEMU. { "execute": "get_fd", "arguments": { "fdname": "myclient" } } { "return": {} } { "execute": "add_client", "arguments": { "protocol": "vnc", "fdname": "myclient", "skipauth": true } } { "return": {} } In this case 'protocol' can be 'vnc' or 'spice', or the name of a character device (eg from -chardev id=XXXX) The 'skipauth' parameter can be used to skip any configured VNC authentication scheme, which is useful if the mgmt layer talking to the monitor has already authenticated the client in another way. * console.h: Define 'vnc_display_add_client' method * monitor.c: Implement 'client_add' command * qemu-char.c, qemu-char.h: Add 'qemu_char_add_client' method * qerror.c, qerror.h: Add QERR_ADD_CLIENT_FAILED * qmp-commands.hx: Declare 'client_add' command * ui/vnc.c: Implement 'vnc_display_add_client' method Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-26Remove exec-all.h include directivesBlue Swirl1-1/+1
Most exec-all.h include directives are now useless, remove them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-01HMP: Use QMP inject nmi implementationLuiz Capitulino1-14/+2
This **CHANGES** the human monitor "nmi" command behavior. Currently it accepts an CPU argument which, when provided, will send the NMI to the specified CPU. This feature is of discussable value though and HMP shouldn't have more features than QMP, so let's use QMP's instead (it's also simpler). Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-06-01QMP: add inject-nmi qmp commandLai Jiangshan1-0/+17
inject-nmi command injects an NMI on all CPUs of guest. It is only supported for x86 guest currently, it will returns "Unsupported" error for non-x86 guest. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-05-09monitor: add PPC BookE SPRsScott Wood1-1/+70
Read them via KVM_GET_SREGS in kvm_arch_get_registers(), and display them in "info registers". Also get CR and PID from the existing KVM_GET_REGS. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-04-12Replace cpu_physical_memory_rw were possibleStefan Weil1-5/+4
Using cpu_physical_memory_read, cpu_physical_memory_write and ldub_phys improves readability and allows removing some type casts. lduw_phys and ldl_phys were not used because both require aligned addresses. Therefore it is not possible to simply replace existing calls by one of these functions. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-12monitor: Remove some type casts which are no longer neededStefan Weil1-30/+18
All other type casts in calls of cpu_physical_memory_read are used by hardware emulations and will be fixed by separate patches. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-01Parse SDR1 on mtspr instead of at translate timeDavid Gibson1-1/+1
On ppc machines with hash table MMUs, the special purpose register SDR1 contains both the base address of the encoded size (hashed) page tables. At present, we interpret the SDR1 value within the address translation path. But because the encodings of the size for 32-bit and 64-bit are different this makes for a confusing branch on the MMU type with a bunch of curly shifts and masks in the middle of the translate path. This patch cleans things up by moving the interpretation on SDR1 into the helper function handling the write to the register. This leaves a simple pre-sanitized base address and mask for the hash table in the CPUState structure which is easier to work with in the translation path. This makes the translation path more readable. It addresses the FIXME comment currently in the mtsdr1 helper, by validating the SDR1 value during interpretation. Finally it opens the way for emulating a pSeries-style partition where the hash table used for translation is not mapped into the guests's RAM. Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-03-22Make VNC support optionalJes Sorensen1-12/+10
Per default VNC is enabled. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-21Merge remote branch 'qemu-kvm/uq/master' into stagingAnthony Liguori1-4/+11
2011-03-21change all other clock references to use nanosecond resolution accessorsPaolo Bonzini1-2/+2
This was done with: sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' ) after checking that get_clock and new_timer never occur twice on the same line. There were no missed occurrences; however, even if there had been, they would have been caught by the compiler. There was exactly one false positive in qemu_run_timers: - current_time = qemu_get_clock (clock); + current_time = qemu_get_clock_ns (clock); which is of course not in this patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-16Expose thread_id in info cpusJan Kiszka1-0/+4
Based on patch by Glauber Costa: To allow management applications like libvirt to apply CPU affinities to the VCPU threads, expose their ID via info cpus. This patch provides the pre-existing and used interface from qemu-kvm. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-03-15x86: Optionally avoid injecting AO MCEs while others are pendingJan Kiszka1-2/+5
Allow to tell cpu_x86_inject_mce that it should ignore Action Optional MCE events when the target VCPU is still processing another one. This will be used by KVM soon. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Huang Ying <ying.huang@intel.com> CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> CC: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-03-15x86: Refine error reporting of MCE injection servicesJan Kiszka1-2/+2
As this service is used by the human monitor, make sure that errors get reported to the right channel, and also raise the verbosity. This requires to move Monitor typedef in qemu-common.h to resolve the include dependency. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Huang Ying <ying.huang@intel.com> CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> CC: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-03-15x86: Small cleanups of MCE helpersJan Kiszka1-1/+1
Fix some code style issues, use proper headers, and align to cpu_x86 naming scheme. No functional changes. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Huang Ying <ying.huang@intel.com> CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> CC: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14Improve vm_stop reason declarationsJan Kiszka1-2/+2
Define and use dedicated constants for vm_stop reasons, they actually have nothing to do with the EXCP_* defines used so far. At this chance, specify more detailed reasons so that VM state change handlers can evaluate them. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-01add qemu_chr_set_echoPaolo Bonzini1-0/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-01Merge remote branch 'qemu-kvm/uq/master' into stagingAnthony Liguori1-2/+5
aliguori: fix build with !defined(KVM_CAP_ASYNC_PF) Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-01Merge remote branch 'spice/spice.v29.pull' into stagingAnthony Liguori1-2/+29
Conflicts: trace-events
2011-02-01vnc: Fix password expiration through 'change vnc ""' (v2)Anthony Liguori1-0/+10
commit 52c18be9e99dabe295321153fda7fce9f76647ac introduced a regression in the change vnc password command that changed the behavior of setting the VNC password to an empty string from disabling login to disabling authentication. This commit refactors the code to eliminate this overloaded semantics in vnc_display_password and instead introduces the vnc_display_disable_login. The monitor implementation then determines the behavior of an empty or missing string. Recently, a set_password command was added that allows both the Spice and VNC password to be set. This command has not shown up in a release yet so the behavior is not yet defined. This patch proposes that an empty password be treated as an empty password with no special handling. For specifically disabling login, I believe a new command should be introduced instead of overloading semantics. I'm not sure how Spice handles this but I would recommend that we have Spice and VNC have consistent semantics here for the 0.14.0 release. Reported-by: Neil Wilson <neil@aldur.co.uk> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- v1 -> v2 - Add a proper return to make sure that login is really disabled instead of relying on the VNC server to treat empty passwords specially
2011-01-25monitor: use after free in do_wav_capture()Isaku Yamahata1-1/+2
use after free in do_wav_capture() on the error path. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-24vnc/spice: fix "never" and "now" expire_timeMarc-André Lureau1-2/+2
2011-01-24spice/vnc: client migration.Gerd Hoffmann1-0/+27
Handle spice client migration, i.e. inform a spice client connected about the new host and connection parameters, so it can move over the connection automatically. The monitor command has a not-yet used protocol argument simliar to set_password and expire_password commands. This allows to add a simliar feature to vnc in the future. Daniel Berrange plans to work on this. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-24Make strtosz() return int64_t instead of ssize_tJes Sorensen1-1/+1
strtosz() needs to return a 64 bit type even on 32 bit architectures. Otherwise qemu-img will fail to create disk images >= 2GB Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-21Add "broadcast" option for mce commandJin Dongming1-2/+5
When the following test case is injected with mce command, maybe user could not get the expected result. DATA command cpu bank status mcg_status addr misc (qemu) mce 1 1 0xbd00000000000000 0x05 0x1234 0x8c Expected Result panic type: "Fatal Machine check" That is because each mce command can only inject the given cpu and could not inject mce interrupt to other cpus. So user will get the following result: panic type: "Fatal machine check on current CPU" "broadcast" option is used for injecting dummy data into other cpus. Injecting mce with this option the expected result could be gotten. Usage: Broadcast[on] command broadcast cpu bank status mcg_status addr misc (qemu) mce -b 1 1 0xbd00000000000000 0x05 0x1234 0x8c Broadcast[off] command cpu bank status mcg_status addr misc (qemu) mce 1 1 0xbd00000000000000 0x05 0x1234 0x8c Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>