* merge problems with char-misc-next and Linus's branch right now
@ 2026-08-25 9:05 Greg KH
2026-08-25 10:00 ` Alvin Sun
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2026-08-25 9:05 UTC (permalink / raw)
To: Alice Ryhl; +Cc: rust-for-linux
Hi,
I'm trying to push out a pull request for char-misc-next right now, and
am having merge issues that I need/want to fix up (or at least provide a
hint as to fix up.)
I'm currently stuck at the following build error:
RUSTC drivers/android/binder/rust_binder_main.o
error[E0425]: cannot find value `THIS_MODULE` in the crate root
--> drivers/android/binder/netlink.rs:16:13
|
16 | &crate::THIS_MODULE,
| ^^^^^^^^^^^
|
::: rust/kernel/module.rs:52:1
|
52 | pub const fn this_module<M: ModuleMetadata>() -> &'static ThisModule {
| -------------------------------------------------------------------- similarly named function `this_module` defined here
|
help: a function with a similar name exists
|
16 - &crate::THIS_MODULE,
16 + &crate::this_module,
|
error: aborting due to 1 previous error
I wasn't paying attention to the recent THIS_MODULE changes, and can't
seem to figure out how to fix up the netlink.rs file to build with the
recent changes.
Any hints?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: merge problems with char-misc-next and Linus's branch right now
2026-08-25 9:05 merge problems with char-misc-next and Linus's branch right now Greg KH
@ 2026-08-25 10:00 ` Alvin Sun
2026-08-25 10:49 ` Miguel Ojeda
2026-08-25 10:53 ` Greg KH
0 siblings, 2 replies; 6+ messages in thread
From: Alvin Sun @ 2026-08-25 10:00 UTC (permalink / raw)
To: Greg KH; +Cc: rust-for-linux, Alice Ryhl, Gary Guo
On 8/25/26 17:05, Greg KH wrote:
> Hi,
>
> I'm trying to push out a pull request for char-misc-next right now, and
> am having merge issues that I need/want to fix up (or at least provide a
> hint as to fix up.)
>
> I'm currently stuck at the following build error:
>
> RUSTC drivers/android/binder/rust_binder_main.o
> error[E0425]: cannot find value `THIS_MODULE` in the crate root
> --> drivers/android/binder/netlink.rs:16:13
> |
> 16 | &crate::THIS_MODULE,
> | ^^^^^^^^^^^
> |
> ::: rust/kernel/module.rs:52:1
> |
> 52 | pub const fn this_module<M: ModuleMetadata>() -> &'static ThisModule {
> | -------------------------------------------------------------------- similarly named function `this_module` defined here
> |
> help: a function with a similar name exists
> |
> 16 - &crate::THIS_MODULE,
> 16 + &crate::this_module,
> |
>
> error: aborting due to 1 previous error
>
>
> I wasn't paying attention to the recent THIS_MODULE changes, and can't
> seem to figure out how to fix up the netlink.rs file to build with the
> recent changes.
>
> Any hints?
Hi Greg,
Gary has already posted a fix:
https://lore.kernel.org/rust-for-linux/20260813163951.1102583-1-gary@kernel.org/
Best regards,
Alvin
>
> thanks,
>
> greg k-h
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: merge problems with char-misc-next and Linus's branch right now
2026-08-25 10:00 ` Alvin Sun
@ 2026-08-25 10:49 ` Miguel Ojeda
2026-08-25 11:08 ` Greg KH
2026-08-25 10:53 ` Greg KH
1 sibling, 1 reply; 6+ messages in thread
From: Miguel Ojeda @ 2026-08-25 10:49 UTC (permalink / raw)
To: Greg KH; +Cc: rust-for-linux, Alice Ryhl, Gary Guo, Alvin Sun
On Tue, Aug 25, 2026 at 12:05 PM Alvin Sun <alvin.sun@linux.dev> wrote:
>
> Gary has already posted a fix:
> https://lore.kernel.org/rust-for-linux/20260813163951.1102583-1-gary@kernel.org/
Yeah, please see as well the other conflicts related to char-misc this cycle:
https://lore.kernel.org/linux-next/20260805-slab-rust-fix-v1-1-c4d4c1b69de2@kernel.org/
https://lore.kernel.org/linux-next/ans8lsGbkro4pO6N@sirena.org.uk/
(the diff in that thread is from another conflict somehow, but the
actual conflict is very simple anyway)
The resolutions in linux-next should be fine.
My overall list of conflicts for Linus is at:
https://lore.kernel.org/rust-for-linux/20260816191926.230123-1-ojeda@kernel.org/
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: merge problems with char-misc-next and Linus's branch right now
2026-08-25 10:00 ` Alvin Sun
2026-08-25 10:49 ` Miguel Ojeda
@ 2026-08-25 10:53 ` Greg KH
1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2026-08-25 10:53 UTC (permalink / raw)
To: Alvin Sun; +Cc: rust-for-linux, Alice Ryhl, Gary Guo
On Tue, Aug 25, 2026 at 06:00:37PM +0800, Alvin Sun wrote:
>
> On 8/25/26 17:05, Greg KH wrote:
> > Hi,
> >
> > I'm trying to push out a pull request for char-misc-next right now, and
> > am having merge issues that I need/want to fix up (or at least provide a
> > hint as to fix up.)
> >
> > I'm currently stuck at the following build error:
> >
> > RUSTC drivers/android/binder/rust_binder_main.o
> > error[E0425]: cannot find value `THIS_MODULE` in the crate root
> > --> drivers/android/binder/netlink.rs:16:13
> > |
> > 16 | &crate::THIS_MODULE,
> > | ^^^^^^^^^^^
> > |
> > ::: rust/kernel/module.rs:52:1
> > |
> > 52 | pub const fn this_module<M: ModuleMetadata>() -> &'static ThisModule {
> > | -------------------------------------------------------------------- similarly named function `this_module` defined here
> > |
> > help: a function with a similar name exists
> > |
> > 16 - &crate::THIS_MODULE,
> > 16 + &crate::this_module,
> > |
> >
> > error: aborting due to 1 previous error
> >
> >
> > I wasn't paying attention to the recent THIS_MODULE changes, and can't
> > seem to figure out how to fix up the netlink.rs file to build with the
> > recent changes.
> >
> > Any hints?
>
> Hi Greg,
>
> Gary has already posted a fix:
> https://lore.kernel.org/rust-for-linux/20260813163951.1102583-1-gary@kernel.org/
Thank you, I had missed that.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: merge problems with char-misc-next and Linus's branch right now
2026-08-25 10:49 ` Miguel Ojeda
@ 2026-08-25 11:08 ` Greg KH
2026-08-25 11:45 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2026-08-25 11:08 UTC (permalink / raw)
To: Miguel Ojeda; +Cc: rust-for-linux, Alice Ryhl, Gary Guo, Alvin Sun
On Tue, Aug 25, 2026 at 12:49:54PM +0200, Miguel Ojeda wrote:
> On Tue, Aug 25, 2026 at 12:05 PM Alvin Sun <alvin.sun@linux.dev> wrote:
> >
> > Gary has already posted a fix:
> > https://lore.kernel.org/rust-for-linux/20260813163951.1102583-1-gary@kernel.org/
>
> Yeah, please see as well the other conflicts related to char-misc this cycle:
>
> https://lore.kernel.org/linux-next/20260805-slab-rust-fix-v1-1-c4d4c1b69de2@kernel.org/
>
> https://lore.kernel.org/linux-next/ans8lsGbkro4pO6N@sirena.org.uk/
> (the diff in that thread is from another conflict somehow, but the
> actual conflict is very simple anyway)
>
> The resolutions in linux-next should be fine.
>
> My overall list of conflicts for Linus is at:
>
> https://lore.kernel.org/rust-for-linux/20260816191926.230123-1-ojeda@kernel.org/
Yeah, it's messy.
Below is my resolution, seems to work here for me and I'll send it along
to Linus as well.
thanks,
greg k-h
diff --cc rust/kernel/sync/poll.rs
index 5aa0ce9ba01b,684dfa242b1a..000000000000
--- a/rust/kernel/sync/poll.rs
+++ b/rust/kernel/sync/poll.rs
@@@ -8,13 -9,14 +9,18 @@@ use crate::
bindings,
fs::File,
prelude::*,
- sync::{CondVar, LockClassKey},
+ sync::{
+ rcu::synchronize_rcu,
+ CondVar,
+ LockClassKey, //
+ }, //
+ types::Opaque, //
+ };
+ use core::{
+ marker::PhantomData,
+ mem::ManuallyDrop,
+ ops::Deref, //
};
- use core::{marker::PhantomData, ops::Deref};
/// Creates a [`PollCondVar`] initialiser with the given name and a newly-created lock class.
#[macro_export]
@@@ -103,6 -106,72 +110,70 @@@ impl PinnedDrop for PollCondVar
unsafe { bindings::__wake_up_pollfree(self.inner.wait_queue_head.get()) };
// Wait for epoll items to be properly removed.
- //
- // SAFETY: Just an FFI call.
- unsafe { bindings::synchronize_rcu() };
+ synchronize_rcu();
}
}
+
+ /// A [`KBox<PollCondVar>`] that uses `kfree_rcu`.
+ ///
+ /// [`KBox<PollCondVar>`]: PollCondVar
+ pub struct PollCondVarBox {
+ inner: ManuallyDrop<Pin<KBox<PollCondVarBoxInner>>>,
+ }
+
+ #[pin_data]
+ #[repr(C)]
+ struct PollCondVarBoxInner {
+ #[pin]
+ inner: PollCondVar,
- rcu: Opaque<bindings::callback_head>,
++ rcu: Opaque<bindings::kvfree_rcu_head>,
+ }
+
+ // SAFETY: PollCondVar is Send
+ unsafe impl Send for PollCondVarBoxInner {}
+ // SAFETY: PollCondVar is Sync
+ unsafe impl Sync for PollCondVarBoxInner {}
+
+ impl PollCondVarBox {
+ /// Constructs a new boxed [`PollCondVar`].
+ pub fn new(name: &'static CStr, key: Pin<&'static LockClassKey>) -> Result<Self, AllocError> {
+ let b = KBox::pin_init(
+ pin_init!(PollCondVarBoxInner {
+ inner <- PollCondVar::new(name, key),
+ rcu: Opaque::uninit(),
+ }),
+ GFP_KERNEL,
+ )
+ .map_err(|_| AllocError)?;
+
+ Ok(PollCondVarBox {
+ inner: ManuallyDrop::new(b),
+ })
+ }
+ }
+
+ impl Deref for PollCondVarBox {
+ type Target = PollCondVar;
+ fn deref(&self) -> &PollCondVar {
+ &self.inner.inner
+ }
+ }
+
+ impl Drop for PollCondVarBox {
+ #[inline]
+ fn drop(&mut self) {
+ // SAFETY: ManuallyDrop::take ok because not already taken.
+ let boxed = unsafe { ManuallyDrop::take(&mut self.inner) };
+
+ // SAFETY: The code below frees the box without calling the actual destructor of the type,
+ // but it's okay because it re-implements the destructor using `kfree_rcu()` in place of
+ // `synchronize_rcu()`.
+ let ptr = KBox::into_raw(unsafe { Pin::into_inner_unchecked(boxed) });
+
+ // SAFETY: The pointer points at a valid `wait_queue_head`.
+ unsafe { bindings::__wake_up_pollfree((*ptr).inner.inner.wait_queue_head.get()) };
+
+ // SAFETY: This was allocated using `KBox::pin_init`, so it can be freed with `kvfree`.
+ unsafe { bindings::kvfree_call_rcu((*ptr).rcu.get(), ptr.cast::<ffi::c_void>()) };
+ }
+ }
diff --cc rust/kernel/task.rs
index c2b3457b700c,1b290c61714d..000000000000
--- a/rust/kernel/task.rs
+++ b/rust/kernel/task.rs
@@@ -210,7 -210,14 +210,14 @@@ impl Task
unsafe { *ptr::addr_of!((*self.as_ptr()).pid) }
}
+ /// Returns the TGID (Thread Group ID / Process ID) of the given task.
+ pub fn tgid(&self) -> Pid {
+ // SAFETY: The tgid of a task never changes after initialization, so reading this field is
+ // not a data race.
+ unsafe { *ptr::addr_of!((*self.as_ptr()).tgid) }
+ }
+
- /// Returns the UID of the given task.
+ /// Returns the objective real UID of the given task.
#[inline]
pub fn uid(&self) -> Kuid {
// SAFETY: It's always safe to call `task_uid` on a valid task.
diff --cc rust/uapi/uapi_helper.h
index 1c4aa4292dce,86c7b6b284b0..000000000000
--- a/rust/uapi/uapi_helper.h
+++ b/rust/uapi/uapi_helper.h
@@@ -10,7 -11,7 +10,8 @@@
#include <uapi/drm/nova_drm.h>
#include <uapi/drm/panthor_drm.h>
#include <uapi/linux/android/binder.h>
+ #include <uapi/linux/android/binder_netlink.h>
+#include <uapi/linux/ioctl.h>
#include <uapi/linux/mdio.h>
#include <uapi/linux/mii.h>
#include <uapi/linux/ethtool.h>
diff --git a/drivers/android/binder/netlink.rs b/drivers/android/binder/netlink.rs
index beb7ea2edaff..f34e1009432c 100644
--- a/drivers/android/binder/netlink.rs
+++ b/drivers/android/binder/netlink.rs
@@ -13,7 +13,7 @@
};
pub static BINDER_NL_FAMILY: Family = Family::const_new(
- &crate::THIS_MODULE,
+ kernel::module::this_module::<crate::LocalModule>(),
kernel::uapi::BINDER_FAMILY_NAME,
kernel::uapi::BINDER_FAMILY_VERSION,
&BINDER_NL_FAMILY_MCGRPS,
* Unmerged path drivers/misc/sgi-xp/xpc_uv.c
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: merge problems with char-misc-next and Linus's branch right now
2026-08-25 11:08 ` Greg KH
@ 2026-08-25 11:45 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2026-08-25 11:45 UTC (permalink / raw)
To: Miguel Ojeda; +Cc: rust-for-linux, Alice Ryhl, Gary Guo, Alvin Sun
On Tue, Aug 25, 2026 at 01:08:55PM +0200, Greg KH wrote:
> On Tue, Aug 25, 2026 at 12:49:54PM +0200, Miguel Ojeda wrote:
> > On Tue, Aug 25, 2026 at 12:05 PM Alvin Sun <alvin.sun@linux.dev> wrote:
> > >
> > > Gary has already posted a fix:
> > > https://lore.kernel.org/rust-for-linux/20260813163951.1102583-1-gary@kernel.org/
> >
> > Yeah, please see as well the other conflicts related to char-misc this cycle:
> >
> > https://lore.kernel.org/linux-next/20260805-slab-rust-fix-v1-1-c4d4c1b69de2@kernel.org/
> >
> > https://lore.kernel.org/linux-next/ans8lsGbkro4pO6N@sirena.org.uk/
> > (the diff in that thread is from another conflict somehow, but the
> > actual conflict is very simple anyway)
> >
> > The resolutions in linux-next should be fine.
> >
> > My overall list of conflicts for Linus is at:
> >
> > https://lore.kernel.org/rust-for-linux/20260816191926.230123-1-ojeda@kernel.org/
>
> Yeah, it's messy.
>
> Below is my resolution, seems to work here for me and I'll send it along
> to Linus as well.
Now sent here:
https://lore.kernel.org/r/2026082525-spoils-gutless-f1ff@gregkh
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-25 11:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 9:05 merge problems with char-misc-next and Linus's branch right now Greg KH
2026-08-25 10:00 ` Alvin Sun
2026-08-25 10:49 ` Miguel Ojeda
2026-08-25 11:08 ` Greg KH
2026-08-25 11:45 ` Greg KH
2026-08-25 10:53 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox