2021-07-11 22:32:51

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH 0/6 v2] treewide: rename 'mod_init' & 'mod_exit' functions to be module-specific

There are multiple (16) modules which use a module_init() function
with the name 'mod_init' and a module_exit() function with the name
'mod_exit'. This can lead to confusion or ambiguity when reading
crashes/oops/bugs etc. and when reading an initcall_debug log.

Example 1: (System.map file)

ffffffff83446d10 t mod_init
ffffffff83446d18 t mod_init
ffffffff83446d20 t mod_init
...
ffffffff83454665 t mod_init
ffffffff834548a4 t mod_init
ffffffff83454a53 t mod_init
...
ffffffff8345bd42 t mod_init
...
ffffffff8345c916 t mod_init
ffffffff8345c92a t mod_init
ffffffff8345c93e t mod_init
ffffffff8345c952 t mod_init
ffffffff8345c966 t mod_init
...
ffffffff834672c9 t mod_init

Example 2: (boot log when using 'initcall_debug')

[ 0.252157] initcall mod_init+0x0/0x8 returned 0 after 0 usecs
[ 0.252180] initcall mod_init+0x0/0x8 returned 0 after 0 usecs
[ 0.252202] initcall mod_init+0x0/0x8 returned 0 after 0 usecs
...
[ 0.892907] initcall mod_init+0x0/0x23f returned -19 after 104 usecs
[ 0.913788] initcall mod_init+0x0/0x1af returned -19 after 9 usecs
[ 0.934353] initcall mod_init+0x0/0x49 returned -19 after 0 usecs
...
[ 1.454870] initcall mod_init+0x0/0x66 returned 0 after 72 usecs
...
[ 1.455527] initcall mod_init+0x0/0x14 returned 0 after 0 usecs
[ 1.455531] initcall mod_init+0x0/0x14 returned 0 after 0 usecs
[ 1.455536] initcall mod_init+0x0/0x14 returned 0 after 0 usecs
[ 1.455541] initcall mod_init+0x0/0x14 returned 0 after 0 usecs
[ 1.455545] initcall mod_init+0x0/0x52 returned 0 after 0 usecs
...
[ 1.588162] initcall mod_init+0x0/0xef returned 0 after 45 usecs


v2: wireguard: changes per Jason
arm/crypto/curve25519-glue: add Russell's Acked-by

Cc: Jason A. Donenfeld <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: Arnd Bergmann <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Andres Salomon <[email protected]>
Cc: [email protected]
Cc: Matt Mackall <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: [email protected]
Cc: Christian Gromm <[email protected]>
Cc: Krzysztof Halasa <[email protected]>
Cc: [email protected]
Cc: "David S. Miller" <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Martin Schiller <[email protected]>
Cc: [email protected]
Cc: [email protected]

[PATCH 1/6 v2] arm: crypto: rename 'mod_init' & 'mod_exit' functions to be module-specific
[PATCH 2/6 v2] hw_random: rename 'mod_init' & 'mod_exit' functions to be module-specific
[PATCH 3/6 v2] lib: crypto: rename 'mod_init' & 'mod_exit' functions to be module-specific
[PATCH 4/6 v2] MOST: cdev: rename 'mod_init' & 'mod_exit' functions to be module-specific
[PATCH 5/6 v2] net: hdlc: rename 'mod_init' & 'mod_exit' functions to be module-specific
[PATCH 6/6 v2] net: wireguard: rename 'mod_init' & 'mod_exit' functions to be module-specific

arch/arm/crypto/curve25519-glue.c | 8 ++++----
drivers/char/hw_random/amd-rng.c | 8 ++++----
drivers/char/hw_random/geode-rng.c | 8 ++++----
drivers/char/hw_random/intel-rng.c | 8 ++++----
drivers/char/hw_random/via-rng.c | 8 ++++----
drivers/most/most_cdev.c | 8 ++++----
drivers/net/wan/hdlc_cisco.c | 8 ++++----
drivers/net/wan/hdlc_fr.c | 8 ++++----
drivers/net/wan/hdlc_ppp.c | 8 ++++----
drivers/net/wan/hdlc_raw.c | 8 ++++----
drivers/net/wan/hdlc_raw_eth.c | 8 ++++----
drivers/net/wan/hdlc_x25.c | 8 ++++----
drivers/net/wireguard/main.c | 8 ++++----
lib/crypto/blake2s.c | 8 ++++----
lib/crypto/chacha20poly1305.c | 8 ++++----
lib/crypto/curve25519.c | 8 ++++----
16 files changed, 64 insertions(+), 64 deletions(-)


2021-07-11 22:32:51

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH 1/6 v2] arm: crypto: rename 'mod_init' & 'mod_exit' functions to be module-specific

Rename module_init & module_exit functions that are named
"mod_init" and "mod_exit" so that they are unique in both the
System.map file and in initcall_debug output instead of showing
up as almost anonymous "mod_init".

This is helpful for debugging and in determining how long certain
module_init calls take to execute.

Signed-off-by: Randy Dunlap <[email protected]>
Cc: Jason A. Donenfeld <[email protected]>
Cc: [email protected]
Cc: [email protected]
Acked-by: Russell King (Oracle) <[email protected]>
---
KernelVersion: v5.13

v2: add KernelVersion: info for the armlinux patch daemon;
add Russell's Ack;

arch/arm/crypto/curve25519-glue.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

--- linux-next-20210708.orig/arch/arm/crypto/curve25519-glue.c
+++ linux-next-20210708/arch/arm/crypto/curve25519-glue.c
@@ -112,7 +112,7 @@ static struct kpp_alg curve25519_alg = {
.max_size = curve25519_max_size,
};

-static int __init mod_init(void)
+static int __init arm_curve25519_init(void)
{
if (elf_hwcap & HWCAP_NEON) {
static_branch_enable(&have_neon);
@@ -122,14 +122,14 @@ static int __init mod_init(void)
return 0;
}

-static void __exit mod_exit(void)
+static void __exit arm_curve25519_exit(void)
{
if (IS_REACHABLE(CONFIG_CRYPTO_KPP) && elf_hwcap & HWCAP_NEON)
crypto_unregister_kpp(&curve25519_alg);
}

-module_init(mod_init);
-module_exit(mod_exit);
+module_init(arm_curve25519_init);
+module_exit(arm_curve25519_exit);

MODULE_ALIAS_CRYPTO("curve25519");
MODULE_ALIAS_CRYPTO("curve25519-neon");