LWN: Comments on "The realtime preemption mini-summit" https://lwn.net/Articles/354690/ This is a special feed containing comments posted to the individual LWN article titled "The realtime preemption mini-summit". en-us Mon, 06 Oct 2025 23:01:04 +0000 Mon, 06 Oct 2025 23:01:04 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Lock naming https://lwn.net/Articles/356478/ https://lwn.net/Articles/356478/ efexis <div class="FormattedComment"> Sleepy sounds like they might run a bit slow and probably need to sleep... if the locks may end up sleeping due to external conditions then it should be a narcolocksy :-)<br> <p> <p> </div> Sun, 11 Oct 2009 16:34:35 +0000 The realtime preemption mini-summit https://lwn.net/Articles/356475/ https://lwn.net/Articles/356475/ efexis <div class="FormattedComment"> Priority inheritance may often/usually not be the best way to do things by design (ie, try not to rely on it) sure, but is always better to have support for it to avoid inversion just-in-case, than not and have a Pathfinder style incident on your hands :-)<br> <p> </div> Sun, 11 Oct 2009 16:02:21 +0000 The realtime preemption mini-summit https://lwn.net/Articles/356464/ https://lwn.net/Articles/356464/ jnareb <div class="FormattedComment"> <font class="QuotedText">&gt; So the realtime tests might remain on their own, but it would be nice, at least, to standardize test options and output formats to help with the automation of testing. XML output from test programs is favored by some, but it is fair to say that XML is not universally loved in this crowd.</font><br> <p> Why not use Test Anything Protocol (TAP), originally developed for unit testing of the Perl interpreter? See <a rel="nofollow" href="http://www.testanything.org">http://www.testanything.org</a><br> </div> Sun, 11 Oct 2009 09:53:26 +0000 The realtime preemption mini-summit https://lwn.net/Articles/355646/ https://lwn.net/Articles/355646/ simlo <div class="FormattedComment"> As I said: You could leave half-PI-aware : Let readers boost the writer, but not the other way around. This will most likely work in many cases. It means a RT task can't write-lock a rwlock must defer the operation to another task. Config options are needed....<br> <p> </div> Tue, 06 Oct 2009 15:37:23 +0000 The realtime preemption mini-summit https://lwn.net/Articles/355513/ https://lwn.net/Articles/355513/ bdonlan <div class="FormattedComment"> Buggy instructions can also be fixed in the kernel, however, and at least then you know about them. While this may be a bit unfeasable for Windows, there should be some kind of switch Linux can use to disable the SMI handling, and just pass things to the normal #UD handler. If you then include hooks for any operations needing emulation at the same time as loading new microcode to disable the hardware support, no problem.<br> </div> Mon, 05 Oct 2009 19:10:59 +0000 Typical geek party https://lwn.net/Articles/355394/ https://lwn.net/Articles/355394/ dvhart <div class="FormattedComment"> That or when the camera came out we all tried to find something else to focus on. ;-) Actually, there was discussion 100% of the time. Most of time, about 1/3 of the room was participating while the others focused on something else. I think that's probably typical (or even pretty good) given the diversity of topics and expertise in the room.<br> </div> Sun, 04 Oct 2009 14:03:59 +0000 About 2.6.29.5-rt22-tirqonly patch and the exact test scenario. https://lwn.net/Articles/355393/ https://lwn.net/Articles/355393/ dvhart <div class="FormattedComment"> That isn't a patch, it's just a .config setting. Grab the 2.6.29-rt22 patches (see Download on rt.wiki.kernel.org) and set CONFIG_PREEMPT (not CONFIG_PREEMPT_RT) and enable hard and soft threaded irq's to yes. As for the exact test scenario, I don't have the details, but running dbench is fairly straightforward and will easily reproduce these results. Ingo did so with a simple 10 second run during discussions at the rt-summit.<br> </div> Sun, 04 Oct 2009 13:59:42 +0000 The realtime preemption mini-summit https://lwn.net/Articles/355392/ https://lwn.net/Articles/355392/ dvhart <div class="FormattedComment"> WRT rwlocks. We actually cap reader count to 1 in PREEMPT_RT for that very reason. This is unfortunate, and one of the causes for performance degradation on -rt for certain workloads. There was some discussion during the rt-summit in Dresden about making kernel rwlocks non-pi-aware for this reason. Some more investigation is needed before we make a decision there.<br> </div> Sun, 04 Oct 2009 13:56:11 +0000 The realtime preemption mini-summit https://lwn.net/Articles/355391/ https://lwn.net/Articles/355391/ dvhart <div class="FormattedComment"> There are other less known uses for SMIs that are an unfortunately reality of our world. Fixing hardware bugs is one. A buggy instruction for instance can get emulated under an SMI. It would be wonderful if those things never existed, but in practice, that just isn't the case.<br> </div> Sun, 04 Oct 2009 13:51:33 +0000 Typical geek party https://lwn.net/Articles/354965/ https://lwn.net/Articles/354965/ nevets <div class="FormattedComment"> If you look closely at the picture of everyone. You will notice that they are (mostly) all concentrating on their laptops. This probably shows that the room was silent most of the time, and everyone was communicating over IRC!<br> <p> </div> Thu, 01 Oct 2009 06:31:40 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354915/ https://lwn.net/Articles/354915/ jcm <div class="FormattedComment"> Sounds like you guys had fun :)<br> </div> Wed, 30 Sep 2009 19:20:45 +0000 Lock naming https://lwn.net/Articles/354896/ https://lwn.net/Articles/354896/ doogie <div class="FormattedComment"> You mean baby bear.<br> </div> Wed, 30 Sep 2009 17:32:25 +0000 POSIX shmem in PostgreSQL https://lwn.net/Articles/354875/ https://lwn.net/Articles/354875/ nix <div class="FormattedComment"> Oh, curses. We need a POSIX syscall that does what lsof/fuser do, really.<br> </div> Wed, 30 Sep 2009 15:14:13 +0000 Lock naming https://lwn.net/Articles/354864/ https://lwn.net/Articles/354864/ nevets <div class="FormattedComment"> goldielocks was indeed mentioned. But the sleepy locks were not. I'll have to have Jon add that one to the list of possibilities. :-)<br> </div> Wed, 30 Sep 2009 12:03:50 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354848/ https://lwn.net/Articles/354848/ mjthayer <div class="FormattedComment"> <font class="QuotedText">&gt; Or you could say that writers don't boost the readers but readers can boost the single writer. That way you can't use rwlocks in real time tasks and that would not be a problem in most cases.</font><br> So to return to my previous question, this would simply mean not trying to get it "right" for this API and clearly write that on the box.<br> <p> <font class="QuotedText">&gt; But the kernel would need a lot of review to be sure and therefore I fully understand the current solution in the preemt RT patche.</font><br> Of course I was naively thinking that the API user would be aware of what locking they are using, but that won't hold if they are doing the locking implicitly through other APIs.<br> </div> Wed, 30 Sep 2009 08:05:48 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354773/ https://lwn.net/Articles/354773/ simlo <div class="FormattedComment"> Well, as for being one of those who actually pushed and implemented a little bit of the priority inheritance in the beginning, I must say that he is just making excuses for not making it in RTLinux, because making it right _is_ indeed very hard. From experience I know it is done wrong even in VxWorks!<br> <p> But it can be done, and it is done in the current rtmutex in Linux. <br> <p> From the cases he is talking about, shows me that he has not understood how to use the system at all. He does the usual mistake of not distinguishing between a mutex and a semaphore used as a condition (i.e. waiting for some external event to happen). <br> <p> Yes, making an RT application work with priority inheritance mutex requires some programming rules: You can't block on a semaphore, socket etc. while holding a lock. But, heck you should always try to avoid that in any multi-threaded program to avoid the whole program eventually locking up because some message didn't arrive over TCP as expected.<br> <p> In general locks should only be used "inside a module" to protect it's state. The user of the module should not be aware of it. The modules should be ordered such that low level module is not calling a highlevel module with an internal the lock taken - or you can create a deadlock. Or a even simpler rule: Newer make a call to another module with a lock held. In a RT environment with priority inheritance the module can use this to ensure the timing of all the calls to it because all the modules "lower" in the chain have a known timing and you therefore know the maximum time all the internal locks can be held by any thread.<br> <p> And yes, priority inheritance takes a lot of performance. But in general you should try to avoid congestion and make your program such that the locks are not contended. The locks should only be considered as "safeguards" against a contention, which should not happen very often.<br> <p> If you know how to use locks, and can avoid the pitfalls, priority inheritance will work for you - provided they are properly implemented by the OS. As is done in Linux.<br> <p> Wrt. rwlocks: If a high priority, realtime writer wants the lock, it doesn't make sense to boost the readers as you don't know how many there are. What you could do was to limit the number of readers to specific number. Or you could say that writers don't boost the readers but readers can boost the single writer. That way you can't use rwlocks in real time tasks and that would not be a problem in most cases. But the kernel would need a lot of review to be sure and therefore I fully understand the current solution in the preemt RT patche.<br> <p> </div> Wed, 30 Sep 2009 07:49:27 +0000 About 2.6.29.5-rt22-tirqonly patch and the exact test scenario. https://lwn.net/Articles/354833/ https://lwn.net/Articles/354833/ jstultz <div class="FormattedComment"> Yea, sorry, the chart wasn't originally intended to be distributed as far as it has, so I wasn't as rigorous with the data as I should have been.<br> <p> 2.6.29.5-rt22-tirqonly is the same as 2.6.29.5-rt22 with CONFIG_PREEMPT_RT disabled (CONFIG_PREEMPT is used instead).<br> <p> I booted with maxcpus=$NP for each cpu point, and with dbench-3.04, ran:<br> ./dbench $NP -t 7000 -D . -c client.txt<br> </div> Tue, 29 Sep 2009 23:20:30 +0000 POSIX shmem in PostgreSQL https://lwn.net/Articles/354831/ https://lwn.net/Articles/354831/ alvherre <div class="FormattedComment"> BTW, mmap does not work either.<br> </div> Tue, 29 Sep 2009 22:47:39 +0000 Lock naming https://lwn.net/Articles/354828/ https://lwn.net/Articles/354828/ rahulsundaram <div class="FormattedComment"> Call them sleepy locks then. <br> </div> Tue, 29 Sep 2009 21:08:34 +0000 Lock naming https://lwn.net/Articles/354825/ https://lwn.net/Articles/354825/ niv <div class="FormattedComment"> "Well, some locks are to heavy, some are too lightweight. Since these are Just Right, they are obviously goldilocks."<br> <p> Just have to applaud :).<br> <p> Humor aside, we really do have to get the naming right - there's enough confusion as it is, as Jon points out. Lock names really need to be self-explanatory, or at very least, imply behavior that's somewhat in the ballpark of actual behavior. Spinlocks that can sleep should have big, flashing red neon warning signs or some equivalent thereof in their name, ideally.<br> <p> </div> Tue, 29 Sep 2009 20:42:21 +0000 What do they mean by "Realtime"? https://lwn.net/Articles/354818/ https://lwn.net/Articles/354818/ niv <div class="FormattedComment"> Determinism is what's really important to real-time. <br> <p> It's often confused with low latency, but the two are separate criteria and often conflicting goals requiring a trade-off, made complicated by the fact that most applications typically want BOTH - determinism AND low latency. <br> <p> Determinism is easier understood as the ability to say "this task will take AT MOST n ms". That is, bounded maximum latency. <br> <p> In the strictest case, this would mean the following:<br> <p> it is preferable for all 5000 iterations of a task execution <br> to take 49us (less than 50us) than it is for 4950 to take <br> 35us and 50 iterations to take 69us, when your application <br> requires a maximum latency of 50us.<br> <p> For most enterprise applications, the max latency is not a MUST_FINISH_BY with severe consequences for failure, but a REALLY_GOOD_TO_FINISH_WITHIN, with the average low latency being also important. Some applications can tolerate some outliers (maximum latency bound exceeded) as they usually need average low latency as well.<br> <p> Most OSs are optimized for throughput-driven applications (where average latency is minimized). <br> <p> Real-time Linux is optimized to offer greater determinism than the stock kernel. Hence the need for greater preemption, including the ability to preempt critical kernel tasks should a higher priority application become runnable. <br> <p> And remember, you can only guarantee/meet real-time requirements for as many threads as you can run concurrently on your system - on an N-core system, you can at most guarantee that N SCHED_FIFO tasks at the same highest priority P will meet their real time guarantees (depending on a lot of things, handwave, handwave, but you get the general idea). So a lot depends on what the system is running, the overall application solution and top-down configuration of the entire system.<br> <br> <p> <p> <p> </div> Tue, 29 Sep 2009 20:15:09 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354823/ https://lwn.net/Articles/354823/ mjthayer <div class="FormattedComment"> <font class="QuotedText">&gt; I mean, assume you have code like</font><br> <font class="QuotedText">&gt; </font><br> <font class="QuotedText">&gt; int get_foo(struct foo* f)</font><br> <font class="QuotedText">&gt; {</font><br> <font class="QuotedText">&gt; lock_mutex(&amp;mutex);</font><br> <font class="QuotedText">&gt; memcpy(f, &amp;source, sizeof(struct foo));</font><br> <font class="QuotedText">&gt; unlock_mutex(&amp;mutex);</font><br> <font class="QuotedText">&gt; }</font><br> That particular example could be solved by RCU, although I don't want to start a showdown here, as I'm sure you would win it :) I was thinking more on the lines of avoiding contention in the critical path as much as possible though.<br> </div> Tue, 29 Sep 2009 20:09:40 +0000 POSIX shmem in PostgreSQL https://lwn.net/Articles/354817/ https://lwn.net/Articles/354817/ alvherre <div class="FormattedComment"> It's not just history. In fact, a patch was posted to add support for POSIX shmem, but as it turns out, the POSIX API is not complete enough for PostgreSQL's purposes. See here, for instance: <a href="http://archives.postgresql.org/pgsql-patches/2007-02/msg00527.php">http://archives.postgresql.org/pgsql-patches/2007-02/msg0...</a><br> </div> Tue, 29 Sep 2009 19:50:51 +0000 What do they mean by "Realtime"? https://lwn.net/Articles/354816/ https://lwn.net/Articles/354816/ dlang <div class="FormattedComment"> by realtime they don't mean responding in the minimum time<br> <p> they are looking for a response in a _predictable_max_ time<br> <p> how short that predictable time is determines how suitable it is for a particular application, but the key thing is to make it predictable.<br> <p> right now linux is not predictable, that is what they are working on fixing.<br> </div> Tue, 29 Sep 2009 18:56:59 +0000 What do they mean by "Realtime"? https://lwn.net/Articles/354810/ https://lwn.net/Articles/354810/ clameter <div class="FormattedComment"> It seems that the realtime folks are fuzzy on what they are trying to accomplish. I thought realtime was ensuring that the kernel always responds in a mininum time interval to an event but I dont see any discussion of what the minimum time interval is. <br> <p> From the article it seems that there are numerous features in the kernel that are currently not "Realtime". That probably means that the potential latencies are beyond any assumable time interval. This includes such basic things as locking.<br> <p> What is meant by "Realtime" then? What set of functionality of the kernel can be used so that a response is guaranteed within the time interval?<br> <p> </div> Tue, 29 Sep 2009 18:20:46 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354807/ https://lwn.net/Articles/354807/ aleXXX <div class="FormattedComment"> Yes, it's messy.<br> <p> Still it's a practical tool and works in general.<br> Another problem is that most RTOSes don't have the full priority <br> inheritance implemented, but a simplified version.<br> E.g. eCos (and I think also vxworks) raise the priorities as expected, <br> but lower them again when all mutexes in the system are released again. <br> This can be very late.<br> <p> The poster before said:<br> "that they should either not wait for potentially low priority processes <br> in critical paths,"<br> <p> This is not easy.<br> I mean, assume you have code like<br> <p> int get_foo(struct foo* f)<br> {<br> lock_mutex(&amp;mutex);<br> memcpy(f, &amp;source, sizeof(struct foo));<br> unlock_mutex(&amp;mutex);<br> }<br> <p> i.e. you just protect access to the variable "source". You may need this <br> information in a low priority thread. The code looks innocent, there are <br> no loops, nothing undeterministic, it will take at less than 10 <br> microseconds.<br> So why now wait use the same mutex in all other threads ?<br> The issue is when a medium priority thread comes into play, suddenly the <br> code above can block a higher priority thread for a time determined by <br> the medium priority thread (which does not use that mutex at all).<br> <p> Also, "make sure that the processes waited for already have the right <br> priority" is basically saying that all threads using the same mutex <br> should have the same priority ?<br> Doesn't work.<br> <p> So, this is a hard issue, and there's no easy solution. <br> Maybe, try not to use too many shared variables, let your threads <br> communicate via messages/tokens/etc.<br> This helps, but everything gets asynchronous, which doesn't make things <br> necessarily easier.<br> <p> Alex<br> <p> </div> Tue, 29 Sep 2009 18:14:53 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354778/ https://lwn.net/Articles/354778/ flewellyn <div class="FormattedComment"> Well, the SysV stuff for a lot of things is unpleasant to work with. Still, it does work.<br> </div> Tue, 29 Sep 2009 14:58:21 +0000 Lock naming https://lwn.net/Articles/354776/ https://lwn.net/Articles/354776/ nettings <div class="FormattedComment"> <font class="QuotedText">&gt; There was some talk of the best names for "atomic spinlocks"; they could be "core locks," "little kernel locks," or "dread locks." </font><br> <p> Well, some locks are to heavy, some are too lightweight. Since these are Just Right, they are obviously goldilocks.<br> </div> Tue, 29 Sep 2009 14:44:52 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354763/ https://lwn.net/Articles/354763/ abacus Priority inheritance is indeed messy. The following paper contains interesting background information: Victor Yodaiken, <a href="http://www.linuxfordevices.com/files/misc/yodaiken-july02.pdf"><em>Against Priority Inheritance</em></a>, July 2002. Tue, 29 Sep 2009 10:59:41 +0000 About 2.6.29.5-rt22-tirqonly patch and the exact test scenario. https://lwn.net/Articles/354761/ https://lwn.net/Articles/354761/ leemgs <div class="FormattedComment"> I think that this is good information for realtime developers. <br> Can I get 2.6.29.5-rt22-tirqonly patch and the exact test scenario <br> about this result among 2.6.29.5 and 2.6.29.5-rt22 and <br> 2.6.29.5-rt22-tirqonly by Darren Hart and and John Stultz? <br> <p> I can just find test result at <br> <a href="http://dvhart.com/darren/rtlws/elm3c160-dbench-vanilla-vs-rt-vs-tirq.png">http://dvhart.com/darren/rtlws/elm3c160-dbench-vanilla-vs...</a> file without test scenario <br> using dbench(<a href="http://samba.org/ftp/tridge/dbench/">http://samba.org/ftp/tridge/dbench/</a>). <br> <p> <p> </div> Tue, 29 Sep 2009 09:28:33 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354760/ https://lwn.net/Articles/354760/ nix <div class="FormattedComment"> It's a bit unfortunate that the ability to have the OS actually control the machine is relegated to a "premium real-time mode" on "select platforms". *Everything* should work like this.<br> <p> The only tolerable use for SMIs IMNSHO is emergency thermal control, i.e. keeping the hardware safe...<br> </div> Tue, 29 Sep 2009 09:23:18 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354759/ https://lwn.net/Articles/354759/ nix <div class="FormattedComment"> Yes. I don't really know why databases use SysV SHM: the API for all the SysV stuff is so cracksmoking and unpleasant and non-Unixlike. I suppose POSIX shared memory functions didn't exist when PostgreSQL was young, and mmap() of /dev/null wasn't very portable at that point... so maybe it's just history.<br> <p> </div> Tue, 29 Sep 2009 09:21:47 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354758/ https://lwn.net/Articles/354758/ nix <div class="FormattedComment"> Oh right. My ignorance is showing, so I'll go and correct that before saying anything else (and add a comment here once I know one way or the other).<br> <p> </div> Tue, 29 Sep 2009 09:20:24 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354746/ https://lwn.net/Articles/354746/ mjthayer <div class="FormattedComment"> This is probably a very silly question, but priority inheritance seems to be such a messy thing to do right - wouldn't it be better to tell API users directly that it is not guaranteed and that they should either not wait for potentially low priority processes in critical paths, or make sure that the processes waited for already have the right priority? I understand that it is preferable to solve things in a generic way where that is feasible, but one has to be careful that the solution doesn't end up being worse than the problem.<br> </div> Tue, 29 Sep 2009 08:28:38 +0000 -rt tree https://lwn.net/Articles/354743/ https://lwn.net/Articles/354743/ dvhart <div class="FormattedComment"> The rt wiki <a href="http://rt.wiki.kernel.org">http://rt.wiki.kernel.org</a> is a good source of information as well, including links to the download site.<br> </div> Tue, 29 Sep 2009 07:15:38 +0000 -rt tree https://lwn.net/Articles/354741/ https://lwn.net/Articles/354741/ corbet See, for example, the <a rel="nofollow" href="http://lwn.net/Articles/353497/">2.6.31-rt11 announcement</a>. Tue, 29 Sep 2009 05:38:34 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354740/ https://lwn.net/Articles/354740/ mcgrof <div class="FormattedComment"> Ah got it -- thanks. And what is the tree where I can pull all this from to test?<br> </div> Tue, 29 Sep 2009 05:26:14 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354735/ https://lwn.net/Articles/354735/ josh <div class="FormattedComment"> No, nobody has a patch which converts all ISRs individually to threaded interrupt handling. Mainline allows selectively making individual interrupts threaded. The -rt patchset allows making *all* interrupts automatically threaded, with no individual changes to each one.<br> </div> Tue, 29 Sep 2009 03:15:32 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354734/ https://lwn.net/Articles/354734/ mcgrof <div class="FormattedComment"> <p> Does someone really have a patch which coverts all drivers to use thread IRSs? If so I'd like to see the wireless parts :)<br> </div> Tue, 29 Sep 2009 02:02:00 +0000 The realtime preemption mini-summit https://lwn.net/Articles/354723/ https://lwn.net/Articles/354723/ niv <div class="FormattedComment"> Jon, thanks for the excellent write-up as usual.<br> <p> "Some hardware allows SMIs to be disabled, but it's never clear what the consequences of doing so might be; if the CPU melts into a puddle of silicon, the resulting latencies will be even worse than before".<br> <p> Just to elaborate on the above, and to clear up any doubt on the issue, as we (IBM) have actually done work to remediate SMIs - we are pretty confident that our CPUs will not melt into a puddle, and we officially support on select platforms IBM premium real-time mode which allows us to do this safely (don't try this at home :)).<br> <p> In all seriousness, though, we have open-sourced the work that Keith Mannthey has done (he talked about this at LPC this past week, and we'll have his slides up on the LPC website shortly) and I imagine it would be of interest to others. <br> <p> <p> <p> <p> </div> Mon, 28 Sep 2009 23:15:05 +0000