History | View | Annotate | Download (34 kB)
cpus: Let vm_stop[_force_state]() always flush block devices
Even if the VM is already stopped, we cannot assume that all data hasalready been successfully flushed to disk. The flush during the previousvm_stop() could have failed.
Run bdrv_flush_all() unconditionally so that we get an error each time...
Merge remote-tracking branch 'quintela/migration.next' into staging
Message-id: 1373664508-5404-1-git-send-email-quintela@redhat.com...
cpus: Add return value for vm_stop()
If flushing the block devices fails, return an error. The VM is stoppedanyway.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Introduce async_run_on_cpu()
Introduce an asynchronous version of run_on_cpu() i.e. the callerdoesn't have to block till the call back routine finishes executionon the target vcpu.
Signed-off-by: Chegu Vinod <chegu_vinod@hp.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
cpu: Make first_cpu and next_cpu CPUState
Move next_cpu from CPU_COMMON to CPUState.Move first_cpu variable to qom/cpu.h.
gdbstub needs to use CPUState::env_ptr for now.cpu_copy() no longer needs to save and restore cpu_next.
Acked-by: Paolo Bonzini <pbonzini@redhat.com>...
cpu: Replace cpu_single_env with CPUState current_cpu
Move it to qom/cpu.h.
Signed-off-by: Andreas Färber <afaerber@suse.de>
KVM: Don't assume that mpstate exists with in-kernel PIC always
On PPC, we don't support MP state. So far it's not necessary and I'mnot convinced yet that we really need to support it ever.
However, the current idle logic in QEMU assumes that an in-kernel PIC...
gdbstub: Set gdb_set_stop_cpu() argument to CPUState
Use CPUState::env_ptr for now.
Prepares for changing cpu_handle_guest_debug() argument to CPUState.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Andreas Färber <afaerber@suse.de>
cpus: Change cpu_handle_guest_debug() argument to CPUState
CPUArchState is no longer needed.
Prepares for changing qemu_kvm_cpu_thread_fn() opaque to CPUState.
cpus: Change qemu_kvm_start_vcpu() argument to CPUState
Pass it on to qemu_kvm_cpu_thread_fn().
Prepares for changing qemu_init_vcpu() argument to CPUState.
cpus: Change qemu_dummy_start_vcpu() argument to CPUState
Pass it to qemu_dummy_cpu_thread_fn().Use CPUState::env_ptr for cpu_single_env.
cpu: Change qemu_init_vcpu() argument to CPUState
This allows to move the call into CPUState's realizefn.Therefore move the stub into libqemustub.a.
kvm: Change cpu_synchronize_state() argument to CPUState
Change Monitor::mon_cpu to CPUState as well.
Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>Acked-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Change cpu_exit() argument to CPUState
It no longer depends on CPUArchState, so move it to qom/cpu.c.
Prepares for changing GDBState::c_cpu to CPUState.
cpus: Change cpu_thread_is_idle() argument to CPUState
It no longer needs CPUArchState.
Prepares for changing all_cpu_threads_idle() CPU loop to CPUState andneeded for changing qemu_kvm_wait_io_event() argument to CPUState.
Reviewed-by: Richard Henderson <rth@twiddle.net>...
cpus: Change qemu_kvm_wait_io_event() argument to CPUState
It no longer uses CPUArchState.
kvm: Change kvm_set_signal_mask() argument to CPUState
Prepares for changing qemu_kvm_init_cpu_signals() argument to CPUState.
Acked-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Richard Henderson <rth@twiddle.net>...
cpus: Change qemu_kvm_init_cpu_signals() argument to CPUState
cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks
Make cpustats monitor command available unconditionally.
Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec()arguments to CPUState.
kvm: Change kvm_cpu_exec() argument to CPUState
Acked-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Andreas Färber <afaerber@suse.de>
cpus: use error_setg_file_open()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Acked-by: Kevin Wolf <kwolf@redhat.com>
cpus: Fix pausing TCG CPUs while in vCPU thread
Due to a preceding while loop, no CPU would've been put into stoppedstate. Reinitialize the variable.This fixes commit d798e97456658ea7605303b7c69b04ec7df95c10 (Allow to usepause_all_vcpus from VCPU context) for non-KVM case....
cpus: Use qemu_for_each_cpu() in TCG thread
Replaces an open-coded loop and hides unused CPUArchState.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Introduce cpu_resume(), for single CPU
Also add a stub for it, to make possible to use it in qom/cpu.c,which is shared with user emulators.
w64: Fix compiler warnings (wrong format specifier)
GetLastError() returns a DWORD value which is unsigned long,so the correct format specifier is %lu.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
cpu: Pass CPUState to cpu_synchronize_post()
... so it could be called without requiring CPUArchState.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
Check effective suspension of TCG thread
On multi-core systems, SuspendThread does not guaranty immediate threadsuspension. We add busy loop to wait for effective thread suspensionafter call to ThreadSuspend().
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>...
cpu: Move halted and interrupt_request fields to CPUState
Both fields are used in VMState, thus need to be moved together.Explicitly zero them on reset since they were located beforebreakpoints.
Pass PowerPCCPU to kvmppc_handle_halt().
cpu: Pass CPUState to cpu_interrupt()
Move it to qom/cpu.h to avoid issues with include order.
Change pc_acpi_smi_interrupt() opaque to X86CPU.
cpus: Replace open-coded CPU loop in qmp_memsave() with qemu_get_cpu()
No functional change, just less usages of first_cpu and next_cpu fields.
env is passed to cpu_memory_rw_debug(), which in turn passes it totarget-specific cpu_get_phys_page_debug(). Changing both would be a...
cpus.c: Drop unnecessary set_cpu_log()
The set_cpu_log() function in cpus.c is a fairly simple wrapperwhich is only called from one location. Just inline the codeinto vl.c, since there is no need to indirect it via cpus.cand the handling of the error case is more appropriate to vl.c....
qemu-log: Rename the public-facing cpu_set_log function to qemu_set_log
Rename the public-facing function cpu_set_log to qemu_set_log. Thisrequires us to rename the internal-only qemu_set_log() todo_qemu_set_log().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
qemu-log: Rename cpu_str_to_log_mask to qemu_str_to_log_mask
Rename cpu_str_to_log_mask() to qemu_str_to_log_mask(), sincethe qemu_log functionality is no longer restricted to TCG CPUdebug logging.
qemu-log: Abstract out "print usage message about valid log categories"
Abstract out the "print a human readable list of all thevalid log categories" functionality which is currently duplicatedin three separate places. (We leave the monitor.c help_cmd()...
qemu-log: Unify {cpu_set,set_cpu}_log_filename as qemu_set_log_filename
The qemu_log() functionality is no longer specific to TCG CPU debug logs.Rename cpu_set_log_filename() to qemu_set_log_filename() and drop thepointless wrapper set_cpu_log_filename()....
kvm: Pass CPUState to kvm_on_sigbus_vcpu()
Since commit 20d695a9254c1b086a456d3b79a3c311236643ba (kvm: PassCPUState to kvm_arch_*) CPUArchState is no longer needed.
Allows to change qemu_kvm_eat_signals() argument as well.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
cpu: Move nr_{cores,threads} fields to CPUState
To facilitate the field movements, pass MIPSCPU to malta_mips_config();avoid that for mips_cpu_map_tc() since callers only access MIPS ThreadContexts, inside TCG helpers.
cpu: Move numa_node field to CPUState
cpu: Move cpu_index field to CPUState
Note that target-alpha accesses this field from TCG, now using anegative offset. Therefore the field is placed last in CPUState.
Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change.
Move common parts of mips cpu_state_reset() to mips_cpu_reset()....
kvm: Pass CPUState to kvm_init_vcpu()
CPUArchState is no longer needed, and it thereby no longer depends onNEED_CPU_H.
softmmu: move include files to include/sysemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
misc: move include files to include/qemu/
monitor: move include files to include/monitor/
exec: move include files to include/exec/
cpus: Pass CPUState to run_on_cpu()
Move the declaration to include/qemu/cpu.h and add documentation.
cpu: Move thread_id to CPUState
cpus: Pass CPUState to [qemu_]cpu_has_work()
For target-mips also change the return type to bool.
Make include paths for cpu-qom.h consistent for alpha and unicore32.
Signed-off-by: Andreas Färber <afaerber@suse.de>[AF: Updated new target-openrisc function accordingly]...
cpus: Pass CPUState to qemu_tcg_init_vcpu()
cpus: Pass CPUState to qemu_cpu_kick()
CPUArchState is no longer needed there.
cpu: Move queued_work_{first,last} to CPUState
cpus: Pass CPUState to flush_queued_work()
cpus: Pass CPUState to qemu_wait_io_event_common()
cpus: Pass CPUState to qemu_cpu_kick_thread()
Signed-off-by: Andreas Färber <afaerber@suse.de>Reviewed-by: Igor Mammedov <imammedo@redhat.com>
cpu: Move created field to CPUState
Change its type to bool.
cpu: Move stop field to CPUState
cpu: Move stopped field to CPUState
cpus: Pass CPUState to cpu_is_stopped()
Also change the return type to bool.
cpus: Pass CPUState to cpu_can_run()
Also change its return type to bool.
cpu: Move halt_cond to CPUState
cpus: Pass CPUState to qemu_tcg_cpu_thread_fn
CPUArchState is no longer needed except for iterating the CPUs.
Needed for qemu_tcg_init_vcpu().
KVM and dummy threads still need CPUArchState for cpu_single_env.
cpus: Pass CPUState to qemu_cpu_is_self()
Change return type to bool, move to include/qemu/cpu.h andadd documentation.
Signed-off-by: Andreas Färber <afaerber@suse.de>Reviewed-by: Igor Mammedov <imammedo@redhat.com>[AF: Updated new caller qemu_in_vcpu_thread()]
cpus: create qemu_in_vcpu_thread()
Old code used !io_thread to know if a thread was an vcpu or not. Thatfails when we introduce the iothread.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic
Move the DUMP_FPU and DUMP_CCOP flags for cpu_dump_state() from beingx86-specific flags to being generic ones. This allows us to drop someTARGET_I386 ifdefs in various places, and means that we can (potentially)...
cpu: Add missing 'static' attribute to qemu_global_mutex
Contrary to its name, 'qemu_global_mutex' is only used locallyin cpus.c.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Drop cpu_list_id macro
Since the only user of the extended cpu_list_id() formatwas the x86 ?model/?dump/?cpuid output, we can drop itcompletely.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>...
kvm: Decouple 'async interrupt delivery' from 'kernel irqchip'
On x86 userspace delivers interrupts to the kernel asynchronously(and therefore VCPU idle management is done in the kernel) if andonly if there is an in-kernel irqchip. On other architectures this...
Fixes related to processing of qemu's -numa option
The -numa option to qemu is used to create [fake] numa nodesand expose them to the guest OS instance.
There are a couple of issues with the -numa option:
a) Max VCPU's that can be specified for a guest while using...
cpu: Move thread_kicked to CPUState
Change field type to bool.
cpu: Move CPU_COMMON_THREAD into CPUState
CPU_COMMON_THREAD was only used for Windows, adding an hThread fieldto CPU_COMMON.
Move the field into QOM CPUState and change its type to HANDLE,which it is assigned from. This requires Windows headers, pulled in...
cpu: Move thread field into CPUState
cpus.c: Make all_cpu_threads_idle() static
Commit 946fb27c1 moved all the uses of all_cpu_threads_idle()into cpus.c. This means we can mark the function 'static'(again), if we shuffle it a bit earlier in the source file.
kvm: Drop redundant kvm_enabled from cpu_thread_is_idle
This is now implied by kvm_irqchip_in_kernel.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Avi Kivity <avi@redhat.com>
qtest: add test framework
The idea behind qtest is pretty simple. Instead of executing a CPU via TCG orKVM, rely on an external process to send events to the device model that the CPUwould normally generate.
qtest presents itself as an accelerator. In addition, a new option is added to...
qtest: add clock management
This patch combines qtest and -icount together to turn the vm_clockinto a source that can be fully managed by the client. To this end newcommands clock_step and clock_set are added. Hooking them with libqtestis left as an exercise to the reader....
Rename CPUState -> CPUArchState
Scripted conversion: for file in .[hc] hw/.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do sed -i "s/CPUState/CPUArchState/g" $file done...
Allow to use pause_all_vcpus from VCPU context
In order to perform critical manipulations on the VM state in thecontext of a VCPU, specifically code patching, stopping and resuming ofall VCPUs may be necessary. resume_all_vcpus is already compatible, now...
Remove useless casts from cpu iterators
CPUState::next_cpu is already CPUState *.
Process pending work while waiting for initial kick-off in TCG mode
When the TCG thread is started but not yet the machine, we wait inqemu_tcg_cpu_thread_fn on tcg_halt_cond. To allow run_on_cpu already atthis time, we need to process pending request in that loop....
kvm: Set cpu_single_env only once
As we have thread-local cpu_single_env now and KVM uses exactly onethread per VCPU, we can drop the cpu_single_env updates from the loopand initialize this variable only once during setup.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
apic: Inject external NMI events via LINT1
On real hardware, NMI button events are injected via the LINT1 line ofthe APICs. E.g. kdump expect this wiring and gets upset if the per-APICLINT1 mask is not respected, i.e. if NMIs are injected to VCPUs that...
cleanup, Remove duplicated code
These two blocks of code are exactly the same, remove one.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
fix win32 build
On Windows, cpus.c needs access to the hThread. Add a Windows-specificfunction to grab it. This requires changing the CPU threads tojoinable. There is no substantial change because the threads runin an infinite loop.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
Merge remote-tracking branch 'stefanha/trivial-patches-next' into staging
qemu-thread: add API for joinable threads
Split from Jan's original qemu-thread-posix.c patch. No semantic change,just introduce the new API that POSIX and Win32 implementations willconform to.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
qapi: Convert pmemsave
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qapi: Convert inject-nmi
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qapi: Convert memsave
Please, note that the QMP command has a new 'cpu-index' parameter.
fix typo: delete redundant semicolon
Double semicolons should be single.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Merge remote-tracking branch 'kwolf/for-anthony' into staging
block: convert qemu_aio_flush() calls to bdrv_drain_all()
Many places in QEMU call qemu_aio_flush() to complete all pendingasynchronous I/O. Most of these places actually want to drain all blockrequests but there is no block layer API to do so.
This patch introduces the bdrv_drain_all() API to wait for requests...
fix spelling in main directory
reenable vm_clock when resuming all vcpus
We disable vm_clock when pausing all vcpus, but we forget toreenable it when resuming all vcpus. It will cause that theguest can not be rebooted.
Tested-by: Zhi Yong Wu <zwu.kernel@gmai.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
Simplify cpu_exec_all to tcg_exec_all
After the removal of the non-threaded mode cpu_exec_all is now only usedby TCG. Refactor it accordingly, also dropping its unused return value.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qapi: Convert query-cpus
simplify main loop functions
Provide a clean example of how to use the main loop in the tools.
qemu-timer: move icount to cpus.c
None of this is needed by tools, and most of it can even be made staticinside cpus.c.
qemu-timer: do not refer to runstate_is_running()
main-loop: create main-loop.h
main-loop: create main-loop.c