All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Peter Hurley <peter@hurleysoftware.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tony Lindgren <tony@atomide.com>,
	nsekhar@ti.com, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH] tty: serial: 8250_omap: do not defer termios changes
Date: Thu, 31 Mar 2016 12:51:36 +0200	[thread overview]
Message-ID: <87vb42gbt3.fsf@linutronix.de> (raw)
In-Reply-To: <8737r7ght7.fsf@linutronix.de> (John Ogness's message of "Thu, 31 Mar 2016 10:41:56 +0200")

On 2016-03-31, John Ogness <john.ogness@linutronix.de> wrote:
> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 6f76051..9459b4d 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -460,6 +451,24 @@ static void omap_8250_set_termios(struct uart_port *port,
>  			priv->efr |= OMAP_UART_SW_TX;
>  		}
>  	}
> +
> +	if (dma && dma->tx_running) {
> +		/*
> +		 * TCSANOW requests the change to occur immediately, however
> +		 * if we have a TX-DMA operation in progress then it has been
> +		 * observed that it might stall and never complete. Therefore
> +		 * we wait until DMA completes to prevent this hang from
> +		 * happening.
> +		 */
> +
> +		dma->tx_running = 2;
> +
> +		spin_unlock_irq(&up->port.lock);
> +		wait_event_interruptible(priv->termios_wait,
> +					 dma->tx_running == 3);
> +		spin_lock_irq(&up->port.lock);
> +		complete_dma = 1;
> +	}

Sorry, I just realized that wait_event_interruptible() is used
here. IMHO this should be changed to wait_event(), otherwise a signal
could trigger the TX-DMA deadlock this code is trying to prevent.

If hardware flow control is active, it is possible that wait_event()
leads to the caller waiting forever. But allowing interruptible causes
too many problems since set_termios() cannot communicate errors.

John Ogness

  reply	other threads:[~2016-03-31 10:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31  8:41 [PATCH] tty: serial: 8250_omap: do not defer termios changes John Ogness
2016-03-31  8:41 ` John Ogness
2016-03-31 10:51 ` John Ogness [this message]
2016-03-31 14:33 ` One Thousand Gnomes
2016-04-05  4:07 ` Peter Hurley
2016-04-11  8:18   ` John Ogness
2016-04-11 17:53     ` Peter Hurley
2016-04-11 18:31       ` Sebastian Andrzej Siewior
2016-04-11 20:10         ` Peter Hurley
2016-04-12 17:03           ` Sebastian Andrzej Siewior
2016-04-12 18:42             ` Peter Hurley
2016-04-14 16:03               ` Peter Hurley
2016-04-12 23:20             ` 8250 dma issues ( was Re: [PATCH] tty: serial: 8250_omap: do not defer termios changes) Peter Hurley
2016-04-14 15:07               ` One Thousand Gnomes
2016-04-14 17:54                 ` Peter Hurley
2016-04-13  0:00             ` omap uart + dma issues (Re: " Peter Hurley
2016-04-13 11:11               ` Sekhar Nori
2016-04-13 11:11                 ` Sekhar Nori
2016-04-14  1:14                 ` Peter Hurley
2016-05-03 12:00             ` [PATCH] tty: serial: 8250_omap: do not defer termios changes Vignesh R
2016-05-03 12:00               ` Vignesh R

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=87vb42gbt3.fsf@linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=peter@hurleysoftware.com \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.