Skip to contentSkip to conversation

(1/5) get rid of useless hashbin in irtty

PATCH In review Stephen Hemminger 4 participants 17 messages Aug 15, 2003 – Aug 20, 2003 2 messages not in the archive

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

PATCH 1/1 (1/5) get rid of useless hashbin in irtty

Working on converting IRDA to new netdevice semantics, this is the first of some of the small things I found.

The irtty hashbin is created, maintained and never used. Motivation for removing is that the hashbin locking has problems with the locking assumptions in on network device removal.

drivers/net/irda/irtty.c +0 -19
diff -Nru a/drivers/net/irda/irtty.c b/drivers/net/irda/irtty.c
@@ -39,7 +39,6 @@
 #include <net/irda/wrapper.h>
 #include <net/irda/irda_device.h>
 
-static hashbin_t *irtty = NULL;
 static struct tty_ldisc irda_ldisc;
 
 static int qos_mtt_bits = 0x03;      /* 5 ms or more */
@@ -75,14 +74,6 @@
 {
 	int status;
 
-	/* Probably no need to lock here because all operations done in
-	 * open()/close() which are already safe - Jean II */
-	irtty = hashbin_new( HB_NOLOCK);
-	if ( irtty == NULL) {
-		printk( KERN_WARNING "IrDA: Can't allocate irtty hashbin!\n");
-		return -ENOMEM;
-	}
-
 	/* Fill in our line protocol discipline, and register it */
 	memset(&irda_ldisc, 0, sizeof( irda_ldisc));
 
@@ -124,12 +115,6 @@
 		      __FUNCTION__, ret);
 	}
 
-	/*
-	 *  The TTY should care of deallocating the instances by using the
-	 *  callback to irtty_close(), therefore we do give any deallocation
-	 *  function to hashbin_destroy().
-	 */
-	hashbin_delete(irtty, NULL);
 }
 
 /* 
@@ -172,8 +157,6 @@
 	/* Give self a name */
 	strcpy(name, tty->name);
 
-	hashbin_insert(irtty, (irda_queue_t *) self, (int) self, NULL);
-
 	if (tty->driver->flush_buffer)
 		tty->driver->flush_buffer(tty);
 	
@@ -285,8 +268,6 @@
 	if (self->netdev)
 		unregister_netdev(self->netdev);
 	
-	self = hashbin_remove(irtty, (int) self, NULL);
-
 	/* Protect access to self->task and self->?x_buff - Jean II */
 	spin_lock_irqsave(&self->lock, flags);
 
include/net/irda/irtty.h +0 -2
diff -Nru a/include/net/irda/irtty.h b/include/net/irda/irtty.h
@@ -31,7 +31,6 @@
 #include <linux/netdevice.h>
 
 #include <net/irda/irda.h>
-#include <net/irda/irqueue.h>
 #include <net/irda/irda_device.h>
 
 /* Used by ioctl */
