From: Tom Evans <tom_usenet@optusnet.com.au>
To: Holger Schurig <holgerschurig@gmail.com>
Cc: linux-can@vger.kernel.org
Subject: Re: CAN question: how to trace frame errors?
Date: Sun, 14 Jun 2015 12:42:54 +1000 [thread overview]
Message-ID: <557CEA2E.5060904@optusnet.com.au> (raw)
In-Reply-To: <CAOpc7mHYiX3SAJSEHM32PA1gRFA+BQ0DxCC3U6Aux15Swy06sQ@mail.gmail.com>
On 14/06/2015 6:28 AM, Holger Schurig wrote:
>> and while the CPU supports different interrupt priorities, the 3.4 TZIC code
>> simply doesn't provide the functions to change it.
>
> I don't know the i.MX5x and it's TZIC, only the i.MX6 ... and only a
> bit. But I think there it's not a limitation in the silicon, but in
> the software (Linux in our case, e.g. drivers/irqchips/gic*).
I think Linux has to cater for the "lowest common denominator hardware",
so features like priority interrupts aren't used/supported for the cases
where they simply aren't present.
> And btw, thanks for your patch. I'll probably rewrite it to use kfifo,
> which is a ringbuffer already contained in Linux (see
> include/linux/kfifo.h), I think that will increase it's chance of
> inclusion.
I think there'll be a architectural/philosophical push-back against a
change that makes an interrupt service routine take longer. I'll let
those with more experience than me make this case.
Data point. Reading pretty much any peripheral register (in any ISR)
takes 180ns on an i.MX53, and I'd expect similar with the i.MX6 [1].
Reading the entire FIFO would take four reads/message plus another
couple for the status words for each entry, so about 7us or 7000 CPU
clocks at 1GHz.
But here's a compromise. The FlexCAN controller has nearly 70 different
interrupt sources, although normally only a few are enabled.
FLEXCANx_IFLAG1[bit 5] is "at least one frame in FIFO" and
FLEXCANx_IFLAG1[bit 6] is "FIFO nearly full" (4 out of 6).
So I'd suggest enabling both of them and having the code work like it
does now for the normal interrupt, but have the "FIFO nearly full" one
trigger an unload (to the ring buffer) within the interrupt. That would
result in a fast interrupt routine most of the time, only taking a bit
longer when needed to avoid overflow. Synchronising the reads in the ISR
and the ones in NAPI "left as an interesting exercise for the
programmer" (especially trying to test it properly :-).
Slow peripheral reads (even OCRAM is slow) discussed here:
https://community.freescale.com/thread/355199
Tom
next prev parent reply other threads:[~2015-06-14 2:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 9:29 CAN question: how to trace frame errors? Holger Schurig
2015-06-12 9:34 ` Marc Kleine-Budde
2015-06-12 10:01 ` Holger Schurig
2015-06-12 12:33 ` Tom Evans
2015-06-12 14:24 ` Holger Schurig
2015-06-13 15:30 ` Tom Evans
2015-06-13 20:28 ` Holger Schurig
2015-06-14 2:42 ` Tom Evans [this message]
2015-06-22 12:17 ` Holger Schurig
2015-06-22 13:15 ` Marc Kleine-Budde
2015-06-24 14:29 ` Holger Schurig
2015-06-25 8:37 ` Tom Evans
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=557CEA2E.5060904@optusnet.com.au \
--to=tom_usenet@optusnet.com.au \
--cc=holgerschurig@gmail.com \
--cc=linux-can@vger.kernel.org \
/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.