History | View | Annotate | Download (64.9 kB)
rdma: bugfix: ram_control_save_page()
We were not checking for a valid 'bytes_sent' pointer before accessing it.
Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
rdma: export yield_until_fd_readable()
The RDMA event channel can be made non-blocking just like a TCPsocket. Exporting this function allows us to yield so that theQEMU monitor remains available.
Reviewed-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
rdma: introduce qemu_file_mode_is_not_valid()
QEMUFileRDMA also has read and write modes. This function is nowshared to reduce code duplication.
Reviewed-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Chegu Vinod <chegu_vinod@hp.com>...
rdma: export qemu_fflush()
RDMA uses this to flush the control channel before sending itsown message to handle page registrations.
rdma: new QEMUFileOps hooks
These are the prototypes and implementation of new hooks thatRDMA takes advantage of to perform dynamic page registration.
An optional hook is also introduced for a custom functionto be able to override the default save_page function....
rdma: introduce qemu_update_position()
RDMA writes happen asynchronously, and thus the performance accountingalso needs to be able to occur asynchronously. This allows anybodyto call into savevm.c to update both f->pos as well as into arch_init.cto update the acct_info structure with up-to-date values when...
savevm: Fix potential memory leak
The leak was reported by cppcheck. Fix it by moving the g_malloc0 afterthe argument validity check.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
savevm: qmp_xen_save_devices_state(): use error_setg_file_open()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Acked-by: Kevin Wolf <kwolf@redhat.com>
block: move snapshot code in block.c to block/snapshot.c
All snapshot related code, except bdrv_snapshot_dump() andbdrv_is_snapshot(), is moved to block/snapshot.c. bdrv_snapshot_dump()will be moved to another file later. bdrv_is_snapshot() is not related...
block: move qmp and info dump related code to block/qapi.c
This patch is a pure code move patch, except following modification:1 get_human_readable_size() is changed to static function.2 dump_human_image_info() is renamed to bdrv_image_info_dump().3 in qmp_query_block() and qmp_query_blockstats, use bdrv_next(bs)...
block: dump snapshot and image info to specified output
bdrv_snapshot_dump() and bdrv_image_info_dump() do not dump to a buffer now,some internal buffers are still used for format control, which have nochance to be truncated. As a result, these two functions have no more issue...
block: drop bs_snapshots global variable
The bs_snapshots global variable points to the BlockDriverState whichwill be used to save vmstate. This is really a savevm.c concept but wasmoved into block.c:bdrv_snapshots() when it became clear that hotplugcould result in a dangling pointer....
do not check pointers after dereferencing them
Two instances, both spotted by Coverity. In one, two blocks wereswapped. In the other, the check is not needed anymore.
Cc: qemu-stable@nongnu.orgCc: qemu-trivial@nongnu.orgSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>...
qemu-file: do not use stdio for qemu_fdopen
This uses system calls directly for Unix file descriptors, so that theefficient writev_buffer can be used. Pay attention to the possibilityof partial writes in writev.
Reviewed-by: Juan Quintela <quintela@redhat.com>...
qemu-file: drop socket_put_buffer
It is enough to implement one of socket_writev_buffer andsocket_put_buffer.
Reviewed-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Orit Wassermann <owasserm@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Merge remote-tracking branch 'stefanha/block' into staging
savevm: Implement block_writev_buffer()
Instead of breaking up RAM state into many small chunks, pass the iovecto the block layer for better performance.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
migration: set f->is_write and flush in add_to_iovec
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: use a single I/O operation when writev_buffer is not defined
The recent patches to use vectored I/O for RAM migration caused aregression in savevm speed. To restore previous performance,add data to the buffer in qemu_put_buffer_async whenever writev_buffer...
migration: drop is_write complications
The same QEMUFile is never used for both read and write. Simplifythe logic to simply look for presence or absence of the right ops.
migration: simplify writev vs. non-writev logic
Check f->iovcnt in add_to_iovec, f->buf_index in qemu_put_buffer/byte.
oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
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>...
Add socket_writev_buffer function
Signed-off-by: Orit Wasserman <owasserm@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
Update bytes_xfer in qemu_put_byte
Signed-off-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
Store the data to send also in iovec
All data is still copied into the static buffer.Adjacent iovecs are coalesced so we send one big bufferinstead of many small buffers.
Use writev ops if available
Update qemu_fflush and stdio_close to use writev ops if they are availableUse the buffers stored in the iovec.
Add qemu_put_buffer_async
This allows us to add a buffer to the iovec to send without copying itinto the static buffer, the buffer will be sent later when qemu_fflush is called.
savevm: Add VMSTATE_FLOAT64 helpers
The current savevm code includes VMSTATE helpers for a number of commonlyused data types, but not for the float64 type used by the internal floatingpoint emulation code. This patch fixes the deficiency.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>...
savevm: Add VMSTATE_UINT64_EQUAL helpers
The savevm code already includes a number of *_EQUAL helpers which act assanity checks verifying that the configuration of the saved state matchesthat of the machine we're loading into to work. Variants already exist...
vmstate: Make vmstate_register() static inline
This avoids adding a duplicate stub for CONFIG_USER_ONLY.
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>...
migration: yay, buffering is gone
Buffering was needed because blocking writes could take a long timeand starve other threads seeking to grab the big QEMU mutex.
Now that all writes (except within _complete callbacks) are doneoutside the big QEMU mutex, we do not need buffering at all....
qemu-file: make qemu_fflush and qemu_file_set_error private again
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: merge qemu_popen_cmd with qemu_popen
There is no reason for outgoing exec migration to do popen manuallyanymore (the reason used to be that we needed the FILE* to make itnon-blocking). Use qemu_popen_cmd.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>...
qemu-file: fsync a writable stdio QEMUFile
This is what fd_close does. Prepare for switching to a QEMUFile.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
qemu-file: check exit status when closing a pipe QEMUFile
This is what exec_close does. Move this to the underlying QEMUFile.
qemu-file: add writable socket QEMUFile
qemu-file: simplify and export qemu_ftell
Force a flush when qemu_ftell is called. This simplifies the buffer magic(it also breaks qemu_ftell for input QEMUFiles, but we never use it).
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>...
migration: use QEMUFile for migration channel lifetime
As a start, use QEMUFile to store the destination and close it.qemu_get_fd gets a file descriptor that will be used by the writecallbacks.
migration: move rate limiting to QEMUFile
Rate limiting is now simply a byte counter; client callqemu_file_rate_limit() manually to determine if they have to exit.So it is possible and simple to move the functionality to QEMUFile.
This makes the remaining functionality of s->file redundant;...
qemu-file: pass errno from qemu_fflush via f->last_error
This is done by almost all callers of qemu_fflush, move the codedirectly to qemu_fflush.
migration: use qemu_file_set_error to pass error codes back to qemu_savevm_state
qemu-file: temporarily expose qemu_file_set_error and qemu_fflush
Right now, migration cannot entirely rely on QEMUFile's automaticdrop of I/O after an error, because it does its "real" I/O outsidethe put_buffer callback. To fix this until buffering is gone, expose...
migration: run setup callbacks out of big lock
Only the migration_bitmap_sync() call needs the iothread lock.
migration: push qemu_savevm_state_cancel out of qemu_savevm_state_*
This is useful, because it lets us keep the cancellation callbacksinside the big lock while pushing the others out.
migration: make qemu_ftell() public and support writable files
Migration .save_live_iterate() functions return the number of bytestransferred. The easiest way of doing this is by calling qemu_ftell(f)at the beginning and end of the function to calculate the difference....
migration: restrict scope of incoming fd read handler
The incoming migration is processed in a coroutine and uses an fd readhandler to enter the yielded coroutine when data becomes available.
The read handler was set too broadly, so that spurious coroutine entries...
net: introduce qemu_get_queue()
To support multiqueue, the patch introduce a helper qemu_get_queue()which is used to get the NetClientState of a device. The following patches wouldrefactor this helper to support multiqueue.
Signed-off-by: Jason Wang <jasowang@redhat.com>...
Move XBZRLE encoding code to a separate file to allow testing
Signed-off-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
Merge remote-tracking branch 'quintela/thread.next' into staging
migration: remove argument to qemu_savevm_state_cancel
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-file: Only set last_error if it is not already set
HMP: add QDict to info callback handler
This patch change all info call back function to takeadditional QDict * parameter, which allow those commandtake parameter. Now it is set to NULL at default case.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>...
savevm: Remove MinGW specific code which is no longer needed
QEMU provides a portable function qemu_gettimeofday instead ofgettimeofday and also an implementation of localtime_r for MinGW.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
savevm.c: cleanup system includes
savevm.c suffers from the same problem as some other files.Some years ago savevm.c was created from vl.c, moving somecode from there into a separate file. At that time, allincludes were just copied from vl.c to savevm.c, without...
migration: make writes blocking
Move all the writes to the migration_thread, and make writingsblocking. Notice that are still using the iothread for everythingthat we do.
savevm: New save live migration method: pending
Code just now does (simplified for clarity)
if (qemu_savevm_state_iterate(s->file) == 1) { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); qemu_savevm_state_complete(s->file); }
Problem here is that qemu_savevm_state_iterate() returns 1 when it...
softmmu: move include files to include/sysemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
misc: move include files to include/qemu/
monitor: move include files to include/monitor/
migration: move include files to include/migration/
exec: move include files to include/exec/
net: reorganize headers
Move public headers to include/net, and leave private headers in net/.Put the virtio headers in include/net/tap.h, removing the multiple copiesthat existed. Leave include/net/tap.h as the interface for NICs, andnet/tap_int.h as the interface for OS-specific parts of the tap backend....
janitor: do not include qemu-char everywhere
Touching char/char.h basically causes the whole of QEMU tobe rebuilt. Avoid this, it is usually unnecessary.
migration: close socket QEMUFile from socket_close
The common suffix now is process_incoming_migration+qemu_fclose.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
migration: handle EAGAIN while reading QEMUFile
This will never happen right now (the assertion would fail). Thenext patch will set the socket or pipe in non-blocking mode, thusenabling this part of the code.
Coroutines can just stop whenever they want with qemu_coroutine_yield....
migration: replace qemu_stdio_fd with qemu_get_fd
migration: unify stdio-based QEMUFile operations
Now that qemu_fseek does not exist anymore, there is no reason to doan fseek before fread/fwrite when operating on an stdio file.Thus, unify the get/put_buffer callbacks used by qemu_fopenwith those used for pipes....
migration: consolidate QEMUFile methods in a single QEMUFileOps struct
migration: add qemu_get_fd
vmstate: Add support for saving/loading bitmaps
Add support for saving/loading bitmap.h bitmaps in vmstate.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Tested-by: Igor Mitsyanko <i.mitsyanko@samsung.com>Reviewed-by: Juan Quintela <quintela@redhat.com>
savevm: make qemu_file_put_notify() return errors
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: unexport qemu_fflush
It is not used outside of savevm.c
savevm: Remove qemu_fseek()
It has no users, and is only half implemented.
savevm: make qemu_fflush() return an error code
Adjust all the callers. We moved the set of last_error from insideqemu_fflush() to all the callers.
savevm: unfold qemu_fclose_internal()
It was used only one, and was only one if. It makes error handlingsaner.
savevm: unexport qemu_ftell()
It was unused out of savevm.c.
savevm: make qemu_fill_buffer() be consistent
It was setting last_error directly once, and with the helper the other time.
savevm: Only qemu_fflush() can generate errors
Move the error check to the beggining of the callers. Once this is fixedqemu_file_set_if_error() is not used anymore, so remove it.
savevm: un-export qemu_file_set_error()
cleanup useless return sentence
This patch cleans up return sentences in the end of void functions.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Merge remote-tracking branch 'agraf/ppc-for-upstream' into staging
xbzrle: fix compilation on ppc32
When compiling the xbzrle code on my ppc32 user space, I hit the followinggcc compiler warning (treated as an error):
cc1: warnings being treated as errors savevm.c: In function ‘xbzrle_encode_buffer’: savevm.c:2476: error: overflow in implicit constant conversion...
block: Convert close calls to qemu_close
This patch converts all block layer close calls, that correspondto qemu_open calls, to qemu_close.
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Add xbzrle_encode_buffer and xbzrle_decode_buffer functions
For performance we are encoding long word at a time.For nzrun we use long-word-at-a-time NULL-detection tricks from strcmp():using ((lword - 0x0101010101010101) & (~lword) & 0x8080808080808080) test...
savevm: Use a struct to pass all handlers
This would make easier to add more operations in the next patches.
savevm: Live migration handlers register the struct directly
Notice that the live migration users never unregister, so no problemabout freeing the ops structure.
savevm: Refactor cancel operation in its own operation
Intead of abusing stage with value -1.
savevm: introduce is_active method
Enable the creation of a method to tell migration if that section isactive and should be migrate. We use it for blk-migration, that isnormally not active. We don't create the method for RAM, as setupswithout RAM are very strange O:-)...
savevm: split save_live_setup from save_live_state
This patch splits stage 1 to its own function for both save_liveusers, ram and block. It is just a copy of the function, removing theparts of the other stages. Optimizations would came later.
savevm: split save_live into stage2 and stage3
We split it into 2 functions, foo_live_iterate, and foo_live_complete.At this point, we only remove the bits that are for the other stage,functionally this is equivalent to previous code.
Add tracepoints for savevm section start/end
This allows to know how long each section takes to save.
An awk script like this tells us sections that takes more that 10ms
$1 ~ /savevm_state_iterate_end/ { /* Print savevm_section_end line when > 10ms duration */...
No need to iterate if we already are over the limit
If buffers are full, don't iterate, just exit.
Add MigrationParams structure
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Merge remote-tracking branch 'afaerber-or/qom-next-2' into staging
qdev: Use wrapper for qdev_get_path
This makes it easier to remove it from BusInfo.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>[AF: Drop now unnecessary NULL initialization in scsibus_get_dev_path()]...
savevm: flush after saving vm state
Writing vm state uses bdrv_pwrite, so it will automatically get flushesin writethrough mode. But doing a flush at the end in writeback modeis probably a good idea anyway.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
w64: Fix time conversion for some versions of MinGW-w64
tb.time is a time value, but not necessarily of the same size as time_t:while time_t is 64 bit for w64, tb.time still is 32 bit only.
Therefore we need en explicit conversion.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Merge remote-tracking branch 'sstabellini/saverestore-8' into staging
Introduce "xen-save-devices-state"
- add an "is_ram" flag to SaveStateEntry;
- register_savevm_live sets is_ram for live_savevm devices;
- introduce a "xen-save-devices-state" QAPI command that can be used to savethe state of all devices, but not the RAM or the block devices of the...
Merge remote-tracking branch 'qemu-kvm/memory/urgent' into staging