public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Rocco.Yue <rocco.yue@mediatek.com>
To: Cong Wang <xiyou.wangcong@gmail.com>, <linux-kernel@vger.kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	 <wsd_upstream@mediatek.com>
Subject: Re: [PATCH][v3] rtnetlink: add rtnl_lock debug log
Date: Wed, 12 May 2021 16:38:32 +0800	[thread overview]
Message-ID: <1620808712.30754.62.camel@mhfsdcap03> (raw)
In-Reply-To: <CAM_iQpVWSJ8BdRoLDX0MdiqmJn2dp+U9JM4mcfzRbVn4MZbzcg@mail.gmail.com>

On Tue, 2021-05-11 at 10:00 -0700, Cong Wang wrote:
> On Tue, May 11, 2021 at 4:46 AM Rocco yue <rocco.yue@mediatek.com> wrote:
> >
> > From: Rocco Yue <rocco.yue@mediatek.com>
> >
> > 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

  reply	other threads:[~2021-05-12  8:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 11:32 [PATCH][v3] rtnetlink: add rtnl_lock debug log Rocco yue
2021-05-11 17:00 ` Cong Wang
2021-05-12  8:38   ` Rocco.Yue [this message]
2021-05-12 16:15     ` Cong Wang
2021-05-12 15:39 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1620808712.30754.62.camel@mhfsdcap03 \
    --to=rocco.yue@mediatek.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=masahiroy@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=peterz@infradead.org \
    --cc=wsd_upstream@mediatek.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox