Re: Ethernet communication from real time thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mathias,


From: M. Koehrer <mathias_koehrer@xxxxxxxx>>
> My questions are now:
> A call of send() in my user space application to transmit a UDP message 
> ends up in the network stack of Linux.
> Which real time priority will be used in the network stack?
When you make a system call (e.g. socket) then your system call is 
processed in the same thread as your application is running... Just in kernel
space
> Is it the priority of the user space thread that is calling send()?
Therefor, yes!
> Or is it the priority of the kernel thread [sirq-net-tx/3]?
Yes too, because your network packet will be put in a queue, which
is processed by sirq-net-tx. (Altough, on my system sending packet
are processed by sirq-net-rx, it might be a bug...)

> On the receive side (calling recv()):
> Which threads are relevant here?
> IRQ-XX for the NIC's irq thread, [sirq-net-rx/3] or also the user space 
> thread that is calling recv()?
Your IRQ-XX thread is relevant too. Interrupts can be shared, and they
are first dispatched by this IRQ-XX thread, which then calls
the sirq-net-rx. So you need to prioritize both threads... And you're 
final reciption thread too...

To be sure that you take the right IRQ-XX thread you can look up which
IRQ is used by your network card by invoking this: 
cat /proc/interrupts

To be sure you took every thread which is used by your application you 
can do a function trace, or a scheduling trace, which might be less verbose.
You need to enable that in your kernel (onder kernel hacking, Tracers...)

Mount you're debug fs:
sudo mount -t debugfs debugfs /debug

Get available tracers
cat /debug/tracing/available_tracers

Enable one and do a the trace, while you're app is running:
echo sched_switch > /debug/tracing/current_tracer
echo 1 > /debug/tracing/tracing_enabled
wait a short while
echo 0 > /debug/tracing/tracing_enabled
cat /debug/tracing/trace > /tmp/yourtrace

Thats how i understand the thing atm, Im pretty new to preempt rt and linux 
kernel hacking too, so some of my explanations might be wrong... :-)

I send network packets with preempt rt too, it might be interessting to
share some expirences... With which frequency do you send packets? 
Does it happen for you that you're top is somehow messed up? I use to have 
different cpu usages each time i start my application... It seems that the
scheduler has some problems with short period tasks, networking and 
accounting...


Bye
Stefan



      

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux