summaryrefslogtreecommitdiff
path: root/util
AgeCommit message (Collapse)AuthorFilesLines
2013-09-11Merge remote-tracking branch 'mdroth/qga-pull-2013-9-9' into stagingAnthony Liguori1-0/+35
# By Tomoki Sekiyama (10) and Paul Burton (1) # Via Michael Roth * mdroth/qga-pull-2013-9-9: QMP/qemu-ga-client: Make timeout longer for guest-fsfreeze-freeze command qemu-ga: Install Windows VSS provider on `qemu-ga -s install' qemu-ga: Call Windows VSS requester in fsfreeze command handler qemu-ga: Add Windows VSS provider and requester as DLL error: Add error_set_win32 and error_setg_win32 qemu-ga: Add configure options to specify path to Windows/VSS SDK Add a script to extract VSS SDK headers on POSIX system checkpatch.pl: Check .cpp files Add c++ keywords to QAPI helper script configure: Support configuring C++ compiler mips_malta: support up to 2GiB RAM Message-id: 1378755701-2051-1-git-send-email-mdroth@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-09-09error: Add error_set_win32 and error_setg_win32Tomoki Sekiyama1-0/+35
These functions help maintaining homogeneous formatting of error messages with Windows error code and description (generated by g_win32_error_message()). Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-09-06throttle: Add a new throttling API implementing continuous leaky bucket.Benoît Canet2-0/+397
Implement the continuous leaky bucket algorithm devised on IRC as a separate module. Signed-off-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-30option: Add assigned flag to QEMUOptionParameterMax Reitz1-0/+9
Adds an "assigned" flag to QEMUOptionParameter which is cleared at the beginning of parse_option_parameters and set on (successful) set_option_parameter and set_option_parameter_int. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-12qemu-option: Guard against qemu_opts_set_defaults() misuseMarkus Armbruster1-0/+9
Commit 6d4cd40 fixed qemu_opts_set_defaults() for an existing corner case, but broke it for another one that can't be reached in current code. Quote from its commit message: I believe [opts_parse()] attempts to do the following: If options don't yet exist, create new options Else, if defaults, modify the existing options Else, if list->merge_lists, modify the existing options Else, fail The only caller that passes true for defaults is qemu_opts_set_defaults(). The commit message then claims: A straightforward call of qemu_opts_create() does exactly that. Wrong. When !list->merge_lists, and the option string doesn't contain id=, and options without ID exist, then we don't actually modify the existing options, we create new ones. Not reachable, because we never pass lists with !list->merge_lists to qemu_opts_set_defaults(). Guard against possible (if unlikely) future misuse with assert(). Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1375428840-5275-1-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-08-06iov: handle EOF in iov_send_recvMORITA Kazutaka1-0/+6
Without this patch, iov_send_recv() never returns when do_send_recv() returns zero. Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-05semaphore: fix a hangup problem under load on NetBSD hosts.Izumi Tsutsui1-12/+16
Fix following bugs in "fallback implementation of counting semaphores with mutex+condvar" added in c166cb72f1676855816340666c3b618beef4b976: - waiting threads are not restarted properly if more than one threads are waiting unblock signals in qemu_sem_timedwait() - possible missing pthread_cond_signal(3) calls when waiting threads are returned by ETIMEDOUT - fix an uninitialized variable The problem is analyzed by and fix is provided by Noriyuki Soda. Also put additional cleanup suggested by Laszlo Ersek: - make QemuSemaphore.count unsigned (it won't be negative) - check a return value of in pthread_cond_wait() in qemu_sem_wait() Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-id: 1372841894-10634-1-git-send-email-tsutsui@ceres.dti.ne.jp Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29qdev: Add SIZE type to qdev propertiesVasilis Liaskovitis1-2/+2
This patch adds a 'SIZE' type property to qdev. Signed-off-by: Ian Molton <ian.molton@collabora.co.uk> Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Message-id: 1375109277-25561-7-git-send-email-imammedo@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-27aes: Remove unused code (NDEBUG, u16)Stefan Weil1-5/+0
The current code includes assert.h very early (from qemu-common.h), so the definition of NDEBUG was without any effect. In the initial version from 2004, NDEBUG was used to disable the assertions. Those assertions are not in time critical code, so it is no longer reasonable to disable them and the definition of NDEBUG can be removed. Type u16 is also unused and therefore does not need a type definition. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-07-26QemuOpts: Add qemu_opt_unset()Kevin Wolf1-0/+14
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-07-10add timestamp to error_report()Seiji Aguchi1-0/+10
[Issue] When we offer a customer support service and a problem happens in a customer's system, we try to understand the problem by comparing what the customer reports with message logs of the customer's system. In this case, we often need to know when the problem happens. But, currently, there is no timestamp in qemu's error messages. Therefore, we may not be able to understand the problem based on error messages. [Solution] Add a timestamp to qemu's error message logged by error_report() with g_time_val_to_iso8601(). Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-07-09qemu-option: Fix qemu_opts_set_defaults() for corner casesMarkus Armbruster1-9/+1
Commit 4f6dd9a changed the initialization of opts in opts_parse() to this: if (defaults) { if (!id && !QTAILQ_EMPTY(&list->head)) { opts = qemu_opts_find(list, NULL); } else { opts = qemu_opts_create(list, id, 0); } } else { opts = qemu_opts_create(list, id, 1); } Same as before for !defaults. If defaults is true, and params has no ID, and options exist, we use the first assignment. It sets opts to null if all options have an ID. opts_parse() then returns null. qemu_opts_set_defaults() asserts the value is non-null. It's the only caller that passes true for defaults. To reproduce, try "-M xenpv -machine id=foo" (yes, "id=foo" is silly, but it shouldn't crash). I believe the function attempts to do the following: If options don't yet exist, create new options Else, if defaults, modify the existing options Else, if list->merge_lists, modify the existing options Else, fail A straightforward call of qemu_opts_create() does exactly that. Cc: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372943363-24081-3-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-09qemu-option: Fix qemu_opts_find() for null id argumentsMarkus Armbruster1-8/+4
Crashes when the first list member has an ID. Admittedly nonsensical reproducer: $ qemu-system-x86_64 -nodefaults -machine id=foo -machine "" Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1372943363-24081-2-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-28qemu-socket: don't leak opts on errorGerd Hoffmann1-1/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-28qemu-socket: catch monitor_get_fd failuresGerd Hoffmann1-1/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-28qemu-socket: drop pointless allocationGerd Hoffmann1-1/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-28qemu-socket: zero-initialize SocketAddressGerd Hoffmann1-2/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-28notify: add NotiferWithReturn so notifier list can abortStefan Hajnoczi1-0/+30
notifier_list_notify() has no return value. This is fine when we just want to invoke side-effects. Sometimes it's useful for notifiers to produce a return value. This allows notifiers to "veto" an operation and will be used by the block layer before-write notifier. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-06-21acl: acl_add can't insert before last list element, fixMarkus Armbruster1-2/+2
Watch this: $ upstream-qemu -nodefaults -S -vnc :0,acl,sasl -monitor stdio QEMU 1.5.50 monitor - type 'help' for more information (qemu) acl_add vnc.username drei allow acl: added rule at position 1 (qemu) acl_show vnc.username policy: deny 1: allow drei (qemu) acl_add vnc.username zwei allow 1 acl: added rule at position 2 (qemu) acl_show vnc.username policy: deny 1: allow drei 2: allow zwei (qemu) acl_add vnc.username eins allow 1 acl: added rule at position 1 (qemu) acl_show vnc.username policy: deny 1: allow eins 2: allow drei 3: allow zwei The second acl_add inserts at position 2 instead of 1. Root cause is an off-by-one in qemu_acl_insert(): when index == acl->nentries, it appends instead of inserting before the last list element. Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-19qemu-option: check_params() is now unused, drop itMarkus Armbruster1-30/+0
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1371208516-7857-3-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-18qemu-socket: allow hostnames starting with a digitJán Tomko1-9/+4
According to RFC 1123 [1], hostnames can start with a digit too. [1] http://tools.ietf.org/html/rfc1123#page-13 Signed-off-by: Ján Tomko <jtomko@redhat.com> Cc: qemu-stable@nongnu.org [Use strspn, not strcspn. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-06-17error: add error_setg_file_open() helperLuiz Capitulino1-0/+5
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Acked-by: Kevin Wolf <kwolf@redhat.com>
2013-06-14create qemu_openpty_raw() helper function and move it to a separate fileMichael Tokarev2-1/+136
In two places qemu uses openpty() which is very system-dependent, and in both places the pty is switched to raw mode as well. Make a wrapper function which does both steps, and move all the system-dependent complexity into a separate file, together with static/local implementations of openpty() and cfmakeraw() from qemu-char.c. It is in a separate file, not part of oslib-posix.c, because openpty() often resides in -lutil which is not linked to every program qemu builds. This change removes #including of <pty.h>, <termios.h> and other rather specific system headers out of qemu-common.h, which isn't a place for such specific headers really. This version has been verified to build correctly on Linux, OpenBSD, FreeBSD and OpenIndiana. On the latter it lets qemu to be built with gtk gui which were not possible there due to missing openpty() and cfmakeraw(). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Tested-by: Andreas Färber <andreas.faerber@web.de>
2013-06-06qemu-io: Move qemu_strsep() to cutils.cKevin Wolf1-0/+21
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06cutils: Support 'P' and 'E' suffixes in strtosz()Kevin Wolf1-0/+4
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-05-30osdep: add qemu_get_local_state_pathname()Laszlo Ersek2-0/+31
This function returns ${prefix}/var/RELATIVE_PATHNAME on POSIX-y systems, and <CSIDL_COMMON_APPDATA>/RELATIVE_PATHNAME on Win32. http://msdn.microsoft.com/en-us/library/bb762494.aspx [...] This folder is used for application data that is not user specific. For example, an application can store a spell-check dictionary, a database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. [...] Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-05-20Rename hexdump to avoid FreeBSD libutil conflictEd Maste2-2/+2
On FreeBSD libutil is used for openpty(), but it also provides a hexdump() which conflicts with QEMU's. Signed-off-by: Ed Maste <emaste@freebsd.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1368718348-15199-1-git-send-email-emaste@freebsd.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-14osdep: introduce qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memoryPaolo Bonzini2-0/+16
We switched from qemu_memalign to mmap() but then we don't modify qemu_vfree() to do a munmap() over free(). Which we cannot do because qemu_vfree() frees memory allocated by qemu_{mem,block}align. Introduce a new function that does the munmap(), luckily the size is available in the RAMBlock. Reported-by: Amos Kong <akong@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Message-id: 1368454796-14989-3-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-14osdep, kvm: rename low-level RAM allocation functionsPaolo Bonzini2-4/+4
This is preparatory to the introduction of a separate freeing API. Reported-by: Amos Kong <akong@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Message-id: 1368454796-14989-2-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-12clean unnecessary code: don't check g_strdup arg for NULLDong Xu Wang1-1/+1
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-03qemu: add castagnoli crc32c checksum algorithmJeff Cody2-0/+116
This adds the Castagnoli CRC32C algorithm, using the 0x11EDC6F41 polynomial. This is extracted from the linux kernel cryptographic crc32.c module. The algorithm is based on: Castagnoli93: Guy Castagnoli and Stefan Braeuer and Martin Herrman "Optimization of Cyclic Redundancy-Check Codes with 24 and 32 Parity Bits", IEEE Transactions on Communication, Volume 41, Number 6, June 1993 Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-29win32: add readv/writev emulationPaolo Bonzini2-1/+44
Commit e9d8fbf (qemu-file: do not use stdio for qemu_fdopen, 2013-03-27) introduced a usage of writev, which mingw32 does not have. Even though qemu_fdopen itself is not used on mingw32, the future-proof solution is to add an implementation of it. This is simple and similar to how we emulate sendmsg/recvmsg in util/iov.c. Some files include osdep.h without qemu-common.h, so move the definition of iovec to osdep.h too, and include osdep.h from qemu-common.h unconditionally (protection against including files when NEED_CPU_H is defined is not needed since the removal of AREG0). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-25monitor: introduce query-command-line-optionsAmos Kong1-0/+67
Libvirt has no way to probe if an option or property is supported, This patch introduces a new qmp command to query command line option information. hmp command isn't added because it's not needed. Signed-off-by: Amos Kong <akong@redhat.com> CC: Luiz Capitulino <lcapitulino@redhat.com> CC: Osier Yang <jyang@redhat.com> CC: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-04-24ccid-card-passthru, dev-smartcard-reader: add debug environment variablesAlon Levy1-0/+23
Introduces a new utility function: parse_debug_env to avoid code duplication. This overrides whatever debug value is set on the corresponding devices from the command line, and is meant to ease the usage with any management stack. For libvirt you can set environment variables by extending the dom namespace, i.e: <domain type='kvm' id='3' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> <qemu:commandline> <qemu:env name='QEMU_CCID_PASSTHRU_DEBUG' value='4'/> <qemu:env name='QEMU_CCID_DEBUG' value='4'/> </qemu:commandline> </domain> Signed-off-by: Alon Levy <alevy@redhat.com> Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24util: move socket_init() to osdep.cMarc-André Lureau2-24/+23
vscclient needs to call socket_init() for portability. Moving to osdep.c since it has no internal dependency. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-17iov: handle partial writes from sendmsg and recvmsgPaolo Bonzini1-47/+55
Partial writes can still happen in sendmsg and recvmsg, if a signal is received in the middle of a write. To handle this, retry the operation with a new offset/bytes pair. Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wassermann <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-17iov: reorganize iov_send_recv, part 3Paolo Bonzini1-15/+15
"si" and "ei" are merged in a single variable. Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wassermann <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-17iov: reorganize iov_send_recv, part 2Paolo Bonzini1-14/+14
Do not touch the "bytes" argument anymore. Instead, remember the original length of the last iovec if we touch it, and restore it afterwards. This requires undoing the changes in opposite order. The previous algorithm didn't care. Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wassermann <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-17iov: reorganize iov_send_recv, part 1Paolo Bonzini1-7/+13
Once the initial part of the iov is dropped, it is not used anymore. Modify iov/iovcnt directly instead of adjusting them with the "si" variable. Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wassermann <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-16migration: initialize RAM to zeroPaolo Bonzini1-17/+18
Using qemu_memalign only leaves the RAM zero by chance, because libc will usually use mmap to satisfy our huge requests. But memory will not be zero when using MALLOC_PERTURB_ with a nonzero value. In the case of incoming migration, this breaks a recently-introduced invariant (commit f1c7279, migration: do not sent zero pages in bulk stage, 2013-03-26). To fix this, use mmap ourselves to get a well-aligned, always zero block for the RAM. Mmap-ed memory is easy to "trim" at the sides. This also removes the need to do something special on valgrind (see commit c2a8238a, Support running QEMU on Valgrind, 2011-10-31), thus effectively reverts that patch. Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-id: 1365522223-20153-1-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-15sysemu: avoid proliferation of include/ subdirectoriesPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-13unicode: New mod_utf8_codepoint()Markus Armbruster2-1/+101
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-04-13aes: make Td[0-5] and Te[0-5] tables non staticAurelien Jarno1-252/+252
Remove static attribute to Td[0-5] and Te[0-5] tables so that they can be used outside of aes.c. Change their type from u32 to uint32_t, to keep the u32 udef local to aes.c. Prefix them with AES_ so that they do not conflict with other symbols. Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-04-13aes: move aes.h from include/block to include/qemuAurelien Jarno1-1/+1
Move aes.h from include/block to include/qemu to show it can be reused by other subsystems. Cc: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-04-04Allow clock_gettime() monotonic clock to be utilized on more OS'sBrad Smith1-3/+1
Allow the clock_gettime() code using monotonic clock to be utilized on more POSIX compliannt OS's. This started as a fix for OpenBSD which was listed in one function as part of the previous hard coded list of OS's for the functions to support but not in the other. Signed-off-by: Brad Smith <brad@comstyle.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 20130405003748.GH884@rox.home.comstyle.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-02qemu-socket: set passed fd non-blocking in socket_connect()Stefan Hajnoczi1-0/+1
socket_connect() sets non-blocking on TCP or UNIX domain sockets if a callback function is passed. Do the same for file descriptor passing, otherwise we could unexpectedly be using a blocking file descriptor. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-04-02oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()Stefan Hajnoczi3-6/+6
The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets. Rename to qemu_set_nonblock() just like qemu_set_cloexec(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-03-26bitops: unroll while loop in find_next_bit()Peter Lieven1-1/+17
this patch adopts the loop unrolling idea of bitmap_is_zero() to speed up the skipping of large areas with zeros in find_next_bit(). this routine is extensively used to find dirty pages in live migration. testing only the find_next_bit performance on a zeroed bitfield the loop onrolling decreased executing time by approx. 50% on x86_64. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Juan Quintela <quintela@redhat.com>
2013-03-26buffer_is_zero: use vector optimizations if possiblePeter Lieven1-0/+5
performance gain on SSE2 is approx. 20-25%. altivec is not tested. performance for unsigned long arithmetic is unchanged. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2013-03-26cutils: add a function to find non-zero content in a bufferPeter Lieven1-0/+55
this adds buffer_find_nonzero_offset() which is a SSE2/Altivec optimized function that searches for non-zero content in a buffer. the function starts full unrolling only after the first few chunks have been checked one by one. analyzing real memory page data has revealed that non-zero pages are non-zero within the first 256-512 bits in most cases. as this function is also heavily used to check for zero memory pages this tweak has been made to avoid the high setup costs of the fully unrolled check for non-zero pages. due to the optimizations used in the function there are restrictions on buffer address and search length. the function can_use_buffer_find_nonzero_content() can be used to check if the function can be used safely. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Juan Quintela <quintela@redhat.com>