* [PATCH 0/4] remap non-modular uses of module_init properly
@ 2014-01-13 16:21 Paul Gortmaker
2014-01-13 16:21 ` [PATCH 1/4] powerpc: use device_initcall for registering rtc devices Paul Gortmaker
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Paul Gortmaker @ 2014-01-13 16:21 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras; +Cc: Paul Gortmaker, linuxppc-dev
The goal is to move module_init/module_exit from init.h and into
module.h -- however in doing so, we uncover several instances in
powerpc code where module_init is used somewhat incorrectly by
non modular code, and a file that needs module.h but isn't sourcing
it. We need to make these fixups 1st before changing the headers
so that we don't cause build failures.
The changes are largely inert, however we do cause a largely trivial
change in the initcall ordering -- that happens because module_init
is really device_initcall; and yet we shouldn't be using device_initcall
where clearly arch_initcall or subsys_initcall are more appropriate.
Boot tested on sbc8548 on powerpc next branch of today.
Paul Gortmaker (4):
powerpc: use device_initcall for registering rtc devices
powerpc: book3s kvm can be modular so it should use module.h
powerpc: use subsys_initcall for Freescale Local Bus
powerpc: don't use module_init for non-modular core hugetlb code
arch/powerpc/kernel/time.c | 2 +-
arch/powerpc/kvm/book3s.c | 2 +-
arch/powerpc/mm/hugetlbpage.c | 2 +-
arch/powerpc/platforms/ps3/time.c | 3 +--
arch/powerpc/sysdev/fsl_lbc.c | 2 +-
5 files changed, 5 insertions(+), 6 deletions(-)
--
1.8.5.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] powerpc: use device_initcall for registering rtc devices
2014-01-13 16:21 [PATCH 0/4] remap non-modular uses of module_init properly Paul Gortmaker
@ 2014-01-13 16:21 ` Paul Gortmaker
2014-01-13 16:21 ` [PATCH 2/4] powerpc: book3s kvm can be modular so it should use module.h Paul Gortmaker
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Paul Gortmaker @ 2014-01-13 16:21 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras; +Cc: Paul Gortmaker, linuxppc-dev
Currently these two RTC devices are in core platform code
where it is not possible for them to be modular. It will
never be modular, so using module_init as an alias for
__initcall can be somewhat misleading.
Fix this up now, so that we can relocate module_init from
init.h into module.h in the future. If we don't do this, we'd
have to add module.h to obviously non-modular code, and that
would be a worse thing.
Note that direct use of __initcall is discouraged, vs. one
of the priority categorized subgroups. As __initcall gets
mapped onto device_initcall, our use of device_initcall
directly in this change means that the runtime impact is
zero -- they will remain at level 6 in initcall ordering.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
arch/powerpc/kernel/time.c | 2 +-
arch/powerpc/platforms/ps3/time.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index afb1b56ef4fa..bee2bb2bbc75 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1053,4 +1053,4 @@ static int __init rtc_init(void)
return PTR_ERR_OR_ZERO(pdev);
}
-module_init(rtc_init);
+device_initcall(rtc_init);
diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
index ce73ce865613..791c6142c4a7 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -92,5 +92,4 @@ static int __init ps3_rtc_init(void)
return PTR_ERR_OR_ZERO(pdev);
}
-
-module_init(ps3_rtc_init);
+device_initcall(ps3_rtc_init);
--
1.8.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] powerpc: book3s kvm can be modular so it should use module.h
2014-01-13 16:21 [PATCH 0/4] remap non-modular uses of module_init properly Paul Gortmaker
2014-01-13 16:21 ` [PATCH 1/4] powerpc: use device_initcall for registering rtc devices Paul Gortmaker
@ 2014-01-13 16:21 ` Paul Gortmaker
2014-01-13 16:21 ` [PATCH 3/4] powerpc: use subsys_initcall for Freescale Local Bus Paul Gortmaker
2014-01-13 16:21 ` [PATCH 4/4] powerpc: don't use module_init for non-modular core hugetlb code Paul Gortmaker
3 siblings, 0 replies; 6+ messages in thread
From: Paul Gortmaker @ 2014-01-13 16:21 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras; +Cc: Paul Gortmaker, linuxppc-dev
KVM support is tristate, so this file should be including
module.h instead of export.h -- it only works currently because
module_init is currently (mis)placed in init.h -- but we are
intending to clean that up and relocate it to module.h
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
arch/powerpc/kvm/book3s.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 8912608b7e1b..279459e8a072 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -16,7 +16,7 @@
#include <linux/kvm_host.h>
#include <linux/err.h>
-#include <linux/export.h>
+#include <linux/module.h>
#include <linux/slab.h>
#include <asm/reg.h>
--
1.8.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] powerpc: use subsys_initcall for Freescale Local Bus
2014-01-13 16:21 [PATCH 0/4] remap non-modular uses of module_init properly Paul Gortmaker
2014-01-13 16:21 ` [PATCH 1/4] powerpc: use device_initcall for registering rtc devices Paul Gortmaker
2014-01-13 16:21 ` [PATCH 2/4] powerpc: book3s kvm can be modular so it should use module.h Paul Gortmaker
@ 2014-01-13 16:21 ` Paul Gortmaker
2014-01-14 22:56 ` Scott Wood
2014-01-13 16:21 ` [PATCH 4/4] powerpc: don't use module_init for non-modular core hugetlb code Paul Gortmaker
3 siblings, 1 reply; 6+ messages in thread
From: Paul Gortmaker @ 2014-01-13 16:21 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras; +Cc: Paul Gortmaker, linuxppc-dev
The FSL_SOC option is bool, and hence this code is either
present or absent. It will never be modular, so using
module_init as an alias for __initcall is rather misleading.
Fix this up now, so that we can relocate module_init from
init.h into module.h in the future. If we don't do this, we'd
have to add module.h to obviously non-modular code, and that
would be a worse thing.
Note that direct use of __initcall is discouraged, vs. one
of the priority categorized subgroups. As __initcall gets
mapped onto device_initcall, our use of subsys_initcall (which
makes sense for bus code) will thus change this registration
from level 6-device to level 4-subsys (i.e. slightly earlier).
However no observable impact of that small difference has
been observed during testing, or is expected.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
arch/powerpc/sysdev/fsl_lbc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index 6bc5a546d49f..9f00e5f84abe 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -388,4 +388,4 @@ static int __init fsl_lbc_init(void)
{
return platform_driver_register(&fsl_lbc_ctrl_driver);
}
-module_init(fsl_lbc_init);
+subsys_initcall(fsl_lbc_init);
--
1.8.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] powerpc: don't use module_init for non-modular core hugetlb code
2014-01-13 16:21 [PATCH 0/4] remap non-modular uses of module_init properly Paul Gortmaker
` (2 preceding siblings ...)
2014-01-13 16:21 ` [PATCH 3/4] powerpc: use subsys_initcall for Freescale Local Bus Paul Gortmaker
@ 2014-01-13 16:21 ` Paul Gortmaker
3 siblings, 0 replies; 6+ messages in thread
From: Paul Gortmaker @ 2014-01-13 16:21 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras; +Cc: Paul Gortmaker, linuxppc-dev
The hugetlbpage.o is obj-y (always built in). It will never
be modular, so using module_init as an alias for __initcall is
somewhat misleading.
Fix this up now, so that we can relocate module_init from
init.h into module.h in the future. If we don't do this, we'd
have to add module.h to obviously non-modular code, and that
would be a worse thing.
Note that direct use of __initcall is discouraged, vs. one
of the priority categorized subgroups. As __initcall gets
mapped onto device_initcall, our use of arch_initcall (which
makes sense for arch code) will thus change this registration
from level 6-device to level 3-arch (i.e. slightly earlier).
However no observable impact of that small difference has
been observed during testing, or is expected.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
arch/powerpc/mm/hugetlbpage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 90bb6d9409bf..d25c202420da 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -911,7 +911,7 @@ static int __init hugetlbpage_init(void)
return 0;
}
#endif
-module_init(hugetlbpage_init);
+arch_initcall(hugetlbpage_init);
void flush_dcache_icache_hugepage(struct page *page)
{
--
1.8.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/4] powerpc: use subsys_initcall for Freescale Local Bus
2014-01-13 16:21 ` [PATCH 3/4] powerpc: use subsys_initcall for Freescale Local Bus Paul Gortmaker
@ 2014-01-14 22:56 ` Scott Wood
0 siblings, 0 replies; 6+ messages in thread
From: Scott Wood @ 2014-01-14 22:56 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: Paul Mackerras, linuxppc-dev
On Mon, 2014-01-13 at 11:21 -0500, Paul Gortmaker wrote:
> The FSL_SOC option is bool, and hence this code is either
> present or absent. It will never be modular, so using
> module_init as an alias for __initcall is rather misleading.
>
> Fix this up now, so that we can relocate module_init from
> init.h into module.h in the future. If we don't do this, we'd
> have to add module.h to obviously non-modular code, and that
> would be a worse thing.
>
> Note that direct use of __initcall is discouraged, vs. one
> of the priority categorized subgroups. As __initcall gets
> mapped onto device_initcall, our use of subsys_initcall (which
> makes sense for bus code) will thus change this registration
> from level 6-device to level 4-subsys (i.e. slightly earlier).
> However no observable impact of that small difference has
> been observed during testing, or is expected.
>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
> arch/powerpc/sysdev/fsl_lbc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
> index 6bc5a546d49f..9f00e5f84abe 100644
> --- a/arch/powerpc/sysdev/fsl_lbc.c
> +++ b/arch/powerpc/sysdev/fsl_lbc.c
> @@ -388,4 +388,4 @@ static int __init fsl_lbc_init(void)
> {
> return platform_driver_register(&fsl_lbc_ctrl_driver);
> }
> -module_init(fsl_lbc_init);
> +subsys_initcall(fsl_lbc_init);
Acked-by: Scott Wood <scottwood@freescale.com>
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-01-14 22:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 16:21 [PATCH 0/4] remap non-modular uses of module_init properly Paul Gortmaker
2014-01-13 16:21 ` [PATCH 1/4] powerpc: use device_initcall for registering rtc devices Paul Gortmaker
2014-01-13 16:21 ` [PATCH 2/4] powerpc: book3s kvm can be modular so it should use module.h Paul Gortmaker
2014-01-13 16:21 ` [PATCH 3/4] powerpc: use subsys_initcall for Freescale Local Bus Paul Gortmaker
2014-01-14 22:56 ` Scott Wood
2014-01-13 16:21 ` [PATCH 4/4] powerpc: don't use module_init for non-modular core hugetlb code Paul Gortmaker
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).