<?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>Maslow Forgot about Beer™ &#187; Linux</title>
	<atom:link href="http://www.seanstoner.com/blog/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.seanstoner.com/blog</link>
	<description>My irreverent musings on the nature of things . . . .</description>
	<lastBuildDate>Tue, 13 Apr 2010 21:03:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Linux Music Studio Part III</title>
		<link>http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/</link>
		<comments>http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 10:47:04 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[My Music]]></category>
		<category><![CDATA[DAW]]></category>
		<category><![CDATA[digital audio workstations]]></category>
		<category><![CDATA[kernel patch]]></category>
		<category><![CDATA[linux music]]></category>
		<category><![CDATA[music studio]]></category>
		<category><![CDATA[PREEMPT]]></category>
		<category><![CDATA[real time system]]></category>
		<category><![CDATA[realtime kernel]]></category>
		<category><![CDATA[realtime-lsm]]></category>
		<category><![CDATA[RT]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ubuntustudio]]></category>

		<guid isPermaLink="false">http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/</guid>
		<description><![CDATA[This is a follow up to the previous post located here. Well I finally decided to get down and dirty once again and dive into the innards of real time kernel tuning. As I reported last time, I was getting some latency which was evident through the sound card as a very nasty buzzing sound. [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />This is a follow up to the previous post located <a href="http://www.seanstoner.com/blog/2008/02/19/linux-studio-chapter-ii/" target="_blank">here</a>.</p>
<p>Well I finally decided to get down and dirty once again and dive into the innards of real time kernel tuning. As I reported last time, I was getting some latency which was evident through the sound card as a very nasty buzzing sound. Here I&#8217;ll report some basic findings which hopefully will help anyone attempting to set up a real time system set up for use as a DAW.</p>
<p>My system is running Ubuntu Gutsy Gibbon. You may recall where I had some serious trouble installing the Ubuntu Studio real time Ubuntu kernel;  the initrd image was severely anemic to the point where I couldn&#8217;t even boot up. Instead, I decided to download the latest kernel source and roll my own so I knew everything would be just the way I wanted.</p>
<p>Before I go into the step by step process of how that was done, allow me to report some updated findings that may clear up some confusion. One issue is deciding what method to use to grant realtime scheduling to users (so you don&#8217;t have to run programs as root, which is a very bad idea). The old way of doing things was to use the <strong>realtime-lsm</strong> kernel patch and module. The problem I was running into with this method along with the latest 2.6.24 kernels is the fact that you can no longer configure your kernel with <strong>CONFIG_SECURITY_CAPABILITIES</strong> as a module! The kernel maintainers have decided that it introduces some serious security vulnerabilities, so the only options now are built into the kernel or not at all. This is a serious problem when using realtime-lsm since presumably the capability module does not support stacking and needs to be unloaded when the realtime-lsm module is loaded. This is not completely true as <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=336561#48" target="_blank">pointed out by the Debian Kernel Team</a>, but the realtime-lsm module patches I was using have not been modified to correct this. In any case, realtime-lsm has been deprecated in favor of the newer PAM rlimits method of granting realtime scheduling priority to userspace programs. It is important to note that realtime-lsm will still give you superior performance over the rlimits method for really heavy multimedia work, but in 99% of cases the rlimits method should suit most users just fine. The rlimits method works by configuring priority scheduling limits in /etc/security/limits.conf.</p>
<p>Let&#8217;s get to the meat of how I configured my system. I&#8217;m going to list all the steps in order with a very brief explanation of each.</p>
<p>First we get the latest kernel source tarball. In my case this was 2.6.24.3.</p>
<p><code>wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.xx.tar.bz2</code></p>
<p>Then we get the latest realtime kernel patch. Make sure the patch version matches your kernel version above. Get the latest rt version if there is more than one for your kernel. In my case this was patch-2.6.24.3-rt3.bz2.</p>
<p><code>wget http://kernel.org/pub/linux/kernel/projects/rt/patch-2.6.xx-rt.bz2</code></p>
<p>Copy the files to your kernel source tree, un-tarball them and patch the kernel. Be sure to use the proper version numbers below in place of these as applicable from your download.</p>
<p><code>cd /usr/src/</p>
<p>tar zjfv ~/linux-2.6.24.3.tar.bz2 linux-2.6.24.3 .</p>
<p>ln -s linux-2.6.24.3 linux</p>
<p>cd linux</p>
<p>bzcat ~/patch-2.6.24.3-rt3.bz2 | patch -p1</code></p>
<p>Get your current working config if you have one.<br />
<code><br />
zcat /proc/config.gz &gt; .config</code></p>
<p>or</p>
<p><code>cp /usr/src/linux-`uname -r`/.config ./.config</code></p>
<p>From the existing .config, if you have one, update the settings from it. If there are any new features from the last config file, you may be asked some configuration questions.</p>
<p><code>make oldconfig</code></p>
<p>Get your favorite editor out and modify the config file to match the following settings. If they don&#8217;t exist just add them to the end of the config file. Another option is to make menuconfig (or xconfig, gconfig, config, etc.) and set the values that way.</p>
<p><code>vi .config</p>
<p>HIGH_RES_TIMERS=y</p>
<p>PREEMPT_RT=y</p>
<p>HZ_1000=y</p>
<p>RTC=y</p>
<p>SND_RTCTIMER=y</p>
<p>SND_SEQ_RTCTIMER_DEFAULT=y</code></p>
<p>Now we can recompile and install our kernel. Below is the Debian/Ubuntu way of doing it. You can use the old school make &amp;&amp; make modules &amp;&amp; make modules_install technique as well. The Debian way does it all for you and packages the kernel image and headers as .deb packages in /usr/src and even installs the new kernel into GRUB!</p>
<p><code>make-kpkg --initrd --append-to-version=-rt_custom kernel_image kernel_headers</p>
<p>dpkg -i ../*deb</code></p>
<p>Now we grant realtime scheduling to the user group audio. Be sure your user account is part of this group. Here we set a max priority of 99 (RT), nice value of -10 (not very nice <img src='http://www.seanstoner.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) and memlock value of 512MB.<br />
<code>sudo cat "@audio - rtprio 99" &gt;&gt; /etc/security/limits.conf<br />
sudo cat "@audio - nice -10" &gt;&gt; /etc/security/limits.conf<br />
sudo cat "@audio - memlock 512000" &gt;&gt; /etc/security/limits.conf</code><br />
Verify everything looks good in GRUB and reboot. Verify you&#8217;re running the new kernel. Look for PREEMPT RT in the version.</p>
<p><code>uname -ar</p>
<p>Linux ubuntu 2.6.24.3-rt3-rt_custom #1 SMP PREEMPT RT Sun Mar 2 22:06:11 CST 2008 i686 GNU/Linux</code></p>
<p>Great! Now you can run qtjackctl and select the appropriate realtime setting. You can launch your other studio applications with these settings as well and modify them in real time using the chrt command. You can check on the status of a process with ps -eo rtprio,comm.</p>
<p><code>ps -eo rtprio,comm | grep jack</p>
<p>chrt -p 99 &lt;process id&gt;</code></p>
<p>I will follow up with some more details and howtos regarding working with your DAW. Feel free to comment below if you have any questions or email me using the email icon at the top of the page. Enjoy!</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/&amp;title=Linux+Music+Studio+Part+III" title="Add 'Linux Music Studio Part III' to Del.icio.us"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Linux Music Studio Part III' to Del.icio.us" alt="Add 'Linux Music Studio Part III' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/&amp;title=Linux+Music+Studio+Part+III" title="Add 'Linux Music Studio Part III' to digg"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Linux Music Studio Part III' to digg" alt="Add 'Linux Music Studio Part III' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/&amp;title=Linux+Music+Studio+Part+III" title="Add 'Linux Music Studio Part III' to reddit"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Linux Music Studio Part III' to reddit" alt="Add 'Linux Music Studio Part III' to reddit" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/" title="Add 'Linux Music Studio Part III' to Technorati"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Linux Music Studio Part III' to Technorati" alt="Add 'Linux Music Studio Part III' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/&amp;t=Linux+Music+Studio+Part+III" title="Add 'Linux Music Studio Part III' to Yahoo My Web"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Linux Music Studio Part III' to Yahoo My Web" alt="Add 'Linux Music Studio Part III' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/&amp;h=Linux+Music+Studio+Part+III" title="Add 'Linux Music Studio Part III' to Newsvine"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/newsvine.png" title="Add 'Linux Music Studio Part III' to Newsvine" alt="Add 'Linux Music Studio Part III' to Newsvine" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/&amp;title=Linux+Music+Studio+Part+III" title="Add 'Linux Music Studio Part III' to Stumble Upon"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Linux Music Studio Part III' to Stumble Upon" alt="Add 'Linux Music Studio Part III' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/&amp;title=Linux+Music+Studio+Part+III" title="Add 'Linux Music Studio Part III' to Google Bookmarks"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Linux Music Studio Part III' to Google Bookmarks" alt="Add 'Linux Music Studio Part III' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/" title="Add 'Linux Music Studio Part III' to Bloglines"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'Linux Music Studio Part III' to Bloglines" alt="Add 'Linux Music Studio Part III' to Bloglines" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Linux+Music+Studio+Part+III&amp;url=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/" title="Add 'Linux Music Studio Part III' to Ask"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Linux Music Studio Part III' to Ask" alt="Add 'Linux Music Studio Part III' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/&amp;title=Linux+Music+Studio+Part+III" title="Add 'Linux Music Studio Part III' to Live-MSN"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Linux Music Studio Part III' to Live-MSN" alt="Add 'Linux Music Studio Part III' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?title=Linux+Music+Studio+Part+III&amp;url=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/" title="Add 'Linux Music Studio Part III' to SlashDot"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/slashdot.png" title="Add 'Linux Music Studio Part III' to SlashDot" alt="Add 'Linux Music Studio Part III' to SlashDot" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/&amp;t=Linux+Music+Studio+Part+III" title="Add 'Linux Music Studio Part III' to FaceBook"><img src="http://www.seanstoner.com/blog/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Linux Music Studio Part III' to FaceBook" alt="Add 'Linux Music Studio Part III' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.seanstoner.com/blog/2008/03/03/linux-music-studio-part-iii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
