|
|
Subscribe / Log in / New account

Rationalizing the ARM tree

LWN.net needs you!

Without subscribers, LWN would simply not exist. Please consider signing up for a subscription and helping to keep LWN publishing

By Jonathan Corbet
April 19, 2011
The kernel's ARM architecture support is one of the fastest-moving parts of a project which, as a whole, is anything but slow. Recent concerns about the state of the code in the ARM tree threaten to slow things down considerably, though, with some developers now worrying in public that support for new platforms could be delayed indefinitely. The situation is probably not that grim, but some changes will certainly need to be made to get ARM development back on track.

Top-level ARM maintainer Russell King recently looked at the ARM patches in linux-next and was not pleased with what he saw. About 75% of all the architecture-specific changes in linux-next were for the ARM architecture, and those changes add some 6,000 lines of new code. Some of this work is certainly justified by the fact that the appearance of new ARM-based processors and boards is a nearly daily event, but it is still problematic in an environment where there have been calls for the ARM code to shrink. So, Russell suggested: "Please take a moment to consider how Linus will react to this at the next merge window."

As it turns out, relatively little consideration was required; Linus showed up and told the ARM developers what to expect:

Hint for anybody on the arm list: look at the dirstat that rmk posted, and if your "arch/arm/{mach,plat}-xyzzy" shows up a lot, it's quite possible that I won't be pulling your tree unless the reason it shows up a lot is because it has a lot of code removed.

People need to realize that the endless amounts of new pointless platform code is a problem, and since my only recourse is to say "if you don't seem to try to make an effort to fix it, I won't pull from you", that is what I'll eventually be doing.

Exactly when I reach that point, I don't know.

A while back, most of the ARM subplatform maintainers started managing their own trees and sending pull requests directly to Linus. It was a move that made some sense; the size and diversity of the ARM tree makes it hard for a single top-level maintainer to manage everything. But it has also led to a situation where there seems to be little overall control, and that leads to a lot of duplicated code. As Arnd Bergmann put it:

Right now, every subarchitecture in arm implements a number of drivers (irq, clocksource, gpio, pci, iommu, cpufreq, ...). These drivers are frequently copies of other existing ones with slight modifications or (worse) actually are written independently for the same IP blocks. In some cases, they are copies of drivers for stuff that is present in other architectures.

The obvious solution to the problem is to pull more of the code out of the subplatforms, find the commonalities, and eliminate the duplications. It is widely understood that a determined effort along these lines could reduce the amount of code in the ARM tree considerably while simultaneously making it more generally useful and more maintainable. Some work along these lines has already begun; some examples include Thomas Gleixner's work to consolidate interrupt chip drivers, Rafael Wysocki and Kevin Hilman's work to unify some of the runtime power management code, and Sascha Hauer's "sanitizing crazy clock data files" patch.

Some of the ongoing work could benefit architectures beyond ARM as well. It has been observed, for example, that most GPIO drivers tend to look a lot alike. There are, after all, only so many ways that even the most imaginative hardware designers can come up with to control a wire with a maximum of two or three states. The kernel has an unbelievable number of GPIO drivers; if most of them could be reduced to declarations of which memory-mapped I/O bits need to be twiddled to read or change the state of the line, quite a bit of code could go away.

There is also talk of reorganizing the ARM tree so that most drivers no longer live in subplatform-specific directories. Once all of the drivers of a specific type can be found in the same place, it will be much easier to find duplicates and abstract out common functionalities.

All of this work takes time, though, and the next merge window is due to open in less than two months. Any work which is to be merged for 2.6.40 needs to be in a nearly-complete state by now; most of the work that satisfies that criterion will be business as usual: adding new platforms, boards, and drivers. Russell worries that this work is now unmergeable:

Will we ever be able to put John's code in the kernel? Honestly, I have no idea. What I do know is that unless we start doing something to solve the problem we have today with the quantity of code under arch/arm _and_ the constant churn of that code, we will _never_ be able to add new platform support in any shape or form to the kernel.

Russell has an occasional tendency toward drama that might cause readers to discount the above, but he's not alone in these worries. Mark Brown is concerned that ARM development will come to a halt for the next several months; he also has expressed doubts about the whole idea that the ARM tree must shrink before it can be allowed to grow again:

What we're telling people to do is work on random improvements to more or less tangentially related code. This doesn't seem entirely reasonable and is going to be especially offputting for new contributors (like the people trying to submit new platforms, many of them will be new to mainline work) as it's a pretty big jump to start working on less familiar code when you're still trying to find your feet and worried about stepping on people's toes or breaking things, not to mention justifying your time to management.

If these fears hold true, we could be looking at a situation where the kernel loses much of its momentum - both in support for new hardware and in getting more contributions from vendors. The costs of such an outcome could be quite high; it is not surprising that people are concerned.

In the real world, though, such an ugly course of events seems unlikely. Nobody expects the ARM tree to be fixed by the 2.6.40 merge window; even Linus, for all his strongly-expressed opinions, is not so unreasonable. Indeed, he is currently working on a patch to git to make ARM cleanup work not look so bad in the statistics. What is needed in the near future is not a full solution; it's a clear signal that the ARM development community is working toward that solution. Some early cleanup work, some pushback against the worst offenses, and a plan for following releases should be enough to defer the Wrath Of Linus for another development cycle. As long as things continue to head in the right direction thereafter, it should be possible to keep adding support for new hardware.

Observers may be tempted to view this whole episode as a black mark for the kernel development community. How can we run a professional development project if this kind of uncertainty can be cast over an entire architecture? What we are really seeing here, though, is an example of how the community tries to think for the long term. Cramming more ARM code into the kernel will make some current hardware work now, but, in the long term, nobody will be happy if the kernel collapses under its own weight. With luck, some pushback now will help to avoid much more significant problems some years down the line. Those of us who plan to still be working on (and using) Linux then will benefit from it.

Index entries for this article
KernelArchitectures/Arm
KernelDevelopment model


(Log in to post comments)

Rationalizing the ARM tree

Posted Apr 21, 2011 12:21 UTC (Thu) by broonie (subscriber, #7078) [Link]

In terms of stalling work it's not a question of if it'll happen for at least this merge window - much of the work in question (like new platforms) needs to go through Russell and since Russell is already refusing any new code that work is currently stalled. We need Russell to change his view, which given where we are and the strength with which Linus has expressed himself seems unlikely.

Rationalizing the ARM tree

Posted Apr 21, 2011 20:15 UTC (Thu) by BenHutchings (subscriber, #37955) [Link]

Russell needs to bring in someone else to handle the managerial side of architecture maintenance, so he can concentrate on the technical side.

Rationalizing the ARM tree

Posted Apr 21, 2011 21:03 UTC (Thu) by tdwebste (guest, #18154) [Link]

This is unfortunate. It is a difficult task of moving out of tree arm kernel code forward.

Rationalizing the ARM tree

Posted Apr 22, 2011 1:44 UTC (Fri) by xilinx (subscriber, #50617) [Link]

It was surprising not to see mention of Device Tree driven ARM platforms in this article.

This work has the potential to dramatically rationalise arch/arm/mach-*, and is entirely complementary with other efforts such as driver consolidation.

Rationalizing the ARM tree

Posted May 12, 2011 23:49 UTC (Thu) by jcm (subscriber, #18262) [Link]

+1

This was discussed again at LDS as a means to radically reduce the number of mach/board files lying around.


Copyright © 2011, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds