All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Holtz <jan5697@gmx.net>
Cc: xenomai@xenomai.org
Subject: Re: Effective way to stream data from xenomai task to linux domain task
Date: Wed, 10 Feb 2021 18:08:48 +0100	[thread overview]
Message-ID: <87y2fvlujj.fsf@xenomai.org> (raw)
In-Reply-To: <trinity-f80d2905-650a-40fe-868e-5e8b383b367c-1612976082333@3c-app-gmx-bap21>


Jan Holtz via Xenomai <xenomai@xenomai.org> writes:

>    Hello,
>
>    i am running a xenomai 3 on a SMP cobalt kernel using the alchemy skin.
>
>    I have a rt task running in a 10kHz period which has to transfer every
>    40ms a amount of data (30.000 byte)  to the linux domain task.
>
>    At moment i am using a rt_pipe with the file backend on linux side.
>    In my setup the rt_pipe_write call takes upto 60 microseconds .
>    Measured using rt_timer_read.
>
>    I expected that writing to the pipe is the bottleneck, so i created a
>    second task and used a queue to push data to this task, which is
>    feeding the pipe.
>    The runtime for the rt_queue_write is like the same, which i measured
>    bevore using the rt_pipe_write.
>
>    My questions:
>    Is the amout of time i need for this action expectable, or may i have
>    another issue?
>    Is there a more effective way to communicate/stream data to the linux
>    task? Are the xddp sockets faster on the xenomai side (i iam correct
>    the pipe is based on this?)
>
>
>    Hope you have s suggestion or a tip.
>

rt_pipe is based on xddp, which involves a user->kernel->user data
roundtrip via Cobalt's xnpipe mechanism, this is likely what is time
consuming for the most part. Using xddp should not give you better
figures.

rt_queue_write may be costly because it first allocates a buffer to
write your data to, before queuing it. The allocation + copy ops are
likely the outstanding ones in the benchmark figures.

If the implementation allows this, you may want to pre-allocate a number
of queue buffers using rt_queue_alloc, pushing them to the receiver by
calling rt_queue_send. That would mimic rt_queue_write, but moving out
the buffer allocation to a non time-sensitive place. You would simply
have to manage a free list of pre-allocated buffers.

Based on the previous optimization, you may want to prep your data in
place, directly into a pre-allocated buffer if possible. That would save
you one data copy.

-- 
Philippe.


  reply	other threads:[~2021-02-10 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 16:54 Effective way to stream data from xenomai task to linux domain task Jan Holtz
2021-02-10 17:08 ` Philippe Gerum [this message]
2021-02-10 17:31   ` Philippe Gerum

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=87y2fvlujj.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=jan5697@gmx.net \
    --cc=xenomai@xenomai.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.