* [PATCH net] veth: Free queues on link delete
@ 2018-08-14 22:36 dsahern
2018-08-15 0:37 ` Toshiaki Makita
2018-08-16 0:44 ` kbuild test robot
0 siblings, 2 replies; 4+ messages in thread
From: dsahern @ 2018-08-14 22:36 UTC (permalink / raw)
To: netdev; +Cc: davem, makita.toshiaki, David Ahern
From: David Ahern <dsahern@gmail.com>
kmemleak reported new suspected memory leaks.
$ cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff880130b6ec00 (size 1024):
comm "ip", pid 916, jiffies 4296194668 (age 7251.672s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000001ed37cc9>] kmemleak_alloc+0x70/0x94
[<00000000646dfdeb>] slab_post_alloc_hook+0x42/0x52
[<0000000004aba61b>] __kmalloc+0x101/0x142
[<0000000054d50e21>] kmalloc_array.constprop.20+0x1e/0x26 [veth]
[<000000008238855a>] veth_newlink+0x147/0x3ac [veth]
...
The allocation in question is veth_alloc_queues.
Free the queues on a delete.
Fixes: 638264dc90227 ("veth: Support per queue XDP ring")
Signed-off-by: David Ahern <dsahern@gmail.com>
---
drivers/net/veth.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index e3202af72df5..bef7d212f04e 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1205,6 +1205,7 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
struct veth_priv *priv;
struct net_device *peer;
+ veth_free_queues(dev);
priv = netdev_priv(dev);
peer = rtnl_dereference(priv->peer);
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] veth: Free queues on link delete
2018-08-14 22:36 [PATCH net] veth: Free queues on link delete dsahern
@ 2018-08-15 0:37 ` Toshiaki Makita
2018-08-15 0:47 ` David Ahern
2018-08-16 0:44 ` kbuild test robot
1 sibling, 1 reply; 4+ messages in thread
From: Toshiaki Makita @ 2018-08-15 0:37 UTC (permalink / raw)
To: dsahern, netdev; +Cc: davem, David Ahern
On 2018/08/15 7:36, dsahern@kernel.org wrote:
> From: David Ahern <dsahern@gmail.com>
>
> kmemleak reported new suspected memory leaks.
> $ cat /sys/kernel/debug/kmemleak
> unreferenced object 0xffff880130b6ec00 (size 1024):
> comm "ip", pid 916, jiffies 4296194668 (age 7251.672s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<000000001ed37cc9>] kmemleak_alloc+0x70/0x94
> [<00000000646dfdeb>] slab_post_alloc_hook+0x42/0x52
> [<0000000004aba61b>] __kmalloc+0x101/0x142
> [<0000000054d50e21>] kmalloc_array.constprop.20+0x1e/0x26 [veth]
> [<000000008238855a>] veth_newlink+0x147/0x3ac [veth]
> ...
>
> The allocation in question is veth_alloc_queues.
>
> Free the queues on a delete.
Oops, thanks for catching this.
> Fixes: 638264dc90227 ("veth: Support per queue XDP ring")
> Signed-off-by: David Ahern <dsahern@gmail.com>
> ---
> drivers/net/veth.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index e3202af72df5..bef7d212f04e 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -1205,6 +1205,7 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
> struct veth_priv *priv;
> struct net_device *peer;
>
> + veth_free_queues(dev);
> priv = netdev_priv(dev);
> peer = rtnl_dereference(priv->peer);
We need to free up peer queues as well.
Also isn't this for net-next though it is now closed?
--
Toshiaki Makita
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] veth: Free queues on link delete
2018-08-15 0:37 ` Toshiaki Makita
@ 2018-08-15 0:47 ` David Ahern
0 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2018-08-15 0:47 UTC (permalink / raw)
To: Toshiaki Makita, dsahern, netdev; +Cc: davem
On 8/14/18 6:37 PM, Toshiaki Makita wrote:
> On 2018/08/15 7:36, dsahern@kernel.org wrote:
>> From: David Ahern <dsahern@gmail.com>
>>
>> kmemleak reported new suspected memory leaks.
>> $ cat /sys/kernel/debug/kmemleak
>> unreferenced object 0xffff880130b6ec00 (size 1024):
>> comm "ip", pid 916, jiffies 4296194668 (age 7251.672s)
>> hex dump (first 32 bytes):
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
>> backtrace:
>> [<000000001ed37cc9>] kmemleak_alloc+0x70/0x94
>> [<00000000646dfdeb>] slab_post_alloc_hook+0x42/0x52
>> [<0000000004aba61b>] __kmalloc+0x101/0x142
>> [<0000000054d50e21>] kmalloc_array.constprop.20+0x1e/0x26 [veth]
>> [<000000008238855a>] veth_newlink+0x147/0x3ac [veth]
>> ...
>>
>> The allocation in question is veth_alloc_queues.
>>
>> Free the queues on a delete.
>
> Oops, thanks for catching this.
>
>> Fixes: 638264dc90227 ("veth: Support per queue XDP ring")
>> Signed-off-by: David Ahern <dsahern@gmail.com>
>> ---
>> drivers/net/veth.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
>> index e3202af72df5..bef7d212f04e 100644
>> --- a/drivers/net/veth.c
>> +++ b/drivers/net/veth.c
>> @@ -1205,6 +1205,7 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
>> struct veth_priv *priv;
>> struct net_device *peer;
>>
>> + veth_free_queues(dev);
>> priv = netdev_priv(dev);
>> peer = rtnl_dereference(priv->peer);
>
> We need to free up peer queues as well.
missed that. Odd that kmemleak was not complaining.
> Also isn't this for net-next though it is now closed?
>
yes. was not sure if net-next is now net.
will send a v2.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] veth: Free queues on link delete
2018-08-14 22:36 [PATCH net] veth: Free queues on link delete dsahern
2018-08-15 0:37 ` Toshiaki Makita
@ 2018-08-16 0:44 ` kbuild test robot
1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2018-08-16 0:44 UTC (permalink / raw)
To: dsahern; +Cc: kbuild-all, netdev, davem, makita.toshiaki, David Ahern
[-- Attachment #1: Type: text/plain, Size: 1734 bytes --]
Hi David,
I love your patch! Yet something to improve:
[auto build test ERROR on net/master]
url: https://github.com/0day-ci/linux/commits/dsahern-kernel-org/veth-Free-queues-on-link-delete/20180816-073955
config: i386-randconfig-x016-201832 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers//net/veth.c: In function 'veth_dellink':
>> drivers//net/veth.c:476:2: error: implicit declaration of function 'veth_free_queues'; did you mean 'veth_dev_free'? [-Werror=implicit-function-declaration]
veth_free_queues(dev);
^~~~~~~~~~~~~~~~
veth_dev_free
cc1: some warnings being treated as errors
vim +476 drivers//net/veth.c
470
471 static void veth_dellink(struct net_device *dev, struct list_head *head)
472 {
473 struct veth_priv *priv;
474 struct net_device *peer;
475
> 476 veth_free_queues(dev);
477 priv = netdev_priv(dev);
478 peer = rtnl_dereference(priv->peer);
479
480 /* Note : dellink() is called from default_device_exit_batch(),
481 * before a rcu_synchronize() point. The devices are guaranteed
482 * not being freed before one RCU grace period.
483 */
484 RCU_INIT_POINTER(priv->peer, NULL);
485 unregister_netdevice_queue(dev, head);
486
487 if (peer) {
488 priv = netdev_priv(peer);
489 RCU_INIT_POINTER(priv->peer, NULL);
490 unregister_netdevice_queue(peer, head);
491 }
492 }
493
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34697 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-16 3:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-14 22:36 [PATCH net] veth: Free queues on link delete dsahern
2018-08-15 0:37 ` Toshiaki Makita
2018-08-15 0:47 ` David Ahern
2018-08-16 0:44 ` kbuild test robot
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.