IO Scheduling Classes and Compiling Larger Projects

Occasionally I am forced to build larger parts of kernel, not only the “hot area”. This is mainly caused trough modified header files at a prominent position (e.g. tcp.h) or through some updates where the timestamps are updated. Depending on the current workload I restrict the CPU usage by not provide the full SMP load via -j N. But this is one kind of load - the other is IO/disk load....

June 19, 2010 · 2 min · Hagen Paul Pfeifer

L7 Filter IRC

(17:17) < fw> pakete kriegt das ding via libnetfilter_queue, was prinzipiell schon richtig ist (17:18) < fw> Typische loesung ist, nur "noch-nicht-klassifiziert" pakete zu queuen, und nach sagen wir 4k aufhoeren (17:18) <hgn> das wird eine baumstruktur (17:19) < fw> so sollte es sein (17:19) <hgn> genau (17:19) < fw> aber fuer l7filter sind alle pakete gleich, und alle pattern auch (17:19) < fw> und das ist schlecht[tm] (17:19) <hgn> ok (17:19) <hgn> das ist wirklich schlecht (17:19) < fw> und es ist c++ ;)

June 18, 2010 · 1 min · Hagen Paul Pfeifer

Hypervisor Time Machine Call Graph

Finally: a dream comes true. Doubling or even increase tenfold the clock frequency of your CPU without costs by modifying some variables. Drawback it just works under use of a hypervisor; a virtual environments under kvm. ;-) Just kidding, but as explained yesterday in a blog posting my idea was to introduce a decoupled behavior of the virtual clock. Actually I had no notion to explain the implementation in detail. Just some aspects: the mechanism does not use a utilize a virtual interrupt, on the contrary a memory page is mapped into the guest....

June 17, 2010 · 1 min · Hagen Paul Pfeifer

Virtual Machine Time Lapse

Today I had the idea of accelerate respective decelerate the time for virtual guest machines. The idea comes into mind with time discrete simulators where the wall clock behavior is not required or rather cumbersome. Linux sophisticated kernel virtualization infrastructure is kvm (Kernel-based Virtual Machine, where Intels VT-x or AMD-V native virtualization technique is used). Several timing systems are supported by QEMU and the kernel side: PIT, an emulation of @Intels i8254@ Programmable Interval Timer, normally with three 16 bit counters, modern back in @i8086@ CPUs days RTC, the real time clock with a interval of 32768 ticks per second to advance the time system reported by interrupt number 8....

June 16, 2010 · 2 min · Hagen Paul Pfeifer

Hypervisor IRC Fun

(22:37) <fw > hast du nen kvm im kvm, oder fummelst du nur am guest kernel rum? (22:37) <hgn> modular, ich lade die hypervisor abstraktion dynamisch via kvm.ko und kvm-amd.ko (22:38) <hgn> was kann schon passieren, jetzt bleib mal auf den boden! ;) (22:38) <fw > harhar (22:38) <fw > *hgn has quit irc [connection reset by peer] (22:39) <fw > hrhr

June 16, 2010 · 1 min · Hagen Paul Pfeifer

GCC generated Switch Jump Tables

The disassembled output of filter.o looks not cache-line friendly, with the current generated code two cache-lines must be hit – at least. A switch statement with two case statements is translated into a sequence of conditional branches like this (arch: @x86_64@): 4b8: 8b 06 mov (%rsi),%eax 4ba: 66 83 f8 35 cmp $0x35,%ax 4be: 0f 84 d8 02 00 00 je 79c <sk_run_filter+0x325> 4c4: 0f 87 07 01 00 00 ja 5d1 <sk_run_filter+0x15a> 4ca: 66 83 f8 15 cmp $0x15,%ax 4ce: 0f 84 cd 02 00 00 je 7a1 <sk_run_filter+0x32a> 4d4: 77 73 ja 549 <sk_run_filter+0xd2> 4d6: 66 83 f8 04 cmp $0x4,%ax 4da: 0f 84 1f 02 00 00 je 6ff <sk_run_filter+0x288> 4e0: 77 29 ja 50b <sk_run_filter+0x94> The whole switch/case jump construct in @run_filter()@ eat exactly 567 byte ....

June 15, 2010 · 2 min · Hagen Paul Pfeifer

On the Generating of IP Fragments

If the IP packet size exceed the link layer maximum transmission unit (MTU, 1500 byte for Ethernet v2) a packet must be fragmented. Yesterday Changli Gao submited a patch that optimize the reassembling process in the kernel. Changli assumption was that fragments arrived in accureate ascending order. He optimized the processing behavior by optimizing the list processing of inet_frag_queue for IPv4 and IPv6 by introducing an additional pointer, called fragments_tail that points to the end of the list....

June 14, 2010 · 2 min · Hagen Paul Pfeifer

IRC License Discussions

Lately in the IRC after looking at some “Linuxtag”:http://www.linuxtag.org/ photos (19:43) < h**> http://www.flickr.com/photos/linuxtag/4699311928/ (19:44) < h**> thomas und drei linux chicks! ;-) (20:02) < n***> open-source-babes sind halt immer nur son community-produkt ;) (20:04) < l***> he, das waren nur die angestellten von Beach at the box (20:14) < c***> n***: na dafuer darfste open-source-babes nach belieben nutzen und weiterreichen ;) (20:17) < k**> yeah, und wenn sie unter einer bsd-lizenz steht darfst du die auch kommerziell weitervertreiben (20:17) < w*****> :D (20:21) < h**> ;) (20:31) < n***> jo, GPL-babes haben den weiteren nachteil, dass man jegliche modifikationen, die man an ihnen vornimmt, publizieren muss ;) (20:36) < h**> warum n0-1?...

June 14, 2010 · 1 min · Hagen Paul Pfeifer

IPSec and Quagga Automating

A tiny drawback of quagga is a missing feature to signal the host environment when routes change. So it is not simple to start/stop scripts if routes are added or deleted. For example: if you want to add or delete a security association if a route changes then it is not directly possible via quagga. But Linux and other operating systems provides a monitor mode where all relevant network events can be caught by the user space....

June 14, 2010 · 1 min · Hagen Paul Pfeifer

CPU Cycles versus Cacheline Miss

Optimization changed over time - optimization today does not address CPU cycle/instruction, rather reduced memory transaction are the key to success. Keep the code small and keep the code in the cacheline and reduce memory loads. A cache miss is equivalent to 100 instructions during a CPU stall. Therefore keeping the @.text@ footprint small can boost your application more then some sophisticated CPU tweaks. Pahole provides a feeling how the @....

June 14, 2010 · 2 min · Hagen Paul Pfeifer