History | View | Annotate | Download (122.6 kB)
exec: Remove debugging fprintf() that slipped into qemu_ram_alloc_from_ptr()
Remove the debugging fprintf() slipped in via the following commit:
commit b2e0a138e77245290428a7d599a929e2e1bfe510 Author: Michael S. Tsirkin <mst@redhat.com> Date: Mon Nov 22 19:52:34 2010 +0200...
migration: stable ram block ordering
This makes ram block ordering under migration stable, ordered by offset.This is especially useful for migration to exec, for debugging.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Tested-by: Jason Wang <jasowang@redhat.com>
exec: Use fprintf_function for dump_exec_info (format checking)
fprintf_function uses format checking with GCC_FMT_ATTR.
It is declared in qemu-common.h and used in cpu-all.h(which is included from cpu.h), so qemu-common.h mustbe included earlier. Some redundant include statements...
Export qemu_ram_addr_from_host
To be used by next patches.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Avi Kivity <avi@redhat.com>
exec: Fix compilation error for debug code
is_softmmu was removed with commitd4c430a80f000d722bb70287af4d4c184a8d7006,so remove it now from debug code, too.
Fix also the format specifier for paddrin the same line of code.
Cc: Blue Swirl <blauwirbel@gmail.com>...
Introduce qemu_madvise()
vl.c has a Sun-specific hack to supply a prototype for madvise(),but the call site has apparently moved to arch_init.c.
Haiku doesn't implement madvise() in favor of posix_madvise().OpenBSD and Solaris 10 don't implement posix_madvise() but madvise()....
Fix segfault in mmio subpage handling code.
It is possible that subpage mmio is registered over existing memorypage. When this happens "memory" will have real memory address and notindex into io_mem array so next access to the page will generatesegfault. It is uncommon to have some part of a page to be accessed as...
exec: replace tabs by spaces.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
exec: remove code duplication in qemu_ram_alloc() and qemu_ram_alloc_from_ptr()
Since most of the code in qemu_ram_alloc() andqemu_ram_alloc_from_ptr() are duplicated, letqemu_ram_alloc_from_ptr() to switch by checking void *host, and changeqemu_ram_alloc() to a wrapper....
Add qemu_ram_alloc_from_ptr function
Provide a function to add an allocated region of memory to the qemu RAM.
This patch is copied from Marcelo's qemu_ram_map() in qemu-kvm and given theclearer name qemu_ram_alloc_from_ptr().
Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>...
Declare code_gen_ptr, code_gen_max_blocks 'static'
Both values are only used in exec.c, so there is no needto make them globally available.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Fix warning about uninitialized variable
With gcc 4.2.1-sjlj (mingw32-2) I get this warning:/src/qemu/exec.c: In function 'qemu_ram_alloc':/src/qemu/exec.c:2777: warning: 'offset' may be used uninitialized in this function
Fix by initializing the variable....
ramblocks: No more being lazy about duplicate names
Now that we have a working qemu_ram_free() and the primary runtimeuser of it has been updated, don't be lenient about duplicate id strings.We also shouldn't need to create them ondemand at the target....
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceStatewhen registering a savevm. For buses with a get_dev_path()function, this will allow us to create more unique savevmid strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
qemu_ram_alloc: Add DeviceState and name parameters
These will be used to generate unique id strings for ramblocks. The namefield is required, the device pointer is optional as most callers don'thave a device. When there's no device or the device isn't a child of...
ramblocks: Make use of DeviceState pointer and BusInfo.get_dev_path
With these two pieces in place, we can start naming ramblocks. Whenthe device is present and it lives on a bus that provides a devicepath, we concatenate the path and the provided name. Otherwise we...
qemu_ram_free: Implement it
Now that we can support a ram_addr_t space with holes, we can implementqemu_ram_free().
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Remove uses of ram.last_offset (aka last_ram_offset)
We currently need this either to allocate the next ram_addr_t for anew block, or for total memory to be migrated. Both of which we cancalculate without need of this to keep us in a contiguous address space....
A bit optimization for tlb_set_page()
This patch avoids handling write watchpoints on read-only memory access.It also breaks the searching loop for watchpoint once the setup forhandling watchpoint later is done.
Signed-off-by: Jun Koi <junkoi2004@gmail.com>...
ram_blocks: Convert to a QLIST
This makes the RAM block list easier to manipulate. Also incorporaterelevant variables into the RAMList struct.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Acked-by: Chris Wright <chrisw@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
tcg-s390: Allocate the code_gen_buffer near the main program.
This allows the use of direct calls to the helpers,and a direct branch back to the epilogue.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: get rid of copy_size in TCGOpDef
copy_size is a left-over from the dyngen era, remove it.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: Initialize the prologue after GUEST_BASE is fixed.
This will allow backends to make intelligent choices about howto implement GUEST_BASE.
Fix -mem-path with hugetlbfs
Fallback to qemu_vmalloc in case file_ram_alloc fails.
Fill in unassigned mem read/write callbacks.
Implement the "functions may be omitted with NULL pointer" interface mentioned in the function block comment by transformingNULL entries in the read/write arrays into calls to theunassigned_mem family of functions....
qemu: address todo comment in exec.c
exec.c has a comment 'XXX: optimize' for lduw_phys/stw_phys,so let's do it, along the lines of stl_phys.
The reason to address 16 bit accesses specifically is that virtio relieson these accesses to be done atomically, using memset as we do now...
Fix zero-length write(2).
Remove PAGE_RESERVED
The usermode PAGE_RESERVED code is not required by the current mmapimplementation, and is already broken when guest_base != 0.Unfortunately the bsd emulation still uses the old mmap implementation,so we can't rip it out altogether....
Remove IO_MEM_SUBWIDTH.
Greatly simplify the subpage implementation by not supportingmultiple devices at the same address at different widths. Wedon't need full copies of mem_read/mem_write/opaque for eachaddress, only a single index back into the main io_mem_* arrays....
Cleanup dead code
This patch removes some dead code in exec.c
Signed-off-by: Jun Koi <junkoi2004@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Revert "Avoid page_set_flags() assert in qemu-user host page protection code"
This reverts commit 01c0bef1625d8e5d6d5c6abaf413214d667615ad.
(breaks build on 32-bit hosts)
Avoid page_set_flags() assert in qemu-user host page protection code
V2 that uses endaddr = end-of-guest-address-space if !h2g_valid(endaddr)after I found out that indeed works; and also disables the FreeBSD 6.x/compat/linux/proc/self/maps fallback because it can return partial lines...
Replace direct phys_ram_dirty access with wrapper functions.
Replaces direct phys_ram_dirty access with wrapper functions to preventdirect access to the phys_ram_dirty bitmap.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>...
Split TLB addend and target_phys_addr_t
Historically the qemu tlb "addend" field was used for both RAM and IO accesses,so needed to be able to hold both host addresses (unsigned long) and guestphysical addresses (target_phys_addr_t). However since the introduction of...
linux-user: fix page_unprotect when host page size > target page size
When the host page size is bigger that the target one, unprotecting apage should:- mark all the target pages corresponding to the host page as writable- invalidate all tb corresponding to the host page (and not the target...
tcg: align static_code_gen_buffer to CODE_GEN_ALIGN
On ia64, the default memory alignement is not enough for a codealignement. To fix that, force static_code_gen_buffer alignmentto CODE_GEN_ALIGN.
Get bsd-user host page protection code working on FreeBSD hosts
Use kinfo_getvmmap(3) on FeeBSD >= 7.x and /compat/linux/proc on olderFreeBSD. (kinfo_getvmmap is preferred since /compat/linux/proc isusually only mounted on hosts also using the Linuxolator.)...
Compile qemu-timer only once
Arrange various declarations so that also non-CPU code can accessthem, adjust users.
Move CPU specific code to cpus.c.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
exec: remove dead code
be more specific in -mem-path error messages
Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Large page TLB flush
QEMU uses a fixed page size for the CPU TLB. If the guest uses largepages then we effectively split these into multiple smaller pages, andpopulate the corresponding TLB entries on demand.
When the guest invalidates the TLB by virtual address we must invalidate...
Fix pagetable code
The multi-level pagetable code fails to iterate ove all entries becauseof the L2_BITS v.s. L2_SIZE thinko.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Fix more wrong usermode virtual address types
Fixes warning: CC sparc-bsd-user/exec.o/src/qemu/exec.c: In function `page_check_range':/src/qemu/exec.c:2375: warning: comparison is always true due to limited range of data type
Fix usermode virtual address type
Usermode virtual addresses are abi_ulong, not target_ulong.
Disable phsyical memory handling in userspace emulation.
Code to handle physical memory access is not meaningful in usrmode emulation,so disable it.
Add tb_page_addr_t
The page tracking code in exec.c is used by both userspace and systememulation. Userspace emulation uses it to track virtual pages, andsystem emulation to track ram pages. Introduce a new type to hold thiskind of address.
Fix last page errors in page_check_range and page_set_flags.
The addr < end comparison prevents iterating over the lastpage in the guest address space; an iteration based onlength avoids this problem.
At the same time, assert that the given address is in the...
Implement multi-level page tables.
Define L1_MAP_ADDR_SPACE_BITS to be either the virtual address size(in user mode) or physical address size (in system mode), and usethat to size l1_map. This rewrites page_find_alloc, page_flush_tb,and walk_memory_regions....
Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h.
Removes a set of ifdefs from exec.c.
Introduce TARGET_VIRT_ADDR_SPACE_BITS for all targets otherthan Alpha. This will be used for page_find_alloc, which issupposed to be using virtual addresses in the first place....
KVM: Rework VCPU state writeback API
This grand cleanup drops all reset and vmsave/load relatedsynchronization points in favor of four(!) generic hooks:
- cpu_synchronize_all_states in qemu_savevm_state_complete (initial sync from kernel before vmsave)...
Add option to use file backed guest memory
Port qemu-kvm's -mem-path and -mem-prealloc options. These are usefulfor backing guest memory with huge pages via hugetlbfs.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>CC: john cooper <john.cooper@redhat.com>
Avoid tlb_set_page in userspace emulation
tlb_set_page isn't meaningful for userspace emulation, so remove it.
Move subpage definitions
Move definitions for subpage handling into !CONFIG_USER_ONLY code.
Remove bogus cpu_physical_memory_rw
Userspace doesn't have physical memory, so cpu_physical_memory_rwmakes no sense. This is only used to implement cpu_memory_rw_debug, sojust implement that directly instead.
Remove l1_phys_map from userspace emulation
Userspace emulation doesn't have a physical address space, sol1_phys_map makes no sense. This code is never actually used, so don'ttry and build it.
Fix userspace breakpoint invalidation
Remove bogus virtual->physical address translation inbreakpoint_invalidate for userspace emulation.
qemu: memory notifiers
This adds notifiers for phys memory changes: a set of callbacks thatvhost can register and update kernel accordingly. Down the road, kvmcode can be switched to use these as well, instead of calling kvm codedirectly from exec.c as is done now....
kvm: move kvm to use memory notifiers
remove direct kvm calls from exec.c, makekvm use memory notifiers framework instead.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Acked-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Merge remote branch 'qemu-kvm/uq/master' into staging-tmp
fix locking error with current_tb
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: remove signal handler before calling abort()
Qemu may hang in host_signal_handler after qemu has done aseppuku with cpu_abort(). But at this stage we are not reallyinterested in target process coredump anymore, so unregisterhost_signal_handler to die grafefully....
exec.c: dead assignments
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
kvm: Flush coalesced MMIO buffer periodly
The default action of coalesced MMIO is, cache the writing in buffer, until:1. The buffer is full.2. Or the exit to QEmu due to other reasons.
But this would result in a very late writing in some condition.1. The each time write to MMIO content is small....
win32: pair qemu_memalign() with qemu_vfree()
Win32 suffers from a very big memory leak when dealing with SCSI devices.Each read/write request allocates memory with qemu_memalign (ieVirtualAlloc) but frees it with qemu_free (ie free).Pair all qemu_memalign() calls with qemu_vfree() to prevent such leaks....
linux-user: enable tb unlinking when compiled with NPTL
Fixes receiving signals when guest code is being executed in a tightloop. For an example, try interrupting the following code with ctrl-c.
http://nchipin.kos.to/test-loop.c
The tight loop is ofcourse brainless, but it is also exactly how the waitpid* testcases...
Fix win32 log file location
/tmp doesn't exist under win32. Ease the pain of win32 development slightly.
From: Juha Riihimäki <juha.riihimaki@nokia.com>Signed-off-by: Riku Voipio <riku.voipio@nokia.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Give a error when running out of iomem areas.
The limit of iomem areas is quite low. Without thedebug print, it is quite hard to figure out why moredevices are not getting registered.
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Allocate physical memory in low virtual address space
KVM on S390x requires the virtual address space of the guest's RAM to bewithin the first 256GB.
The general direction I'd like to see KVM on S390 move is that this requirementis losened, but for now that's what we're stuck with....
Add support for GNU/kFreeBSD
ksm support
Call MADV_MERGEABLE on guest memory allocations. MADV_MERGABLE will beavailable starting in Linux 2.6.32. This system call registers a region ofvirtual address space with Linux as a candidate for transparent memorysharing.
Patchworks-ID: 35447...
fix comment on cpu_register_physical_memory_offset
We don't require full pages in cpu_register_physical_memory,except for RAM.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vmstate: remove const from pre_save() functions
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vmstate: add version_id argument to post_load
Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.
The naming convention is goofy and it causes a massive merge problem. Somethinglike this must be presented on the list first so people can provide input...
Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the timebeing.
Signed-off-by: malc <av1474@comtv.ru>
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
vmstate: port cpu_comon
microblaze: Trap on bus accesses to unmapped areas.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
kvm: Simplify cpu_synchronize_state()
cpu_synchronize_state() is a little unreadable since the 'modified'argument isn't self-explanatory. Simplify it by making it alwayssynchronize the kernel state into qemu, and automatically flush theregisters back to the kernel if they've been synchronized on this...
Make CPURead/WriteFunc structure 'const'
Unbreak large mem support by removing kqemu
kqemu introduces a number of restrictions on the i386 target. The worst is thatit prevents large memory from working in the default build.
Furthermore, kqemu is fundamentally flawed in a number of ways. It relies on...
Fix Sparse warnings: "Using plain integer as NULL pointer"
rename USE_NPTL to CONFIG_USE_NPTL
Remove setvbuf(<handle>, NULL, _IOLBF, 0) calls for Win32
On Win32 the setvbuf function requires the last parameter to be size between 2 and INT_MAX bytes, so the calls always failed. Since the whole point of the calls is to set line-buffered mode for the file handle and that's not supported on Win32 anyway, conditionally remove them....
Fix most warnings (errors with -Werror) when debugging is enabled
I used the following command to enable debugging:perl -p -i -e 's/^\/\/#define DEBUG/#define DEBUG/g' * /* *//*
tlb flush cleanup
Use static empty variable s_cputlb_empty_entry to clear entries,also reset addend member when clearing entries.This helps running with valgrind/memcheck
Signed-off-by: igor.v.kovalenko@gmail.com
--Kind regards,Igor V. KovalenkoSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
Update to a hopefully more future proof FSF address
cpu_unregister_map_client: fix memory leak.
fix memory leak in cpu_unregister_map_client() and cpu_notify_map_clients().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Win32: Reduce section alignment for Windows.
Maximum alignment for Win32 is 16, so don't tryto set it to 32. Otherwise the compiler complains:
exec.c:102: warning: alignment of 'code_gen_prologue'is greater than maximum object file alignment. Using 16...
exec.c: remove unnecessary #if NB_MMU_MODES
remove unnecessary #if NB_MMU_MODES by using loop.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
provide cpu_index to env mapping
There are some people interested in, given a cpu number,pick its CPUState. KVM is an example, although not yet in tree.This patch provides a way of doing that.
Signed-off-by: Glauber Costa <glommer@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Rearrange io_mem_init()
Move io_mem_init() downwards to avoid a forward declaration. No code change.
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Remove io_index argument from cpu_register_io_memory()
The parameter is always zero except when registering the three internalio regions (ROM, unassigned, notdirty). Remove the parameter to reducethe API's power, thus facilitating future change.
Signed-off-by: Avi Kivity <avi@redhat.com>...
linux-user: implemented ELF coredump support for ARM target
When target process is killed with signal (such signal thatshould dump core) a coredump file is created. This file issimilar than coredump generated by Linux (there are few exceptionsthough)....
fix gdbstub support for multiple threads in usermode, v3
When debugging multi-threaded programs, QEMU's gdb stub would report thecorrect number of threads (the qfThreadInfo and qsThreadInfo packets).However, the stub was unable to actually switch between threads (the T...
kvm: Rework dirty bitmap synchronization
Extend kvm_physical_sync_dirty_bitmap() so that is can sync acrossmultiple slots. Useful for updating the whole dirty log duringmigration. Moreover, properly pass down errors the whole call chain.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
kvm: Add missing bits to support live migration
This patch adds the missing hooks to allow live migration in KVM mode.It adds proper synchronization before/after saving/restoring the VCPUstates (note: PPC is untested), hooks intocpu_physical_memory_set_dirty_tracking() to enable dirty memory logging...
Fix typos in comments in exec.c
This patch fixes several typos in comments in exec.c:
longet -> longer recommanded -> recommended ajustments -> adjustments inconsistancies -> inconsistencies phsical -> physical positionned -> positioned...
kvm: Avoid COW if KVM MMU is asynchronous
Avi Kivity wrote:
Suggest wrapping in a function and hiding it deep inside kvm-all.c.
Done in v2:
---------->
If the KVM MMU is asynchronous (kernel does not support MMU_NOTIFIER),we have to avoid COW for the guest memory. Otherwise we risk serious...
Remove cpu_get_io_memory_{read,write}.