Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Sven Eckelmann
On Sunday 15 May 2016 23:26:32 Linus Lüssing wrote: [...] > Yes, it's not ar71xx like you have, it's x86-64/amd64 in a > VM. sizeof() actually tells me 144 bytes for a tg entry. And 56 > bytes for an orig-list entry (like I wrote before). Ah, sorry. I was doing something else when I received the m

[B.A.T.M.A.N.] [PATCH] batman-adv: Consolidate logging related functions

2016-05-15 Thread Sven Eckelmann
There are several places in batman-adv which provide logging related functions. These should be grouped together in the log.* files to make them easier to find. Reported-by: Markus Pargmann Signed-off-by: Sven Eckelmann --- v4: - remove linux/kernel.h v3: - introduce this patch --- net/batman

[B.A.T.M.A.N.] [PATCH next] batman-adv: Fix build against recent Debian Stretch kernels

2016-05-15 Thread Sven Eckelmann
The kernels for Debian stretch require some special CFLAGS settings which are only correctly defined when NOSTDINC_FLAGS is defined inside the execution of the Makefile via kbuild. But batman-adv sets it currently outside to insert compatibility include headers and compat-sources. This can be avoi

Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Linus Lüssing
On Sun, May 15, 2016 at 10:50:20PM +0200, Sven Eckelmann wrote: > Hm, looks like the the biggest difference is in kmalloc-64. So this would > mean > that the kmalloc version uses 64 byte entries for tg entries. And the > batadv_tt_global_cache version uses 192 bytes (so it has an even larger >

Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Sven Eckelmann
On Sunday 15 May 2016 14:41:38 Linus Lüssing wrote: > On Sun, May 15, 2016 at 02:06:26PM +0200, Linus Lüssing wrote: > > Ok, yes, that's what I had looked at yesterday, too. > > Btw., these were the results from slabinfo I got yesterday. The > first one before applying the patches, the second one

[B.A.T.M.A.N.] pull request [net]: batman-adv 20160515

2016-05-15 Thread Antonio Quartulli
Hello David, although we are extremely late in the release cycle we have 4 fixes which would really be worth merging before releasing linux-4.6. As you can read in the git tag below, each of them can lead to a kernel crash or to an unstable system. We came up with several fixes after having test

[B.A.T.M.A.N.] [PATCH 1/4] batman-adv: fix skb deref after free

2016-05-15 Thread Antonio Quartulli
From: Florian Westphal batadv_send_skb_to_orig() calls dev_queue_xmit() so we can't use skb->len. Fixes: 953324776d6d ("batman-adv: network coding - buffer unicast packets before forward") Signed-off-by: Florian Westphal Reviewed-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by:

[B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Fix refcnt leak in batadv_v_neigh_*

2016-05-15 Thread Antonio Quartulli
From: Sven Eckelmann The functions batadv_neigh_ifinfo_get increase the reference counter of the batadv_neigh_ifinfo. These have to be reduced again when the reference is not used anymore to correctly free the objects. Fixes: 9786906022eb ("batman-adv: B.A.T.M.A.N. V - implement neighbor compar

[B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Fix double neigh_node_put in batadv_v_ogm_route_update

2016-05-15 Thread Antonio Quartulli
From: Sven Eckelmann The router is put down twice when it was non-NULL and either orig_ifinfo is NULL afterwards or batman-adv receives a packet with the same sequence number. This will end up in a use-after-free when the batadv_neigh_node is removed because the reference counter ended up too ear

[B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Avoid nullptr derefence in batadv_v_neigh_is_sob

2016-05-15 Thread Antonio Quartulli
From: Sven Eckelmann batadv_neigh_ifinfo_get can return NULL when it cannot find (even when only temporarily) anymore the neigh_ifinfo in the list neigh->ifinfo_list. This has to be checked to avoid kernel Oopses when the ifinfo is dereferenced. This a situation which isn't expected but is alrea

Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Sven Eckelmann
On Sunday 15 May 2016 14:37:33 Linus Lüssing wrote: > On Sun, May 15, 2016 at 02:15:01PM +0200, Sven Eckelmann wrote: > > On Sunday 15 May 2016 14:06:26 Linus Lüssing wrote: > > [...] > > > > > [0] > > > https://git.open-mesh.org/batman-adv.git/shortlog/refs/heads/linus/kmem- > > > cac > > > he >

Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Linus Lüssing
On Sun, May 15, 2016 at 02:06:26PM +0200, Linus Lüssing wrote: > Ok, yes, that's what I had looked at yesterday, too. Btw., these were the results from slabinfo I got yesterday. The first one before applying the patches, the second one after: http://metameute.de/~tux/batman-adv/slablog/before/ ht

Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Linus Lüssing
On Sun, May 15, 2016 at 02:15:01PM +0200, Sven Eckelmann wrote: > On Sunday 15 May 2016 14:06:26 Linus Lüssing wrote: > [...] > > [0] > > https://git.open-mesh.org/batman-adv.git/shortlog/refs/heads/linus/kmem-cac > > he > > This patchset has a bad bug. It still uses kfree for tt_local objects >

Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Sven Eckelmann
On Sunday 15 May 2016 14:15:01 Sven Eckelmann wrote: > On Sunday 15 May 2016 14:06:26 Linus Lüssing wrote: > [...] > > > [0] > > https://git.open-mesh.org/batman-adv.git/shortlog/refs/heads/linus/kmem-ca > > c > > he > > This patchset has a bad bug. It still uses kfree for tt_local objects > allo

Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Sven Eckelmann
On Sunday 15 May 2016 14:06:26 Linus Lüssing wrote: [...] > [0] > https://git.open-mesh.org/batman-adv.git/shortlog/refs/heads/linus/kmem-cac > he This patchset has a bad bug. It still uses kfree for tt_local objects allocated via kmem_cache_(z)alloc. Kind regards, Sven signature.asc De

Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Linus Lüssing
On Sun, May 15, 2016 at 01:27:39PM +0200, Sven Eckelmann wrote: > On Saturday 14 May 2016 16:51:29 Linus Lüssing wrote: > > Hi, > > > > Is anyone familiar with the implications of using kmalloc() vs. > > kmem_cache_alloc()? Not just allocation speed, but also RAM > > fragmentation is something I'm

Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?

2016-05-15 Thread Sven Eckelmann
On Saturday 14 May 2016 16:51:29 Linus Lüssing wrote: > Hi, > > Is anyone familiar with the implications of using kmalloc() vs. > kmem_cache_alloc()? Not just allocation speed, but also RAM > fragmentation is something I'm currently wondering about. Yes, it should reduce the effects of allocating

[B.A.T.M.A.N.] [RFC] batman-adv: use kmem_cache for translation table

2016-05-15 Thread Sven Eckelmann
The two translation tables (global, local) contain equally sized objects. The global translation table changes often when a client is connected/removed from the mesh. So it makes sense to keep a cache of the equally sized objects. TODO statistics, batadv_tt_roam_node?, batadv_tt_change_node?, bata

[B.A.T.M.A.N.] [PATCH v3 3/6] batman-adv: split tvlv into a separate file

2016-05-15 Thread Sven Eckelmann
From: Markus Pargmann The tvlv functionality in main.c is mostly unrelated to the rest of the content. It still takes up a large portion of this source file (~45%, 588 lines). Moving it to a separate file makes it better visible as a main component of the batman-adv implementation and hides it le

[B.A.T.M.A.N.] [PATCH v3 5/6] batman-adv: Consolidate logging related functions

2016-05-15 Thread Sven Eckelmann
There are several places in batman-adv which provide logging related functions. These should be grouped together in the log.* files to make them easier to find. Reported-by: Markus Pargmann Signed-off-by: Sven Eckelmann --- v3: - introduce this patch --- net/batman-adv/Makefile

[B.A.T.M.A.N.] [PATCH v3 6/6] batman-adv: Fix bat_(iv|v) function declaration header

2016-05-15 Thread Sven Eckelmann
The bat_algo.h had some functions declared which were not part of the bat_algo.c file. These are instead stored in bat_v.c and bat_iv_ogm.c. The declaration should therefore be also in bat_v.h and bat_iv_ogm,h to make them easier to find. Signed-off-by: Sven Eckelmann --- v3: - introduce this pa

[B.A.T.M.A.N.] [PATCH v3 1/6] batman-adv: Include main.h in all files

2016-05-15 Thread Sven Eckelmann
main.h includes statements which (re)define preprocessor variables which influence the compiled code. This makes it necessary to include it in all files. For example, it redefines pr_fmt used to the module as prefix for each pr_* message. Reported-by: Antonio Quartulli Signed-off-by: Sven Eckelma

[B.A.T.M.A.N.] [PATCH v3 2/6] batman-adv: Keep includes ordered by filename

2016-05-15 Thread Sven Eckelmann
It is easier to detect if a include is already there for a used functionality when the includes are ordered. Using an alphabetic order together with the grouping in commit 7df620092727 ("batman-adv: Add required includes to all files") makes includes better manageable. Signed-off-by: Sven Eckelman

[B.A.T.M.A.N.] [PATCH v3 4/6] batman-adv: move bat_algo functions into a separate file

2016-05-15 Thread Sven Eckelmann
The bat_algo functionality in main.c is mostly unrelated to the rest of the content. It still takes up a large portion of this source file (~15%, 103 lines). Moving it to a separate file makes it better visible as a main component of the batman-adv implementation and hides it less in the other help

Re: [B.A.T.M.A.N.] [PATCH 1/7] batman-adv: remove useless inline attribute for sysfs helper function

2016-05-15 Thread Sven Eckelmann
On Sunday 08 May 2016 18:59:56 Sven Eckelmann wrote: [] > Now you can for example run the build tests and receive the mail: > > REMOTE=/home/sven/tmp/qemu-batman/batman-adv TO=sven ./checkstuff.sh The repo was updated to support the multicast patches. I've also introduced other helper code