From: Stephane Grosjean <s.grosjean@peak-system.com>
To: Andri Yngvason <andri.yngvason@marel.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
Oliver Hartkopp <socketcan@hartkopp.net>,
linux-can@vger.kernel.org, wg@grandegger.com,
hrafnkell.eiriksson@marel.com, haukur.hafsteinsson@marel.com
Subject: Re: peak_pci: TX Frame Loss
Date: Tue, 22 Dec 2015 09:13:25 +0100 [thread overview]
Message-ID: <56790625.6060908@peak-system.com> (raw)
In-Reply-To: <20151208122455.GA16567@maxwell.marel.net>
Hi Andri,
We're currently investigating hard onto this issue. On my side, I'm
checking the software part and I'd like to discuss with you about one
point:
AFAIK the "sja1000_start_xmit()" function calls are really serialized by
the network core. So there's actually no need of any lock to share the
access of the SJA1000 registers, regarding the Tx path. Right. But I
don't see in this function any test condition over the Transmit Status
bit before writing the outgoing CAN frame (aka "reg[SJA1000_SR] & SR_TS").
Without testing the Transmit Status bit before writing, wouldn't it be
possible that any 2nd task overwrite a 1st frame written by a 1st task
before it has been really sent by the SJA1000?
Regards,
Stéphane
Le 08/12/2015 13:24, Andri Yngvason a écrit :
> Hi Stephane,
>
> On Tue, Dec 08, 2015 at 12:42:58PM +0100, Stephane Grosjean wrote:
>> Hi Andri,
>>
>> So, you mean that, for example, the below sequence (extract from _xmit()):
>>
>> priv->write_reg(priv, SJA1000_FI, fi);
>> priv->write_reg(priv, SJA1000_ID1, (id & 0x000007f8) >> 3);
>> priv->write_reg(priv, SJA1000_ID2, (id & 0x00000007) << 5);
>> ...
>> (1)
>> ...
>> sja1000_write_cmdreg(priv, CMD_TR);
>>
>> can't be interrupted at all (especially at (1)), by any IRQ which ISR could
>> write (again) some new ID?
>> I mean, shouldn't the SJA1000 and the sequence order of the cmds be
>> considered as shared resource?
>>
> AFAIK only _xmit() writes to these registers and I think the _xmit() function is
> only ever executed on one core at a time. Executing two of them at the same time
> wouldn't make much sense. It would just cause out-of-order transmission.
>
> Also, the interrupt routine does not call _xmit() directly. It just calls
> netif_wake_queue() which AFAIK schedules the _xmit() routine to be called later.
>
> I'm just saying that we shouldn't place locks where they are not needed because
> it really just obfuscates the real issue. It's the equivalent of leaving the
> mess on the ground and just walking around it instead of cleaning it up. Someone
> else will step into it.
>
> Besides, ftrace does not show _xmit() being called concurrently for the frames
> that are lost.
>
> By the way, I'm not sure that I understood you correctly. Did placing the spin
> locks prevent the issue? I'm not sure this "guess what" rhetoric works well on a
> mailing list. ;)
>
> Thanks,
> Andri
--
We hereby inform you that PEAK-System Europe will be closed from 24 December 2015 untill 4 January 2016.
During this period there will be only limited software and technical support available.
We wish you all a merry christmas and a happy new year!
-The PEAK-System Europe Team -
--
PEAK-System Technik GmbH
Sitz der Gesellschaft Darmstadt
Handelsregister Darmstadt HRB 9183
Geschaeftsfuehrung: Alexander Gach, Uwe Wilhelm
--
next prev parent reply other threads:[~2015-12-22 8:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-18 14:51 peak_pci: TX Frame Loss Andri Yngvason
2015-11-19 8:38 ` Stephane Grosjean
2015-11-19 10:12 ` Andri Yngvason
2015-12-02 18:09 ` Andri Yngvason
2015-12-02 19:19 ` Oliver Hartkopp
2015-12-03 6:37 ` Oliver Hartkopp
2015-12-03 11:23 ` Andri Yngvason
2015-12-03 11:44 ` Marc Kleine-Budde
2015-12-08 10:21 ` Stephane Grosjean
2015-12-08 10:50 ` Andri Yngvason
2015-12-08 11:42 ` Stephane Grosjean
2015-12-08 12:24 ` Andri Yngvason
2015-12-08 14:12 ` [BULK]Re: " Stephane Grosjean
2015-12-22 8:13 ` Stephane Grosjean [this message]
2015-12-22 11:51 ` Andri Yngvason
2015-12-03 16:37 ` Stephane Grosjean
2015-12-03 8:20 ` Marc Kleine-Budde
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=56790625.6060908@peak-system.com \
--to=s.grosjean@peak-system.com \
--cc=andri.yngvason@marel.com \
--cc=haukur.hafsteinsson@marel.com \
--cc=hrafnkell.eiriksson@marel.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=socketcan@hartkopp.net \
--cc=wg@grandegger.com \
/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).