All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>,
	qemu devel <qemu-devel@nongnu.org>
Cc: zhanghailiang <zhang.zhanghailiang@huawei.com>,
	Li Zhijian <lizhijian@cn.fujitsu.com>,
	Gui jianfeng <guijianfeng@cn.fujitsu.com>,
	"eddie.dong" <eddie.dong@intel.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Yang Hongyang <hongyang.yang@easystack.cn>
Subject: Re: [Qemu-devel] [RFC PATCH V3 1/4] colo-compare: introduce colo compare initlization
Date: Fri, 29 Apr 2016 10:03:02 +0800	[thread overview]
Message-ID: <5722C0D6.8080805@redhat.com> (raw)
In-Reply-To: <5721D21C.6070202@cn.fujitsu.com>



On 04/28/2016 05:04 PM, Zhang Chen wrote:
>
>
> On 04/28/2016 04:17 PM, Jason Wang wrote:
>>
>> On 04/28/2016 03:55 PM, Zhang Chen wrote:
>>>
>>> On 04/28/2016 03:16 PM, Jason Wang wrote:
>>>> On 04/28/2016 02:53 PM, Jason Wang wrote:
>>>>> +static void compare_set_outdev(Object *obj, const char *value,
>>>>> Error **errp)
>>>>>> +{
>>>>>> +    CompareState *s = COLO_COMPARE(obj);
>>>>>> +
>>>>>> +    g_free(s->outdev);
>>>>>> +    s->outdev = g_strdup(value);
>>>>>> +}
>>>>>> +
>>>>>> +/*
>>>>>> + * called from the main thread on the primary
>>>>>> + * to setup colo-compare.
>>>>>> + */
>>>>>> +static void colo_compare_complete(UserCreatable *uc, Error **errp)
>>>>>> +{
>>>>>> +    CompareState *s = COLO_COMPARE(uc);
>>>>>> +
>>>>>> +    if (!s->pri_indev || !s->sec_indev || !s->outdev) {
>>>>>> +        error_setg(errp, "colo compare needs 'primary_in' ,"
>>>>>> +                   "'secondary_in','outdev' property set");
>>>>>> +        return;
>>>>>> +    } else if (!strcmp(s->pri_indev, s->outdev) ||
>>>>>> +               !strcmp(s->sec_indev, s->outdev) ||
>>>>>> +               !strcmp(s->pri_indev, s->sec_indev)) {
>>>>>> +        error_setg(errp, "'indev' and 'outdev' could not be same "
>>>>>> +                   "for compare module");
>>>>>> +        return;
>>>>>> +    }
>>>>>> +
>>>>>> +    s->chr_pri_in = qemu_chr_find(s->pri_indev);
>>>>>> +    if (s->chr_pri_in == NULL) {
>>>>>> +        error_setg(errp, "Primary IN Device '%s' not found",
>>>>>> +                   s->pri_indev);
>>>>>> +        return;
>>>>>> +    }
>>>>>> +
>>>>>> +    s->chr_sec_in = qemu_chr_find(s->sec_indev);
>>>>>> +    if (s->chr_sec_in == NULL) {
>>>>>> +        error_setg(errp, "Secondary IN Device '%s' not found",
>>>>>> +                   s->sec_indev);
>>>>>> +        return;
>>>>>> +    }
>>>>>> +
>>>>>> +    s->chr_out = qemu_chr_find(s->outdev);
>>>>>> +    if (s->chr_out == NULL) {
>>>>>> +        error_setg(errp, "OUT Device '%s' not found", s->outdev);
>>>>>> +        return;
>>>>>> +    }
>>>>>> +
>>>>>> +    qemu_chr_fe_claim_no_fail(s->chr_pri_in);
>>>>>> +    qemu_chr_add_handlers(s->chr_pri_in, compare_chr_can_read,
>>>>>> +                          compare_pri_chr_in, NULL, s);
>>>>>> +
>>>>>> +    qemu_chr_fe_claim_no_fail(s->chr_sec_in);
>>>>>> +    qemu_chr_add_handlers(s->chr_sec_in, compare_chr_can_read,
>>>>>> +                          compare_sec_chr_in, NULL, s);
>>>>>> +
>>>> Btw, what's the reason of handling this in main loop? I thought it
>>>> would
>>>> be better to do this in colo thread? Otherwise, you need lots of extra
>>>> synchronizations?
>>> Do you mean we should start/stop/do checkpoint it by colo-frame?
>> I mean we probably want to handle pri_in and sec_in in colo compare
>> thread. Through this way, there's no need for extra synchronization with
>> main loop.
>
> I get your point, but how to do this.
> Now, we use qemu_chr_add_handlers to do this job.

You probably want to start a new main loop in colo comparing thread.

>
>
> Thanks
> zhangchen 

  reply	other threads:[~2016-04-29  2:03 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 11:11 [Qemu-devel] [RFC PATCH V3 0/4] Introduce COLO-compare Zhang Chen
2016-04-18 11:11 ` [Qemu-devel] [RFC PATCH V3 1/4] colo-compare: introduce colo compare initlization Zhang Chen
2016-04-28  6:53   ` Jason Wang
2016-04-28  7:16     ` Jason Wang
2016-04-28  7:55       ` Zhang Chen
2016-04-28  8:17         ` Jason Wang
2016-04-28  9:04           ` Zhang Chen
2016-04-29  2:03             ` Jason Wang [this message]
2016-04-29  2:08               ` Zhang Chen
2016-05-06  5:42               ` Zhang Chen
2016-05-06  6:37                 ` Jason Wang
2016-05-09 10:49                   ` Zhang Chen
2016-05-12  6:49                     ` Zhang Chen
2016-05-12  8:01                       ` Jason Wang
2016-05-12  8:16                         ` Zhang Chen
2016-05-13  3:48                           ` Jason Wang
2016-05-20  2:46                             ` Jason Wang
2016-05-20  6:52                               ` Fam Zheng
2016-04-28  7:53     ` Zhang Chen
2016-04-28  8:23       ` Jason Wang
2016-04-28 20:55   ` Eric Blake
2016-04-29  1:28     ` Zhang Chen
2016-04-18 11:11 ` [Qemu-devel] [RFC PATCH V3 2/4] colo-compare: track connection and enqueue packet Zhang Chen
2016-04-28  7:47   ` Jason Wang
2016-04-28 10:25     ` Zhang Chen
2016-04-29  2:05       ` Jason Wang
2016-04-29  7:24         ` Zhang Chen
2016-04-18 11:11 ` [Qemu-devel] [RFC PATCH V3 3/4] colo-compare: introduce packet comparison thread Zhang Chen
2016-04-28  7:58   ` Jason Wang
2016-04-28 10:31     ` Zhang Chen
2016-04-29  2:07       ` Jason Wang
2016-04-29  8:28         ` Zhang Chen
2016-04-29 11:20           ` Dr. David Alan Gilbert
2016-04-18 11:11 ` [Qemu-devel] [RFC PATCH V3 4/4] colo-compare: add TCP, UDP, ICMP packet comparison Zhang Chen
2016-04-28  8:15   ` Jason Wang
2016-04-28 19:44   ` Dr. David Alan Gilbert
2016-05-05  3:03     ` Zhang Chen
2016-05-05  3:10       ` Zhang Chen
2016-04-27 11:54 ` [Qemu-devel] [RFC PATCH V3 0/4] Introduce COLO-compare Zhang Chen

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=5722C0D6.8080805@redhat.com \
    --to=jasowang@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eddie.dong@intel.com \
    --cc=guijianfeng@cn.fujitsu.com \
    --cc=hongyang.yang@easystack.cn \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhang.zhanghailiang@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 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.