diff mbox

[v5,5/6] BitmapLog: set the period of the dump bitmap process

Message ID 1406862751-24008-6-git-send-email-sanidhya.iiith@gmail.com
State New
Headers show

Commit Message

Sanidhya Kashyap Aug. 1, 2014, 3:12 a.m. UTC
No functional change except the variable name -- frequency has been modified
to period.

Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
 hmp-commands.hx  | 15 +++++++++++++++
 hmp.c            | 12 ++++++++++++
 hmp.h            |  1 +
 qapi-schema.json | 12 ++++++++++++
 qmp-commands.hx  | 24 ++++++++++++++++++++++++
 savevm.c         | 14 ++++++++++++++
 6 files changed, 78 insertions(+)

Comments

Eric Blake Aug. 12, 2014, 1:57 p.m. UTC | #1
On 07/31/2014 09:12 PM, Sanidhya Kashyap wrote:
> No functional change except the variable name -- frequency has been modified
> to period.

This sounds like patch revision information that belongs...

> 
> Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
> ---

...here.

>  hmp-commands.hx  | 15 +++++++++++++++
>  hmp.c            | 12 ++++++++++++
>  hmp.h            |  1 +
>  qapi-schema.json | 12 ++++++++++++
>  qmp-commands.hx  | 24 ++++++++++++++++++++++++
>  savevm.c         | 14 ++++++++++++++
>  6 files changed, 78 insertions(+)
> 
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index dcdc465..b36927d 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -1820,6 +1820,21 @@ STEXI
>  Cancel the current bitmap dump process
>  ETEXI
>  
> +    {
> +        .name       = "ldbsf|log_dirty_bitmap_set_period",

As in 2/6, don't try to use a short 'ldbsf' name.
diff mbox

Patch

diff --git a/hmp-commands.hx b/hmp-commands.hx
index dcdc465..b36927d 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1820,6 +1820,21 @@  STEXI
 Cancel the current bitmap dump process
 ETEXI
 
+    {
+        .name       = "ldbsf|log_dirty_bitmap_set_period",
+        .args_type  = "period:i",
+        .params     = "period",
+        .help       = "set the period for bitmap dump process\n\t\t\t"
+                      "period: the new period value to replace the existing",
+        .mhandler.cmd = hmp_log_dirty_bitmap_set_period,
+    },
+
+STEXI
+@item ldbsf or log_dirty_bitmap_set_period @var{period}
+@findex log_dirty_bitmap_set_period
+Set the period to @var{period} (int) for bitmap dump process.
+ETEXI
+
 STEXI
 @end table
 ETEXI
diff --git a/hmp.c b/hmp.c
index e485788..4963c05 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1341,6 +1341,18 @@  void hmp_log_dirty_bitmap_cancel(Monitor *mon, const QDict *qdict)
     qmp_log_dirty_bitmap_cancel(NULL);
 }
 
+void hmp_log_dirty_bitmap_set_period(Monitor *mon, const QDict *qdict)
+{
+    int64_t period = qdict_get_int(qdict, "period");
+    Error *err = NULL;
+    qmp_log_dirty_bitmap_set_period(period, &err);
+    if (err) {
+        monitor_printf(mon, "log_dirty_bitmap_set_period: %s\n",
+                       error_get_pretty(err));
+        error_free(err);
+    }
+}
+
 void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
diff --git a/hmp.h b/hmp.h
index fcfb10f..a5a0571 100644
--- a/hmp.h
+++ b/hmp.h
@@ -97,6 +97,7 @@  void hmp_object_del(Monitor *mon, const QDict *qdict);
 void hmp_info_memdev(Monitor *mon, const QDict *qdict);
 void hmp_log_dirty_bitmap(Monitor *mon, const QDict *qdict);
 void hmp_log_dirty_bitmap_cancel(Monitor *mon, const QDict *qdict);
+void hmp_log_dirty_bitmap_set_period(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 b54c0ec..f24e850 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3552,3 +3552,15 @@ 
 # Since 2.2
 ##
 { 'command': 'log-dirty-bitmap-cancel' }
+
+##
+# @log-dirty-bitmap-set-period
+#
+# sets the period of the dirty bitmap logging process
+# @frequency: the updated period value (in milliseconds).
+# The min and max values are 10 and 100000 respectively.
+#
+# Since 2.2
+##
+{ 'command': 'log-dirty-bitmap-set-period',
+  'data': { 'period': 'int' } }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index b339d55..43a989d 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3834,3 +3834,27 @@  Example:
 -> { "execute": "log-dirty-bitmap-cancel" }
 <- { "return": {} }
 EQMP
+
+    {
+        .name       = "log-dirty-bitmap-set-period",
+        .args_type  = "period:i",
+        .mhandler.cmd_new = qmp_marshal_input_log_dirty_bitmap_set_period,
+    },
+
+SQMP
+log-dirty-bitmap-set-period
+---------------------------
+
+Update the period for the remaining iterations.
+
+Arguments:
+
+- "period": The updated period (json-int) (in milliseconds).
+            The min and max values are 10 and 100000 respectively.
+
+Example:
+
+-> { "execute": "log-dirty-bitmap-set-period", "arguments": { "period": 1024 } }
+<- { "return": {} }
+
+EQMP
diff --git a/savevm.c b/savevm.c
index cbd4fc6..161724d 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1546,6 +1546,20 @@  void qmp_log_dirty_bitmap_cancel(Error **errp)
     } while (b->state != LOG_BITMAP_STATE_CANCELING);
 }
 
+void qmp_log_dirty_bitmap_set_period(int64_t period, Error **errp)
+{
+    BitmapLogState *b = log_bitmap_get_current_state();
+    Error *local_err = NULL;
+    if (value_in_range(period, MIN_PERIOD_VALUE,
+                       MAX_PERIOD_VALUE, "period", &local_err)) {
+        if (local_err) {
+            error_propagate(errp, local_err);
+            return;
+        }
+    }
+    b->current_period = period;
+}
+
 void qmp_xen_save_devices_state(const char *filename, Error **errp)
 {
     QEMUFile *f;