diff mbox series

[v9,01/12] migration/dirtyrate: setup up query-dirtyrate framwork

Message ID 1600137887-58739-2-git-send-email-zhengchuan@huawei.com
State Superseded
Headers show
Series *** A Method for evaluating dirty page rate *** | expand

Commit Message

Zheng Chuan Sept. 15, 2020, 2:44 a.m. UTC
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>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
---
 migration/dirtyrate.c | 38 ++++++++++++++++++++++++++++++++++++++
 migration/dirtyrate.h | 29 +++++++++++++++++++++++++++++
 migration/meson.build |  2 +-
 3 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 migration/dirtyrate.c
 create mode 100644 migration/dirtyrate.h

Comments

Li Qiang Sept. 15, 2020, 4:16 p.m. UTC | #1
Chuan Zheng <zhengchuan@huawei.com> 于2020年9月15日周二 上午10:34写道:
>

> 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>

> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> Reviewed-by: David Edmondson <david.edmondson@oracle.com>


Reviewed-by: Li Qiang <liq3ea@gmail.com>


> ---

>  migration/dirtyrate.c | 38 ++++++++++++++++++++++++++++++++++++++

>  migration/dirtyrate.h | 29 +++++++++++++++++++++++++++++

>  migration/meson.build |  2 +-

>  3 files changed, 68 insertions(+), 1 deletion(-)

>  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..bf7fd24

> --- /dev/null

> +++ b/migration/dirtyrate.c

> @@ -0,0 +1,38 @@

> +/*

> + * Dirtyrate implement code

> + *

> + * 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.

> + */

> +

> +#include "qemu/osdep.h"

> +#include "qapi/error.h"

> +#include "cpu.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..5be9714

> --- /dev/null

> +++ b/migration/dirtyrate.h

> @@ -0,0 +1,29 @@

> +/*

> + *  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

> +

> +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..b5b71c8 100644

> --- a/migration/meson.build

> +++ b/migration/meson.build

> @@ -37,4 +37,4 @@ softmmu_ss.add(when: ['CONFIG_RDMA', rdma], if_true: files('rdma.c'))

>  softmmu_ss.add(when: 'CONFIG_LIVE_BLOCK_MIGRATION', if_true: files('block.c'))

>  softmmu_ss.add(when: 'CONFIG_ZSTD', if_true: [files('multifd-zstd.c'), zstd])

>

> -specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files('ram.c'))

> +specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files('dirtyrate.c', 'ram.c'))

> --

> 1.8.3.1

>
diff mbox series

Patch

diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
new file mode 100644
index 0000000..bf7fd24
--- /dev/null
+++ b/migration/dirtyrate.c
@@ -0,0 +1,38 @@ 
+/*
+ * Dirtyrate implement code
+ *
+ * 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.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "cpu.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..5be9714
--- /dev/null
+++ b/migration/dirtyrate.h
@@ -0,0 +1,29 @@ 
+/*
+ *  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
+
+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..b5b71c8 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -37,4 +37,4 @@  softmmu_ss.add(when: ['CONFIG_RDMA', rdma], if_true: files('rdma.c'))
 softmmu_ss.add(when: 'CONFIG_LIVE_BLOCK_MIGRATION', if_true: files('block.c'))
 softmmu_ss.add(when: 'CONFIG_ZSTD', if_true: [files('multifd-zstd.c'), zstd])
 
-specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files('ram.c'))
+specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files('dirtyrate.c', 'ram.c'))