Search:  

 
 
   News
home

Ubuntu Gutsy on Sony TX series (TXN19P)
custom kernel, powertop optimized and all
(old news - 07:05PM Monday Oct 22 2007)
Help! I lost a week of my productive hours to Ubuntu. First it starts with downloading LiveCD and booting it, then it becomes "I'll just try it in a partition" and finally you are chasing down minor tweak after minor tweak to get it almost, but never perfectly, "just right".

lspci, lsusb



What works etc..


What works out of the box
Gutsy, actually, not Feisty, although Feisty was ok too
The HDD and DVD drive, of course
The video-subsystem including 24 bit deep native 1366x768 (use the intel driver but i810 works as well)
Wifi (ipw3945) and wpa_supplicant via gnome NetworkManager
Bluetooth
Sound (speakers and headphones)
Suspend to disk
Suspend to RAM
Texas 5-in-1 card reader (Gutsy also provides sony memory stick filesystem)
Screen brightness
PMCIA cards (probably?)
USB port
Playing DVDs (using VLC)
3d graphics (glxgears 525fps, compiz etc)


What can easily be made to work
Reasonable sony keys support
rmmod sonypi; modprobe sony_laptop .. edit the hotkeys startup script to avoid sonypi and use sony_laptop instead
fan control via command line
again, provided by sony_laptop. The fan appears to be controlled by thermals so there is little point changing the speed manually
Full synaptics/ALPs pad
requires some xorg.conf tweaking to enable synclient and/or to setup options to disable double-tap and so on
you should have absolutely smooth motion, no halts or jumps
Brightness control
the acpi brightness .sh script called by down/up brightness keys interprets brightness level 0 as "off" but there is no "off" utility (spicctrl), and brightness level 0 is actually available so we miss out on minimum brightness without echo 0 into the /proc file. This is also a filed bug in launchpad.
56k intel_hda modem
I guess? haven't tried it


Not enabled

Alt-Fn F10 - resolution expansion key
in addition, the AV keys apart from the green one, and the eject, do not generate events


Not ideal
An unlabeled Fn-F2 is connected to gnome volume mute and un-mute
the mute button works but does not generate any software events
the volume up/down buttons do not alert any software
the brightness up and down change isn't communicated to gnome brightness applet (which works, but gets confused as to the current brightness)
There is a TPM module for the TPM Infineon chip, but little docs for it
The brightness setting on this laptop is actually NINE steps (0 thru 8 inclusive). The sony_laptop module thinks hardware starts from 1, so it maps that to 0. The brightness modification hotkey script takes this mistake and compounds it, by mapping 0 to "off" (which is not possible on this vaio). By fixing both of these issues we regain all 9 levels of brightness and are able to use the two lowest settings that were previously blocked under default Ubuntu.


What doesn't work
Fingerprint reader
The thinkfinger project explicitly says it is not for the vaio reader, it gives a CONNECT error
Sprint EVDO WWAN
you can get it up as a usbserial device, but so far I haven't figured out how to use it


What works better than windows XP
The wifi association/dhcp lease renewal (was kind of flaky under XP)
suspend/resume (XP would disable the hibernate option after one use!)


What doesn't work as well as XP
Power usage is 15% higher at full idle than XP.
still investigating this, some hardware must be left on by linux
Kernel loses touch with disk, and file-system goes read-only after suspend/resume(?)
I noticed this on Gutsy, with my current config haven't seen it
Turning off power to CDROM kills access to HDD
hald recognizes when the CDROM goes off and appears to screw up access to the HDD


NetworkManager


The stated aim of NetworkManager is to make networking "just work". It doesn't yet achieve this. I have noticed several issues. NetworkManager will sometimes SEGV and then enter an infinite cpu-using loop handing the signal. It has to be killed with -9 then restarted. The gnome nm-applet does not recognize when NetworkManager has gone beserk. Sometimes (through hibernate/resume or whatever) it gives up and wireless networking must be unchecked then re-checked before it wakes up, and finds the AP. The safest thing to do is to add to /etc/acpid/resume.d a script that will simply kill NetworkManager, and wpa_supplicant, then restart it fresh. The same thing needs to be done after hibernate (to disk) resumes.

