public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Markus Armbruster <armbru@redhat.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Michal Hocko <mhocko@suse.cz>
Subject: Re: [PATCH] Do not read IIR in serial8250_start_tx when UART_BUG_TXEN
Date: Thu, 19 Nov 2009 08:42:33 -0800	[thread overview]
Message-ID: <20091119164233.GA8476@suse.de> (raw)
In-Reply-To: <alpine.LSU.2.00.0911191734570.15039@wotan.suse.de>

On Thu, Nov 19, 2009 at 05:38:55PM +0100, Jiri Kosina wrote:
> On Wed, 18 Nov 2009, Jiri Kosina wrote:
> 
> > The patch below has been lost several times (the last submission happened 
> > probably on [1]). I am currently aware of a real hardware which triggers 
> > this problem quite reliably, so we should rather have that really fixed.
> > 
> > [1] http://lkml.org/lkml/2009/3/12/379
> > 
> > 
> > 
> > 
> > From: Ian Jackson <ian.jackson@eu.citrix.com>
> > 
> > Do not read IIR in serial8250_start_tx when UART_BUG_TXEN
> > 
> > Reading the IIR clears some oustanding interrupts so it is not safe.
> > Instead, simply transmit immediately if the buffer is empty without
> > regard to IIR.
> > 
> > Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> > Reviewed-by: Markus Armbruster <armbru@redhat.com>
> > Reviewed-by: Jiri Kosina <jkosina@suse.cz>
> > 
> > ---
> >  drivers/serial/8250.c |    8 +++-----
> >  1 files changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
> > index 737b4c9..807042b 100644
> > --- a/drivers/serial/8250.c
> > +++ b/drivers/serial/8250.c
> > @@ -1339,14 +1339,12 @@ static void serial8250_start_tx(struct uart_port *port)
> >  		serial_out(up, UART_IER, up->ier);
> >  
> >  		if (up->bugs & UART_BUG_TXEN) {
> > -			unsigned char lsr, iir;
> > +			unsigned char lsr;
> >  			lsr = serial_in(up, UART_LSR);
> >  			up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
> > -			iir = serial_in(up, UART_IIR) & 0x0f;
> >  			if ((up->port.type == PORT_RM9000) ?
> > -				(lsr & UART_LSR_THRE &&
> > -				(iir == UART_IIR_NO_INT || iir == UART_IIR_THRI)) :
> > -				(lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT))
> > +				(lsr & UART_LSR_THRE) :
> > +				(lsr & UART_LSR_TEMT))
> >  				transmit_chars(up);
> >  		}
> >  	}
> 
> Does anyone have any comments about this please?
> 
> In a nutshell -- this is needed so that we make the UART_BUG_TXEN really 
> harmless (which I guess it originally inteded to be, but reading IIR has 
> some unwanted sideeffects and is in fact not needed).
> 
> We need to have this in to handle properly the cases in which BUG_TXEN is 
> misdetected, and we can't blacklist such systems as we do for some SoL 
> hardware (see commit b6adea334c6c (" 8250: fix boot hang with serial 
> console when using with Serial Over Lan port"). Also there doesn't seem to 
> be any straightforward way to workaround the misdetection, so this seems 
> to be proper fix, unbreaking all the possible scenarios.
> 
> Alan, Greg, any comments?

At first glance, it looks acceptable to me.  It's in my "to-apply" queue
that has gotten a bit big due to "real work" and a vacation I took last
week.

thanks,

greg k-h

  reply	other threads:[~2009-11-19 16:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-18 10:08 [PATCH] Do not read IIR in serial8250_start_tx when UART_BUG_TXEN Jiri Kosina
2009-11-19 16:38 ` Jiri Kosina
2009-11-19 16:42   ` Greg KH [this message]
2009-11-19 18:15   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091119164233.GA8476@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=armbru@redhat.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mhocko@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox