netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dccp: remove module exit functions
@ 2006-11-10  8:48 James Morris
  2006-11-10 13:55 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: James Morris @ 2006-11-10  8:48 UTC (permalink / raw)
  To: acme; +Cc: netdev

The dccp ipv4 & ipv6 modules cannot be unloaded, as their control sockets 
each maintain a couple of module references.  So, it seems like a good 
idea to just remove the module exit functions completely.

Please review.

Signed-off-by: James Morris <jmorris@namei.org>

---

 net/dccp/ipv4.c |    8 --------
 net/dccp/ipv6.c |    8 --------
 2 files changed, 16 deletions(-)

diff -purN -X dontdiff linux-2.6.o/net/dccp/ipv4.c linux-2.6.w/net/dccp/ipv4.c
--- linux-2.6.o/net/dccp/ipv4.c	2006-10-27 01:52:53.000000000 -0400
+++ linux-2.6.w/net/dccp/ipv4.c	2006-11-10 03:10:34.000000000 -0500
@@ -1135,15 +1135,7 @@ out_proto_unregister:
 	goto out;
 }
 
-static void __exit dccp_v4_exit(void)
-{
-	inet_unregister_protosw(&dccp_v4_protosw);
-	inet_del_protocol(&dccp_v4_protocol, IPPROTO_DCCP);
-	proto_unregister(&dccp_v4_prot);
-}
-
 module_init(dccp_v4_init);
