Skip to contentSkip to conversation

Industrial device driver uio/uio_*

DISCUSSION Alan Cox 7 participants 11 messages Sep 11, 2006 – Oct 6, 2006

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

This passed me by while I was away so I only saw it to review in mm6. It looks like it has a few problems...

uio_lseek locking ?

uio_read uses f->f_pos which it should never do
ditto uio_write ...

The uio_read/write functions can race seek or other read/write

The uio_read/write functions do signed maths checks on unsigned types (size_t) so the count check fails.

Partially completed I/O returns -EFAULT, should return the length transferred OK

The *ppos adjustment means you can get f_pos to interestingly unsafe values. Generally speaking do

	loff_t pos = *ppos;

	do stuff with pos

	pos += movement;
	*ppos = pos;

If idev->virtaddr is an mmio object you can't use copy_from/to_user on it

uio_event is based on sizeof(int) so makes 32bit compat code insanely hard

event_poll is wrong - poll methods shouldn't error just return "ready"

idev->event_listener appears to have no locking versus the irq handler and the like.

Anyone appears to be able to select any process as the task to signal or out of range or negative values

I've not begun to look at uio_base.c in detail but it seems a lot of code to do very little. That said I can see the problem it is trying to solve, I'm just not sure it helps as is.

Alan

#1 lore raw
Quoted 2 lines

Subject: Industrial device driver uio/uio_*

Hm has this now been named uio? iio may have seem strange to some, but uio also resembles BSD/Solaris (uio_copyin, uio_copyout, uiomove, etc.)

Jan Engelhardt

#2 lore raw
Quoted 5 lines · Jan Engelhardt
Quoted 2 lines

Subject: Industrial device driver uio/uio_*

Hm has this now been named uio? iio may have seem strange to some, but uio also resembles BSD/Solaris (uio_copyin, uio_copyout, uiomove, etc.)

Yes, I am aware of uio, we have include/linux/uio.h :)

Do you have a better name for this code? If you don't like uio, I'm open to new suggestions.

thanks,

greg k-h

#3 lore raw
Quoted 8 lines
Quoted 3 lines

Hm has this now been named uio? iio may have seem strange to some, but uio also resembles BSD/Solaris (uio_copyin, uio_copyout, uiomove, etc.)

Yes, I am aware of uio, we have include/linux/uio.h :)

Do you have a better name for this code? If you don't like uio, I'm open to new suggestions.

- I was fine with iio
- udio, for userspace-driven IO (my favorite should iio not make it)
- idd, since it's called "Industrial device driver" (don't go about calling it iddqd)

more artistic ones:
- iofu, for IO From Userspace, or, on 2nd thought, simply IO-fu (as in Kung-fu)
- something else that's not related at all? /methinks of squid, which, from the name, does not suggest it would be a web proxy.

Jan Engelhardt

author
#4 lore raw
In reply to Alan Cox

Ar Llu, 2006-09-11 am 18:22 +0100, ysgrifennodd Alan Cox:

Quoted 3 lines

This passed me by while I was away so I only saw it to review in mm6. It looks like it has a few problems...

And nothing has happened since [Thats Sept 11th] even on the simple bugs although the authors were sent a copy. At this point can the linutronix guys either let me know if they just never got the list of flaws or can we pull the drivers/uio stuff from -mm until its rather better ?

I would just NAK it but want to be sure the guys saw the list of problems

Alan

#5 lore raw
Quoted 5 lines · On Wed, 04 Oct 2006 19:59:54 +0100 Alan Cox <[email protected]> wrote:

Ar Llu, 2006-09-11 am 18:22 +0100, ysgrifennodd Alan Cox:

Quoted 3 lines

This passed me by while I was away so I only saw it to review in mm6. It looks like it has a few problems...

Quoted 8 lines

And nothing has happened since [Thats Sept 11th] even on the simple bugs although the authors were sent a copy. At this point can the linutronix guys either let me know if they just never got the list of flaws or can we pull the drivers/uio stuff from -mm until its rather better ?

