Re: [PATCH]: serial oops fixes among others

From: Mike Perry (mikepery@fscked.org)
Date: Wed Jul 26 2000 - 13:51:45 EST


Thus spake Theodore Ts'o (tytso@mit.edu):

> 2. You could set the IRQ to anything if you had CAP_SYS_ADMIN. Of course,
> request_irq failed, but I was noticing system hangs in some cases
> (like trying to change the IRQ to something sane) when the serial
> driver thought the IRQ was something taken by another device. I
> changed the behavior to return the appropriate error code instead.
>
> NO, this is incorrect. It's supposed to set the TTY_IO_ERROR flag and
> return if you opened the port as root. Otherwise, you won't be able to
> use setserial (which uses an ioctl, and therefore requires an open file
> descriptor) to change the IRQ to be something sane.
I'm not seeing how this change prevents you from obtaining or retaining an
open file descriptor.

In my fix, I would restore the old settings if the new IRQ (or any other
setting) were invalid (line 2178). With this fix, I can change the IRQ all day
long with setserial to any available IRQ, and it returns Device Or Resource
Busy when you set it to an IRQ that's already in use (and not shareable). The
IRQ on the serial device then remains unchanged, and afterwards, I can
continue to change it all day long to any other available IRQ. To me, this
makes more sense than allowing the IRQ to be set to already-in-use IRQs that
don't even allow shared operation and having the serial driver run around
thinking it's IRQ was something it couldn't possibly be.

On top of this, like I said, I noticed sporadic cold system hangs when the
serial driver thought its IRQ was one already in use (especially when it
thought the IRQ was 0). I didn't feel like tracking this problem down, so I
fixed it that way.

On the other hand, if your way is POSIX.1 or some other standard, I concede.

Redardless, it's your driver I guess. Do what you see fit. But I reserve the
right to like my patch better ;)

> 3. auto_irq wasn't being listened to when called from setserial. I changed
> this, but it seems that detect_uart_irq still doesn't work, at least on my
> system. I'm suspecting it might be my hardware, because I compared this
> routine with a DOS one I found, and they seemed equivalent (but then again,
> what the hell do I know about DOS? ;).
>
> This is also an incorrect fix. Auto_IRQ is a flag which causes the
> automatic IRQ configuration to happen when you explicit request an
> autoconfiguration using the "setserial autoconfig" command. It is
> documented as such in the setserial man page.
My mistake. I was only looking at the seterial help message.

> Automatic IRQ detection is *very* dicey. It seems to work for some
> motherboards and some serial ports, but not all. I got tired of lots
> people complaining that it didn't work, and sometimes producing the
> wrong result, which is why it's disabled by default. Basically, lots of
> PC hardware is crap....
Yes, unfortunately, on my machine this seems to be the rule rather than the
exception :)

-- 
Mike Perry
http://got.fscked.org?

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



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:22 EST