Skip to contentSkip to conversation

kbuild: do not sort after reading modules.order

PATCH In review Masahiro Yamada 2 participants 4 messages Dec 11, 2022 – Dec 13, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: do not sort after reading modules.order

modules.order lists modules in the deterministic order (that is why "modules order"), and there is no duplication in the list.

$(sort ) is pointless.

---

 scripts/Makefile.modfinal | 2 +-
 scripts/Makefile.modinst  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.modfinal +1 -1
index 25bedd83644b..4705d32388f3 100644
@@ -13,7 +13,7 @@ include $(srctree)/scripts/Kbuild.include
 include $(srctree)/scripts/Makefile.lib
 
 # find all modules listed in modules.order
-modules := $(sort $(shell cat $(MODORDER)))
+modules := $(shell cat $(MODORDER))
 
 __modfinal: $(modules)
 	@:
scripts/Makefile.modinst +1 -1
index a4c987c23750..f4cff42069ad 100644
@@ -9,7 +9,7 @@ __modinst:
 include include/config/auto.conf
 include $(srctree)/scripts/Kbuild.include
 
-modules := $(sort $(shell cat $(MODORDER)))
+modules := $(shell cat $(MODORDER))
 
 ifeq ($(KBUILD_EXTMOD),)
 dst := $(MODLIB)/kernel
Signature · 1 line
2.34.1
#1 lore raw
Quoted 2 lines · Masahiro Yamada

modules.order lists modules in the deterministic order (that is why "modules order"), and there is no duplication in the list.

Isn't a subdirectory's modules.order just created by concatenation of $(obj-m) (w/ respect to mentioned subdirs)? Thus, "no duplication" seems to be true, as long as there is no obj-m containing duplicated entries. Do we ensure unique entries in obj-m only?

Kind regards,
Nicolas

Quoted 38 lines

$(sort ) is pointless.

---

 scripts/Makefile.modfinal | 2 +-
 scripts/Makefile.modinst  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.modfinal +1 -1
index 25bedd83644b..4705d32388f3 100644
@@ -13,7 +13,7 @@ include $(srctree)/scripts/Kbuild.include
 include $(srctree)/scripts/Makefile.lib
 
 # find all modules listed in modules.order
-modules := $(sort $(shell cat $(MODORDER)))
+modules := $(shell cat $(MODORDER))
 
 __modfinal: $(modules)
 	@:
scripts/Makefile.modinst +1 -1
index a4c987c23750..f4cff42069ad 100644
@@ -9,7 +9,7 @@ __modinst:
 include include/config/auto.conf
 include $(srctree)/scripts/Kbuild.include
 
-modules := $(sort $(shell cat $(MODORDER)))
+modules := $(shell cat $(MODORDER))
 
 ifeq ($(KBUILD_EXTMOD),)
 dst := $(MODLIB)/kernel
Signature · 1 line
2.34.1
Signature · 3 lines
epost|xmpp: [email protected]          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --
#2 lore raw
Quoted 7 lines · Nicolas Schier
Quoted 2 lines · Masahiro Yamada

modules.order lists modules in the deterministic order (that is why "modules order"), and there is no duplication in the list.

Isn't a subdirectory's modules.order just created by concatenation of $(obj-m) (w/ respect to mentioned subdirs)?

Not $(obj-m) directly.

The magic is $^, which is a deduplicated list
of prerequisites.

Quoted 3 lines

Thus, "no duplication" seems to be true, as long as there is no obj-m containing duplicated entries. Do we ensure unique entries in obj-m only?

The entries in modules.order must be unique.
Moreover, the basename of modules must be unique.

scripts/modules-check.sh is a stronger check.

You might be interested in these commits:

d724b578a1f746db6fc1fd5e4cbba554a855dc8d
3a48a91901c516a46a3406ea576798538a8d94d2

Quoted 47 lines

Kind regards,
Nicolas

Quoted 37 lines

$(sort ) is pointless.

---

 scripts/Makefile.modfinal | 2 +-
 scripts/Makefile.modinst  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.modfinal +1 -1
index 25bedd83644b..4705d32388f3 100644
@@ -13,7 +13,7 @@ include $(srctree)/scripts/Kbuild.include
 include $(srctree)/scripts/Makefile.lib
 
 # find all modules listed in modules.order
-modules := $(sort $(shell cat $(MODORDER)))
+modules := $(shell cat $(MODORDER))
 
 __modfinal: $(modules)
      @:
scripts/Makefile.modinst +1 -2
index a4c987c23750..f4cff42069ad 100644
@@ -9,7 +9,7 @@ __modinst:
 include include/config/auto.conf
 include $(srctree)/scripts/Kbuild.include
 
-modules := $(sort $(shell cat $(MODORDER)))
+modules := $(shell cat $(MODORDER))
 
 ifeq ($(KBUILD_EXTMOD),)
 dst := $(MODLIB)/kernel
--
Quoted 1 line

2.34.1

--
epost|xmpp: [email protected] irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f
-- frykten for herren er opphav til kunnskap --

Signature · 2 lines
Best Regards
Masahiro Yamada
Reviewed-by
#3 lore raw
Quoted 23 lines · On Tue, Dec 13, 2022 at 03:41:36PM +0900 Masahiro Yamada wrote:
Quoted 7 lines · Nicolas Schier
Quoted 2 lines · Masahiro Yamada

modules.order lists modules in the deterministic order (that is why "modules order"), and there is no duplication in the list.

Isn't a subdirectory's modules.order just created by concatenation of $(obj-m) (w/ respect to mentioned subdirs)?

Not $(obj-m) directly.

The magic is $^, which is a deduplicated list
of prerequisites.

Quoted 3 lines

Thus, "no duplication" seems to be true, as long as there is no obj-m containing duplicated entries. Do we ensure unique entries in obj-m only?

The entries in modules.order must be unique.
Moreover, the basename of modules must be unique.

Quoted 7 lines

scripts/modules-check.sh is a stronger check.

You might be interested in these commits:

d724b578a1f746db6fc1fd5e4cbba554a855dc8d
3a48a91901c516a46a3406ea576798538a8d94d2

ah, thanks!

Quoted 49 lines
Quoted 43 lines
Quoted 37 lines

$(sort ) is pointless.

---

 scripts/Makefile.modfinal | 2 +-
 scripts/Makefile.modinst  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.modfinal +1 -1
index 25bedd83644b..4705d32388f3 100644
@@ -13,7 +13,7 @@ include $(srctree)/scripts/Kbuild.include
 include $(srctree)/scripts/Makefile.lib
 
 # find all modules listed in modules.order
-modules := $(sort $(shell cat $(MODORDER)))
+modules := $(shell cat $(MODORDER))
 
 __modfinal: $(modules)
      @:
scripts/Makefile.modinst +1 -2
index a4c987c23750..f4cff42069ad 100644
@@ -9,7 +9,7 @@ __modinst:
 include include/config/auto.conf
 include $(srctree)/scripts/Kbuild.include
 
-modules := $(sort $(shell cat $(MODORDER)))
+modules := $(shell cat $(MODORDER))
 
 ifeq ($(KBUILD_EXTMOD),)
 dst := $(MODLIB)/kernel
--
Quoted 1 line

2.34.1

--
epost|xmpp: [email protected] irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f
-- frykten for herren er opphav til kunnskap --

Signature · 2 lines
Best Regards
Masahiro Yamada
Signature · 3 lines
epost|xmpp: [email protected]          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --