The future of realtime Linux
LWN.net needs you! Without subscribers, LWN would simply not exist. Please consider signing up for a subscription and helping to keep LWN publishing |
The future of the realtime (aka PREEMPT_RT) kernel patch set was on the agenda for the Realtime Linux minisummit—as usual—but this year's edition had a bit more urgency than in years past. It is clear that Thomas Gleixner, who is doing most of the development work on the patch set, is concerned about the future of the remaining pieces. There appears to be minimal interest in furthering the development of realtime Linux outside of its main sponsor, Red Hat, and that may not be a sustainable model, he reported to both the minisummit and the concurrent 15th Real Time Linux Workshop (RTLWS).
The RTLWS is a four-day gathering of those interested in using Linux for realtime applications. The minisummit was an all-day meeting on the first day of the workshop for nine kernel developers who are involved in the PREEMPT_RT work: Ingo Molnar, Sebastian Siewior, Frédéric Weisbecker, John Kacur, Paul McKenney, Steven Rostedt, Paul Gortmaker, Gleixner, and Darren Hart. Gleixner also reported on the minisummit to the participants of the workshop on its second day. The conclusion was the same in both cases: the PREEMPT_RT project will be done in 2014, "one way or another". The first way would be to get most of the rest of the code upstream, but that will require more of an effort, from a wider group than is currently involved. The alternative is to decide that the 95% of the realtime work already upstream is good enough and to drop further efforts.
Status
Since last year's minisummit, not much has changed for the realtime patch set, Gleixner said. He spent three months trying to clean up some of the last pieces to get them ready for mainline, but that quickly ballooned into nine separate projects with circular dependencies. That code was "stashed in the horror cabinet", he said, but the work was not entirely wasted as he has a good idea of what needs to be done, "but it's not pretty".
In order to focus on the development side of things, Gleixner has handed off doing the -rt releases to Siewior. The "whole problem" over the last couple of years has been the lack of developers, paid developers in particular, Gleixner said. Red Hat pays him to work half-time on realtime development and it pays the messaging, realtime, and grid (MRG) team to test and productize the realtime patch set. Beyond that, there are a few other contributors, including McKenney for read-copy-update (RCU) development as well as Hart and Gortmaker. Both of the latter two indicated they would try to encourage their employers (Intel and Wind River, respectively) to contribute more to realtime development moving forward.
Gleixner said that he spoke with Linus Torvalds and Andrew Morton at the recently completed Kernel Summit about the remaining realtime code. Both were favorably disposed toward getting those pieces upstream, but Gleixner is concerned that the lack of a dedicated realtime development team to sustain the code may be an impediment. Torvalds worries less about drivers or filesystems that "can bitrot away at the edge of the kernel" without affecting anything else, Gleixner said, but core kernel code is different. If Red Hat were to decide that realtime was no longer of interest, that code might go largely unmaintained.
Part of the problem may be that it is smaller and smaller segments of the user base that is being served with each addition of realtime code to the mainline. McKenney said that he has seen that with RCU—the mainline version works for a lot of people, which is a sign of maturity. Newer features are just for specialized situations, which means it is hard to get a groundswell of support behind them.
Similarly, Hart said that there are customers who are talking about using PREEMPT_RT with the Yocto project, but there would need to be a whole lot more of them before he is likely to be able to convince his management to have him work half-time on realtime. The Open Source Automation Development Lab (OSADL)—sponsor of the RTLWS—was originally set up to gather enough funds to support four or so full-time engineers working on realtime Linux, Gleixner said. Unfortunately, the number of members has never risen to the point where that became a reality and the organization is just able to support its QA test farm alongside its other activities, he said.
From statistics gathered by Gleixner while he was hosting the -rt patches during the kernel.org outage, it is clear that there is interest in realtime Linux. Within five days of the announcement of a new -rt kernel, he would see around 3000 downloads from addresses that read like a "who's who" of the computer industry, he said. In particular, Germany—where OSADL is based—was well represented, with 45% or so of the downloads coming from there.
As Hart noted, this is a different kind of problem than the realtime project has faced in the past. It is not a technical problem like those that the project has tackled—largely successfully. There may be some help on the horizon, however, as there are plans to put the MRG offering on top of the RHEL kernel (with the -rt patches, of course), Kacur said. That may free up some people who are currently working to test and stabilize the -rt kernels because much of the RHEL driver testing and the like can be reused.
Gortmaker asked what the "end game" for realtime Linux looked like, was it going to be like linux-tiny with some out-of-tree patches? Gleixner acknowledged that was likely to be the case; some "special case" pieces would need to be maintained out of tree.
Something that might help realtime get the final push it needs to be mainlined and to have enough maintenance support would be a contract that required mainline realtime support, McKenney suggested. The original realtime patches came about due to a contract that IBM and Red Hat had with the US Navy, so something like that might come along again.
While the financial industry was once a hotbed for interest in realtime, that seems to have cooled somewhat. The traders are more interested in throughput and are willing to allow Linux to miss some latency deadlines in the interests of throughput, Hart said. The embedded use cases for realtime seem to be where the "action" is today, Gleixner and others said, but there has been little effort to fund realtime development coming from that community.
Technical hurdles
After that, the conversation moved on to the remaining technical hurdles to clear to "finish" the realtime work. Gortmaker noted that Ted Ts'o was not opposed to replacing the bit spinlocks (single bits used as spinlocks to save space) in the ext4 filesystem with regular spinlocks if it could be shown there were no performance impacts or, better still, that performance increases offset the extra space used in buffer-heads. Bit spinlocks are a problem for the realtime code because they cannot be turned into sleeping spinlocks as is done with other mainline spinlocks. Gortmaker said that he plans to pursue the conversion with Ts'o as a possible step toward eliminating bit spinlocks.
Gleixner suggested that a patch which converted bit spinlocks to regular spinlocks when lockdep is enabled might be one approach to solving the bit spinlock problem for realtime. Right now, bit spinlocks are not tracked by lockdep, so a cleanup that tracked them could be sold as a debug feature and the realtime patches could enable that mode as well. Molnar said that doing so might well find locking bugs, which would demonstrate its usefulness.
Rostedt asked about getting rid of uses of the cpu_chill(), which can lead to livelock situations. Gleixner said that it is a replacement for cpu_relax() that just does an msleep(1) to allow "nasty trylock loops" to continue to work. By delaying the looping task for a tick, it allows a preempted task to make progress which will, eventually, allow it to release a lock the looping task is waiting on.
Rostedt called cpu_chill() a "hail Mary" that just hopes whoever has the lock will let go of it. He suggested that the waiting task temporarily give its priority to the lock holder, but others thought that fixing the directory entry cache (dcache) code where cpu_chill() is used would be a better approach. For now, the msleep() is reasonable.
The bottleneck of turning reader-writer locks (rwlock) and semaphores (rwsem) into a single spinlock was another issue that Rostedt raised. He noted that there was some ongoing work by Mathieu Desnoyers to turn the oft-contended mmap_sem into something else. "Any heavily threaded application" works poorly on the realtime kernel, Rostedt said, because of mmap_sem contention. Either the realtime kernel can do something realtime-specific to alleviate the problem or there could be an effort to get rid of rwsems in the mainline kernel.
McKenney said that he had put Desnoyers and Peter Zijlstra together at the Kernel Summit to discuss the effort to rework mmap_sem. Zijlstra had made an attempt at the rework earlier, based on a paper from MIT that applied RCU in the page fault path to avoid the need for mmap_sem. It used a different kind of tree that required less rebalancing to track the mappings. He wasn't sure if anything came out of that conversation but that is one possible approach.
Another approach, suggested by Molnar, is to just eliminate rwsem in the realtime patch set and allow memory management to be non-deterministic. If an application cares about deterministic memory management behavior, it should be using mlock(), Gleixner said. Just removing rwsem and "see who complains" is probably best, Molnar said. If someone truly needs the functionality in the realtime kernel, they can fund the development of a realtime variant of rwsem, he said.
There was also discussion of restricting which softirqs are run when softirqs are processed as a result of a call to local_bh_enable(). A mask value could be provided to the local_bh_disable() call that would specify which types of softirqs were being disabled. Typically it would just be those for the subsystem doing the disabling, but others could be added if they needed to be held off.
Gortmaker plans to create an API to post as an RFC soon that would add the mask, but hide it behind a higher-level interface (like local_bh_disable_net() or similar). It would also convert one type of softirq (scheduler, RCU, or timer were suggested) to use the new API. That way, people can "scream" right away, Gleixner said, if they don't like the idea and another way to handle softirq processing for realtime can be found.
Where to next?
In summary, Gleixner said, much of the "low-hanging fruit" from last year's to-do list has been dealt with. Gortmaker picked up many of those and got them to the right subsystem maintainer, Gleixner said. What's left are the "nasty and intrusive" pieces that he keeps trying to "wrap my brain around", but the lack of developer time has really hurt that process.
Gleixner expanded on that problem some more in the report to the RTLWS. He believes a team of four or five full-time developers is needed to make realtime Linux truly sustainable. Without that kind of commitment, he is concerned that Torvalds will be unwilling to take the kind of core changes required by the remaining pieces of the realtime patch set.
The community contribution to the realtime patch set "amounts roughly to zero", he said. There is a fair amount of frustration on the team in always chasing mainline and being unable to stop realtime-unfriendly mainline features because the code is out of tree. In his mind, that should not continue past 2014; either a larger group steps up to work on the code or the project can be declared "finished", he said. "I could live with either outcome."
Gleixner said that he was trying to scare the audience a little bit with his proclamation, but it is clear he has nearly reached the end of his rope. While he would like to see the project continue—and prosper—he has real concerns about making the kinds of changes to the kernel that are required without a deeper and wider group to maintain it all. It seems that it is now up to those who use the realtime kernel to either step up or prepare for a future where the mainline kernel will have to serve their needs.
Index entries for this article | |
---|---|
Kernel | Realtime |
Conference | Realtime Linux Workshop/2013 |
(Log in to post comments)
The future of realtime Linux
Posted Nov 6, 2013 19:49 UTC (Wed) by HIGHGuY (subscriber, #62277) [Link]
I wouldn't be surprised that they start hiding PREEMPT_RT behind support contracts to fund either keeping the out-of-tree patches or aid in upstreaming the current effort.
As a PREEMPT_RT user in the embedded world, I'd be sad to see the efforts come to a halt, although I wonder what parts of the remaining patchset we'd be missing out on... (At this moment we're on the ancient 2.6.32+rt patchset)
The future of realtime Linux
Posted Nov 6, 2013 20:54 UTC (Wed) by karim (subscriber, #114) [Link]
The future of realtime Linux
Posted Nov 6, 2013 22:59 UTC (Wed) by dashesy (guest, #74652) [Link]
Thanks for the interesting read.
The future of realtime Linux
Posted Nov 6, 2013 23:03 UTC (Wed) by dashesy (guest, #74652) [Link]
The future of realtime Linux
Posted Nov 7, 2013 6:16 UTC (Thu) by karim (subscriber, #114) [Link]
The future of realtime Linux
Posted Nov 7, 2013 9:18 UTC (Thu) by dlang (guest, #313) [Link]
a lot of the core kernel folks have been doing this for a long while, they have learned things that you just don't get until you have been maintaining and improving the same thing for several generations. When you start looking at something and can't say "what was the idiot who wrote this thinking" because _you_ were that idiot, and you remember exactly what you were thinking, it starts to change how you approach new things. You become a bit more discriminating about what you implement and you think a lot more about the effort to maintain things. In the short term, you slow down, but by reducing the long-term maintenance burden you actually end up going faster over time.
and while it's hard to tell users 'no' or 'not now' or 'fix it first', many projects who don't push back end up collapsing and burning out and providing nothing to their users.
The future of realtime Linux
Posted Nov 7, 2013 9:52 UTC (Thu) by karim (subscriber, #114) [Link]
The future of realtime Linux
Posted Nov 8, 2013 6:57 UTC (Fri) by dlang (guest, #313) [Link]
but the reality is that it is a problem to maintain it separately, merging it with the mainstream kernel greatly reduces the work for those people who have been maintaining it so far, but that work doesn't all just go away, it goes out to the other kernel maintainers who now have to make sure that new changes don't break -rt, and they have to respond when the -rt people try to block other "important" features going in.
so it makes sense for the kernel maintainers to be careful about major changes.
The future of realtime Linux
Posted Nov 11, 2013 8:47 UTC (Mon) by karim (subscriber, #114) [Link]
Initially I said: "I'd like to think mainline's purpose is to serve its users, not its own self. But I do tend to be idealistic." If indeed the kernel's purpose is to serve its users then there would be some recognition that those needing real-time actually do need real-time in the kernel. What we have now is people maintaining functionality that was aimed back in 2005 at providing hard real-time and that currently actually doesn't and might actual never do so. How that becomes the benchmark for admitting something that actually solved that same problem even before PREEMPT_RT came around is beyond my clearly limited intelligence.
The future of realtime Linux
Posted Nov 11, 2013 9:47 UTC (Mon) by dlang (guest, #313) [Link]
well, if the external maintainers are saying that they will be finished with it within a year by either getting it merged upstream or they will stop maintaining it, they must believe that getting it merged will result in others doing some of the work that they have been doing.
The future of realtime Linux
Posted Nov 11, 2013 14:53 UTC (Mon) by raven667 (subscriber, #5198) [Link]
The future of realtime Linux
Posted Nov 12, 2013 2:41 UTC (Tue) by nevets (subscriber, #11875) [Link]
Currently, if a subsystem breaks PREEMPT_RT, we need to figure out a work around for that breakage. Sometimes we send patches to upstream, and they get fixed. Other times, it requires a bit of design change that upstream doesn't care about and that work goes into the -rt patch. Now the -rt maintainers need to maintain every subsystem in the kernel that breaks PREEMPT_RT, and that just does not scale.
Thus the comment about it either going into mainline or we are done is not saying we are done if it goes into mainline. But our work will be a lot easier if it is, as we don't need to maintain the entire kernel for PREEMPT_RT anymore. We just need to educate other maintainers on how to play nice with PREEMPT_RT.
The future of realtime Linux
Posted Nov 7, 2013 0:55 UTC (Thu) by ppisa (subscriber, #67307) [Link]
If RT variant is dead then there will be significant problem to use Linux for live/interactive audio applications/pass through processing as well. So even audio community should provide some interest there.
In each case, I want to express my thanks to Thomas to make mainline kernel much better and modern and to show that Linux can/could be changed to system usable for real world applications - automotive, robotic, industrial control and that is is not only OS for toy boxes and backbone system for advertisement driven servers.
Unfortunately, development of the things which save real lives is horrible underpaid - at least as I know from our own work on other systems and as seem on Linux RT project.
The future of realtime Linux
Posted Nov 7, 2013 4:19 UTC (Thu) by dlang (guest, #313) [Link]
and you could argue that something is 'real time' if it was 'guaranteed' not to have latency more than 1 second, but something not being real-time if it had latencies < 1ms 99.9999% of the time, but most people would be far happier with the second system than the first.
The future of realtime Linux
Posted Nov 8, 2013 13:45 UTC (Fri) by armijn (subscriber, #3653) [Link]
The future of realtime Linux
Posted Nov 8, 2013 18:08 UTC (Fri) by dlang (guest, #313) [Link]
However, the vast majority of cases where people start throwing around the term, they are really thinking speed, and a (very rare) missed deadline is less of a problem than most people think.
at some point you will miss your deadline because the hardware fails (or if you are a networked function, because the network drops a packet)
as noted in the article, the prior poster child of -rt scheduling (stock trades) is moving away from -rt as the probability of missing their deadlines gets to an acceptably low level and they started noticing that their overall throughput was improved by moving away from -rt
The future of realtime Linux
Posted Nov 20, 2013 18:18 UTC (Wed) by k8to (guest, #15413) [Link]
* Not real time users
* Wrong.
The future of realtime Linux
Posted Nov 20, 2013 18:24 UTC (Wed) by hummassa (guest, #307) [Link]
Yeah, that will happen until the next flash-crash caused by some specific circumstance making a node miss its deadlines. :D
The future of realtime Linux
Posted Nov 21, 2013 2:06 UTC (Thu) by mmorrow (guest, #83845) [Link]
The future of realtime Linux
Posted Nov 7, 2013 11:17 UTC (Thu) by jkacur (guest, #63) [Link]
We have an rt-wiki hosted on kernel.org, that never seemed to fully recover from the period in which kernel.org was down.
I would love to see it become more active again.
We welcome contributions. How-Tos, uses, etc,
https://rt.wiki.kernel.org/index.php/Main_Page
In addition, you can join the relatively low volume mailing list
linux-rt-users
Send a message to majordomo@vger.kernel.org with the only content being
subscribe linux-rt-users
The future of realtime Linux
Posted Nov 7, 2013 11:53 UTC (Thu) by karim (subscriber, #114) [Link]
P.S.: long-time no see, btw. OLS 200X I think.
The future of realtime Linux
Posted Nov 9, 2013 22:15 UTC (Sat) by liam (subscriber, #84133) [Link]
They've been running a rack of fairly diverse hardware for years on the -rt kernel.
Also free-electrons.com. That's more general embedded than realtime but it does cover that as well.
The future of realtime Linux
Posted Nov 9, 2013 16:39 UTC (Sat) by peterzzz (guest, #70147) [Link]
I don't think I saw that paper until after I did that work.
That said, faults shouldn't really be a problem for RT as you should lock and prefault all your memory anyway (well aware of the mlock() limitations etc..).
The basic premises of the idea is simple; (S)RCU lookup the VMA, speculative call the read_page() method if required and once you hold the page table lock validate the VMA you did your work against is still the same (or at the very least is still covering the page you faulted on) and proceed to install the page you found, if not bail and retake the fault.
Back then the problem was that due to the (S)RCU lookup we could keep file backed VMAs alive past their final iput() which becomes tricky way fast, as you'd have to delay the iput until call_rcu() time, which at the time wasn't possible.
However, since then Al Viro and Oleg Nesterov added the delayed_fput() which makes all of that quite possible.
There's a few other left overs after that but it should mostly be a matter of being careful.
The future of realtime Linux
Posted Feb 5, 2014 19:39 UTC (Wed) by solanum (guest, #95359) [Link]
What you get from them IS a larger community, a bug reports, potential help further with documentation, bug fixes, driver support and possibly kernel help. Essentially the whole point of the project is to get people to learn, about computers. Yeah you see everyone from newbies to kernel maintainers.
It has a direct relation to market penetration, documentation and project viability.
Getting easy to use documentation and a list of supported devices with "sample projects" out in the public, and helping people get started is the key to an overall successful project.
I have seen it quite a few times, in open source projects, where the lead developer group, chases off people trying to help. Because they seem like idiots, which they are newbies, so they do seem -stupid- to you, but that educational gap is the lack of easily obtainable knowledge. They don't stay stupid forever, and sometimes they end up contributing, even if it is merely answering the same stupid question they asked or adding the documentation to the FAQ.
I am not saying that this is the case in this instance. It is just a general comment.
The future of realtime Linux
Posted Oct 22, 2014 8:23 UTC (Wed) by ortalo (guest, #4654) [Link]
However, if the classical western players are too frozen in their current technology maybe it would be the time to have a look at the new players in asia who are certainly much more interested in alternatives than their entrenched competitors (esp. in aeronautics - space may be a little more innovative in the US currently, cf. SpaceX presentation a couple years ago).
As a bonus, I've read a few times in these columns that contributors from asia are under-represented in the kernel community.
Maybe the realtime patches could turn from a burden to an opportunity given different perspectives?