[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <27fa19c9-81b2-3604-033c-b7fe5d14b620@i-love.sakura.ne.jp>
Date: Fri, 30 Apr 2021 20:48:02 +0900
From: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
To: Rocco Yue <rocco.yue@...iatek.com>
Cc: Peter Enderborg <peter.enderborg@...y.com>,
Thomas Gleixner <tglx@...utronix.de>,
Anshuman Khandual <anshuman.khandual@....com>,
Vitor Massaru Iha <vitor@...saru.org>,
Sedat Dilek <sedat.dilek@...il.com>,
Wei Yang <richard.weiyang@...il.com>,
Cong Wang <cong.wang@...edance.com>,
Di Zhu <zhudi21@...wei.com>,
Stephen Hemminger <stephen@...workplumber.org>,
Francis Laniel <laniel_francis@...vacyrequired.com>,
Roopa Prabhu <roopa@...ulusnetworks.com>,
Andrii Nakryiko <andrii@...nel.org>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, wsd_upsream@...iatek.com,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
peterz@...radead.org
Subject: Re: [PATCH] rtnetlink: add rtnl_lock debug log
On 2021/04/29 16:02, Rocco Yue wrote:
> +static void rtnl_print_btrace(struct timer_list *unused)
> +{
> + pr_info("----------- %s start -----------\n", __func__);
> + pr_info("%s[%d][%c] hold rtnl_lock more than 2 sec, start time: %llu\n",
> + rtnl_instance.task->comm,
> + rtnl_instance.pid,
> + task_state_to_char(rtnl_instance.task),
> + rtnl_instance.start_time);
> + stack_trace_print(rtnl_instance.addrs, rtnl_instance.nr_entries, 0);
Do we want to print same traces every 2 seconds?
Since it is possible to stall for e.g. 30 seconds, printing either only upon
first call to rtnl_print_btrace() for each stalling duration or only upon
end of stalling duration (i.e. from rtnl_relase_btrace()) is better?
> + show_stack(rtnl_instance.task, NULL, KERN_DEBUG);
Why KERN_DEBUG ?
If you retrieve the output via dmesg, KERN_DEBUG would be fine.
But for syzkaller (which counts on printk() messages being printed to
consoles), KERN_INFO (or default) is expected.
> + pr_info("------------ %s end -----------\n", __func__);
> +}
> +
> +static void rtnl_relase_btrace(void)
> +{
> + rtnl_instance.end_time = sched_clock();
> +
You should del_timer_sync() here than
> + if (rtnl_instance.end_time - rtnl_instance.start_time > 2000000000ULL) {
> + pr_info("rtnl_lock is held by [%d] from [%llu] to [%llu]\n",
> + rtnl_instance.pid,
> + rtnl_instance.start_time,
> + rtnl_instance.end_time);
> + }
> +
> + del_timer(&rtnl_chk_timer);
here in order to make sure that end message is printed only after
rtnl_print_btrace() messages are printed.
> +}
> +#endif
> +
Powered by blists - more mailing lists