All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Dimitrov <picmaster@mail.bg>
To: Fabio Estevam <festevam@gmail.com>,
	 "Frazer, Will" <will.frazer@eurotech.com>
Cc: "meta-freescale@yoctoproject.org" <meta-freescale@yoctoproject.org>
Subject: Re: imx.c RXTL
Date: Wed, 29 Apr 2015 20:15:53 +0300	[thread overview]
Message-ID: <554111C9.3090802@mail.bg> (raw)
In-Reply-To: <CAOMZO5AJui4TUwsb9erdeqBnMJJq93DxyabRPsNjC9m5zgFFsQ@mail.gmail.com>

Hi Fabio, Will,

On 04/29/2015 06:29 PM, Fabio Estevam wrote:
> Hi Will,
>
> On Wed, Apr 29, 2015 at 10:24 AM, Fabio Estevam <festevam@gmail.com>
> wrote:
>> Hi Will,
>>
>> On Wed, Apr 29, 2015 at 9:08 AM, Frazer, Will
>> <will.frazer@eurotech.com> wrote:
>>
>>> In tests I can see that with the value set as 1, under intensive
>>> serial use, CPU use goes towards about 20% (solo core). With the
>>> value set to 14 it’s closer to 2%.
>>
>> I think your proposal makes sense.
>>
>> Should we also change TXTL?
>
> I tested your proposal and it seems we need some logic to adjust the
> RXTL value.
>
> For console operation we need it to be RXTL, otherwise we miss
> echoing the chars.

It's normal to have this behavior when RXTL is 1, this essentially
generates 1 interrupt per character. In order to reduce interrupt load,
it's not enough to just increase the RXTL to a higher value, for reasons
observed by Fabio.

If one wants to use RXFIFO > 1 character, the solution is called "Aging
Timer" (it was available even back in the 16550 days). It's
functionality is to assert an interrupt when:
- there's at least 1 character in RXFIFO
- no characters have been received for several character periods (I
think for imx6 it's 8)

Both interrupts (RRDY & AgingTimeout) together handle all situations in
appropriate manner. Let's look at the code
(http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/tty/serial/imx.c?h=imx_3.14.28_1.0.0_ga):


static irqreturn_t imx_int(int irq, void *dev_id)
{
...
	sts = readl(sport->port.membase + USR1);

	if ((sts & USR1_RRDY || sts & USR1_AGTIM) &&
		!sport->dma_is_enabled) {
		if (sts & USR1_AGTIM)
			writel(USR1_AGTIM, sport->port.membase + USR1);
		imx_rxint(irq, dev_id);
	}
...
}


It seems to me that AGTIM is not handled if DMA is enabled.
Unfortunately these 2 features are not connected at all, imho.

It's also good to note that the RXTL level is different for the system
console and other serial ports:


...
#define RXTL 1 /* For console port */
#define RXTL_UART 16 /* For uart */

static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
{
...
	if (uart_console(&sport->port))
		rx_fifo_trig = RXTL;
	else
		rx_fifo_trig = RXTL_UART;
...
}


What can you do to solve this? You can try disabling the dma and test
how it works for you, or you can fix the driver logic to use the AgingTimer.

Regards,
Nikolay


  reply	other threads:[~2015-04-29 17:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 12:08 imx.c RXTL Frazer, Will
2015-04-29 13:24 ` Fabio Estevam
2015-04-29 15:29   ` Fabio Estevam
2015-04-29 17:15     ` Nikolay Dimitrov [this message]
2015-04-29 15:31 ` Fabio Estevam
2015-04-29 17:00   ` Frazer, Will
2015-04-29 17:18     ` Nikolay Dimitrov
2015-04-29 17:38       ` Frazer, Will

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=554111C9.3090802@mail.bg \
    --to=picmaster@mail.bg \
    --cc=festevam@gmail.com \
    --cc=meta-freescale@yoctoproject.org \
    --cc=will.frazer@eurotech.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.