Thread (7 messages) flat view 7 messages, 4 authors, 2019-11-12

Re: [PATCH] net: remove static inline from dev_put/dev_hold

From: Tony Lu <tonylu@linux.alibaba.com>
Date: 2019-11-12 09:48:14
Also in: lkml

On Mon, Nov 11, 2019 at 09:21:58AM -0800, Eric Dumazet wrote:

On 11/11/19 6:05 AM, Tony Lu wrote:
quoted
This patch removes static inline from dev_put/dev_hold in order to help
trace the pcpu_refcnt leak of net_device.

We have sufferred this kind of issue for several times during
manipulating NIC between different net namespaces. It prints this
log in dmesg:

  unregister_netdevice: waiting for eth0 to become free. Usage count = 1

However, it is hard to find out who called and leaked refcnt in time. It
only left the crime scene but few evidence. Once leaked, it is not
safe to fix it up on the running host. We can't trace dev_put/dev_hold
directly, for the functions are inlined and used wildly amoung modules.
And this issue is common, there are tens of patches fix net_device
refcnt leak for various causes.

To trace the refcnt manipulating, this patch removes static inline from
dev_put/dev_hold. We can use handy tools, such as eBPF with kprobe, to
find out who holds but forgets to put refcnt. This will not be called
frequently, so the overhead is limited.
This looks as a first step.
Yes, I used to want to give a flexible approach for people, and they
could choose tools what they want. And I already made a patch, putting a
pair tracepoints into dev_put()/dev_hold() to trace that. I will send it out
later.
But I would rather get a full set of scripts/debugging features,
instead of something that most people can not use right now.

Please share the whole thing.
Thanks.
Tony Lu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help