From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Dr. David Alan Gilbert" <dave@treblig.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Hyman Huang" <infra.ai.cloud@bitdeer.com>
Subject: [PATCH v2 13/16] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c
Date: Wed, 12 Aug 2026 15:11:44 +0200 [thread overview]
Message-ID: <20260812131147.83188-14-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260812131147.83188-1-philmd@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
system/dirtylimit-hmp-cmds.c | 74 ++++++++++++++++++++++++++++++++++++
system/dirtylimit.c | 60 -----------------------------
system/meson.build | 1 +
3 files changed, 75 insertions(+), 60 deletions(-)
create mode 100644 system/dirtylimit-hmp-cmds.c
diff --git a/system/dirtylimit-hmp-cmds.c b/system/dirtylimit-hmp-cmds.c
new file mode 100644
index 00000000000..4928d57cc8e
--- /dev/null
+++ b/system/dirtylimit-hmp-cmds.c
@@ -0,0 +1,74 @@
+/*
+ * HMP commands related to migration dirty page rate limit
+ *
+ * Copyright (c) 2022 CHINA TELECOM CO.,LTD.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-migration.h"
+#include "qobject/qdict.h"
+#include "monitor/hmp.h"
+#include "monitor/monitor.h"
+#include "system/dirtylimit.h"
+
+void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
+{
+ int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
+ Error *err = NULL;
+
+ qmp_cancel_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, &err);
+ if (err) {
+ hmp_handle_error(mon, err);
+ return;
+ }
+
+ monitor_printf(mon, "[Please use 'info vcpu_dirty_limit' to query "
+ "dirty limit for virtual CPU]\n");
+}
+
+void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
+{
+ int64_t dirty_rate = qdict_get_int(qdict, "dirty_rate");
+ int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
+ Error *err = NULL;
+
+ if (dirty_rate < 0) {
+ error_setg(&err, "invalid dirty page limit %" PRId64, dirty_rate);
+ goto out;
+ }
+
+ qmp_set_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, dirty_rate, &err);
+
+out:
+ hmp_handle_error(mon, err);
+}
+
+void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
+{
+ DirtyLimitInfoList *info;
+ g_autoptr(DirtyLimitInfoList) head = NULL;
+ Error *err = NULL;
+
+ if (!dirtylimit_in_service()) {
+ monitor_printf(mon, "Dirty page limit not enabled!\n");
+ return;
+ }
+
+ head = qmp_query_vcpu_dirty_limit(&err);
+ if (err) {
+ hmp_handle_error(mon, err);
+ return;
+ }
+
+ for (info = head; info != NULL; info = info->next) {
+ monitor_printf(mon, "vcpu[%"PRIi64"], limit rate %"PRIi64 " (MB/s),"
+ " current rate %"PRIi64 " (MB/s)\n",
+ info->value->cpu_index,
+ info->value->limit_rate,
+ info->value->current_rate);
+ }
+}
diff --git a/system/dirtylimit.c b/system/dirtylimit.c
index 50fa67f3d6a..70bb7bac2d0 100644
--- a/system/dirtylimit.c
+++ b/system/dirtylimit.c
@@ -17,8 +17,6 @@
#include "qapi/error.h"
#include "system/dirtyrate.h"
#include "system/dirtylimit.h"
-#include "monitor/hmp.h"
-#include "monitor/monitor.h"
#include "system/memory.h"
#include "exec/target_page.h"
#include "hw/core/boards.h"
@@ -491,21 +489,6 @@ void qmp_cancel_vcpu_dirty_limit(bool has_cpu_index,
dirtylimit_state_unlock();
}
-void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
-{
- int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
- Error *err = NULL;
-
- qmp_cancel_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, &err);
- if (err) {
- hmp_handle_error(mon, err);
- return;
- }
-
- monitor_printf(mon, "[Please use 'info vcpu_dirty_limit' to query "
- "dirty limit for virtual CPU]\n");
-}
-
void qmp_set_vcpu_dirty_limit(bool has_cpu_index,
int64_t cpu_index,
uint64_t dirty_rate,
@@ -548,23 +531,6 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index,
dirtylimit_state_unlock();
}
-void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
-{
- int64_t dirty_rate = qdict_get_int(qdict, "dirty_rate");
- int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
- Error *err = NULL;
-
- if (dirty_rate < 0) {
- error_setg(&err, "invalid dirty page limit %" PRId64, dirty_rate);
- goto out;
- }
-
- qmp_set_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, dirty_rate, &err);
-
-out:
- hmp_handle_error(mon, err);
-}
-
/* Return the max throttle time of each virtual CPU */
uint64_t dirtylimit_throttle_time_per_round(void)
{
@@ -646,29 +612,3 @@ struct DirtyLimitInfoList *qmp_query_vcpu_dirty_limit(Error **errp)
{
return dirtylimit_query_all();
}
-
-void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
-{
- DirtyLimitInfoList *info;
- g_autoptr(DirtyLimitInfoList) head = NULL;
- Error *err = NULL;
-
- if (!dirtylimit_in_service()) {
- monitor_printf(mon, "Dirty page limit not enabled!\n");
- return;
- }
-
- head = qmp_query_vcpu_dirty_limit(&err);
- if (err) {
- hmp_handle_error(mon, err);
- return;
- }
-
- for (info = head; info != NULL; info = info->next) {
- monitor_printf(mon, "vcpu[%"PRIi64"], limit rate %"PRIi64 " (MB/s),"
- " current rate %"PRIi64 " (MB/s)\n",
- info->value->cpu_index,
- info->value->limit_rate,
- info->value->current_rate);
- }
-}
diff --git a/system/meson.build b/system/meson.build
index cd3193d170b..377adce8035 100644
--- a/system/meson.build
+++ b/system/meson.build
@@ -9,6 +9,7 @@ system_ss.add(files(
'cpus.c',
'cpu-timers.c',
'dirtylimit.c',
+ 'dirtylimit-hmp-cmds.c',
'dma-helpers.c',
'exit-with-parent.c',
'globals.c',
--
2.53.0
next prev parent reply other threads:[~2026-08-12 13:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
2026-08-12 13:11 ` [PATCH v2 01/16] hexagon: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 02/16] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 03/16] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h' Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 04/16] qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 05/16] migration/hmp-cmds: Include 'block/block-global-state.h' header Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 06/16] monitor: Include missing 'qemu/aio-wait.h' header Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 07/16] monitor: Include missing 'qemu/lockable.h' header Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 08/16] monitor: Include missing 'qemu/coroutine-core.h' header Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 09/16] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 10/16] monitor: Remove unnecessary 'block/block.h' header Philippe Mathieu-Daudé
2026-08-12 14:00 ` Marc-André Lureau
2026-08-12 16:05 ` Philippe Mathieu-Daudé
2026-08-12 13:11 ` [PATCH v2 11/16] monitor/hmp: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 12/16] system: " Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` Philippe Mathieu-Daudé [this message]
2026-08-12 14:05 ` [PATCH v2 13/16] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 14/16] system: Move qmp_inject_nmi() to hw/core/machine-qmp-cmds.c Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 15/16] system: Extract QMP memsave/pmemsave commands to physmem-qmp-cmds.c Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 16/16] system: Move runstate-related code from cpus.c to runstate.c Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260812131147.83188-14-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=david@gibson.dropbear.id.au \
--cc=infra.ai.cloud@bitdeer.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.