@@ -45,7 +44,6 @@
 #define IRTTY_IOC_MAXNR   2
 
 struct irtty_cb {
-	irda_queue_t q;     /* Must be first */
 	magic_t magic;
 
 	struct net_device *netdev; /* Yes! we are some kind of netdevice */
#1 lore raw
Quoted 2 lines · Stephen Hemminger

Working on converting IRDA to new netdevice semantics,

I hope you realised that this is most likely 2.7.X
material. There is not enough IrDA testing happening in 2.6.X to make sure that this could work properly in the short time we have before 2.6.0. It usually take 3 months to get feedback on the 2.4.X changes. Driver still have not caught up with the core changes in 2.6.X, so I don't feel like introducing more core changes that would destabilise everything.
I don't want to discourage you, because I know that this needs
to happen. Also, you may want to contact Martin Diehl, which is taking care of irtty-sir and dongle drivers, so might have a more accurate perpective on the problem and help on that.
I'm not saying "No", I just want some way to reduce the risk
level. Having Martin involved is one good way.

Quoted 4 lines

this is the first
of some of the small things I found.

The irtty hashbin is created, maintained and never used.

irtty is broken in 2.6.X, and the only thing that should
happen to it is complete removal.

Quoted 2 lines

Motivation for removing is that the hashbin locking has problems with the locking assumptions in on network device removal.

Please explain that, if there is a bug in hashbin, it need
fixing. I personally took care of making sure that hashbin locking is sensible, so I have to assume that there is something wrong with network device removal.
Also note that the hashbin was created with NO_LOCK, so
hashbin locking can't be a problem ;-)

	Have fun...

	Jean
#2 lore raw
Quoted 6 lines · On Fri, 15 Aug 2003 16:05:46 -0700 Jean Tourrilhes <[email protected]>…
Quoted 2 lines · Stephen Hemminger

Working on converting IRDA to new netdevice semantics,

I hope you realised that this is most likely 2.7.X
material.

Without moving to the new netdevice semantics, you're drivers will be broken.

This isn't a happy cleanup change, it is necessary.

#3 lore raw
Quoted 7 lines · David S. Miller
Quoted 4 lines · On Fri, 15 Aug 2003 16:05:46 -0700 Jean Tourrilhes <[email protected]>…
Quoted 2 lines · Stephen Hemminger

Working on converting IRDA to new netdevice semantics,

Quoted 7 lines
Quoted 2 lines

I hope you realised that this is most likely 2.7.X
material.

Without moving to the new netdevice semantics, you're drivers will be broken.

This isn't a happy cleanup change, it is necessary.

Curently driver do work properly (including SMP). Does it mean
that you plan to have big changes before 2.6.0 is released ?
Regards,

Jean

#4 lore raw
Quoted 1 line · On Sat, 16 Aug 2003 17:14:05 -0700 Jean Tourrilhes <[email protected]>…

Curently driver do work properly (including SMP).

Users can hold onto procfs files after the driver
modules are unloaded. For example:

rmmod eth0 </proc/sys/net/ipv4/eth0/whatever

If IRDA creates any procfs files for devices that are registered, you have this problem too.

This is not fixable without first making sure every net driver in the entire tree abides by a few rules, and that is what Stephen is doing.

#5 lore raw
Quoted 8 lines · David S. Miller
Quoted 1 line · On Sat, 16 Aug 2003 17:14:05 -0700 Jean Tourrilhes <[email protected]>…

Curently driver do work properly (including SMP).

Users can hold onto procfs files after the driver
modules are unloaded. For example:

Quoted 7 lines

rmmod eth0 </proc/sys/net/ipv4/eth0/whatever

If IRDA creates any procfs files for devices that are registered, you have this problem too.

This is not fixable without first making sure every net driver in the entire tree abides by a few rules, and that is what Stephen is doing.

No problem, it's just that with the total lack of testing of
IrDA in 2.6.0, I'm a bit nervous, as always. Would it be possible for Stephen to use some real IrDA hardware so that he can double check what he is doing ?

	Have fun...

	Jean
#6 lore raw
Quoted 2 lines · On Sat, 16 Aug 2003 18:11:31 -0700 Jean Tourrilhes <[email protected]>…

Would it be possible for Stephen to use some real IrDA hardware so that he can double check what he is doing ?

And alternatively, what? We let known bugs sit in the tree because of IRDA?

We've had to edit and hack on lots of obscure ISA ethernet drivers to do this so far that probably nobody has tried to use in years and very few people have access to. Not just trivial changes, we've had to rewrite some of their probe routines in some cases.

The work simply must be done.

If we add bugs, the first person who tries to use it will find out and report the problem.

#7 lore raw
Quoted 8 lines · David S. Miller
Quoted 2 lines · On Sat, 16 Aug 2003 18:11:31 -0700 Jean Tourrilhes <[email protected]>…

Would it be possible for Stephen to use some real IrDA hardware so that he can double check what he is doing ?

And alternatively, what? We let known bugs sit in the tree because of IRDA?

Wow ! I did not mean to argue and stop the work, if you
understood that, I'm sorry for the misunderstanding.
I'm just trying to understand the reason for it, how best to
proceed, and that's why I took the time to give Stephen some constructive suggestions (as well as my worries). I'm just doing my job, and I don't think I'm unnegociable.

Quoted 4 lines

We've had to edit and hack on lots of obscure ISA ethernet drivers to do this so far that probably nobody has tried to use in years and very few people have access to. Not just trivial changes, we've had to rewrite some of their probe routines in some cases.

It's fairly easy to get hold of some IrDA hardware, and in the
worse case you can use a serial crossover cable to test it. It's not like I'm asking the impossible.

Quoted 1 line

The work simply must be done.

After your explanation, I didn't argue with that. But let's do
quality work, not a quick job.

Quoted 2 lines

If we add bugs, the first person who tries to use it will find out and report the problem.

If the bug report come in one year, nobody will remember the
context of the work. It's better to get it right the first time, and that's what I'm trying to acheive.

	Have fun...

	Jean
#8 lore raw
In reply to Jean Tourrilhes
Quoted 14 lines · On Sat, 16 Aug 2003 18:11:31 -0700 Jean Tourrilhes <[email protected]>…
Quoted 13 lines · David S. Miller
Quoted 1 line · On Sat, 16 Aug 2003 17:14:05 -0700 Jean Tourrilhes <[email protected]>…

Curently driver do work properly (including SMP).

Users can hold onto procfs files after the driver
modules are unloaded. For example:

rmmod eth0 </proc/sys/net/ipv4/eth0/whatever

If IRDA creates any procfs files for devices that are registered, you have this problem too.

Quoted 8 lines
Quoted 2 lines

This is not fixable without first making sure every net driver in the entire tree abides by a few rules, and that is what Stephen is doing.

No problem, it's just that with the total lack of testing of
IrDA in 2.6.0, I'm a bit nervous, as always. Would it be possible for Stephen to use some real IrDA hardware so that he can double check what he is doing ?

	Have fun...

I have some, but haven't used it so far.
For the load/unload testing, it is possible to setup irtty (and irlan) without real hardware. So far, haven't had to change the hardware drivers.

#9 lore raw
Quoted 26 lines · Stephen Hemminger
Quoted 14 lines · On Sat, 16 Aug 2003 18:11:31 -0700 Jean Tourrilhes <[email protected]>…
Quoted 13 lines · David S. Miller
Quoted 1 line · On Sat, 16 Aug 2003 17:14:05 -0700 Jean Tourrilhes <[email protected]>…

Curently driver do work properly (including SMP).

Users can hold onto procfs files after the driver
modules are unloaded. For example:

rmmod eth0 </proc/sys/net/ipv4/eth0/whatever

If IRDA creates any procfs files for devices that are registered, you have this problem too.

Quoted 8 lines
Quoted 2 lines

This is not fixable without first making sure every net driver in the entire tree abides by a few rules, and that is what Stephen is doing.

No problem, it's just that with the total lack of testing of
IrDA in 2.6.0, I'm a bit nervous, as always. Would it be possible for Stephen to use some real IrDA hardware so that he can double check what he is doing ?

	Have fun...
Quoted 3 lines

I have some, but haven't used it so far.
For the load/unload testing, it is possible to setup irtty (and irlan) without real hardware. So far, haven't had to change the hardware drivers.

You can use irtty-sir with a cross-over serial cable between
two PCs. IrLAN is a bit flaky and no longer maintained, I would recommend to try IrNET or RfCOMM.

Thanks !

Jean

#10 lore raw
Quoted 3 lines · Jean Tourrilhes

You can use irtty-sir with a cross-over serial cable between
two PCs. IrLAN is a bit flaky and no longer maintained, I would recommend to try IrNET or RfCOMM.

Can we remove IrLAN in 2.6, then? :)

