Re: [PATCH v19 10/40] dept: apply sdt_might_sleep_{start, end}() to wait_for_completion()/complete()

[email protected]
Newsgroups org.kernel.vger.linux-modules,dev.linux.lists.linux-rt-devel,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-ide,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The `init_completion_map()` macro ignores the provided lockdep map argument `m` and sets `dmap` to `NULL`. This forces all generic wrappers like `flush_work()` to share a single, monolithic dependency class generated at the `wait_for_completion` macro call site.
--

commit c25e7af1e00aa68cd5900db21d080eadb8fccd71
Author: Byungchul Park <[email protected]>

dept: apply sdt_might_sleep_{start,end}() to wait_for_completion()/complete()

This commit enables the DEPT (Dependency Tracker) to track dependencies
introduced by wait_for_completion() and complete() calls. It adds a
dept_map to the completion structure and applies the appropriate sleep
start and end annotations.

> diff --git a/include/linux/completion.h b/include/linux/completion.h
> index fb29156765743..bd2c207481d68 100644
> --- a/include/linux/completion.h
> +++ b/include/linux/completion.h
[ ... ]
> @@ -26,14 +27,33 @@
>  struct completion {
>  	unsigned int done;
>  	struct swait_queue_head wait;
> +	struct dept_map dmap;
>  };
>  
> +#define init_completion(x)				\
> +do {							\
> +	sdt_map_init(&(x)->dmap);			\
> +	__init_completion(x);				\
> +} while (0)
> +
> +/*
> + * XXX: No use cases for now. Fill the body when needed.
> + */
>  #define init_completion_map(x, m) init_completion(x)

[Severity: High]
Does this macro cause independent dependency graphs to merge? By ignoring the
lockdep map argument m and calling init_completion(x) instead, it seems
generic wrappers like flush_work() will be forced to share a single
monolithic dependency class generated at the wait site.

Could this lead DEPT to report false-positive deadlocks during normal
operations? For example, if Work A flushes Work B, and Work B flushes
Work C, both use the same flush_work() completion class. DEPT might see
Work B both waiting on and satisfying this global class, erroneously
detecting a self-cycle.

> -static inline void complete_acquire(struct completion *x) {}
> -static inline void complete_release(struct completion *x) {}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.