Linux Modules
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Byungchul Park" <byungchul@sk.com>
Cc: cassel@kernel.org, linux-rt-devel@lists.linux.dev,
	ojeda@kernel.org, linux-ide@vger.kernel.org, dlemoal@kernel.org,
	"Chuck Lever" <cel@kernel.org>,
	"Jeff Layton" <jlayton@kernel.org>,
	linux-modules@vger.kernel.org, "Anna Schumaker" <anna@kernel.org>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	tytso@mit.edu
Subject: Re: [PATCH v19 15/40] dept: track timeout waits separately with a new Kconfig
Date: Tue, 07 Jul 2026 07:33:31 +0000	[thread overview]
Message-ID: <20260707073331.B4C831F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260706061928.66713-16-byungchul@sk.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Semantic collision in the timeoutval argument causes 0-timeout try-waits to be incorrectly tracked as hard blocking dependencies.
- [High] Enabling CONFIG_DEPT_AGGRESSIVE_TIMEOUT_WAIT masks real deadlocks because a timeout wait permanently poisons the dependency edge, causing subsequent strict (non-timeout) waits to be ignored.
--

commit 1b06fc68b17e6c7948f8187e55952d1767e48762
Author: Byungchul Park <byungchul@sk.com>

dept: track timeout waits separately with a new Kconfig

This patch modifies DEPT to track timeout waits separately to avoid
reporting false positive deadlocks for deliberate timeouts. It also
introduces the CONFIG_DEPT_AGGRESSIVE_TIMEOUT_WAIT option to toggle this
tracking behavior.

