All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V2 0/2] COLO-compare: Optimize tcp compare performance and trace format.
@ 2017-04-18  2:20 Zhang Chen
  2017-04-18  2:20 ` [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field Zhang Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Zhang Chen @ 2017-04-18  2:20 UTC (permalink / raw)
  To: qemu devel, Jason Wang
  Cc: Zhang Chen, zhanghailiang, eddie . dong, bian naimeng, Li Zhijian

In the first patch, we add tcp options support to optimize compare performance.
and another patch simplified code and adjust trace print format.

Zhang Chen (2):
  COLO-compare: Optimize tcp compare for option field
  COLO-compare: Optimize tcp compare trace event

 net/colo-compare.c | 54 ++++++++++++++++++++++++++++++++++++++++++------------
 net/trace-events   |  3 +--
 2 files changed, 43 insertions(+), 14 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field
  2017-04-18  2:20 [Qemu-devel] [PATCH V2 0/2] COLO-compare: Optimize tcp compare performance and trace format Zhang Chen
@ 2017-04-18  2:20 ` Zhang Chen
  2017-04-20  6:43   ` Jason Wang
  2017-04-18  2:20 ` [Qemu-devel] [PATCH V2 2/2] COLO-compare: Optimize tcp compare trace event Zhang Chen
  2017-04-24  3:30 ` [Qemu-devel] [PATCH V2 0/2] COLO-compare: Optimize tcp compare performance and trace format Jason Wang
  2 siblings, 1 reply; 9+ messages in thread
From: Zhang Chen @ 2017-04-18  2:20 UTC (permalink / raw)
  To: qemu devel, Jason Wang
  Cc: Zhang Chen, zhanghailiang, eddie . dong, bian naimeng, Li Zhijian

In this patch we support packet that have tcp options field.
Add tcp options field check, If the packet have options
field we just skip it and compare tcp payload,
Avoid unnecessary checkpoint, optimize performance.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 net/colo-compare.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/net/colo-compare.c b/net/colo-compare.c
index aada04e..049f6f8 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -248,7 +248,32 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt)
         spkt->ip->ip_sum = ppkt->ip->ip_sum;
     }
 
-    if (ptcp->th_sum == stcp->th_sum) {
+    /*
+     * Check tcp header length for tcp option field.
+     * th_off > 5 means this tcp packet have options field.
+     * The tcp options maybe always different.
+     * for example:
+     * From RFC 7323.
+     * TCP Timestamps option (TSopt):
+     * Kind: 8
+     *
+     * Length: 10 bytes
+     *
+     *    +-------+-------+---------------------+---------------------+
+     *    |Kind=8 |  10   |   TS Value (TSval)  |TS Echo Reply (TSecr)|
+     *    +-------+-------+---------------------+---------------------+
+     *       1       1              4                     4
+     *
+     * In this case the primary guest's timestamp always different with
+     * the secondary guest's timestamp. COLO just focus on payload,
+     * so we just need skip this field.
+     */
+    if (ptcp->th_off > 5) {
+        ptrdiff_t tcp_offset;
+        tcp_offset = ppkt->transport_header - (uint8_t *)ppkt->data
+                     + (ptcp->th_off * 4);
+        res = colo_packet_compare_common(ppkt, spkt, tcp_offset);
+    } else if (ptcp->th_sum == stcp->th_sum) {
         res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN);
     } else {
         res = -1;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH V2 2/2] COLO-compare: Optimize tcp compare trace event
  2017-04-18  2:20 [Qemu-devel] [PATCH V2 0/2] COLO-compare: Optimize tcp compare performance and trace format Zhang Chen
  2017-04-18  2:20 ` [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field Zhang Chen
@ 2017-04-18  2:20 ` Zhang Chen
  2017-04-24  3:30 ` [Qemu-devel] [PATCH V2 0/2] COLO-compare: Optimize tcp compare performance and trace format Jason Wang
  2 siblings, 0 replies; 9+ messages in thread
From: Zhang Chen @ 2017-04-18  2:20 UTC (permalink / raw)
  To: qemu devel, Jason Wang
  Cc: Zhang Chen, zhanghailiang, eddie . dong, bian naimeng, Li Zhijian

Optimize two trace events as one, adjust print format make
it easy to read. rename trace_colo_compare_pkt_info_src/dst
to trace_colo_compare_tcp_info.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 net/colo-compare.c | 29 +++++++++++++++++------------
 net/trace-events   |  3 +--
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/net/colo-compare.c b/net/colo-compare.c
index 049f6f8..0eaa097 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -279,18 +279,23 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt)
         res = -1;
     }
 
