From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Martin Kozusky <mkozusky@kkmicro.cz>
Cc: linux-can@vger.kernel.org
Subject: Re: can4linux compilation for i.mx25 under 2.6.39
Date: Thu, 31 May 2012 15:42:55 +0200 [thread overview]
Message-ID: <4FC7755F.7020403@pengutronix.de> (raw)
In-Reply-To: <jq7rnt$acc$1@dough.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2341 bytes --]
On 05/31/2012 03:29 PM, Martin Kozusky wrote:
> Dne 30.5.2012 16:18, Marc Kleine-Budde napsal(a):
>> On 05/30/2012 03:26 PM, Martin Kozusky wrote:
>>> Dne 30.5.2012 15:18, Marc Kleine-Budde napsal(a):
>>>> On 05/30/2012 02:50 PM, Martin Kozusky wrote:
>>>>>>> The best for me would be some kernel module which would just put
>>>>>>> the CAN
>>>>>>> frame into some big "from userspace available" buffer in the
>>>>>>> interrupt
>>>>>>> and nothing more. My app would check if there is anything new and
>>>>>>> read
>>>>>>> it out.
>>>>>>> There are around 1500/sec (at 250kbit) can frames on the bus when
>>>>>>> the
>>>>>>> problem arise, I think it's not that much.
>>>>>>
>>>>>> Are you writing the can frames to storage in the same thread as
>>>>>> receiving them?
>>>>>
>>>>>
>>>>> No, CAN has it's own thread, which is just making struct from can
>>>>> messages (reading via select() ) and writes them into another buffer.
>>>>> Then the main thread reads this buffer and writes to SD card. Now I
>>>>> changed it so that this buffer is 30MB big, so I first store all the
>>>>> messages into RAM, and when I don't need to record CAN frames
>>>>> anymore, I
>>>>> write all of them to card from this big buffer.
>>>>> But this is just limited workaround because I'm limited with the RAM
>>>>> size (so I had to make the buffer cyclic and just latest xxxx messages
>>>>> are stored, older are overwritten when the buffer is full).
>>>>
>>>> Have you setup realtime priorities for you CAN thread?
>>> No, I did't set up any special attributes. Do you mean I should use
>>> pthread_attr_setschedpolicy(ptr,SCHED_RR) or something else?
>>
>> or better SCHED_FIFO for your can thread.
> Hello Marc,
> I tried that and still when I write
> dd if=/dev/zero of=/mnt/mmcblk0p1/test bs=512 count=10000 (copy 5MB to
> SD card) around 300 CAN frames (from 68500 frames) are lost :(
http://man7.org/linux/man-pages/man2/recvmmsg.2.html
Maybe you can use recvmmsg(). I don't know if it works already on can
sockets.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2012-05-31 13:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-30 11:39 can4linux compilation for i.mx25 under 2.6.39 Martin Kozusky
2012-05-30 11:50 ` Marc Kleine-Budde
2012-05-30 12:05 ` Martin Kozusky
2012-05-30 12:08 ` Martin Kozusky
2012-05-30 12:18 ` Marc Kleine-Budde
2012-05-30 12:34 ` Martin Kozusky
2012-05-30 12:37 ` Marc Kleine-Budde
2012-05-30 12:16 ` Marc Kleine-Budde
2012-05-30 12:29 ` Martin Kozusky
2012-05-30 12:40 ` Marc Kleine-Budde
2012-05-30 12:50 ` Martin Kozusky
2012-05-30 13:18 ` Marc Kleine-Budde
2012-05-30 13:26 ` Martin Kozusky
2012-05-30 14:18 ` Marc Kleine-Budde
2012-05-31 13:29 ` Martin Kozusky
2012-05-31 13:42 ` Marc Kleine-Budde [this message]
2012-05-31 16:28 ` Oliver Hartkopp
2012-06-01 8:12 ` Martin Kozusky
2012-06-01 11:22 ` Oliver Hartkopp
2012-06-01 6:19 ` Martin Kozusky
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=4FC7755F.7020403@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=mkozusky@kkmicro.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).