linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Brian Silverman <brian@peloton-tech.com>,
	Austin Schuh <austin@peloton-tech.com>,
	Daniel Squires <dan@engineeredarts.co.uk>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>, linux-can@vger.kernel.org
Subject: Re: socket can receive order
Date: Wed, 09 Sep 2015 18:23:32 +0200	[thread overview]
Message-ID: <55F05D04.6090908@hartkopp.net> (raw)
In-Reply-To: <CAGt3f4nRhtx=W_2NWErmoS=o4x0qu89VzkfgLvsJ1=+WLYyJTw@mail.gmail.com>

On 09.09.2015 05:10, Brian Silverman wrote:
> Another thing Austin and I do is set up RPS (receive packet steering)
> for the Ethernet interfaces so the hardware sends the physical
> Ethernet interrupts to that same core which isn't involved in
> servicing the CAN interfaces at all.
>
> On Tue, Sep 8, 2015 at 10:30 PM, Austin Schuh <austin@peloton-tech.com> wrote:
>>
>> On our boxes, I've been setting the affinity for both the IRQ thread
>> (we are running a RT kernel), and the interrupt to the same single
>> core.  Would that help here?

Yes it does.

Nailing the interrupts from ethernet and CAN interfaces to different CPUs by 
setting irq_affinity is a valid but pretty hard solution.

Therefore I was trying to use hash based RPS to fix the out-of-order problem 
and let the kernel networking do the (hopefully optimal) rest.

>> We've seen CAN packets get significantly delayed causing overruns due
>> to Ethernet load and both CAN and ethernet sharing the same softirq.
>> Our solution has been to set the affinity for each of those to
>> different cores to keep them isolated.

Yes. That's a good point. Due to the fact that you split up ethernet and CAN 
on different CPUs the softirq is also running on different CPUs.

This could also be the solution for Daniels problem!

My suggested solution (aka 'hack' 
http://marc.info/?l=linux-netdev&m=143689694125450&w=2 ) with the hash based 
RPS does not split the ethernet/CAN traffic among CPUs as - depending on the 
IP hashes - some of the ethernet traffic can be pushed into the same CPU we 
use for the CAN interface.

So it's a softer solution which at least fixes out-of-order for CAN interfaces.

Regards,
Oliver

ps. There were some performance tests (vanilla and RT kernel) from the 
University of Prague where you can see the impact of additional ethernet load:

http://rtime.felk.cvut.cz/can/

http://rtime.felk.cvut.cz/can/benchmark/3.0/

  reply	other threads:[~2015-09-09 16:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08  9:42 socket can receive order Daniel Squires
2015-09-08 10:01 ` Marc Kleine-Budde
2015-09-08 10:41   ` Daniel Squires
2015-09-08 11:13     ` Marc Kleine-Budde
2015-09-08 11:17       ` Daniel Squires
2015-09-08 11:20         ` Marc Kleine-Budde
2015-09-08 11:37           ` Daniel Squires
2015-09-08 16:56         ` Oliver Hartkopp
2015-09-09  2:30           ` Austin Schuh
2015-09-09  3:10             ` Brian Silverman
2015-09-09 16:23               ` Oliver Hartkopp [this message]
2015-09-09 12:05             ` Daniel Squires
2015-09-09 16:14             ` Daniel Squires
2015-09-09 16:31               ` Oliver Hartkopp
2015-09-17 19:18               ` Oliver Hartkopp
2015-09-08 11:46       ` Wolfgang Grandegger
2015-09-08 11:49         ` Daniel Squires
2015-09-08 11:56         ` Marc Kleine-Budde
2015-09-10  2:29         ` Tom Evans
2015-09-10  8:08           ` Daniel Squires

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=55F05D04.6090908@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=austin@peloton-tech.com \
    --cc=brian@peloton-tech.com \
    --cc=dan@engineeredarts.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).