From: Hongyang Yang <yanghy@cn.fujitsu.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: ian.campbell@citrix.com, wency@cn.fujitsu.com,
stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
yunhong.jiang@intel.com, eddie.dong@intel.com,
xen-devel@lists.xen.org, rshriram@cs.ubc.ca,
roger.pau@citrix.com, laijs@cn.fujitsu.com
Subject: Re: [PATCH v10 4/5] remus: implement remus network buffering for nic devices
Date: Thu, 10 Jul 2014 09:38:30 +0800 [thread overview]
Message-ID: <53BDEE96.10303@cn.fujitsu.com> (raw)
In-Reply-To: <21437.52514.486908.472983@mariner.uk.xensource.com>
Hi Ian,
Thank you for the reply, I have some comments below...
On 07/10/2014 07:15 AM, Ian Jackson wrote:
> Hongyang Yang writes ("Re: [PATCH v10 4/5] remus: implement remus network buffering for nic devices"):
>> Sorry for the late reply, just notice this comment...
>
> And here I am being even later replying...
>
>> On 06/06/2014 01:24 AM, Ian Jackson wrote:
>>> As far as I can see this attempts to search for an ifb which is not in
>>> use.
>>>
>>> I see you claim a lock to ensure that you don't fail due to races with
>>> other copies of this script.
>>>
>>> But are there potentially other things (not Xen related, parhaps) in
>>> the system which might try to allocate an ifb using a similar
>>> approach ? How do we deal with the potential race with them ?
>
> Have I missed an answer to this question ?
>
>>> Also: I think you should:
>>> - write the IFB name to xenstore _before_ starting to configure it
>>> - in the loop I quote above, check in xenstore that the ifb is not
>>> in use by another domain
Sorry for mention this explicit,your comment here has already been addressed:
+#return 0 if the ifb is free
+check_ifb() {
+ local installed=`nl-qdisc-list -d $1`
+ [ -n "$installed" ] && return 1
+
+ for domid in `xenstore-list "/local/domain" 2>/dev/null || true`
+ do
+ [ $domid -eq 0 ] && continue
+ xenstore-exists "/libxl/$domid/remus/netbuf" || continue
+ for devid in `xenstore-list "/libxl/$domid/remus/netbuf" 2>/dev/null ||
true`
+ do
+ local path="/libxl/$domid/remus/netbuf/$devid/ifb"
+ xenstore-exists $path || continue
+ local ifb=`xenstore-read "$path" 2>/dev/null || true`
+ [ "$ifb" = "$1" ] && return 1
+ done
+ done
+
+ return 0
+}
+
+setup_ifb() {
+
+ for ifb in `ifconfig -a -s|egrep ^ifb|cut -d ' ' -f1`
+ do
+ check_ifb "$ifb" || continue
+ IFB="$ifb"
+ break
+ done
+
+ if [ -z "$IFB" ]
+ then
+ fatal "Unable to find a free IFB device for $vifname"
+ fi
+
+ #not using xenstore_write that automatically exits on error
+ #because we need to cleanup
+ _xenstore_write "$XENBUS_PATH/ifb" "$IFB" || xs_write_failed "$vifname" "$IFB"
+ do_or_die ip link set dev "$IFB" up
+}
>>>
>>> Otherwise there seems to be the following risk:
>>> 1. You pick ifbX using the loop above
>>> 2. You start to configure ifbX, eventually resulting in a
>>> configuration which makes it not show up as free
>>> 3. Something bad happens and you fail, before writing the
>>> ifb name to xenstore
>>>
>>> In this case, the ifb would be leaked. (I see you do try to avoid
>>> this with xs_write_failed, but scripts can fail for other reasons.)
>>
>> If the setup failed for any reason, we will call teardown in the remus
>> device framework, so the ifb won't be leaked.
>
> I'm afraid that you can't assume that your script will necessarily
> execute the teardown. Perhaps the script got killed by the OOM
> killer, or something else horrible went wrong.
>
> So you need to make sure that all the states the system goes through,
> however briefly and no matter what cleanup will be attempted on
> failure.
>
>>>> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
>>>> index 4278a6b..50bf1ef 100644
>>>> --- a/tools/libxl/libxl_types.idl
>>>> +++ b/tools/libxl/libxl_types.idl
>>>> @@ -566,6 +566,8 @@ libxl_domain_remus_info = Struct("domain_remus_info",[
>>>> ("interval", integer),
>>>> ("blackhole", bool),
>>>> ("compression", bool),
>>>> + ("netbuf", bool),
>>>> + ("netbufscript", string),
>>>
>>> I think netbuf should be a defbool, not a bool. Indeed, perhaps this
>>> is true of the other options too. Is there some reason it shouldn't
>>> default to enabled ?
>>
>> The netbuffering is enabled by default, this option is used to disable
>> the netbuffering support.
>
> Maybe I haven't followed the code here correctly, but I think that has
> to be done with a defbool. Where is the default set ? I don't see it
> in this patch.
It was set in the main_remus function in netbuf command switch patch,
default is on, and will only be switched off when user passes an -n option,
so I think this does not need to be done with a defbool:
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 68df548..b324f34 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -7175,8 +7175,9 @@ int main_remus(int argc, char **argv)
r_info.interval = 200;
r_info.blackhole = 0;
r_info.compression = 1;
+ r_info.netbuf = 1;
- SWITCH_FOREACH_OPT(opt, "bui:s:e", NULL, "remus", 2) {
+ SWITCH_FOREACH_OPT(opt, "buni:s:N:e", NULL, "remus", 2) {
@@ -7186,6 +7187,12 @@ int main_remus(int argc, char **argv)
case 'u':
r_info.compression = 0;
break;
+ case 'n':
+ r_info.netbuf = 0;
+ break;
+ case 'N':
>
> Thanks,
> Ian.
> .
>
--
Thanks,
Yang.
next prev parent reply other threads:[~2014-07-10 1:38 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 1:34 [PATCH v10 0/5] Remus netbuffer: Network buffering support Yang Hongyang
2014-06-05 1:34 ` [PATCH v10 1/5] libxl: introduce asynchronous execution API Yang Hongyang
2014-06-05 16:01 ` Ian Jackson
2014-06-05 1:34 ` [PATCH v10 2/5] remus: add libnl3 dependency for network buffering support Yang Hongyang
2014-06-05 16:18 ` Ian Jackson
2014-06-06 1:48 ` Hongyang Yang
2014-06-06 6:45 ` Shriram Rajagopalan
2014-06-06 10:07 ` Ian Campbell
2014-06-06 11:04 ` Ian Jackson
2014-06-05 1:34 ` [PATCH v10 3/5] remus: introduce remus device Yang Hongyang
2014-06-05 17:06 ` Ian Jackson
2014-06-06 1:54 ` Hongyang Yang
2014-06-09 2:08 ` Hongyang Yang
2014-06-05 1:34 ` [PATCH v10 4/5] remus: implement remus network buffering for nic devices Yang Hongyang
2014-06-05 16:50 ` Shriram Rajagopalan
2014-06-05 17:37 ` Ian Jackson
2014-06-05 17:44 ` Ian Jackson
2014-06-05 17:56 ` Shriram Rajagopalan
2014-06-06 2:08 ` Hongyang Yang
2014-06-06 1:59 ` Hongyang Yang
2014-06-05 17:24 ` Ian Jackson
2014-06-10 7:33 ` Hongyang Yang
2014-07-09 23:15 ` Ian Jackson
2014-07-10 1:38 ` Hongyang Yang [this message]
2014-06-05 1:34 ` [PATCH v10 5/5] libxl: network buffering cmdline switch Yang Hongyang
2014-06-05 1:39 ` [PATCH v10] remus drbd: Implement remus drbd replicated disk Yang Hongyang
2014-06-05 16:25 ` Shriram Rajagopalan
2014-06-05 17:41 ` Ian Jackson
2014-06-05 18:14 ` Shriram Rajagopalan
2014-06-05 18:26 ` Ian Jackson
2014-06-06 11:23 ` Ian Jackson
2014-06-06 5:38 ` Hongyang Yang
2014-06-06 7:12 ` Shriram Rajagopalan
2014-06-06 11:18 ` Ian Jackson
2014-06-06 2:21 ` Hongyang Yang
2014-06-05 17:30 ` [PATCH v10 5/5] libxl: network buffering cmdline switch Ian Jackson
2014-06-06 6:34 ` Hongyang Yang
2014-06-06 7:26 ` Shriram Rajagopalan
2014-06-06 11:13 ` Ian Jackson
2014-06-05 10:47 ` [PATCH v10 0/5] Remus netbuffer: Network buffering support George Dunlap
2014-06-06 2:17 ` Hongyang Yang
2014-06-05 16:01 ` Ian Jackson
2014-06-05 16:12 ` Ian Jackson
2014-06-06 2:26 ` Hongyang Yang
-- strict thread matches above, loose matches on Subject: below --
2014-05-21 10:14 [PATCH v10 0/5] Remus/Libxl: " Yang Hongyang
2014-05-21 10:14 ` [PATCH v10 4/5] remus: implement remus network buffering for nic devices Yang Hongyang
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=53BDEE96.10303@cn.fujitsu.com \
--to=yanghy@cn.fujitsu.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=eddie.dong@intel.com \
--cc=ian.campbell@citrix.com \
--cc=laijs@cn.fujitsu.com \
--cc=roger.pau@citrix.com \
--cc=rshriram@cs.ubc.ca \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wency@cn.fujitsu.com \
--cc=xen-devel@lists.xen.org \
--cc=yunhong.jiang@intel.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.