qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v10 3/3] cpus-common: implement dirty page limit on virtual C


From: Hyman Huang
Subject: Re: [PATCH v10 3/3] cpus-common: implement dirty page limit on virtual CPU
Date: Wed, 15 Dec 2021 15:56:55 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2



在 2021/12/15 15:37, Markus Armbruster 写道:
huangy81@chinatelecom.cn writes:

From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>

Implement dirtyrate calculation periodically basing on
dirty-ring and throttle virtual CPU until it reachs the quota
dirty page rate given by user.

Introduce qmp commands "vcpu-dirty-limit", "query-vcpu-dirty-limit"
to enable, disable, query dirty page limit for virtual CPU.

Meanwhile, introduce corresponding hmp commands "vcpu_dirty_limit",
"info vcpu_dirty_limit" so developers can play with them easier.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>

[...]

diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index 96d0148..04879a2 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -131,6 +131,8 @@ void hmp_replay_delete_break(Monitor *mon, const QDict 
*qdict);
  void hmp_replay_seek(Monitor *mon, const QDict *qdict);
  void hmp_info_dirty_rate(Monitor *mon, const QDict *qdict);
  void hmp_calc_dirty_rate(Monitor *mon, const QDict *qdict);
+void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict);
+void hmp_vcpu_dirty_limit(Monitor *mon, const QDict *qdict);
  void hmp_human_readable_text_helper(Monitor *mon,
                                      HumanReadableText *(*qmp_handler)(Error 
**));
diff --git a/qapi/migration.json b/qapi/migration.json
index ac5fa56..7d8da4f 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -1869,6 +1869,50 @@
              'current-rate': 'int64' } }
##
+# @vcpu-dirty-limit:
+#
+# Set or cancel the upper limit of dirty page rate for a virtual CPU.
+#
+# Requires KVM with accelerator property "dirty-ring-size" set.
+# A virtual CPU's dirty page rate is a measure of its memory load.
+# To observe dirty page rates, use @calc-dirty-rate.
+#
+# @enable: true to enable, false to disable.
+#
+# @cpu-index: index of virtual CPU, default is all.

Suggest

     # @cpu-index: The vCPU to act upon (all by default).

(I'm stealing this from trace.json)

+#
+# @dirty-rate: upper limit of dirty page rate for virtual CPU, to
+#              cancel dirty limit, this field will be ignored.
+#
+# Since: 7.0
+#
+# Example:
+#   {"execute": "vcpu-dirty-limit"}
+#    "arguments": { "enable": true,
+#                   "cpu-index": 1,
+#                   "dirty-rate": 200 } }
+#
+##
+{ 'command': 'vcpu-dirty-limit',
+  'data': { 'enable': 'bool',
+            '*cpu-index': 'uint64',
+            '*dirty-rate': 'uint64'} }

Drop @enable, please.

If @dirty-rate is present, set the limit to its value.

If it's absent, cancel the limit.

Ok. Indeed, this is the simplest style. :)

So the final qmp format should be like:

case 1: setup vcpu 0 dirty page limit 100MB/s
vcpu-dirty-limit  cpu-index=0   dirty-rate=100MB/s

case 2: cancle vcpu 0 dirty page limit
vcpu-dirty-limit  cpu-index=0

I'll do that next version.

Thanks Markus very much

+
+##
+# @query-vcpu-dirty-limit:
+#
+# Returns information about all virtual CPU dirty limit if enabled.
+#
+# Since: 7.0
+#
+# Example:
+#   {"execute": "query-vcpu-dirty-limit"}
+#
+##
+{ 'command': 'query-vcpu-dirty-limit',
+  'returns': [ 'DirtyLimitInfo' ] }
+
+##
  # @snapshot-save:
  #
  # Save a VM snapshot


--
Best regard

Hyman Huang(黄勇)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]