[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 01/12] migration/dirtyrate: setup up query-dirtyrate framwork
From: |
Chuan Zheng |
Subject: |
[PATCH v5 01/12] migration/dirtyrate: setup up query-dirtyrate framwork |
Date: |
Tue, 25 Aug 2020 09:40:39 +0800 |
Add get_dirtyrate_thread() functions to setup query-dirtyrate
framework.
Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
Signed-off-by: YanYing Zhuang <ann.zhuangyanying@huawei.com>
---
migration/dirtyrate.c | 39 +++++++++++++++++++++++++++++++++++++++
migration/dirtyrate.h | 32 ++++++++++++++++++++++++++++++++
migration/meson.build | 1 +
3 files changed, 72 insertions(+)
create mode 100644 migration/dirtyrate.c
create mode 100644 migration/dirtyrate.h
diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
new file mode 100644
index 0000000..366f4e9
--- /dev/null
+++ b/migration/dirtyrate.c
@@ -0,0 +1,39 @@
+/*
+ * Dirtyrate implement code
+ *
+ * Copyright (c) 2017-2020 HUAWEI TECHNOLOGIES CO.,LTD.
+ *
+ * Authors:
+ * Chuan Zheng <zhengchuan@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "crypto/hash.h"
+#include "crypto/random.h"
+#include "qemu/config-file.h"
+#include "exec/memory.h"
+#include "exec/ramblock.h"
+#include "exec/target_page.h"
+#include "qemu/rcu_queue.h"
+#include "qapi/qapi-commands-migration.h"
+#include "migration.h"
+#include "dirtyrate.h"
+
+static void calculate_dirtyrate(struct DirtyRateConfig config)
+{
+ /* todo */
+ return;
+}
+
+void *get_dirtyrate_thread(void *arg)
+{
+ struct DirtyRateConfig config = *(struct DirtyRateConfig *)arg;
+
+ calculate_dirtyrate(config);
+
+ return NULL;
+}
diff --git a/migration/dirtyrate.h b/migration/dirtyrate.h
new file mode 100644
index 0000000..33669b7
--- /dev/null
+++ b/migration/dirtyrate.h
@@ -0,0 +1,32 @@
+/*
+ * Dirtyrate common functions
+ *
+ * Copyright (c) 2020 HUAWEI TECHNOLOGIES CO., LTD.
+ *
+ * Authors:
+ * Chuan Zheng <zhengchuan@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_MIGRATION_DIRTYRATE_H
+#define QEMU_MIGRATION_DIRTYRATE_H
+
+/*
+ * Sample 512 pages per GB as default.
+ * TODO: Make it configurable.
+ */
+#define DIRTYRATE_DEFAULT_SAMPLE_PAGES 512
+
+/* Take 1s as default for calculation duration */
+#define DEFAULT_FETCH_DIRTYRATE_TIME_SEC 1
+
+struct DirtyRateConfig {
+ uint64_t sample_pages_per_gigabytes; /* sample pages per GB */
+ int64_t sample_period_seconds; /* time duration between two sampling */
+};
+
+void *get_dirtyrate_thread(void *arg);
+#endif
+
diff --git a/migration/meson.build b/migration/meson.build
index ac8ff14..30cc6c3 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -21,6 +21,7 @@ softmmu_ss.add(files(
'channel.c',
'colo-failover.c',
'colo.c',
+ 'dirtyrate.c',
'exec.c',
'fd.c',
'global_state.c',
--
1.8.3.1
- Re: [PATCH v5 09/12] migration/dirtyrate: Implement get_sample_page_period() and block_sample_page_period(), (continued)
[PATCH v5 12/12] migration/dirtyrate: Add trace_calls to make it easier to debug, Chuan Zheng, 2020/08/24
[PATCH v5 10/12] migration/dirtyrate: Implement calculate_dirtyrate() function, Chuan Zheng, 2020/08/24
Re: [PATCH v5 00/12] *** A Method for evaluating dirty page rate ***, no-reply, 2020/08/24
[PATCH v5 00/12] *** A Method for evaluating dirty page rate ***, Chuan Zheng, 2020/08/24
[PATCH v5 06/12] migration/dirtyrate: Record hash results for each sampled page, Chuan Zheng, 2020/08/24