diff mbox series

[v1,1/2] colo-compare: Fix incorrect data type conversion

Message ID 20200911190508.1316487-2-dereksu@qnap.com (mailing list archive)
State New, archived
Headers show
Series colo-compare bugfixes | expand

Commit Message

Derek Su Sept. 11, 2020, 7:05 p.m. UTC
Fix data type conversion of compare_timeout. The incorrect
conversion results in a random compare_timeout value and
unexpected stalls in packet comparison.

Signed-off-by: Derek Su <dereksu@qnap.com>
---
 net/colo-compare.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Zhang Chen Sept. 13, 2020, 8:02 p.m. UTC | #1
> -----Original Message-----
> From: Derek Su <dereksu@qnap.com>
> Sent: Saturday, September 12, 2020 3:05 AM
> To: qemu-devel@nongnu.org
> Cc: Zhang, Chen <chen.zhang@intel.com>; lizhijian@cn.fujitsu.com;
> jasowang@redhat.com; Derek Su <dereksu@qnap.com>
> Subject: [PATCH v1 1/2] colo-compare: Fix incorrect data type conversion
> 
> Fix data type conversion of compare_timeout. The incorrect conversion
> results in a random compare_timeout value and unexpected stalls in packet
> comparison.
> 

This bug already found on our internal test too. Just waiting to send.
Good catch! But this patch not fixed the root cause.
Change the compare_timeout from uint32_t to uint64_t is better.
I will send a patch for this and tag reported by you.

Thanks
Zhang Chen


> Signed-off-by: Derek Su <dereksu@qnap.com>
> ---
>  net/colo-compare.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/colo-compare.c b/net/colo-compare.c index
> 2c20de1537..c4de86ef34 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -619,11 +619,12 @@ static int colo_packet_compare_other(Packet *spkt,
> Packet *ppkt)
>                                         ppkt->size - offset);  }
> 
> -static int colo_old_packet_check_one(Packet *pkt, int64_t *check_time)
> +static int colo_old_packet_check_one(Packet *pkt, void *user_data)
>  {
>      int64_t now = qemu_clock_get_ms(QEMU_CLOCK_HOST);
> +    uint32_t check_time = *(uint32_t *)user_data;
> 
> -    if ((now - pkt->creation_ms) > (*check_time)) {
> +    if ((now - pkt->creation_ms) > check_time) {
>          trace_colo_old_packet_check_found(pkt->creation_ms);
>          return 0;
>      } else {
> --
> 2.25.1
Derek Su Sept. 14, 2020, 12:31 a.m. UTC | #2
Hi, Chen

Got it, thank you :)

Regards,
Derek

Zhang, Chen <chen.zhang@intel.com>於 2020年9月14日 週一,上午4:02寫道:

>
>
>
>
> > -----Original Message-----
>
> > From: Derek Su <dereksu@qnap.com>
>
> > Sent: Saturday, September 12, 2020 3:05 AM
>
> > To: qemu-devel@nongnu.org
>
> > Cc: Zhang, Chen <chen.zhang@intel.com>; lizhijian@cn.fujitsu.com;
>
> > jasowang@redhat.com; Derek Su <dereksu@qnap.com>
>
> > Subject: [PATCH v1 1/2] colo-compare: Fix incorrect data type conversion
>
> >
>
> > Fix data type conversion of compare_timeout. The incorrect conversion
>
> > results in a random compare_timeout value and unexpected stalls in packet
>
> > comparison.
>
> >
>
>
>
> This bug already found on our internal test too. Just waiting to send.
>
> Good catch! But this patch not fixed the root cause.
>
> Change the compare_timeout from uint32_t to uint64_t is better.
>
> I will send a patch for this and tag reported by you.
>
>
>
> Thanks
>
> Zhang Chen
>
>
>
>
>
> > Signed-off-by: Derek Su <dereksu@qnap.com>
>
> > ---
>
> >  net/colo-compare.c | 5 +++--
>
> >  1 file changed, 3 insertions(+), 2 deletions(-)
>
> >
>
> > diff --git a/net/colo-compare.c b/net/colo-compare.c index
>
> > 2c20de1537..c4de86ef34 100644
>
> > --- a/net/colo-compare.c
>
> > +++ b/net/colo-compare.c
>
> > @@ -619,11 +619,12 @@ static int colo_packet_compare_other(Packet *spkt,
>
> > Packet *ppkt)
>
> >                                         ppkt->size - offset);  }
>
> >
>
> > -static int colo_old_packet_check_one(Packet *pkt, int64_t *check_time)
>
> > +static int colo_old_packet_check_one(Packet *pkt, void *user_data)
>
> >  {
>
> >      int64_t now = qemu_clock_get_ms(QEMU_CLOCK_HOST);
>
> > +    uint32_t check_time = *(uint32_t *)user_data;
>
> >
>
> > -    if ((now - pkt->creation_ms) > (*check_time)) {
>
> > +    if ((now - pkt->creation_ms) > check_time) {
>
> >          trace_colo_old_packet_check_found(pkt->creation_ms);
>
> >          return 0;
>
> >      } else {
>
> > --
>
> > 2.25.1
>
>
>
> --

Best regards,

Derek Su
QNAP Systems, Inc.
Email: dereksu@qnap.com
Tel: (+886)-2-2393-5152 ext. 15017
Address: 13F., No.56, Sec. 1, Xinsheng S. Rd., Zhongzheng Dist., Taipei
City, Taiwan
diff mbox series

Patch

diff --git a/net/colo-compare.c b/net/colo-compare.c
index 2c20de1537..c4de86ef34 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -619,11 +619,12 @@  static int colo_packet_compare_other(Packet *spkt, Packet *ppkt)
                                        ppkt->size - offset);
 }
 
-static int colo_old_packet_check_one(Packet *pkt, int64_t *check_time)
+static int colo_old_packet_check_one(Packet *pkt, void *user_data)
 {
     int64_t now = qemu_clock_get_ms(QEMU_CLOCK_HOST);
+    uint32_t check_time = *(uint32_t *)user_data;
 
-    if ((now - pkt->creation_ms) > (*check_time)) {
+    if ((now - pkt->creation_ms) > check_time) {
         trace_colo_old_packet_check_found(pkt->creation_ms);
         return 0;
     } else {