> diff --git a/kernel/dependency/dept.c b/kernel/dependency/dept.c
> index 3af360ba17d8e..5ef85977e6314 100644
> --- a/kernel/dependency/dept.c
> +++ b/kernel/dependency/dept.c
[ ... ]
> @@ -810,6 +812,24 @@ static void print_dep(struct dept_dep *d)
>  
>  static void save_current_stack(int skip);
>  
> +static bool is_timeout_wait_circle(struct dept_class *c)
> +{
> +	struct dept_class *fc = c->bfs_parent;
> +	struct dept_class *tc = c;
> +
> +	do {
> +		struct dept_dep *d = lookup_dep(fc, tc);
> +
> +		if (d->wait->timeout)
> +			return true;

[Severity: High]
If CONFIG_DEPT_AGGRESSIVE_TIMEOUT_WAIT is enabled, does this mask genuine
deadlocks if a strict wait follows a timeout wait?

If a timeout wait between class A and class B occurs first, it creates a
dependency edge with wait->timeout set to true. If a strict (non-timeout)
wait subsequently occurs between the same classes, add_dep() finds the
existing edge and returns early:

kernel/dependency/dept.c:add_dep() {
        if (lookup_dep(fc, tc))
                return;
        ...
}

The edge is never upgraded to reflect the stricter dependency. 

If a deadlock later happens involving this edge, would is_timeout_wait_circle()
see the stale timeout flag and incorrectly report it as an intended circular
dependency instead of a genuine deadlock?

> +
> +		tc = fc;
> +		fc = fc->bfs_parent;
> +	} while (tc != c);
> +
> +	return false;
> +}
[ ... ]
> @@ -2355,14 +2381,23 @@ static void __dept_event(struct dept_map *m, struct dept_map *real_m,
>  }
>  
>  void dept_wait(struct dept_map *m, unsigned long w_f,
> -	       unsigned long ip, const char *w_fn, int sub_l)
> +	       unsigned long ip, const char *w_fn, int sub_l,
> +	       long timeoutval)
>  {
>  	struct dept_task *dt = dept_task();
>  	unsigned long flags;
> +	bool timeout;
>  
>  	if (unlikely(!dept_working()))
>  		return;
>  
> +	timeout = timeoutval > 0 && timeoutval < MAX_SCHEDULE_TIMEOUT;

[Severity: High]
Does this logic correctly handle try-waits or polling?

When a caller invokes a polling wait like wait_for_completion_timeout(x, 0),
the timeoutval is 0. Because 0 > 0 evaluates to false, this sets timeout to
false. DEPT then tracks this non-blocking poll as an indefinite hard wait.

Can this lead to false positive deadlock reports when no actual blocking
occurs?

> +
> +#if !defined(CONFIG_DEPT_AGGRESSIVE_TIMEOUT_WAIT)
> +	if (timeout)
> +		return;
> +#endif
> +
>  	if (dt->recursive)
>  		return;
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260706061928.66713-1-byungchul@sk.com?part=15

  reply	other threads:[~2026-07-07  7:33 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06  6:18 [PATCH v19 00/40] DEPT(DEPendency Tracker) Byungchul Park
2026-07-06  6:18 ` [PATCH v19 01/40] dept: implement " Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:18 ` [PATCH v19 02/40] dept: add single event dependency tracker APIs Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:18 ` [PATCH v19 03/40] dept: add lock " Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:18 ` [PATCH v19 04/40] dept: tie to lockdep and IRQ tracing Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:18 ` [PATCH v19 05/40] dept: add proc knobs to show stats and dependency graph Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:18 ` [PATCH v19 06/40] dept: distinguish each kernel context from another Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:18 ` [PATCH v19 07/40] dept: distinguish each work " Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:18 ` [PATCH v19 08/40] dept: add a mechanism to refill the internal memory pools on running out Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:18 ` [PATCH v19 09/40] dept: record the latest one out of consecutive waits of the same class Byungchul Park
2026-07-06  6:18 ` [PATCH v19 10/40] dept: apply sdt_might_sleep_{start,end}() to wait_for_completion()/complete() Byungchul Park
2026-07-07  7:33   ` [PATCH v19 10/40] dept: apply sdt_might_sleep_{start, end}() " sashiko-bot
2026-07-06  6:18 ` [PATCH v19 11/40] dept: apply sdt_might_sleep_{start,end}() to swait Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 12/40] dept: apply sdt_might_sleep_{start,end}() to waitqueue wait Byungchul Park
2026-07-07  7:33   ` [PATCH v19 12/40] dept: apply sdt_might_sleep_{start, end}() " sashiko-bot
2026-07-06  6:19 ` [PATCH v19 13/40] dept: apply sdt_might_sleep_{start,end}() to hashed-waitqueue wait Byungchul Park
2026-07-07  7:33   ` [PATCH v19 13/40] dept: apply sdt_might_sleep_{start, end}() " sashiko-bot
2026-07-06  6:19 ` [PATCH v19 14/40] dept: apply sdt_might_sleep_{start,end}() to dma fence Byungchul Park
2026-07-06  6:19 ` [PATCH v19 15/40] dept: track timeout waits separately with a new Kconfig Byungchul Park
2026-07-07  7:33   ` sashiko-bot [this message]
2026-07-06  6:19 ` [PATCH v19 16/40] dept: apply timeout consideration to wait_for_completion()/complete() Byungchul Park
2026-07-06  6:19 ` [PATCH v19 17/40] dept: apply timeout consideration to swait Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 18/40] dept: apply timeout consideration to waitqueue wait Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 19/40] dept: apply timeout consideration to hashed-waitqueue wait Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 20/40] dept: apply timeout consideration to dma fence wait Byungchul Park
2026-07-06  6:19 ` [PATCH v19 21/40] dept: make dept able to work with an external wgen Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 22/40] dept: track PG_locked with dept Byungchul Park
2026-07-06 18:05   ` Matthew Wilcox
2026-07-07  2:35     ` Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 23/40] dept: print staged wait's stacktrace on report Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 24/40] locking/lockdep: prevent various lockdep assertions when lockdep_off()'ed Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 25/40] dept: add documents for dept Byungchul Park
2026-07-06  6:19 ` [PATCH v19 26/40] cpu/hotplug: use a weaker annotation in AP thread Byungchul Park
2026-07-06  6:19 ` [PATCH v19 27/40] dept: assign dept map to mmu notifier invalidation synchronization Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 28/40] dept: assign unique dept_key to each distinct dma fence caller Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 29/40] dept: make dept aware of lockdep_set_lock_cmp_fn() annotation Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 30/40] dept: make dept stop from working on debug_locks_off() Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 31/40] dept: assign unique dept_key to each distinct wait_for_completion() caller Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 32/40] completion, dept: introduce init_completion_dmap() API Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 33/40] dept: call dept_hardirqs_off() in local_irq_*() regardless of irq state Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 34/40] rcu/update: fix same dept key collision between various types of RCU Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 35/40] dept: introduce APIs to set page usage and use subclasses_evt for the usage Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 36/40] dept: track PG_writeback with dept Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 37/40] SUNRPC: relocate struct rcu_head to the first field of struct rpc_xprt Byungchul Park
2026-07-06  6:19 ` [PATCH v19 38/40] mm: percpu: increase PERCPU_DYNAMIC_SIZE_SHIFT on DEPT and large PAGE_SIZE Byungchul Park
2026-07-07  7:33   ` sashiko-bot
2026-07-06  6:19 ` [PATCH v19 39/40] rust: completion: Add __rust_helper to rust_helper_wait_for_completion() Byungchul Park
2026-07-06  6:19 ` [PATCH v19 40/40] dept: implement a basic unit test for dept Byungchul Park
2026-07-07  7:33   ` sashiko-bot

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=20260707073331.B4C831F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anna@kernel.org \
    --cc=byungchul@sk.com \
    --cc=cassel@kernel.org \
    --cc=cel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jlayton@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tytso@mit.edu \
    /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