* [Qemu-devel] [RFC PATCH v1 0/5] VMState testing
@ 2014-07-07 17:17 Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 1/5] QEMUSizedBuffer/QEMUFile Sanidhya Kashyap
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Sanidhya Kashyap @ 2014-07-07 17:17 UTC (permalink / raw)
To: qemu list; +Cc: Sanidhya Kashyap, Dr. David Alan Gilbert, Juan Quintela
Hi,
This patch series introduces a mechanism to test the vmstates' information.
Currently, this is achieved by saving the device states' information to
a memory buffer - an abstraction provided by QEMUFile pointer (David's patch)
and then clearing the states followed by loading the data from the buffer.
Currently, this is just a basic implementation in which one cannot test a
particular device - due to the issues in the reset functionality. In the next
version of the patch, I will try to work on this issue so that the vmstate
checking is possible for every device. This will help the users to enable
checking of a device at the time of saving and loading of its state.
I have tried to provide the both of the hmp and qmp commands interface to dump
and load the vmstates. Besides this, one can either cancel an already running
testing process or update the required sleep interval between iteration.
With these patches, I haven't found any bug in the device states. I wish I am
on the right track.
Dr. David Alan Gilbert (1):
QEMUSizedBuffer/QEMUFile
Sanidhya Kashyap (4):
VMState test: basic vmstate testing mechanism
VMState test: hmp interface for vmstate testing
VMState test: set the frequency of the vmstate testing process
VMState test: cancel mechanism for an already running vmstate testing
process
hmp-commands.hx | 44 +++++
hmp.c | 34 ++++
hmp.h | 3 +
include/migration/qemu-file.h | 27 +++
qapi-schema.json | 31 ++++
qemu-file.c | 411 ++++++++++++++++++++++++++++++++++++++++++
qmp-commands.hx | 70 +++++++
savevm.c | 174 ++++++++++++++++++
8 files changed, 794 insertions(+)
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v1 1/5] QEMUSizedBuffer/QEMUFile
2014-07-07 17:17 [Qemu-devel] [RFC PATCH v1 0/5] VMState testing Sanidhya Kashyap
@ 2014-07-07 17:18 ` Sanidhya Kashyap
2014-07-07 18:28 ` Eric Blake
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 2/5] VMState test: basic vmstate testing mechanism Sanidhya Kashyap
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Sanidhya Kashyap @ 2014-07-07 17:18 UTC (permalink / raw)
To: qemu list
Cc: Joel Schopp, Stefan Berger, Dr. David Alan Gilbert, Juan Quintela
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Using the patch of Stefan Berger for memory buffer based QEMUFile.
http://lists.gnu.org/archive/html/qemu-devel/2013-03/msg05036.html
In the words of David:
"""
Using the QEMUFile interface, this patch adds support functions for
operating on in-memory sized buffers that can be written to or read from.
"""
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
---
include/migration/qemu-file.h | 27 +++
qemu-file.c | 411 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 438 insertions(+)
diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index c90f529..14e1f4d 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -25,6 +25,8 @@
#define QEMU_FILE_H 1
#include "exec/cpu-common.h"
+#include <stdint.h>
+
/* This function writes a chunk of data to a file at the given position.
* The pos argument can be ignored if the file is only being used for
* streaming. The handler should try to write all of the data it can.
@@ -94,11 +96,31 @@ typedef struct QEMUFileOps {
QEMURamSaveFunc *save_page;
} QEMUFileOps;
+struct QEMUSizedBuffer {
+ struct iovec *iov;
+ size_t n_iov;
+ size_t size; /* total allocated size in all iov's */
+ size_t used; /* number of used bytes */
+};
+
+typedef struct QEMUSizedBuffer QEMUSizedBuffer;
+QEMUSizedBuffer *qsb_create(const uint8_t *buffer, size_t len);
+QEMUSizedBuffer *qsb_clone(const QEMUSizedBuffer *);
+void qsb_free(QEMUSizedBuffer *);
+size_t qsb_set_length(QEMUSizedBuffer *qsb, size_t length);
+size_t qsb_get_length(const QEMUSizedBuffer *qsb);
+ssize_t qsb_get_buffer(const QEMUSizedBuffer *, off_t start, size_t count,
+ uint8_t **buf);
+ssize_t qsb_write_at(QEMUSizedBuffer *qsb, const uint8_t *buf,
+ off_t pos, size_t count);
+
+
QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops);
QEMUFile *qemu_fopen(const char *filename, const char *mode);
QEMUFile *qemu_fdopen(int fd, const char *mode);
QEMUFile *qemu_fopen_socket(int fd, const char *mode);
QEMUFile *qemu_popen_cmd(const char *command, const char *mode);
+QEMUFile *qemu_bufopen(const char *mode, QEMUSizedBuffer *input);
int qemu_get_fd(QEMUFile *f);
int qemu_fclose(QEMUFile *f);
int64_t qemu_ftell(QEMUFile *f);
@@ -111,6 +133,11 @@ void qemu_put_byte(QEMUFile *f, int v);
void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, int size);
bool qemu_file_mode_is_not_valid(const char *mode);
+/*
+ * For use on files opened with qemu_bufopen
+ */
+const QEMUSizedBuffer *qemu_buf_get(QEMUFile *f);
+
static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v)
{
qemu_put_byte(f, (int)v);
diff --git a/qemu-file.c b/qemu-file.c
index a8e3912..9fd1675 100644
--- a/qemu-file.c
+++ b/qemu-file.c
@@ -878,3 +878,414 @@ uint64_t qemu_get_be64(QEMUFile *f)
v |= qemu_get_be32(f);
return v;
}
+
+
+#define QSB_CHUNK_SIZE (1 << 10)
+#define QSB_MAX_CHUNK_SIZE (10 * QSB_CHUNK_SIZE)
+
+/**
+ * Create a QEMUSizedBuffer
+ * This type of buffer uses scatter-gather lists internally and
+ * can grow to any size. Any data array in the scatter-gather list
+ * can hold different amount of bytes.
+ *
+ * @buffer: Optional buffer to copy into the QSB
+ * @len: size of initial buffer; if @buffer is given, buffer must
+ * hold at least len bytes
+ *
+ * Returns a pointer to a QEMUSizedBuffer
+ */
+QEMUSizedBuffer *qsb_create(const uint8_t *buffer, size_t len)
+{
+ QEMUSizedBuffer *qsb;
+ size_t alloc_len, num_chunks, i, to_copy;
+ size_t chunk_size = (len > QSB_MAX_CHUNK_SIZE)
+ ? QSB_MAX_CHUNK_SIZE
+ : QSB_CHUNK_SIZE;
+
+ if (len == 0) {
+ /* we want to allocate at least one chunk */
+ len = QSB_CHUNK_SIZE;
+ }
+
+ num_chunks = DIV_ROUND_UP(len, chunk_size);
+ alloc_len = num_chunks * chunk_size;
+
+ qsb = g_new0(QEMUSizedBuffer, 1);
+ qsb->iov = g_new0(struct iovec, num_chunks);
+ qsb->n_iov = num_chunks;
+
+ for (i = 0; i < num_chunks; i++) {
+ qsb->iov[i].iov_base = g_malloc0(chunk_size);
+ qsb->iov[i].iov_len = chunk_size;
+ if (buffer) {
+ to_copy = (len - qsb->used) > chunk_size
+ ? chunk_size : (len - qsb->used);
+ memcpy(qsb->iov[i].iov_base, &buffer[qsb->used], to_copy);
+ qsb->used += to_copy;
+ }
+ }
+
+ qsb->size = alloc_len;
+
+ return qsb;
+}
+
+/**
+ * Free the QEMUSizedBuffer
+ *
+ * @qsb: The QEMUSizedBuffer to free
+ */
+void qsb_free(QEMUSizedBuffer *qsb)
+{
+ size_t i;
+
+ if (!qsb) {
+ return;
+ }
+
+ for (i = 0; i < qsb->n_iov; i++) {
+ g_free(qsb->iov[i].iov_base);
+ }
+ g_free(qsb->iov);
+ g_free(qsb);
+}
+
+/**
+ * Get the number of of used bytes in the QEMUSizedBuffer
+ *
+ * @qsb: A QEMUSizedBuffer
+ *
+ * Returns the number of bytes currently used in this buffer
+ */
+size_t qsb_get_length(const QEMUSizedBuffer *qsb)
+{
+ return qsb->used;
+}
+
+/**
+ * Set the length of the buffer; The primary usage of this
+ * function is to truncate the number of used bytes in the buffer.
+ * The size will not be extended beyond the current number of
+ * allocated bytes in the QEMUSizedBuffer.
+ *
+ * @qsb: A QEMUSizedBuffer
+ * @new_len : The new length of bytes in the buffer
+ *
+ * Returns the number of bytes the buffer was trucated or extended
+ * to.
+ */
+size_t qsb_set_length(QEMUSizedBuffer *qsb, size_t new_len)
+{
+ if (new_len <= qsb->size) {
+ qsb->used = new_len;
+ } else {
+ qsb->used = qsb->size;
+ }
+ return qsb->used;
+}
+
+/**
+ * Get the iovec that holds the data for a given position @pos.
+ *
+ * @qsb: A QEMUSizedBuffer
+ * @pos: The index of a byte in the buffer
+ * @d_off: Pointer to an offset that this function will indicate
+ * at what position within the returned iovec the byte
+ * is to be found
+ *
+ * Returns the index of the iovec that holds the byte at the given
+ * index @pos in the byte stream; a negative number if the iovec
+ * for the given position @pos does not exist.
+ */
+static ssize_t qsb_get_iovec(const QEMUSizedBuffer *qsb,
+ off_t pos, off_t *d_off)
+{
+ ssize_t i;
+ off_t curr = 0;
+
+ if (pos > qsb->used) {
+ return -1;
+ }
+
+ for (i = 0; i < qsb->n_iov; i++) {
+ if (curr + qsb->iov[i].iov_len > pos) {
+ *d_off = pos - curr;
+ return i;
+ }
+ curr += qsb->iov[i].iov_len;
+ }
+ return -1;
+}
+
+/*
+ * Convert the QEMUSizedBuffer into a flat buffer.
+ *
+ * Note: If at all possible, try to avoid this function since it
+ * may unnecessarily copy memory around.
+ *
+ * @qsb: pointer to QEMUSizedBuffer
+ * @start : offset to start at
+ * @count: number of bytes to copy
+ * @buf: a pointer to an optional buffer to write into; the pointer may
+ * point to NULL in which case the buffer will be allocated;
+ * if buffer is provided, it must be large enough to hold @count bytes
+ *
+ * Returns the number of bytes copied into the output buffer
+ */
+ssize_t qsb_get_buffer(const QEMUSizedBuffer *qsb, off_t start,
+ size_t count, uint8_t **buf)
+{
+ uint8_t *buffer;
+ const struct iovec *iov;
+ size_t to_copy, all_copy;
+ ssize_t index;
+ off_t s_off;
+ off_t d_off = 0;
+ char *s;
+
+ if (start > qsb->used) {
+ return 0;
+ }
+
+ all_copy = qsb->used - start;
+ if (all_copy > count) {
+ all_copy = count;
+ } else {
+ count = all_copy;
+ }
+
+ if (*buf == NULL) {
+ *buf = g_malloc(all_copy);
+ }
+ buffer = *buf;
+
+ index = qsb_get_iovec(qsb, start, &s_off);
+ if (index < 0) {
+ return 0;
+ }
+
+ while (all_copy > 0) {
+ iov = &qsb->iov[index];
+
+ s = iov->iov_base;
+
+ to_copy = iov->iov_len - s_off;
+ if (to_copy > all_copy) {
+ to_copy = all_copy;
+ }
+ memcpy(&buffer[d_off], &s[s_off], to_copy);
+
+ d_off += to_copy;
+ all_copy -= to_copy;
+
+ s_off = 0;
+ index++;
+ }
+
+ return count;
+}
+
+/**
+ * Grow the QEMUSizedBuffer to the given size and allocated
+ * memory for it.
+ *
+ * @qsb: A QEMUSizedBuffer
+ * @new_size: The new size of the buffer
+ *
+ * Returns an error code in case of memory allocation failure
+ * or the new size of the buffer otherwise. The returned size
+ * may be greater or equal to @new_size.
+ */
+static ssize_t qsb_grow(QEMUSizedBuffer *qsb, size_t new_size)
+{
+ size_t needed_chunks, i;
+ size_t chunk_size = QSB_CHUNK_SIZE;
+
+ if (qsb->size < new_size) {
+ needed_chunks = DIV_ROUND_UP(new_size - qsb->size,
+ chunk_size);
+
+ qsb->iov = g_realloc_n(qsb->iov, qsb->n_iov + needed_chunks,
+ sizeof(struct iovec));
+ if (qsb->iov == NULL) {
+ return -ENOMEM;
+ }
+
+ for (i = qsb->n_iov; i < qsb->n_iov + needed_chunks; i++) {
+ qsb->iov[i].iov_base = g_malloc0(chunk_size);
+ qsb->iov[i].iov_len = chunk_size;
+ }
+
+ qsb->n_iov += needed_chunks;
+ qsb->size += (needed_chunks * chunk_size);
+ }
+
+ return qsb->size;
+}
+
+/**
+ * Write into the QEMUSizedBuffer at a given position and a given
+ * number of bytes. This function will automatically grow the
+ * QEMUSizedBuffer.
+ *
+ * @qsb: A QEMUSizedBuffer
+ * @source: A byte array to copy data from
+ * @pos: The position withing the @qsb to write data to
+ * @size: The number of bytes to copy into the @qsb
+ *
+ * Returns an error code in case of memory allocation failure,
+ * @size otherwise.
+ */
+ssize_t qsb_write_at(QEMUSizedBuffer *qsb, const uint8_t *source,
+ off_t pos, size_t count)
+{
+ ssize_t rc = qsb_grow(qsb, pos + count);
+ size_t to_copy;
+ size_t all_copy = count;
+ const struct iovec *iov;
+ ssize_t index;
+ char *dest;
+ off_t d_off, s_off = 0;
+
+ if (rc < 0) {
+ return rc;
+ }
+
+ if (pos + count > qsb->used) {
+ qsb->used = pos + count;
+ }
+
+ index = qsb_get_iovec(qsb, pos, &d_off);
+ if (index < 0) {
+ return 0;
+ }
+
+ while (all_copy > 0) {
+ iov = &qsb->iov[index];
+
+ dest = iov->iov_base;
+
+ to_copy = iov->iov_len - d_off;
+ if (to_copy > all_copy) {
+ to_copy = all_copy;
+ }
+
+ memcpy(&dest[d_off], &source[s_off], to_copy);
+
+ s_off += to_copy;
+ all_copy -= to_copy;
+
+ d_off = 0;
+ index++;
+ }
+
+ return count;
+}
+
+/**
+ * Create an exact copy of the given QEMUSizedBuffer.
+ *
+ * @qsb : A QEMUSizedBuffer
+ *
+ * Returns a clone of @qsb
+ */
+QEMUSizedBuffer *qsb_clone(const QEMUSizedBuffer *qsb)
+{
+ QEMUSizedBuffer *out = qsb_create(NULL, qsb_get_length(qsb));
+ size_t i;
+ off_t pos = 0;
+
+ for (i = 0; i < qsb->n_iov; i++) {
+ pos += qsb_write_at(out, qsb->iov[i].iov_base,
+ pos, qsb->iov[i].iov_len);
+ }
+
+ return out;
+}
+
+typedef struct QEMUBuffer {
+ QEMUSizedBuffer *qsb;
+ QEMUFile *file;
+} QEMUBuffer;
+
+static int buf_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
+{
+ QEMUBuffer *s = opaque;
+ ssize_t len = qsb_get_length(s->qsb) - pos;
+
+ if (len <= 0) {
+ return 0;
+ }
+
+ if (len > size) {
+ len = size;
+ }
+ return qsb_get_buffer(s->qsb, pos, len, &buf);
+}
+
+static int buf_put_buffer(void *opaque, const uint8_t *buf,
+ int64_t pos, int size)
+{
+ QEMUBuffer *s = opaque;
+
+ return qsb_write_at(s->qsb, buf, pos, size);
+}
+
+static int buf_close(void *opaque)
+{
+ QEMUBuffer *s = opaque;
+
+ qsb_free(s->qsb);
+
+ g_free(s);
+
+ return 0;
+}
+
+const QEMUSizedBuffer *qemu_buf_get(QEMUFile *f)
+{
+ QEMUBuffer *p;
+
+ qemu_fflush(f);
+
+ p = (QEMUBuffer *)f->opaque;
+
+ return p->qsb;
+}
+
+static const QEMUFileOps buf_read_ops = {
+ .get_buffer = buf_get_buffer,
+ .close = buf_close
+};
+
+static const QEMUFileOps buf_write_ops = {
+ .put_buffer = buf_put_buffer,
+ .close = buf_close
+};
+
+QEMUFile *qemu_bufopen(const char *mode, QEMUSizedBuffer *input)
+{
+ QEMUBuffer *s;
+
+ if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) {
+ fprintf(stderr, "qemu_bufopen: Argument validity check failed\n");
+ return NULL;
+ }
+
+ s = g_malloc0(sizeof(QEMUBuffer));
+ if (mode[0] == 'r') {
+ s->qsb = input;
+ }
+
+ if (s->qsb == NULL) {
+ s->qsb = qsb_create(NULL, 0);
+ }
+
+ if (mode[0] == 'r') {
+ s->file = qemu_fopen_ops(s, &buf_read_ops);
+ } else {
+ s->file = qemu_fopen_ops(s, &buf_write_ops);
+ }
+ return s->file;
+}
--
1.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v1 2/5] VMState test: basic vmstate testing mechanism
2014-07-07 17:17 [Qemu-devel] [RFC PATCH v1 0/5] VMState testing Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 1/5] QEMUSizedBuffer/QEMUFile Sanidhya Kashyap
@ 2014-07-07 17:18 ` Sanidhya Kashyap
2014-07-07 17:33 ` Eric Blake
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 3/5] VMState test: hmp interface for vmstate testing Sanidhya Kashyap
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Sanidhya Kashyap @ 2014-07-07 17:18 UTC (permalink / raw)
To: qemu list; +Cc: Sanidhya Kashyap, Dr. David Alan Gilbert, Juan Quintela
This patch introduces the mechanism to test the devices state by storing
and dumping in in the QEMUFile pointer.
The testing is done as follows:
1) The VM is halted.
2) guest state is synchronized.
3) Then the device state is dumped to a temporary memory.
4) The guest state is reset.
5) Then the device state is loaded from the temporary memory.
6) The guest is resumed.
If the guest resumes, then there is no issue with the vmstates.
Currently, in this patch, I am directly using the qemu_system_reset()
function to reset all the states of the guest. But, what I have found
is that there is a difference in the registration of devices' reset
function in QEMUResetEntry and in SaveStateEntry. Since, we dump and
load all the devices information using the SaveStateEntry, but the reseting
of the devices takes place with the help of QEMUResetEntry. Thus, in
future, I will try to use the qdevified device tree to reset the functions.
As of now, I am providing DPRINTF to know about the amount of time spend in
saving and loading the data from the buffer. If there is any other way that
should be used to print the stats, then please do let me know.
Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
qapi-schema.json | 12 +++++
qmp-commands.hx | 28 +++++++++++
savevm.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 188 insertions(+)
diff --git a/qapi-schema.json b/qapi-schema.json
index b11aad2..92acf91 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3480,3 +3480,15 @@
# Since: 2.1
##
{ 'command': 'rtc-reset-reinjection' }
+
+## @test-vmstates
+#
+# tests the vmstates' value by dumping and loading in memory
+# @times: total iterations
+# @sinterval: sleep interval between iteration
+#
+# Since 2.1
+##
+{ 'command': 'test-vmstates',
+ 'data': {'*times' : 'int',
+ '*sinterval' : 'int' } }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 4be4765..ccddabb 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3755,3 +3755,31 @@ Example:
<- { "return": {} }
EQMP
+
+ {
+ .name = "test-vmstates",
+ .args_type = "times:i?,sinterval:i?",
+ .mhandler.cmd_new = qmp_marshal_input_test_vmstates,
+ },
+
+SQMP
+test-vmstates
+--------------------
+
+Tests the vmstates' entry by dumping and loading in/from memory
+
+Arguments:
+
+- "times" : the total iterations for vmstates testing. The default
+ value is 10.
+- "sinterval": the sleep interval between the iterations. The default
+ value is 100 milliseconds.
+
+Example:
+
+-> { "execute": "test-vmstates",
+ "arguments": {
+ "times": 10
+ "sinterval": 100 } }
+<- { "return": {} }
+EQMP
diff --git a/savevm.c b/savevm.c
index e19ae0a..3713a56 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1137,6 +1137,154 @@ void do_savevm(Monitor *mon, const QDict *qdict)
}
}
+#ifdef DEBUG_TEST_VMSTATES
+#define DPRINTF(fmt, ...) \
+ do { printf("vmstate_test: " fmt, ## __VA_ARGS__); } while (0)
+#else
+#define DPRINTF(fmt, ...) \
+ do { } while (0)
+#endif
+
+#define TEST_VMSTATE_MIN_TIMES 10
+#define TEST_VMSTATE_MAX_TIMES 1000
+
+#define TEST_VMSTATE_MIN_INTERVAL_MS 1
+#define TEST_VMSTATE_DEFAULT_INTERVAL_MS 100
+#define TEST_VMSTATE_MAX_INTERVAL_MS 10000
+
+typedef struct VMStateLogState VMStateLogState;
+
+struct VMStateLogState {
+ int64_t times;
+ int64_t sleep_interval;
+ int64_t save_vmstates_duration;
+ int64_t load_vmstates_duration;
+ bool active_state;
+ QEMUTimer *timer;
+};
+
+static VMStateLogState *vmstate_current_state(void)
+{
+ static VMStateLogState current_state = {
+ .active_state = false,
+ };
+
+ return ¤t_state;
+}
+
+static void vmstate_test_cb(void *opaque)
+{
+ VMStateLogState *v = opaque;
+ int saved_vm_running = runstate_is_running();
+ const QEMUSizedBuffer *qsb;
+ QEMUFile *f;
+ int ret;
+ int64_t start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
+
+ /* executing the steps for a single time with the help of timer */
+ if (--(v->times) > 0) {
+ saved_vm_running = runstate_is_running();
+
+ /* stopping the VM before dumping the vmstates */
+ vm_stop(RUN_STATE_SAVE_VM);
+
+ f = qemu_bufopen("w", NULL);
+ if (!f) {
+ goto testing_end;
+ }
+
+ cpu_synchronize_all_states();
+
+ /* saving the vmsates to memory buffer */
+ ret = qemu_save_device_state(f);
+ if (ret < 0) {
+ goto testing_end;
+ }
+ v->save_vmstates_duration = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) -
+ start_time;
+ DPRINTF("iteration: %ld, save time: %ld(ms)\n",
+ v->times, v->save_vmstates_duration);
+
+ /* clearing the states of the guest */
+ qemu_system_reset(VMRESET_SILENT);
+
+ start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
+ qsb = qemu_buf_get(f);
+ f = qemu_bufopen("r", (QEMUSizedBuffer *)qsb);
+ if (!f) {
+ goto testing_end;
+ }
+
+ /* loading the device states from the saved buffer */
+ ret = qemu_loadvm_state(f);
+ qemu_fclose(f);
+ if (ret < 0) {
+ goto testing_end;
+ }
+ v->load_vmstates_duration = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) -
+ start_time;
+ DPRINTF("iteration: %ld, load time: %ld(ms)\n",
+ v->times, v->load_vmstates_duration);
+
+ if (saved_vm_running) {
+ vm_start();
+ }
+ timer_mod(v->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) +
+ v->sleep_interval);
+ return;
+ }
+
+ testing_end:
+ if (saved_vm_running) {
+ vm_start();
+ }
+ timer_del(v->timer);
+ timer_free(v->timer);
+ v->active_state = false;
+ return;
+}
+
+void qmp_test_vmstates(bool has_times, int64_t times,
+ bool has_sinterval, int64_t sinterval,
+ Error **errp)
+{
+ VMStateLogState *v = vmstate_current_state();
+
+ if (v->active_state) {
+ error_setg(errp, "VMState testing already in progress\n");
+ return;
+ }
+
+ /* checking the value of times to be in the defined range */
+ if (!has_times) {
+ v->times = TEST_VMSTATE_MIN_TIMES;
+ } else if (times >= TEST_VMSTATE_MIN_TIMES &&
+ times <= TEST_VMSTATE_MAX_TIMES) {
+ v->times = times;
+ } else {
+ error_setg(errp, "epoch value must be in the range [%d, %d]\n",
+ TEST_VMSTATE_MIN_TIMES, TEST_VMSTATE_MAX_TIMES);
+ return;
+ }
+
+ /* checking for the value of sleep_interval to be in the defined range */
+ if (!has_sinterval) {
+ v->sleep_interval = TEST_VMSTATE_DEFAULT_INTERVAL_MS;
+ } else if (sinterval >= TEST_VMSTATE_MIN_INTERVAL_MS &&
+ sinterval <= TEST_VMSTATE_MAX_INTERVAL_MS) {
+ v->sleep_interval = sinterval;
+ } else {
+ error_setg(errp, "sleep interval value must be "
+ "in the defined range [%d, %d](ms)\n",
+ TEST_VMSTATE_MIN_INTERVAL_MS, TEST_VMSTATE_MAX_INTERVAL_MS);
+ return;
+ }
+
+ v->active_state = true;
+ v->timer = timer_new_ms(QEMU_CLOCK_REALTIME, vmstate_test_cb, v);
+ timer_mod(v->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
+}
+
void qmp_xen_save_devices_state(const char *filename, Error **errp)
{
QEMUFile *f;
--
1.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v1 3/5] VMState test: hmp interface for vmstate testing
2014-07-07 17:17 [Qemu-devel] [RFC PATCH v1 0/5] VMState testing Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 1/5] QEMUSizedBuffer/QEMUFile Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 2/5] VMState test: basic vmstate testing mechanism Sanidhya Kashyap
@ 2014-07-07 17:18 ` Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 4/5] VMState test: set the frequency of the vmstate testing process Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 5/5] VMState test: cancel mechanism for an already running " Sanidhya Kashyap
4 siblings, 0 replies; 11+ messages in thread
From: Sanidhya Kashyap @ 2014-07-07 17:18 UTC (permalink / raw)
To: qemu list; +Cc: Sanidhya Kashyap, Dr. David Alan Gilbert, Juan Quintela
Added hmp interface.
Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
hmp-commands.hx | 15 +++++++++++++++
hmp.c | 14 ++++++++++++++
hmp.h | 1 +
3 files changed, 30 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index d0943b1..c492f3f 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1788,6 +1788,21 @@ STEXI
show available trace events and their state
ETEXI
+ {
+ .name = "test-vmstates",
+ .args_type = "times:i?,sinterval:i?",
+ .params = "times sinterval",
+ .help = "test the vmstates by dumping and loading form memory\n\t\t\t"
+ "times: number of times, the vmstates will be tested\n\t\t\t"
+ "sinterval: sleep interval in milliseconds between each iteration",
+ .mhandler.cmd = hmp_test_vmstates,
+ },
+STEXI
+@item test-vmstates
+@findex test-vmstates
+dumps and reads the device state's data from the memory for testing purpose
+ETEXI
+
STEXI
@end table
ETEXI
diff --git a/hmp.c b/hmp.c
index 4d1838e..38ec5b3 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1714,3 +1714,17 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "\n");
}
+
+void hmp_test_vmstates(Monitor *mon, const QDict *qdict)
+{
+ int64_t times = qdict_get_try_int(qdict, "times", 10);
+ int64_t sleep_interval = qdict_get_try_int(qdict, "sinterval", 100);
+ Error *err = NULL;
+
+ qmp_test_vmstates(!!times, times, !!sleep_interval, sleep_interval, &err);
+
+ if (err) {
+ monitor_printf(mon, "test-vmstates: %s\n", error_get_pretty(err));
+ error_free(err);
+ }
+}
diff --git a/hmp.h b/hmp.h
index 4fd3c4a..9f00997 100644
--- a/hmp.h
+++ b/hmp.h
@@ -94,6 +94,7 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict);
void hmp_object_add(Monitor *mon, const QDict *qdict);
void hmp_object_del(Monitor *mon, const QDict *qdict);
void hmp_info_memdev(Monitor *mon, const QDict *qdict);
+void hmp_test_vmstates(Monitor *mon, const QDict *qdict);
void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
--
1.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v1 4/5] VMState test: set the frequency of the vmstate testing process
2014-07-07 17:17 [Qemu-devel] [RFC PATCH v1 0/5] VMState testing Sanidhya Kashyap
` (2 preceding siblings ...)
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 3/5] VMState test: hmp interface for vmstate testing Sanidhya Kashyap
@ 2014-07-07 17:18 ` Sanidhya Kashyap
2014-07-07 18:25 ` Eric Blake
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 5/5] VMState test: cancel mechanism for an already running " Sanidhya Kashyap
4 siblings, 1 reply; 11+ messages in thread
From: Sanidhya Kashyap @ 2014-07-07 17:18 UTC (permalink / raw)
To: qemu list; +Cc: Sanidhya Kashyap, Dr. David Alan Gilbert, Juan Quintela
This patch introduces the mechanism to update the sleep interval - sinterval.
Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
hmp-commands.hx | 15 +++++++++++++++
hmp.c | 14 ++++++++++++++
hmp.h | 1 +
qapi-schema.json | 10 ++++++++++
qmp-commands.hx | 22 ++++++++++++++++++++++
savevm.c | 13 +++++++++++++
6 files changed, 75 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index c492f3f..efe4354 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1803,6 +1803,21 @@ STEXI
dumps and reads the device state's data from the memory for testing purpose
ETEXI
+ {
+ .name = "test-vmstates-set-sinterval",
+ .args_type = "sinterval:i",
+ .params = "sinterval",
+ .help = "set the sleep interval for vmstates testing process\n\t\t\t"
+ "sinterval: the new sleep interval value to replace the existing",
+ .mhandler.cmd = hmp_test_vmstates_set_sinterval,
+ },
+
+STEXI
+@item test_vmstates-set-sinterval @var{sinterval}
+@findex test-vmstates-set-sinterval
+Set the sinterval to @var{sinterval} (int) for vmstate testing process.
+ETEXI
+
STEXI
@end table
ETEXI
diff --git a/hmp.c b/hmp.c
index 38ec5b3..7378727 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1728,3 +1728,17 @@ void hmp_test_vmstates(Monitor *mon, const QDict *qdict)
error_free(err);
}
}
+
+void hmp_test_vmstates_set_sinterval(Monitor *mon, const QDict *qdict)
+{
+ int64_t sleep_interval = qdict_get_int(qdict, "sinterval");
+ Error *err = NULL;
+
+ qmp_test_vmstates_set_sinterval(sleep_interval, &err);
+
+ if (err) {
+ monitor_printf(mon, "test-vmstates-set-frequency: %s\n",
+ error_get_pretty(err));
+ error_free(err);
+ }
+}
diff --git a/hmp.h b/hmp.h
index 9f00997..737dae2 100644
--- a/hmp.h
+++ b/hmp.h
@@ -95,6 +95,7 @@ void hmp_object_add(Monitor *mon, const QDict *qdict);
void hmp_object_del(Monitor *mon, const QDict *qdict);
void hmp_info_memdev(Monitor *mon, const QDict *qdict);
void hmp_test_vmstates(Monitor *mon, const QDict *qdict);
+void hmp_test_vmstates_set_sinterval(Monitor *mon, const QDict *qdict);
void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
diff --git a/qapi-schema.json b/qapi-schema.json
index 92acf91..2eb8bc4 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3492,3 +3492,13 @@
{ 'command': 'test-vmstates',
'data': {'*times' : 'int',
'*sinterval' : 'int' } }
+
+## @test-vmstates-set-sinterval
+#
+# sets the sleep interval between iterations of the vmstate testing process
+# @sinterval: the updated sleep interval value
+#
+# Since 2.1
+##
+{ 'command' : 'test-vmstates-set-sinterval',
+ 'data' : { 'sinterval': 'int' } }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index ccddabb..2c25dde 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3783,3 +3783,25 @@ Example:
"sinterval": 100 } }
<- { "return": {} }
EQMP
+
+ {
+ .name = "test-vmstates-set-sinterval",
+ .args_type = "sinterval:i",
+ .mhandler.cmd_new = qmp_marshal_input_test_vmstates_set_sinterval,
+ },
+
+SQMP
+test-vmstates-set-sinterval
+--------------------
+
+Update the sleep interval for the remaining iterations
+
+Arguments:
+
+- "sinterval": the updated sleep interval between iterations (json-int)
+
+Example:
+
+-> { "execute": "test-vmstates-set-sinterval", "arguments": { "sinterval": 1024 } }
+<- { "return": {} }
+EQMP
diff --git a/savevm.c b/savevm.c
index 3713a56..8a81355 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1285,6 +1285,19 @@ void qmp_test_vmstates(bool has_times, int64_t times,
timer_mod(v->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
}
+void qmp_test_vmstates_set_sinterval(int64_t sinterval, Error **errp)
+{
+ VMStateLogState *v = vmstate_current_state();
+ if (sinterval < TEST_VMSTATE_MIN_INTERVAL_MS ||
+ sinterval > TEST_VMSTATE_MAX_INTERVAL_MS) {
+ error_setg(errp, "sleep interval value must be "
+ "in the defined range [%d, %d](ms)\n",
+ TEST_VMSTATE_MIN_INTERVAL_MS, TEST_VMSTATE_MAX_INTERVAL_MS);
+ return;
+ }
+ v->sleep_interval = sinterval;
+}
+
void qmp_xen_save_devices_state(const char *filename, Error **errp)
{
QEMUFile *f;
--
1.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v1 5/5] VMState test: cancel mechanism for an already running vmstate testing process
2014-07-07 17:17 [Qemu-devel] [RFC PATCH v1 0/5] VMState testing Sanidhya Kashyap
` (3 preceding siblings ...)
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 4/5] VMState test: set the frequency of the vmstate testing process Sanidhya Kashyap
@ 2014-07-07 17:18 ` Sanidhya Kashyap
4 siblings, 0 replies; 11+ messages in thread
From: Sanidhya Kashyap @ 2014-07-07 17:18 UTC (permalink / raw)
To: qemu list; +Cc: Sanidhya Kashyap, Dr. David Alan Gilbert, Juan Quintela
This patch helps in cancelling an already executing vmstate testing process.
Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
hmp-commands.hx | 14 ++++++++++++++
hmp.c | 6 ++++++
hmp.h | 1 +
qapi-schema.json | 9 +++++++++
qmp-commands.hx | 20 ++++++++++++++++++++
savevm.c | 17 +++++++++++++++--
6 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index efe4354..6187d59 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1818,6 +1818,20 @@ STEXI
Set the sinterval to @var{sinterval} (int) for vmstate testing process.
ETEXI
+ {
+ .name = "test-vmstates-cancel",
+ .args_type = "",
+ .params = "",
+ .help = "cancel the current vmstates testing process",
+ .mhandler.cmd = hmp_test_vmstates_cancel,
+},
+
+STEXI
+@item test-vmstates-cancel
+@findex test-vmstates-cancel
+Cancel the current vmstates testing process
+ETEXI
+
STEXI
@end table
ETEXI
diff --git a/hmp.c b/hmp.c
index 7378727..d47877b 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1742,3 +1742,9 @@ void hmp_test_vmstates_set_sinterval(Monitor *mon, const QDict *qdict)
error_free(err);
}
}
+
+void hmp_test_vmstates_cancel(Monitor *mon, const QDict *qdict)
+{
+ qmp_test_vmstates_cancel(NULL);
+}
+
diff --git a/hmp.h b/hmp.h
index 737dae2..af720bc 100644
--- a/hmp.h
+++ b/hmp.h
@@ -96,6 +96,7 @@ void hmp_object_del(Monitor *mon, const QDict *qdict);
void hmp_info_memdev(Monitor *mon, const QDict *qdict);
void hmp_test_vmstates(Monitor *mon, const QDict *qdict);
void hmp_test_vmstates_set_sinterval(Monitor *mon, const QDict *qdict);
+void hmp_test_vmstates_cancel(Monitor *mon, const QDict *qdict);
void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
diff --git a/qapi-schema.json b/qapi-schema.json
index 2eb8bc4..1e914c5 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3502,3 +3502,12 @@
##
{ 'command' : 'test-vmstates-set-sinterval',
'data' : { 'sinterval': 'int' } }
+
+##
+# @log-dirty-bitmap-cancel
+#
+# cancel the testing vmstates process
+#
+# Since 2.1
+##
+{ 'command': 'test-vmstates-cancel' }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 2c25dde..a336b50 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3805,3 +3805,23 @@ Example:
-> { "execute": "test-vmstates-set-sinterval", "arguments": { "sinterval": 1024 } }
<- { "return": {} }
EQMP
+
+ {
+ .name = "test-vmstates-cancel",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_marshal_input_test_vmstates_cancel,
+ },
+
+SQMP
+test-vmstates-cancel
+--------------
+
+Cancel the current vmstate testing process.
+
+Arguments: None.
+
+Example:
+
+-> { "execute": "test-vmstates-cancel" }
+<- { "return": {} }
+EQMP
diff --git a/savevm.c b/savevm.c
index 8a81355..c760bdb 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1229,8 +1229,13 @@ static void vmstate_test_cb(void *opaque)
if (saved_vm_running) {
vm_start();
}
- timer_mod(v->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) +
- v->sleep_interval);
+
+ if (v->active_state) {
+ timer_mod(v->timer, v->sleep_interval +
+ qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
+ } else {
+ goto testing_end;
+ }
return;
}
@@ -1298,6 +1303,14 @@ void qmp_test_vmstates_set_sinterval(int64_t sinterval, Error **errp)
v->sleep_interval = sinterval;
}
+void qmp_test_vmstates_cancel(Error **errp)
+{
+ VMStateLogState *v = vmstate_current_state();
+ if (v->active_state) {
+ v->active_state = false;
+ }
+}
+
void qmp_xen_save_devices_state(const char *filename, Error **errp)
{
QEMUFile *f;
--
1.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [RFC PATCH v1 2/5] VMState test: basic vmstate testing mechanism
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 2/5] VMState test: basic vmstate testing mechanism Sanidhya Kashyap
@ 2014-07-07 17:33 ` Eric Blake
0 siblings, 0 replies; 11+ messages in thread
From: Eric Blake @ 2014-07-07 17:33 UTC (permalink / raw)
To: Sanidhya Kashyap, qemu list; +Cc: Dr. David Alan Gilbert, Juan Quintela
[-- Attachment #1: Type: text/plain, Size: 2167 bytes --]
On 07/07/2014 11:18 AM, Sanidhya Kashyap wrote:
> This patch introduces the mechanism to test the devices state by storing
> and dumping in in the QEMUFile pointer.
>
> The testing is done as follows:
> 1) The VM is halted.
> 2) guest state is synchronized.
> 3) Then the device state is dumped to a temporary memory.
> 4) The guest state is reset.
> 5) Then the device state is loaded from the temporary memory.
> 6) The guest is resumed.
>
> +
> +## @test-vmstates
> +#
> +# tests the vmstates' value by dumping and loading in memory
> +# @times: total iterations
Missing the #optional flag; what does it default to if not specified?
> +# @sinterval: sleep interval between iteration
in what unit? Missing the #optional flag; what does it default to if
not specified?
> +#
> +# Since 2.1
You've missed hard freeze for 2.1; this is a new feature, and at the
earliest it can only be introduced in 2.2.
> +##
> +{ 'command': 'test-vmstates',
> + 'data': {'*times' : 'int',
> + '*sinterval' : 'int' } }
> +Arguments:
> +
> +- "times" : the total iterations for vmstates testing. The default
> + value is 10.
> +- "sinterval": the sleep interval between the iterations. The default
> + value is 100 milliseconds.
Ah, you provided more documentation in the .hx file than in the .json.
I hate the redundancy, but it's better to include it in both files.
> +++ b/savevm.c
> @@ -1137,6 +1137,154 @@ void do_savevm(Monitor *mon, const QDict *qdict)
> }
> }
>
> +#ifdef DEBUG_TEST_VMSTATES
> +#define DPRINTF(fmt, ...) \
> + do { printf("vmstate_test: " fmt, ## __VA_ARGS__); } while (0)
> +#else
> +#define DPRINTF(fmt, ...) \
> + do { } while (0)
> +#endif
Wasn't there another series proposed that ensures that even when
debugging is disabled that the compiler still compiles printf*
statements under an if(0) block to prevent bit-rot? I didn't bother to
look it up now in the archives, but you should reuse that approach.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [RFC PATCH v1 4/5] VMState test: set the frequency of the vmstate testing process
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 4/5] VMState test: set the frequency of the vmstate testing process Sanidhya Kashyap
@ 2014-07-07 18:25 ` Eric Blake
2014-07-18 18:59 ` Sanidhya Kashyap
0 siblings, 1 reply; 11+ messages in thread
From: Eric Blake @ 2014-07-07 18:25 UTC (permalink / raw)
To: Sanidhya Kashyap, qemu list; +Cc: Dr. David Alan Gilbert, Juan Quintela
[-- Attachment #1: Type: text/plain, Size: 2573 bytes --]
On 07/07/2014 11:18 AM, Sanidhya Kashyap wrote:
> This patch introduces the mechanism to update the sleep interval - sinterval.
>
> Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
> ---
> hmp-commands.hx | 15 +++++++++++++++
> hmp.c | 14 ++++++++++++++
> hmp.h | 1 +
> qapi-schema.json | 10 ++++++++++
> qmp-commands.hx | 22 ++++++++++++++++++++++
> savevm.c | 13 +++++++++++++
> 6 files changed, 75 insertions(+)
>
> +++ b/qapi-schema.json
> @@ -3492,3 +3492,13 @@
> { 'command': 'test-vmstates',
> 'data': {'*times' : 'int',
> '*sinterval' : 'int' } }
> +
> +## @test-vmstates-set-sinterval
> +#
> +# sets the sleep interval between iterations of the vmstate testing process
> +# @sinterval: the updated sleep interval value
in what units?
> +#
> +# Since 2.1
2.2.
> +##
> +{ 'command' : 'test-vmstates-set-sinterval',
> + 'data' : { 'sinterval': 'int' } }
This feels like a write-only command. How do I query what it is
currently set to?
I'm also afraid that we aren't learning our lessons from migrate.
Adding one new command per new tunable does not scale very well in the
number of commands that need to be maintained or that have to be wired
up in management software; better is adding a single command pair for
set/get that can be easily introspected (to see when new tunables are
added), by taking an array of tunables where each tunable is a struct
containing name, type, and value information. Something like:
{"execute":"test-vmstates-set-tuning", "arguments":{ "list":[
{ "name":"sinterval", "type":"int", "value":100 },
{ "name":"other", "type":"...", "value":... }
]}}
{"return": {}}
and a counterpart:
{"execute":"test-vmstates-get-tuning" }
{"return": [
{ "name":"sinterval", "type":"int", "value":100 },
{ "name":"other", "type":"...", "value":... }
]}
> +void qmp_test_vmstates_set_sinterval(int64_t sinterval, Error **errp)
> +{
> + VMStateLogState *v = vmstate_current_state();
> + if (sinterval < TEST_VMSTATE_MIN_INTERVAL_MS ||
> + sinterval > TEST_VMSTATE_MAX_INTERVAL_MS) {
> + error_setg(errp, "sleep interval value must be "
> + "in the defined range [%d, %d](ms)\n",
> + TEST_VMSTATE_MIN_INTERVAL_MS, TEST_VMSTATE_MAX_INTERVAL_MS);
This range limit should also be mentioned in the public API (.json) file.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [RFC PATCH v1 1/5] QEMUSizedBuffer/QEMUFile
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 1/5] QEMUSizedBuffer/QEMUFile Sanidhya Kashyap
@ 2014-07-07 18:28 ` Eric Blake
2014-07-08 7:48 ` Dr. David Alan Gilbert
0 siblings, 1 reply; 11+ messages in thread
From: Eric Blake @ 2014-07-07 18:28 UTC (permalink / raw)
To: Sanidhya Kashyap, qemu list
Cc: Joel Schopp, Juan Quintela, Dr. David Alan Gilbert, Stefan Berger
[-- Attachment #1: Type: text/plain, Size: 959 bytes --]
On 07/07/2014 11:18 AM, Sanidhya Kashyap wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
You are attributing the patch to David...
>
> Using the patch of Stefan Berger for memory buffer based QEMUFile.
>
> http://lists.gnu.org/archive/html/qemu-devel/2013-03/msg05036.html
>
> In the words of David:
>
> """
> Using the QEMUFile interface, this patch adds support functions for
> operating on in-memory sized buffers that can be written to or read from.
> """
>
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Signed-off-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
> ---
...but lack his S-o-b. Is it something that Stefan and Joel wrote (in
which case, one of them should be listed as author), or something that
David adopted and further improvedd (in which case he needs a signature)?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [RFC PATCH v1 1/5] QEMUSizedBuffer/QEMUFile
2014-07-07 18:28 ` Eric Blake
@ 2014-07-08 7:48 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 11+ messages in thread
From: Dr. David Alan Gilbert @ 2014-07-08 7:48 UTC (permalink / raw)
To: Eric Blake
Cc: Joel Schopp, Stefan Berger, qemu list, Juan Quintela,
Sanidhya Kashyap
* Eric Blake (eblake@redhat.com) wrote:
> On 07/07/2014 11:18 AM, Sanidhya Kashyap wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> You are attributing the patch to David...
>
> >
> > Using the patch of Stefan Berger for memory buffer based QEMUFile.
> >
> > http://lists.gnu.org/archive/html/qemu-devel/2013-03/msg05036.html
> >
> > In the words of David:
> >
> > """
> > Using the QEMUFile interface, this patch adds support functions for
> > operating on in-memory sized buffers that can be written to or read from.
> > """
> >
> > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> > Signed-off-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
> > ---
>
> ...but lack his S-o-b. Is it something that Stefan and Joel wrote (in
> which case, one of them should be listed as author), or something that
> David adopted and further improvedd (in which case he needs a signature)?
I adopted it and just updated it; nothing substantial.
(I use it in both my BER world and my postcopy world; and both Stefan
and Isaku wrote something similar, so it's about time this finds it's
way into the code base one way or another before someone else writes
a 3rd implementation).
Dave
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [RFC PATCH v1 4/5] VMState test: set the frequency of the vmstate testing process
2014-07-07 18:25 ` Eric Blake
@ 2014-07-18 18:59 ` Sanidhya Kashyap
0 siblings, 0 replies; 11+ messages in thread
From: Sanidhya Kashyap @ 2014-07-18 18:59 UTC (permalink / raw)
To: Eric Blake, qemu list; +Cc: Dr. David Alan Gilbert, Juan Quintela
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> This feels like a write-only command. How do I query what it is
> currently set to?
>
> I'm also afraid that we aren't learning our lessons from migrate.
> Adding one new command per new tunable does not scale very well in
> the number of commands that need to be maintained or that have to
> be wired up in management software; better is adding a single
> command pair for set/get that can be easily introspected (to see
> when new tunables are added), by taking an array of tunables where
> each tunable is a struct containing name, type, and value
> information. Something like:
>
> {"execute":"test-vmstates-set-tuning", "arguments":{ "list":[ {
> "name":"sinterval", "type":"int", "value":100 }, { "name":"other",
> "type":"...", "value":... } ]}} {"return": {}}
>
> and a counterpart:
>
> {"execute":"test-vmstates-get-tuning" } {"return": [ {
> "name":"sinterval", "type":"int", "value":100 }, { "name":"other",
> "type":"...", "value":... } ]}
>
>
Well, I have some issues about the implementation of the list which is
associated with the set-tuning one. Any patch illustrating the above
example which includes list will help me a lot.
Thanks.
- --
- -----
Sanidhya Kashyap
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJTyW6KAAoJEFt9RLmoahlnFQkIAJL6z0jo72gEc67ISr6pNxyH
sxFbT67LNHhliWlVvohOPqC4e8hGOfXJb5gmPr2UFZUbVNKLrGc1Mh8t5OeRPR2y
3twA+3uUvpuJhc6F+KH4Z125Qirj7Uom9/PCtOYD9QMIAOEkD9SzD1S3ZpWL6I2r
+l0s2xkFScG9eHyqe6pJlKRIORm9FnKVhYS18bzXz1WWh1mJTjF6qXNfbCS3OyqT
9rk1ZcYyYei/JNoclgC7Mvxy5QpQxrhhjwDFK0G3vFaPte+K+CYpGHL8a5s0sPFb
OOZ29X+5Zz4wOx9btf0+LovqSwrLueHCdF/l65+jSNPRRsvB4MslQva/Rybs4Kg=
=DpKh
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-07-18 18:59 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07 17:17 [Qemu-devel] [RFC PATCH v1 0/5] VMState testing Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 1/5] QEMUSizedBuffer/QEMUFile Sanidhya Kashyap
2014-07-07 18:28 ` Eric Blake
2014-07-08 7:48 ` Dr. David Alan Gilbert
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 2/5] VMState test: basic vmstate testing mechanism Sanidhya Kashyap
2014-07-07 17:33 ` Eric Blake
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 3/5] VMState test: hmp interface for vmstate testing Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 4/5] VMState test: set the frequency of the vmstate testing process Sanidhya Kashyap
2014-07-07 18:25 ` Eric Blake
2014-07-18 18:59 ` Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 5/5] VMState test: cancel mechanism for an already running " Sanidhya Kashyap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).