Skip to contentSkip to conversation

linux-next: manual merge of the rust tree with the char-misc tree

DISCUSSION Stephen Rothwell 3 participants 4 messages Nov 11, 2024 – Nov 28, 2024 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next merge of the rust tree got a conflict in:

rust/macros/module.rs

between commit:

7f15c46a57c3 ("rust: introduce InPlaceModule")

from the char-misc tree and commit:

d072acda4862 ("rust: use custom FFI integer types")

from the rust tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 37 lines
Cheers,
Stephen Rothwell

diff --cc rust/macros/module.rs
index a03266a78cfb,e7a087b7e884..000000000000
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@@ -332,15 -330,21 +332,15 @@@ pub(crate) fn module(ts: TokenStream) -
                      /// # Safety
                      ///
                      /// This function must only be called once.
-                     unsafe fn __init() -> core::ffi::c_int {{
+                     unsafe fn __init() -> kernel::ffi::c_int {{
 -                        match <{type_} as kernel::Module>::init(&super::super::THIS_MODULE) {{
 -                            Ok(m) => {{
 -                                // SAFETY: No data race, since `__MOD` can only be accessed by this
 -                                // module and there only `__init` and `__exit` access it. These
 -                                // functions are only called once and `__exit` cannot be called
 -                                // before or during `__init`.
 -                                unsafe {{
 -                                    __MOD = Some(m);
 -                                }}
 -                                return 0;
 -                            }}
 -                            Err(e) => {{
 -                                return e.to_errno();
 -                            }}
 +                        let initer =
 +                            <{type_} as kernel::InPlaceModule>::init(&super::super::THIS_MODULE);
 +                        // SAFETY: No data race, since `__MOD` can only be accessed by this module
 +                        // and there only `__init` and `__exit` access it. These functions are only
 +                        // called once and `__exit` cannot be called before or during `__init`.
 +                        match unsafe {{ initer.__pinned_init(__MOD.as_mut_ptr()) }} {{
 +                            Ok(m) => 0,
 +                            Err(e) => e.to_errno(),
                          }}
                      }}
#1 lore raw
Quoted 52 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the rust tree got a conflict in:

rust/macros/module.rs

between commit:

7f15c46a57c3 ("rust: introduce InPlaceModule")

from the char-misc tree and commit:

d072acda4862 ("rust: use custom FFI integer types")

from the rust tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 2 lines
Cheers,
Stephen Rothwell
rust/macros/module.rs +1 -1
diff --cc rust/macros/module.rs
index a03266a78cfb,e7a087b7e884..000000000000
@@@ -332,15 -330,21 +332,15 @@@ pub(crate) fn module(ts: TokenStream) -
                      /// # Safety
                      ///
                      /// This function must only be called once.
-                     unsafe fn __init() -> core::ffi::c_int {{
+                     unsafe fn __init() -> kernel::ffi::c_int {{
 -                        match <{type_} as kernel::Module>::init(&super::super::THIS_MODULE) {{
 -                            Ok(m) => {{
 -                                // SAFETY: No data race, since `__MOD` can only be accessed by this
 -                                // module and there only `__init` and `__exit` access it. These
 -                                // functions are only called once and `__exit` cannot be called
 -                                // before or during `__init`.
 -                                unsafe {{
 -                                    __MOD = Some(m);
 -                                }}
 -                                return 0;
 -                            }}
 -                            Err(e) => {{
 -                                return e.to_errno();
 -                            }}

rust/macros/module.rs

Quoted 10 lines
rust/macros/module.rs +0 -0
 +                        let initer =
 +                            <{type_} as kernel::InPlaceModule>::init(&super::super::THIS_MODULE);
 +                        // SAFETY: No data race, since `__MOD` can only be accessed by this module
 +                        // and there only `__init` and `__exit` access it. These functions are only
 +                        // called once and `__exit` cannot be called before or during `__init`.
 +                        match unsafe {{ initer.__pinned_init(__MOD.as_mut_ptr()) }} {{
 +                            Ok(m) => 0,
 +                            Err(e) => e.to_errno(),
                          }}
                      }}

Looks good to me, thanks!

greg k-h

#2 lore raw
Quoted 2 lines · Greg KH

Looks good to me, thanks!

+1

Stephen -- you will get the conflict in the upcoming round again, but this time without build failures, hopefully! The hash has not changed. Thanks!

Cheers,
Miguel

#3 lore raw
In reply to Stephen Rothwell

Hi all,

Quoted 47 lines · On Mon, 11 Nov 2024 17:34:59 +1100 Stephen Rothwell <[email protected]>…

Today's linux-next merge of the rust tree got a conflict in:

rust/macros/module.rs

between commit:

7f15c46a57c3 ("rust: introduce InPlaceModule")

from the char-misc tree and commit:

d072acda4862 ("rust: use custom FFI integer types")

from the rust tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

rust/macros/module.rs +1 -1
diff --cc rust/macros/module.rs
index a03266a78cfb,e7a087b7e884..000000000000
@@@ -332,15 -330,21 +332,15 @@@ pub(crate) fn module(ts: TokenStream) -
                      /// # Safety
                      ///
                      /// This function must only be called once.
-                     unsafe fn __init() -> core::ffi::c_int {{
+                     unsafe fn __init() -> kernel::ffi::c_int {{
 -                        match <{type_} as kernel::Module>::init(&super::super::THIS_MODULE) {{
 -                            Ok(m) => {{
 -                                // SAFETY: No data race, since `__MOD` can only be accessed by this
 -                                // module and there only `__init` and `__exit` access it. These
 -                                // functions are only called once and `__exit` cannot be called
 -                                // before or during `__init`.
 -                                unsafe {{
 -                                    __MOD = Some(m);
 -                                }}
 -                                return 0;
 -                            }}
 -                            Err(e) => {{
 -                                return e.to_errno();
 -                            }}

rust/macros/module.rs

Quoted 10 lines
rust/macros/module.rs +0 -0
 +                        let initer =
 +                            <{type_} as kernel::InPlaceModule>::init(&super::super::THIS_MODULE);
 +                        // SAFETY: No data race, since `__MOD` can only be accessed by this module
 +                        // and there only `__init` and `__exit` access it. These functions are only
 +                        // called once and `__exit` cannot be called before or during `__init`.
 +                        match unsafe {{ initer.__pinned_init(__MOD.as_mut_ptr()) }} {{
 +                            Ok(m) => 0,
 +                            Err(e) => e.to_errno(),
                          }}
                      }}

This is now conflict between the char-misc tree and Linus' tree.

Signature · 2 lines
Cheers,
Stephen Rothwell