From nobody Wed Nov 5 10:28:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534021342515705.2610072550827; Sat, 11 Aug 2018 14:02:22 -0700 (PDT) Received: from localhost ([::1]:33178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fob1h-0005tE-FK for importer@patchew.org; Sat, 11 Aug 2018 17:02:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1foazJ-0004NX-Pk for qemu-devel@nongnu.org; Sat, 11 Aug 2018 16:59:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1foazI-000155-T5 for qemu-devel@nongnu.org; Sat, 11 Aug 2018 16:59:53 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:35824) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1foazI-00014j-Mp for qemu-devel@nongnu.org; Sat, 11 Aug 2018 16:59:52 -0400 Received: by mail-pg1-x52c.google.com with SMTP id w10-v6so5872207pgv.2 for ; Sat, 11 Aug 2018 13:59:52 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id h24-v6sm23502641pfk.113.2018.08.11.13.59.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Aug 2018 13:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bpx5nNk4c2i+Qel/d4lL7jT0w+UFVx5G4ipkEW0Rma0=; b=ClZBExym7OBkgvKHO7xIrM0C+y2E0WJki4DPWcQfetTv3G/ETV+Yk+8gSkbBYl9YnH Kp0QMimkC5TkwSBx9Hhv5ymF5IGVNFSynxTdpWBSe8o/gZbosahGTn1p3AKsVUD8FqPI C4VJsG5p/rmdSUwKWu5HhgM/AYTroBtGkQ1RC1hi/AjKcMPrnkKgq1e1MjL5IycEPfU2 pcy9sscECuIolGOFWq+4gSjLZ/8sewbjb6S0o8eMM+EDukyWQq6qNTwn4JN6nH5PSbXg 5HMlT4JeLqZt5V7WviQswoKp4KbLIoxeiuDDqH8RA3VJwFYhyEDE9L+IwaUfapcvl8eU ZkUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bpx5nNk4c2i+Qel/d4lL7jT0w+UFVx5G4ipkEW0Rma0=; b=EPYbowDj1DlJjkojqkhnFhCb04fqOhs+EoU9F+EwG8BXaTxJcDXngCHXdg71p7Qthv 9okYtdwMVKDKkGg6vwB00Gy9v2X93oOJCPGZ3Juimxp5lBRxRcX99om22A9viISw3wwH IfZeQwnuDESHiRLS1h0Ui4EEHZ4nugis/ax/3e+Glr8Imj5CZXYwmqC/f8ORSPwF5Jng GruWtsN1wKumLmVfOaFTlImGgUBeDBRjKr7mCayjGlmuHkrhMSxxXbAlVLWvHP4gla4o dEtLE35/eqFK1vao6ojqTzw/hL6vsEjTQgyMw8E7ztRIOqmxkpZF15QRIVh8s2L8Y1zk zyLA== X-Gm-Message-State: AOUpUlHNEslKKSdJUxtPPZ1pNB4xAvttmVGLTFZfZaLltCKOko6XkRAL cUWLASolfXTA+Wl1q3jCtNlehsRJ X-Google-Smtp-Source: AA+uWPxHqd4AICH8jcTb+tbnUpJY6rk6WOzOUhuO5q6G3K0355jrjvgvKFcJGWNHthftCkm9DAJYvw== X-Received: by 2002:a62:1d49:: with SMTP id d70-v6mr12760657pfd.101.1534021191258; Sat, 11 Aug 2018 13:59:51 -0700 (PDT) From: Zhang Chen To: qemu-devel@nongnu.org, Paolo Bonzini , Juan Quintela , "Dr . David Alan Gilbert" , Jason Wang , Eric Blake , Markus Armbruster Date: Sun, 12 Aug 2018 04:59:07 +0800 Message-Id: <20180811205924.4113-4-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180811205924.4113-1-zhangckid@gmail.com> References: <20180811205924.4113-1-zhangckid@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52c Subject: [Qemu-devel] [PATCH V11 03/20] colo-compare: use notifier to notify packets comparing result X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , zhanghailiang , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It's a good idea to use notifier to notify COLO frame of inconsistent packets comparing. Signed-off-by: Zhang Chen Signed-off-by: Zhang Chen Signed-off-by: zhanghailiang --- net/colo-compare.c | 37 ++++++++++++++++++++++++++----------- net/colo-compare.h | 2 ++ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 80e6532e8b..426eab5973 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -29,6 +29,7 @@ #include "sysemu/iothread.h" #include "net/colo-compare.h" #include "migration/colo.h" +#include "migration/migration.h" =20 #define TYPE_COLO_COMPARE "colo-compare" #define COLO_COMPARE(obj) \ @@ -37,6 +38,9 @@ static QTAILQ_HEAD(, CompareState) net_compares =3D QTAILQ_HEAD_INITIALIZER(net_compares); =20 +static NotifierList colo_compare_notifiers =3D + NOTIFIER_LIST_INITIALIZER(colo_compare_notifiers); + #define COMPARE_READ_LEN_MAX NET_BUFSIZE #define MAX_QUEUE_SIZE 1024 =20 @@ -427,10 +431,7 @@ sec: qemu_hexdump((char *)spkt->data, stderr, "colo-compare spkt", spkt->size); =20 - /* - * colo_compare_inconsistent_notify(); - * TODO: notice to checkpoint(); - */ + colo_compare_inconsistency_notify(); } } =20 @@ -561,8 +562,24 @@ static int colo_old_packet_check_one(Packet *pkt, int6= 4_t *check_time) } } =20 +static void colo_compare_inconsistency_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 int colo_old_packet_check_one_conn(Connection *conn, - void *user_data) + void *user_data) { GList *result =3D NULL; int64_t check_time =3D REGULAR_PACKET_CHECK_MS; @@ -573,10 +590,7 @@ static int colo_old_packet_check_one_conn(Connection *= conn, =20 if (result) { /* Do checkpoint will flush old packet */ - /* - * TODO: Notify colo frame to do checkpoint. - * colo_compare_inconsistent_notify(); - */ + colo_compare_inconsistency_notify(); return 0; } =20 @@ -620,11 +634,12 @@ static void colo_compare_packet(CompareState *s, Conn= ection *conn, /* * If one packet arrive late, the secondary_list or * primary_list will be empty, so we can't compare it - * until next comparison. + * until next comparison. If the packets in the list are + * timeout, it will trigger a checkpoint request. */ trace_colo_compare_main("packet different"); g_queue_push_head(&conn->primary_list, pkt); - /* TODO: colo_notify_checkpoint();*/ + colo_compare_inconsistency_notify(); break; } } diff --git a/net/colo-compare.h b/net/colo-compare.h index 1b1ce76aea..22ddd512e2 100644 --- a/net/colo-compare.h +++ b/net/colo-compare.h @@ -18,5 +18,7 @@ #define QEMU_COLO_COMPARE_H =20 void colo_notify_compares_event(void *opaque, int event, Error **errp); +void colo_compare_register_notifier(Notifier *notify); +void colo_compare_unregister_notifier(Notifier *notify); =20 #endif /* QEMU_COLO_COMPARE_H */ --=20 2.17.GIT