From nobody Thu Nov 13 20:40:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1582492153; cv=none; d=zohomail.com; s=zohoarc; b=XOUGhIZr360oRLT5wGH1oHYD8od6+HeNa8EX1bXulX1mSxhKMty1f96eSck52LV/Zp5jQzKJKUDFjBUxkHV6jk6vuqiTKShlHYuKjDyC1M0gseu9w4hmxR5drj6wo73A0KwnECGw/Jfh1HgLGv8Y/bWSeVsl4uR17eGxyISxcfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582492153; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Qj9AtJPLvAKZfG/9na8gW/Ml8ahFj6KJPjFxoWZRrtg=; b=NRpOgUwOOrYUQcMujicpr6TluY5iG3qizrebbU1XQk6AQlzKqGs6lacJYS9Z9HLZzJZ88+gvtfiy/gOlgHvcx9H32CLt6DY4dp/NOv+2YOiWQyIH463jMONJvZ8bsv9xcVCTj3AUBhWqIOvGLeKdhi9xv6KBCNrrza8hZwoNSZs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582492153575433.0890833441297; Sun, 23 Feb 2020 13:09:13 -0800 (PST) Received: from localhost ([::1]:56850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5yUy-0006NL-Kg for importer@patchew.org; Sun, 23 Feb 2020 16:09:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56610) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5ySv-0004Eh-UF for qemu-devel@nongnu.org; Sun, 23 Feb 2020 16:07:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5ySu-0001gR-J0 for qemu-devel@nongnu.org; Sun, 23 Feb 2020 16:07:05 -0500 Received: from mga05.intel.com ([192.55.52.43]:59518) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j5ySu-0001eg-At for qemu-devel@nongnu.org; Sun, 23 Feb 2020 16:07:04 -0500 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2020 13:07:02 -0800 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga008.fm.intel.com with ESMTP; 23 Feb 2020 13:07:01 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,477,1574150400"; d="scan'208";a="230945816" From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 2/2] net/colo-compare.c: Expose "expired_scan_cycle" to user Date: Mon, 24 Feb 2020 04:58:05 +0800 Message-Id: <20200223205805.26412-3-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200223205805.26412-1-chen.zhang@intel.com> References: <20200223205805.26412-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.43 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Cho , Zhang Chen , "Dr . David Alan Gilbert" , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Zhang Chen The "expired_scan_cycle" determines colo-compare scan expired net packet cycle. Signed-off-by: Zhang Chen --- net/colo-compare.c | 48 +++++++++++++++++++++++++++++++++++++++++++--- qemu-options.hx | 3 ++- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index ec09b2a524..10c0239f9d 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -48,7 +48,6 @@ static NotifierList colo_compare_notifiers =3D #define COLO_COMPARE_FREE_PRIMARY 0x01 #define COLO_COMPARE_FREE_SECONDARY 0x02 =20 -/* TODO: Should be configurable */ #define REGULAR_PACKET_CHECK_MS 3000 #define DEFAULT_TIME_OUT_MS 3000 =20 @@ -94,6 +93,7 @@ typedef struct CompareState { SocketReadState notify_rs; bool vnet_hdr; uint32_t compare_timeout; + uint32_t expired_scan_cycle; =20 /* * Record the connection that through the NIC @@ -823,7 +823,7 @@ static void check_old_packet_regular(void *opaque) /* if have old packet we will notify checkpoint */ colo_old_packet_check(s); timer_mod(s->packet_check_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)= + - REGULAR_PACKET_CHECK_MS); + s->expired_scan_cycle); } =20 /* Public API, Used for COLO frame to notify compare event */ @@ -853,7 +853,7 @@ static void colo_compare_timer_init(CompareState *s) SCALE_MS, check_old_packet_regular, s); timer_mod(s->packet_check_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)= + - REGULAR_PACKET_CHECK_MS); + s->expired_scan_cycle); } =20 static void colo_compare_timer_del(CompareState *s) @@ -1018,6 +1018,39 @@ out: error_propagate(errp, local_err); } =20 +static void compare_get_expired_scan_cycle(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + CompareState *s =3D COLO_COMPARE(obj); + uint32_t value =3D s->expired_scan_cycle; + + visit_type_uint32(v, name, &value, errp); +} + +static void compare_set_expired_scan_cycle(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + CompareState *s =3D COLO_COMPARE(obj); + Error *local_err =3D NULL; + uint32_t value; + + visit_type_uint32(v, name, &value, &local_err); + if (local_err) { + goto out; + } + if (!value) { + error_setg(&local_err, "Property '%s.%s' requires a positive value= ", + object_get_typename(obj), name); + goto out; + } + s->expired_scan_cycle =3D value; + +out: + error_propagate(errp, local_err); +} + static void compare_pri_rs_finalize(SocketReadState *pri_rs) { CompareState *s =3D container_of(pri_rs, CompareState, pri_rs); @@ -1129,6 +1162,11 @@ static void colo_compare_complete(UserCreatable *uc,= Error **errp) s->compare_timeout =3D DEFAULT_TIME_OUT_MS; } =20 + if (!s->expired_scan_cycle) { + /* Set default value to 3000 MS */ + s->expired_scan_cycle =3D REGULAR_PACKET_CHECK_MS; + } + if (find_and_check_chardev(&chr, s->pri_indev, errp) || !qemu_chr_fe_init(&s->chr_pri_in, chr, errp)) { return; @@ -1228,6 +1266,10 @@ static void colo_compare_init(Object *obj) compare_get_timeout, compare_set_timeout, NULL, NULL, NULL); =20 + object_property_add(obj, "expired_scan_cycle", "uint32", + compare_get_expired_scan_cycle, + compare_set_expired_scan_cycle, NULL, NULL, NULL); + s->vnet_hdr =3D false; object_property_add_bool(obj, "vnet_hdr_support", compare_get_vnet_hdr, compare_set_vnet_hdr, NULL); diff --git a/qemu-options.hx b/qemu-options.hx index 3832d0ae8a..8069428c73 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4598,7 +4598,7 @@ Dump the network traffic on netdev @var{dev} to the f= ile specified by The file format is libpcap, so it can be analyzed with tools such as tcpdu= mp or Wireshark. =20 -@item -object colo-compare,id=3D@var{id},primary_in=3D@var{chardevid},seco= ndary_in=3D@var{chardevid},outdev=3D@var{chardevid},iothread=3D@var{id}[,vn= et_hdr_support][,notify_dev=3D@var{id}][,compare_timeout=3D@var{ms}] +@item -object colo-compare,id=3D@var{id},primary_in=3D@var{chardevid},seco= ndary_in=3D@var{chardevid},outdev=3D@var{chardevid},iothread=3D@var{id}[,vn= et_hdr_support][,notify_dev=3D@var{id}][,compare_timeout=3D@var{ms}][,expir= ed_scan_cycle=3D@var{ms}] =20 Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@v= ar{chardevid}, than compare primary packet with secondary packet. If the packets are same, we will output primary @@ -4608,6 +4608,7 @@ In order to improve efficiency, we need to put the ta= sk of comparison in another thread. If it has the vnet_hdr_support flag, colo compare will send/recv packet with vnet_hdr_len. The compare_timeout=3D@var{ms} determines the maximum time colo-compare wait for primary packet. +The expired_scan_cycle=3D@var{ms} to set the expired packet scan cycle. If you want to use Xen COLO, will need the notify_dev to notify Xen colo-frame to do checkpoint. =20 --=20 2.17.1