diff mbox

[3/4] tty: omap-serial: use threaded interrupt handler

Message ID 1410789610-23059-4-git-send-email-frans.klaver@xsens.com (mailing list archive)
State New, archived
Headers show

Commit Message

Frans Klaver Sept. 15, 2014, 2 p.m. UTC
At 3.6Mbaud, with slightly over 2Mbit/s data coming in, we see 1600 uart
rx buffer overflows within 30 seconds. Threading the interrupt handling reduces
this to about 170 overflows in 10 minutes.

In practice this therefore reduces the need for hardware flow control,
meaning the sending side doesn't have to buffer as much either.

Signed-off-by: Frans Klaver <frans.klaver@xsens.com>
---
 drivers/tty/serial/omap-serial.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

Comments

Peter Hurley Sept. 15, 2014, 3:39 p.m. UTC | #1
On 09/15/2014 10:00 AM, Frans Klaver wrote:
> At 3.6Mbaud, with slightly over 2Mbit/s data coming in, we see 1600 uart
> rx buffer overflows within 30 seconds. Threading the interrupt handling reduces
> this to about 170 overflows in 10 minutes.

Why is the threadirqs kernel boot option not sufficient?
Or conversely, shouldn't this be selectable?

Regards,
Peter Hurley

PS - To overflow the 64 byte RX FIFO at those data rates means interrupt
latency in excess of 250us?

