From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: qemu-devel@nongnu.org, jasowang@redhat.com
Cc: zhangchen.fnst@cn.fujitsu.com, lizhijian@cn.fujitsu.com,
zhanghailiang <zhang.zhanghailiang@huawei.com>
Subject: [Qemu-devel] [PATCH 3/3] colo-compare: use notifier to notify inconsistent packets comparing
Date: Tue, 24 Jan 2017 22:05:48 +0800 [thread overview]
Message-ID: <1485266748-15340-4-git-send-email-zhang.zhanghailiang@huawei.com> (raw)
In-Reply-To: <1485266748-15340-1-git-send-email-zhang.zhanghailiang@huawei.com>
It's a good idea to use notifier to notify COLO frame of
inconsistent packets comparing.
Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
net/colo-compare.c | 24 ++++++++++++++++++++++--
net/colo-compare.h | 2 ++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 2ad577b..39c394d 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -30,6 +30,7 @@
#include "qapi-visit.h"
#include "net/colo.h"
#include "net/colo-compare.h"
+#include "migration/migration.h"
#define TYPE_COLO_COMPARE "colo-compare"
#define COLO_COMPARE(obj) \
@@ -38,6 +39,9 @@
static QTAILQ_HEAD(, CompareState) net_compares =
QTAILQ_HEAD_INITIALIZER(net_compares);
+static NotifierList colo_compare_notifiers =
+ NOTIFIER_LIST_INITIALIZER(colo_compare_notifiers);
+
#define COMPARE_READ_LEN_MAX NET_BUFSIZE
#define MAX_QUEUE_SIZE 1024
@@ -378,6 +382,22 @@ static int colo_old_packet_check_one(Packet *pkt, int64_t *check_time)
}
}
+static void colo_compare_inconsistent_notify(void)
+{
+ notifier_list_notify(&colo_compare_notifiers,
+ migrate_get_current());
+}
+
+void colo_compare_register_notifier(Notifier *notify)
+{
+ notifier_list_add(&colo_compare_notifiers, notify);
+}
+
+void colo_compare_unregister_notifier(Notifier *notify)
+{
+ notifier_remove(notify);
+}
+
static void colo_old_packet_check_one_conn(void *opaque,
void *user_data)
{
@@ -392,7 +412,7 @@ static void colo_old_packet_check_one_conn(void *opaque,
qemu_mutex_unlock(&conn->conn_lock);
if (result) {
/* do checkpoint will flush old packet */
- /* TODO: colo_notify_checkpoint();*/
+ colo_compare_inconsistent_notify();
}
}
@@ -466,7 +486,7 @@ static void colo_compare_connection(void *opaque, void *user_data)
*/
trace_colo_compare_main("packet different");
g_queue_push_tail(&conn->primary_list, pkt);
- /* TODO: colo_notify_checkpoint();*/
+ colo_compare_inconsistent_notify();
break;
}
}
diff --git a/net/colo-compare.h b/net/colo-compare.h
index 44f9014..769f55a 100644
--- a/net/colo-compare.h
+++ b/net/colo-compare.h
@@ -16,5 +16,7 @@
#define QEMU_COLO_COMPARE_H
void colo_compare_do_checkpoint(void);
+void colo_compare_register_notifier(Notifier *notify);
+void colo_compare_unregister_notifier(Notifier *notify);
#endif /* QEMU_COLO_COMPARE_H */
--
1.8.3.1
next prev parent reply other threads:[~2017-01-24 14:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 14:05 [Qemu-devel] [PATCH 0/3] colo-compare: Preparing work for combining with COLO frame zhanghailiang
2017-01-24 14:05 ` [Qemu-devel] [PATCH 1/3] colo-compare: reconstruct the mutex lock usage zhanghailiang
2017-02-03 3:47 ` Jason Wang
2017-02-06 8:13 ` Hailiang Zhang
2017-02-06 8:30 ` Zhang Chen
2017-02-06 9:35 ` Jason Wang
2017-02-06 11:11 ` Hailiang Zhang
2017-02-06 12:53 ` Jason Wang
2017-02-07 7:54 ` Hailiang Zhang
2017-02-07 7:57 ` Jason Wang
2017-02-07 8:19 ` Hailiang Zhang
2017-02-07 9:21 ` Jason Wang
2017-02-07 9:30 ` Hailiang Zhang
2017-02-14 2:32 ` Hailiang Zhang
2017-02-14 4:08 ` Jason Wang
2017-02-14 7:33 ` Hailiang Zhang
2017-02-15 3:16 ` Jason Wang
2017-01-24 14:05 ` [Qemu-devel] [PATCH 2/3] colo-compare: add API to flush all queued packets while do checkpoint zhanghailiang
2017-01-24 14:05 ` zhanghailiang [this message]
2017-02-03 4:50 ` [Qemu-devel] [PATCH 3/3] colo-compare: use notifier to notify inconsistent packets comparing Jason Wang
2017-02-06 8:44 ` Hailiang Zhang
2017-02-06 9:35 ` Jason Wang
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=1485266748-15340-4-git-send-email-zhang.zhanghailiang@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=jasowang@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=zhangchen.fnst@cn.fujitsu.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).