Skip to contentSkip to conversation

Section mismatch fixes

PATCH In review Jeff Mahoney 6 participants 14 messages Jan 13, 2010 – Jan 14, 2010

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover Section mismatch fixes

This series fixes section mismatch warnings in 2.6.33-rc3-git5.

-Jeff

#1 lore raw

PATCH 2/6 hugetlb: Fix section mismatches

hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with __init. Since hugetlb_register_node is only called by hugetlb_register_all_nodes, which in turn is only called by hugetlb_init, it's safe to mark both of them as __init.

---
 mm/hugetlb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/hugetlb.c +2 -2
@@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
  * hugetlb module exit:  unregister hstate attributes from node sysdevs
  * that have them.
  */
-static void hugetlb_unregister_all_nodes(void)
+static void __init hugetlb_unregister_all_nodes(void)
 {
 	int nid;
 
@@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
  * Register hstate attributes for a single node sysdev.
  * No-op if attributes already registered.
  */
-void hugetlb_register_node(struct node *node)
+void __init hugetlb_register_node(struct node *node)
 {
 	struct hstate *h;
 	struct node_hstate *nhs = &node_hstates[node->sysdev.id];

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw

Re: [patch 2/6] hugetlb: Fix section mismatches

Quoted 13 lines · Jeff Mahoney

hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with __init. Since hugetlb_register_node is only called by hugetlb_register_all_nodes, which in turn is only called by hugetlb_init, it's safe to mark both of them as __init.

---
 mm/hugetlb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

mm/hugetlb.c void hugetlb_unregister_node(struct node · line 1636

Quoted 8 lines
mm/hugetlb.c +1 -1
@@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
  * hugetlb module exit:  unregister hstate attributes from node sysdevs
  * that have them.
  */
-static void hugetlb_unregister_all_nodes(void)
+static void __init hugetlb_unregister_all_nodes(void)
 {
 	int nid;
 

This is wrong, you want to move hugetlb_register_all_nodes() to .init.text, not hugetlb_unregister_all_nodes().

mm/hugetlb.c static void hugetlb_unregister_all_nodes · line 1656

Quoted 9 lines
mm/hugetlb.c +1 -1
@@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
  * Register hstate attributes for a single node sysdev.
  * No-op if attributes already registered.
  */
-void hugetlb_register_node(struct node *node)
+void __init hugetlb_register_node(struct node *node)
 {
 	struct hstate *h;
 	struct node_hstate *nhs = &node_hstates[node->sysdev.id];

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

Re: [patch 2/6] hugetlb: Fix section mismatches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 12 lines · David Rientjes
Quoted 10 lines · Jeff Mahoney

hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with __init. Since hugetlb_register_node is only called by hugetlb_register_all_nodes, which in turn is only called by hugetlb_init, it's safe to mark both of them as __init.

---
 mm/hugetlb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 14 lines

mm/hugetlb.c void hugetlb_unregister_node(struct node · line 1636

Quoted 11 lines
mm/hugetlb.c +1 -1
@@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
  * hugetlb module exit:  unregister hstate attributes from node sysdevs
  * that have them.
  */
-static void hugetlb_unregister_all_nodes(void)
+static void __init hugetlb_unregister_all_nodes(void)
 {
 	int nid;
 

This is wrong, you want to move hugetlb_register_all_nodes() to .init.text, not hugetlb_unregister_all_nodes().

Yep. You're right. I had this correct in my initial version of the patch but accidentally deleted it while renaming them. I'll re-send.

- -Jeff

Quoted 9 lines

mm/hugetlb.c static void hugetlb_unregister_all_nodes · line 1656

Quoted 9 lines
mm/hugetlb.c +1 -1
@@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
  * Register hstate attributes for a single node sysdev.
  * No-op if attributes already registered.
  */
-void hugetlb_register_node(struct node *node)
+void __init hugetlb_register_node(struct node *node)
 {
 	struct hstate *h;
 	struct node_hstate *nhs = &node_hstates[node->sysdev.id];

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAktN2NsACgkQLPWxlyuTD7LWzACcDpwbTkDEaZpdHUOYBiFqj0xP 9NkAnjoySOmUkV45P8yaMK6Z7N8xWnvn
=dTst
-----END PGP SIGNATURE-----

#4 lore raw

PATCH 1/1 hugetlb: Fix section mismatches #2

In reply to David Rientjes

hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with __init. Since hugetlb_register_node is only called by hugetlb_register_all_nodes, which in turn is only called by hugetlb_init, it's safe to mark both of them as __init.

---
 mm/hugetlb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/hugetlb.c +2 -2
@@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
  * Register hstate attributes for a single node sysdev.
  * No-op if attributes already registered.
  */
-void hugetlb_register_node(struct node *node)
+void __init hugetlb_register_node(struct node *node)
 {
 	struct hstate *h;
 	struct node_hstate *nhs = &node_hstates[node->sysdev.id];
@@ -1683,7 +1683,7 @@ void hugetlb_register_node(struct node *
  * sysdevs of nodes that have memory.  All on-line nodes should have
  * registered their associated sysdev by this time.
  */
-static void hugetlb_register_all_nodes(void)
+static void __init hugetlb_register_all_nodes(void)
 {
 	int nid;
 
Signature · 2 lines
Jeff Mahoney
SUSE Labs
Acked-by on v1 1/1
#5 lore raw

Re: [patch] hugetlb: Fix section mismatches #2

Quoted 6 lines · Jeff Mahoney

hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with __init. Since hugetlb_register_node is only called by hugetlb_register_all_nodes, which in turn is only called by hugetlb_init, it's safe to mark both of them as __init.

#6 lore raw

Re: [patch 2/6] hugetlb: Fix section mismatches

In reply to Jeff Mahoney
Quoted 5 lines · Jeff Mahoney

plain text document attachment (patches.rpmify) hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with
__init. Since hugetlb_register_node is only called by hugetlb_register_all_nodes, which in turn is only called by hugetlb_init, it's safe to mark both of them as __init.

Actually, hugetlb_register_node() also called, via a function pointer that hugetlb registers with the sysfs node driver, when a node is hot plugged. So, I think the correct approach is to remove the '__init' from hugetlb_sysfs_add_hstate() as this is also used at runtime. I missed this in the original submittal.

Regards,
Lee Schermerhorn

Quoted 29 lines
---
 mm/hugetlb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/hugetlb.c +2 -3
@@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
  * hugetlb module exit:  unregister hstate attributes from node sysdevs
  * that have them.
  */
-static void hugetlb_unregister_all_nodes(void)
+static void __init hugetlb_unregister_all_nodes(void)
 {
 	int nid;
 
@@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
  * Register hstate attributes for a single node sysdev.
  * No-op if attributes already registered.
  */
-void hugetlb_register_node(struct node *node)
+void __init hugetlb_register_node(struct node *node)
 {
 	struct hstate *h;
 	struct node_hstate *nhs = &node_hstates[node->sysdev.id];
 
 
--
Quoted 4 lines

To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#7 lore raw

Re: [patch 2/6] hugetlb: Fix section mismatches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · Lee Schermerhorn
Quoted 5 lines · Jeff Mahoney

plain text document attachment (patches.rpmify) hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with
__init. Since hugetlb_register_node is only called by hugetlb_register_all_nodes, which in turn is only called by hugetlb_init, it's safe to mark both of them as __init.

Quoted 5 lines

Actually, hugetlb_register_node() also called, via a function pointer that hugetlb registers with the sysfs node driver, when a node is hot plugged. So, I think the correct approach is to remove the '__init' from hugetlb_sysfs_add_hstate() as this is also used at runtime. I missed this in the original submittal.

Yep. You're right. Sorry for the noise.

- -Jeff

Quoted 31 lines

Regards,
Lee Schermerhorn

Quoted 28 lines
---
 mm/hugetlb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/hugetlb.c +2 -2
@@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
  * hugetlb module exit:  unregister hstate attributes from node sysdevs
  * that have them.
  */
-static void hugetlb_unregister_all_nodes(void)
+static void __init hugetlb_unregister_all_nodes(void)
 {
 	int nid;
 
@@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
  * Register hstate attributes for a single node sysdev.
  * No-op if attributes already registered.
  */
-void hugetlb_register_node(struct node *node)
+void __init hugetlb_register_node(struct node *node)
 {
 	struct hstate *h;
 	struct node_hstate *nhs = &node_hstates[node->sysdev.id];
Quoted 6 lines
Quoted 5 lines

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAktN6dYACgkQLPWxlyuTD7JzEgCfXZKyPnW9VKO7OTatSm5k5WSI l6sAoIVB0cTvz1AwN2mG7ANGPt6VVuTi
=TYGp
-----END PGP SIGNATURE-----

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#8 lore raw

PATCH 4/6 acpi: Fix section mismatch

In reply to Jeff Mahoney

acpi_early_processor_set_pdc uses processor_idle_dmi_table, which is marked __cpuinitdata. It's only called by acpi_bus_init, which is __init. We mark it __cpuinit.

---
 drivers/acpi/processor_pdc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/processor_pdc.c +1 -1
@@ -151,7 +151,7 @@ early_init_pdc(acpi_handle handle, u32 l
 	return AE_OK;
 }
 
-void acpi_early_processor_set_pdc(void)
+void __cpuinit acpi_early_processor_set_pdc(void)
 {
 	/*
 	 * Check whether the system is DMI table. If yes, OSPM
#9 lore raw

Re: [patch 4/6] acpi: Fix section mismatch

Tony Luck already sent a patch for this to Len Brown (which I acked).

Thanks,
/ac

* Jeff Mahoney <[email protected]>:

Quoted 22 lines

acpi_early_processor_set_pdc uses processor_idle_dmi_table, which is marked __cpuinitdata. It's only called by acpi_bus_init, which is __init. We mark it __cpuinit.

---
 drivers/acpi/processor_pdc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/processor_pdc.c +1 -1
@@ -151,7 +151,7 @@ early_init_pdc(acpi_handle handle, u32 l
 	return AE_OK;
 }
 
-void acpi_early_processor_set_pdc(void)
+void __cpuinit acpi_early_processor_set_pdc(void)
 {
 	/*
 	 * Check whether the system is DMI table. If yes, OSPM
#10 lore raw

PATCH 6/6 virtio: fix section mismatch warnings

In reply to Jeff Mahoney

This patch fixes the following warnings by renaming the driver structures to be suffixed with _driver.

WARNING: drivers/virtio/virtio_balloon.o(.data+0x88): Section mismatch in reference from the variable virtio_balloon to the function .devexit.text:virtballoon_remove()

WARNING: drivers/char/hw_random/virtio-rng.o(.data+0x88): Section mismatch in reference from the variable virtio_rng to the function .devexit.text:virtrng_remove()

---
 drivers/char/hw_random/virtio-rng.c |    6 +++---
 drivers/virtio/virtio_balloon.c     |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/char/hw_random/virtio-rng.c +3 -3
@@ -114,7 +114,7 @@ static struct virtio_device_id id_table[
 	{ 0 },
 };
 
-static struct virtio_driver virtio_rng = {
+static struct virtio_driver virtio_rng_driver = {
 	.driver.name =	KBUILD_MODNAME,
 	.driver.owner =	THIS_MODULE,
 	.id_table =	id_table,
@@ -124,12 +124,12 @@ static struct virtio_driver virtio_rng =
 
 static int __init init(void)
 {
-	return register_virtio_driver(&virtio_rng);
+	return register_virtio_driver(&virtio_rng_driver);
 }
 
 static void __exit fini(void)
 {
-	unregister_virtio_driver(&virtio_rng);
+	unregister_virtio_driver(&virtio_rng_driver);
 }
 module_init(init);
 module_exit(fini);
drivers/virtio/virtio_balloon.c +3 -3
@@ -266,7 +266,7 @@ static void __devexit virtballoon_remove
 
 static unsigned int features[] = { VIRTIO_BALLOON_F_MUST_TELL_HOST };
 
-static struct virtio_driver virtio_balloon = {
+static struct virtio_driver virtio_balloon_driver = {
 	.feature_table = features,
 	.feature_table_size = ARRAY_SIZE(features),
 	.driver.name =	KBUILD_MODNAME,
@@ -279,12 +279,12 @@ static struct virtio_driver virtio_ballo
 
 static int __init init(void)
 {
-	return register_virtio_driver(&virtio_balloon);
+	return register_virtio_driver(&virtio_balloon_driver);
 }
 
 static void __exit fini(void)
 {
-	unregister_virtio_driver(&virtio_balloon);
+	unregister_virtio_driver(&virtio_balloon_driver);
 }
 module_init(init);
 module_exit(fini);
Acked-by on v1 6/6
#11 lore raw

Re: [patch 6/6] virtio: fix section mismatch warnings

Quoted 8 lines · Jeff Mahoney

This patch fixes the following warnings by renaming the driver structures to be suffixed with _driver.

WARNING: drivers/virtio/virtio_balloon.o(.data+0x88): Section mismatch in reference from the variable virtio_balloon to the function .devexit.text:virtballoon_remove()

WARNING: drivers/char/hw_random/virtio-rng.o(.data+0x88): Section mismatch in reference from the variable virtio_rng to the function .devexit.text:virtrng_remove()

Andrew, will you take these?

Thanks,
Rusty.

maintainer
#12 lore raw

Re: [patch 6/6] virtio: fix section mismatch warnings

Quoted 6 lines · On Wed, 13 Jan 2010 21:27:26 +1030 Rusty Russell <[email protected]> wrote:
Quoted 5 lines · Jeff Mahoney

This patch fixes the following warnings by renaming the driver structures to be suffixed with _driver.

WARNING: drivers/virtio/virtio_balloon.o(.data+0x88): Section mismatch in reference from the variable virtio_balloon to the function .devexit.text:virtballoon_remove()

Quoted 8 lines
Quoted 3 lines

WARNING: drivers/char/hw_random/virtio-rng.o(.data+0x88): Section mismatch in reference from the variable virtio_rng to the function .devexit.text:virtrng_remove()

Andrew, will you take these?

umm, sure. But I wish I knew how the patch worked. Is there some magic sauce which moves a variable called foo_driver into a different section or what?

And if so, what was I doing when that got done :(

#13 lore raw

Re: [patch 6/6] virtio: fix section mismatch warnings

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 15 lines · Andrew Morton
Quoted 12 lines · On Wed, 13 Jan 2010 21:27:26 +1030 Rusty Russell <[email protected]> wrote:
Quoted 8 lines · Jeff Mahoney

This patch fixes the following warnings by renaming the driver structures to be suffixed with _driver.

WARNING: drivers/virtio/virtio_balloon.o(.data+0x88): Section mismatch in reference from the variable virtio_balloon to the function .devexit.text:virtballoon_remove()

WARNING: drivers/char/hw_random/virtio-rng.o(.data+0x88): Section mismatch in reference from the variable virtio_rng to the function .devexit.text:virtrng_remove()

Quoted 8 lines
Quoted 2 lines

Andrew, will you take these?

umm, sure. But I wish I knew how the patch worked. Is there some magic sauce which moves a variable called foo_driver into a different section or what?

And if so, what was I doing when that got done :(

It doesn't move it into a different section, it just shuts the warning up. modpost has a whitelist it uses to ignore the mismatch warning.

- -Jeff

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAktOewsACgkQLPWxlyuTD7IGKgCfSETonDGCsM/AgsUmdGtvSzCi omQAn3tMc0Ol6PkpaX0Qf6+tvcUnlqcU
=jUja
-----END PGP SIGNATURE-----