mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Waiman Long <longman@redhat.com>,
	Joel Granados <joel.granados@kernel.org>,
	Anna Schumaker <anna.schumaker@oracle.com>,
	Lance Yang <ioworker0@gmail.com>,
	Kent Overstreet <kent.overstreet@linux.dev>,
	Yongliang Gao <leonylgao@tencent.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Tomasz Figa <tfiga@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] hung_task: Dump blocker task if it is not hung
Date: Thu, 31 Jul 2025 14:58:39 +0900	[thread overview]
Message-ID: <20250731145839.5a27175ebf16e249619fea0d@kernel.org> (raw)
In-Reply-To: <reyd4bppb5tfon7gtqaelwknvptdeyhrsh5ijbcj77ezini3yq@ivkgxmiqzk3x>

On Thu, 31 Jul 2025 11:53:51 +0900
Sergey Senozhatsky <senozhatsky@chromium.org> wrote:

> On (25/07/31 07:11), Masami Hiramatsu (Google) wrote:
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > 
> > Dump the lock blocker task if it is not hung because if the blocker
> > task is also hung, it should be dumped by the detector. This will
> > de-duplicate the same stackdumps if the blocker task is also blocked
> > by another task (and hung).
> > 
> > Suggested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > Acked-by: Lance Yang <lance.yang@linux.dev>
> 
> Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> 

Thank you for testing!

> 
> Wrote a simple 3 tasks circular lock test (same that I had in real
> life).  The output looks good:

OK, it works nicely. We'll better to have a similar test (but
with maximum warning message because it can crash the kernel.)

Thank you,

> 
> [   90.985431] [    T140] INFO: task T1:525 blocked for more than 30 seconds.
> [   90.990981] [    T140]       Not tainted 6.16.0-next-20250730-00003-g5865c79d6085-dirty #261
> [   90.996912] [    T140] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [   91.001617] [    T140] task:T1              state:D stack:0     pid:525   tgid:525   ppid:2      task_flags:0x208040 flags:0x00004000
> [   91.007564] [    T140] Call Trace:
> [   91.008767] [    T140]  <TASK>
> [   91.009872] [    T140]  __schedule+0x137f/0x20c0
> [   91.011606] [    T140]  schedule+0xdc/0x280
> [   91.013115] [    T140]  schedule_preempt_disabled+0x10/0x20
> [   91.015200] [    T140]  __mutex_lock+0x721/0x1590
> [   91.016817] [    T140]  ? __mutex_lock+0x500/0x1590
> [   91.018074] [    T140]  mutex_lock+0x81/0x90
> [   91.019169] [    T140]  t1+0x62/0x70
> [   91.020061] [    T140]  kthread+0x583/0x6e0
> [   91.021140] [    T140]  ? drop_caches_sysctl_handler+0x130/0x130
> [   91.022729] [    T140]  ? kthread_blkcg+0xa0/0xa0
> [   91.023921] [    T140]  ret_from_fork+0xc8/0x160
> [   91.025091] [    T140]  ? kthread_blkcg+0xa0/0xa0
> [   91.026309] [    T140]  ret_from_fork_asm+0x11/0x20
> [   91.027577] [    T140]  </TASK>
> [   91.028326] [    T140] INFO: task T1:525 is blocked on a mutex likely owned by task T2:526.
> [   91.030404] [    T140] INFO: task T2:526 blocked for more than 30 seconds.
> [   91.031978] [    T140]       Not tainted 6.16.0-next-20250730-00003-g5865c79d6085-dirty #261
> [   91.034069] [    T140] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [   91.036215] [    T140] task:T2              state:D stack:0     pid:526   tgid:526   ppid:2      task_flags:0x208040 flags:0x00004000
> [   91.039233] [    T140] Call Trace:
> [   91.040084] [    T140]  <TASK>
> [   91.040810] [    T140]  __schedule+0x137f/0x20c0
> [   91.041954] [    T140]  schedule+0xdc/0x280
> [   91.042984] [    T140]  schedule_preempt_disabled+0x10/0x20
> [   91.044329] [    T140]  __mutex_lock+0x721/0x1590
> [   91.045464] [    T140]  ? __mutex_lock+0x500/0x1590
> [   91.046624] [    T140]  mutex_lock+0x81/0x90
> [   91.047632] [    T140]  t2+0x69/0x70
> [   91.048473] [    T140]  kthread+0x583/0x6e0
> [   91.049453] [    T140]  ? drop_pagecache_sb+0x200/0x200
> [   91.050686] [    T140]  ? kthread_blkcg+0xa0/0xa0
> [   91.051808] [    T140]  ret_from_fork+0xc8/0x160
> [   91.052886] [    T140]  ? kthread_blkcg+0xa0/0xa0
> [   91.054036] [    T140]  ret_from_fork_asm+0x11/0x20
> [   91.055205] [    T140]  </TASK>
> [   91.056011] [    T140] INFO: task T2:526 is blocked on a mutex likely owned by task T3:527.
> [   91.058014] [    T140] INFO: task T3:527 blocked for more than 30 seconds.
> [   91.059682] [    T140]       Not tainted 6.16.0-next-20250730-00003-g5865c79d6085-dirty #261
> [   91.061708] [    T140] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [   91.063825] [    T140] task:T3              state:D stack:0     pid:527   tgid:527   ppid:2      task_flags:0x208040 flags:0x00004000
> [   91.066668] [    T140] Call Trace:
> [   91.067462] [    T140]  <TASK>
> [   91.068121] [    T140]  __schedule+0x137f/0x20c0
> [   91.069244] [    T140]  schedule+0xdc/0x280
> [   91.070264] [    T140]  schedule_preempt_disabled+0x10/0x20
> [   91.071723] [    T140]  __mutex_lock+0x721/0x1590
> [   91.072848] [    T140]  ? __mutex_lock+0x500/0x1590
> [   91.074032] [    T140]  mutex_lock+0x81/0x90
> [   91.075054] [    T140]  t3+0x23/0x30
> [   91.075932] [    T140]  kthread+0x583/0x6e0
> [   91.076953] [    T140]  ? t2+0x70/0x70
> [   91.077865] [    T140]  ? kthread_blkcg+0xa0/0xa0
> [   91.078974] [    T140]  ret_from_fork+0xc8/0x160
> [   91.080109] [    T140]  ? kthread_blkcg+0xa0/0xa0
> [   91.081250] [    T140]  ret_from_fork_asm+0x11/0x20
> [   91.082530] [    T140]  </TASK>
> [   91.083248] [    T140] INFO: task T3:527 is blocked on a mutex likely owned by task T1:525.


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

      parent reply	other threads:[~2025-07-31  5:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 22:11 Masami Hiramatsu (Google)
2025-07-31  2:53 ` Sergey Senozhatsky
2025-07-31  3:15   ` Lance Yang
2025-07-31  3:25     ` Lance Yang
2025-07-31  3:37       ` Sergey Senozhatsky
2025-07-31  4:45         ` Lance Yang
2025-07-31  5:58   ` Masami Hiramatsu [this message]

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=20250731145839.5a27175ebf16e249619fea0d@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=anna.schumaker@oracle.com \
    --cc=boqun.feng@gmail.com \
    --cc=ioworker0@gmail.com \
    --cc=joel.granados@kernel.org \
    --cc=kent.overstreet@linux.dev \
    --cc=leonylgao@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=will@kernel.org \
    /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

all inboxes | Powered by JetHome®