-    if (res != 0 && trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {
-        trace_colo_compare_pkt_info_src(inet_ntoa(ppkt->ip->ip_src),
-                                        ntohl(stcp->th_seq),
-                                        ntohl(stcp->th_ack),
-                                        res, stcp->th_flags,
-                                        spkt->size);
-
-        trace_colo_compare_pkt_info_dst(inet_ntoa(ppkt->ip->ip_dst),
-                                        ntohl(ptcp->th_seq),
-                                        ntohl(ptcp->th_ack),
-                                        res, ptcp->th_flags,
-                                        ppkt->size);
+    if (res && trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {
+        char ip_src[20], ip_dst[20];
+
+        strcpy(ip_src, inet_ntoa(ppkt->ip->ip_src));
+        strcpy(ip_dst, inet_ntoa(ppkt->ip->ip_dst));
+
+        trace_colo_compare_tcp_info(ip_src,
+                                    ip_dst,
+                                    ntohl(ptcp->th_seq),
+                                    ntohl(stcp->th_seq),
+                                    ntohl(ptcp->th_ack),
+                                    ntohl(stcp->th_ack),
+                                    res,
+                                    ptcp->th_flags,
+                                    stcp->th_flags,
+                                    ppkt->size,
+                                    spkt->size);
 
         qemu_hexdump((char *)ppkt->data, stderr,
                      "colo-compare ppkt", ppkt->size);
diff --git a/net/trace-events b/net/trace-events
index 35198bc..123cb28 100644
--- a/net/trace-events
+++ b/net/trace-events
@@ -13,8 +13,7 @@ colo_compare_icmp_miscompare(const char *sta, int size) ": %s = %d"
 colo_compare_ip_info(int psize, const char *sta, const char *stb, int ssize, const char *stc, const char *std) "ppkt size = %d, ip_src = %s, ip_dst = %s, spkt size = %d, ip_src = %s, ip_dst = %s"
 colo_old_packet_check_found(int64_t old_time) "%" PRId64
 colo_compare_miscompare(void) ""
-colo_compare_pkt_info_src(const char *src, uint32_t sseq, uint32_t sack, int res, uint32_t sflag, int ssize) "src/dst: %s s: seq/ack=%u/%u res=%d flags=%x spkt_size: %d\n"
-colo_compare_pkt_info_dst(const char *dst, uint32_t dseq, uint32_t dack, int res, uint32_t dflag, int dsize) "src/dst: %s d: seq/ack=%u/%u res=%d flags=%x dpkt_size: %d\n"
+colo_compare_tcp_info(const char *src, const char *dst, uint32_t pseq, uint32_t sseq, uint32_t pack, uint32_t sack, int res, uint32_t pflag, uint32_t sflag, int psize, int ssize) "src/dst: %s/%s pseq/sseq:%u/%u pack/sack:%u/%u res=%d pflags/sflag:%x/%x psize/ssize:%d/%d \n"
 
 # net/filter-rewriter.c
 colo_filter_rewriter_debug(void) ""
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field
  2017-04-18  2:20 ` [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field Zhang Chen
@ 2017-04-20  6:43   ` Jason Wang
  2017-04-21  3:48     ` Zhang Chen
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Wang @ 2017-04-20  6:43 UTC (permalink / raw)
  To: Zhang Chen, qemu devel
  Cc: zhanghailiang, eddie . dong, bian naimeng, Li Zhijian



On 2017年04月18日 10:20, Zhang Chen wrote:
> In this patch we support packet that have tcp options field.
> Add tcp options field check, If the packet have options
> field we just skip it and compare tcp payload,
> Avoid unnecessary checkpoint, optimize performance.
>
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> ---
>   net/colo-compare.c | 27 ++++++++++++++++++++++++++-
>   1 file changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index aada04e..049f6f8 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -248,7 +248,32 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt)
>           spkt->ip->ip_sum = ppkt->ip->ip_sum;
>       }
>   
> -    if (ptcp->th_sum == stcp->th_sum) {
> +    /*
> +     * Check tcp header length for tcp option field.
> +     * th_off > 5 means this tcp packet have options field.
> +     * The tcp options maybe always different.
> +     * for example:
> +     * From RFC 7323.
> +     * TCP Timestamps option (TSopt):
> +     * Kind: 8
> +     *
> +     * Length: 10 bytes
> +     *
> +     *    +-------+-------+---------------------+---------------------+
> +     *    |Kind=8 |  10   |   TS Value (TSval)  |TS Echo Reply (TSecr)|
> +     *    +-------+-------+---------------------+---------------------+
> +     *       1       1              4                     4
> +     *
> +     * In this case the primary guest's timestamp always different with
> +     * the secondary guest's timestamp. COLO just focus on payload,
> +     * so we just need skip this field.h

Probably a good explanation why we can skip this kind of header. But it 
does not explain why we can skip all the rest?

Thanks

> +     */
> +    if (ptcp->th_off > 5) {
> +        ptrdiff_t tcp_offset;
> +        tcp_offset = ppkt->transport_header - (uint8_t *)ppkt->data
> +                     + (ptcp->th_off * 4);
> +        res = colo_packet_compare_common(ppkt, spkt, tcp_offset);
> +    } else if (ptcp->th_sum == stcp->th_sum) {
>           res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN);
>       } else {
>           res = -1;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field
  2017-04-20  6:43   ` Jason Wang
@ 2017-04-21  3:48     ` Zhang Chen
  2017-04-21  4:10       ` Jason Wang
  0 siblings, 1 reply; 9+ messages in thread
From: Zhang Chen @ 2017-04-21  3:48 UTC (permalink / raw)
  To: Jason Wang, qemu devel
  Cc: zhangchen.fnst, zhanghailiang, eddie . dong, bian naimeng, Li Zhijian



On 04/20/2017 02:43 PM, Jason Wang wrote:
>
>
> On 2017年04月18日 10:20, Zhang Chen wrote:
>> In this patch we support packet that have tcp options field.
>> Add tcp options field check, If the packet have options
>> field we just skip it and compare tcp payload,
>> Avoid unnecessary checkpoint, optimize performance.
>>
>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>> ---
>>   net/colo-compare.c | 27 ++++++++++++++++++++++++++-
>>   1 file changed, 26 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/colo-compare.c b/net/colo-compare.c
>> index aada04e..049f6f8 100644
>> --- a/net/colo-compare.c
>> +++ b/net/colo-compare.c
>> @@ -248,7 +248,32 @@ static int colo_packet_compare_tcp(Packet *spkt, 
>> Packet *ppkt)
>>           spkt->ip->ip_sum = ppkt->ip->ip_sum;
>>       }
>>   -    if (ptcp->th_sum == stcp->th_sum) {
>> +    /*
>> +     * Check tcp header length for tcp option field.
>> +     * th_off > 5 means this tcp packet have options field.
>> +     * The tcp options maybe always different.
>> +     * for example:
>> +     * From RFC 7323.
>> +     * TCP Timestamps option (TSopt):
>> +     * Kind: 8
>> +     *
>> +     * Length: 10 bytes
>> +     *
>> +     * +-------+-------+---------------------+---------------------+
>> +     *    |Kind=8 |  10   |   TS Value (TSval)  |TS Echo Reply (TSecr)|
>> +     * +-------+-------+---------------------+---------------------+
>> +     *       1       1              4                     4
>> +     *
>> +     * In this case the primary guest's timestamp always different with
>> +     * the secondary guest's timestamp. COLO just focus on payload,
>> +     * so we just need skip this field.h
>
> Probably a good explanation why we can skip this kind of header. But 
> it does not explain why we can skip all the rest?

I found tcp options have many kind number to express different meaning,
Here I just give an example for the different options situation,
and this field not the COLO-proxy focus on, COLO just concern the payload.
Maybe we will optimize in the feature. Currently we want to make COLO 
full-function
running in qemu upstream.

Thanks
Zhang Chen

>
> Thanks
>
>> +     */
>> +    if (ptcp->th_off > 5) {
>> +        ptrdiff_t tcp_offset;
>> +        tcp_offset = ppkt->transport_header - (uint8_t *)ppkt->data
>> +                     + (ptcp->th_off * 4);
>> +        res = colo_packet_compare_common(ppkt, spkt, tcp_offset);
>> +    } else if (ptcp->th_sum == stcp->th_sum) {
>>           res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN);
>>       } else {
>>           res = -1;
>
>
>
> .
>

-- 
Thanks
Zhang Chen

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field
  2017-04-21  3:48     ` Zhang Chen
@ 2017-04-21  4:10       ` Jason Wang
  2017-04-21  8:22         ` Zhang Chen
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Wang @ 2017-04-21  4:10 UTC (permalink / raw)
  To: Zhang Chen, qemu devel
  Cc: Li Zhijian, bian naimeng, eddie . dong, zhanghailiang



On 2017年04月21日 11:48, Zhang Chen wrote:
>
>
> On 04/20/2017 02:43 PM, Jason Wang wrote:
>>
>>
>> On 2017年04月18日 10:20, Zhang Chen wrote:
>>> In this patch we support packet that have tcp options field.
>>> Add tcp options field check, If the packet have options
>>> field we just skip it and compare tcp payload,
>>> Avoid unnecessary checkpoint, optimize performance.
>>>
>>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>>> ---
>>>   net/colo-compare.c | 27 ++++++++++++++++++++++++++-
>>>   1 file changed, 26 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/net/colo-compare.c b/net/colo-compare.c
>>> index aada04e..049f6f8 100644
>>> --- a/net/colo-compare.c
>>> +++ b/net/colo-compare.c
>>> @@ -248,7 +248,32 @@ static int colo_packet_compare_tcp(Packet 
>>> *spkt, Packet *ppkt)
>>>           spkt->ip->ip_sum = ppkt->ip->ip_sum;
>>>       }
>>>   -    if (ptcp->th_sum == stcp->th_sum) {
>>> +    /*
>>> +     * Check tcp header length for tcp option field.
>>> +     * th_off > 5 means this tcp packet have options field.
>>> +     * The tcp options maybe always different.
>>> +     * for example:
>>> +     * From RFC 7323.
>>> +     * TCP Timestamps option (TSopt):
>>> +     * Kind: 8
>>> +     *
>>> +     * Length: 10 bytes
>>> +     *
>>> +     * +-------+-------+---------------------+---------------------+
>>> +     *    |Kind=8 |  10   |   TS Value (TSval)  |TS Echo Reply 
>>> (TSecr)|
>>> +     * +-------+-------+---------------------+---------------------+
>>> +     *       1       1              4                     4
>>> +     *
>>> +     * In this case the primary guest's timestamp always different 
>>> with
>>> +     * the secondary guest's timestamp. COLO just focus on payload,
>>> +     * so we just need skip this field.h
>>
>> Probably a good explanation why we can skip this kind of header. But 
>> it does not explain why we can skip all the rest?
>
> I found tcp options have many kind number to express different meaning,
> Here I just give an example for the different options situation,
> and this field not the COLO-proxy focus on, COLO just concern the 
> payload.
> Maybe we will optimize in the feature. Currently we want to make COLO 
> full-function
> running in qemu upstream.

I see, but the questions are:

- If we see packets with different options (except for the case you 
explain above), does it mean primary and secondary run out of sync?
- What will happen if we compare and ask for synchronization if we find 
options are not exactly the same?

Thanks

>
> Thanks
> Zhang Chen
>
>>
>> Thanks
>>
>>> +     */
>>> +    if (ptcp->th_off > 5) {
>>> +        ptrdiff_t tcp_offset;
>>> +        tcp_offset = ppkt->transport_header - (uint8_t *)ppkt->data
>>> +                     + (ptcp->th_off * 4);
>>> +        res = colo_packet_compare_common(ppkt, spkt, tcp_offset);
>>> +    } else if (ptcp->th_sum == stcp->th_sum) {
>>>           res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN);
>>>       } else {
>>>           res = -1;
>>
>>
>>
>> .
>>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field
  2017-04-21  4:10       ` Jason Wang
@ 2017-04-21  8:22         ` Zhang Chen
  2017-04-24  3:27           ` Jason Wang
  0 siblings, 1 reply; 9+ messages in thread
From: Zhang Chen @ 2017-04-21  8:22 UTC (permalink / raw)
  To: Jason Wang, qemu devel
  Cc: zhangchen.fnst, Li Zhijian, bian naimeng, eddie . dong, zhanghailiang



On 04/21/2017 12:10 PM, Jason Wang wrote:
>
>
> On 2017年04月21日 11:48, Zhang Chen wrote:
>>
>>
>> On 04/20/2017 02:43 PM, Jason Wang wrote:
>>>
>>>
>>> On 2017年04月18日 10:20, Zhang Chen wrote:
>>>> In this patch we support packet that have tcp options field.
>>>> Add tcp options field check, If the packet have options
>>>> field we just skip it and compare tcp payload,
>>>> Avoid unnecessary checkpoint, optimize performance.
>>>>
>>>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>>>> ---
>>>>   net/colo-compare.c | 27 ++++++++++++++++++++++++++-
>>>>   1 file changed, 26 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/net/colo-compare.c b/net/colo-compare.c
>>>> index aada04e..049f6f8 100644
>>>> --- a/net/colo-compare.c
>>>> +++ b/net/colo-compare.c
>>>> @@ -248,7 +248,32 @@ static int colo_packet_compare_tcp(Packet 
>>>> *spkt, Packet *ppkt)
>>>>           spkt->ip->ip_sum = ppkt->ip->ip_sum;
>>>>       }
>>>>   -    if (ptcp->th_sum == stcp->th_sum) {
>>>> +    /*
>>>> +     * Check tcp header length for tcp option field.
>>>> +     * th_off > 5 means this tcp packet have options field.
>>>> +     * The tcp options maybe always different.
>>>> +     * for example:
>>>> +     * From RFC 7323.
>>>> +     * TCP Timestamps option (TSopt):
>>>> +     * Kind: 8
>>>> +     *
>>>> +     * Length: 10 bytes
>>>> +     *
>>>> +     * +-------+-------+---------------------+---------------------+
>>>> +     *    |Kind=8 |  10   |   TS Value (TSval)  |TS Echo Reply 
>>>> (TSecr)|
>>>> +     * +-------+-------+---------------------+---------------------+
>>>> +     *       1       1              4                     4
>>>> +     *
>>>> +     * In this case the primary guest's timestamp always different 
>>>> with
>>>> +     * the secondary guest's timestamp. COLO just focus on payload,
>>>> +     * so we just need skip this field.h
>>>
>>> Probably a good explanation why we can skip this kind of header. But 
>>> it does not explain why we can skip all the rest?
>>
>> I found tcp options have many kind number to express different meaning,
>> Here I just give an example for the different options situation,
>> and this field not the COLO-proxy focus on, COLO just concern the 
>> payload.
>> Maybe we will optimize in the feature. Currently we want to make COLO 
>> full-function
>> running in qemu upstream.
>
> I see, but the questions are:
>
> - If we see packets with different options (except for the case you 
> explain above), does it mean primary and secondary run out of sync?
> - What will happen if we compare and ask for synchronization if we 
> find options are not exactly the same?
>


The tcp options begin from the first SYN packet, if client connect to 
guest, the primary guest and secondary guest
just give a responses to the client's options, so I think the different 
options part mostly from guest's running
statues(like the timestamp), and if kind number are not same, the 
payload more likely not same too. finally, after
next checkpoint, all things will be same. If guest connect to client, 
primary guest send a packet and secondary not,
It will trigger old packet scan to do checkpoint.

Thanks
Zhang Chen


> Thanks
>
>>
>> Thanks
>> Zhang Chen
>>
>>>
>>> Thanks
>>>
>>>> +     */
>>>> +    if (ptcp->th_off > 5) {
>>>> +        ptrdiff_t tcp_offset;
>>>> +        tcp_offset = ppkt->transport_header - (uint8_t *)ppkt->data
>>>> +                     + (ptcp->th_off * 4);
>>>> +        res = colo_packet_compare_common(ppkt, spkt, tcp_offset);
>>>> +    } else if (ptcp->th_sum == stcp->th_sum) {
>>>>           res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN);
>>>>       } else {
>>>>           res = -1;
>>>
>>>
>>>
>>> .
>>>
>>
>
>
>
> .
>

-- 
Thanks
Zhang Chen

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field
  2017-04-21  8:22         ` Zhang Chen
@ 2017-04-24  3:27           ` Jason Wang
  0 siblings, 0 replies; 9+ messages in thread
From: Jason Wang @ 2017-04-24  3:27 UTC (permalink / raw)
  To: Zhang Chen, qemu devel
  Cc: Li Zhijian, bian naimeng, eddie . dong, zhanghailiang



On 2017年04月21日 16:22, Zhang Chen wrote:
>
>
> On 04/21/2017 12:10 PM, Jason Wang wrote:
>>
>>
>> On 2017年04月21日 11:48, Zhang Chen wrote:
>>>
>>>
>>> On 04/20/2017 02:43 PM, Jason Wang wrote:
>>>>
>>>>
>>>> On 2017年04月18日 10:20, Zhang Chen wrote:
>>>>> In this patch we support packet that have tcp options field.
>>>>> Add tcp options field check, If the packet have options
>>>>> field we just skip it and compare tcp payload,
>>>>> Avoid unnecessary checkpoint, optimize performance.
>>>>>
>>>>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>>>>> ---
>>>>>   net/colo-compare.c | 27 ++++++++++++++++++++++++++-
>>>>>   1 file changed, 26 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/net/colo-compare.c b/net/colo-compare.c
>>>>> index aada04e..049f6f8 100644
>>>>> --- a/net/colo-compare.c
>>>>> +++ b/net/colo-compare.c
>>>>> @@ -248,7 +248,32 @@ static int colo_packet_compare_tcp(Packet 
>>>>> *spkt, Packet *ppkt)
>>>>>           spkt->ip->ip_sum = ppkt->ip->ip_sum;
>>>>>       }
>>>>>   -    if (ptcp->th_sum == stcp->th_sum) {
>>>>> +    /*
>>>>> +     * Check tcp header length for tcp option field.
>>>>> +     * th_off > 5 means this tcp packet have options field.
>>>>> +     * The tcp options maybe always different.
>>>>> +     * for example:
>>>>> +     * From RFC 7323.
>>>>> +     * TCP Timestamps option (TSopt):
>>>>> +     * Kind: 8
>>>>> +     *
>>>>> +     * Length: 10 bytes
>>>>> +     *
>>>>> +     * +-------+-------+---------------------+---------------------+
>>>>> +     *    |Kind=8 |  10   |   TS Value (TSval)  |TS Echo Reply 
>>>>> (TSecr)|
>>>>> +     * +-------+-------+---------------------+---------------------+
>>>>> +     *       1       1              4 4
>>>>> +     *
>>>>> +     * In this case the primary guest's timestamp always 
>>>>> different with
>>>>> +     * the secondary guest's timestamp. COLO just focus on payload,
>>>>> +     * so we just need skip this field.h
>>>>
>>>> Probably a good explanation why we can skip this kind of header. 
>>>> But it does not explain why we can skip all the rest?
>>>
>>> I found tcp options have many kind number to express different meaning,
>>> Here I just give an example for the different options situation,
>>> and this field not the COLO-proxy focus on, COLO just concern the 
>>> payload.
>>> Maybe we will optimize in the feature. Currently we want to make 
>>> COLO full-function
>>> running in qemu upstream.
>>
>> I see, but the questions are:
>>
>> - If we see packets with different options (except for the case you 
>> explain above), does it mean primary and secondary run out of sync?
>> - What will happen if we compare and ask for synchronization if we 
>> find options are not exactly the same?
>>
>
>
> The tcp options begin from the first SYN packet, if client connect to 
> guest, the primary guest and secondary guest
> just give a responses to the client's options, so I think the 
> different options part mostly from guest's running
> statues(like the timestamp), and if kind number are not same, the 
> payload more likely not same too. finally, after
> next checkpoint, all things will be same. If guest connect to client, 
> primary guest send a packet and secondary not,
> It will trigger old packet scan to do checkpoint.
>
> Thanks
> Zhang Chen

Ok this sounds more or less a question of whether or not we want to be 
more relaxed.

Thanks

>
>
>> Thanks
>>
>>>
>>> Thanks
>>> Zhang Chen
>>>
>>>>
>>>> Thanks
>>>>
>>>>> +     */
>>>>> +    if (ptcp->th_off > 5) {
>>>>> +        ptrdiff_t tcp_offset;
>>>>> +        tcp_offset = ppkt->transport_header - (uint8_t *)ppkt->data
>>>>> +                     + (ptcp->th_off * 4);
>>>>> +        res = colo_packet_compare_common(ppkt, spkt, tcp_offset);
>>>>> +    } else if (ptcp->th_sum == stcp->th_sum) {
>>>>>           res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN);
>>>>>       } else {
>>>>>           res = -1;
>>>>
>>>>
>>>>
>>>> .
>>>>
>>>
>>
>>
>>
>> .
>>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH V2 0/2] COLO-compare: Optimize tcp compare performance and trace format.
  2017-04-18  2:20 [Qemu-devel] [PATCH V2 0/2] COLO-compare: Optimize tcp compare performance and trace format Zhang Chen
  2017-04-18  2:20 ` [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field Zhang Chen
  2017-04-18  2:20 ` [Qemu-devel] [PATCH V2 2/2] COLO-compare: Optimize tcp compare trace event Zhang Chen
@ 2017-04-24  3:30 ` Jason Wang
  2 siblings, 0 replies; 9+ messages in thread
From: Jason Wang @ 2017-04-24  3:30 UTC (permalink / raw)
  To: Zhang Chen, qemu devel
  Cc: zhanghailiang, eddie . dong, bian naimeng, Li Zhijian



On 2017年04月18日 10:20, Zhang Chen wrote:
> In the first patch, we add tcp options support to optimize compare performance.
> and another patch simplified code and adjust trace print format.
>
> Zhang Chen (2):
>    COLO-compare: Optimize tcp compare for option field
>    COLO-compare: Optimize tcp compare trace event
>
>   net/colo-compare.c | 54 ++++++++++++++++++++++++++++++++++++++++++------------
>   net/trace-events   |  3 +--
>   2 files changed, 43 insertions(+), 14 deletions(-)
>

Applied, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-04-24  3:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18  2:20 [Qemu-devel] [PATCH V2 0/2] COLO-compare: Optimize tcp compare performance and trace format Zhang Chen
2017-04-18  2:20 ` [Qemu-devel] [PATCH V2 1/2] COLO-compare: Optimize tcp compare for option field Zhang Chen
2017-04-20  6:43   ` Jason Wang
2017-04-21  3:48     ` Zhang Chen
2017-04-21  4:10       ` Jason Wang
2017-04-21  8:22         ` Zhang Chen
2017-04-24  3:27           ` Jason Wang
2017-04-18  2:20 ` [Qemu-devel] [PATCH V2 2/2] COLO-compare: Optimize tcp compare trace event Zhang Chen
2017-04-24  3:30 ` [Qemu-devel] [PATCH V2 0/2] COLO-compare: Optimize tcp compare performance and trace format Jason Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.