Re: [PATCH] 8250: option 'force_polling' for buggy IRQs

From: Max Staudt
Date: Thu Jul 28 2016 - 05:59:19 EST

On 07/27/2016 03:33 PM, Theodore Ts'o wrote:
> On Wed, Jul 27, 2016 at 02:14:24PM +0200, Max Staudt wrote:
>>> If you set the IRQ to 0 it should poll anyway (0 means 'no IRQ') so I
>>> don't think the option is needed. At least it seems sufficient to get me
>>> by when I meet buggy PC BIOSes and the like
>> That's exactly what the patch does - but if there is already a way to set the
>> IRQ to 0, I would of course prefer to use that.
>> It seems I haven't found the trick you're using - could you please tell me how
>> you set the IRQ to 0? I can't change it in the BIOS, so I have to do it at
>> the kernel level at the latest.
> So the problem is that you can't use setserial because you want to use
> this port for your console? And so you don't want to set it in an initscript?

Exactly. There is no initscript when I use rdinit=/bin/bash, so I have no choice
but to set it in the kernel. As soon as /bin/bash accesses /dev/ttyS0, the
console hangs.

> The one thing which is really unfortunate with this patch is that it's
> a global, so it forces polling for *all* serial ports. And it may be
> that it's only base ports on the motherboard which needs this hack.

I agree, and I thought about it, but since this is meant for a very limited
audience, I think a catch-all is the easiest solution - both in terms of
implementation as well as ease of use.

It's not meant for general consumption anyway.

IMHO chances are that if someone actually goes as far as to install further serial
ports, he'll make sure they are properly working ones. Thus, the workaround will
no longer be needed, and if the broken port really needs to be used, it can be set
in userspace (after using one of the properly working ports for the console).

> I wonder if it would just be simpler to make it be a CONFIG option
> which causes the irq value to zero in arch/x86/include/asm/serial.h?

Alan hit the nail on the head in his reply to your email: I can't set the IRQ in
the system configuration. The other option is to compile a custom kernel for this
system, but that's exactly what I'd like to avoid.

My motivation for this patch is to have a boot time option that allows *any*
kernel to boot on this broken hardware. This allows for console boot on a broken
machine even when the machine has never been used in serial console mode before,
and thus the hardware bug has not been discovered before either.