> In practice this therefore reduces the need for hardware flow control,
> meaning the sending side doesn't have to buffer as much either.
> 
> Signed-off-by: Frans Klaver <frans.klaver@xsens.com>
> ---
>  drivers/tty/serial/omap-serial.c | 30 +++++++++++++++++++++++-------
>  1 file changed, 23 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index 7d3f557..398139a 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -575,6 +575,20 @@ static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)
>  }
>  
>  /**
> + * serial_omap_fast_irq() - schedule interrupt handling
> + */
> +static irqreturn_t serial_omap_fast_irq(int irq, void *dev_id)
> +{
> +	struct uart_omap_port *up = dev_id;
> +	unsigned int iir = serial_in(up, UART_IIR);
> +
> +	if (iir & UART_IIR_NO_INT)
> +		return IRQ_NONE;
> +
> +	return IRQ_WAKE_THREAD;
> +}
> +
> +/**
>   * serial_omap_irq() - This handles the interrupt from one port
>   * @irq: uart port irq number
>   * @dev_id: uart port info
> @@ -584,7 +598,6 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
>  	struct uart_omap_port *up = dev_id;
>  	unsigned int iir, lsr;
>  	unsigned int type;
> -	irqreturn_t ret = IRQ_NONE;
>  	int max_count = 256;
>  
>  	spin_lock(&up->port.lock);
> @@ -595,7 +608,6 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
>  		if (iir & UART_IIR_NO_INT)
>  			break;
>  
> -		ret = IRQ_HANDLED;
>  		lsr = serial_in(up, UART_LSR);
>  
>  		/* extract IRQ type from IIR register */
> @@ -634,7 +646,7 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
>  	pm_runtime_put_autosuspend(up->dev);
>  	up->port_activity = jiffies;
>  
> -	return ret;
> +	return IRQ_HANDLED;
>  }
>  
>  static unsigned int serial_omap_tx_empty(struct uart_port *port)
> @@ -731,15 +743,19 @@ static int serial_omap_startup(struct uart_port *port)
>  	/*
>  	 * Allocate the IRQ
>  	 */
> -	retval = request_irq(up->port.irq, serial_omap_irq, up->port.irqflags,
> -				up->name, up);
> +	retval = request_threaded_irq(up->port.irq, serial_omap_fast_irq,
> +						serial_omap_irq,
> +						IRQF_ONESHOT | up->port.irqflags,
> +						up->name, up);
>  	if (retval)
>  		return retval;
>  
>  	/* Optional wake-up IRQ */
>  	if (up->wakeirq) {
> -		retval = request_irq(up->wakeirq, serial_omap_irq,
> -				     up->port.irqflags, up->name, up);
> +		retval = request_threaded_irq(up->wakeirq, serial_omap_fast_irq,
> +						serial_omap_irq,
> +						IRQF_ONESHOT | up->port.irqflags,
> +						up->name, up);
>  		if (retval) {
>  			free_irq(up->port.irq, up);
>  			return retval;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter Hurley Sept. 15, 2014, 5:31 p.m. UTC | #2
On 09/15/2014 11:39 AM, Peter Hurley wrote:
> On 09/15/2014 10:00 AM, Frans Klaver wrote:
>> At 3.6Mbaud, with slightly over 2Mbit/s data coming in, we see 1600 uart
>> rx buffer overflows within 30 seconds. Threading the interrupt handling reduces
>> this to about 170 overflows in 10 minutes.
> 
> Why is the threadirqs kernel boot option not sufficient?
> Or conversely, shouldn't this be selectable?

Also, do you see the same performance differential when you implement this
in the 8250 driver (that is, on top of Sebastian's omap->8250 conversion)?


> Regards,
> Peter Hurley
> 
> PS - To overflow the 64 byte RX FIFO at those data rates means interrupt
> latency in excess of 250us?
> 
>> In practice this therefore reduces the need for hardware flow control,
>> meaning the sending side doesn't have to buffer as much either.
>>
>> Signed-off-by: Frans Klaver <frans.klaver@xsens.com>
>> ---
>>  drivers/tty/serial/omap-serial.c | 30 +++++++++++++++++++++++-------
>>  1 file changed, 23 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
>> index 7d3f557..398139a 100644
>> --- a/drivers/tty/serial/omap-serial.c
>> +++ b/drivers/tty/serial/omap-serial.c
>> @@ -575,6 +575,20 @@ static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)
>>  }
>>  
>>  /**
>> + * serial_omap_fast_irq() - schedule interrupt handling
>> + */
>> +static irqreturn_t serial_omap_fast_irq(int irq, void *dev_id)
>> +{
>> +	struct uart_omap_port *up = dev_id;
>> +	unsigned int iir = serial_in(up, UART_IIR);
>> +
>> +	if (iir & UART_IIR_NO_INT)
>> +		return IRQ_NONE;
>> +
>> +	return IRQ_WAKE_THREAD;
>> +}
>> +
>> +/**
>>   * serial_omap_irq() - This handles the interrupt from one port
>>   * @irq: uart port irq number
>>   * @dev_id: uart port info
>> @@ -584,7 +598,6 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
>>  	struct uart_omap_port *up = dev_id;
>>  	unsigned int iir, lsr;
>>  	unsigned int type;
>> -	irqreturn_t ret = IRQ_NONE;
>>  	int max_count = 256;
>>  
>>  	spin_lock(&up->port.lock);
>> @@ -595,7 +608,6 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
>>  		if (iir & UART_IIR_NO_INT)
>>  			break;
>>  
>> -		ret = IRQ_HANDLED;
>>  		lsr = serial_in(up, UART_LSR);
>>  
>>  		/* extract IRQ type from IIR register */
>> @@ -634,7 +646,7 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
>>  	pm_runtime_put_autosuspend(up->dev);
>>  	up->port_activity = jiffies;
>>  
>> -	return ret;
>> +	return IRQ_HANDLED;
>>  }
>>  
>>  static unsigned int serial_omap_tx_empty(struct uart_port *port)
>> @@ -731,15 +743,19 @@ static int serial_omap_startup(struct uart_port *port)
>>  	/*
>>  	 * Allocate the IRQ
>>  	 */
>> -	retval = request_irq(up->port.irq, serial_omap_irq, up->port.irqflags,
>> -				up->name, up);
>> +	retval = request_threaded_irq(up->port.irq, serial_omap_fast_irq,
>> +						serial_omap_irq,
>> +						IRQF_ONESHOT | up->port.irqflags,
>> +						up->name, up);
>>  	if (retval)
>>  		return retval;
>>  
>>  	/* Optional wake-up IRQ */
>>  	if (up->wakeirq) {
>> -		retval = request_irq(up->wakeirq, serial_omap_irq,
>> -				     up->port.irqflags, up->name, up);
>> +		retval = request_threaded_irq(up->wakeirq, serial_omap_fast_irq,
>> +						serial_omap_irq,
>> +						IRQF_ONESHOT | up->port.irqflags,
>> +						up->name, up);
>>  		if (retval) {
>>  			free_irq(up->port.irq, up);
>>  			return retval;
>>


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Frans Klaver Sept. 16, 2014, 8:50 a.m. UTC | #3
On Mon, Sep 15, 2014 at 01:31:56PM -0400, Peter Hurley wrote:
> On 09/15/2014 11:39 AM, Peter Hurley wrote:
> > On 09/15/2014 10:00 AM, Frans Klaver wrote:
> >> At 3.6Mbaud, with slightly over 2Mbit/s data coming in, we see 1600 uart
> >> rx buffer overflows within 30 seconds. Threading the interrupt handling reduces
> >> this to about 170 overflows in 10 minutes.
> > 
> > Why is the threadirqs kernel boot option not sufficient?
> > Or conversely, shouldn't this be selectable?
> 

I wasn't aware of the threadirqs boot option. I also wouldn't know if
this should be selectable. What would be a reason to favor the
non-threaded irq over the threaded irq?

> Also, do you see the same performance differential when you implement this
> in the 8250 driver (that is, on top of Sebastian's omap->8250 conversion)?
> 

I haven't gotten Sebastian's driver to work properly yet on the console.
There was no reason for me yet to throw my omap changes on top of
Sebastian's queue.

> > PS - To overflow the 64 byte RX FIFO at those data rates means interrupt
> > latency in excess of 250us?

At 3686400 baud it should take about 174 us to fill a 64 byte buffer. I
haven't done any measurements on the interrupt latency though. If you
consider that we're sending about 1kB of data, 240 times a second, we're
spending a lot of time reading data from the uart. I can imagine the
system has other work to do as well.

This doesn't mean that we're not interested in Sebastian's driver
anymore though. We really want that dma support.

Thanks,
Frans
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter Hurley Sept. 17, 2014, 12:01 p.m. UTC | #4
On 09/16/2014 04:50 AM, Frans Klaver wrote:
> On Mon, Sep 15, 2014 at 01:31:56PM -0400, Peter Hurley wrote:
>> On 09/15/2014 11:39 AM, Peter Hurley wrote:
>>> On 09/15/2014 10:00 AM, Frans Klaver wrote:
>>>> At 3.6Mbaud, with slightly over 2Mbit/s data coming in, we see 1600 uart
>>>> rx buffer overflows within 30 seconds. Threading the interrupt handling reduces
>>>> this to about 170 overflows in 10 minutes.
>>>
>>> Why is the threadirqs kernel boot option not sufficient?
>>> Or conversely, shouldn't this be selectable?
>>
> 
> I wasn't aware of the threadirqs boot option. I also wouldn't know if
> this should be selectable. What would be a reason to favor the
> non-threaded irq over the threaded irq?

Not everyone cares enough about serial to dedicate kthreads to it :)

>> Also, do you see the same performance differential when you implement this
>> in the 8250 driver (that is, on top of Sebastian's omap->8250 conversion)?
>>
> 
> I haven't gotten Sebastian's driver to work properly yet on the console.
> There was no reason for me yet to throw my omap changes on top of
> Sebastian's queue.
> 
>>> PS - To overflow the 64 byte RX FIFO at those data rates means interrupt
>>> latency in excess of 250us?
> 
> At 3686400 baud it should take about 174 us to fill a 64 byte buffer. I
> haven't done any measurements on the interrupt latency though. If you
> consider that we're sending about 1kB of data, 240 times a second, we're
> spending a lot of time reading data from the uart. I can imagine the
> system has other work to do as well.

System work should not keep irqs from being serviced. Even 174us is a long
time not to service an interrupt. Maybe console writes are keeping the isr
from running?

Regards,
Peter Hurley

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Frans Klaver Sept. 17, 2014, 12:13 p.m. UTC | #5
On Wed, Sep 17, 2014 at 08:01:08AM -0400, Peter Hurley wrote:
> On 09/16/2014 04:50 AM, Frans Klaver wrote:
> > On Mon, Sep 15, 2014 at 01:31:56PM -0400, Peter Hurley wrote:
> >> On 09/15/2014 11:39 AM, Peter Hurley wrote:
> >>> On 09/15/2014 10:00 AM, Frans Klaver wrote:
> >>>> At 3.6Mbaud, with slightly over 2Mbit/s data coming in, we see 1600 uart
> >>>> rx buffer overflows within 30 seconds. Threading the interrupt handling reduces
> >>>> this to about 170 overflows in 10 minutes.
> >>>
> >>> Why is the threadirqs kernel boot option not sufficient?
> >>> Or conversely, shouldn't this be selectable?
> >>
> > 
> > I wasn't aware of the threadirqs boot option. I also wouldn't know if
> > this should be selectable. What would be a reason to favor the
> > non-threaded irq over the threaded irq?
> 
> Not everyone cares enough about serial to dedicate kthreads to it :)

Fair enough. In that light, we might not care enough about other
subsystems to dedicate kthreads to it :). Selectable seems reasonable in
that case.


> >> Also, do you see the same performance differential when you implement this
> >> in the 8250 driver (that is, on top of Sebastian's omap->8250 conversion)?
> >>
> > 
> > I haven't gotten Sebastian's driver to work properly yet on the console.
> > There was no reason for me yet to throw my omap changes on top of
> > Sebastian's queue.
> > 
> >>> PS - To overflow the 64 byte RX FIFO at those data rates means interrupt
> >>> latency in excess of 250us?
> > 
> > At 3686400 baud it should take about 174 us to fill a 64 byte buffer. I
> > haven't done any measurements on the interrupt latency though. If you
> > consider that we're sending about 1kB of data, 240 times a second, we're
> > spending a lot of time reading data from the uart. I can imagine the
> > system has other work to do as well.
> 
> System work should not keep irqs from being serviced. Even 174us is a long
> time not to service an interrupt. Maybe console writes are keeping the isr
> from running?

That's quite possible. I'll have to redo the test setup I had for this to
give you a decent answer. I'll have to do that anyway as Sebastian's
8250 conversion improves.

Thanks for the comments,
Frans
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Frans Klaver Sept. 23, 2014, 8:24 a.m. UTC | #6
On Wed, Sep 17, 2014 at 02:13:03PM +0200, Frans Klaver wrote:
> On Wed, Sep 17, 2014 at 08:01:08AM -0400, Peter Hurley wrote:
> > On 09/16/2014 04:50 AM, Frans Klaver wrote:
> > > On Mon, Sep 15, 2014 at 01:31:56PM -0400, Peter Hurley wrote:
> > >> On 09/15/2014 11:39 AM, Peter Hurley wrote:
> > >>> On 09/15/2014 10:00 AM, Frans Klaver wrote:
> > >>>> At 3.6Mbaud, with slightly over 2Mbit/s data coming in, we see 1600 uart
> > >>>> rx buffer overflows within 30 seconds. Threading the interrupt handling reduces
> > >>>> this to about 170 overflows in 10 minutes.
> > >>>
> > >>> Why is the threadirqs kernel boot option not sufficient?
> > >>> Or conversely, shouldn't this be selectable?
> > >>
> > > 
> > > I wasn't aware of the threadirqs boot option. I also wouldn't know if
> > > this should be selectable. What would be a reason to favor the
> > > non-threaded irq over the threaded irq?
> > 
> > Not everyone cares enough about serial to dedicate kthreads to it :)
> 
> Fair enough. In that light, we might not care enough about other
> subsystems to dedicate kthreads to it :). Selectable seems reasonable in
> that case.
> 
> 
> > >> Also, do you see the same performance differential when you implement this
> > >> in the 8250 driver (that is, on top of Sebastian's omap->8250 conversion)?
> > >>
> > > 
> > > I haven't gotten Sebastian's driver to work properly yet on the console.
> > > There was no reason for me yet to throw my omap changes on top of
> > > Sebastian's queue.

Doing the threaded interrupt change on the 8250 driver doesn't seem as
trivial. Unless I'm mistaken, that version of this patch would mess with
all other 8250 based serial drivers, if it's done properly. Incidentally
I did try using threadirqs, but that didn't give my any significant
results. I mostly noticed a difference in the console.


> > > 
> > >>> PS - To overflow the 64 byte RX FIFO at those data rates means interrupt
> > >>> latency in excess of 250us?
> > > 
> > > At 3686400 baud it should take about 174 us to fill a 64 byte buffer. I
> > > haven't done any measurements on the interrupt latency though. If you
> > > consider that we're sending about 1kB of data, 240 times a second, we're
> > > spending a lot of time reading data from the uart. I can imagine the
> > > system has other work to do as well.
> > 
> > System work should not keep irqs from being serviced. Even 174us is a long
> > time not to service an interrupt. Maybe console writes are keeping the isr
> > from running?
> 
> That's quite possible. I'll have to redo the test setup I had for this to
> give you a decent answer. I'll have to do that anyway as Sebastian's
> 8250 conversion improves.

I haven't had time yet to look into this any further. I'll accept that
this patch may fix a case most people aren't the least interested in.
I'll also happily accept that I probably need a better argumentation
than "this works better for us".Would it make sense to drop this patch
and resubmit the other three? As I mentioned in the previous run, I
think these are useful in any case.

Thanks,
Frans
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter Hurley Sept. 23, 2014, 5:17 p.m. UTC | #7
On 09/23/2014 04:24 AM, Frans Klaver wrote:
> On Wed, Sep 17, 2014 at 02:13:03PM +0200, Frans Klaver wrote:
>> On Wed, Sep 17, 2014 at 08:01:08AM -0400, Peter Hurley wrote:
>>> On 09/16/2014 04:50 AM, Frans Klaver wrote:
>>>> On Mon, Sep 15, 2014 at 01:31:56PM -0400, Peter Hurley wrote:
>>>>> On 09/15/2014 11:39 AM, Peter Hurley wrote:
>>>>>> On 09/15/2014 10:00 AM, Frans Klaver wrote:
>>>>>>> At 3.6Mbaud, with slightly over 2Mbit/s data coming in, we see 1600 uart
>>>>>>> rx buffer overflows within 30 seconds. Threading the interrupt handling reduces
>>>>>>> this to about 170 overflows in 10 minutes.
>>>>>>
>>>>>> Why is the threadirqs kernel boot option not sufficient?
>>>>>> Or conversely, shouldn't this be selectable?
>>>>>
>>>>
>>>> I wasn't aware of the threadirqs boot option. I also wouldn't know if
>>>> this should be selectable. What would be a reason to favor the
>>>> non-threaded irq over the threaded irq?
>>>
>>> Not everyone cares enough about serial to dedicate kthreads to it :)
>>
>> Fair enough. In that light, we might not care enough about other
>> subsystems to dedicate kthreads to it :). Selectable seems reasonable in
>> that case.
>>
>>
>>>>> Also, do you see the same performance differential when you implement this
>>>>> in the 8250 driver (that is, on top of Sebastian's omap->8250 conversion)?
>>>>>
>>>>
>>>> I haven't gotten Sebastian's driver to work properly yet on the console.
>>>> There was no reason for me yet to throw my omap changes on top of
>>>> Sebastian's queue.
> 
> Doing the threaded interrupt change on the 8250 driver doesn't seem as
> trivial. Unless I'm mistaken, that version of this patch would mess with
> all other 8250 based serial drivers, if it's done properly. Incidentally
> I did try using threadirqs, but that didn't give my any significant
> results. I mostly noticed a difference in the console.
> 
> 
>>>>
>>>>>> PS - To overflow the 64 byte RX FIFO at those data rates means interrupt
>>>>>> latency in excess of 250us?
>>>>
>>>> At 3686400 baud it should take about 174 us to fill a 64 byte buffer. I
>>>> haven't done any measurements on the interrupt latency though. If you
>>>> consider that we're sending about 1kB of data, 240 times a second, we're
>>>> spending a lot of time reading data from the uart. I can imagine the
>>>> system has other work to do as well.
>>>
>>> System work should not keep irqs from being serviced. Even 174us is a long
>>> time not to service an interrupt. Maybe console writes are keeping the isr
>>> from running?
>>
>> That's quite possible. I'll have to redo the test setup I had for this to
>> give you a decent answer. I'll have to do that anyway as Sebastian's
>> 8250 conversion improves.
> 
> I haven't had time yet to look into this any further. I'll accept that
> this patch may fix a case most people aren't the least interested in.
> I'll also happily accept that I probably need a better argumentation
> than "this works better for us".Would it make sense to drop this patch
> and resubmit the other three? As I mentioned in the previous run, I
> think these are useful in any case.

I would've thought the first 2 patches had already been picked up because
they fix div-by-zero faults.

I don't really have a problem with the patch (except for it should be
selectable, even if that's just a CONFIG_ setting). At the same time,
the performance results don't really make sense; so if there's actually
an underlying problem, I'd rather that get addressed (and the long
interrupt latency may be the underlying problem).