Jeff

#11 lore raw
Quoted 8 lines · Jeff Garzik
Quoted 3 lines · Jean Tourrilhes

You can use irtty-sir with a cross-over serial cable between
two PCs. IrLAN is a bit flaky and no longer maintained, I would recommend to try IrNET or RfCOMM.

Can we remove IrLAN in 2.6, then? :)

Jeff

The problem is that we don't have another implementation of
IrLAN. There are a few devices that talk IrLAN (NetBeamIr, Win95), and for those there is no alternative and IrLAN works good enough with them (I test it every few months). No need to remove it if it still works...

If you really are in cleanup mood, you can kill :
o irtty (broken - replaced by irtty-sir + sir-dev)
o toshoboe (no spinlock - replaced by donauboe)
o smc-ircc (flaky - replaced by smsc-ircc2)
o ep7211_ir (obsolete hardware, unmaintained)
Happy ?

Have fun...

Jean

#12 lore raw
Quoted 10 lines · Jean Tourrilhes
Quoted 8 lines · Jeff Garzik
Quoted 3 lines · Jean Tourrilhes

You can use irtty-sir with a cross-over serial cable between
two PCs. IrLAN is a bit flaky and no longer maintained, I would recommend to try IrNET or RfCOMM.

Can we remove IrLAN in 2.6, then? :)

