qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hailiang Zhang <zhang.zhanghailiang@huawei.com>
To: Jason Wang <jasowang@redhat.com>,
	zhangchen.fnst@cn.fujitsu.com, lizhijian@cn.fujitsu.com
Cc: xuquan8@huawei.com, qemu-devel@nongnu.org, pss.wulizhen@huawei.com
Subject: Re: [Qemu-devel] [PATCH 3/5] colo-compare: release all unhandled packets in finalize function
Date: Thu, 16 Feb 2017 10:43:30 +0800	[thread overview]
Message-ID: <58A511D2.6020102@huawei.com> (raw)
In-Reply-To: <09a2bc10-d8dd-a2c0-f545-6b08a871d91a@redhat.com>

On 2017/2/16 10:34, Jason Wang wrote:
>
>
> On 2017年02月15日 16:34, zhanghailiang wrote:
>> We should release all unhandled packets before finalize colo compare.
>> Besides, we need to free connection_track_table, or there will be
>> a memory leak bug.
>>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> ---
>>    net/colo-compare.c | 20 ++++++++++++++++++++
>>    1 file changed, 20 insertions(+)
>>
>> diff --git a/net/colo-compare.c b/net/colo-compare.c
>> index a16e2d5..809bad3 100644
>> --- a/net/colo-compare.c
>> +++ b/net/colo-compare.c
>> @@ -676,6 +676,23 @@ static void colo_compare_complete(UserCreatable *uc, Error **errp)
>>        return;
>>    }
>>
>> +static void colo_release_packets(void *opaque, void *user_data)
>> +{
>> +    CompareState *s = user_data;
>> +    Connection *conn = opaque;
>> +    Packet *pkt = NULL;
>> +
>> +    while (!g_queue_is_empty(&conn->primary_list)) {
>> +        pkt = g_queue_pop_head(&conn->primary_list);
>> +        compare_chr_send(&s->chr_out, pkt->data, pkt->size);
>
> Any reason to send packets here?
>

Yes, considering the usage case which we shut COLO for
the VM to make it as a normal VM without FT.
We need to remove all the filter objects. In this case,
IMHO, it is necessary to release the unhandled packets.


Thanks.

> Thanks
>
>> +        packet_destroy(pkt, NULL);
>> +    }
>> +    while (!g_queue_is_empty(&conn->secondary_list)) {
>> +        pkt = g_queue_pop_head(&conn->secondary_list);
>> +        packet_destroy(pkt, NULL);
>> +    }
>> +}
>> +
>>    static void colo_compare_class_init(ObjectClass *oc, void *data)
>>    {
>>        UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
>> @@ -707,9 +724,12 @@ static void colo_compare_finalize(Object *obj)
>>        g_main_loop_quit(s->compare_loop);
>>        qemu_thread_join(&s->thread);
>>
>> +    /* Release all unhandled packets after compare thead exited */
>> +    g_queue_foreach(&s->conn_list, colo_release_packets, s);
>>
>>        g_queue_free(&s->conn_list);
>>
>> +    g_hash_table_destroy(s->connection_track_table);
>>        g_free(s->pri_indev);
>>        g_free(s->sec_indev);
>>        g_free(s->outdev);
>
>
> .
>

  reply	other threads:[~2017-02-16  2:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15  8:34 [Qemu-devel] [PATCH 0/5] colo-compare: fix some bugs zhanghailiang
2017-02-15  8:34 ` [Qemu-devel] [PATCH 1/5] colo-compare: use g_timeout_source_new() to process the stale packets zhanghailiang
2017-02-15  8:34 ` [Qemu-devel] [PATCH 2/5] colo-compare: kick compare thread to exit while finalize zhanghailiang
2017-02-16  2:25   ` Zhang Chen
2017-02-16  2:34     ` Jason Wang
2017-02-16  2:45     ` Hailiang Zhang
2017-02-15  8:34 ` [Qemu-devel] [PATCH 3/5] colo-compare: release all unhandled packets in finalize function zhanghailiang
2017-02-16  2:27   ` Zhang Chen
2017-02-16  5:25     ` Hailiang Zhang
2017-02-16  2:34   ` Jason Wang
2017-02-16  2:43     ` Hailiang Zhang [this message]
2017-02-16  2:47       ` Jason Wang
2017-02-15  8:34 ` [Qemu-devel] [PATCH 4/5] char: remove the right fd been watched in qemu_chr_fe_set_handlers() zhanghailiang
2017-02-15  8:34 ` [Qemu-devel] [PATCH 5/5] colo-compare: Fix removing fds been watched incorrectly in finalization zhanghailiang

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=58A511D2.6020102@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=jasowang@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=pss.wulizhen@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xuquan8@huawei.com \
    --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).