<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tiago Vignatti &#187; SoC2008</title>
	<atom:link href="http://vignatti.wordpress.com/tag/soc2008/feed/" rel="self" type="application/rss+xml" />
	<link>http://vignatti.wordpress.com</link>
	<description>In The Eyes Of The World</description>
	<lastBuildDate>Mon, 09 Nov 2009 01:47:17 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='vignatti.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/33cb7ca85d43793f113cab97fc6c2cd1?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Tiago Vignatti &#187; SoC2008</title>
		<link>http://vignatti.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vignatti.wordpress.com/osd.xml" title="Tiago Vignatti" />
		<item>
		<title>Parallel events (panic) with X</title>
		<link>http://vignatti.wordpress.com/2008/08/18/parallel-events-panic-with-x/</link>
		<comments>http://vignatti.wordpress.com/2008/08/18/parallel-events-panic-with-x/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 22:02:16 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[SoC2008]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[gdb sucks]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=49</guid>
		<description><![CDATA[Unfortunately that model which I described some weeks ago to put the input event delivery of the X server in a separate thread wouldn&#8217;t be an advantage. I precipitated myself thinking that it could be feasible. Sorry :(
I started to implement all this but it showed a very boring task to grab all the globals [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=49&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Unfortunately that model which I <a href="http://vignatti.wordpress.com/2008/08/07/keep-it-going/">described some weeks ago</a> to put the input event delivery of the X server in a separate thread wouldn&#8217;t be an advantage. I precipitated myself thinking that it could be feasible. Sorry :(</p>
<p>I started to implement all this but it showed a very boring task to grab all the globals variables which both threads touch and to lock it. So I decided to stop going in this way. It&#8217;s hard to program thinking in parallel. It&#8217;s even harder to debug a program with severals flows. More, the tools don&#8217;t help you (if you have lucky, gdb will work).</p>
<p>But the main reason I can argue to stop with this model is that the &#8220;main&#8221; event flow of execution (i.e. basically all the functions in {Swapped,}ProcVector) and the input delivery flow (ProcessInputEvents()) are very very tied. Both deal a lot with clients and we&#8217;d need to lock several globals, thus spending a lot of time in the management of the threads. It&#8217;s easy to see this acting: just put a breakpoint in TryClientEvents(). Every single request to deliver a given event to a given client involves this function. And both input and main event flow will call TryClientEvents(). So you will see a zillion of times this function being called. The contention of the eventual processing and main threads would be even greater if the client choose to receive MotionNotify event.</p>
<p>So yeah, it&#8217;s far from be clear how to put processing of input events inside another thread.</p>
<p>== Next ==</p>
<p>In the next days I&#8217;ll be traveling to <a href="http://www.cesol.ufc.br/">CESol</a>, Fortaleza here in Brazil. I was invited to talk about my work in X land. Latin America has a lot of promising countries concerning FOSS development however for some reason no one actively participate and contribute for the X development (why?). I&#8217;ll try to motivate people there somehow :)</p>
<p>In the next week I&#8217;ll put the generation thread in a shape good enough to eventually push this to upstream. Also I&#8217;ll try to write a good sumary of all my work given that GSoC is in the end.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/49/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/49/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=49&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/08/18/parallel-events-panic-with-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
		<item>
		<title>Priorities and scheduling hints for X server threads</title>
		<link>http://vignatti.wordpress.com/2008/08/07/priorities-and-scheduling-hints-for-x-server-threads/</link>
		<comments>http://vignatti.wordpress.com/2008/08/07/priorities-and-scheduling-hints-for-x-server-threads/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 23:33:57 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[policy]]></category>
		<category><![CDATA[priority]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[SoC2008]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[vignatti]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xorg]]></category>
		<category><![CDATA[xserver]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=44</guid>
		<description><![CDATA[Input events routed through another thread/process can have bad effects on latency because we can&#8217;t guarantee that it will get scheduled at the right moment. Although this is hard to see happening with the current X server threaded implementation, we must design something to avoid it. One way to improve the responsiveness is to give [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=44&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Input events routed through another thread/process can have bad effects on latency because we can&#8217;t guarantee that it will get scheduled at the right moment. Although this is hard to see happening with the current X server threaded implementation, we must design something to avoid it. One way to improve the responsiveness is to give a high priority to the input thread and also adjust the CPU scheduling. (Note that this will not avoid problems related with <a href="http://vignatti.wordpress.com/2007/08/10/mlocking-adventure/">page faults</a> which usually happen in the X input flow.)</p>
<p>Linux uses 1:1 thread model and the scheduler handles every thread as a process. For now I don&#8217;t care about others systems. Both input generation and processing threads was designed to sleep after a relatively short CPU run. So we can give a priority to processes that are trusted to not hog the CPU. And given they are special time-critical applications I have no doubt in what policy to use: I set both input threads to use the real-time FIFO policy and to get the maximum priority (sched_get_priority_max()).</p>
<p>&#8212;</p>
<p>I&#8217;m sure that someone will complain telling that this would decrease a bit the main thread when used together with both input threads. In GUI we&#8217;re talking about better user experience. Latency variability must be avoided whenever possible in interactive situations. What the user <strong><em>see</em></strong> is what matters. For non-interactive processes (server scheduling workloads) the situation is totally different.</p>
<p>Xorg&#8217;s philosophy is to be portable so we have to take care when setting this kind of parameters. It is a complex issue and different systems do it in wildly different ways. I was using my Linux box (2.6.24) to design it all.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/44/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/44/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=44&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/08/07/priorities-and-scheduling-hints-for-x-server-threads/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
		<item>
		<title>fakemouse &#8212; a driver that emulates a mouse</title>
		<link>http://vignatti.wordpress.com/2008/05/27/fakemouse-a-driver-that-emulates-a-mouse/</link>
		<comments>http://vignatti.wordpress.com/2008/05/27/fakemouse-a-driver-that-emulates-a-mouse/#comments</comments>
		<pubDate>Wed, 28 May 2008 02:36:09 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[SoC2008]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[fake]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[vignatti]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=29</guid>
		<description><![CDATA[For my SoC project I need some mechanism to evaluate the improvement of the input thread inside X. So I wrote a simple kernel driver that emulates the mouse device moving and emitting bits of a simple pattern. I don&#8217;t know if something like this already exists or if there are other ways to do [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=29&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For my SoC <a href="http://vignatti.wordpress.com/2008/04/29/google-summer-of-code-2008/" target="_self">project</a> I need some mechanism to evaluate the improvement of the input thread inside X. So I wrote a simple kernel driver that emulates the mouse device moving and emitting bits of a simple pattern. I don&#8217;t know if something like this already exists or if there are other ways to do it, but the fact is that the solution I thought took me only few hours between the moment that I imagined, collected some ideas on the Web and implemented it.</p>
<p>Why emulate a device? I need stress the X server always with same routines and things like XWarpPointer() and XTestFake*MotionEvent() is not close to a real user usage because they do not pass through all the paths of the event creation stage inside X. So now I can run fakemouse module together with some x11perf test and collect the results comparing the X with and without input thread. Cool :)</p>
<p>&#8212;</p>
<p>For those who are interested in the driver can do the following:<br />
# wget http://web.inf.ufpr.br/vignatti/code/fakemouse-0.01.tar.gz<br />
# tar xzvf fakemouse-0.01.tar.gz<br />
# cd fakemouse-0.01<br />
# make<br />
# insmod fakemouse.ko<br />
# echo 1 &gt; /sys/module/fakemouse/parameters/mouseon</p>
<p>and be happy seeing what happens in some event node create by fakemouse (/dev/input/event*).</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=29&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/05/27/fakemouse-a-driver-that-emulates-a-mouse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
	</channel>
</rss>