From: Tom Evans <tom_usenet@optusnet.com.au>
To: Vlastimil Setka <setka@vstk.cz>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Robert Schwebel <r.schwebel@pengutronix.de>
Cc: rfi@lists.rocketboards.org, linux-can <linux-can@vger.kernel.org>
Subject: Re: [Rfi] Cyclone V CAN errors when application pinned to CPU1
Date: Mon, 8 Feb 2016 09:19:37 +1100 [thread overview]
Message-ID: <56B7C2F9.2090901@optusnet.com.au> (raw)
In-Reply-To: <56B6881F.3010606@vstk.cz>
On 07/02/16 10:56, Vlastimil Setka wrote:
> 6.2.2016 23:34 Tom Evans:
>> On 7/02/2016 4:59 AM, Vlastimil Setka wrote:
>>>>> We have a linux application which sends data
>>>>> periodically (1 to 20 ms period) out over the
>>>>> can0 socketcan interface. Sometimes the first
>>>>> data byte in the CAN frame is zero on the wire,
>>>>> but non-zero in the data sent!
>>>> The TX functions is usually pretty straight forward. Copy all data bytes into the hardware, write ID and DLC, then hit the send bit (or whatever triggers the hardware to send the frame). Maybe there's some barrier missing in this sequence?
>> I'd suggest you "objdump -S" the CAN driver object file and check to see the optimizer hasn't re-ordered the above sequence too much.
...
>>> It can be reproducibly triggered by a high network load on
>>> ethernet generated by iperf for example.
>>
>> Which generates a lot of interrupts. Which are probably
>> interrupting the above transmit sequence and delaying its
>> completion. During which time something else can get in.
...
>> I'd suggest you add a "reentry counter" to the driver
An easier way to investigate this (initially, you'll need things like reentry
counters later) is to add "spin_lock_irqsave()" and "spin_unlock_irqrestore()"
pairs around sections of the CAN driver code you want to "protect". Have a
look at the other CAN drivers that do this and some of the large number of
Ethernet drivers for examples of how to declare the variables and call the
functions.
I'm not recommending the above as a fix, just as a tool for narrowing down the
cause of your problem.
If this is bad advice (the wrong functions etc) I ask others on the list that
know better to correct me.
Tom
prev parent reply other threads:[~2016-02-07 22:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <562155B7.7020504@vsis.cz>
2015-10-20 7:18 ` [Rfi] Cyclone V CAN errors when application pinned to CPU1 Robert Schwebel
2015-10-20 7:37 ` Marc Kleine-Budde
2016-02-06 17:59 ` Vlastimil Setka
2016-02-06 22:34 ` Tom Evans
2016-02-06 23:56 ` Vlastimil Setka
2016-02-07 0:54 ` Tom Evans
2016-02-07 22:19 ` 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=56B7C2F9.2090901@optusnet.com.au \
--to=tom_usenet@optusnet.com.au \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=r.schwebel@pengutronix.de \
--cc=rfi@lists.rocketboards.org \
--cc=setka@vstk.cz \
/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).