aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-06-13linux-user: Implement safe_syscall for i386sigrace-fixesPeter Maydell
Implement the host assembly fragment needed for safe_syscall for 32-bit x86. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13linux-user: Implement safe_syscall for 64-bit ARMPeter Maydell
Implement the host assembly fragment needed for safe_syscall for 64-bit ARM. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13linux-user: Implement safe-syscall for 32-bit ARMPeter Maydell
Implement the host assembly fragment needed for safe_syscall for 32-bit ARM. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13linux-user: Create a hostdep.h for each host architecturePeter Maydell
In commit 4d330cee37a21 a new hostdep.h file was added, with the intent that host architectures which needed one could provide it, and the build system would automatically fall back to a generic version if there was no version for the host architecture. Although this works, it has a flaw: if a subsequent commit switches an architecture from "uses generic/hostdep.h" to "uses its own hostdep.h" nothing in the makefile dependencies notices this and so doing a rebuild without a manual 'make clean' will fail. So we drop the idea of having a 'generic' version in favour of every architecture we support having its own hostdep.h, even if it doesn't have anything in it. (There are only thirteen of these.) If the dependency files claim that an object file depends on a nonexistent file, our dependency system means that make will rebuild the object file, and regenerate the dependencies in the process. So moving between trees prior to this commit and trees after this commit works without requiring a 'make clean'. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13user-exec: Remove unused code for OSX hostsPeter Maydell
Since we dropped darwin-user support many years ago, the code in user-exec to support hosts which define __APPLE__ is unused; delete it. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13user-exec: Delete now-unused hppa and m68k cpu_signal_handler() codePeter Maydell
Now that configure blocks attempts to build user-mode code on hppa and m68k hosts, we can delete the cpu_signal_handler() implementations for those architectures. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13configure: Don't allow user-only targets for unknown CPU architecturesPeter Maydell
For the user-only targets, we need to know something about the host CPU architecture even if we are using the TCI interpreter rather than TCG. (In particular user-exec.c has code for handling signals that needs to know about that host's context structures.) Specifically forbid building the user-only targets on unknown CPU architectures, rather than allowing them to configure but then fail when building user-exec.c. This change drops supports for two configurations which were theoretically possible before: * linux-user targets on M68K hosts using TCI * linux-user targets on HPPA hosts using TCI We don't think anybody is actually trying to use these in practice, though: * interpreted TCG on a slow host CPU would be unusably slow * the m68k user-exec.c support is missing is_write detection so guest code which writes to the same page it is executing from was broken (will include any guest program using signals) * HPPA TCG backend support was dropped two and a half years ago with no complaints Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13configure: Don't override ARCH=unknown if enabling TCIPeter Maydell
At the moment if configure finds an unknown CPU it will set ARCH to 'unknown', and then later either bail out or set it to 'tci' (depending on whether the user passed configure the --enable-tcg-interpreter switch). This is unnecessarily confusing, because we could be using TCI in two cases: * a known host architecture (in which case ARCH is set to the actual host architecture, like 'i386') * an unknown host architecture (in which case ARCH is set to 'tci') so nothing can rely on ARCH=tci to mean "using TCI". Remove the line setting ARCH, so we leave it as "unknown", which is what the actual situation is. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13linux-user: Use safe_syscall wrapper for fcntlPeter Maydell
Use the safe_syscall wrapper for fcntl. This is straightforward now that we always use 'struct fcntl64' on the host, as we don't need to select whether to call the host's fcntl64 or fcntl syscall (a detail that the libc previously hid for us). Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13linux-user: Use __get_user() and __put_user() to handle structs in do_fcntl()Peter Maydell
Use the __get_user() and __put_user() to handle reading and writing the guest structures in do_ioctl(). This has two benefits: * avoids possible errors due to misaligned guest pointers * correctly sign extends signed fields (like l_start in struct flock) which might be different sizes between guest and host To do this we abstract out into copy_from/to_user functions. We also standardize on always using host flock64 and the F_GETLK64 etc flock commands, as this means we always have 64 bit offsets whether the host is 64-bit or 32-bit and we don't need to support conversion to both host struct flock and struct flock64. In passing we fix errors in converting l_type from the host to the target (where we were doing a byteswap of the host value before trying to do the convert-bitmasks operation rather than otherwise, and inexplicably shifting left by 1); these were accidentally left over when the original simple "just shift by 1" arm<->x86 conversion of commit 43f238d was changed to the more general scheme of using target_to_host_bitmask() functions in 2ba7f73. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-13linux-user: Avoid possible misalignment in host_to_target_siginfo()Peter Maydell
host_to_target_siginfo() is implemented by a combination of host_to_target_siginfo_noswap() followed by tswap_siginfo(). The first of these two functions assumes that the target_siginfo_t it is writing to is correctly aligned, but the pointer passed into host_to_target_siginfo() is directly from the guest and might be misaligned. Use a local variable to avoid this problem. (tswap_siginfo() does now correctly handle a misaligned destination.) We have to add a memset() to host_to_target_siginfo_noswap() to avoid some false positive "may be used uninitialized" warnings from gcc about subfields of the _sifields union if it chooses to inline both tswap_siginfo() and host_to_target_siginfo_noswap() into host_to_target_siginfo(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-10Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160610-1' into ↵Peter Maydell
staging ui: misc bug fixes. # gpg: Signature made Fri 10 Jun 2016 10:56:06 BST # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/pull-ui-20160610-1: console: ignore ui_info updates which don't actually update something ui/console-gl: Add support for big endian display surfaces gtk: fix vte version check ui: fix regression in printing VNC host/port on startup vnc: drop unused depth arg for set_pixel_format Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-10console: ignore ui_info updates which don't actually update somethingGerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1464597673-26464-1-git-send-email-kraxel@redhat.com
2016-06-10ui/console-gl: Add support for big endian display surfacesThomas Huth
This is required for running QEMU on big endian hosts (like PowerPC machines) that use RGB instead of BGR byte ordering. Ticket: https://bugs.launchpad.net/qemu/+bug/1581796 Signed-off-by: Thomas Huth <thuth@redhat.com> Message-id: 1465243261-26731-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-06-10gtk: fix vte version checkOlaf Hering
vte_terminal_set_encoding takes 3 args since 0.38.0. This fixes commit fba958c6 ("gtk: implement set_echo") Signed-off-by: Olaf Hering <olaf@aepfle.de> Message-id: 20160608214352.32669-1-olaf@aepfle.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-06-10ui: fix regression in printing VNC host/port on startupDaniel P. Berrange
If VNC is chosen as the compile time default display backend, QEMU will print the host/port it listens on at startup. Previously this would look like VNC server running on '::1:5900' but in 04d2529da27db512dcbd5e99d0e26d333f16efcc the ':' was accidentally replaced with a ';'. This the ':' back. Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1465382576-25552-1-git-send-email-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-06-10vnc: drop unused depth arg for set_pixel_formatGerd Hoffmann
Spotted by Coverity. Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1465204725-31562-1-git-send-email-kraxel@redhat.com
2016-06-09target-i386: Move user-mode exception actions out of user-exec.cPeter Maydell
The exception_action() function in user-exec.c is just a call to cpu_loop_exit() for every target CPU except i386. Since this function is only called if the target's handle_mmu_fault() hook has indicated an MMU fault, and that hook is only called from the handle_cpu_signal() code path, we can simply move the x86-specific setup into that hook, which allows us to remove the TARGET_I386 ifdef from user-exec.c. Of the actions that were done by the call to raise_interrupt_err(): * cpu_svm_check_intercept_param() is a no-op in user mode * check_exception() is a no-op since double faults are impossible for user-mode * assignments to cs->exception_index and env->error_code are no-ops * assigning to env->exception_next_eip is unnecessary because it is not used unless env->exception_is_int is true * cpu_loop_exit_restore() is equivalent to cpu_loop_exit() since pc is 0 which leaves just setting env_>exception_is_int as the action that needs to be added to x86_cpu_handle_mmu_fault(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Sergey Fedorov <sergey.fedorov@linaro.org> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Message-id: 1463494687-25947-7-git-send-email-peter.maydell@linaro.org
2016-06-09target-i386: Add comment about do_interrupt_user() next_eip argumentPeter Maydell
Add a comment to do_interrupt_user() along the same lines as the existing one for do_interrupt_all() noting that the next_eip argument is not used unless is_int is true or intno is EXCP_SYSCALL. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Sergey Fedorov <sergey.fedorov@linaro.org> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Message-id: 1463494687-25947-6-git-send-email-peter.maydell@linaro.org
2016-06-09user-exec: Don't reextract sigmask from usercontext pointerPeter Maydell
Extracting the old signal mask from the usercontext pointer passed to a signal handler is a pain because it is OS and CPU dependent. Since we've already done it once and passed it to handle_cpu_signal(), there's no need to do it again in cpu_exit_tb_from_sighandler(). This then means we don't need to pass a usercontext pointer in to handle_cpu_signal() at all. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Sergey Fedorov <sergey.fedorov@linaro.org> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Message-id: 1463494687-25947-5-git-send-email-peter.maydell@linaro.org
2016-06-09cpu-exec: Rename cpu_resume_from_signal() to cpu_loop_exit_noexc()Peter Maydell
The function cpu_resume_from_signal() is now always called with a NULL puc argument, and is rather misnamed since it is never called from a signal handler. It is essentially forcing an exit to the top level cpu loop but without raising any exception, so rename it to cpu_loop_exit_noexc() and drop the useless unused argument. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Sergey Fedorov <sergey.fedorov@linaro.org> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Message-id: 1463494687-25947-4-git-send-email-peter.maydell@linaro.org
2016-06-09user-exec: Push resume-from-signal code out to handle_cpu_signal()Peter Maydell
Since the only caller of page_unprotect() which might cause it to need to call cpu_resume_from_signal() is handle_cpu_signal() in the user-mode code, push the longjump handling out to that function. Since this is the only caller of cpu_resume_from_signal() which passes a non-NULL puc argument, split the non-NULL handling into a new cpu_exit_tb_from_sighandler() function. This allows us to merge the softmmu and usermode implementations of the cpu_resume_from_signal() function, which are now identical. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Sergey Fedorov <sergey.fedorov@linaro.org> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Message-id: 1463494687-25947-3-git-send-email-peter.maydell@linaro.org
2016-06-09translate-all.c: Don't pass puc, locked to tb_invalidate_phys_page()Peter Maydell
The user-mode-only function tb_invalidate_phys_page() is only called from two places: * page_unprotect(), which passes in a non-zero pc, a puc pointer and the value 'true' for the locked argument * page_set_flags(), which passes in a zero pc, a NULL puc pointer and a 'false' locked argument If the pc is non-zero then we may call cpu_resume_from_signal(), which does a longjmp out of the calling code (and out of the signal handler); this is to cover the case of a target CPU with "precise self-modifying code" (currently only x86) executing a store instruction which modifies code in the same TB as the store itself. Rather than doing the longjump directly here, return a flag to the caller which indicates whether the current TB was modified, and move the longjump to page_unprotect. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Sergey Fedorov <sergey.fedorov@linaro.org> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Message-id: 1463494687-25947-2-git-send-email-peter.maydell@linaro.org
2016-06-08hw/arm: virt uart fixxiaoqiang zhao
commit f0d1d2c115dffc1fbaf954d0b449db05c5eb79b1 ("hw/char: QOM'ify pl011 model") break qemu-system-arm virt machine if option '-machine secure=on' is provided. The function create_uart is called twice. So make CharDriverState pointer a parameter to create_uart instead of hardcoded. Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> Message-id: 1465353045-26323-1-git-send-email-zxq_yx_007@163.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-08Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160608' ↵Peter Maydell
into staging linux-user pull request for June 2016 # gpg: Signature made Wed 08 Jun 2016 14:27:14 BST # gpg: using RSA key 0xB44890DEDE3C9BC0 # gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>" # gpg: aka "Riku Voipio <riku.voipio@linaro.org>" * remotes/riku/tags/pull-linux-user-20160608: (44 commits) linux-user: In fork_end(), remove correct CPUs from CPU list linux-user: Special-case ERESTARTSYS in target_strerror() linux-user: Make target_strerror() return 'const char *' linux-user: Correct signedness of target_flock l_start and l_len fields linux-user: Use safe_syscall wrapper for ioctl linux-user: Use safe_syscall wrapper for accept and accept4 syscalls linux-user: Use safe_syscall wrapper for semop linux-user: Use safe_syscall wrapper for epoll_wait syscalls linux-user: Use safe_syscall wrapper for poll and ppoll syscalls linux-user: Use safe_syscall wrapper for sleep syscalls linux-user: Use safe_syscall wrapper for rt_sigtimedwait syscall linux-user: Use safe_syscall wrapper for flock linux-user: Use safe_syscall wrapper for mq_timedsend and mq_timedreceive linux-user: Use safe_syscall wrapper for msgsnd and msgrcv linux-user: Use safe_syscall wrapper for send* and recv* syscalls linux-user: Use safe_syscall wrapper for connect syscall linux-user: Use safe_syscall wrapper for readv and writev syscalls linux-user: Fix error conversion in 64-bit fadvise syscall linux-user: Fix NR_fadvise64 and NR_fadvise64_64 for 32-bit guests linux-user: Fix handling of arm_fadvise64_64 syscall ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Conflicts: configure scripts/qemu-binfmt-conf.sh
2016-06-08Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell
Block layer patches # gpg: Signature made Wed 08 Jun 2016 09:31:38 BST # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (31 commits) qemu-img bench: Add --flush-interval qemu-img bench: Implement -S (step size) qemu-img bench: Make start offset configurable qemu-img bench: Sequential writes qemu-img bench block: Don't emulate natively supported pwritev flags blockdev: clean up error handling in do_open_tray block: Fix bdrv_all_delete_snapshot() error handling qcow2: avoid extra flushes in qcow2 raw-posix: Fetch max sectors for host block device block: assert that bs->request_alignment is a power of 2 migration/block: Convert saving to BlockBackend migration/block: Convert load to BlockBackend block: Kill bdrv_co_write_zeroes() vmdk: Convert to bdrv_co_pwrite_zeroes() raw_bsd: Convert to bdrv_co_pwrite_zeroes() raw-posix: Convert to bdrv_co_pwrite_zeroes() qed: Convert to bdrv_co_pwrite_zeroes() gluster: Convert to bdrv_co_pwrite_zeroes() blkreplay: Convert to bdrv_co_pwrite_zeroes() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-08Merge remote-tracking branch 'remotes/famz/tags/pull-docker-20160608' into ↵Peter Maydell
staging Docker testing fixes by Paolo. # gpg: Signature made Wed 08 Jun 2016 08:20:54 BST # gpg: using RSA key 0xCA35624C6A9171C6 # gpg: Good signature from "Fam Zheng <famz@redhat.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 5003 7CB7 9706 0F76 F021 AD56 CA35 624C 6A91 71C6 * remotes/famz/tags/pull-docker-20160608: tests/docker: build all targets in test-clang tests/docker: support travis test with fedora image tests/docker: remove unused feature "ccache" tests/docker: fix test-mingw tests/docker: make test-full build all targets, not none tests/docker: fix make-archive-maybe Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-08Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2016-07-07-tag' ↵Peter Maydell
into staging qemu-ga patch queue * add unit tests for guest-exec command set # gpg: Signature made Tue 07 Jun 2016 21:43:33 BST # gpg: using RSA key 0x3353C9CEF108B584 # gpg: Good signature from "Michael Roth <flukshun@gmail.com>" # gpg: aka "Michael Roth <mdroth@utexas.edu>" # gpg: aka "Michael Roth <mdroth@linux.vnet.ibm.com>" * remotes/mdroth/tags/qga-pull-2016-07-07-tag: tests: start a /qga/guest-exec test Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-08Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell
* max-ram-below-4g improvement (Gerd) * escc fix (xiaoqiang) * ESP fix (Prasad) * scsi-disk tweaks/fix (me) * Makefile dependency fixes (me) * PKGVERSION improvement (Fam) * -vnc man improvement (Robert) # gpg: Signature made Tue 07 Jun 2016 18:06:22 BST # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" * remotes/bonzini/tags/for-upstream: vnc: list the 'to' parameter of '-vnc' in the qemu man page scsi-disk: add missing break Makefile: Derive "PKGVERSION" from "git describe" by default Makefile: add dependency on scripts/hxtool Makefile: add dependency on scripts/make_device_config.sh Makefile: add dependency on scripts/create_config Makefile: Add a "FORCE" target scsi: megasas: null terminate bios version buffer scsi: mark TYPE_SCSI_DISK_BASE as abstract scsi: esp: check TI buffer index before read/write hw/char: QOM'ify escc.c (fix) pc: allow raising low memory via max-ram-below-4g option tests: Rename tests/Makefile to tests/Makefile.include Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-08linux-user: In fork_end(), remove correct CPUs from CPU listPeter Maydell
In fork_end(), we must fix the list of current CPUs to match the fact that the child of the fork has only one thread. Unfortunately we were removing the wrong CPUs from the list, which meant that if the child subsequently did an exclusive operation it would deadlock in start_exclusive() waiting for a sibling CPU which didn't exist. In particular this could cause hangs doing git submodule init operations, as reported in https://bugs.launchpad.net/qemu/+bug/955379 comment #47. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-08linux-user: Special-case ERESTARTSYS in target_strerror()Peter Maydell
Since TARGET_ERESTARTSYS and TARGET_ESIGRETURN are internal-to-QEMU error numbers, handle them specially in target_strerror(), to avoid confusing strace output like: 9521 rt_sigreturn(14,8,274886297808,8,0,268435456) = -1 errno=513 (Unknown error 513) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-08linux-user: Make target_strerror() return 'const char *'Peter Maydell
Make target_strerror() return 'const char *' rather than just 'char *'; this will allow us to return constant strings from it for some special cases. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
2016-06-08linux-user: Correct signedness of target_flock l_start and l_len fieldsPeter Maydell
The l_start and l_len fields in the various target_flock structures are supposed to be '__kernel_off_t' or '__kernel_loff_t', which means they should be signed, not unsigned. Correcting the structure definitions means that __get_user() and __put_user() will correctly sign extend them if the guest is using 32 bit offsets and the host is using 64 bit offsets. This fixes failures in the LTP 'fcntl14' tests where it checks that negative seek offsets work correctly. We reindent the structures to drop hard tabs since we're touching 40% of the fields anyway. RV: long long -> abi_llong as suggested by Laurent Vivier <laurent@vivier.eu> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-08qemu-img bench: Add --flush-intervalKevin Wolf
This options allows to flush the image periodically during write tests. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-08qemu-img bench: Implement -S (step size)Kevin Wolf
With this new option, qemu-img bench can be told to advance the current offset after each request by a different value than the buffer size. This is useful for controlling the conditions for cluster allocation in image formats (e.g. qcow2 cluster allocation with COW in front of the request, or COW areas that aren't overwritten immediately). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-08qemu-img bench: Make start offset configurableKevin Wolf
This patch adds an option the specify the offset of the first request made by qemu-img bench. This allows to benchmark misaligned requests. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-08qemu-img bench: Sequential writesKevin Wolf
This extends qemu-img bench with an option that makes it use sequential writes instead of reads for the test run. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-08qemu-img benchKevin Wolf
This adds a qemu-img command that allows doing some simple benchmarks for the block layer without involving guest devices and a real VM. For the start, this implements only a test of sequential reads. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-08block: Don't emulate natively supported pwritev flagsKevin Wolf
Drivers that implement .bdrv_co_pwritev() get the flags passed as an argument to said function, but we also unconditionally emulate the flags anyway. We shouldn't do that. Fix this by clearing all flags that the driver supports natively after it returns from .bdrv_co_pwritev(). Fixes: 4df863f3 ('block: Make supported_write_flags a per-bds property') Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-06-08blockdev: clean up error handling in do_open_trayColin Lord
Returns negative error codes and accompanying error messages in cases where the device has no tray or the tray is locked and isn't forced open. This extra information should result in better flexibility in functions that call do_open_tray. Suggested by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Colin Lord <clord@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-06-08block: Fix bdrv_all_delete_snapshot() error handlingKevin Wolf
The code to exit the loop after bdrv_snapshot_delete_by_id_or_name() returned failure was duplicated. The first copy of it was too early so that the AioContext lock would not be freed. This patch removes it so that only the second, correct copy remains. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-08qcow2: avoid extra flushes in qcow2Denis V. Lunev
The problem with excessive flushing was found by a couple of performance tests: - parallel directory tree creation (from 2 processes) - 32 cached writes + fsync at the end in a loop For the first one results improved from 2.6 loops/sec to 3.5 loops/sec. Each loop creates 10^3 directories with 10 files in each. For the second one results improved from ~600 fsync/sec to ~1100 fsync/sec. Though, it was run on SSD so it probably won't show such performance gain on rotational media. qcow2_cache_flush() calls bdrv_flush() unconditionally after writing cache entries of a particular cache. This can lead to as many as 2 additional fdatasyncs inside bdrv_flush. We can simply skip all fdatasync calls inside qcow2_co_flush_to_os as bdrv_flush for sure will do the job. These flushes are necessary to keep the right order of writes to the different caches. Though this is not necessary in the current code base as this ordering is ensured through the flush in qcow2_cache_flush_dependency(). Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Pavel Borzenkov <pborzenkov@virtuozzo.com> CC: Kevin Wolf <kwolf@redhat.com> CC: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-06-08raw-posix: Fetch max sectors for host block deviceFam Zheng
This is sometimes a useful value we should count in. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-06-08block: assert that bs->request_alignment is a power of 2Peter Lieven
at least bdrv_co_preadv/pwritev expect this. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-06-08migration/block: Convert saving to BlockBackendKevin Wolf
This creates a new BlockBackend for copying data from an images to the migration stream on the source host. All I/O for block migration goes through BlockBackend now. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-08migration/block: Convert load to BlockBackendKevin Wolf
This converts the loading part of block migration to use BlockBackend interfaces rather than accessing the BlockDriverState directly. Note that this takes a lazy shortcut. We should really use a separate BlockBackend that is configured for the migration rather than for the guest (e.g. writethrough caching is unnecessary) and holds its own reference to the BlockDriverState, but the impact isn't that big and we didn't have a separate migration reference before either, so it must be good enough, I guess... Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-08block: Kill bdrv_co_write_zeroes()Eric Blake
Now that all drivers have been converted to a byte interface, we no longer need a sector interface. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-06-08vmdk: Convert to bdrv_co_pwrite_zeroes()Eric Blake
Another step on our continuing quest to switch to byte-based interfaces. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-06-08raw_bsd: Convert to bdrv_co_pwrite_zeroes()Eric Blake
Another step on our continuing quest to switch to byte-based interfaces. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-06-08raw-posix: Convert to bdrv_co_pwrite_zeroes()Eric Blake
Another step on our continuing quest to switch to byte-based interfaces. Signed-off-by: Eric Blake <eblake@redhat.com> [ kwolf: Fixed up trace_paio_submit_co() call for qiov == NULL ] Signed-off-by: Kevin Wolf <kwolf@redhat.com>