Thread (5 messages) flat view 5 messages, 3 authors, 2021-05-12

Re: [PATCH][v3] rtnetlink: add rtnl_lock debug log

From: Rocco.Yue <hidden>
Date: 2021-05-12 08:41:45
Also in: linux-mediatek

On Tue, 2021-05-11 at 10:00 -0700, Cong Wang wrote:
On Tue, May 11, 2021 at 4:46 AM Rocco yue [off-list ref] wrote:
quoted
From: Rocco Yue <redacted>

We often encounter system hangs caused by certain process
holding rtnl_lock for a long time. Even if there is a lock
detection mechanism in Linux, it is a bit troublesome and
affects the system performance. We hope to add a lightweight
debugging mechanism for detecting rtnl_lock.
Any reason why this is specific to RTNL lock? To me holding
a mutex lock for a long time is problematic for any mutex.
I have seen some fs mutex being held for a long time caused
many hung tasks in the system.

Thanks.
Thank you for a good question.

It's a problem to hold rtnl_lock for a long time, and other locks are no
exception.

the reason for adding rtnl_lock debug log:

1.rtnl_lock is a widely used lock:

In my view, for some other mutex locks, such as "f2fs_stat_mutex" in the
fs/f2fs/debug.c , there are not many codes that use this lock, and the
module involved is relatively single.

But when we search for rtnl_lock in the entire Linux kernel, we will get
a lot of matching results. Obviously this lock is a widely used lock,
which makes it difficult for us to locate the problem. If we do not
enable CONFIG_DEBUG_LOCKDEP and CONFIG_PROVE_LOCKING, it is often
difficult for us to find out where went wrong.

2.codes that use rtnl_lock include some basic functions of networking:

There are many networking modules that use rtnl_lock, and some functions
that use rtnl_lock are infrastructure part, such as unregister_netdev(),
dev_ioctl(). Perhaps this can also explain to a certain extent the
importance of adding a lightweight debug mechanism for rtnl_lock. And
mediatek and our customer have benefited a lot from such log.


Hope above contents can answer your question.

Best Regards
Rocco

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help