If you have seen me anywhere near my computer at DebConf, you probably have seen the face of a hurried, worried developer. Still, if you monitor my Debian-related activity, you will notice it is still quite low, even given my (much needed and very much enjoyed) vacations pre-DebConf. Yes, orga-team work is very time consuming, even if my role is far from central this year. And yes, DebCamp+DebConf are known for sucking time into social interaction, which is great but not so (formally) productive. And yes, I even took 1.5 days off to visit my family and a friend who live in the area...
Still, I managed to release! \ /
Release what?
I have been working with Pooka for the last ~2 years on the Seminary on Collaborative Knowledge Construction. We assembled a group of ~10 speakers/authors, each of whom prepared a chapter for a book meant for publication. Pooka and me coordinated the work, which took a long time because it was also an interaction experiment (and because we both did it only in our free time).
After the coordination work started fading, I took up the task of coming up with a way to translate it all into LaTeX (and fix a host of conversion bugs, and play with the available packages, and... Hey, I'm after all just a LaTeX newbie, and had to learn to tame the beast!), I stumbled upon that precious fact that makes so many projects release.
I stumbled upon a deadline.
We want to publish the book under the seal of IIEc-UNAM. Besides my workplace, it is a very well regarded university, and having its seal in our work is definitively a big plus. And the Publications Committee of my Institute is meeting this week - So I had to send our final manuscript by today.
Having a deadline overlapping with DebConf sucks. But somehow, I managed to do the needed work to my complete satisfaction. The work is now in the Committee's hands, and I expect to have more news soon(ish).
Oh, and where can you get our work? Well, if you register in our site, you will be able to read the whole contents. And once the book is approved and published, the whole work will be published online under a free (CC-BY-SA) license.
BTW, that probably means I will have more time to fix my Debian bugs and pending stuff! \ /
This week, I am attending DebConf 10 at Columbia University in New York.
The first day of DebConf is known as Debian Day. While most of DebConf is for the benefit of people involved in Debian itself, Debian Day is aimed at a wider audience, and invites the public to learn about, and interact with, the Debian project.
These are the talks I attended.
Debian Day Opening Plenary (Gabriella Coleman, Hans-Christoph Steiner)
Hans-Christoph discussed Debian and free software from a big picture perspective: why software freedom matters, challenging the producer/consumer dichotomy, how the Debian ecosystem hangs together, and so on.
Steps to adopting F/OSS in government (Andy Oram)
Andy discussed FLOSS adoption in governments, drawing on examples from Peru, the city of Munich, the state of Massachusetts. He covered the reasons why this is valuable, the relationship between government transparency and software freedom, and practical advice for successful adoption and deployment.
Pedagogical Freedom (panel, Jonah Bossewitch et al)
The panelists discussed the use of technology in education, especially free software, some of the parallels between free software and education, and what these communities could learn from each other. This is a promising topic, though the perspectives seemed to be mostly from the education realm. There is much to be learned on both sides.
Google Summer of Code 2010 at Debian (Obey Arthur Liu)
This talk covered the student projects for this year s Summer of Code. Most of the students were in attendance, and presented their own work. They ranged from more specialized projects like the Hurd installer, to core infrastructure improvements like multi-arch in APT.
Beyond Sharing: Open Source Design (Mushon Zer-Aviv)
Mushon gave an excellent talk on open design. This is a subject I ve thought quite a bit about, and Asheesh validated many of my conclusions from a different angle. I ve added a new post to my todo list to go into more detail on this subject.
Some points from his talk which resonated with me:
As I did since 2007, I will be attending Debconf again this year. I have been quite busy recently, and am lagging behind in some of my Debian work, so I plan to use Debconf to get stuff done, not just socialize and attend talks.
Here is my TODO list, basically by order of willingness to do the work . It s probably too much for 9 days, so don t hesitate to talk to me if you want to help with some items.
gobby.debian.net. Just do the following in
order to be ready for collaborative minutes taking:
# apt-get install gobby-0.5
$ gobby-0.5 -c gobby.debian.net
(Note: you shouldn't use the non versioned
gobby package as it uses a different protocol and
doesn't support undo, which is quite risky; see Debian bug #590753 for more
background.)
As the naming convention for DebConf10 minutes, using document
names that start with dc10- sounds sensible.
The web offers a compelling platform for developing modern applications. How can free software benefit more from web technology, and at the same time promote more software freedom on the web? What would the world be like if FLOSS web applications were as plentiful and successful as traditional FLOSS applications are today?
Web architecture
The web, as a collection of interlinked hypertext documents available on the Internet, has been well established for over a decade. However, the web as an application architecture is only just hitting its stride. With modern tools and frameworks, it s relatively straightforward to build rich applications with browser-oriented frontends and HTTP-accessible backends.
This architecture has its limitations, of course: browser compatibility nightmares, limited offline capabilities, network latency, performance challenges, server-side scalability, complicated multimedia story, and so on. Most of these are slowly but surely being addressed or ameliorated as web technology improves.
However, for a large class of applications, these limitations are easily outweighed by the advantages: cross-platform support, instantaneous upgrades, global availability, etc. The web enables developers to reach the largest audience of users with the most compelling functionality, and simplifies users lives by giving them immediate access to their digital lives from anywhere.
Some web advocates would go so far as to say that if an application can be built for the web, it should be built for the web because it will be more successful. It s no surprise that new web applications are being developed at a staggering rate, and I expect this trend to continue.
So what?
This trend represents a significant threat, and a corresponding opportunity, to free software. Relatively few web applications are free software, and relatively few free software applications are built for the web. Therefore, the momentum which is leading developers and users to the web is also leading them (further) away from free software.
Traditionally, pragmatists have adopted free software applications because they offered immediate gratification: it s much faster and easier to install a free software application than to buy a proprietary one. The SaaS model of web applications offers the same (and better) immediacy, so free software has lost some of its appeal among pragmatists, who instead turn to proprietary web applications. Why install and run a heavyweight client application when you can just click a link?
Many web applications perhaps even a majority are built using free software, but are not themselves free. A new generation of developers share an appreciation for free software tools and frameworks, but see little value in sharing their own software. To these developers, free software is something you use, not something you make.
Free software cannot afford to ignore the web. Instead, we should embrace the web more completely, more powerfully, and more effectively than proprietary systems do.
What would that look like?
In my view, a FLOSS client platform which fully embraced the web would:
Just so I won't forget, but also to make sure others with similar
problems to me don't need to search for several hours before finding
it's so simple that it's silly:
If you have a bunch of image files (PNG, JPG, whatnot) that you want
to treat as a single clip in cinelerra rather than hundreds (if not
thousands) of individual files, the trick is to use a "list file": you
create a file with some metadata and a list of all the files that make
up the video clip, and import that, rather than the individual
files.
If said individual files are PNG files with alpha information, doing
so also makes it ridiculously easy to create an animation that only
covers part of the screen.
The file format is pretty basic; but over at this page on the cinelerra.org
website they list two scripts (one python with GUI, one bash and
command-line only) that can generate such a file, given a bunch of image
files. That makes it even easier.
I'd also like to note, for the record, that cinelerra outperforms
kdenlive in everything but 'transcoding flexibility'. Kdenlive also has
support for image lists (and you can create them in the gui rather than
having to muck about with external programs or editors), but it has the
rather nasty misfeature of doing the equivalent of "Oh, look, what's
that? We don't need that, let's throw it away" whenever it encounters
alpha information in PNG files.
For full reproducability, it's also possible to generate PNG files
with alpha information from povray if you use the +UA command-line
parameter, and say something like
sky_sphere pigment color rgbt <0, 0, 0, 1>somewhere in your scene file. Yes, I know, povray is non-free, but it works, and as opposed to blender I do know how to use it. Hey, I'm not RMS.
Thanks to the work of Mark Heily, both upstream and in Debian, this week saw the arrival of libdispatch in Debian.
libdispatch is the userspace component of Apple s Grand Central Dispatch technology, designed to help write applications that really take advantage of multicore processors without having to fiddle directly with threads and locking (and getting it terribly wrong).
To get that working on Linux, Mark wrote a userspace implementation of the pthread workqueues and a kqueue compatibility library (libkqueue). He also packaged the Blocks runtime (libblocksruntime) for Debian so as to build libdispatch with Blocks support. That means code using libdispatch must be built with CLang (or llvm-gcc-4.2) rather than gcc, as getting Blocks support in gcc in the near future looks highly improbable.
On Mac OS X and FreeBSD, a kernel-based implementation of the pthread workqueues is used; we don t have that for Linux yet. The all-userspace implementation we have at the moment works really well; there are some caveats, though, but that s no reason for not starting to play with libdispatch right now!
Try it out, it s great. Thanks again, Mark!
Tomorrow, at this time, I'll probably be unsuccessfully trying to find a
comfortable position on a seat of the Bilmanbus to Irun. Very early
on Saturday, as soon as we get off the bus, Maria and I will quickly head to
Hondarribia's beach in Cape Higer to symbolically wet our feet in the waters
of the Cantabrian Sea.
We won't have much time to enjoy the cold waters of the ocean, though.
Soon after that, we'll have to take a deep breath, look East, and start
walking if we want to achieve our utmost objective: take a bath in the
beautiful beaches of the Cap de Creus, in the Mediterranean sea. In between,
30 days and 840 kilometres of thick woods, deep valleys, high peaks and cold
waters, all of which shape incredible landscapes.

The Portella de Baiau, during our 2008 trip
For a whole month, we'll be mostly disconnected from everything else that
isn't our knee ache, our blisters, the Sun over our heads or where to get
food. It's the first time I leave on a hiking trip as long and tough as this
one, and I feel both uncertainty and eagerness. We've been so busy during the
last few months that we've been unable to train at all for this, and I'm
probably in the worst physical condition in a decade. It's too late
to take care of that now, so we'll try to take good care of our legs and
spine.
In order to get back home in the Mediterranean, we'll have to
be fast, some days joining two stages and skipping a few that we know are not
that interesting (sections over asphalt, etc.). It's hard to make it in just
one month, but we'll try our best. The plan is going to sleep not long after sunset, getting up at dawn, to be able to walk for a decent time before the heat
starts being a handicap and just resting at midday, when the Sun is
<strongest.>
Of course, this means that I'm missing, yet again, this year's edition
of DebConf in New York City, which is
really sad because I was looking forward hanging around with
Mako,
Mika,
Biella, micah,
Clint and the rest of the
NYC/
Boston gang, but when
the idea of doing a long trip this summer popped up around January, it was
clear DebConf seemed unlikely this year. I hope all of you have a lot of
fun, and see you in a few weeks!
The DNS server uses the associateddomain and arecord entries, while the DHCP server uses the dhcphwaddress and dhcpstatements entries before asking DNS to resolve the fixed-adddress. LTSP will use dhcphwaddress or associateddomain and the ldapconfig* attributes. I am not yet sure if I can get the DHCP server to look for its dhcphost in a different location, to allow us to put the objects outside the "DHCP Config" subtree, but hope to figure out a way to do that. If I can't figure out a way to do that, we can still get rid of the hosts subtree and move all its content into the DHCP Config tree (which probably should be renamed to be more related to the new content. I suspect cn=dnsdhcp,ou=services or something like that might be a good place to put it. If you want to help out with implementing this for Debian Edu, please contact us on debian-edu@lists.debian.org.dn: cn=hostname,cn=group1,cn=THINCLIENTS,cn=DHCP Config,dc=skole,dc=skolelinux,dc=no cn: hostname objectClass: dhcphost objectclass: domainrelatedobject objectclass: dnsdomainaux associateddomain: hostname.intern arecord: 10.11.12.13 dhcphwaddress: ethernet 00:00:00:00:00:00 dhcpstatements: fixed-address hostname ldapconfigsound: Y
ld.so and programs/libraries, but it can have a dramatic influence on startup times. My analysis is far from complete, would need to be improved by actually investigating ld.so code further, and so far has been limited to libxul.so built from mozilla-central, with the help of icegrind, on x86-64 linux.
As I wrote recently, icegrind allows to track memory accesses within mmap()ed memory ranges. As ld.so does mmap() the program and library binaries, tracking the memory accesses within these mmap()s allows to get a better idea at I/O patterns when an ELF binary is initialized. I only focused on local accesses within a single given binary file (libxul.so) because the case of Firefox loading many files at startup is already being scrutinized, and because most of the non-Firefox files being read at Firefox startup (system and GNOME libraries) are most likely already in the page cache. I also focused on that because it was an interesting case that could be helpful to understand how big (and maybe less big) binaries may be affected by the toolchain (compiler, linker and dynamic linker) and possibly by some coding practices.
For the record, what I did to get these results is to use icegrind and elflog, with further additions to the sections file with some output from objdump -h : I added sections that elflog wouldn t give (such as .plt, .hash, .dynsym, etc.), and even down to the entry level for the .rela.dyn section. The latter is particularly interesting because icegrind only outputs the first access for any given section. To see sequential accesses within that section, you need to split it in smaller pieces, which I did for .rela.dyn entries (each one being 24 bytes on x86-64). Uncommenting some parts of the icegrind code was also useful to track where some accesses were made from, code-wise.
Now, the interesting data:
One of the first accesses is a nullification of a few variables within the .bss section. The .bss section is usually an anonymous piece of memory, that is, a range of mmap()ed memory that is not backed by a file, and filled with zeroes by the kernel (I think it even does that lazily). It is used for e.g. variables that are initialized with zeroes in the code, and obviously, any code accessing these variables would be addressing at some offset of the .bss section. It means the section needs to start in memory at the offset it has been assigned by the linker at build time. This is actually where problems begin.
When the .bss section offset as assigned by the linker doesn t align on a page (usually 4KB), the mmap()ed .bss can t be at that location, and really starts on the next page. The remainder is still mmap()ed from the binary file, and ld.so will itself fill that part. As the .bss section doesn t start on a page boundary, any write at this location will trigger the kernel reading the entire page. This means one of the first set of data being read from the file is the end of the section preceding .bss, and the beginning of the following one. Most likely, respectively the .data and .comment sections.
While this probably doesn t matter much when the binary file is small, when it is big enough, reading in a non sequential manner will trigger hard disk seeks, and we all know how they can hurt performance. Although thankfully, cheap SSDs should be coming some day, in the meanwhile, we still need to cope with the bad performance. The interesting part is, the .bss section is really empty in the binary file, so its virtual memory address could be anywhere. Why the linker wouldn t align it at a page boundary without having to resort to a linker script is beyond me.
The next accesses go back and forth between .dynamic, .gnu.hash, .dynstr, .gnu.version_r, .gnu.version and .dynsym. These are probably all related to symbol version resolution and DT_NEEDED library loading. While most of these sections are at the beginning of the file (not necessarily in the order they are read from), the .dynamic section is much nearer to the end, but way before .data, so that it won t even have been loaded as a by-product of the .bss section loading.
After that, the .rela.dyn section is read, and for each relocation entry it contains, the relocations are being applied. Relocations is one of the mechanisms by which position independent code (PIC) is made possible. When a library is loaded in memory, it is not necessarily loaded at the same address every time. The code and data contained in the library thus need to cope with that constraint. Fortunately, while the base address where the library is mmap()ed in memory is not necessary constant, the offsets of the various sections are still as codified in the binary. The library code can thus directly access data at the right offset if it knows the base offset of the library (which is what is done on the x86 ABI), or if it knows where the current instruction is located (which is what is done on the x86-64 ABI).
Static data (initialized in e.g. a const or a global variable, or, in C++ case, vtables), on the other hand, may contain pointers to other locations. This is where relocation enters the scene. The .rela.dyn section contains a set of rules describing where in the binary some pointers need to be adjusted depending on the base library offset (or some other information), and how they should be updated. ld.so thus reads all .rela.dyn entries, and applies each relocation, which means that while .rela.dyn is being read sequentially, reads and writes are also performed at various places of the binary, depending on the content of the .rela.dyn entries.
This is where this gets ugly for Firefox: there are near 200000 such relocations. On x86-64 an entry is 24 bytes (12 on x86), and each of these is going to read/write a pointer (8 bytes on x86-64, 4 on x86) at some random (though mostly ordered) location. The whole .rela.dyn section not being read ahead, what actually happens is that it is read in small batches, with seeks and reads of other data at various locations in between. In libxul.so case, this spreads over .ctors, .data.rel.ro, .got, and .data. The relocation entries are somehow ordered by address to be rewritten, though they occasionally jump backwards. Some of these relocations also appear to be touching to .gnu.version, .dynsym and .dynstr, because their type involves a symbol resolution.
Once .rela.dyn relocation have been dealt with comes .rela.plt s turn. The principle is the same for this section: entries describe what kind of relocation must be done where, and how the result must be calculated. The scope of this section, though, is apparently limited to .got.plt. But before explaining these relocations, I ll explain what happens with the PLT.
The PLT (Procedure Linkage Table) is used when calling functions from external libraries. For example, in a Hello World example, the PLT would be used for calls to the puts function. The function making the call would in fact call the corresponding PLT location. The PLT itself, on x86 and x86-64, at least, consists of 3 instructions (I ll skip the gory details, especially for x86, where the caller needs to also set some register before calling the PLT). The first instruction is the only one to be called most of the time: it reads the final destination in the .got.plt section, and jumps there. That final destination, obviously, is not fixed in the library file, since it needs to be resolved by its symbol. This is why the two subsequent instructions exist : originally, the destination stored in the .got.plt section points back to the second instruction ; the first instruction will effectively be a nop (no operation), and the following instructions will be executed. They will jump into code responsible for symbol resolution, update of the .got.plt entry for the next call, and call of the real function.
But pointing back to the second instruction is like the pointers in static data we saw above : it s not possible in position independent code. So, the .rela.plt relocations are actually filling the .got.plt section with these pointers back to the PLT. There are a tad more than 3000 such relocations.
All these relocations should be going away when prelinking the binaries, but from my several experimentations, it looks like prelinking only avoids relative relocations, and not the others, while it technically could skip all of them. prelink even properly applies all the relocations in the binary, but executing the binary rewrites the same information at startup for all but relative relocations. That could well be a bug in either ld.so not skipping enough relocations or prelink not marking enough relocations to be skipped. I haven t dug deep enough in the code to know how prelinking works exactly. Anyways, prelinking is not a perfect solution, as it also breaks ASLR. Sure, prelink can randomize library locations, but it relies on the user or a cron job doing so at arbitrary times, but that s far from satisfying.
An interesting thing to note, though, is that a good part of the relocations prelinking doesn t rid us of in libxul.so (more than 25000) are due to the __cxa_pure_virtual symbol, which is used for, well, pure virtual methods. In other words, virtual methods that don t have an implementation in a given class. The __cxa_pure_virtual function is set as method in the corresponding field(s) of the class VTABLE in the .data.rel.ro section. This function is provided by libstdc++, and as such, is dynamically linked. But this function is just a dummy function, doing nothing. Defining an empty __cxa_pure_virtual function to be included in libxul.so makes these relocations become relative, thus taken care of by prelinking.
After all relocations occur, the library initialization itself can begin, and the content of the .init section is executed. That section, indirectly, executes all functions stored in the .ctors section. This includes static initializers, which are unfortunately called backwards, as Taras pointed out already. Each of these static initializers are also accessing various locations in the .data or .bss sections, which may or may not have already been loaded during the relocation phase. The execution of these initializers will also (obviously) read various pieces of the .text section (despite its name, it contains executable sections, i.e. functions code).
The initialization of the library ends there, and no access should happen until a function from the library is called. In libxul.so case, XRE_main is first called, then many other functions, but that s another story. All that needs to be remembered about the startup process past this point is that the .text section will be read heavily, as well as the various data, got, plt and dynamic symbol sections, in a very scattered way. While most of these sections may have been retrieved in memory already, as a byproduct of the various initialization processes described above, some may have not, increasing even more the need to seek at all places in the binary file.
Now the main problem with all these I/O patterns at startup, is that it seems the only way reorganizing the binary layout may have a visible impact is by considering all the above, and not only a part of it, because only addressing a part of it is very likely to only move part of the problem to a different layer.
All in all, making sure the relevant sections of libxul.so are read by the kernel before ld.so enters the game is a good short-term solution to avoid many seeks at startup.
I'm running a power management track at the Linux Plumbers Conference again this November. Unlike most conferences which focus on presenting completed work, Plumbers is an opportunity to focus on unsolved problems and throw around as many half-baked solutions as you want in order to try to find one that seems to stick. The suspend/resume problem in Linux is mostly solved[1], which means that it's time for us to focus on runtime power management and quality of service.
check-deps.sh
This Monday I was again at concert of Grossstadtgefl ster, and it was again one of the best concerts I've visited. Their new album again has again great songs on it like the former two, and their live performance is truly worth it. Besides they are charming like hell offstage, too. Jen, Raphi and Chriz, I simply love you!
It's hard to choose which songs to put here because there are way too many great ones, so feel free to dig around yourself if you like them:
The current version of mksh
had use of arc4random(3) removed, including set -o arc4random , to
speed it up (on some architectures, a lot) this will break
some existing scripts (such as /etc/rc *cough* on MirBSD ).
Hence I decided to publish the next version of mksh(1) as R40 based
upon current development, and defer plans for associative arrays (and
multidimensional arrays) for mksh R41. There s also already the change
to Build.sh arguments, so this suits me quite fine.
(Read: if running MirBSD, don t upgrade mksh at the moment.) There
will be a new MirBSD snapshot once this is fixed, maybe a few more
changes to the shell for better POSuX compliance, and the recently mentioned
patent on LFNs (long filename) in FAT will be taken into account with
a patch to msdosfs.
I ll travel to LSM/RMLL 2010,
the Libre Software Meeting (Rencontres Mondiales
du Logiciel Libre) tomorrow until the weekend, to hack some on
FusionForge (this is worktime for me), visit XTaran, Uriel,
and maybe a couple of other usual people .
Thundersday, between 10:00 UTC and 12:00 UTC, eurynome will
be shut down by gecko2@ due to power supply maintenance on the host
system data centre.
We have a new mirror in the Americas, thanks a lot to Mike 'Fuzzy'
Partin! Benny will mention it on the webpages once it s working.
Next.