<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Tuxology</title>
	<atom:link href="http://tuxology.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://tuxology.net</link>
	<description>A Linux embedded, kernel and training blog</description>
	<pubDate>Mon, 10 Nov 2008 14:22:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Rami Rosen on IPv6 in Linux</title>
		<link>http://tuxology.net/2008/11/10/rami-rosen-on-ipv6-in-linux/</link>
		<comments>http://tuxology.net/2008/11/10/rami-rosen-on-ipv6-in-linux/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 14:22:49 +0000</pubDate>
		<dc:creator>Tuxology team</dc:creator>
		
		<category><![CDATA[Herzelinux]]></category>

		<category><![CDATA[Lectures]]></category>

		<category><![CDATA[Network]]></category>

		<category><![CDATA[article]]></category>

		<category><![CDATA[ipv6]]></category>

		<category><![CDATA[lecture]]></category>

		<category><![CDATA[linuxdevices]]></category>

		<category><![CDATA[networking]]></category>

		<category><![CDATA[rami rosen]]></category>

		<category><![CDATA[slides]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=116</guid>
		<description><![CDATA[Last Thursday Rami Rosen, a Computer Science graduate of The Technion Israel Institute of Technology in Haifa, Israel and a Linux kernel programmer for a networking startup, gave an excellent talk about IPv6 and it&#8217;s implementation in the Linux kernel at monthly the Herzlinux meeting.
For those of our reader which were absent, fear not! not [...]]]></description>
			<content:encoded><![CDATA[<p>Last Thursday Rami Rosen, a Computer Science graduate of The Technion Israel Institute of Technology in Haifa, Israel and a Linux kernel programmer for a networking startup, gave an excellent talk about IPv6 and it&#8217;s implementation in the Linux kernel at monthly the <a href="http://tuxology.net/herzelinux">Herzlinux</a> meeting.</p>
<p>For those of our reader which were absent, fear not! not only are the slides for the lecture available <a href="http://tuxology.net/lectures/ipv6-in-the-linux-kernel/">here,</a> Rami posted an excellent <a href="http://linuxdevices.com/articles/AT7843301253.html">article based on the lecture</a> on <a href="http://linuxdevices.com/">LinuxDevices.com</a>.</p>
<p>Thanks you Rami and we look forward to hosting you again in <a href="http://tuxology.net/herzelinux/">Herzelinux</a> club meeting as well as here.</p>
<p>Tuxology Team.</p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/11/10/rami-rosen-on-ipv6-in-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Videos from the Linux Symposium in Ottawa</title>
		<link>http://tuxology.net/2008/08/14/videos-from-the-linux-symposium-in-ottawa/</link>
		<comments>http://tuxology.net/2008/08/14/videos-from-the-linux-symposium-in-ottawa/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 14:31:04 +0000</pubDate>
		<dc:creator>Gilad Ben-Yossef</dc:creator>
		
		<category><![CDATA[Conferences]]></category>

		<category><![CDATA[Lectures]]></category>

		<category><![CDATA[Video]]></category>

		<category><![CDATA[Embedded]]></category>

		<category><![CDATA[free electrons]]></category>

		<category><![CDATA[ols]]></category>

		<category><![CDATA[openmoko]]></category>

		<category><![CDATA[real time]]></category>

		<category><![CDATA[talks]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=86</guid>
		<description><![CDATA[The wonderful Michael Opdenacker and Thomas Petazzoni from Free Electrons are at it again - they have released 29 videos of talks, tutorials and &#8220;birds of a feather&#8221; sessions given at the 2008 Linux Symposium in Ottawa.
The released video includes the following:

Keynote: The Kernel: 10 Years in Review, by Matthew Wilcox (Intel)
Talk: Tux on the [...]]]></description>
			<content:encoded><![CDATA[<p>The wonderful Michael Opdenacker and Thomas Petazzoni from <a href="http://free-electrons.com/">Free Electrons</a> are at it again - they have released 29 videos of talks, tutorials and &#8220;birds of a feather&#8221; sessions given at the 2008 Linux Symposium in Ottawa.</p>
<p>The released video includes the following:</p>
<ul>
<li>Keynote: The Kernel: 10 Years in Review, by Matthew Wilcox (Intel)</li>
<li>Talk: Tux on the Air: State of Linux Wireless Networking, by John W. Linville (Red Hat)</li>
<li>Talk: Suspend to RAM in Linux: State of the Union, by Len Brown and Rafael Wysocki (Intel)</li>
<li>Talk: Real Time vs Real Fast: How To Choose?, by Paul E. McKenney (IBM)</li>
<li>Tutorial: ftrace: latency tracer, by Steven Rostedt (Red Hat)</li>
<li>BOF: Embedded Linux, by Tim R. Bird (Sony)</li>
<li>BOF: Embedded Micro controller Linux, by Michael Durrant (Arcturus Networks)</li>
<li>Talk: Energy-aware task and interrupt management, by Vaidyanathan Srinivasan (IBM)</li>
<li>Talk: Application Testing Under Realtime Linux, by Luis Claudio R. Gonçalves (Red Hat)</li>
<li>Talk: Application Framework for Your Mobile Device, by Shreyas Srinivasan (Geodesic Information Systems)</li>
<li>Keynote: The Making of OpenMoko Neo, by Werner Almesberger (OpenMoko)</li>
<li>BOF: U-Boot by Wolfgang Denk (Denx)</li>
<li>BOF: Linux Compiler, by Rob Landley (Impact Linux)</li>
<li>Talk: Advanced XIP File System, by Jared Hulbert (Intel)</li>
<li>Talk: SELinux for Consumer Electronic Devices, by Yuichi Nakamura (Hitachi)</li>
<li>Talk: Around the Linux File System World in 45 Minutes, by Steve French (IBM)</li>
<li>BOF: Linux The Easy Way with LTIB, by Stuart Hughes (Freescale)</li>
<li>Keynote: The Joy of Synchronicity: Coordinating the Releases of Upstream and Distributions, by Mark Shuttleworth</li>
<li>Talk: Smack in Embedded Computing, by Casey Schauffer</li>
<li>Talk: Bazillions of Pages: The Future of Memory Management, by Christoph H. Lameter (SGI)</li>
<li>Tutorial: Writing application fault handlers, by Gilad Ben-Yossef (Codefidence)</li>
<li>Talk: Linux, Open Source and System Bringup Tools, by Tim Hockin (Google)</li>
<li>Talk: DCCP Reached Mobiles, by Leandro Melo Sales (Federal University of Campina Grande)</li>
<li>Talk: Building a robust Linux kernel, by Subrata Modak (IBM)</li>
<li>CELF BOF presentation: Best of recent CELF Conferences, by Tim Bird (Sony)</li>
<li>CELF BOF presentation: Developing Embedded Linux with Target Control, by Tim Bird (Sony)</li>
<li>CELF BOF presentation: Embedded Building Tools - An Audience Survey, by Michael Opdenacker (Free Electrons)</li>
<li>CELF BOF presentation: GCC Tips and Tricks Highlights, by Gene Sally</li>
</ul>
<p>The videos and related resources can be downloaded from their <a href="http://free-electrons.com/community/videos/conferences/">conference videos page</a>.</p>
<p>I especially recommend viewing the exceptional &#8220;Real Time vs Real Fast: How To Choose?&#8221; talk by Paul E. McKenney from IBM and the the &#8220;The Making of OpenMoko Neo&#8221; keynote, by Werner Almesberger of the OpenMoko.</p>
<p>Much thanks to Michael and Thomas for sharing this with everybody.</p>
<p>Gilad</p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/08/14/videos-from-the-linux-symposium-in-ottawa/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using ldd and nm to locate crashing function</title>
		<link>http://tuxology.net/2008/08/04/using-ldd-and-nm-to-locate-crashing-function/</link>
		<comments>http://tuxology.net/2008/08/04/using-ldd-and-nm-to-locate-crashing-function/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 11:55:00 +0000</pubDate>
		<dc:creator>Gilad Ben-Yossef</dc:creator>
		
		<category><![CDATA[Applications]]></category>

		<category><![CDATA[Video]]></category>

		<category><![CDATA[debugging]]></category>

		<category><![CDATA[application]]></category>

		<category><![CDATA[debug]]></category>

		<category><![CDATA[ldd]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[nm]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=67</guid>
		<description><![CDATA[A new video post tutorial, showing how to locate the function where your Linux application crashed if all you know is the address where the crash happened using two common Linux utilities: ldd and nm.
Enjoy!
 
]]></description>
			<content:encoded><![CDATA[<p>A new video post tutorial, showing how to locate the function where your Linux application crashed if all you know is the address where the crash happened using two common Linux utilities: ldd and nm.</p>
<p>Enjoy!</p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/I8Aib2Oe3ow"></param> <embed src="http://www.youtube.com/v/I8Aib2Oe3ow" type="application/x-shockwave-flash" width="425" height="350"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/08/04/using-ldd-and-nm-to-locate-crashing-function/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Announcing Herzelinux</title>
		<link>http://tuxology.net/2008/07/08/announcing-herzelinux/</link>
		<comments>http://tuxology.net/2008/07/08/announcing-herzelinux/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 14:27:37 +0000</pubDate>
		<dc:creator>Tuxology team</dc:creator>
		
		<category><![CDATA[Herzelinux]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[gby]]></category>

		<category><![CDATA[Herzelia]]></category>

		<category><![CDATA[lug]]></category>

		<category><![CDATA[splice]]></category>

		<category><![CDATA[tee]]></category>

		<category><![CDATA[vmsplice]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=58</guid>
		<description><![CDATA[We are please to announce the founding of a new Linux User Group for the Herzlia Pituch area: Herzelinux.
Much like its older brothers Haifux and Telux and similar other Linux User Groups around the world, in each meeting one of the club regular members or a guest gives an informal lecture or a talk about [...]]]></description>
			<content:encoded><![CDATA[<p>We are please to announce the founding of a new Linux User Group for the Herzlia Pituch area: <a href="http://tuxology.net/herzelinux/"><strong>Herzelinux</strong></a>.</p>
<p>Much like its older brothers <a href="http://www.haifux.org/">Haifux</a> and <a href="http://www.cs.tau.ac.il/lin-club/">Telux</a> and similar other Linux User Groups around the world, in each meeting one of the club regular members or a guest gives an informal lecture or a talk about an interesting topic related to development in and for Linux and Open Source in general.</p>
<p>Herzelinux focuses in serving the local community of professional Linux developers and hobbyists working in hi-tech companies in the Silicon Wadi area of Herzelia Pituch. Accordingly, the meeting place is in walking distance from most Hi Tech companies in the area and the topics converge towards advanced topics of interest mainly to developers and system administrators.</p>
<p>Our first meet up will be held at Thursday, July 17, 2008 where Gilad Ben-Yossef will give a talk entitled: &#8220;Splice, Tee and Vmsplice: zero copy in the Linux kernel&#8221;.</p>
<p>Attendance is free, there is no need to pre-register, parking and light snacks and coffee are provided by Hi-Tech College and we welcome each and anyone who is interested in attending.</p>
<p><strong>Wondering when is the next meet up and what it is about?</strong> <a href="../schedule/">check the schedule</a>.</p>
<p><strong>Want to give a talk in an upcoming meeting?</strong> <a href="../contact/">let us know</a>!</p>
<p>See you there!</p>
<p>Tuxology Team</p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/07/08/announcing-herzelinux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Benchmarking boot latency on x86</title>
		<link>http://tuxology.net/2008/07/08/benchmarking-boot-latency-on-x86/</link>
		<comments>http://tuxology.net/2008/07/08/benchmarking-boot-latency-on-x86/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 12:59:56 +0000</pubDate>
		<dc:creator>Gilad Ben-Yossef</dc:creator>
		
		<category><![CDATA[Applications]]></category>

		<category><![CDATA[Bootloaders]]></category>

		<category><![CDATA[Embedded]]></category>

		<category><![CDATA[Kernel]]></category>

		<category><![CDATA[boot]]></category>

		<category><![CDATA[comboot]]></category>

		<category><![CDATA[embedded linux]]></category>

		<category><![CDATA[latency]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[printk]]></category>

		<category><![CDATA[rdtsc]]></category>

		<category><![CDATA[syslinux]]></category>

		<category><![CDATA[TSC]]></category>

		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=51</guid>
		<description><![CDATA[One of the tasks embedded system developers face is managing boot latency, or the time it takes for a device to become functional after power up.
After all, a set top box that will take more then 60 seconds from the time the &#8220;On&#8221; button is pressed until the end customer can at least interact with [...]]]></description>
			<content:encoded><![CDATA[<p>One of the tasks embedded system developers face is managing boot latency, or the time it takes for a device to become functional after power up.</p>
<p>After all, a set top box that will take more then 60 seconds from the time the &#8220;On&#8221; button is pressed until the end customer can at least interact with the menus, for example, will most likely be returned to the store for a refund, no matter what feature set it has. When it come to our gadgets, we are all hungry for immediate satisfaction, it seems.</p>
<p>There are many tricks one can employ to to achieve boot time nirvana, but as <a href="http://en.wikipedia.org/wiki/Donald_Knuth">Knuth</a> taught us, premature optimization is the root of all evil. Therefore, before we turn our efforts to optimize boot latency, we should first try to measure what that boot latency really is and what part of the boot sequence contribute to it, lest we optimize the wrong thing.</p>
<p>Generally speaking, on a x86 (32bit or 64 bit), the boot process of a Linux system is comprised of the following phases and milestones:</p>
<ul>
<li>The power up milestone: when the power is set to on</li>
<li>The BIOS phase: which includes the POST (or Power On Self Test), device initialization, running of option ROMs and loading the boot loader form the MBR (or Master Boot Record).</li>
<li>The boot loader phase: loading of an operating system kernel and ancillary data (such as Linux initrd or initramfs) into RAM.</li>
<li>Kernel initialization phase: initialization of CPU, peripherals and kernel data structures, including the bring up of the non boot cores in the case of a multi-core machine.</li>
<li>First user application first line of code milestone: the time when the first line of user application source code is executed.</li>
</ul>
<p>Unfortunately, measuring the contribution of each of these phases to the overall boot latency is not an easy task to accomplish. At each of the phases different kind of code is executing on the machine: from the 16 bit BIOS code which is part of the machine firmware, via the 16 or 32 bit boot loader code, the 32 bit kernel code and the finally user applications - each of these is executing in a completely different software environment from the other and it is hard to find a common ground to compare the time each phase takes.</p>
<p>Luckily, the x86 architecture provides a useful tool: the <a href="http://en.wikipedia.org/wiki/Time_Stamp_Counter">TSC (or Time Stamp Clock) register</a>. The TSC register was introduced in the original Intel Pentium CPU and counts the number of clock ticks from the last processor reset. Reading the current value of the TSC register is done using the <a href="http://en.wikipedia.org/wiki/RDTSC">RDTSC instruction</a>.</p>
<p>Assuming no processor frequency changes (for example via <a href="http://en.wikipedia.org/wiki/SpeedStep">SpeedStep</a> technology) takes place and that we always sample the register of the same core in a multi core environment, both of which are easy to guarantee during the boot phase, the TSC register provides us with an accurate hi-res timer through which we can benchmarks the various phases in the boot process.</p>
<p><span id="more-51"></span></p>
<p>As of Linux kernel version 2.6.11, the Linux kernel supports a build time configuration options called <a href="http://elinux.org/Printk_Times">CONFIG_PRINTK_TIMES</a>, which adds a time stamp based on the TSC value to each kernel log message, including during the boot process.</p>
<p><a href="http://tuxology.net/wp-content/uploads/2008/07/boot_latency_11.png" target="_blank"><img class="alignnone size-full wp-image-54" style="margin: 6px; vertical-align: middle;" title="kernel log with PRINTK_TIMES" src="http://tuxology.net/wp-content/uploads/2008/07/boot_latency_11.png" alt="" width="417" height="204" /></a></p>
<p>Turning on this option is the first step towards boot latency benchmark, as it provides a break down of the latency of the various points within the kernel initialization phase and is very easy to set up. While we are configuring the kernel, turning off CPU frequency scaling OS support is also required, as if this feature is turned on, it can render the the TSC register useless.</p>
<p>While the PRINTK_TIMES feature is useful to get latency contributions of various kernel subsystems to the overall kernel initialization latency, is does not suffice: the printk timestamps counts from the kernel boot and includes only kernel log messages, and thus it does not take into account the latency induced by BIOS, boot loader code or the time to the first payload application source code line.</p>
<p>In order to measure those we will need to add code that queries and prints the TSC value to run during the boot loader execution and as the first user space program. The code to query the TSC and print it is rather simple. Here is an example (taken from <a href="http://en.wikipedia.org/wiki/RDTSC">the Wikipedia article on RDTSC</a>) that demonstrates how it is done:</p>

<div class="wp_syntax"><div class="code"><pre class="c c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdint.h&gt;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">inline</span> uint64_t rdtsc<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       uint32_t lo<span style="color: #339933;">,</span> hi;
       <span style="color: #808080; font-style: italic;">/*
        * cpuid will serialize the following rdtsc with respect to all other
        * instructions the processor may be handling.
        */</span>
       __asm__ __volatile__ <span style="color: #009900;">&#40;</span>
         <span style="color: #ff0000;">&quot;xorl %%eax, %%eax<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
         <span style="color: #ff0000;">&quot;cpuid<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
         <span style="color: #ff0000;">&quot;rdtsc<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
         <span style="color: #339933;">:</span> <span style="color: #ff0000;">&quot;=a&quot;</span> <span style="color: #009900;">&#40;</span>lo<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;=d&quot;</span> <span style="color: #009900;">&#40;</span>hi<span style="color: #009900;">&#41;</span>
         <span style="color: #339933;">:</span>
         <span style="color: #339933;">:</span> <span style="color: #ff0000;">&quot;%ebx&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;%ecx&quot;</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span>uint64_t<span style="color: #009900;">&#41;</span>hi <span style="color: #339933;">&amp;</span>lt;&amp;lt; <span style="color: #0000dd;">32</span> | lo;
   <span style="color: #009900;">&#125;</span></pre></div></div>

<p>In order to measure boot time latency contribution of the various phases other then the kernel initialization,  we will need to incorporate a call to this function and print the results in both our boot loader and a user program that will run at boot.</p>
<p>Let us start with the user program first, as it is easier. Here is the user program:</p>

<div class="wp_syntax"><div class="code"><pre class="c c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdint.h&gt;</span>
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">inline</span> uint64_t rdtsc<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   ...
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;TSC: %lld<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>  rdtsc<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
t1<span style="color: #339933;">:</span>
        <span style="color: #b1b100;">goto</span> t1;
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color:#800080;">0</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The rdtsc function implementation which is missing from the listing above is the same function provided earlier in this article. Also, note we added  an infinite loop at the end of the program - this hack is meant from keeping our program from existing when it has finished, this making it easier for us to run it as an &#8220;init&#8221; program  without having the kernel panics when the program exists (more about this below).</p>
<p>Yet another issue to bare in mind that in a multi core board, it is prudent to pin the program to run on the boot CPU, as the value of the TSC register of different cores is not consistent, something which have neglected in the example above.</p>
<p>To build the program, the following one liner can be used:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">gcc timestamp.c -static -o timestamp</pre></div></div>

<p>After building the program, we shall copy the timestamp program binary on to the root file system of the target board and instruct the kernel to run the program during boot using <a href="http://lxr.linux.no/linux/Documentation/kernel-parameters.txt#L750">the kernel command line parameter &#8220;init&#8221;</a>, which tells the kernel to run the specified program at boot, rather then the default of &#8220;/sbin/init&#8221;.</p>
<p>Alternatively, we can use the <a href="http://lxr.linux.no/linux/Documentation/filesystems/ramfs-rootfs-initramfs.txt">initramfs</a> mechanism of the Linux kernel to include the small user space program as part of the kernel binary image itself.</p>
<p>As you&#8217;ve seen, writing a simple user space program to print the value of the TSC register and have it run as the first program during boot is not a complicated affair. Let us see how we can produce a similar affect with the boot loader.</p>
<p>Unfortunately, doing so is less simple then with the user application example above. First and foremost, there are quite a few boot loaders that can be used to load Linux on the x86 architecture (e.g. GRUB, LILO, syslinux). In addition, x86 boot loader code can be notoriously complex, usually written in 16 bit assembly and part of it runs under less then idle conditions.</p>
<p>Luckily, the <a href="http://syslinux.zytor.com/wiki/index.php/The_SYSLINUX_Project">syslinux</a> boot loader  offers a very easy way to integrate 32 bit C code that can be run as part of the boot process, via its support for the <a href="http://syslinux.zytor.com/wiki/index.php/Comboot_API">Comboot API</a> which enables us to write a small 32 bit C program and integrate it as part of the boot loader phase.</p>
<p>Here is our timestamp program once again, this time presented as a Comboot 32 module. It is derived from the hello.c example program supplied as part of the syslinux source code:</p>

<div class="wp_syntax"><div class="code"><pre class="c c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;string.h&gt;</span>
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;console.h&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">inline</span> uint64_t rdtsc<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
...
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
   uint32_t lo<span style="color: #339933;">,</span> hi;
&nbsp;
  openconsole<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>amp;dev_stdcon_r<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>amp;dev_stdcon_w<span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;TSC: %lld<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> rdtsc<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  syslinux_run_command<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;linux&quot;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color:#800080;">0</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>As before, the rdstc function is the same one we presented earlier in this article. Also, you may note that we end our little comboot32 program by invoking the syslinux_run_command() comboot 32 API call, which will cause the Linux kernel image with the name of &#8220;linux&#8221; to be executed when out little timestamp program will end.</p>
<p>To build our little comboot32 program, have a look inside the com32/samples/ directory that is part of the syslinux source code and follow the Makefile example provided there.</p>
<p>Now that we have our little Comboot32 program, named timestamp.c32, we need to instruct the syslinux boot loader to run the program at boot time. The program will then print the value of the TSC register and proceed to load the Linux kernel.</p>
<p>The syslinux boot loader reads a configuration file, called syslinux.cfg, located in same partition into which it is installed and executes the command in the file. In our case, the file content will be:</p>
<pre>default timestamp.c32</pre>
<pre>prompt 0</pre>
<p>Let us recap the different stages of the boot process and how we plan to benchmark them:</p>
<p>When the power is turned on, the board firmware will run the BIOS which will initialize the hardware and load and run syslinux, out boot loader.</p>
<p>syslinux will read the syslinux.cfg file and according to the commands in it, will execute our timestamp.c32 Comboot32 program, which will print the current value of the TSC register to the VGA screen and proceed to instruct syslinux to load the Linux kernel.</p>
<p>As the kernel boots, every printk log message send by it to the kernel log buffer, will be stamped with a timestamp, relative to the kernel start time, which is to based on the TSC register.</p>
<p>Finally, after the kernel initialization has complete, the kernel will run the first user space program, which in our case will be the user program version of the timestamp program, which once again will print the current value of the TSC register and halt.</p>
<p>At the end of this proccess, we will have the following values:</p>
<p>The value of the TSC register when the boot loader run. By dividing this value by the number of  cycles per second the machine has, we can convert this cycle count, to the the number of seconds since the CPU reset up to this point.</p>
<p>The time it took the kernel to finish initialization, using the PRINTK_TIMES tiemstamps in the log messages. This value is already in seconds, so not conversion is needed.</p>
<p>The final TSC register value when the first user code program runs. Here too we will divide the raw cycle count as reported by the TSC register by the number of cycles per second the machine is running at to obtain the number of seconds.</p>
<p>From these measurements we can easily construct a somewhat crude, but useful, table of the contribution each of the stages has to the overall machine boot latency:</p>
<p>The latency of the BIOS phase is measured by the time we measure by reading the TSC register at the start of the boot loader code in our timestamp.c32 program.</p>
<p>The latency of the boot loader actions (reading the kernel image to RAM and compressing the image), can be computed by subtracting the number of seconds which took the kernel to initialize as reported by the PRINTK_TIMES feature, from the number of seconds reported by the user space version of our timestamp program and the number of seconds recorded at the boot loader beginning.</p>
<p>In addition, the various timestamps in the log messages throughout the kernel initialization process provided further insight as to the contribution of the various kernel subsystems and device driver to the overall latency.</p>
<p>Finally, the full boot latency, which is the the overall time which is needed to get to the first user program  first line of source code running, is the number of seconds computed from the value of the TSC reported by the user program version of our timestamp program.</p>
<p>As an example, here are the values from one type of CoreDuo board, running at 1.5 Ghz:</p>
<p>The value reported from the timestamp.c32 program was 90933051222 cycles. Dividing the number of cycles by the number of cycles per second, or 1,500,000,000 on this specific boards, gives a BIOS latency of 60.6 seconds (the BIOS on this particular run was wasting a long time scanning the IDE bus).</p>
<p>The timestamp provided by the  PRINTK_TIMES feature in the kernel log messages indicated it took the kernel 0.44 seconds to initialize.</p>
<p>Finally, the user program timestamp reported the first line of code ran at 93907247022 cycles, or 62.6 seconds after CPU reset, which are 2.0 second since the boot loader started.</p>
<p>If we subtract the 0.44 seconds it took the kernel to initialize from the over 2 seconds latency between boot loader and first user program line of code, we can reach the conclusion that it took the boot loader roughly 1.66 seconds to read the kernel binary from the CompactFlash on which it was stored into memory and decompress it.</p>
<p>As is evident, these numbers are not 100% accurate. Certainly, we have neglected to attribute some kernel initialization time before the first printk to the kernel initialization phase, as well as attributing some latency caused by the boot loader code initialization to the BIOS phase.</p>
<p>However, these numbers are accurate enough to be used as the basis of evaluating the effect of various changes on overall boot time and give us a clue as to where out optimization efforts needs to be focused.</p>
<p>For example, deom the measurements provided above it is clear that a faster storage medium can save up to 1.66 seconds from the boot process, simply by the virtue that it will take less time for the bootloader to load the kernel image into memory.</p>
<p>For further information about reducing and measuring boot latency, the <a href="http://elinux.org/Main_Page">embedded Linux wiki</a> entry <a href="http://elinux.org/Boot_Time">BootTime</a> is highly recommended.</p>
<p>Gilad Ben-Yossef</p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/07/08/benchmarking-boot-latency-on-x86/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A new lecture: Crash N&#8217; Burn</title>
		<link>http://tuxology.net/2008/06/30/a-new-lecture-crash-n-burn/</link>
		<comments>http://tuxology.net/2008/06/30/a-new-lecture-crash-n-burn/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 11:42:10 +0000</pubDate>
		<dc:creator>Tuxology team</dc:creator>
		
		<category><![CDATA[Applications]]></category>

		<category><![CDATA[Conferences]]></category>

		<category><![CDATA[Lectures]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[crash]]></category>

		<category><![CDATA[debugging]]></category>

		<category><![CDATA[exception]]></category>

		<category><![CDATA[haifux]]></category>

		<category><![CDATA[lecture]]></category>

		<category><![CDATA[ols]]></category>

		<category><![CDATA[slides]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=50</guid>
		<description><![CDATA[We&#8217;ve just added a brand new tutorial to the lectures section on the site, entitled: &#8220;Crash and burn: Writing Linux application fault handlers&#8220;. Check out the full description, slides and example code on the lecture page.
Or, if you&#8217;d rather see our very own Gilad Ben-Yossef present the tutorial in front of a live audience, you&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve just added a brand new tutorial to the lectures section on the site, entitled: &#8220;<a href="http://tuxology.net/lectures/crash-and-burn-writing-linux-application-fault-handlers/">Crash and burn: Writing Linux application fault handlers</a>&#8220;. Check out the full description, slides and example code on the lecture <a href="http://tuxology.net/lectures/crash-and-burn-writing-linux-application-fault-handlers/">page</a>.</p>
<p>Or, if you&#8217;d rather see our very own Gilad Ben-Yossef present the tutorial in front of a live audience, you&#8217;re welcome to attend one of the following venues:</p>
<ul>
<li>The <a href="http://www.haifux.org/">Haifux</a> Linux club meeting in Haifa, Israel on June 30, 2008.</li>
<li>The <a href="http://www.linuxsymposium.org/">Ottawa Linux Symposium</a>, July 26, 2008.</li>
<li>The <a href="http://www.hi-tech.co.il/college/promotion/linux_jul.htm">Penguin in a Box embedded Linux seminar</a> in Herzelia, August 7, 2008 (note the new date!)</li>
</ul>
<p>Hope to see you there!</p>
<p>Tuxology team</p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/06/30/a-new-lecture-crash-n-burn/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Writers Wanted!</title>
		<link>http://tuxology.net/2008/06/25/writers-wanted/</link>
		<comments>http://tuxology.net/2008/06/25/writers-wanted/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 14:52:34 +0000</pubDate>
		<dc:creator>Tuxology team</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[contest]]></category>

		<category><![CDATA[how-to]]></category>

		<category><![CDATA[prize]]></category>

		<category><![CDATA[stories]]></category>

		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=45</guid>
		<description><![CDATA[Got a story to share about your latest Linux bring up on a new board? have a great tip you would like to share with your peers? wrote an excellent how-to for you co workers and wish to share that with the world?
Great! Now you can win something in addition to your peers admiration - [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-46" style="margin: 8px; float: left;" title="Penguin Award" src="http://tuxology.net/wp-content/uploads/2008/06/penguinaward-thumb.gif" alt="Penguin Award" width="65" height="134" />Got a story to share about your latest Linux bring up on a new board? have a great tip you would like to share with your peers? wrote an excellent how-to for you co workers and wish to share that with the world?</p>
<p>Great! Now you can win something in addition to your peers admiration - Introducing the  <strong>Tuxology Contributing Author Contest</strong>: post your story as a reply to this message, we&#8217;ll publish the best ones (while giving full credit, of course) and the very best of them all will <span style="color: #993300;"><strong>win a free Linux training course of your choosing</strong></span>, courtesy of Hi Tech College.</p>
<p><em>The fine print</em>: you must have the writes to the material you and agree to let us post it here. All entries must be submitted until the 30 of July and you must OK to publish your name and title as the winner. Best entry selected by Tuxology team members.</p>
<p>Happy authoring!</p>
<p>The Tuxology Team</p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/06/25/writers-wanted/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Updates</title>
		<link>http://tuxology.net/2008/06/18/site-update/</link>
		<comments>http://tuxology.net/2008/06/18/site-update/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 15:02:26 +0000</pubDate>
		<dc:creator>Tuxology team</dc:creator>
		
		<category><![CDATA[Lectures]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[courses]]></category>

		<category><![CDATA[slides]]></category>

		<category><![CDATA[updates]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=44</guid>
		<description><![CDATA[Hi there,
We just added a new section to the site: lectures, where we&#8217;ll post the slides of technical lectures given at various conferences, events and panels. Already posted are the slides for two lectures: one about different approaches to real time with Linux and another about Open Source virtualization solutions, so go check them out.
Also [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there,</p>
<p>We just added a new section to the site: <a href="/lectures/">lectures,</a> where we&#8217;ll post the slides of technical lectures given at various conferences, events and panels. Already posted are the slides for two lectures: one about <a href="http://tuxology.net/lectures/soft-hard-and-ruby-hard-real-time-approaches-with-linux/">different approaches to real time with Linux</a> and another about <a href="http://tuxology.net/lectures/linux-virtualization-from-xen-to-kvm/">Open Source virtualization solutions</a>, so go check them out.</p>
<p>Also in the news, slides for both the <a href="http://tuxology.net/courses/advanced-embedded-linux/">Advanced Embedded Linux</a> course and the <a href="http://tuxology.net/courses/linux-internals/">Linux Internals</a> course have been posted.</p>
<p>In addition, slides and syllabus for a new course, <a href="http://tuxology.net/courses/linux-network-internals/">Linux Network Internals</a>, which is still in development, has been posted and we&#8217;d be very glad to receive your feedback and suggestions.</p>
<p>And as a desert, we&#8217;ve added the events from the <a href="http://haifux.org/">Haifux</a> meeting calender to the <a href="/schedule/">schedule section</a> on the site. Got any other calender we think we should be tracking? let us <a href="/contact/">know</a>.</p>
<p>Have a great day,<br />
The Tuxology Team</p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/06/18/site-update/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Linux Network Stack Flow</title>
		<link>http://tuxology.net/2008/06/16/linux-network-stack-flow/</link>
		<comments>http://tuxology.net/2008/06/16/linux-network-stack-flow/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 14:29:38 +0000</pubDate>
		<dc:creator>Tuxology team</dc:creator>
		
		<category><![CDATA[Kernel]]></category>

		<category><![CDATA[Network]]></category>

		<category><![CDATA[2.6]]></category>

		<category><![CDATA[flow]]></category>

		<category><![CDATA[linux foundation]]></category>

		<category><![CDATA[mind]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=37</guid>
		<description><![CDATA[A wonderful article, describing the control flow and the associated data types of the Linux networking stack of kernel 2.6, written by Arnout Vandecappelle of Mind, is available via the kind folks at the Linux Foundation.
Accompanying the article itself, an elaborate graphic schema of the network stack and data type, is also included. Looks like [...]]]></description>
			<content:encoded><![CDATA[<p>A wonderful <a href="http://www.linuxfoundation.org/en/Net:Kernel_Flow">article,</a> describing the control flow and the associated data types of the Linux networking stack of kernel 2.6, written by Arnout Vandecappelle of <a href="http://www.mind.be/">Mind</a>, is available via the kind folks at the <a href="http://www.linuxfoundation.org/">Linux Foundation</a>.</p>
<p>Accompanying the article itself, an <a href="http://www.linuxfoundation.org/en/Image:Network_data_flow_through_kernel.png">elaborate graphic schema of the network stack</a> and data type, is also included. Looks like it will make a great cubicle poster!</p>
<p>The Tuxology Team</p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/06/16/linux-network-stack-flow/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Penguin In a Box 2008</title>
		<link>http://tuxology.net/2008/06/05/penguin-in-a-box-2008/</link>
		<comments>http://tuxology.net/2008/06/05/penguin-in-a-box-2008/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 09:39:58 +0000</pubDate>
		<dc:creator>Limor Pipman</dc:creator>
		
		<category><![CDATA[Conferences]]></category>

		<category><![CDATA[Embedded]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[confrence]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[seminar]]></category>

		<guid isPermaLink="false">http://tuxology.net/?p=35</guid>
		<description><![CDATA[We are proud to announce that the third annual Penguin In A Box embedded Linux seminar organized by Codefidence ltd. in cooperation with Hi Tech College, will be held at the 03/07/2008 07/08/2008 in the Daniel hotel and convention center in Herzelia, Israel.
As the use of Linux in the embedded market is on the rise [...]]]></description>
			<content:encoded><![CDATA[<p>We are proud to announce that the third annual Penguin In A Box embedded Linux seminar organized by Codefidence ltd. in cooperation with <a href="http://www.hi-tech.co.il/college/">Hi Tech College</a>, will be held at the <span style="text-decoration: line-through;">03/07/2008</span> 07/08/2008 in the Daniel hotel and convention center in Herzelia, Israel.</p>
<p>As the <a href="http://www.linuxdevices.com/news/NS4920597981.html">use of Linux in the embedded market is on the rise</a> and it&#8217;s <a href="http://www.linux-foundation.org/publications/linuxkerneldevelopment.php">development continues at an extraordinary rate</a>, the seminar will cover, as in previous years, a broad range of topics relevant to Linux based embedded system developers wishing to keep abreast of recent developments.</p>
<p>For further details, check out the seminar <a href="http://www.hi-tech.co.il/college/promotion/linux_jul.htm">web page</a> (in Hebrew).</p>
]]></content:encoded>
			<wfw:commentRss>http://tuxology.net/2008/06/05/penguin-in-a-box-2008/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
