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

View: New views
4 Messages — Rating Filter:   Alert me  

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

by Michael S. Tsirkin-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <u.kleine-koenig@...>
        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?

--
MST
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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

by Sam Ravnborg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 04, 2009 at 04:17:30PM +0200, Michael S. Tsirkin wrote:

> 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 <u.kleine-koenig@...>
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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

by Rusty Russell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 5 Nov 2009 12:47:30 am Michael S. Tsirkin wrote:

> 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 <u.kleine-koenig@...>
> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[PATCH] virtio_net: rename driver struct to please modpost

by Uwe Kleine-König-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...>
Reported-by: Michael S. Tsirkin <mst@...>
Blame-taken-by: Rusty Russell <rusty@...>
Cc: Sam Ravnborg <sam@...>
Cc: David S. Miller <davem@...>
Cc: Alex Williamson <alex.williamson@...>
Cc: Mark McLoughlin <markmc@...>
Cc: netdev@...
---
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(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 05630f2..b9e002f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -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);
--
1.6.5.2


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/