← Back to team overview

ubuntu-boot team mailing list archive

Starting X earlier in boot process

 

One of the changes that we have experimented with on the Hardy netbooks/MIDs is to start X earlier in the boot process.  Scott had mentioned at UDS Intrepid that this could be effective and our bootcharts supported this.

Our bootcharts showed a significant CPU usage drop while X was starting up and the 3 main reasons for this were:
1. Most of the initialization that could happen before the windowing system was up had already completed
2. Most of the remaining initialization could not occur until after the windowing system was up
3. Sleeps during X loading (especially during the loading of drivers)

Moving X up would help address reasons 1 and 2 as it would allow initialization that previously ran before X was started to occur in parallel with X start-up and it would allow initialization that could not occur until after the windowing system was up to start earlier (because the windowing system itself would be started earlier).  To address reason 3, we removed as many sleeps as possible from X and its drivers.  Fedora's OneSecondX project (http://fedoraproject.org/wiki/Features/OneSecondX) provided useful information in this area.

By moving gdm (which starts X) to the beginning of runlevel 2 (previously, it was started by /etc/rc2.d/S30gdm), we were able to reduce the boot-time by 3-5 seconds.  By removing many of the sleeps in X and its drivers, we were able to further reduce the boot-time by about 2 seconds.  In the resulting bootchart, the CPU was used much more efficiently.  However, we ultimately reverted the gdm change in many of our netbooks despite the savings because of failures in reboot stress testing and because of its inherent riskiness.  Although we did keep the X sleep removal changes, they are of less interest to this group since the X server in Intrepid (and Jaunty) is much more efficient starting up than the one in Hardy.  This posting is really about capturing the challenges we encountered when moving X startup earlier in the boot process.

The following are the main challenges we encountered:

1. Getting gdm to wait for its dependencies and only for its dependencies

Unfortunately, it's difficult to achieve this using the SysV init scripts as they only support a single sequential order.  It is more easily done using upstart but, given that most initialization in Hardy does not use upstart, the conversion of gdm to an upstart task is not an easy task.  For an upstart task to start gdm only after waiting for all of gdm's dependencies to start, all of gdm's dependencies and each of their dependency chains need to be started by upstart tasks.  The SysV init to upstart conversion therefore includes the conversion of many more services than just gdm.

2. Determining what gdm depends on is a challenge in it of itself

D-BUS, HAL, and acpid seem to be its main dependencies.  Are there others?  Hopefully, HAL and acpid will not be an issue in Jaunty.  Scott mentioned that D-BUS activation of HAL may be used to start HAL in Jaunty and I have heard that acpid no longer is needed by gdm (can someone confirm that gdm can function properly if it starts before /var/run/acpid.socket is created?).

3. Starting gdm in an upstart process rather than in the init process caused the following VT Switching issue to occur during stress testing: http://lkml.indiana.edu/hypermail/linux/kernel/0204.0/1139.html

Essentially, screen corruption can occur if 2 VT_ACTIVATE calls are called in close succession.  Having gdm run outside of the init process increases the likelihood that this will happen since gdm causes a VT switch (when it tears down usplash) and the init process may also call a script that switches VTs.  That said, the only VT switch in the init process that we ran into issues with is the one triggered by /etc/rc2.d/S98usplash and this script may very well be obsolete since gdm explicitly tears down usplash now.  Can we safely remove /etc/rc2.d/S98usplash for Jaunty?



I hope this information is useful in deciding whether to start X earlier in Jaunty and, if so, what challenges need to be overcome to achieve this.

-Debbie



-- 
This message was sent by Launchpad via the Contact user/team
link on your profile page.  For more information see
https://help.launchpad.net/YourAccount/ContactingPeople



Follow ups