As far as the 8250 driver and threaded irqs go, I just was hoping for
another data point with a simple hard-coded test jig, not a full-blown
patch series for all of them. Sorry for the misunderstanding.

Regards,
Peter Hurley
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Frans Klaver Sept. 23, 2014, 6:11 p.m. UTC | #8
On 23 September 2014 19:17:20 CEST, Peter Hurley <peter@hurleysoftware.com> wrote:
>On 09/23/2014 04:24 AM, Frans Klaver wrote:
>> On Wed, Sep 17, 2014 at 02:13:03PM +0200, Frans Klaver wrote:
>>> On Wed, Sep 17, 2014 at 08:01:08AM -0400, Peter Hurley wrote:
>>>> On 09/16/2014 04:50 AM, Frans Klaver wrote:
>>>>> On Mon, Sep 15, 2014 at 01:31:56PM -0400, Peter Hurley wrote:
>>>>>> On 09/15/2014 11:39 AM, Peter Hurley wrote:
>>>>>>> On 09/15/2014 10:00 AM, Frans Klaver wrote:
>>>>>>>> At 3.6Mbaud, with slightly over 2Mbit/s data coming in, we see
>1600 uart
>>>>>>>> rx buffer overflows within 30 seconds. Threading the interrupt
>handling reduces
>>>>>>>> this to about 170 overflows in 10 minutes.
>>>>>>>
>>>>>>> Why is the threadirqs kernel boot option not sufficient?
>>>>>>> Or conversely, shouldn't this be selectable?
>>>>>>
>>>>>
>>>>> I wasn't aware of the threadirqs boot option. I also wouldn't know
>if
>>>>> this should be selectable. What would be a reason to favor the
>>>>> non-threaded irq over the threaded irq?
>>>>
>>>> Not everyone cares enough about serial to dedicate kthreads to it
>:)
>>>
>>> Fair enough. In that light, we might not care enough about other
>>> subsystems to dedicate kthreads to it :). Selectable seems
>reasonable in
>>> that case.
>>>
>>>
>>>>>> Also, do you see the same performance differential when you
>implement this
>>>>>> in the 8250 driver (that is, on top of Sebastian's omap->8250
>conversion)?
>>>>>>
>>>>>
>>>>> I haven't gotten Sebastian's driver to work properly yet on the
>console.
>>>>> There was no reason for me yet to throw my omap changes on top of
>>>>> Sebastian's queue.
>> 
>> Doing the threaded interrupt change on the 8250 driver doesn't seem
>as
>> trivial. Unless I'm mistaken, that version of this patch would mess
>with
>> all other 8250 based serial drivers, if it's done properly.
>Incidentally
>> I did try using threadirqs, but that didn't give my any significant
>> results. I mostly noticed a difference in the console.
>> 
>> 
>>>>>
>>>>>>> PS - To overflow the 64 byte RX FIFO at those data rates means
>interrupt
>>>>>>> latency in excess of 250us?
>>>>>
>>>>> At 3686400 baud it should take about 174 us to fill a 64 byte
>buffer. I
>>>>> haven't done any measurements on the interrupt latency though. If
>you
>>>>> consider that we're sending about 1kB of data, 240 times a second,
>we're
>>>>> spending a lot of time reading data from the uart. I can imagine
>the
>>>>> system has other work to do as well.
>>>>
>>>> System work should not keep irqs from being serviced. Even 174us is
>a long
>>>> time not to service an interrupt. Maybe console writes are keeping
>the isr
>>>> from running?
>>>
>>> That's quite possible. I'll have to redo the test setup I had for
>this to
>>> give you a decent answer. I'll have to do that anyway as Sebastian's
>>> 8250 conversion improves.
>> 
>> I haven't had time yet to look into this any further. I'll accept
>that
>> this patch may fix a case most people aren't the least interested in.
>> I'll also happily accept that I probably need a better argumentation
>> than "this works better for us".Would it make sense to drop this
>patch
>> and resubmit the other three? As I mentioned in the previous run, I
>> think these are useful in any case.
>
>I would've thought the first 2 patches had already been picked up
>because
>they fix div-by-zero faults.

