All of lore.kernel.org
 help / color / mirror / Atom feed
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: Tue, 10 Jun 2014 15:33:19 +0800	[thread overview]
Message-ID: <5396B4BF.2060209@cn.fujitsu.com> (raw)
In-Reply-To: <21392.42936.240674.451323@mariner.uk.xensource.com>

Hi Ian,

   Sorry for the late reply, just notice this comment...

On 06/06/2014 01:24 AM, Ian Jackson wrote:
> Yang Hongyang writes ("[PATCH v10 4/5] remus: implement remus network buffering for nic devices"):
>> 1.Add two members in libxl_domain_remus_info:
>
> Thanks for this patch.
>
> I'm deferring reviewing the parts of this inside libxl which use the
> new libxl device interface, until we have the API documentation
> comments which I discussed in my last email.  I hope that's OK.
>
> But there i
>
>>      netbuf: whether netbuf is enabled
>>      netbufscript: the path of the script which will be run to setup
>>         and tear down the guest's interface.
>> 2.introduces remus-netbuf-setup hotplug script responsible for
>>    setting up and tearing down the necessary infrastructure required for
>>    network output buffering in Remus.  This script is intended to be invoked
>>    by libxl for each guest interface, when starting or stopping Remus.
>>
>>    Apart from returning success/failure indication via the usual hotplug
>>    entries in xenstore, this script also writes to xenstore, the name of
>>    the IFB device to be used to control the vif's network output.
>>
>>    The script relies on libnl3 command line utilities to perform various
>>    setup/teardown functions. The script is confined to Linux platforms only
>>    since NetBSD does not seem to have libnl3.
>>
>>    The following steps are taken during init:
>>      a) establish a dedicated remus context containing libnl related
>>         state (netlink sockets, qdisc caches, etc.,)
>>
>>    The following steps are taken for each vif during setup:
>>      a) call the hotplug script to setup its network buffer
>>
>>      b) Obtain handles to plug qdiscs installed on the IFB devices
>>         chosen by the hotplug scripts.
>>
>>    And during teardown, the netlink resources are released, followed by
>>    invocation of hotplug scripts to remove the ifb devices.
>> 3.implement the remus device interface. setup, teardown, etc.
>>
>> Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
>> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
>> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
>> Reviewed-by: Wen Congyang <wency@cn.fujitsu.com>
>> ---
>>   docs/misc/xenstore-paths.markdown      |   4 +
>>   tools/hotplug/Linux/Makefile           |   1 +
>>   tools/hotplug/Linux/remus-netbuf-setup | 183 ++++++++++++
>>   tools/libxl/libxl.c                    |  18 ++
>>   tools/libxl/libxl.h                    |  13 +
>>   tools/libxl/libxl_internal.h           |   3 +
>>   tools/libxl/libxl_netbuffer.c          | 519 +++++++++++++++++++++++++++++++++
>>   tools/libxl/libxl_nonetbuffer.c        |  67 +++++
>>   tools/libxl/libxl_remus_device.c       |  22 +-
>>   tools/libxl/libxl_types.idl            |   2 +
>>   10 files changed, 831 insertions(+), 1 deletion(-)
>>   create mode 100644 tools/hotplug/Linux/remus-netbuf-setup
>>
>
>
>
>> diff --git a/docs/misc/xenstore-paths.markdown b/docs/misc/xenstore-paths.markdown
>> index 70ab7f4..039eaea 100644
>> --- a/docs/misc/xenstore-paths.markdown
>> +++ b/docs/misc/xenstore-paths.markdown
>> @@ -385,6 +385,10 @@ The guest's virtual time offset from UTC in seconds.
>>
>>   The device model version for a domain.
>>
>> +#### /libxl/$DOMID/remus/netbuf/$DEVID/ifb = STRING [n,INTERNAL]
>> +
>> +ifb device used by Remus to buffer network output from the associated vif.
>> +
>
> Thanks for updating the doc.  Your changes to the hotplug Makefile
> look good too.
>
>> diff --git a/tools/hotplug/Linux/remus-netbuf-setup b/tools/hotplug/Linux/remus-netbuf-setup
>> new file mode 100644
>> index 0000000..aed2583
>> --- /dev/null
>> +++ b/tools/hotplug/Linux/remus-netbuf-setup
>> @@ -0,0 +1,183 @@
>> +#!/bin/bash
>> +#============================================================================
>> +# ${XEN_SCRIPT_DIR}/remus-netbuf-setup
>> +#
>> +# Script for attaching a network buffer to the specified vif (in any mode).
>> +# The hotplugging system will call this script when starting remus via libxl
>> +# API, libxl_domain_remus_start.
>
> Right.  Thanks for the comprehensive head comment.
>
>> +#============================================================================
> ...
>> +setup_ifb() {
>> +
>> +    for ifb in `ifconfig -a -s|egrep ^ifb|cut -d ' ' -f1`
>> +    do
>> +        local installed=`nl-qdisc-list -d $ifb`
>> +        [ -n "$installed" ] && continue
>> +        IFB="$ifb"
>> +        break
>> +    done
>
> 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 ?
>
> 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
>
> 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.

>
>> +    do_or_die tc qdisc add dev "$vif" ingress
>
> I'm not qualified to review these tc manipulations.  I guess I'm going
> to trust that they're correct.
>
>> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
>> index 80947c3..db30a97 100644
>> --- a/tools/libxl/libxl.h
>> +++ b/tools/libxl/libxl.h
>> @@ -437,6 +437,19 @@
>>   #define LIBXL_HAVE_DRIVER_DOMAIN_CREATION 1
>>
>>   /*
>> + * LIBXL_HAVE_REMUS_NETBUF 1
>> + *
>> + * If this is defined, then the libxl_domain_remus_info structure will
>> + * have a boolean field (netbuf) and a string field (netbufscript).
>> + *
>> + * netbuf, if true, indicates that network buffering should be enabled.
>> + *
>> + * netbufscript, if set, indicates the path to the hotplug script to
>> + * setup or teardown network buffers.
>> + */
>> +#define LIBXL_HAVE_REMUS_NETBUF 1
>
> Good.
>
>> 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.

>
> You should mention in your commit message that this is going to be
> plumbed into xl and the documentation in the next patch.
>
> Regarding the other remus options here (and perhaps changing their
> types), I think it would be OK to break API compatibility, since the
> previous versions of remus exposed via xl have not been suitable for
> deployment.  Do you agree ?

Agree. Since I've done v11 patch series, I will look into it in the next
series. For rapid iteration, I will send v11 patch series for review in
a short period.

>
> Thanks,
> Ian.
> .
>

-- 
Thanks,
Yang.

  reply	other threads:[~2014-06-10  7:33 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 [this message]
2014-07-09 23:15       ` Ian Jackson
2014-07-10  1:38         ` Hongyang Yang
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=5396B4BF.2060209@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.