From: Byungchul Park <byungchul@sk.com>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: Guangbo Cui <2407018371@qq.com>,
Liam.Howlett@oracle.com, amir73il@gmail.com,
andi.shyti@kernel.org, andrii@kernel.org, bsegall@google.com,
gregkh@linuxfoundation.org, linaro-mm-sig@lists.linaro.org,
link@vivo.com, linux-kernel@vger.kernel.org,
mark.rutland@arm.com, masahiroy@kernel.org,
mathieu.desnoyers@efficios.com, matthew.brost@intel.com,
max.byungchul.park@gmail.com, mcgrof@kernel.org,
melissa.srw@gmail.com, mgorman@suse.de, mhocko@kernel.org,
minchan@kernel.org, oleg@redhat.com, paulmck@kernel.org,
penberg@kernel.org, peterz@infradead.org, petr.pavlu@suse.com,
torvalds@linux-foundation.org, vincent.guittot@linaro.org,
will@kernel.org, yeoreum.yun@arm.com, ysk@kzalloc.com,
rust-for-linux@vger.kernel.org, ojeda@kernel.org,
gary@garyguo.net, lossin@kernel.org, a.hindborg@kernel.org,
aliceryhl@google.com, dakr@kernel.org, alex.gaynor@gmail.com,
bjorn3_gh@protonmail.com, kernel_team@skhynix.com
Subject: Re: [PATCH] rust: bindings: add `rust_helper_wait_for_completion` helper function
Date: Thu, 13 Nov 2025 11:02:36 +0900 [thread overview]
Message-ID: <20251113020236.GA36724@system.software.com> (raw)
In-Reply-To: <20251113012036.GA75428@system.software.com>
On Thu, Nov 13, 2025 at 10:20:36AM +0900, Byungchul Park wrote:
> On Thu, Oct 02, 2025 at 10:27:51AM -0700, Boqun Feng wrote:
> > On Thu, Oct 02, 2025 at 10:06:17AM +0000, Guangbo Cui wrote:
> > > > -extern void wait_for_completion(struct completion *);
> > > > -extern void wait_for_completion_io(struct completion *);
> > > > -extern int wait_for_completion_interruptible(struct completion *x);
> > > > -extern int wait_for_completion_killable(struct completion *x);
> > > > -extern int wait_for_completion_state(struct completion *x, unsigned int state);
> > > > -extern unsigned long wait_for_completion_timeout(struct completion *x,
> > > > +extern void __wait_for_completion(struct completion *);
> > > > +extern void __wait_for_completion_io(struct completion *);
> > > > +extern int __wait_for_completion_interruptible(struct completion *x);
> > > > +extern int __wait_for_completion_killable(struct completion *x);
> > > > +extern int __wait_for_completion_state(struct completion *x, unsigned int state);
> > > > +extern unsigned long __wait_for_completion_timeout(struct completion *x,
> > > > unsigned long timeout);
> > > > -extern unsigned long wait_for_completion_io_timeout(struct completion *x,
> > > > +extern unsigned long __wait_for_completion_io_timeout(struct completion *x,
> > > > unsigned long timeout);
> > > > -extern long wait_for_completion_interruptible_timeout(
> > > > +extern long __wait_for_completion_interruptible_timeout(
> > > > struct completion *x, unsigned long timeout);
> > > > -extern long wait_for_completion_killable_timeout(
> > > > +extern long __wait_for_completion_killable_timeout(
> > > > struct completion *x, unsigned long timeout);
> > > > extern bool try_wait_for_completion(struct completion *x);
> > > > extern bool completion_done(struct completion *x);
> > > > @@ -139,4 +134,79 @@ extern void complete(struct completion *);
> > > > extern void complete_on_current_cpu(struct completion *x);
> > > > extern void complete_all(struct completion *);
> > > >
> > > > +#define wait_for_completion(x) \
> > > > +({ \
> > > > + sdt_might_sleep_start_timeout(NULL, -1L); \
> > > > + __wait_for_completion(x); \
> > > > + sdt_might_sleep_end(); \
> > > > +})
> > >
> > > The DEPT patch series changed `wait_for_completion` into a macro.
> > > Because bindgen cannot handle function-like macros, this caused
> > > Rust build errors. Add a helper function to fix it.
> > >
> > > ```
> > > error[E0425]: cannot find function `wait_for_completion` in crate `bindings`
> > > --> rust/kernel/sync/completion.rs:110:28
> > > |
> > > 110 | unsafe { bindings::wait_for_completion(self.as_raw()) };
> > > | ^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `__wait_for_completion`
> > > |
> > > ::: /root/linux/rust/bindings/bindings_generated.rs:33440:5
> > > |
> > > 33440 | pub fn __wait_for_completion(arg1: *mut completion);
> > > | ---------------------------------------------------- similarly named function `__wait_for_completion` defined here
> > >
> > > error: aborting due to 1 previous error
> > >
> > > For more information about this error, try `rustc --explain E0425`.
> > > ```
> > >
> >
> > I think Danilo already made it clear, please fold this the existing
> > patch. Moreover, since this patchset doesn't adjust init_completion()
> > from the Rust side, the result is Rust code will also use the same dept
> > key for completion, which has to be fixed if dept wants to be in-tree.
>
> Thank you for informing that. I will take a look on it.
It looks not easy unless Rust side uses explicit maps for that purpose.
I think there are the same issues in 'lockdep + typical lock' too. How
does lockdep deal with the issue? Use explicit keys for that?
Byungchul
>
> Byungchul
> >
> > Regards,
> > Boqun
> >
> > > Signed-off-by: Guangbo Cui <2407018371@qq.com>
> > > ---
> > > rust/helpers/completion.c | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > >
> > > diff --git a/rust/helpers/completion.c b/rust/helpers/completion.c
> > > index b2443262a2ae..5bae5e749def 100644
> > > --- a/rust/helpers/completion.c
> > > +++ b/rust/helpers/completion.c
> > > @@ -6,3 +6,8 @@ void rust_helper_init_completion(struct completion *x)
> > > {
> > > init_completion(x);
> > > }
> > > +
> > > +void rust_helper_wait_for_completion(struct completion *x)
> > > +{
> > > + wait_for_completion(x);
> > > +}
> > > --
> > > 2.43.0
> > >
next prev parent reply other threads:[~2025-11-13 2:02 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 8:12 [PATCH v17 00/47] DEPT(DEPendency Tracker) Byungchul Park
2025-10-02 8:12 ` [PATCH v17 01/47] llist: move llist_{head,node} definition to types.h Byungchul Park
2025-10-02 8:24 ` Greg KH
2025-10-02 13:53 ` Mathieu Desnoyers
2025-10-02 23:19 ` Arnd Bergmann
2025-10-16 0:46 ` Byungchul Park
2025-10-16 7:59 ` Arnd Bergmann
2025-10-16 0:38 ` Byungchul Park
2025-10-02 8:12 ` [PATCH v17 02/47] dept: implement DEPT(DEPendency Tracker) Byungchul Park
2025-10-02 8:25 ` Greg KH
2025-10-02 12:56 ` Geert Uytterhoeven
2025-10-02 8:12 ` [PATCH v17 03/47] dept: add single event dependency tracker APIs Byungchul Park
2025-10-02 8:12 ` [PATCH v17 04/47] dept: add lock " Byungchul Park
2025-10-02 8:12 ` [PATCH v17 05/47] dept: tie to lockdep and IRQ tracing Byungchul Park
2025-10-02 8:12 ` [PATCH v17 06/47] dept: add proc knobs to show stats and dependency graph Byungchul Park
2025-10-02 8:12 ` [PATCH v17 07/47] dept: distinguish each kernel context from another Byungchul Park
2025-10-02 8:12 ` [PATCH v17 08/47] x86_64, dept: add support CONFIG_ARCH_HAS_DEPT_SUPPORT to x86_64 Byungchul Park
2025-10-02 15:22 ` Dave Hansen
2025-10-03 1:12 ` Byungchul Park
2025-10-02 8:12 ` [PATCH v17 09/47] arm64, dept: add support CONFIG_ARCH_HAS_DEPT_SUPPORT to arm64 Byungchul Park
2025-10-02 11:39 ` Mark Brown
2025-10-03 1:46 ` Byungchul Park
2025-10-03 11:33 ` Mark Brown
2025-10-13 1:51 ` Byungchul Park
2025-10-03 14:36 ` Mark Rutland
2025-10-13 4:28 ` Byungchul Park
2025-10-02 8:12 ` [PATCH v17 10/47] dept: distinguish each work from another Byungchul Park
2025-10-02 8:12 ` [PATCH v17 11/47] dept: add a mechanism to refill the internal memory pools on running out Byungchul Park
2025-10-02 8:12 ` [PATCH v17 12/47] dept: record the latest one out of consecutive waits of the same class Byungchul Park
2025-10-02 8:12 ` [PATCH v17 13/47] dept: apply sdt_might_sleep_{start,end}() to wait_for_completion()/complete() Byungchul Park
2025-10-02 8:12 ` [PATCH v17 14/47] dept: apply sdt_might_sleep_{start,end}() to swait Byungchul Park
2025-10-02 8:12 ` [PATCH v17 15/47] dept: apply sdt_might_sleep_{start,end}() to waitqueue wait Byungchul Park
2025-10-02 8:12 ` [PATCH v17 16/47] dept: apply sdt_might_sleep_{start,end}() to hashed-waitqueue wait Byungchul Park
2025-10-02 8:12 ` [PATCH v17 17/47] dept: apply sdt_might_sleep_{start,end}() to dma fence Byungchul Park
2025-10-02 8:12 ` [PATCH v17 18/47] dept: track timeout waits separately with a new Kconfig Byungchul Park
2025-10-02 8:12 ` [PATCH v17 19/47] dept: apply timeout consideration to wait_for_completion()/complete() Byungchul Park
2025-10-02 8:12 ` [PATCH v17 20/47] dept: apply timeout consideration to swait Byungchul Park
2025-10-02 8:12 ` [PATCH v17 21/47] dept: apply timeout consideration to waitqueue wait Byungchul Park
2025-10-02 8:12 ` [PATCH v17 22/47] dept: apply timeout consideration to hashed-waitqueue wait Byungchul Park
2025-10-02 8:12 ` [PATCH v17 23/47] dept: apply timeout consideration to dma fence wait Byungchul Park
2025-10-02 8:12 ` [PATCH v17 24/47] dept: make dept able to work with an external wgen Byungchul Park
2025-10-02 8:12 ` [PATCH v17 25/47] dept: track PG_locked with dept Byungchul Park
2025-10-02 8:12 ` [PATCH v17 26/47] dept: print staged wait's stacktrace on report Byungchul Park
2025-10-02 8:12 ` [PATCH v17 27/47] locking/lockdep: prevent various lockdep assertions when lockdep_off()'ed Byungchul Park
2025-10-02 8:12 ` [PATCH v17 28/47] dept: add documentation for dept Byungchul Park
2025-10-03 2:44 ` Bagas Sanjaya
2025-10-13 1:28 ` Byungchul Park
2025-10-03 5:36 ` Jonathan Corbet
2025-10-13 1:03 ` Byungchul Park
2025-10-03 6:55 ` NeilBrown
2025-10-13 5:23 ` Byungchul Park
2025-10-14 6:03 ` NeilBrown
2025-10-14 6:38 ` Byungchul Park
2025-10-02 8:12 ` [PATCH v17 29/47] cpu/hotplug: use a weaker annotation in AP thread Byungchul Park
2025-10-02 8:12 ` [PATCH v17 30/47] fs/jbd2: use a weaker annotation in journal handling Byungchul Park
2025-10-02 8:40 ` Jan Kara
2025-10-03 1:13 ` Byungchul Park
2025-10-02 8:12 ` [PATCH v17 31/47] dept: assign dept map to mmu notifier invalidation synchronization Byungchul Park
2025-10-02 8:12 ` [PATCH v17 32/47] dept: assign unique dept_key to each distinct dma fence caller Byungchul Park
2025-10-02 8:12 ` [PATCH v17 33/47] dept: make dept aware of lockdep_set_lock_cmp_fn() annotation Byungchul Park
2025-10-02 8:12 ` [PATCH v17 34/47] dept: make dept stop from working on debug_locks_off() Byungchul Park
2025-10-02 8:12 ` [PATCH v17 35/47] i2c: rename wait_for_completion callback to wait_for_completion_cb Byungchul Park
2025-10-04 16:39 ` Wolfram Sang
2025-10-13 5:27 ` Byungchul Park
2025-10-02 8:12 ` [PATCH v17 36/47] dept: assign unique dept_key to each distinct wait_for_completion() caller Byungchul Park
2025-10-02 10:06 ` [PATCH] rust: bindings: add `rust_helper_wait_for_completion` helper function Guangbo Cui
2025-10-02 10:27 ` Danilo Krummrich
2025-11-13 1:21 ` Byungchul Park
2025-10-02 10:39 ` Miguel Ojeda
2025-10-02 16:52 ` Guangbo Cui
2025-10-02 17:27 ` Boqun Feng
2025-11-13 1:20 ` Byungchul Park
2025-11-13 2:02 ` Byungchul Park [this message]
2025-11-19 9:38 ` Byungchul Park
2025-10-02 8:12 ` [PATCH v17 37/47] completion, dept: introduce init_completion_dmap() API Byungchul Park
2025-10-02 8:12 ` [PATCH v17 38/47] dept: introduce a new type of dependency tracking between multi event sites Byungchul Park
2025-10-02 8:12 ` [PATCH v17 39/47] dept: add module support for struct dept_event_site and dept_event_site_dep Byungchul Park
2025-10-02 8:12 ` [PATCH v17 40/47] dept: introduce event_site() to disable event tracking if it's recoverable Byungchul Park
2025-10-02 8:12 ` [PATCH v17 41/47] dept: implement a basic unit test for dept Byungchul Park
2025-10-02 8:12 ` [PATCH v17 42/47] dept: call dept_hardirqs_off() in local_irq_*() regardless of irq state Byungchul Park
2025-10-02 8:12 ` [PATCH v17 43/47] rcu/update: fix same dept key collision between various types of RCU Byungchul Park
2025-10-02 8:12 ` [PATCH v17 44/47] dept: introduce APIs to set page usage and use subclasses_evt for the usage Byungchul Park
2025-11-19 10:53 ` Byungchul Park
2025-11-19 14:37 ` Matthew Wilcox
2025-11-20 2:09 ` Byungchul Park
2025-11-20 2:34 ` Byungchul Park
2025-11-20 5:14 ` Byungchul Park
2025-12-01 7:18 ` Byungchul Park
2025-10-02 8:12 ` [PATCH v17 45/47] dept: track PG_writeback with dept Byungchul Park
2025-10-02 8:12 ` [PATCH v17 46/47] SUNRPC: relocate struct rcu_head to the first field of struct rpc_xprt Byungchul Park
2025-10-02 8:12 ` [PATCH v17 47/47] mm: percpu: increase PERCPU_DYNAMIC_SIZE_SHIFT on DEPT and large PAGE_SIZE Byungchul Park
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=20251113020236.GA36724@system.software.com \
--to=byungchul@sk.com \
--cc=2407018371@qq.com \
--cc=Liam.Howlett@oracle.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=amir73il@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=andrii@kernel.org \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=bsegall@google.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=kernel_team@skhynix.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=link@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=matthew.brost@intel.com \
--cc=max.byungchul.park@gmail.com \
--cc=mcgrof@kernel.org \
--cc=melissa.srw@gmail.com \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=ojeda@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@kernel.org \
--cc=penberg@kernel.org \
--cc=peterz@infradead.org \
--cc=petr.pavlu@suse.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vincent.guittot@linaro.org \
--cc=will@kernel.org \
--cc=yeoreum.yun@arm.com \
--cc=ysk@kzalloc.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