I've had no confirmation of that happening so far. I also don't know if I should expect one. Who'd take these patches? Tony? 


>I don't really have a problem with the patch (except for it should be
>selectable, even if that's just a CONFIG_ setting). At the same time,
>the performance results don't really make sense; so if there's actually
>an underlying problem, I'd rather that get addressed (and the long
>interrupt latency may be the underlying problem).

Your questions got me thinking a bit more. I concluded that it's hard to define why this difference in performance is so big. I only got to it by just trying and seeing what would happen. 


>As far as the 8250 driver and threaded irqs go, I just was hoping for
>another data point with a simple hard-coded test jig, not a full-blown
>patch series for all of them. Sorry for the misunderstanding.

Ah yes. I'll see what I can do about it. It does make sense to get that data point somehow. 

Thanks, 
Frans 

>
>Regards,
>Peter Hurley
>
>_______________________________________________
>linux-arm-kernel mailing list
>linux-arm-kernel@lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Sept. 23, 2014, 6:38 p.m. UTC | #9
* Frans Klaver <fransklaver@gmail.com> [140923 11:12]:
> On 23 September 2014 19:17:20 CEST, Peter Hurley <peter@hurleysoftware.com> wrote:
> >
> >I would've thought the first 2 patches had already been picked up
> >because
> >they fix div-by-zero faults.
> 
> I've had no confirmation of that happening so far. I also don't
> know if I should expect one. Who'd take these patches? Tony? 