Quoted 8 lines
Quoted 1 line

Jeff

The problem is that we don't have another implementation of
IrLAN. There are a few devices that talk IrLAN (NetBeamIr, Win95), and for those there is no alternative and IrLAN works good enough with them (I test it every few months). No need to remove it if it still works...

No argument. IrLAN definitely sounds like it should stay.

Quoted 6 lines

If you really are in cleanup mood, you can kill :
o irtty (broken - replaced by irtty-sir + sir-dev)
o toshoboe (no spinlock - replaced by donauboe)
o smc-ircc (flaky - replaced by smsc-ircc2)
o ep7211_ir (obsolete hardware, unmaintained)
Happy ?

hehe :)

Given this list, I would be ok with removing the first three, if you and others are ok with it. If something's been replaced, I don't have any problem removing it. If something doesn't have a replacement, like IrLAN or ep7211_ir, Linux generally leans towards not removing that code (retrocomputing!), so I was perhaps a bit hasty in suggesting that. But that's why we have discussion ;-)

Jeff

#13 lore raw

PATCH 1/1 kill old irtty

As suggested by Jean and Jeff, kill the old irtty driver since it is replaced by irtty-sir

drivers/net/irda/Kconfig +0 -14
diff -Nru a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig
@@ -68,20 +68,6 @@
 
 comment "Old SIR device drivers"
 
-config IRTTY_OLD
-	tristate "Old IrTTY (broken)"
-	depends on IRDA && EXPERIMENTAL
-	help
-	  Say Y here if you want to build support for the IrTTY line
-	  discipline.  If you want to compile it as a module (irtty), say M
-	  here and read <file:Documentation/modules.txt>.  IrTTY makes it
-	  possible to use Linux's own serial driver for all IrDA ports that
-	  are 16550 compatible.  Most IrDA chips are 16550 compatible so you
-	  should probably say Y to this option.  Using IrTTY will however
-	  limit the speed of the connection to 115200 bps (IrDA SIR mode).
-
-	  If unsure, say N.
-
 config IRPORT_SIR
 	tristate "IrPORT (IrDA serial driver)"
 	depends on IRDA
drivers/net/irda/Makefile +1 -2
diff -Nru a/drivers/net/irda/Makefile b/drivers/net/irda/Makefile
@@ -5,8 +5,7 @@
 # Rewritten to use lists instead of if-statements.
 #
 
-# Old SIR drivers (irtty is broken)
-obj-$(CONFIG_IRTTY_OLD)		+= irtty.o
+# Old SIR drivers 
 obj-$(CONFIG_IRPORT_SIR)	+= 		irport.o
 # FIR drivers
 obj-$(CONFIG_USB_IRDA)		+= irda-usb.o
drivers/net/irda/irtty.c deleted +0 -1055

1,055 lines not on this page · raw message

#14 lore raw

Re: [PATCH] kill old irtty

Quoted 2 lines · On Tue, 19 Aug 2003 15:58:47 -0700 Stephen Hemminger <[email protected]>…

As suggested by Jean and Jeff, kill the old irtty driver since it is replaced by irtty-sir

Applied, thanks.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw
Quoted 1 line · On Sun, 17 Aug 2003 19:42:40 +0200 (CEST) Martin Diehl <[email protected]> wrote:

try_module_get(netdev->owner)

netdev->owner does not exist any more and we don't use module refcounts to manage unload of network devices, it simply is not needed.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#18 lore raw
Quoted 3 lines · On Mon, 18 Aug 2003 10:48:28 +0200 (CEST) Martin Diehl <[email protected]> wrote:

So the question arises what to do if
some stack (say irda ;-) *wants* to lock the driver providing the netdev while registered?

You can't, you have to interlock with netdevice removal and also capture NETDEV_GOING_DOWN events to properly handle when netdevices disappear.