All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: Van Jacobson's net channels and real-time
@ 2006-04-24 17:28 Caitlin Bestler
  0 siblings, 0 replies; 32+ messages in thread
From: Caitlin Bestler @ 2006-04-24 17:28 UTC (permalink / raw)
  To: netdev

netdev-owner@vger.kernel.org wrote:
> Subject: Re: Van Jacobson's net channels and real-time
> 
> 
> On Mon, 24 Apr 2006, Auke Kok wrote:
> 
>> Ingo Oeser wrote:
>>> On Saturday, 22. April 2006 15:49, Jörn Engel wrote:
>>>> That was another main point, yes.  And the endpoints should be as
>>>> little burden on the bottlenecks as possible.  One bottleneck is
>>>> the receive interrupt, which shouldn't wait for cachelines from
>>>> other cpus too much.
>>> 
>>> Thats right. This will be made a non issue with early demuxing on
>>> the NIC and MSI (or was it MSI-X?) which will select the right CPU
>>> based on hardware channels.
>> 
>> MSI-X. with MSI you still have only one cpu handling all MSI
>> interrupts and that doesn't look any different than ordinary
>> interrupts. MSI-X will allow much better interrupt handling across
>> several cpu's. 
>> 
>> Auke
>> -
> 
> Message signaled interrupts are just a kudge to save a trace
> on a PC board (read make junk cheaper still). They are not
> faster and may even be slower. They will not be the salvation
> of any interrupt latency problems. The solutions for
> increasing networking speed, where the bit-rate on the wire
> gets close to the bit-rate on the bus, is to put more and
> more of the networking code inside the network board. The CPU
> get interrupted after most things (like network handshakes)
> are complete.
> 

The number of hardware interrupts supported is a bit out of scope.
Whatever the capacity is, the key is to have as few meaningless
interrupts as possible.

In the context of netchannels this would mean that an interrupt
should only be fired when there is a sufficient number of packets
for the user-mode code to process. Fully offloading the protocol
to the hardware is certainly one option, that I also thinks make
sense, but the goal of netchannels is to try to optimize performance
while keeping TCP processing on host.

More hardware offload is distinctly possible and relevant in this
context. Statefull offload, such as TSO, are fully relevant.
Going directly from the NIC to the channel is also possible (after
the channel is set up by the kernel, of course). If the NIC is
aware of the channels directly then interrupts can be limited to
packets that cross per-channel thresholds configured directly
by the ring consumer.



^ permalink raw reply	[flat|nested] 32+ messages in thread
* Van Jacobson's net channels and real-time
@ 2006-04-20 16:29 Esben Nielsen
  2006-04-20 19:09 ` David S. Miller
  2006-04-21  8:53 ` Jan Kiszka
  0 siblings, 2 replies; 32+ messages in thread
From: Esben Nielsen @ 2006-04-20 16:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar

Before I start, where is VJ's code? I have not been able to find it anywhere.

With the preempt-realtime branch maturing and finding it's way into the
mainline kernel, using Linux (without sub-kernels) for real-time applications
is becomming an realistic option without having to do a lot of hacks in the
kernel on your own. But the network stack could be improved and some of the
ideas in Van Jacobson's net channels could be usefull when receiving network
packages with real-time latencies.

Finding the end point in the receive interrupt and send of the packet to
the receiving process directly is a good idea if it is fast enough to do
so in the interrupt context (and I think it can be done very fast). One
problem in the current setup, is that everything has to go through the
soft interrupt.  That is even if you make a completely new, non-IP
protocol, the latency for delivering the frame to your application is
still limited by the latency of the IP-stack because it still have to go
through soft irq which might be busy working on IP packages. Even if you
open a raw socket, the latency is limited to the latency of the soft irq.
At work we use a widely used commercial RTOS. It got exactly the same
problem of having every network packet being handled by the same thread.