$ scripts/get_maintainer.pl -f drivers/tty/serial/omap-serial.c

Shows they should be sent to Greg and linux-serial. Please also Cc
linux-omap. And if it's a fix, please make sure the subject has the
magic word fix :)

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Frans Klaver Sept. 23, 2014, 8:02 p.m. UTC | #10
On Tue, Sep 23, 2014 at 8:38 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Frans Klaver <fransklaver@gmail.com> [140923 11:12]:
>> On 23 September 2014 19:17:20 CEST, Peter Hurley <peter@hurleysoftware.com> wrote:
>> >
>> >I would've thought the first 2 patches had already been picked up
>> >because
>> >they fix div-by-zero faults.
>>
>> I've had no confirmation of that happening so far. I also don't
>> know if I should expect one. Who'd take these patches? Tony?
>
> $ scripts/get_maintainer.pl -f drivers/tty/serial/omap-serial.c
>
> Shows they should be sent to Greg and linux-serial. Please also Cc
> linux-omap. And if it's a fix, please make sure the subject has the
> magic word fix :)

Done. Thanks.

Frans
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 7d3f557..398139a 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -575,6 +575,20 @@  static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)
 }
 
 /**
+ * serial_omap_fast_irq() - schedule interrupt handling
+ */
+static irqreturn_t serial_omap_fast_irq(int irq, void *dev_id)
+{
+	struct uart_omap_port *up = dev_id;
+	unsigned int iir = serial_in(up, UART_IIR);
+
+	if (iir & UART_IIR_NO_INT)
+		return IRQ_NONE;
+
+	return IRQ_WAKE_THREAD;
+}
+
+/**
  * serial_omap_irq() - This handles the interrupt from one port
  * @irq: uart port irq number
  * @dev_id: uart port info
@@ -584,7 +598,6 @@  static irqreturn_t serial_omap_irq(int irq, void *dev_id)
 	struct uart_omap_port *up = dev_id;
 	unsigned int iir, lsr;
 	unsigned int type;
-	irqreturn_t ret = IRQ_NONE;
 	int max_count = 256;
 
 	spin_lock(&up->port.lock);
@@ -595,7 +608,6 @@  static irqreturn_t serial_omap_irq(int irq, void *dev_id)
 		if (iir & UART_IIR_NO_INT)
 			break;
 
-		ret = IRQ_HANDLED;
 		lsr = serial_in(up, UART_LSR);
 
 		/* extract IRQ type from IIR register */