I would just NAK it but want to be sure the guys saw the list of problems

cc's added.

Thomas has been a bit tied up with timers and interrupts of late.

#6 lore raw
Quoted 8 lines · Andrew Morton

On Wed, 04 Oct 2006 19:59:54 +0100

Quoted 3 lines

I would just NAK it but want to be sure the guys saw the list of problems

cc's added.

Thomas has been a bit tied up with timers and interrupts of late.

Yup. fork(tglx) still returns -ETOOMANYINSTANCES.

I have no objections, if you pull it from -mm for now. The list of flaws is accepted and we'll work on this in foreseeable time, _IF_ there is some basic consensus about the idea itself not being fundamentaly wrong.

tglx

author
#7 lore raw

Ar Mer, 2006-10-04 am 21:32 +0200, ysgrifennodd Thomas Gleixner:

Quoted 3 lines

I have no objections, if you pull it from -mm for now. The list of flaws is accepted and we'll work on this in foreseeable time, _IF_ there is some basic consensus about the idea itself not being fundamentaly wrong.

The device stuff seems ok, the class stuff seems to me overconvoluted but I'd rather someone who knew the class stuff well (Greg thats you) made that decision.

Alan

#8 lore raw
In reply to Thomas Gleixner
Quoted 8 lines · Thomas Gleixner
Quoted 7 lines · Andrew Morton

On Wed, 04 Oct 2006 19:59:54 +0100

Quoted 3 lines

I would just NAK it but want to be sure the guys saw the list of problems

cc's added.

Quoted 8 lines
Quoted 1 line

Thomas has been a bit tied up with timers and interrupts of late.

Yup. fork(tglx) still returns -ETOOMANYINSTANCES.

I have no objections, if you pull it from -mm for now. The list of flaws is accepted and we'll work on this in foreseeable time, _IF_ there is some basic consensus about the idea itself not being fundamentaly wrong.

I've got a few cycles I can throw at this, it's a problem space we (Renesas) are interested in too..

Alan, is your Sept. 11 list the extent of your issues with the current code, or was there more that you sent off-list?

I'll toss up a quick git tree for this so we don't lose anything, and the fixes can trickle in to -mm that way, or it can just be pulled and added back later.

author
#9 lore raw

Ar Iau, 2006-10-05 am 17:12 +0900, ysgrifennodd Paul Mundt:

Quoted 2 lines

Alan, is your Sept. 11 list the extent of your issues with the current code, or was there more that you sent off-list?

Its the current state from the initial pass

Alan

#10 lore raw
In reply to Paul Mundt
Quoted 20 lines · Paul Mundt
Quoted 8 lines · Thomas Gleixner
Quoted 7 lines · Andrew Morton

On Wed, 04 Oct 2006 19:59:54 +0100

Quoted 3 lines

I would just NAK it but want to be sure the guys saw the list of problems

cc's added.

Quoted 8 lines
Quoted 1 line

Thomas has been a bit tied up with timers and interrupts of late.

Yup. fork(tglx) still returns -ETOOMANYINSTANCES.

I have no objections, if you pull it from -mm for now. The list of flaws is accepted and we'll work on this in foreseeable time, _IF_ there is some basic consensus about the idea itself not being fundamentaly wrong.

I've got a few cycles I can throw at this, it's a problem space we (Renesas) are interested in too..

Quoted 6 lines

Alan, is your Sept. 11 list the extent of your issues with the current code, or was there more that you sent off-list?

I'll toss up a quick git tree for this so we don't lose anything, and the fixes can trickle in to -mm that way, or it can just be pulled and added back later.

Please just send me patches and I'll update the main version that I have, which will get pulled into -mm.

And yes, I need to look at this some more too. I was considering just stripping it down to the bare essencials right now, the interrupt handling stuff, and then slowly adding pieces back when people asked for them.

Unless people need all of the different options right now?

thanks,

greg k-h