-module_exit(dccp_v4_exit);
 
 /*
  * __stringify doesn't likes enums, so use SOCK_DCCP (6) and IPPROTO_DCCP (33)
diff -purN -X dontdiff linux-2.6.o/net/dccp/ipv6.c linux-2.6.w/net/dccp/ipv6.c
--- linux-2.6.o/net/dccp/ipv6.c	2006-10-27 01:52:53.000000000 -0400
+++ linux-2.6.w/net/dccp/ipv6.c	2006-11-10 03:10:42.000000000 -0500
@@ -1276,15 +1276,7 @@ out_unregister_proto:
 	goto out;
 }
 
-static void __exit dccp_v6_exit(void)
-{
-	inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
-	inet6_unregister_protosw(&dccp_v6_protosw);
-	proto_unregister(&dccp_v6_prot);
-}
-
 module_init(dccp_v6_init);
-module_exit(dccp_v6_exit);
 
 /*
  * __stringify doesn't likes enums, so use SOCK_DCCP (6) and IPPROTO_DCCP (33)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dccp: remove module exit functions
  2006-11-10  8:48 [PATCH] dccp: remove module exit functions James Morris
@ 2006-11-10 13:55 ` Arnaldo Carvalho de Melo
  2006-11-10 16:24   ` James Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2006-11-10 13:55 UTC (permalink / raw)
  To: James Morris; +Cc: netdev, dccp (vger)

On 11/10/06, James Morris <jmorris@namei.org> wrote:
> The dccp ipv4 & ipv6 modules cannot be unloaded, as their control sockets
> each maintain a couple of module references.  So, it seems like a good
> idea to just remove the module exit functions completely.
>
> Please review.

Well, I have a patch in the DCCP backlog that uses it, ressurecting
the unload hack, for development purposes being able to destroy the
control sockets allowing module removal is something the DCCP
developers want :)

- Arnaldo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dccp: remove module exit functions
  2006-11-10 13:55 ` Arnaldo Carvalho de Melo
@ 2006-11-10 16:24   ` James Morris
  2006-11-10 16:27     ` James Morris
  0 siblings, 1 reply; 8+ messages in thread
From: James Morris @ 2006-11-10 16:24 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: netdev, dccp (vger)

On Fri, 10 Nov 2006, Arnaldo Carvalho de Melo wrote:

> On 11/10/06, James Morris <jmorris@namei.org> wrote:
> > The dccp ipv4 & ipv6 modules cannot be unloaded, as their control sockets
> > each maintain a couple of module references.  So, it seems like a good
> > idea to just remove the module exit functions completely.
> > 
> > Please review.
> 
> Well, I have a patch in the DCCP backlog that uses it, ressurecting
> the unload hack, for development purposes being able to destroy the
> control sockets allowing module removal is something the DCCP
> developers want :)

I wonder if this facility can be integrated more generally into the kernel 
protocol which people are developing.

Where is the patch you use?



- James
-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dccp: remove module exit functions
  2006-11-10 16:24   ` James Morris
@ 2006-11-10 16:27     ` James Morris
  2006-11-10 18:32       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: James Morris @ 2006-11-10 16:27 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: netdev, dccp (vger)

On Fri, 10 Nov 2006, James Morris wrote:

> I wonder if this facility can be integrated more generally into the kernel 
> protocol which people are developing.

Ugh, editor screwup.  That was meant to be 

I wonder if this facility can be integrated more generally into the kernel 
as a kernel hacking option, as this is not the only protocol which people 
are developing.



> 
> Where is the patch you use?
> 
> 
> 
> - James
> 

-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dccp: remove module exit functions
  2006-11-10 16:27     ` James Morris
@ 2006-11-10 18:32       ` Arnaldo Carvalho de Melo
  2006-11-13 13:41         ` Gerrit Renker
  2006-11-14  0:49         ` David Miller
  0 siblings, 2 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2006-11-10 18:32 UTC (permalink / raw)
  To: James Morris; +Cc: netdev, dccp (vger)

On 11/10/06, James Morris <jmorris@namei.org> wrote:
> On Fri, 10 Nov 2006, James Morris wrote:
>
> > I wonder if this facility can be integrated more generally into the kernel
> > protocol which people are developing.
>
> Ugh, editor screwup.  That was meant to be
>
> I wonder if this facility can be integrated more generally into the kernel
> as a kernel hacking option, as this is not the only protocol which people
> are developing.
>

See:
http://www.erg.abdn.ac.uk/users/gerrit/dccp/patch-backlog/09a_release_ctl_socket_at_exit.diff

This one requires a bit more thinking, so I'm postponing it for now to
get the simple bits in Gerrit's patch queue cherrypicked and sent for
Dave.

- Arnaldo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dccp: remove module exit functions
  2006-11-10 18:32       ` Arnaldo Carvalho de Melo
@ 2006-11-13 13:41         ` Gerrit Renker
  2006-11-14  0:49         ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: Gerrit Renker @ 2006-11-13 13:41 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: James Morris, netdev, dccp (vger)

Quoting Arnaldo Carvalho de Melo:
|  On 11/10/06, James Morris <jmorris@namei.org> wrote:

|  > I wonder if this facility can be integrated more generally into the kernel
|  > as a kernel hacking option, as this is not the only protocol which people
|  > are developing.
|  >
|  
|  See:
|  http://www.erg.abdn.ac.uk/users/gerrit/dccp/patch-backlog/09a_release_ctl_socket_at_exit.diff
|  
|  This one requires a bit more thinking, so I'm postponing it for now to
|  get the simple bits in Gerrit's patch queue cherrypicked and sent for

There is a similar problem in sctp and so it would indeed be useful to have a (configuration)
option. Without the `unload hack' there is no module unloading and that is very bad, especially
since DCCP development is likely to continue (there is no single consistent, full DCCP implementation
yet, so testing will be one prime activity).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dccp: remove module exit functions
  2006-11-10 18:32       ` Arnaldo Carvalho de Melo
  2006-11-13 13:41         ` Gerrit Renker
@ 2006-11-14  0:49         ` David Miller
  2006-11-14 14:11           ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 8+ messages in thread
From: David Miller @ 2006-11-14  0:49 UTC (permalink / raw)
  To: arnaldo.melo; +Cc: jmorris, netdev, dccp

From: "Arnaldo Carvalho de Melo" <arnaldo.melo@gmail.com>
Date: Fri, 10 Nov 2006 16:32:16 -0200

> On 11/10/06, James Morris <jmorris@namei.org> wrote:
> > On Fri, 10 Nov 2006, James Morris wrote:
> >
> > > I wonder if this facility can be integrated more generally into the kernel
> > > protocol which people are developing.
> >
> > Ugh, editor screwup.  That was meant to be
> >
> > I wonder if this facility can be integrated more generally into the kernel
> > as a kernel hacking option, as this is not the only protocol which people
> > are developing.
> >
> 
> See:
> http://www.erg.abdn.ac.uk/users/gerrit/dccp/patch-backlog/09a_release_ctl_socket_at_exit.diff
> 
> This one requires a bit more thinking, so I'm postponing it for now to
> get the simple bits in Gerrit's patch queue cherrypicked and sent for
> Dave.

One possible way to handle this is to flag certain sockets such that
no refrence counting is done for them against the module.  It is
an indication that the module will take care of such sockets on
cleanup.

It seems that this would limit the cost to a test at socket create
and destroy time.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] dccp: remove module exit functions
  2006-11-14  0:49         ` David Miller
@ 2006-11-14 14:11           ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2006-11-14 14:11 UTC (permalink / raw)
  To: David Miller; +Cc: jmorris, netdev, dccp, Gerrit Renker

On 11/13/06, David Miller <davem@davemloft.net> wrote:
> From: "Arnaldo Carvalho de Melo" <arnaldo.melo@gmail.com>
> Date: Fri, 10 Nov 2006 16:32:16 -0200
>
> > On 11/10/06, James Morris <jmorris@namei.org> wrote:
> > > On Fri, 10 Nov 2006, James Morris wrote:
> > >
> > > > I wonder if this facility can be integrated more generally into the kernel
> > > > protocol which people are developing.
> > >
> > > Ugh, editor screwup.  That was meant to be
> > >
> > > I wonder if this facility can be integrated more generally into the kernel
> > > as a kernel hacking option, as this is not the only protocol which people
> > > are developing.
> > >
> >
> > See:
> > http://www.erg.abdn.ac.uk/users/gerrit/dccp/patch-backlog/09a_release_ctl_socket_at_exit.diff
> >
> > This one requires a bit more thinking, so I'm postponing it for now to
> > get the simple bits in Gerrit's patch queue cherrypicked and sent for
> > Dave.
>
> One possible way to handle this is to flag certain sockets such that
> no refrence counting is done for them against the module.  It is
> an indication that the module will take care of such sockets on
> cleanup.
>
> It seems that this would limit the cost to a test at socket create
> and destroy time.

Yes, but this is not the case currently with Gerrit's proposed patch,
I'm postponing it for now, as one has to be very very careful to
monitor the TW sockets with iproute2's ss before rmmoding with
--force, have to revisit the old unload hack to combine its ideas with
SCTP/Gerrit's approach, the old one was ugly, but at least refused to
unload before all the TW sockets were gone.

- Arnaldo

[root@qemu ~]# rmmod dccp_ipv4
ERROR: Module dccp_ipv4 is in use by [unsafe]
[root@qemu ~]# rmmod --force dccp_ipv4
[  128.264180] slab error in kmem_cache_destroy(): cache
`tw_sock_DCCP': Can't free all objects
[  128.265284]  [<c0141ea7>] kmem_cache_destroy+0x77/0xd0
[  128.266133]  [<c0201dcf>] proto_unregister+0x8f/0xb0
[  128.267222]  [<d085005c>] dccp_v4_exit+0x3c/0x5b [dccp_ipv4]
[  128.268050]  [<c0128458>] sys_delete_module+0x158/0x1d0
[  128.268527]  [<c0269ada>] do_page_fault+0x4ea/0x640
[  128.269014]  [<c0102abf>] syscall_call+0x7/0xb
[  128.269472]  =======================

[root@qemu ~]# rmmod dccp
[  141.267175] slab error in kmem_cache_destroy(): cache
`dccp_bind_bucket': Can't free all objects
[  141.268392]  [<c0141ea7>] kmem_cache_destroy+0x77/0xd0
[  141.268950]  [<d0847e93>] dccp_fini+0x63/0x70 [dccp]
[  141.270046]  [<c0128458>] sys_delete_module+0x158/0x1d0
[  141.270530]  [<c013b6e4>] do_munmap+0x1c4/0x230
[  141.270964]  [<c0102abf>] syscall_call+0x7/0xb
[  141.271414]  =======================

Followed by:

<BIG SNIP>
[  147.347021]  =======================
[  147.359334] Code: c3 08 e9 69 ff ff ff eb 0d 90 90 90 90 90 90 90
90 90 90 90 90 90 55 89 cd 57 56 89 c6 53 8d 04 ca 83 ec 08 8b 10 89
e7 89 14 24 <89> 62 04 8b 50 04 89 22 89 54 24 04 89 00 8b 14 24 89 40
04 39
[  147.395025] EIP: [<c0115b05>] cascade+0x15/0x60 SS:ESP 0068:c0304fa4
[  147.403619]  <0>Kernel panic - not syncing: Fatal exception in interrupt
[  147.482149]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-11-14 14:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-10  8:48 [PATCH] dccp: remove module exit functions James Morris
2006-11-10 13:55 ` Arnaldo Carvalho de Melo
2006-11-10 16:24   ` James Morris
2006-11-10 16:27     ` James Morris
2006-11-10 18:32       ` Arnaldo Carvalho de Melo
2006-11-13 13:41         ` Gerrit Renker
2006-11-14  0:49         ` David Miller
2006-11-14 14:11           ` Arnaldo Carvalho de Melo

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).