@@ -634,7 +646,7 @@  static irqreturn_t serial_omap_irq(int irq, void *dev_id)
 	pm_runtime_put_autosuspend(up->dev);
 	up->port_activity = jiffies;
 
-	return ret;
+	return IRQ_HANDLED;
 }
 
 static unsigned int serial_omap_tx_empty(struct uart_port *port)
@@ -731,15 +743,19 @@  static int serial_omap_startup(struct uart_port *port)
 	/*
 	 * Allocate the IRQ
 	 */
-	retval = request_irq(up->port.irq, serial_omap_irq, up->port.irqflags,
-				up->name, up);
+	retval = request_threaded_irq(up->port.irq, serial_omap_fast_irq,
+						serial_omap_irq,
+						IRQF_ONESHOT | up->port.irqflags,
+						up->name, up);
 	if (retval)
 		return retval;
 
 	/* Optional wake-up IRQ */
 	if (up->wakeirq) {
-		retval = request_irq(up->wakeirq, serial_omap_irq,
-				     up->port.irqflags, up->name, up);
+		retval = request_threaded_irq(up->wakeirq, serial_omap_fast_irq,
+						serial_omap_irq,
+						IRQF_ONESHOT | up->port.irqflags,
+						up->name, up);
 		if (retval) {
 			free_irq(up->port.irq, up);
 			return retval;