More on power management and power drain


Out of the box ubuntu doesn't offer many options for maximum battery life. hdparm is not set to enable power saving on the HDD. Even the screen blank option (turning off the panel) minimum setting is a long 10 minutes (you can use xset dpms to specify seconds if you want a shorter timeout). There is no GUI support for turning off bluetooth, setting wifi power saving, or disabling polling the CDROM drive.
I used the following links to get familiar with power saving:
»www.thinkwiki.org/wiki/How_to_re···umption

Basic Tweaking


I played with the following for speed:
preload
readahead (including requesting a re-profile)
prelink
bootchart
In summary, preload is a daemon that attempts to do read-ahead for applications to improve startup time. readahead comes with Ubuntu but you can tune it (look at /etc/readahead/files, and reboot with 'profile' in the kernel command line to generate a new file list). Use bootchart to generate a PNG of your current boot that you can view with firefox to see if your last fix improved boot time or not. Prelink can be manually run, or run on all executables in the major directories, to improve their startup time. You can manually run it against firefox by prelinking firefox-bin but you will have to tell prelink where the firefox libraries are (they are in the same directory as firefox-bin).

Building a Custom Kernel on Gutsy


I decided to build a custom kernel. It provides more flexibility for this hardware. There were at least two kernel patches I was interested in. One allowed under-volting which possibly allows better power consumption, and the other is known as HPET, (High Precision Event Timing) supposedly provides better CPU idling.
A third patch was to implement the "completely fair scheduling" which is just a Cool Thing if you want to do background compilations while still getting a responsive desktop. In addition I wanted to fix the errors I was having with the HDD that resulted from coming back from a suspend (or perhaps power-saving options). The ubuntu bug database appeared to indicate this may have been fixed in a kernel version beyond Gutsy.

So I built a custom kernel starting with 2.6.22-14 with:
linux-phc-0.3.0 patch (patches acpi-cpufreq to allow undervolt)
patch-2.6.22-hrt6 patch (patches for better cpu idling)
sched-cfs-v2.6.22.9-v22 patch (patches for completely fair scheduling)
tuxonice patch (faster suspend to disk)

HPET is activated according to the new boot log:

linux-phc is active if you have

