All of lore.kernel.org
 help / color / mirror / Atom feed
From: Torsten Lang <torsten.lang@uweschneider.de>
Cc: Holger Schurig <holgerschurig@gmail.com>,
	Alexander Stein <alexander.stein@systec-electronic.com>,
	linux-can@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de>
Subject: Re: can: flexcan: implement workaround for FIFO overruns (based on code by David Jander)
Date: Wed, 22 Jul 2015 10:00:29 +0200	[thread overview]
Message-ID: <55AF4D9D.8040904@uweschneider.de> (raw)
In-Reply-To: <CAOpc7mG52ni5ESuijv1qVLpMznZXSxxU8gmkhjGqtKZfXuxUNQ@mail.gmail.com>

Am 09.07.2015 um 09:59 schrieb Holger Schurig:
>> The early parts (ColdFire) have 16 buffers, didn't have "Message Queueing" or the FIFO, so aren't supported by Linux at all.
> Fine, so we can ignore them :-)
That would be one more reason to at least have an option for working without the hardware FIFO.
>
>> Is it "normal" to have interrupts locked out for more than 300us (six 50us CAN messages at 1MHz)?
> Unfortunately yes.  My $CUSTOMER had overruns with 500 kB/s, 80% bus
> load, and CAN messages with 3 bytes of data. My guess this was mostly
> due to the sucky SDHCI (eMMC) driver code in Linux. I fixed that, but
> occassionally ftrace still shows large times with irqsoff, I need to
> dig into them as well. Still /me thinks that an RxFIFO of just 6 CAN
> messages isn't swell for an OS that is known to not guarantee response
> times, like Linux. Especially not for CAN, people use it after all
> because of it's reliability guarantees.
I've done some tests with FTRACE, same result. The trace results show that the SDHCI driver executes long sequences of code under spinlock_irqsave. As far as I can see from the trace, sdhci_do_set_ios first locks the interrupts, then activates the clock, does the operation and deactivates the clock again. The actual busy looping appears in the IMX SD/MMC driver which is waiting after every clock change. Turning off CONFIG_MMC_CLKGATE doesn't help here. Even when these busy waits would be avoided there still would be ~100us of operations under spinlock_irqsave.
>
> BTW, with the current in-tree FlexCAN drivers we have two things were
> IRQ or scheduling latency can cause lost frames:
>
> * the time from the hardware IRQ until flexcan_isr() is actually
> called, e.g. because for spin_lock_irqsave
> * the time when the ISR does a napi_schedule() until NAPI get's
> scheduled and calls flexcan_poll()
>
> For the first latency, only FTRACE and fixing the other kernel parts
> helps. Unfortunately, some kernel parts are so complex that it is
> over-the-head of many people (ok, I confess: over my head).
>
> I killed the second latency with my kfifo patch that I posted the
> other day. Getting rid of NAPI completely would also be a method, I'm
> not sure NAPI wins us anything, compared to Ethernet CAN is slow.


  parent reply	other threads:[~2015-07-22  8:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-08 14:38 can: flexcan: implement workaround for FIFO overruns (based on code by David Jander) Torsten Lang
2015-07-09  6:33 ` Holger Schurig
2015-07-09  6:38   ` Holger Schurig
2015-07-09  9:26   ` Torsten Lang
2015-07-09  9:32     ` Holger Schurig
2015-07-09  9:36       ` Marc Kleine-Budde
2015-07-09  9:42         ` Holger Schurig
2015-07-09  6:58 ` Alexander Stein
2015-07-09  7:27   ` Holger Schurig
2015-07-09  7:48     ` Alexander Stein
2015-07-09  7:59       ` Holger Schurig
2015-07-09 10:03         ` Torsten Lang
2015-07-22  8:00         ` Torsten Lang [this message]
2015-07-22  8:57           ` Marc Kleine-Budde
2015-07-24  3:53             ` Tom Evans
2015-07-24  8:45               ` Torsten Lang
2015-07-09  7:42 ` Tom Evans
2015-07-09  9:48   ` Torsten Lang
2015-07-09 10:05     ` Holger Schurig
2015-07-09 15:36     ` Tom Evans
2015-07-10  9:17       ` Torsten Lang
2015-07-11  6:42         ` Tom Evans
2015-07-09  8:06 ` Holger Schurig
2015-07-09  8:43   ` Oliver Hartkopp

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=55AF4D9D.8040904@uweschneider.de \
    --to=torsten.lang@uweschneider.de \
    --cc=alexander.stein@systec-electronic.com \
    --cc=holgerschurig@gmail.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /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.