Buffer management is another issue. On the RTOS above you make a buffer pool
per network device for receiving packages. On Linux received packages are taken
from the global memory pool with GFP_ATOMIC. On both systems you can easily run
out of buffers if they are not freed back to the pool fast enough. In that
case you will just have to drop packages as they are received. Without
having the code to VJ's net channels, it looks like they solve the problem:
Each end receiver provides his own receive resources. If a receiver can't cope
with  all the traffic, it will loose packages, the others wont. That makes it
safe to run important real-time traffic along with some unpredictable, low
priority  TCP/IP traffic. If the TCP/IP receivers does not run fast enough,
their packages will be dropped, but the driver will not drop the real-time
packages. The nice thing about a real-time task is that you know it's latency
and therefore know how many receive buffers it needs to avoid loosing
packages in a worst case scenario.

Implementing new protocols in user space is a good idea, too. The developer -
who doesn't need to be a hard-core kernel hacker - can pick whatever language
he wants and has far easier access to debugging tools than in the kernel.
Unfortunately, it does not perform very well.
Using raw sockets is a way to do protocol stacks in user space now, but you
can only listen to packets with a specific protocol id. Therefore you either
have to make one thread or process in userspace receive everything and then
send it to the end receivers, or let all threads receive all and let them
throw away packages not for them. Apparently the filter mechanism for VJ's
net channels (if it is made general enough) would solve that problem, too.

Many realtime applications are time triggered. I.e. they wake up
say every 5 ms and poll their environment for new inputs, do their
calculations and then send out the results again. For such an application
it will be very efficient to make the driver put the network packages in a
mmap'ed area, but not try to wake up the application. The application will
simply poll the mmap'ed channel every 5 ms. Once this is setup there is no
system calls issued for receiving packages at all!
On Linux today - for packet orientated protocols at least - the application has
to issue a system call for every packet received plus a system call in the end
to check there is no more packeges to be read.

Esben


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2006-05-02 16:03 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <63KcN-6lD-25@gated-at.bofh.it>
     [not found] ` <64wrg-2cg-41@gated-at.bofh.it>
     [not found]   ` <64wAE-2Cs-9@gated-at.bofh.it>
     [not found]     ` <64AkV-8cG-7@gated-at.bofh.it>
     [not found]       ` <65cqo-5tR-33@gated-at.bofh.it>
     [not found]         ` <65cJF-66i-11@gated-at.bofh.it>
2006-04-24 23:48           ` Van Jacobson's net channels and real-time Robert Hancock
2006-04-24 17:28 Caitlin Bestler
  -- strict thread matches above, loose matches on Subject: below --
2006-04-20 16:29 Esben Nielsen
2006-04-20 19:09 ` David S. Miller
2006-04-21 16:52   ` Ingo Oeser
2006-04-22 11:48     ` Jörn Engel
2006-04-22 13:29       ` Ingo Oeser
2006-04-22 13:49         ` Jörn Engel
2006-04-23  0:05           ` Ingo Oeser
2006-04-23  5:50             ` David S. Miller
2006-04-24 16:42             ` Auke Kok
2006-04-24 16:59               ` linux-os (Dick Johnson)
2006-04-24 17:19                 ` Rick Jones
2006-04-24 18:12                   ` linux-os (Dick Johnson)
2006-04-24 23:17                 ` Michael Chan
2006-04-25  1:49                 ` Auke Kok
2006-04-25 11:29                   ` linux-os (Dick Johnson)
2006-05-02 12:41                     ` Vojtech Pavlik
2006-05-02 15:58                       ` Andi Kleen
2006-04-23  5:52         ` David S. Miller
2006-04-23  9:23         ` Avi Kivity
2006-04-23  5:51       ` David S. Miller
2006-04-23  5:56     ` David S. Miller
2006-04-23 14:15       ` Ingo Oeser
2006-04-22 19:30   ` bert hubert
2006-04-23  5:53     ` David S. Miller
2006-04-21  8:53 ` Jan Kiszka
2006-04-24 14:22   ` Esben Nielsen
2006-04-27  8:09     ` Jan Kiszka
2006-04-27  8:16       ` David S. Miller
2006-04-27 10:00         ` Jan Kiszka
2006-04-27 19:50           ` David S. Miller

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.