The only 'restricted driver' used by this laptop is ipw3945, and although there are instructions on how to compile it up, you need to get the ubuntu modified version because it fixes bugs in the 'upstream' version that, at least for this hardware, break NetworkManager / wpa_supplicant! I wasted a day fiddling around with wpa_supplicant and NetworkManager before figuring this out. The key breakthrough was a post ( »https://bugs.launchpad.net/ubuntu/+sourc···ments/10 ) explaining how to test wpa_supplicant with wpa_cli, and seeing that it didn't actually command the wifi device properly.

I used the kernel build instructions in this topic, (post #2, not #1)

»ubuntuforums.org/showthread.php?t=538068

Since I wanted to apply multiple patch files, not just 1, there was more work to manually handle the .rej files. While the kernel was building I had to obtain the three different source files for the ipw3945 (daemon, driver and ucode) following roughly this explanation:
»ubuntuforums.org/showthread.php?t=294842
(if make fails with lots of errors try make shell=/bin/bash !)

I did need to grab the current ubuntu patched version of ipw3945.c first, however, which the above link does not mention. There is a reason that modinfo reports ipw3945 in vanilla gutsy or Feisty is "1.2.2d.ubuntu1" not "1.2.2d". The reason, and patch, is here:
»www.nabble.com/-PATCH--normalize···44.html
The ubuntu file is out there in ubuntu source repository land, and I can't find it right now.

The .config file was based from the one provided in the forum howto above. I wanted to make sure powertop would work so I had to enable CONFIG_DEBUG_KERNEL.

After bootup I added the 'ladder' kernel module to install by adding it to /etc/modules. 'menu' seemed buggy, it would lose track of the availability of the processor C3 state after the AC adapter went in then was removed again.

Using powertop and maximising battery life


In order to maximise battery life so that it would approach or match XP I had several aims:
* maximum power saving CPU state
* minimum number of interrupts per second
* maximum power saving state (or off state) for devices
* minimum disk activity
The following little collection of commands addresses this:
Most of this is self-explanatory. I had to comment out powering down the cd drive because that seemed to destroy access to the HDD (they share the same IRQ).

What you can't see elsewhere is that I also mount the drive using options 'noatime', and 'commit=30' as ext3 appears to want to write to the drive every 5 seconds if there is the slightest activity and this plays havoc with HDD sleep. You will also have to deal with syslogd wanting to write to a bunch of log files all the time if you want the drive to really spin down.

using powertop I also saw what had been reported by others: that X with 3d enabled seemed to generate an interrupt 60 times a second. So I edited xorg.conf and added Option "NoDRI" to the Device section for the chip. I also switched to the "intel" driver from the "i810" driver for no good reason I can yet find, other than the "intel" driver appears to be newer. Without DoDRI, glxgears and compiz (ubuntu "desktop special effects") worked ok.

Powertop also revealed that interrupts per second are jacked up by your AP wifi beacon frequency (which often defaults to 10 times a second - change it @ your router), and use of the ALPs/Synaptic pad which generates 80 packets a second when you are touching the pad. Firefox contributes at least 10 a second, and some of the more continuous gnome widgets also generate some.

Only by running in text mode with no graphical desktop could I make powertop go green and show a mere 5 interrupts per second.

Gutsy tickless kernel helps vs Feisty (the previous production ubuntu), and the HPET patch, and the phc patch, both appear to help some more (now I wish I'd kept stats at each stage).

Boot and shutdown time

MarkXPUbuntu 7.10
+9sGrub menuGrub menu
+14sSplashSplash
+29sCursorMoving bar
+39sWelcome---
+44s--Cursor
+49sXP Sound--
+54s---login box
+59sdesktopsound
+1m 9sstart firefox--
+1m 14s--desktop
+1m 19s--start firefox
+1m 24s--firefox ready
+1m 55sfirefox ready--
+15sshutdownshutdown
At first I thought that Ubuntu was much slower than windows on booting up but impressions can be deceiving. Windows does a good job of showing you your desktop as fast as it can but you can't actually use it for a fair bit longer, and launching firefox asap incurs a huge delay, evidently because certain services are still being started up in the background.

This XP install is fairly vanilla. No AV software or anything expensive put into auto-startup. Most of the stuff Sony threw in was removed or disabled.

Ubuntu is up and multi-user earlier than XP, at about the 25 second mark after grub kicks it off, but takes longer to give you a fully functional desktop. Once the desktop appears, however, the machine is pretty much devoted to your needs so it is able to start firefox in just 5 seconds or so.

In both XP and Ubuntu, the wifi network is up and available before you are able to use it.





Baselining Windows XP consumption


Analyzing XP power consumption was useful so I could aim Ubuntu at the same target. On an idle XP desktop, with maximum power saving and minimum brightness, XP allows the processor to stay in C3 over 98% of the time. With wifi off, XP is handling about 60 interrupts per second, and changes state out of C3 about 60 times per second. With movement on the touchpad, C0 rises to about 5% and C3 drops, while interrupts and context switches shoot up, but power usage does not rise that much.

Monitoring the reported battery draw under XP (leaving it 5 minutes to stablize):
1600mw - suspended
3400mw - screen off (maximum battery settings)
5250mw - backlight level 0
5350mw - enable CD drive
5380mw - enable modem
5420mw - enable audio
6240mw - enable wifi, on power saving mode
6300mw - wifi on standard mode
9050mw - backlight level 7
5000mw - lcd panel off (everything else on)
+300mw - constant touchpad use (5% busy cpu)

Conclusion:
Although the touchpad generates a lot of interrupts, under XP this does not translate to much increased CPU usage, or much increased power usage.

Under Ubuntu, moving the mouse using the touchpad took over 10% of the CPU, depending on what application is under the mouse. Firefox, for instance, the CPU is busy - albeit at 800mhz - 10% of the time. Removing the "ondemand" power manager helps increase C3 state usage: the cpu is able to spend more time at C3 during mouse movement than it could at 800mhz, and power usage actually dropped.

This article »softwarecommunity.intel.com/arti···1086.htm is a good one on how C3 power benefits getting destroyed by frequent interrupts.

Frequency scaling / under-volt


Frequency scaling was there from Feisty and Gutsy anyway, although on this laptop the only options offered by ACPI are full speed (1.2ghz) or 800mhz (same as XP). I don't think frequency scaling is very useful on this platform. If you have work to do, do it as quickly as possible so you can go back to C3 state.

One can also attempt to lower the voltage to save power and heat, but supposedly this intel chip locks the minimum voltage at barely below the default at 800mhz, at 0.930v or something like that. Running at 1.2ghz and a lower voltage would be useful, however. I haven't found a way to determine whether the requested voltage is actually in use.

Power Results


Best results
In text mode, with a custom kernel, with a couple of daemons killed and without running X I can get the average time in C3 state to over 200ms (less than 5 interrupts per second) while still being on wifi. At this point the entire laptop is using about 6 watts of power even though the LCD backlight is active. With about 50 watts of battery capacity the runtime in this mode would be theoretically over 7 hours.

As this article points out, allowing C3 to actually save power requires 1ms+ residency: »softwarecommunity.intel.com/arti···086.htm

Running on desktop, with mouse and pointer use, on brightness setting 3 from 0..7, power use is around 7.5 watts. This is not quite as good as XP.

Critically, I was unable to achieve the same minimum power consumption as XP (wifi off, devices off). XP gets down below 5 watts here. Ubuntu cannot get below 6 watts. Ubuntu must be leaving a key device on, or not in a low power state.

Typical Results
Once you have identified with powertop the problem drivers and mitigated them as you can, once you have disabled bluetooth, reduced wifi consumption, turned off cdrom polling and set HDD power saving, and decreased the need for linux to write to the drive with various settings then just using a browser (reading/typing and sometimes fetching new pages) you can expect to average about 7.5 watts.

Using the 3d desktop instead (which does look so much cleaner), power will rise to over 9 watts, giving a 3.5 hour runtime.

Powertop will report about 50 or so interrupts per second. Many more if you're using the pad.
Click for full size

While I type this post up, I am running on battery and power consumption hovers between 8 and 9 watts. LCD brightness is setting 3 out of 7 max, wifi is active.


The (older) battery I have here reports "full" at 50 watts - which is about 15% less than its rated capacity. It has probably been through over 150 charge/discharge cycles in its life.

Disk activity
It seems to be difficult to keep the disk idle during casual use. Even with a 30 second commit on the partition, there always seems to be something that needs writing. sysctl vm.block.dump=1 will reveal the programs the dirty the buffers but obviously firefox needs to write cache files, log files and state files are written by daemons. It is difficult to eliminate all of this.

Future Mods
I'd like to perhaps obtain a 64GB solid state 1.8" sandisk/samsung drive to replace the internal 80gb 1.8" drive. The advantages are myraid. Power consumption drops, noise drops to zero and so does heat. The flash drive would also be impervious to vibration. Sony are already shipping TX series with this drive as an option. Unfortunately it is not available on the open market yet, or if it is, only at a usurious price.

I'd also like to get the OEM (or otherwise) 11000mah larger battery. The combination of the two (batter + flash drive) would probably provide an ultra-portable that I could use for another 5 years before getting envious of the latest hardware.

Small rant over the fragility of the screen on the Vaio TX
Despite the vaunted carbon fiber case, which is really mostly just a carbon fiber lid, the screen is fragile. The lid is too flexible. If pressure is applied the screen will touch the keys (transfering finger grease). If too much pressure is applied the screen will be damaged or even cracked. Buying a new screen currently costs about $350 on ebay. Compared to my last two vaios (505 and tr/1) this one is the most fragile at least in the LCD department. The keyboard has also started to lose lettering, and the palm rest areas have subtly changed color. Mind you, I do spend hours on it each and every day.

Current status
I update this article every now and again when I find something new. As of the 28th of October I am still searching for the source of the increased idle power consumption (measuring it compared to XP), and working out the best way to kick NetworkManager back after suspend/resume (it sometimes needs that kick).

rss feed About dslreports.com

Random site news information and ponderings, by Justin
Forums » Ubuntu Gutsy on Sony TX series (TXN19P)
view: topics flat text 
Post a:

Jerry McBride

@comcast.net

Tuning for maximum battery life????

You dummy...

Instead of using the PERFORMANCE governor... you should have used ONDEMAND!

Your entire evaluation is suspect.

justin
Australian
join:1999-05-28
Brooklyn, NY

Host:
IPv6
Webmasters and Dev..
Business Connectiv..
Home/Office setup ..
Console/Handheld g..

edit:
October 27th, @11:17AM

Re: Tuning for maximum battery life????

said by Jerry McBride :

You dummy...

Instead of using the PERFORMANCE governor... you should have used ONDEMAND!

Your entire evaluation is suspect.
It doesn't make any difference (to consumption) plus I monitor the frequency and it runs at 800mhz all the time when idle with performance or ondemand.

If the processor is in C3 state all the time, it doesn't have any mhz at all. I can actually show the same power consumption with no governor at all when totally idle. Governors are barely useful when C3 sleep is implemented properly.

I love it how anons come visiting and throwing around terms like "dummy" when they don't know what they are talking about.

Rockwell

@cornell.edu

Re: Tuning for maximum battery life????

Thanks for the detailed report; it looks like you put a lot of effort into this, good job!

Still trying to decide whether I want to install gutsy on my txn...

I cant wait for those solid state drives to become reasonable in price
jimhkuo

join:2008-01-02


edit:
January 2nd, @12:20PM

powertop p-states after resume

Hi
Thanks for this guide, I managed to reduced the power consumption of my TX3 to 7.5W without the custom kernel .

One strange thing i noticed, was that powertop reported 800MHz cpu speed after waking up from sleep, despite that the scaling_governor still was set to "performance".

Restarting powertop didn't help, only changing cpu speed from performance to ondemand back to performance forced powertop to correctly report 1.2GHz.

Just wondering whether this is something you noticed as well.

Lumberjack
Premium
join:2003-01-18
Newport News, VA
·Cox HSI

Vaio Z1 w/NetBSD

A month or so ago I took my wife's (well, she stole it from me ok) laptop that we use downstairs and slapped NetBSD on it (I'll not go into my why NetBSD discussion here).

I didn't even research anything up front about the laptop with a non-Windows OS, I just used my existing experience and threw NetBSD on there. Installed fine and through the packages collection I also installed powerd, KDE (my fav manager) and a few other things.

Sadly, Sony implemented the brightness and volume controls through drivers and the Sony support via sony_laptop (or another, don't remember) doesn't work with my Z1. However, I was able to set things like disc suspend, speed-step, etc..

The only remaining hurdle I have is that while it can be forced to sleep it won't suspend or wake-up from sleep properly. So for now if you push the power button or close the lid I have my powerd scripts just shut it down. I used to have it hibernate when Windows was on it on lid close and power off on power button.

Overall I'm happy to have NetBSD/KDE on it even though, as you've found with Linux it does consume more power. I could poke at it more with a stick but we rarely used it while it's not plugged in anyway and the battery was showing its age long before NetBSD was installed. It lasts plenty long, though I'm sure I could squeeze a lot more time out of it if I could control the contrast.

Besides the power issues and Sony hardware interaction via FN keys, I've got all of it "working". I still need to fight with NetBSD's emulation, Java and Flash to have a better web experience. Though, the only one this hurts is my 2 year old wanting to watch her favorite digger construction videos.
--
»www.fairtax.org
Forums » Ubuntu Gutsy on Sony TX series (TXN19P)

Saturday, 26-Jul
18:06:09
Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
8th year online! © 1999-2008 dslreports.com.