2.6 and the user-space ABI
[Posted May 15, 2007 by corbet]
The 2.6.22-rc1 kernel is out, and the reports of regressions are beginning
to trickle in. A couple of those involve user-space binary interface
changes: one in the video4linux2 interface and one in the i2c code (which
affects hardware monitoring utilities). The V4L2 regression involves a
change made to a structure passed to and from user space; chances are good
that it will be reverted before the final 2.6.22 kernel comes out. For the
time being, the i2c problem is "fixed" by upgrading to version 2.10.3 of
the lm_sensors package.
Linus isn't happy about the forced
lm_sensors upgrade; he has asked for a way to avoid that requirement. In
response, i2c maintainer Jean Delvare raised
some misgivings about the stable ABI policy:
While I'm all for keeping things relatively stable and not asking
the user to constantly upgrade user-space, I believe that we just
can't promise to never break user-level interfaces while keeping
the development pace we have right now. We can promise to grant
people significant delay before we drop compatibility options, but
"forever" doesn't scale.
Those comments notwithstanding, Linux has managed to maintain user-space
ABI compatibility quite nicely for many years. There are certainly
exceptions, but they are few enough and far enough between that each one
stands out. But, as Christoph Hellwig points
out, the situation is not perfect:
Except for very rare case (modules support comes to mine) syscall
compatibility works perfectly. But that's because syscalls are a
very visible ABI and people don't break them by accident. They
also don't decide they have a cool new scheme all syscalls need to
follow now.
Now compare that to sysfs..
The user-space ABI now goes well beyond system calls. The huge sysfs
interface (4800 files on your editor's desktop) is a big piece of user
space's view of the system, and it is a piece which is difficult to avoid
breaking. Directories in sysfs correspond directly to data structures
within the kernel; changes to those structures will often have consequences
in sysfs. So kernel developers may think that they are operating far away
from the user-space interface, but end up breaking it anyway. Netlink,
/proc, and ioctl() also make up part of the ABI, and
they, too, can be easy to break. The V4L2 regression is the result of an
attempt to extend one ioctl() call breaking others.
The new development model can also make it harder to maintain
compatibility. Four or five major releases per year, each with a full load
of new major features, adds up to a lot of code changes. There is also no
clear point where whatever changes do prove to be unavoidable can be
made without surprising users. If the kernel developers were to disappear
for a year or two and return with a 3.0 release, nobody would be surprised
if it required a small amount of adaptation on the user-space side. But a
2.6.22 release - which contains needed fixes and new drivers along with new
features - is not expected to break working systems.
Arguments for returning to the older development model are hard to find,
though. Despite occasional glitches, things are generally working far
better than they did before 2.6 came out. The pace of development is
unlikely to slow. So the problem of occasional ABI regressions is likely
to remain with us. As is often the case, the best way to avoid such
problems - after a high degree of attention by the developers - is
extensive testing. User-space ABI changes caught during the development
cycle will almost certainly not survive into the final release, but it is
hard to fix problems that nobody knows about. As is also often the case,
automating this testing is hard; nobody can put together all of the
hardware and software combinations that the kernel will face. So the
worthy cause of maintaining a stable user-space interface is likely to
require a fair amount of human attention for the foreseeable future.
(
Log in to post comments)