- Dec 17, 2015
-
-
Eric Blake authored
The CpuInfo struct is used only by the 'query-cpus' output command, so we are free to modify it by adding fields (clients are already supposed to ignore unknown output fields), or by changing optional members to mandatory, while still keeping QMP wire compatibility with older versions of qemu. When qapi type CpuInfo was originally created for 0.14, we had no notion of a flat union, and instead just listed a bunch of optional fields with documentation about the mutually-exclusive choice of which instruction pointer field(s) would be provided for a given architecture. But now that we have flat unions and introspection, it is better to segregate off which fields will be provided according to the actual architecture. With this in place, we no longer need the fields to be optional, because the choice of the new 'arch' discriminator serves that role. This has an additional benefit: the old all-in-one struct was the only place in the code base that had a case-sensitive naming of members 'pc' vs. 'PC'. Separating these spellings into different branches of the flat union will allow us to add restrictions against future case-insensitive collisions, since that is generally a poor interface practice. Signed-off-by:
Eric Blake <eblake@redhat.com> Message-Id: <1447836791-369-25-git-send-email-eblake@redhat.com> [Spelling of CPUInfo{SPARC,PPC,MIPS} fixed] Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
- Nov 26, 2015
-
-
Wen Congyang authored
There are still I/O operations when the vm is stopped. For example, stop the vm, and do block migration. In this case, we don't drain all I/O operation, and may meet the following problem: qemu-system-x86_64: migration/block.c:731: block_save_complete: Assertion `block_mig_state.submitted == 0' failed. Signed-off-by:
Wen Congyang <wency@cn.fujitsu.com> Message-Id: <564EE92E.4070701@cn.fujitsu.com> Cc: qemu-stable@nongnu.org Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Nov 06, 2015
-
-
Pavel Dovgaluk authored
This patch introduces checkpoints that synchronize cpu thread and iothread. When checkpoint is met in the code all asynchronous events from the queue are executed. Signed-off-by:
Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru> Message-Id: <20150917162444.8676.52916.stgit@PASHA-ISP.def.inno> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
-
Pavel Dovgaluk authored
icount_warp_rt function is called by qemu_clock_warp and as callback of icount_warp timer. This patch adds call to qemu_clock_warp into main_loop_wait function, because icount warp may be missed in record/replay mode, when CPU is sleeping. This patch also disables of calling this function by timer, because it is not needed after making modifications of main_loop_wait. Signed-off-by:
Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru> Message-Id: <20150917162439.8676.38290.stgit@PASHA-ISP.def.inno> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
-
Pavel Dovgaluk authored
Clock ticks are considered as the sources of non-deterministic data for virtual machine. This patch implements saving the clock values when they are acquired (virtual, host clock). When replaying the execution corresponding values are read from log and transfered to the module, which wants to read the values. Such a design required the clock polling to be synchronized. Sometimes it is not true - e.g. when timeouts for timer lists are checked. In this case we use a cached value of the clock, passing it to the client code. Signed-off-by:
Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru> Message-Id: <20150917162427.8676.36558.stgit@PASHA-ISP.def.inno> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
-
- Nov 05, 2015
-
-
Pavel Dovgaluk authored
This patch adds calls to replay functions into the icount setup block. In record mode number of executed instructions is written to the log. In replay mode number of istructions to execute is taken from the replay log. When replayed instructions counter is expired qemu_notify_event() function is called to wake up the iothread. Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru> Message-Id: <20150917162405.8676.31890.stgit@PASHA-ISP.def.inno> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Liang Li authored
This reverts commit de9d61e8. Now 'cpu_clean_all_dirty' is useless, we can revert the related code. Conflicts: include/sysemu/kvm.h Signed-off-by:
Liang Li <liang.z.li@intel.com> Message-Id: <1446695464-27116-3-git-send-email-liang.z.li@intel.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Oct 08, 2015
-
-
Christopher Covington authored
This should help clarify the purpose of the function that returns the host system's CPU cycle count. Signed-off-by:
Christopher Covington <cov@codeaurora.org> Acked-by:
Paolo Bonzini <pbonzini@redhat.com> ppc portion Acked-by:
David Gibson <david@gibson.dropbear.id.au> Signed-off-by:
Michael Tokarev <mjt@tls.msk.ru>
-
- Sep 30, 2015
-
-
Jason J. Herne authored
Provide a method to throttle guest cpu execution. CPUState is augmented with timeout controls and throttle start/stop functions. To throttle the guest cpu the caller simply has to call the throttle set function and provide a percentage of throttle time. Signed-off-by:
Jason J. Herne <jjherne@linux.vnet.ibm.com> Reviewed-by:
Matthew Rosato <mjrosato@linux.vnet.ibm.com> Signed-off-by:
Juan Quintela <quintela@redhat.com> Reviewed-by:
Juan Quintela <quintela@redhat.com>
-
- Sep 09, 2015
-
-
Frederic Konrad authored
This hides the tcg_halt_cond and tcg_cpu_thread global variables inside qemu_tcg_init_vcpu. Multi-threaded TCG will need one QemuCond and one QemuThread per virtual cpu, so it's preferrable to use cpu->halt_cond and cpu->thread. Signed-off-by:
KONRAD Frederic <fred.konrad@greensocs.com> Message-Id: <1439220437-23957-9-git-send-email-fred.konrad@greensocs.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Protect the list of queued work items with something other than the BQL, as a preparation for running the work items outside it. Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
KONRAD Frederic <fred.konrad@greensocs.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Signals are slow and do not exist on Win32. The previous patches have done most of the legwork to introduce memory barriers (some of them were even there already for the sake of Windows!) and we can now set the flags directly in the iothread. qemu_cpu_kick_thread is not used anymore on TCG, since the TCG thread is never outside usermode while the CPU is running (not halted). Instead run the content of the signal handler (now in qemu_cpu_kick_no_halt) directly. qemu_cpu_kick_no_halt is also used in qemu_mutex_lock_iothread to avoid the overhead of qemu_cond_broadcast. Reviewed-by:
Richard Henderson <rth@twiddle.net> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Use the same API to trigger interruption of a CPU, no matter if under TCG or KVM. There is no difference: these calls come from the CPU thread, so the qemu_cpu_kick calls will send a signal to the running thread and it will be processed synchronously, just like a call to cpu_exit. The only difference is in the overhead, but neither call to cpu_exit (now qemu_cpu_kick) is in a hot path. Reviewed-by:
Richard Henderson <rth@twiddle.net> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Synchronize the remaining pair of accesses in cpu_signal. These should be necessary on Windows as well, at least in theory. Probably SuspendProcess and ResumeProcess introduce some implicit memory barrier. Reviewed-by:
Richard Henderson <rth@twiddle.net> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
This is already useful on Windows in order to remove tls.h, because accesses to current_cpu are done from a different thread on that platform. It will be used on POSIX platforms as soon TCG stops using signals to interrupt the execution of translated code. Reviewed-by:
Richard Henderson <rth@twiddle.net> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Sep 07, 2015
-
-
Aníbal Limón authored
When QEMU starts the RCU thread executes qemu_mutex_lock_thread causing error "qemu:qemu_cpu_kick_thread: No such process" and exits. This isn't occur frequently but in glibc the thread id can exist and this not guarantee that the thread is on active/running state. If is inserted a sleep(1) after newthread assignment [1] the issue appears. So not make assumption that thread exist if first_cpu->thread is set then change the validation of cpu to created that is set into cpu threads (kvm, tcg, dummy). [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_create.c;h=d10f4ea8004e1d8f3a268b95cc0f8d93b8d89867;hb=HEAD#l621 Cc: qemu-stable@nongnu.org Signed-off-by:
Aníbal Limón <anibal.limon@linux.intel.com> Message-Id: <1441313313-3040-1-git-send-email-anibal.limon@linux.intel.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Aug 14, 2015
-
-
Paolo Bonzini authored
After commit 626cf8f4 (icount: set can_do_io outside TB execution, 2014-12-08), can_do_io is set to 1 if not executing code. It is no longer necessary to make this assumption in cpu_can_do_io. It is also possible to remove the use_icount test, simply by never setting cpu->can_do_io to 0 unless use_icount is true. With these changes cpu_can_do_io boils down to a read of cpu->can_do_io. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jul 24, 2015
-
-
Paolo Bonzini authored
Otherwise, grace periods are detected too early! Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jul 09, 2015
-
-
Peter Crosthwaite authored
Remove un-needed usages of ENV_GET_CPU() by converting the APIs to use CPUState pointers and retrieving the env_ptr as minimally needed. Scripted conversion for target-* change: for I in target-*/cpu.h; do sed -i \ 's/\(^int cpu_[^_]*_exec(\)[^ ][^ ]* \*s);$/\1CPUState *cpu);/' \ $I; done Signed-off-by:
Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Peter Crosthwaite authored
The sole caller of this function navigates the cpu->env_ptr only for this function to take it back the cpu pointer straight away. Pass in cpu pointer instead and grab the env pointer locally in the function. Removes a core code usage of ENV_GET_CPU(). Reviewed-by:
Andreas Färber <afaerber@suse.de> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Signed-off-by:
Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
- Jul 01, 2015
-
-
Paolo Bonzini authored
This function will be used to avoid recursive locking of the iothread lock whenever address_space_rw/ld*/st* are called with the BQL held, which is almost always the case. Tracking whether the iothread is owned is very cheap (just use a TLS variable) but requires some care because now the lock must always be taken with qemu_mutex_lock_iothread(). Previously this wasn't the case. Outside TCG mode this is not a problem. In TCG mode, we need to be careful and avoid the "prod out of compiled code" step if already in a VCPU thread. This is easily done with a check on current_cpu, i.e. qemu_in_vcpu_thread(). Hopefully, multithreaded TCG will get rid of the whole logic to kick VCPUs whenever an I/O event occurs! Cc: Frederic Konrad <fred.konrad@greensocs.com> Message-Id: <1434646046-27150-3-git-send-email-pbonzini@redhat.com> Reviewed-by:
Fam Zheng <famz@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
The next patch will require the BQL to be always taken with qemu_mutex_lock_iothread(), while right now this isn't the case. Outside TCG mode this is not a problem. In TCG mode, we need to be careful and avoid the "prod out of compiled code" step if already in a VCPU thread. This is easily done with a check on current_cpu, i.e. qemu_in_vcpu_thread(). Hopefully, multithreaded TCG will get rid of the whole logic to kick VCPUs whenever an I/O event occurs! Cc: Frederic Konrad <fred.konrad@greensocs.com> Message-Id: <1434646046-27150-2-git-send-email-pbonzini@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jun 22, 2015
-
-
Markus Armbruster authored
Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Reviewed-by:
Luiz Capitulino <lcapitulino@redhat.com>
-
Markus Armbruster authored
These macros expand into error class enumeration constant, comma, string. Unclean. Has been that way since commit 13f59ae8. The error class is always ERROR_CLASS_GENERIC_ERROR since the previous commit. Clean up as follows: * Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and delete it from the QERR_ macro. No change after preprocessing. * Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into error_setg(...). Again, no change after preprocessing. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Reviewed-by:
Luiz Capitulino <lcapitulino@redhat.com>
-
- Jun 12, 2015
-
-
Juan Quintela authored
We create optional sections with this patch. But we already have optional subsections. Instead of having two mechanism that do the same, we can just generalize it. For subsections we just change: - Add a needed function to VMStateDescription - Remove VMStateSubsection (after removal of the needed function it is just a VMStateDescription) - Adjust the whole tree, moving the needed function to the corresponding VMStateDescription Signed-off-by:
Juan Quintela <quintela@redhat.com>
-
- Jun 05, 2015
-
-
Victor CLEMENT authored
While qemu is running in sleep=no mode, a warning will be printed when no timer deadline is set. As this mode is intended for getting deterministic virtual time, if no timer is set on the virtual clock this determinism is broken. Signed-off-by:
Victor CLEMENT <victor.clement@openwide.fr> Message-Id: <1432912446-9811-4-git-send-email-victor.clement@openwide.fr> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Victor CLEMENT authored
The 'sleep' parameter sets the icount_sleep mode, which is enabled by default. To disable it, add the 'sleep=no' parameter (or 'nosleep') to the qemu -icount option. Signed-off-by:
Victor CLEMENT <victor.clement@openwide.fr> Message-Id: <1432912446-9811-3-git-send-email-victor.clement@openwide.fr> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Victor CLEMENT authored
When the icount_sleep mode is disabled, the QEMU_VIRTUAL_CLOCK runs at the maximum possible speed by warping the sleep times of the virtual cpu to the soonest clock deadline. The virtual clock will be updated only according the instruction counter. Signed-off-by:
Victor CLEMENT <victor.clement@openwide.fr> Message-Id: <1432912446-9811-2-git-send-email-victor.clement@openwide.fr> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- May 14, 2015
-
-
Eduardo Habkost authored
This will allow clients to query additional information directly using qom-get on the CPU objects. Reviewed-by:
David Gibson <david@gibson.dropbear.id.au> Reviewed-by:
Andreas Färber <afaerber@suse.de> Signed-off-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
- Apr 30, 2015
-
-
Emilio G. Cota authored
Signed-off-by:
Emilio G. Cota <cota@braap.org> Signed-off-by:
Michael Tokarev <mjt@tls.msk.ru>
-
- Mar 25, 2015
-
-
Peter Crosthwaite authored
following a4649824, it's now possible for there to be attempts to take the BQL before CPUs have been realized in cases where a machine model inits peripherals before the first CPU. BQL lock aquisition kicks the first_cpu, leading to a segfault if this happens pre-realize. Guard the CPU kick routine to perform no action for a CPU that doesn't exist or doesn't have a thread yet. There was a fix to this with commit 6b49809c, but the check there misses the case where the CPU has been inited and not realized. Strengthen the check to make sure that the first_cpu has a thread (i.e. it is realized) before allowing the kick. Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Message-Id: <1427107689-6946-1-git-send-email-peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Mar 18, 2015
-
-
Alexey Kardashevskiy authored
2ed1ebcf "timer: replace time() with QEMU_CLOCK_HOST" broke compile when configured with --enable-profiler. Turned out the profiler has been broken for a while. This does s/qemu_time/tcg_time/ as the profiler only works in a TCG mode. This also fixes the compile error. This changes profile_getclock() to return nanoseconds rather than CPU ticks as the "profile" HMP command prints seconds and there is no platform-independent way to get ticks-per-second rate. Since TCG is quite slow and get_clock() returns nanoseconds (fine enough), this should not affect precision much. This removes unused qemu_time_start and tlb_flush_time. Signed-off-by:
Alexey Kardashevskiy <aik@ozlabs.ru> Message-Id: <1426478258-29961-1-git-send-email-aik@ozlabs.ru> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Mar 10, 2015
-
-
Borislav Petkov authored
When requesting a size which cannot be read, the error message shows a different address which is misleading to the user and it looks like something's wrong with the address parsing. This is because the input @addr variable is incremented in the memory dumping loop: (qemu) memsave 0xffffffff8418069c 0xb00000 mem Invalid addr 0xffffffff849ffe9c specified Fix that by saving the original address and size and use them in the error message: (qemu) memsave 0xffffffff8418069c 0xb00000 mem Invalid addr 0xffffffff8418069c/size 11534336 specified Signed-off-by:
Borislav Petkov <bp@suse.de> Signed-off-by:
Michael Tokarev <mjt@tls.msk.ru>
-
- Mar 02, 2015
-
-
Paolo Bonzini authored
For good measure, ensure that the following sequence: thread 1 calls qemu_mutex_lock_iothread thread 2 calls qemu_mutex_lock_iothread VCPU thread are created VCPU thread enters execution loop results in the VCPU threads letting the other two threads run and obeying iothread_requesting_mutex even if the VCPUs are not halted. To do this, check iothread_requesting_mutex before execution starts. Tested-by:
Leon Alrae <leon.alrae@imgtec.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
When two threads (other than the low-priority TCG VCPU thread) are competing for the iothread lock, a deadlock can happen. This is because iothread_requesting_mutex is set to false by the first thread that gets the mutex, and then the VCPU thread might never yield from the execution loop. If iothread_requesting_mutex is changed from a bool to a counter, the deadlock is fixed. However, there is another bug in qemu_mutex_lock_iothread that can be triggered by the new call_rcu thread. The bug happens if qemu_mutex_lock_iothread is called before the CPUs are created. In that case, first_cpu is NULL and the caller segfaults in qemu_mutex_lock_iothread. To fix this, just do not do the kick if first_cpu is NULL. Reported-by:
Leon Alrae <leon.alrae@imgtec.com> Reported-by:
Andreas Gustafsson <gson@gson.org> Tested-by:
Leon Alrae <leon.alrae@imgtec.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Feb 16, 2015
-
-
Paolo Bonzini authored
Note that even after this patch, most callers of address_space_* functions must still be under the big QEMU lock, otherwise the memory region returned by address_space_translate can disappear as soon as address_space_translate returns. This will be fixed in the next part of this series. Reviewed-by:
Fam Zheng <famz@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Fam Zheng authored
qemu_clock_run_timers() only takes care of main_loop_tlg, we shouldn't forget aio timer list groups. Currently, the qemu_clock_deadline_ns_all (a few lines above) counts all the timergroups of this clock type, including aio tlg, but we don't fire them, so they are never cleared, which makes a dead loop. For example, this function hangs when trying to drive throttled block request queue with qtest clock_step. Signed-off-by:
Fam Zheng <famz@redhat.com> Acked-by:
Paolo Bonzini <pbonzini@redhat.com> Message-id: 1421661103-29153-1-git-send-email-famz@redhat.com Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Feb 02, 2015
-
-
Paolo Bonzini authored
With the introduction of QEMU_CLOCK_VIRTUAL_RT, the computation of sc->diff_clk can be simplified nicely: qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + cpu_get_clock_offset() = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - cpu_get_clock_offset()) = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + timers_state.cpu_clock_offset) = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT) Cc: Sebastian Tanase <sebastian.tanase@openwide.fr> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jan 14, 2015
-
-
Pavel Dovgaluk authored
Fix mismatch between timer_new_ms and timer_mod. Signed-off-by:
Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Dec 20, 2014
-
-
Paolo Bonzini authored
This unbreaks linux-user (broken by e511b4d7, cpu-exec: reset exception_index correctly, 2014-11-26). Reported-by:
Eduardo Habkost <ehabkost@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Tested-by:
Laurent Desnogues <laurent.desnogues@gmail.com> Tested-by:
Eduardo Habkost <ehabkost@redhat.com> Message-id: 1418989994-17244-2-git-send-email-pbonzini@redhat.com Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-