Skip to contentSkip to conversation

virtio-net: new section mismatch warning. revert patch?

PATCH Applied Michael S. Tsirkin 5 participants 5 messages Nov 4, 2009 – Nov 5, 2009

Subsystems (3)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

With v2.6.32-rcX I started getting section mismatch warnings for virtio_net.
make with CONFIG_DEBUG_SECTION_MISMATCH=y shows:

WARNING: drivers/net/virtio_net.o(.data+0x90): Section mismatch in reference from the variable virtio_net to the function .devexit.text:virtnet_remove()
The variable virtio_net references
the function __devexit virtnet_remove()
If the reference is valid then annotate the
variable with __exit* (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

virtnet_remove was converted to devexit by this commit:

	commit 3d1285beff2e8467b8c3884d83b7a91a99aa9fcd
	Author: Uwe Kleine-König <[email protected]>
	Date:   Wed Sep 30 22:28:34 2009 +0000

	    move virtnet_remove to .devexit.text

We didn't have these warnings in v2.6.31, so this is a regression. revert?

Signature · 1 line
MST
#1 lore raw
Quoted 15 lines · Michael S. Tsirkin

With v2.6.32-rcX I started getting section mismatch warnings for virtio_net.
make with CONFIG_DEBUG_SECTION_MISMATCH=y shows:

WARNING: drivers/net/virtio_net.o(.data+0x90): Section mismatch in reference from the variable virtio_net to the function .devexit.text:virtnet_remove()
The variable virtio_net references
the function __devexit virtnet_remove()
If the reference is valid then annotate the
variable with __exit* (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

virtnet_remove was converted to devexit by this commit:

Quoted 8 lines
	commit 3d1285beff2e8467b8c3884d83b7a91a99aa9fcd
	Author: Uwe Kleine-König <[email protected]>
	Date:   Wed Sep 30 22:28:34 2009 +0000

	    move virtnet_remove to .devexit.text

We didn't have these warnings in v2.6.31, so this is a regression. revert?

It is correct to annotate the exit function __devexit. So we should try to silence modpost in other ways.

Two options:
1) annotate the virtio_net variable with __ref to tell it is allowed to reference __init, __exit annotated stuff.
2) Rename virtio_net to virtio_net_driver

This is not a "my machine no longer works" issue but it would be nice to have it sorted out one way or the other before next -rc.

Sam

#2 lore raw
In reply to Michael S. Tsirkin
Quoted 15 lines · Michael S. Tsirkin

With v2.6.32-rcX I started getting section mismatch warnings for virtio_net.
make with CONFIG_DEBUG_SECTION_MISMATCH=y shows:

WARNING: drivers/net/virtio_net.o(.data+0x90): Section mismatch in reference from the variable virtio_net to the function .devexit.text:virtnet_remove()
The variable virtio_net references
the function __devexit virtnet_remove()
If the reference is valid then annotate the
variable with __exit* (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

virtnet_remove was converted to devexit by this commit:

Quoted 8 lines
	commit 3d1285beff2e8467b8c3884d83b7a91a99aa9fcd
	Author: Uwe Kleine-König <[email protected]>
	Date:   Wed Sep 30 22:28:34 2009 +0000

	    move virtnet_remove to .devexit.text

We didn't have these warnings in v2.6.31, so this is a regression. revert?

No, just rename "virtio_net" to "virtio_net_driver". Meanwhile, ignore it. It's worked well for me so far.

Uwe: I apologize for accepting your patches. I will be more careful in future.

Cheers,
Rusty.

#3 lore raw

PATCH 1/1 virtio_net: rename driver struct to please modpost

Commit

3d1285b (move virtnet_remove to .devexit.text)

introduced the first reference to __devexit in struct virtio_driver virtio_net which upset modpost ("Section mismatch in reference from the variable virtio_net to the function .devexit.text:virtnet_remove()").

Fix this by renaming virtio_net to virtio_net_driver.

---
Hello,

@Rusty: IMHO there's no need to apologize. The driver was enhanced by 3d1285b and I consider it OK not to notice the (false) section warning. (But if you think it was you who took my first patch, then you forgot to add you S-o-b which is a worse trespass :-)

Best regards
Uwe

 drivers/net/virtio_net.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/virtio_net.c +3 -3
index 05630f2..b9e002f 100644
@@ -998,7 +998,7 @@ static unsigned int features[] = {
 	VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN,
 };
 
-static struct virtio_driver virtio_net = {
+static struct virtio_driver virtio_net_driver = {
 	.feature_table = features,
 	.feature_table_size = ARRAY_SIZE(features),
 	.driver.name =	KBUILD_MODNAME,
@@ -1011,12 +1011,12 @@ static struct virtio_driver virtio_net = {
 
 static int __init init(void)
 {
-	return register_virtio_driver(&virtio_net);
+	return register_virtio_driver(&virtio_net_driver);
 }
 
 static void __exit fini(void)
 {
-	unregister_virtio_driver(&virtio_net);
+	unregister_virtio_driver(&virtio_net_driver);
 }
 module_init(init);
 module_exit(fini);
Signature · 1 line
1.6.5.2
maintainer Applied
#4 lore raw

Re: [PATCH] virtio_net: rename driver struct to please modpost

From: Uwe Kleine-König <[email protected]>
Date: Thu, 5 Nov 2009 09:17:17 +0100

Quoted 8 lines

Commit

3d1285b (move virtnet_remove to .devexit.text)

introduced the first reference to __devexit in struct virtio_driver virtio_net which upset modpost ("Section mismatch in reference from the variable virtio_net to the function .devexit.text:virtnet_remove()").

Quoted 5 lines

Fix this by renaming virtio_net to virtio_net_driver.

Applied, thanks.