<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Off you go... into the purple yonder! &#187; Xen</title>
	<atom:link href="https://ward.vandewege.net/blog/category/xen/feed/" rel="self" type="application/rss+xml" />
	<link>https://ward.vandewege.net/blog</link>
	<description></description>
	<lastBuildDate>Sun, 12 May 2024 20:57:05 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>kexec&#8217;ing into a Xen kernel</title>
		<link>https://ward.vandewege.net/blog/2008/08/kexecing-into-a-xen-kernel/</link>
		<comments>https://ward.vandewege.net/blog/2008/08/kexecing-into-a-xen-kernel/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 01:13:29 +0000</pubDate>
		<dc:creator><![CDATA[ward]]></dc:creator>
				<category><![CDATA[coreboot]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://ward.vandewege.net/blog/?p=217</guid>
		<description><![CDATA[I&#8217;ve got a number of servers that run coreboot + Xen. I like to run coreboot with a linux-as-a-bootloader (LAB) payload. That means that coreboot, after bringing up the machine, boots into a small linux kernel + busybox environment, entirely &#8230; <a href="https://ward.vandewege.net/blog/2008/08/kexecing-into-a-xen-kernel/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve got a number of servers that run <a href="http://coreboot.org">coreboot</a> + <a href="http://xen.org">Xen</a>. I like to run coreboot with a linux-as-a-bootloader (LAB) payload. That means that coreboot, after bringing up the machine, boots into a small linux kernel + busybox environment, entirely contained in rom. That environment can serve as an emergency fallback to resolve booting problems remotely &#8211; remember, coreboot has excellent serial support from power-on. Anyway; on a normal boot the machine kexecs into a Xen kernel.</p>
<p>And that works great. Recently, on deploying a new server, I discovered that the machine would just hang trying to kexec into Xen 3.2.1.</p>
<p>After a lot of digging and some fun setting up a test environment with <a href="http://bellard.org/qemu/">qemu</a>, I discovered that this broke somewhere between Xen 3.1.0 and 3.1.3. A message to the Xen-devel mailing list today yielded a <a href="http://lists.xensource.com/archives/html/xen-devel/2008-08/msg00300.html">quick response</a> from a Xen developer suggesting I try the &#8216;no-real-mode&#8217; parameter as an argument to the hypervisor.</p>
<p>The no-real-mode option stops Xen from doing some bios calls, and it also tells it to ignore the e820 bios table.</p>
<p>Here&#8217;s an lab.conf that works:</p>
<pre>
CMDLINE="no-real-mode com1=115200,8n1 cdb=com1"
INITRD=""
KERNEL="/xen-3.1.4.gz"
MODULE1="/vmlinuz-2.6.18.8-xen root=/dev/md1 ro xencons=ttyS0 console=tty0 console=ttyS0,115200"
MODULE2="/initrd.img-2.6.18.8-xen"
</pre>
<p>Note that you need to pass no-real-mode as the <i>first</i> xen command line argument, otherwise it won&#8217;t work.</p>
<p>And somehow that solves the problem for Xen 3.1.3 and 3.1.4, both under qemu + coreboot and qemu + bochs. Kexec&#8217;ing into Xen 3.1.2 triple-faults qemu under qemu + coreboot, but works fine under qemu + bochs. That smells like a coreboot bug. I&#8217;ll try on real hardware tomorrow to see if this bug is specific to our qemu port, or a more general coreboot problem. To be continued..</p>
]]></content:encoded>
			<wfw:commentRss>https://ward.vandewege.net/blog/2008/08/kexecing-into-a-xen-kernel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>of how XFS saved the day</title>
		<link>https://ward.vandewege.net/blog/2008/03/of-how-xfs-saved-the-day/</link>
		<comments>https://ward.vandewege.net/blog/2008/03/of-how-xfs-saved-the-day/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 23:19:59 +0000</pubDate>
		<dc:creator><![CDATA[ward]]></dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://ward.vandewege.net/blog/?p=183</guid>
		<description><![CDATA[Io, one of my mailservers, is a Xen instance. It&#8217;s moderately busy &#8211; a normal day sees about 12000 accepted messages and about 24000 rejected delivery attempts (spam). It&#8217;s an Exim/clamav/dspam setup, and a significant proportion of the 12000 accepted &#8230; <a href="https://ward.vandewege.net/blog/2008/03/of-how-xfs-saved-the-day/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Io, one of my mailservers, is a Xen instance. It&#8217;s moderately busy &#8211; a normal day sees about 12000 accepted messages and about 24000 rejected delivery attempts (spam). It&#8217;s an Exim/clamav/dspam setup, and a significant proportion of the 12000 accepted messages ends up quarantined as spam.</p>
<p>I recently moved this instance to a new Xen dom0 with significantly faster CPUs. On the old host, the domU ran off a disk image on a pair of fast 10K rpm Western Digital Raptors in software raid-1, connected to a crappy (in terms of performance) SII 3114 sata chipset. On the new host, the domU runs on a pair of Seagate Barracuda sata2 drives (also in raid-1), connected to an Nvidia MCP55 sata chipset. So the drives are slower, but the chipset is considerably better.</p>
<p>The mailserver began having intermittent performance issues soon after the move. The load on the system went high enough for Exim to queue new mail rather than deliver it immediately. In other words, mail got stuck on the mailserver until the load dropped sufficiently for Exim to start delivering it.</p>
<p>The problem turned out to be heavy disk IO &#8211; the disks were not keeping up with the rest of the system, leading to bad iowait and a sluggish system:</p>
<pre>
$ sar 1 0
01:04:35 PM     CPU      %user     %nice   %system    %iowait    %steal     %idle
01:04:35 PM     all      2.08      0.00      1.04     46.88      0.00     50.00
01:04:36 PM     all      0.00      0.00      0.00    100.00      0.00      0.00
01:04:36 PM     all      0.00      0.00      0.00     50.00      0.00     50.00
01:04:37 PM     all      0.00      0.00      0.00     15.69      0.00     84.31
01:04:38 PM     all      0.00      0.00      0.00     49.75      0.00     50.25
01:04:38 PM     all      0.00      0.00      0.00     51.53      0.00     48.47
01:04:39 PM     all      0.79      0.00      1.59      8.73      0.00     88.89
01:04:40 PM     all      1.00      0.00      1.00     26.87      0.00     71.14
01:04:41 PM     all      0.00      0.00      0.00    100.00      0.00      0.00
01:04:42 PM     all      0.00      0.00      0.43     41.13      0.00     58.44
01:04:43 PM     all      3.49      0.00      0.00     52.33      0.00     44.19
01:04:44 PM     all      0.00      0.00      0.00     49.75      0.00     50.25
01:04:45 PM     all      0.00      0.00      0.00     49.75      0.00     50.25
01:04:46 PM     all      0.00      0.00      0.00     49.75      0.00     50.25
01:04:47 PM     all      0.00      0.00      0.00     49.75      0.00     50.25
01:04:48 PM     all      3.47      0.00      0.99     44.06      0.00     51.49
</pre>
<p>The host has 2 CPUs; every time the iowait approximated 50% in the above table, one of the CPUs was 100% busy waiting for disk IO to complete. At 100%, both were fully tied up waiting for the disks.</p>
<p>The iowait was directly correlated with mail delivery &#8211; as mail came in, the iowait jumped up as it was processed. Strangely it seemed to stay high for a few seconds even after the mail was delivered.</p>
<p>Curiously enough, this iowait did not translate in a sluggish dom0, or even in significant iowait there.</p>
<p>I immediately suspected Xen to be the problem, but that turned out to be false. After having stopped Exim (which reduced iowait to zero), I ran hdparm on both the dom0 and the domU:</p>
<pre>
(dom0)
# hdparm -tT /dev/md2

/dev/md2:
 Timing cached reads:   3808 MB in  2.00 seconds = 1904.67 MB/sec
 Timing buffered disk reads:  194 MB in  3.02 seconds =  64.25 MB/sec
</pre>
<pre>
(domU)
# hdparm -tT /dev/sda1

/dev/sda1:
 Timing cached reads:   1850 MB in  2.00 seconds = 925.51 MB/sec
 Timing buffered disk reads:  186 MB in  3.02 seconds =  61.50 MB/sec
</pre>
<p>The cached reads are half of what they are in the dom0, but the buffered disk read performance was pretty much on par. So that was all pretty good.</p>
<p>So since the actualy disk performance looked fine &#8211; at least for reading &#8211; that meant the problem was likely to be higher up. The filesystem, or some process doing something stupid.</p>
<p>Time to figure out which process, exactly, was causing the slowness. The kernel allows us to see just that:</p>
<p>  echo 1 > /proc/sys/vm/block_dump</p>
<p>and then</p>
<p> dmesg | awk &#8216;/(READ|WRITE|dirtied)/ {activity[$1]++} END {for (x in activity) print x, activity[x]}&#8217;| sort -nr | head -n 10</p>
<p>Note: you may want to disable syslog while you enable the block_dump logging so it does distort the results. </p>
<p>That generated the following output, after a few seconds (I repeated the dmesg command quite a few times to make sure I was getting an accurate picture over time &#8211; this is a sample result):</p>
<pre>
wc(3500): 1
sshd(3483): 5
sshd(3481): 2
pdflush(25494): 2
mysqld(26063): 9
mesg(3495): 1
kjournald(1624): 582
find(3499): 28
exim4(3520): 2
exim4(3508): 2
</pre>
<p>I had expected the problem to be caused by mysql, which is heavily taxed by dspam. But no, it was quite clearly caused by kjournald. Kjournald is a kernel thread that deals with ext3 journalling. I googled around a bit, looking for ext3 optimizations that I might have overlooked but did not find anything concrete. The filesystem was already mounted with noatime. This being a Xen system upgrading the kernel is a bit of a problem, so I could not try that.</p>
<p>So I ran some tests on another dom0: I created 2 new domUs, one with ext3 as the root filesystem, and one with xfs. I then ran bonnie++ on both and compared the results. The XFS system seemed to have a much lower CPU load as reported by bonnie++, especially for its Sequential Create and Random Create tests.</p>
<p>So I converted Io to XFS, and the problem went away altogether. It&#8217;s as responsive as it used to be, and a good deal faster when a lot of mail is flowing through. </p>
<p>And that&#8217;s how Io, the mailserver (named after one of Jupiter&#8217;s moons), got significantly improved disk IO.</p>
]]></content:encoded>
			<wfw:commentRss>https://ward.vandewege.net/blog/2008/03/of-how-xfs-saved-the-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xen 3.2 serial</title>
		<link>https://ward.vandewege.net/blog/2008/02/xen-32-serial/</link>
		<comments>https://ward.vandewege.net/blog/2008/02/xen-32-serial/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 22:36:45 +0000</pubDate>
		<dc:creator><![CDATA[ward]]></dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://ward.vandewege.net/blog/2008/02/18/180/</guid>
		<description><![CDATA[Getting access to the serial port in a Xen 3.2 dom0 is somewhat complicated. This is the magic incantation for your grub menu.lst file to get console at 115200 bps on the first physical serial port, as well as on &#8230; <a href="https://ward.vandewege.net/blog/2008/02/xen-32-serial/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Getting access to the serial port in a Xen 3.2 dom0 is somewhat complicated. This is the magic incantation for your grub menu.lst file to get console at 115200 bps on the first physical serial port, as well as on the screen.</p>
<pre>
serial --unit=0 --speed=115200
terminal --timeout=5 serial console

title Xen 3
root    (hd0,0)
kernel    /boot/xen-3.gz com1=115200,8n1 console=com1,vga
module    /boot/vmlinuz-2.6.18.8-xen root=/dev/md0 ro xencons=ttyS0 console=tty0 console=ttyS0,115200n8
module    /boot/initrd.img-2.6.18.8-xen
boot
</pre>
<p>The &#8216;com1=115200,8n1 console=com1,vga&#8217; arguments on the kernel line make sure that xen writes its output to the serial port (with the right speed, stop bit etc) as well as to the vga device. The &#8216;console=tty0 console=ttyS0,115200n8&#8242; on the first module line tells the kernel to do the same. Xen controls the serial port hardware at this point (that&#8217;s the default in 3.2: XEN_DISABLE_CONSOLE is set in the dom0 kernel config!), and in order for the dom0 kernel and Xen to share that serial port, we have to tell the kernel to use the xencons virtual console driver &#8211; hence the &#8216;xencons=ttyS0&#8242; parameter.</p>
<p><a href="http://os-drive.com/en/node/33">Debugging Xen with Serial Console</a> has it almost right, but the xencons parameter is missing. Without xencons you&#8217;ll see serial output until the dom0 kernel taks over; that kernel won&#8217;t see any serial ports, which makes (m)getty very unhappy&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>https://ward.vandewege.net/blog/2008/02/xen-32-serial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xen 3.2.0</title>
		<link>https://ward.vandewege.net/blog/2008/01/xen-320/</link>
		<comments>https://ward.vandewege.net/blog/2008/01/xen-320/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 20:55:16 +0000</pubDate>
		<dc:creator><![CDATA[ward]]></dc:creator>
				<category><![CDATA[Free Software/Open Source]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://ward.vandewege.net/blog/2008/01/26/178/</guid>
		<description><![CDATA[So Xen 3.2.0 was released last week. Oddly enough there are no precompiled 64-bit binaries anymore. That does not make much sense to me &#8211; running Xen on 32 bit is just&#8230; painful. Problems with accessing ram beyond 4GB, issues &#8230; <a href="https://ward.vandewege.net/blog/2008/01/xen-320/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>So <a href="http://xen.org/download/">Xen 3.2.0</a> was released <a href="http://lists.xensource.com/archives/html/xen-announce/2008-01/msg00000.html">last week</a>.</p>
<p>Oddly enough there are no precompiled 64-bit binaries anymore. That does not make much sense to me &#8211; running Xen on 32 bit is just&#8230; painful. Problems with accessing ram beyond 4GB, issues with libc6, etc. On 64 bit all that stuff just works.</p>
<p>Sadly, the 3.2 release is broken. It simply does not build &#8211; make world dies with this mercurial error:</p>
<pre>
select-repository: Searching `.:..' for linux-2.6.18-xen.hg
select-repository: Ignoring `.'
not found!
select-repository: Unable to determine Xen repository parent.
</pre>
<p>Google returns some hits suggesting that this is caused by using a version of mercurial that is too old, but that is nonsense &#8211; I&#8217;m seeing this even with 0.9.5. It&#8217;s a bug in the Xen 3.2.X release.</p>
<p>The fix is easy; just check out the linux-2.6.18-xen mercurial repository yourself in the parent directory to where you have downloaded Xen:</p>
<pre>
  apt-get install gawk libssl-dev libncurses5-dev pciutils-dev
  cd /usr/src/
  hg clone http://xenbits.xensource.com/linux-2.6.18-xen.hg
  cd xen-3.2.X
  make world
  make install
</pre>
<p>Of course you can use make -jX to compile things faster. Time to give 3.2 a spin now <img src="https://ward.vandewege.net/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> </p>
]]></content:encoded>
			<wfw:commentRss>https://ward.vandewege.net/blog/2008/01/xen-320/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>a new record</title>
		<link>https://ward.vandewege.net/blog/2007/04/a-new-record/</link>
		<comments>https://ward.vandewege.net/blog/2007/04/a-new-record/#comments</comments>
		<pubDate>Thu, 19 Apr 2007 13:57:52 +0000</pubDate>
		<dc:creator><![CDATA[ward]]></dc:creator>
				<category><![CDATA[Free Software/Open Source]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://ward.vandewege.net/blog/2007/04/19/125/</guid>
		<description><![CDATA[This morning, a user on one of our machines (inadvertently) created a mail loop with a bad procmail script: 09:42:05 up 120 days, 9:23, 20 users, load average: 3367.40, 3265.08, 2751.75 I had seen machines go up to about 200 &#8230; <a href="https://ward.vandewege.net/blog/2007/04/a-new-record/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This morning, a user on one of our machines (inadvertently) created a mail loop with a bad procmail script:</p>
<p>   09:42:05 up 120 days,  9:23, 20 users,  load average: 3367.40, 3265.08, 2751.75</p>
<p>I had seen machines go up to about 200 before, but never this high. If you ever wonder about the stability of the 2.6 kernel &#8211; and this is a Xen setup! &#8211; here&#8217;s your answer. Even with the load this high, the machine was responsive enough on a couple of ssh sessions to solve the problem remotely.</p>
]]></content:encoded>
			<wfw:commentRss>https://ward.vandewege.net/blog/2007/04/a-new-record/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
