linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "\"Martin Kožuský [KK micro s.r.o.]\"" <mkozusky@kkmicro.cz>
To: Wolfgang Grandegger <wg@grandegger.com>, linux-can@vger.kernel.org
Subject: Re: CAN messages being lost on i.MX25 with flexcan - continued (was CAN messages being lost on i.MX25 with flexcan - 2012-04-19)
Date: Wed, 30 Oct 2013 10:14:05 +0100	[thread overview]
Message-ID: <5270CDDD.9080405@kkmicro.cz> (raw)
In-Reply-To: <5270CB8D.5020206@grandegger.com>

-------- Original Message  --------
Subject: Re: CAN messages being lost on i.MX25 with flexcan - continued (was CAN messages being lost on i.MX25 with flexcan - 2012-04-19)
From: Wolfgang Grandegger
To: Martin Kožuský [KK micro s.r.o.], linux-can@vger.kernel.org
Date: 30. Říjen 2013 10:04:13

> On 10/30/2013 09:43 AM, "Martin Kožuský [KK micro s.r.o.]" wrote:
>> -------- Original Message  --------
>> Subject: Re: CAN messages being lost on i.MX25 with flexcan - continued
>> (was CAN messages being lost on i.MX25 with flexcan - 2012-04-19)
>> From: Wolfgang Grandegger
>> To: Martin Kozusky, linux-can@vger.kernel.org
>> Date: 29. Říjen 2013 15:30:08
>>
>>> On 10/29/2013 01:40 PM, Martin Kozusky wrote:
>>>> Dne 29.10.2013 13:03, Wolfgang Grandegger napsal(a):
>>>>> On 10/29/2013 11:46 AM, Martin Kozusky wrote:
>>> ...
>>>>>> Hello Wolfgang,
>>>>>> it seems that my architecture (arm/mx25 on 2.6.35 kernel) is missing
>>>>>> HAVE_FUNCTION_GRAPH_TRACER, HAVE_DYNAMIC_FTRACE options so it won't be
>>>>>> that easy, will be?
>>>>>> Timestamps that ftrace is showing me are in 10 miliseconds resolution,
>>>>>> that won't help me much :(
>>>
>>> Are high resolution timers enabled in the kernel? Still, event tracing
>>> could would already be useful.
>>>
>>>>> Probably that version is to old for proper ftrace support. The 100us
>>>>> you
>>>>> measured for alloc_can_skb() is worst case, right? What is the mean
>>>>> value?
>>>>
>>>> Now I checked again and logged every call (don't know if realy
>>>> everything was logged but something was :) and I see that it is not
>>>> 100usec, but only around 20usec (mean value - checked by eye). There
>>>> were some very long calls (around 2ms!) that were puttings errors in my
>>>> sum/count formula (may be I should filter out calls longer that
>>>> 200usec), with this error it was not 100usec, but almost 1ms (my value
>>>> was only 32bit and was overflowing when I wrote it first time). So
>>>> normally around 20usec, but with very long calls around 2-3 ms (looks
>>>> like those long are periodic - each 6th - 8th call is much longer, but
>>>> not all the time)
>>>
>>> Are these long latencies related to the SDcard accesses? I think the
>>> problem is the rather long latencies caused by other kernel activity. In
>>> your case caused by the MMC (SDcard) driver, I assume. The Flexcan
>>> controller does buffer up to 5 messages before loosing packets.
>> I think it is not primary related to SD card, those tests I was doing
>> lately were done when system was idle, no special processes were
>> running. But when I do access SD card, problems get bigger.
>>
>>>> But still with those 20usec call, there are many RX overflows, if I
>>>> disable the call alloc_can_skb, there are no overflows and all is
>>>> received (but still not processed further, because I don't have skb
>>>> ... )
>>>
>>> Could you run this test for a longer time? The probability is just lower
>>> that RX gets interrupted for a longer time, I think.
>> I have run it for a few minutes, problem is still the same :(
>>
>>> I see a few approaches to overcome this problem:
>>>
>>> - fix the MMC driver to cause less latency. If you are lucky this is
>>>     already the case in more recent versions of the kernel.
>> Hard to say if this helps when it's also doing in idle.
>
> OK, then I misinterpreted your error description.
>
>>> - Use the "-rt" extension (CONFIG_PREEPMT_RT). It will then allow to
>>>     adjust priorities of soft and hard irq threads.
>> I don't know if there is a patch for this :(
>>
>>> - Do the RX processing in the interrupt context, which would require
>>>     some custom modifications.
>> I was thinking about writing data directly to fifo file, my program
>> would read from it
>
> Well, before hacking something you should try to find out what is
> provoking the long latencies (> 1ms). FTrace is your friend. Therefore I
> would try to get a more recent version of the kernel running somehow.
> 2.6.39 should already be much better.
I will try to get new kernel running, but when I checked the patch for 2.6.35, I see some incompatibilites in directory structure and files, so I will have to go line-by-line and make my patch that will fit the new kernel. And when I do that, I will try it on latest 3.x kernel. I hope I will make it work.

Martin
  
> Wolfgang.
>
>


  reply	other threads:[~2013-10-30  9:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24 13:48 CAN messages being lost on i.MX25 with flexcan - continued (was CAN messages being lost on i.MX25 with flexcan - 2012-04-19) Martin Kozusky
2013-10-25 12:59 ` Martin Kozusky
2013-10-25 17:58   ` Wolfgang Grandegger
2013-10-26 18:18     ` Martin Kozusky
2013-10-26 19:40       ` Wolfgang Grandegger
2013-10-29 10:46         ` Martin Kozusky
2013-10-29 12:03           ` Wolfgang Grandegger
2013-10-29 12:22             ` Wolfgang Grandegger
2013-10-29 12:49               ` Martin Kozusky
2013-10-29 12:54                 ` Gary Thomas
2013-10-29 13:00                   ` "Martin Kožuský [KK micro s.r.o.]"
2013-10-29 12:40             ` Martin Kozusky
2013-10-29 14:30               ` Wolfgang Grandegger
2013-10-30  8:43                 ` "Martin Kožuský [KK micro s.r.o.]"
2013-10-30  9:04                   ` Wolfgang Grandegger
2013-10-30  9:14                     ` "Martin Kožuský [KK micro s.r.o.]" [this message]
2013-10-30  9:27                       ` Wolfgang Grandegger

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=5270CDDD.9080405@kkmicro.cz \
    --to=mkozusky@kkmicro.cz \
    --cc=linux-can@vger.kernel.org \
    --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).