* [PATCH 00/13] rust: bindings: Auto-generate inline static functions
@ 2024-11-07 2:08 Alistair Francis
2024-11-07 2:08 ` [PATCH 01/13] rust: bindings: Support some " Alistair Francis
` (13 more replies)
0 siblings, 14 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
The kernel includes a large number of static inline functions that are
defined in header files. One example is the crypto_shash_descsize()
function which is defined in hash.h as
```
static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm)
{
return tfm->descsize;
}
```
bindgen is currently unable to generate bindings to these functions as
they are not publically exposed (they are static after all).
The Rust code currently uses rust_helper_* functions, such as
rust_helper_alloc_pages() for example to call the static inline
functions. But this is a hassle as someone needs to write a C helper
function.
Instead we can use the bindgen wrap-static-fns feature. The feature
is marked as experimental, but has recently been promoted to
non-experimental (dependig on your version of bindgen).
By supporting wrap-static-fns we automatically generate a C file called
extern.c that exposes the static inline functions, for example like this
```
unsigned int crypto_shash_descsize__extern(struct crypto_shash *tfm) { return crypto_shash_descsize(tfm); }
```
The nice part is that this is auto-generated.
We then also get a bindings_generate_static.rs file with the Rust
binding, like this
```
extern "C" {
#[link_name = "crypto_shash_descsize__extern"]
pub fn crypto_shash_descsize(tfm: *mut crypto_shash) -> core::ffi::c_uint;
}
```
So now we can use the static inline functions just like normal
functions.
There are a bunch of static inline functions that don't work though, because
the C compiler fails to build extern.c:
* functions with inline asm generate "operand probably does not match constraints"
errors (rip_rel_ptr() for example)
* functions with bit masks (u32_encode_bits() and friends) result in
"call to ‘__bad_mask’ declared with attribute error: bad bitfield mask"
errors
As well as that any static inline function that calls a function that has been
kconfig-ed out will fail to link as the function being called isn't built
(mdio45_ethtool_gset_npage for example)
Due to these failures we use a allow-list system (where functions must
be manually enabled).
This series adds support for bindgen generating wrappers for inline statics and
then converts the existing helper functions to this new method. This doesn't
work for C macros, so we can't reamove all of the helper functions, but we
can remove most.
Alistair Francis (13):
rust: bindings: Support some inline static functions
rust: helpers: Remove blk helper
rust: helpers: Remove build_bug helper
rust: helpers: Remove err helper
rust: helpers: Remove kunit helper
rust: helpers: Remove mutex helper
rust: helpers: Remove some page helpers
rust: helpers: Remove rbtree helper
rust: helpers: Remove some refcount helpers
rust: helpers: Remove signal helper
rust: helpers: Remove some spinlock helpers
rust: helpers: Remove some task helpers
rust: helpers: Remove uaccess helpers
rust/.gitignore | 2 ++
rust/Makefile | 36 ++++++++++++++++++++++++++++++---
rust/bindgen_static_functions | 31 ++++++++++++++++++++++++++++
rust/bindings/bindings_helper.h | 5 +++++
rust/bindings/lib.rs | 4 ++++
rust/exports.c | 1 +
rust/helpers/blk.c | 14 -------------
rust/helpers/build_bug.c | 9 ---------
rust/helpers/err.c | 19 -----------------
rust/helpers/helpers.c | 13 ++----------
rust/helpers/kunit.c | 9 ---------
rust/helpers/mutex.c | 15 --------------
rust/helpers/page.c | 5 -----
rust/helpers/rbtree.c | 9 ---------
rust/helpers/refcount.c | 10 ---------
rust/helpers/signal.c | 9 ---------
rust/helpers/spinlock.c | 10 ---------
rust/helpers/task.c | 10 ---------
rust/helpers/uaccess.c | 15 --------------
19 files changed, 78 insertions(+), 148 deletions(-)
create mode 100644 rust/bindgen_static_functions
delete mode 100644 rust/helpers/blk.c
delete mode 100644 rust/helpers/build_bug.c
delete mode 100644 rust/helpers/err.c
delete mode 100644 rust/helpers/kunit.c
delete mode 100644 rust/helpers/mutex.c
delete mode 100644 rust/helpers/rbtree.c
delete mode 100644 rust/helpers/signal.c
delete mode 100644 rust/helpers/uaccess.c
--
2.47.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 01/13] rust: bindings: Support some inline static functions
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 9:25 ` kernel test robot
2024-11-07 2:08 ` [PATCH 02/13] rust: helpers: Remove blk helper Alistair Francis
` (12 subsequent siblings)
13 siblings, 1 reply; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
The kernel includes a large number of static inline functions that are
defined in header files. One example is the crypto_shash_descsize()
function which is defined in hash.h as
static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm)
{
return tfm->descsize;
}
bindgen is currently unable to generate bindings to these functions as
they are not publically exposed (they are static after all).
The Rust code currently uses rust_helper_* functions, such as
rust_helper_alloc_pages() for example to call the static inline
functions. But this is a hassle as someone needs to write a C helper
function.
Instead we can use the bindgen wrap-static-fns feature. The feature
is marked as experimental, but has recently been promoted to
non-experimental (dependig on your version of bindgen).
By supporting wrap-static-fns we automatically generate a C file called
extern.c that exposes the static inline functions, for example like this
```
unsigned int crypto_shash_descsize__extern(struct crypto_shash *tfm) { return crypto_shash_descsize(tfm); }
```
The nice part is that this is auto-generated.
We then also get a bindings_generate_static.rs file with the Rust
binding, like this
```
extern "C" {
#[link_name = "crypto_shash_descsize__extern"]
pub fn crypto_shash_descsize(tfm: *mut crypto_shash) -> core::ffi::c_uint;
}
```
So now we can use the static inline functions just like normal
functions.
There are a bunch of static inline functions that don't work though, because
the C compiler fails to build extern.c:
* functions with inline asm generate "operand probably does not match constraints"
errors (rip_rel_ptr() for example)
* functions with bit masks (u32_encode_bits() and friends) result in
"call to ‘__bad_mask’ declared with attribute error: bad bitfield mask"
errors
As well as that any static inline function that calls a function that has been
kconfig-ed out will fail to link as the function being called isn't built
(mdio45_ethtool_gset_npage for example)
Due to these failures we use a allow-list system (where functions must
be manually enabled).
Link: https://github.com/rust-lang/rust-bindgen/discussions/2405
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/.gitignore | 2 ++
rust/Makefile | 36 ++++++++++++++++++++++++++++++++---
rust/bindgen_static_functions | 6 ++++++
rust/bindings/lib.rs | 4 ++++
rust/exports.c | 1 +
5 files changed, 46 insertions(+), 3 deletions(-)
create mode 100644 rust/bindgen_static_functions
diff --git a/rust/.gitignore b/rust/.gitignore
index d3829ffab80ba..741a180238013 100644
--- a/rust/.gitignore
+++ b/rust/.gitignore
@@ -1,10 +1,12 @@
# SPDX-License-Identifier: GPL-2.0
bindings_generated.rs
+bindings_generated_static.rs
bindings_helpers_generated.rs
doctests_kernel_generated.rs
doctests_kernel_generated_kunit.c
uapi_generated.rs
exports_*_generated.h
+extern.c
doc/
test/
diff --git a/rust/Makefile b/rust/Makefile
index b5e0a73b78f3e..4ea5ce96440d0 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -10,14 +10,17 @@ always-$(CONFIG_RUST) += exports_core_generated.h
# for Rust only, thus there is no header nor prototypes.
obj-$(CONFIG_RUST) += helpers/helpers.o
CFLAGS_REMOVE_helpers/helpers.o = -Wmissing-prototypes -Wmissing-declarations
+CFLAGS_REMOVE_extern.o = -Wmissing-prototypes -Wmissing-declarations -Wdiscarded-qualifiers
always-$(CONFIG_RUST) += libmacros.so
no-clean-files += libmacros.so
-always-$(CONFIG_RUST) += bindings/bindings_generated.rs bindings/bindings_helpers_generated.rs
-obj-$(CONFIG_RUST) += alloc.o bindings.o kernel.o
+always-$(CONFIG_RUST) += bindings/bindings_generated.rs bindings/bindings_helpers_generated.rs \
+ bindings/bindings_generated_static.rs
+obj-$(CONFIG_RUST) += alloc.o bindings.o kernel.o extern.o
always-$(CONFIG_RUST) += exports_alloc_generated.h exports_helpers_generated.h \
- exports_bindings_generated.h exports_kernel_generated.h
+ exports_bindings_generated.h exports_bindings_static_generated.h \
+ exports_kernel_generated.h
always-$(CONFIG_RUST) += uapi/uapi_generated.rs
obj-$(CONFIG_RUST) += uapi.o
@@ -275,6 +278,20 @@ quiet_cmd_bindgen = BINDGEN $@
-o $@ -- $(bindgen_c_flags_final) -DMODULE \
$(bindgen_target_cflags) $(bindgen_target_extra)
+quiet_cmd_bindgen_static = BINDGEN $@
+ cmd_bindgen_static = \
+ $(BINDGEN) $< $(bindgen_target_flags) \
+ --use-core --with-derive-default --ctypes-prefix core::ffi --no-layout-tests \
+ --no-debug '.*' --enable-function-attribute-detection \
+ --experimental --wrap-static-fns \
+ --wrap-static-fns-path $(src)/extern.c \
+ $(bindgen_static_functions) \
+ -o $@ -- $(bindgen_c_flags_final) -DMODULE \
+ $(bindgen_target_cflags) $(bindgen_target_extra)
+
+$(src)/extern.c: $(obj)/bindings/bindings_generated_static.rs
+ @sed -i 's|rust/bindings|bindings|g' $@
+
$(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \
$(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
$(obj)/bindings/bindings_generated.rs: private bindgen_target_extra = ; \
@@ -283,6 +300,15 @@ $(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \
$(src)/bindgen_parameters FORCE
$(call if_changed_dep,bindgen)
+$(obj)/bindings/bindings_generated_static.rs: private bindgen_target_flags = \
+ $(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
+$(obj)/bindings/bindings_generated_static.rs: private bindgen_static_functions = \
+ $(shell grep -Ev '^#|^$$' $(src)/bindgen_static_functions)
+$(obj)/bindings/bindings_generated_static.rs: $(src)/bindings/bindings_helper.h \
+ $(src)/bindgen_static_functions \
+ $(src)/bindgen_parameters FORCE
+ $(call if_changed_dep,bindgen_static)
+
$(obj)/uapi/uapi_generated.rs: private bindgen_target_flags = \
$(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
$(obj)/uapi/uapi_generated.rs: $(src)/uapi/uapi_helper.h \
@@ -329,6 +355,9 @@ $(obj)/exports_helpers_generated.h: $(obj)/helpers/helpers.o FORCE
$(obj)/exports_bindings_generated.h: $(obj)/bindings.o FORCE
$(call if_changed,exports)
+$(obj)/exports_bindings_static_generated.h: $(obj)/extern.o FORCE
+ $(call if_changed,exports)
+
$(obj)/exports_kernel_generated.h: $(obj)/kernel.o FORCE
$(call if_changed,exports)
@@ -410,6 +439,7 @@ $(obj)/build_error.o: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE
$(obj)/bindings.o: $(src)/bindings/lib.rs \
$(obj)/compiler_builtins.o \
$(obj)/bindings/bindings_generated.rs \
+ $(obj)/bindings/bindings_generated_static.rs \
$(obj)/bindings/bindings_helpers_generated.rs FORCE
+$(call if_changed_rule,rustc_library)
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
new file mode 100644
index 0000000000000..1f24360daeb38
--- /dev/null
+++ b/rust/bindgen_static_functions
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+
+# Don't generate structs
+--blocklist-type '.*'
+
+--allowlist-function blk_mq_rq_to_pdu
diff --git a/rust/bindings/lib.rs b/rust/bindings/lib.rs
index 93a1a3fc97bc9..63b915a8e4fbf 100644
--- a/rust/bindings/lib.rs
+++ b/rust/bindings/lib.rs
@@ -33,6 +33,10 @@ mod bindings_raw {
env!("OBJTREE"),
"/rust/bindings/bindings_generated.rs"
));
+ include!(concat!(
+ env!("OBJTREE"),
+ "/rust/bindings/bindings_generated_static.rs"
+ ));
}
// When both a directly exposed symbol and a helper exists for the same function,
diff --git a/rust/exports.c b/rust/exports.c
index e5695f3b45b7a..e4bd5b694beb2 100644
--- a/rust/exports.c
+++ b/rust/exports.c
@@ -19,6 +19,7 @@
#include "exports_alloc_generated.h"
#include "exports_helpers_generated.h"
#include "exports_bindings_generated.h"
+#include "exports_bindings_static_generated.h"
#include "exports_kernel_generated.h"
// For modules using `rust/build_error.rs`.
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 02/13] rust: helpers: Remove blk helper
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
2024-11-07 2:08 ` [PATCH 01/13] rust: bindings: Support some " Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 2:08 ` [PATCH 03/13] rust: helpers: Remove build_bug helper Alistair Francis
` (11 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helper.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 1 +
rust/helpers/blk.c | 14 --------------
rust/helpers/helpers.c | 1 -
3 files changed, 1 insertion(+), 15 deletions(-)
delete mode 100644 rust/helpers/blk.c
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index 1f24360daeb38..42e45ce342211 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -4,3 +4,4 @@
--blocklist-type '.*'
--allowlist-function blk_mq_rq_to_pdu
+--allowlist-function blk_mq_rq_from_pdu
diff --git a/rust/helpers/blk.c b/rust/helpers/blk.c
deleted file mode 100644
index cc9f4e6a2d234..0000000000000
--- a/rust/helpers/blk.c
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/blk-mq.h>
-#include <linux/blkdev.h>
-
-void *rust_helper_blk_mq_rq_to_pdu(struct request *rq)
-{
- return blk_mq_rq_to_pdu(rq);
-}
-
-struct request *rust_helper_blk_mq_rq_from_pdu(void *pdu)
-{
- return blk_mq_rq_from_pdu(pdu);
-}
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 30f40149f3a96..1df56294cad46 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -7,7 +7,6 @@
* Sorted alphabetically.
*/
-#include "blk.c"
#include "bug.c"
#include "build_assert.c"
#include "build_bug.c"
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 03/13] rust: helpers: Remove build_bug helper
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
2024-11-07 2:08 ` [PATCH 01/13] rust: bindings: Support some " Alistair Francis
2024-11-07 2:08 ` [PATCH 02/13] rust: helpers: Remove blk helper Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 13:46 ` kernel test robot
2024-11-07 2:08 ` [PATCH 04/13] rust: helpers: Remove err helper Alistair Francis
` (10 subsequent siblings)
13 siblings, 1 reply; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
This doesn't seem to be required.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/helpers/build_bug.c | 9 ---------
rust/helpers/helpers.c | 1 -
2 files changed, 10 deletions(-)
delete mode 100644 rust/helpers/build_bug.c
diff --git a/rust/helpers/build_bug.c b/rust/helpers/build_bug.c
deleted file mode 100644
index e994f7b5928c0..0000000000000
--- a/rust/helpers/build_bug.c
+++ /dev/null
@@ -1,9 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/export.h>
-#include <linux/errname.h>
-
-const char *rust_helper_errname(int err)
-{
- return errname(err);
-}
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 1df56294cad46..0f0c16c1e8149 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -9,7 +9,6 @@
#include "bug.c"
#include "build_assert.c"
-#include "build_bug.c"
#include "err.c"
#include "kunit.c"
#include "mutex.c"
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 04/13] rust: helpers: Remove err helper
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (2 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 03/13] rust: helpers: Remove build_bug helper Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 2:08 ` [PATCH 05/13] rust: helpers: Remove kunit helper Alistair Francis
` (9 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helper.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 4 ++++
rust/helpers/err.c | 19 -------------------
rust/helpers/helpers.c | 1 -
3 files changed, 4 insertions(+), 20 deletions(-)
delete mode 100644 rust/helpers/err.c
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index 42e45ce342211..0269efa83c618 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -5,3 +5,7 @@
--allowlist-function blk_mq_rq_to_pdu
--allowlist-function blk_mq_rq_from_pdu
+
+--allowlist-function ERR_PTR
+--allowlist-function IS_ERR
+--allowlist-function PTR_ERR
diff --git a/rust/helpers/err.c b/rust/helpers/err.c
deleted file mode 100644
index be3d45ef78a25..0000000000000
--- a/rust/helpers/err.c
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/err.h>
-#include <linux/export.h>
-
-__force void *rust_helper_ERR_PTR(long err)
-{
- return ERR_PTR(err);
-}
-
-bool rust_helper_IS_ERR(__force const void *ptr)
-{
- return IS_ERR(ptr);
-}
-
-long rust_helper_PTR_ERR(__force const void *ptr)
-{
- return PTR_ERR(ptr);
-}
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 0f0c16c1e8149..40e51daef412e 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -9,7 +9,6 @@
#include "bug.c"
#include "build_assert.c"
-#include "err.c"
#include "kunit.c"
#include "mutex.c"
#include "page.c"
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 05/13] rust: helpers: Remove kunit helper
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (3 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 04/13] rust: helpers: Remove err helper Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 2:08 ` [PATCH 06/13] rust: helpers: Remove mutex helper Alistair Francis
` (8 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helper.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 2 ++
rust/helpers/helpers.c | 1 -
rust/helpers/kunit.c | 9 ---------
3 files changed, 2 insertions(+), 10 deletions(-)
delete mode 100644 rust/helpers/kunit.c
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index 0269efa83c618..b4032d277e722 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -9,3 +9,5 @@
--allowlist-function ERR_PTR
--allowlist-function IS_ERR
--allowlist-function PTR_ERR
+
+--allowlist-function kunit_get_current_test
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 40e51daef412e..875e1fed81c24 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -9,7 +9,6 @@
#include "bug.c"
#include "build_assert.c"
-#include "kunit.c"
#include "mutex.c"
#include "page.c"
#include "rbtree.c"
diff --git a/rust/helpers/kunit.c b/rust/helpers/kunit.c
deleted file mode 100644
index 9d725067eb3bc..0000000000000
--- a/rust/helpers/kunit.c
+++ /dev/null
@@ -1,9 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <kunit/test-bug.h>
-#include <linux/export.h>
-
-struct kunit *rust_helper_kunit_get_current_test(void)
-{
- return kunit_get_current_test();
-}
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 06/13] rust: helpers: Remove mutex helper
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (4 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 05/13] rust: helpers: Remove kunit helper Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 11:20 ` kernel test robot
2024-11-07 2:08 ` [PATCH 07/13] rust: helpers: Remove some page helpers Alistair Francis
` (7 subsequent siblings)
13 siblings, 1 reply; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
This doesn't seem to be required at all.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/helpers/helpers.c | 1 -
rust/helpers/mutex.c | 15 ---------------
2 files changed, 16 deletions(-)
delete mode 100644 rust/helpers/mutex.c
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 875e1fed81c24..61ace53675c04 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -9,7 +9,6 @@
#include "bug.c"
#include "build_assert.c"
-#include "mutex.c"
#include "page.c"
#include "rbtree.c"
#include "refcount.c"
diff --git a/rust/helpers/mutex.c b/rust/helpers/mutex.c
deleted file mode 100644
index a17ca8cdb50ca..0000000000000
--- a/rust/helpers/mutex.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/export.h>
-#include <linux/mutex.h>
-
-void rust_helper_mutex_lock(struct mutex *lock)
-{
- mutex_lock(lock);
-}
-
-void rust_helper___mutex_init(struct mutex *mutex, const char *name,
- struct lock_class_key *key)
-{
- __mutex_init(mutex, name, key);
-}
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 07/13] rust: helpers: Remove some page helpers
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (5 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 06/13] rust: helpers: Remove mutex helper Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 2:08 ` [PATCH 08/13] rust: helpers: Remove rbtree helper Alistair Francis
` (6 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helpers.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 2 ++
rust/bindings/bindings_helper.h | 1 +
rust/helpers/page.c | 5 -----
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index b4032d277e722..ded5b816f3041 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -11,3 +11,5 @@
--allowlist-function PTR_ERR
--allowlist-function kunit_get_current_test
+
+--allowlist-function kmap_local_page
diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index ae82e9c941afa..084468123416e 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -13,6 +13,7 @@
#include <linux/errname.h>
#include <linux/ethtool.h>
#include <linux/firmware.h>
+#include <linux/highmem.h>
#include <linux/jiffies.h>
#include <linux/mdio.h>
#include <linux/phy.h>
diff --git a/rust/helpers/page.c b/rust/helpers/page.c
index b3f2b8fbf87fc..52ebec9d71868 100644
--- a/rust/helpers/page.c
+++ b/rust/helpers/page.c
@@ -8,11 +8,6 @@ struct page *rust_helper_alloc_pages(gfp_t gfp_mask, unsigned int order)
return alloc_pages(gfp_mask, order);
}
-void *rust_helper_kmap_local_page(struct page *page)
-{
- return kmap_local_page(page);
-}
-
void rust_helper_kunmap_local(const void *addr)
{
kunmap_local(addr);
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 08/13] rust: helpers: Remove rbtree helper
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (6 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 07/13] rust: helpers: Remove some page helpers Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 2:08 ` [PATCH 09/13] rust: helpers: Remove some refcount helpers Alistair Francis
` (5 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helper.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 2 ++
rust/bindings/bindings_helper.h | 1 +
rust/helpers/helpers.c | 1 -
rust/helpers/rbtree.c | 9 ---------
4 files changed, 3 insertions(+), 10 deletions(-)
delete mode 100644 rust/helpers/rbtree.c
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index ded5b816f3041..e464dc1f56820 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -13,3 +13,5 @@
--allowlist-function kunit_get_current_test
--allowlist-function kmap_local_page
+
+--allowlist-function rb_link_node
diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index 084468123416e..d389944186479 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -17,6 +17,7 @@
#include <linux/jiffies.h>
#include <linux/mdio.h>
#include <linux/phy.h>
+#include <linux/rbtree.h>
#include <linux/refcount.h>
#include <linux/sched.h>
#include <linux/slab.h>
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 61ace53675c04..7f9ffde471da3 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -10,7 +10,6 @@
#include "bug.c"
#include "build_assert.c"
#include "page.c"
-#include "rbtree.c"
#include "refcount.c"
#include "signal.c"
#include "slab.c"
diff --git a/rust/helpers/rbtree.c b/rust/helpers/rbtree.c
deleted file mode 100644
index 6d404b84a9b53..0000000000000
--- a/rust/helpers/rbtree.c
+++ /dev/null
@@ -1,9 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/rbtree.h>
-
-void rust_helper_rb_link_node(struct rb_node *node, struct rb_node *parent,
- struct rb_node **rb_link)
-{
- rb_link_node(node, parent, rb_link);
-}
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 09/13] rust: helpers: Remove some refcount helpers
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (7 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 08/13] rust: helpers: Remove rbtree helper Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 2:08 ` [PATCH 10/13] rust: helpers: Remove signal helper Alistair Francis
` (4 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helpers.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 3 +++
rust/helpers/refcount.c | 10 ----------
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index e464dc1f56820..9c40a867a64de 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -15,3 +15,6 @@
--allowlist-function kmap_local_page
--allowlist-function rb_link_node
+
+--allowlist-function refcount_inc
+--allowlist-function refcount_dec_and_test
diff --git a/rust/helpers/refcount.c b/rust/helpers/refcount.c
index f47afc148ec36..cebdeebcfd08a 100644
--- a/rust/helpers/refcount.c
+++ b/rust/helpers/refcount.c
@@ -7,13 +7,3 @@ refcount_t rust_helper_REFCOUNT_INIT(int n)
{
return (refcount_t)REFCOUNT_INIT(n);
}
-
-void rust_helper_refcount_inc(refcount_t *r)
-{
- refcount_inc(r);
-}
-
-bool rust_helper_refcount_dec_and_test(refcount_t *r)
-{
- return refcount_dec_and_test(r);
-}
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 10/13] rust: helpers: Remove signal helper
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (8 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 09/13] rust: helpers: Remove some refcount helpers Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 2:08 ` [PATCH 11/13] rust: helpers: Remove some spinlock helpers Alistair Francis
` (3 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helper.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 2 ++
rust/bindings/bindings_helper.h | 1 +
rust/helpers/helpers.c | 1 -
rust/helpers/signal.c | 9 ---------
4 files changed, 3 insertions(+), 10 deletions(-)
delete mode 100644 rust/helpers/signal.c
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index 9c40a867a64de..407dd091ddecd 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -18,3 +18,5 @@
--allowlist-function refcount_inc
--allowlist-function refcount_dec_and_test
+
+--allowlist-function signal_pending
diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index d389944186479..0c2964db04076 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -20,6 +20,7 @@
#include <linux/rbtree.h>
#include <linux/refcount.h>
#include <linux/sched.h>
+#include <linux/sched/signal.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 7f9ffde471da3..2af11499da454 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -11,7 +11,6 @@
#include "build_assert.c"
#include "page.c"
#include "refcount.c"
-#include "signal.c"
#include "slab.c"
#include "spinlock.c"
#include "task.c"
diff --git a/rust/helpers/signal.c b/rust/helpers/signal.c
deleted file mode 100644
index 63c407f80c26b..0000000000000
--- a/rust/helpers/signal.c
+++ /dev/null
@@ -1,9 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/export.h>
-#include <linux/sched/signal.h>
-
-int rust_helper_signal_pending(struct task_struct *t)
-{
- return signal_pending(t);
-}
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 11/13] rust: helpers: Remove some spinlock helpers
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (9 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 10/13] rust: helpers: Remove signal helper Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 2:08 ` [PATCH 12/13] rust: helpers: Remove some task helpers Alistair Francis
` (2 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helpers.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 3 +++
rust/helpers/spinlock.c | 10 ----------
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index 407dd091ddecd..0bbc358d03e61 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -20,3 +20,6 @@
--allowlist-function refcount_dec_and_test
--allowlist-function signal_pending
+
+--allowlist-function spin_lock
+--allowlist-function spin_unlock
diff --git a/rust/helpers/spinlock.c b/rust/helpers/spinlock.c
index acc1376b833c7..fe85d6fd66016 100644
--- a/rust/helpers/spinlock.c
+++ b/rust/helpers/spinlock.c
@@ -12,13 +12,3 @@ void rust_helper___spin_lock_init(spinlock_t *lock, const char *name,
spin_lock_init(lock);
#endif
}
-
-void rust_helper_spin_lock(spinlock_t *lock)
-{
- spin_lock(lock);
-}
-
-void rust_helper_spin_unlock(spinlock_t *lock)
-{
- spin_unlock(lock);
-}
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 12/13] rust: helpers: Remove some task helpers
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (10 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 11/13] rust: helpers: Remove some spinlock helpers Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 2:08 ` [PATCH 13/13] rust: helpers: Remove uaccess helpers Alistair Francis
2024-11-07 7:01 ` [PATCH 00/13] rust: bindings: Auto-generate inline static functions Dirk Behme
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helpers.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 3 +++
rust/bindings/bindings_helper.h | 1 +
rust/helpers/task.c | 10 ----------
3 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index 0bbc358d03e61..396e2eac88e5c 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -23,3 +23,6 @@
--allowlist-function spin_lock
--allowlist-function spin_unlock
+
+--allowlist-function get_task_struct
+--allowlist-function put_task_struct
diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index 0c2964db04076..1d1d921fd55e9 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -21,6 +21,7 @@
#include <linux/refcount.h>
#include <linux/sched.h>
#include <linux/sched/signal.h>
+#include <linux/sched/task.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
diff --git a/rust/helpers/task.c b/rust/helpers/task.c
index 7ac789232d11c..a3feb47a6c73f 100644
--- a/rust/helpers/task.c
+++ b/rust/helpers/task.c
@@ -7,13 +7,3 @@ struct task_struct *rust_helper_get_current(void)
{
return current;
}
-
-void rust_helper_get_task_struct(struct task_struct *t)
-{
- get_task_struct(t);
-}
-
-void rust_helper_put_task_struct(struct task_struct *t)
-{
- put_task_struct(t);
-}
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 13/13] rust: helpers: Remove uaccess helpers
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (11 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 12/13] rust: helpers: Remove some task helpers Alistair Francis
@ 2024-11-07 2:08 ` Alistair Francis
2024-11-07 7:01 ` [PATCH 00/13] rust: bindings: Auto-generate inline static functions Dirk Behme
13 siblings, 0 replies; 18+ messages in thread
From: Alistair Francis @ 2024-11-07 2:08 UTC (permalink / raw)
To: alex.gaynor, benno.lossin, gary, linux-kernel, ojeda,
rust-for-linux, bjorn3_gh, alistair.francis, me, a.hindborg,
tmgross, boqun.feng, aliceryhl
Cc: alistair23
Now that we support wrap-static-fns we no longer need the custom helper.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
rust/bindgen_static_functions | 3 +++
rust/bindings/bindings_helper.h | 1 +
rust/helpers/helpers.c | 6 ++----
rust/helpers/uaccess.c | 15 ---------------
4 files changed, 6 insertions(+), 19 deletions(-)
delete mode 100644 rust/helpers/uaccess.c
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index 396e2eac88e5c..4807fecb2f192 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -26,3 +26,6 @@
--allowlist-function get_task_struct
--allowlist-function put_task_struct
+
+--allowlist-function copy_from_user
+--allowlist-function copy_to_user
diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index 1d1d921fd55e9..600ac0046a95f 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -23,6 +23,7 @@
#include <linux/sched/signal.h>
#include <linux/sched/task.h>
#include <linux/slab.h>
+#include <linux/uaccess.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 2af11499da454..e4e42e0ef946a 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
- * Non-trivial C macros cannot be used in Rust. Similarly, inlined C functions
- * cannot be called either. This file explicitly creates functions ("helpers")
- * that wrap those so that they can be called from Rust.
+ * Non-trivial C macros cannot be used in Rust. This file explicitly creates
+ * functions ("helpers") that wrap those so that they can be called from Rust.
*
* Sorted alphabetically.
*/
@@ -14,6 +13,5 @@
#include "slab.c"
#include "spinlock.c"
#include "task.c"
-#include "uaccess.c"
#include "wait.c"
#include "workqueue.c"
diff --git a/rust/helpers/uaccess.c b/rust/helpers/uaccess.c
deleted file mode 100644
index f49076f813cd6..0000000000000
--- a/rust/helpers/uaccess.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/uaccess.h>
-
-unsigned long rust_helper_copy_from_user(void *to, const void __user *from,
- unsigned long n)
-{
- return copy_from_user(to, from, n);
-}
-
-unsigned long rust_helper_copy_to_user(void __user *to, const void *from,
- unsigned long n)
-{
- return copy_to_user(to, from, n);
-}
--
2.47.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 00/13] rust: bindings: Auto-generate inline static functions
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
` (12 preceding siblings ...)
2024-11-07 2:08 ` [PATCH 13/13] rust: helpers: Remove uaccess helpers Alistair Francis
@ 2024-11-07 7:01 ` Dirk Behme
13 siblings, 0 replies; 18+ messages in thread
From: Dirk Behme @ 2024-11-07 7:01 UTC (permalink / raw)
To: Alistair Francis, alex.gaynor, benno.lossin, gary, linux-kernel,
ojeda, rust-for-linux, bjorn3_gh, alistair.francis, me,
a.hindborg, tmgross, boqun.feng, aliceryhl
On 07.11.2024 03:08, Alistair Francis wrote:
> The kernel includes a large number of static inline functions that are
> defined in header files. One example is the crypto_shash_descsize()
> function which is defined in hash.h as
>
> ```
> static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm)
> {
> return tfm->descsize;
> }
> ```
>
> bindgen is currently unable to generate bindings to these functions as
> they are not publically exposed (they are static after all).
>
> The Rust code currently uses rust_helper_* functions, such as
> rust_helper_alloc_pages() for example to call the static inline
> functions. But this is a hassle as someone needs to write a C helper
> function.
>
> Instead we can use the bindgen wrap-static-fns feature. The feature
> is marked as experimental, but has recently been promoted to
> non-experimental (dependig on your version of bindgen).
>
> By supporting wrap-static-fns we automatically generate a C file called
> extern.c that exposes the static inline functions, for example like this
>
> ```
> unsigned int crypto_shash_descsize__extern(struct crypto_shash *tfm) { return crypto_shash_descsize(tfm); }
> ```
>
> The nice part is that this is auto-generated.
>
> We then also get a bindings_generate_static.rs file with the Rust
> binding, like this
>
> ```
> extern "C" {
> #[link_name = "crypto_shash_descsize__extern"]
> pub fn crypto_shash_descsize(tfm: *mut crypto_shash) -> core::ffi::c_uint;
> }
> ```
>
> So now we can use the static inline functions just like normal
> functions.
>
> There are a bunch of static inline functions that don't work though, because
> the C compiler fails to build extern.c:
> * functions with inline asm generate "operand probably does not match constraints"
> errors (rip_rel_ptr() for example)
> * functions with bit masks (u32_encode_bits() and friends) result in
> "call to ‘__bad_mask’ declared with attribute error: bad bitfield mask"
> errors
>
> As well as that any static inline function that calls a function that has been
> kconfig-ed out will fail to link as the function being called isn't built
> (mdio45_ethtool_gset_npage for example)
>
> Due to these failures we use a allow-list system (where functions must
> be manually enabled).
>
> This series adds support for bindgen generating wrappers for inline statics and
> then converts the existing helper functions to this new method. This doesn't
> work for C macros, so we can't reamove all of the helper functions, but we
> can remove most.
Maybe this should be re-done against rust-next which at least contains
https://github.com/Rust-for-Linux/linux/commit/d4d7c05f9656fd8e14c6977a54986264eb296ec8
which seems to conflict with the removal of some helpers file in this
series.
Thanks!
Dirk
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 01/13] rust: bindings: Support some inline static functions
2024-11-07 2:08 ` [PATCH 01/13] rust: bindings: Support some " Alistair Francis
@ 2024-11-07 9:25 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2024-11-07 9:25 UTC (permalink / raw)
To: Alistair Francis, alex.gaynor, benno.lossin, gary, linux-kernel,
ojeda, rust-for-linux, bjorn3_gh, alistair.francis, me,
a.hindborg, tmgross, boqun.feng, aliceryhl
Cc: llvm, oe-kbuild-all, alistair23
Hi Alistair,
kernel test robot noticed the following build errors:
[auto build test ERROR on v6.12-rc6]
[also build test ERROR on linus/master]
[cannot apply to rust/rust-next next-20241106]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Alistair-Francis/rust-bindings-Support-some-inline-static-functions/20241107-101321
base: v6.12-rc6
patch link: https://lore.kernel.org/r/20241107020831.1561063-2-alistair.francis%40wdc.com
patch subject: [PATCH 01/13] rust: bindings: Support some inline static functions
config: arm64-randconfig-003-20241107 (https://download.01.org/0day-ci/archive/20241107/202411071741.ceQcuasR-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241107/202411071741.ceQcuasR-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411071741.ceQcuasR-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from arch/arm64/kernel/asm-offsets.c:12:
In file included from include/linux/ftrace.h:13:
In file included from include/linux/kallsyms.h:13:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
In file included from rust/helpers/helpers.c:10:
In file included from rust/helpers/blk.c:3:
In file included from include/linux/blk-mq.h:5:
In file included from include/linux/blkdev.h:9:
In file included from include/linux/blk_types.h:10:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:8:
In file included from include/linux/cacheflush.h:5:
In file included from arch/arm64/include/asm/cacheflush.h:11:
In file included from include/linux/kgdb.h:19:
In file included from include/linux/kprobes.h:28:
In file included from include/linux/ftrace.h:13:
In file included from include/linux/kallsyms.h:13:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
>> rust/extern.c:1:10: fatal error: 'bindings/bindings_helper.h' file not found
1 | #include "bindings/bindings_helper.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [scripts/Makefile.build:229: rust/extern.o] Error 1 shuffle=940008358
make[3]: Target 'rust/' not remade because of errors.
make[2]: *** [Makefile:1209: prepare] Error 2 shuffle=940008358
make[1]: *** [Makefile:224: __sub-make] Error 2 shuffle=940008358
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:224: __sub-make] Error 2 shuffle=940008358
make: Target 'prepare' not remade because of errors.
vim +1 rust/extern.c
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 06/13] rust: helpers: Remove mutex helper
2024-11-07 2:08 ` [PATCH 06/13] rust: helpers: Remove mutex helper Alistair Francis
@ 2024-11-07 11:20 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2024-11-07 11:20 UTC (permalink / raw)
To: Alistair Francis, alex.gaynor, benno.lossin, gary, linux-kernel,
ojeda, rust-for-linux, bjorn3_gh, alistair.francis, me,
a.hindborg, tmgross, boqun.feng, aliceryhl
Cc: llvm, oe-kbuild-all, alistair23
Hi Alistair,
kernel test robot noticed the following build errors:
[auto build test ERROR on v6.12-rc6]
[also build test ERROR on linus/master]
[cannot apply to rust/rust-next next-20241106]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Alistair-Francis/rust-bindings-Support-some-inline-static-functions/20241107-101321
base: v6.12-rc6
patch link: https://lore.kernel.org/r/20241107020831.1561063-7-alistair.francis%40wdc.com
patch subject: [PATCH 06/13] rust: helpers: Remove mutex helper
config: arm64-randconfig-003-20241107 (https://download.01.org/0day-ci/archive/20241107/202411071903.OV35vZIP-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241107/202411071903.OV35vZIP-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411071903.OV35vZIP-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from arch/arm64/kernel/asm-offsets.c:12:
In file included from include/linux/ftrace.h:13:
In file included from include/linux/kallsyms.h:13:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
In file included from rust/helpers/helpers.c:12:
In file included from rust/helpers/page.c:4:
In file included from include/linux/highmem.h:8:
In file included from include/linux/cacheflush.h:5:
In file included from arch/arm64/include/asm/cacheflush.h:11:
In file included from include/linux/kgdb.h:19:
In file included from include/linux/kprobes.h:28:
In file included from include/linux/ftrace.h:13:
In file included from include/linux/kallsyms.h:13:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
rust/extern.c:1:10: fatal error: 'bindings/bindings_helper.h' file not found
1 | #include "bindings/bindings_helper.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [scripts/Makefile.build:229: rust/extern.o] Error 1 shuffle=940008358
>> error[E0425]: cannot find function `mutex_lock` in crate `bindings`
--> rust/kernel/sync/lock/mutex.rs:110:28
|
110 | unsafe { bindings::mutex_lock(ptr) };
| ^^^^^^^^^^ help: a function with a similar name exists: `mutex_unlock`
|
::: rust/bindings/bindings_generated.rs:24140:5
|
24140 | pub fn mutex_unlock(lock: *mut mutex);
| ------------------------------------- similarly named function `mutex_unlock` defined here
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 03/13] rust: helpers: Remove build_bug helper
2024-11-07 2:08 ` [PATCH 03/13] rust: helpers: Remove build_bug helper Alistair Francis
@ 2024-11-07 13:46 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2024-11-07 13:46 UTC (permalink / raw)
To: Alistair Francis, alex.gaynor, benno.lossin, gary, linux-kernel,
ojeda, rust-for-linux, bjorn3_gh, alistair.francis, me,
a.hindborg, tmgross, boqun.feng, aliceryhl
Cc: llvm, oe-kbuild-all, alistair23
Hi Alistair,
kernel test robot noticed the following build errors:
[auto build test ERROR on v6.12-rc6]
[also build test ERROR on linus/master]
[cannot apply to rust/rust-next next-20241107]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Alistair-Francis/rust-bindings-Support-some-inline-static-functions/20241107-101321
base: v6.12-rc6
patch link: https://lore.kernel.org/r/20241107020831.1561063-4-alistair.francis%40wdc.com
patch subject: [PATCH 03/13] rust: helpers: Remove build_bug helper
config: um-randconfig-001-20241107 (https://download.01.org/0day-ci/archive/20241107/202411072158.bzyWKRAM-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241107/202411072158.bzyWKRAM-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411072158.bzyWKRAM-lkp@intel.com/
All errors (new ones prefixed by >>):
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from rust/helpers/helpers.c:15:
In file included from rust/helpers/page.c:4:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from arch/um/include/asm/hardirq.h:5:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
693 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
701 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
709 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
718 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
727 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
736 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
13 warnings generated.
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
clang diag: include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
clang diag: include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
rust/extern.c:1:10: fatal error: 'bindings/bindings_helper.h' file not found
1 | #include "bindings/bindings_helper.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [scripts/Makefile.build:229: rust/extern.o] Error 1 shuffle=3582132138
>> error[E0425]: cannot find function `errname` in crate `bindings`
--> rust/kernel/error.rs:149:38
|
149 | let ptr = unsafe { bindings::errname(-self.0) };
| ^^^^^^^ not found in `bindings`
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2024-11-07 13:47 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 2:08 [PATCH 00/13] rust: bindings: Auto-generate inline static functions Alistair Francis
2024-11-07 2:08 ` [PATCH 01/13] rust: bindings: Support some " Alistair Francis
2024-11-07 9:25 ` kernel test robot
2024-11-07 2:08 ` [PATCH 02/13] rust: helpers: Remove blk helper Alistair Francis
2024-11-07 2:08 ` [PATCH 03/13] rust: helpers: Remove build_bug helper Alistair Francis
2024-11-07 13:46 ` kernel test robot
2024-11-07 2:08 ` [PATCH 04/13] rust: helpers: Remove err helper Alistair Francis
2024-11-07 2:08 ` [PATCH 05/13] rust: helpers: Remove kunit helper Alistair Francis
2024-11-07 2:08 ` [PATCH 06/13] rust: helpers: Remove mutex helper Alistair Francis
2024-11-07 11:20 ` kernel test robot
2024-11-07 2:08 ` [PATCH 07/13] rust: helpers: Remove some page helpers Alistair Francis
2024-11-07 2:08 ` [PATCH 08/13] rust: helpers: Remove rbtree helper Alistair Francis
2024-11-07 2:08 ` [PATCH 09/13] rust: helpers: Remove some refcount helpers Alistair Francis
2024-11-07 2:08 ` [PATCH 10/13] rust: helpers: Remove signal helper Alistair Francis
2024-11-07 2:08 ` [PATCH 11/13] rust: helpers: Remove some spinlock helpers Alistair Francis
2024-11-07 2:08 ` [PATCH 12/13] rust: helpers: Remove some task helpers Alistair Francis
2024-11-07 2:08 ` [PATCH 13/13] rust: helpers: Remove uaccess helpers Alistair Francis
2024-11-07 7:01 ` [PATCH 00/13] rust: bindings: Auto-generate inline static functions Dirk Behme
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).