Re: [PATCH] serial/8250: remove comment about schedule_timeout

From: Theodore Ts'o
Date: Thu Jan 05 2017 - 17:00:06 EST


On Thu, Jan 05, 2017 at 03:17:45PM -0200, Thadeu Lima de Souza Cascardo wrote:
> Okay. At first, I wanted to simply use msleep there, then realized there
> was the spinlock. I thought I got a good writeup of the history that was
> not in git yet, maybe we should just add a better comment and more
> details in the commit log. How about this as the comment?

Could you look at fixing this, instead? I was taking a look at the
code, and it so very.... 1990's. It looks like it was written during
the days before SMP, and then locking was smashed in a very
blunt-force way ---- probably because that's how it happened. :-)

What we should **really** be doing with autoconfiguration, is instead
of using the spinlock to prevent it from being accessed, is to lock
out any attempt to transmit from the top-half, and remove it from the
linked list of ports to prevent the interrupt handler from accessing
it, make sure that any active interrupt handler has exited (and you
can use the spinlock for the preceeding bits), but then we can safely
do the autoconfiguration without having the deal with the spinlock at
all, afterwards.

It should't be *that* hard to just fix it for real.

Cheers,

- Ted