All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Evans <tom_usenet@optusnet.com.au>
To: info@gerhard-bertelsmann.de, "François Beaulier" <fbeaulier@orange.fr>
Cc: linux-can@vger.kernel.org
Subject: Re: Linux board with 10 CANs
Date: Mon, 18 May 2015 22:56:32 +1000	[thread overview]
Message-ID: <5559E180.9020105@optusnet.com.au> (raw)
In-Reply-To: <45240.212.149.48.43.1431942011.squirrel@webmail.rdts.de>

On 18/05/2015 7:40 PM, Gerhard Bertelsmann wrote:
> Hi Francois,
> Am Mo, 18.05.2015, 11:25, schrieb François Beaulier:
>> I know the MCP2515 may work in some situation but it depends on kernel
>> latency and that is very unpredictable.

You can always try running RT or Xenomai. I wouldn't recommend that.

We had trouble with Linux kernel latency, until I found our supplier had 
shipped Linux with a whole bunch of debugging turned on. We got rid of 
CONFIG_DEBUG_PAGEALLOC, SPIN, MUTEX, and SLUB debugging and it got a lot 
more responsive. I had to trace the kernel to find out where it was 
spending all its time (in SLUB debugging mainly).

We're running two FlexCAN ports, each with a 6-deep FIFO at 1MHz each. 
We're not having any problems now [1]. You're wanting to run at 1/20 of 
that data rate with 1/3 of the FIFO depth. That should work, even with 
10 of them running.

Note 1: The CAN driver deferred reading data to NAPI, the debugs were on 
and the (old non-NAPI) Ethernet driver happily kept pulling hundreds of 
Ethernet packets in during one interrupt, so I was getting CAN overruns. 
I rewrote the CAN driver to read message data during Interrupts, 
throttled Ethernet and added interrupt priority and turned the debugs 
off. Now it is fine.

>> What is helping in QSPI ?

Instead of your GHZ CPU having to wait for a 10MHz SPI bus to send a 
byte, or be interrupted once per byte, it can load up 16 multi-byte 
transactions and be interrupted when the whole thing is complete. I 
don't know how good the SPI drivers are and how well the Linux MCP2515 
driver supports this (if it supports the hardware queue). It looks like 
it reads a whole CAN message in a single SPI transaction though.

>> the main problem beeing latency between
 >> MCP irq and effective SPI transfer ?

Go Multicore and spread the load, or keep long latency stuff of the CAN 
core.

> The only concern that I have is the latency/overhead of the SocketCAN
> API with 10 CANs at high packet rates on 1 GHz ARM ...

The interrupts, NAPI and SocketCAN switches and code all add about the 
same overhead to each message processed. Multiple interrupts, a NAPI run 
and SocketCAN context switch for 8 bytes of user data (or maybe even one 
or no bytes) is a pain. CAN and Linux really weren't mean to get on and 
it shows.

Or you could run 5 complete CPUs, networked via Ethernet.

The USB solution looks good, as long as the USB is reliable.

Tom


      parent reply	other threads:[~2015-05-18 12:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15  7:56 Linux board with 10 CANs François Beaulier
2015-05-15  8:20 ` Yegor Yefremov
2015-05-15  8:50   ` François Beaulier
2015-05-15  9:11   ` Marc Kleine-Budde
2015-05-15  9:33     ` François Beaulier
2015-05-15 10:24       ` Andri Yngvason
2015-05-15 12:40         ` François Beaulier
2015-05-15 12:47           ` Marc Kleine-Budde
2015-05-15 13:04             ` AW: [BULK]Re: " Uwe Wilhelm (PEAK-System)
2015-05-15 13:17               ` Marc Kleine-Budde
2015-05-15 13:20                 ` AW: " Uwe Wilhelm (PEAK-System)
2015-05-15 14:18               ` François Beaulier
2015-05-15 12:38       ` Gerhard Uttenthaler
2015-05-15 12:48         ` Marc Kleine-Budde
2015-05-15 13:54 ` Bernd Krumboeck
2015-05-18  9:07   ` François Beaulier
2015-05-18 13:31     ` Bernd Krumboeck
2015-05-20 11:35       ` Gediminas Simanskis
2015-05-21  3:19         ` Bernd Krumboeck
2015-05-15 15:24 ` Tom Evans
2015-05-18  9:25   ` François Beaulier
2015-05-18  9:40     ` Gerhard Bertelsmann
2015-05-18 11:13       ` François Beaulier
2015-05-18 12:56       ` Tom Evans [this message]

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=5559E180.9020105@optusnet.com.au \
    --to=tom_usenet@optusnet.com.au \
    --cc=fbeaulier@orange.fr \
    --cc=info@gerhard-bertelsmann.de \
    --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.