[Devel] [RFC rh7 v3] ve/vznetstat: Move VE networks statistics allocation into a commaon place

Vladimir Davydov vdavydov at parallels.com
Tue Jul 21 00:59:27 PDT 2015


On Mon, Jul 20, 2015 at 11:53:57PM +0300, Cyrill Gorcunov wrote:
> We have three modules serving network statictics:
> 
>  - vznetstat.ko
>  - ip_vznetstat.ko
>  - ip6_vznetstat.ko
> 
> where ip6_vznetstat depends on ip_vznetstat and both depends on general vznetstat
> module. While vznetstat does are real work on network packets counting the
> counters are allocated in somehow nontrivial way
> 
>  1) ip_vznetstat depends on ip6_vznetstat, and both require vznetstat module
>  2) when ip_vznetstat loads it walks over all existing VE and allocates counters
>     setting up a ve-startup hook to allocate counters for VE which will be
>     started after
>  3) in turn ip6_vznetstat module doesn't depend on ip_vznetstat (which does
>     a real counters allocations, in commit 3ad7b9565dc63734 we fixed
>     ip6_vznetstat so it allocates counters for newly created VEs if
>     former ip_vznetstat get unloaded, but this doesn't take existing
>     VEs into account)
> 
> This makes counters allocation code really hard to read. Lets do their
> allocation in a different way
> 
>  - move counters allocation into general vznetstat module, upon its
>    load it does:
> 
>    * walk over all existing running VEs and allocate/get counters
>    * setup VE start/stop hooks to allocate/get counters for further
>      VEs which be started after the module load
> 
>  - drop counters allocation from both ip6_vznetstat and ip_vznetstat,
>    these modules simply register netfilter hooks for incoming/outgoing
>    traffic and count packets
> 
>  - drop ip_vznetstat dependency on ip6_vznetstat, they are not bound
>    anymore and each simply depends on general vznetstat module which
>    allocates counters for them
> 
> https://jira.sw.ru/browse/PSBM-35011
> 
> v2:
>  - don't forget to assign newly created counters into VEs
> 
> v3:
>  - switch to per-net operaions: instead of using start/stop
>    hooks we simply register net init/exit hooks which either
>    create/get or put/destroy the statistics. Note there is
>    no longer module-get/put, we rely on net namespace
>    synchronization, thus one can call rmmod over all
>    modules mentioned above even with running VEs.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
> CC: Andrey Vagin <avagin at virtuozzo.com>
> CC: Vladimir Davydov <vdavydov at virtuozzo.com>
> CC: Konstantin Khorenko <khorenko at virtuozzo.com>
> CC: Pavel Emelyanov <xemul at virtuozzo.com>
> CC: Igor Sukhih <igor at parallels.com>

Reviewed-by: Vladimir Davydov <vdavydov at parallels.com>



More information about the Devel mailing list