Undervolting & “un-throttling” the Intel Atom Z3xxx Bay Trail CPU series (e.g. ThinkPad 8)

TL;DR: Support for Atom Z3000 series in ThrottleStop is amazing. At full load the temperatures of my ThinkPad 8 are 6-8°C lower, 1.5W less power draw, always-on Turbo Mode.

It recently came to my attention that ThrottleStop, a utility I had been using previously to undervolt my Fujitsu U2010 (Intel Atom Z530), is now finally available with support for the Intel Atom Z3xxx Bay Trail CPU series (used in Lenovo ThinkPad 8, ThinkPad 10, Dell Venue 8 Pro, Asus VivoTab etc.).
The Lenovo ThinkPad 8, while being a good performing mobile warrior device, is not known for being cool and conserving in terms of battery usage. The Intel Atom Z3795 CPU gets quite hot when under load. Lenovo’s thermal management includes heavy throttling/down-clocking of the CPU to stay within the bounds of TJmax of 105°C of this CPU. While the Lenovo Settings tool offer a hard to find/enable “Cool Mode”, it doesn’t do much to lower the temperature and battery consumption.

Naturally I was eager to test ThrottleStop on this device, knowing it was able to lower the voltage (Voltage ID/VID) of the Z530 CPU on my Fujitsu U2010, thus reducing the overall power draw + TDP of the CPU.

First off, here are the results running prime95 (64-bit, Torture mode, Small FFT, max. CPU heat/usage) with the stock clocking and CPU management. Running at a max. Turbo Mode VoltageID/VID of 0.63 V:

Without ThrottleStop, max. Turbo Mode VoltageID/VID of 0.63 V

Now with ThrottleStop enabled, max. Turbo Mode VID set to 0.575 V (0.055 V lower), which I found to be stable on my device:

With ThrottleStop enabled, max. Turbo Mode VID set to 0.575 V (0.055 V lower)

As you can see temperatures are 6-8°C lower with ThrottleStop enabled – and that is with Turbo Mode constantly on! There is no throttling happening like with the stock CPU management. Battery draw on load is roughly 1.5 Watts lower: 7.3W versus 8.8W
These 6-8°C difference + constant Turbo Mode are especially great for playing occasional games on the device as there is more thermal headroom for the IGP to use, i.e. a lot less lagging + stuttering inherent to Lenovo’s stock thermal management.

If you want to give it a spin, ThrottleStop can be downloaded here.
Make sure to create a backup of your device first, since playing with the VID is what system tweakers call a “suicide run”, i.e. it will lock up/crash your system if you lower it too much. You might just lose data. As always with these types of tweaks: your mileage may vary, here be dragons, warranty void.

Setting up the Inno Setup compiler on Debian

I’m currently setting up a nightly build system for Quasar on my Linux box which is running Debian. This system also cross-compiles Quasar for Windows.
The Windows version of Quasar is going to be available in two fashions: one self-contained, portable version and one version that can be installed.
I’m not a huge fan of installers. But when it comes to creating a setup program for a given Windows application I’m quite accustomed to Inno Setup having used it for years. Unfortunately there is no native Linux version of the Inno Setup compiler available for Linux. NSIS exists as package for Debian but I am not fond of using it, largely because I am a Delphi guy. :)
So, here is a small guide on how to get the Inno Setup compiler up and running on Debian:

First step is to install Wine either as super user or by using sudo:

sudo apt-get install wine

As normal user fire up your X server and your favourite terminal application and get the latest Inno Setup QuickStart pack:

mkdir /tmp/innosetup
cd /tmp/innosetup
wget http://files.jrsoftware.org/ispack/ispack-5.2.3.exe
wine ./ispack-5.2.3.exe

This will start the installer in Wine. Note, for the installation you will need a running X11 server since the installer obviously is graphical. If you have not set up Wine before, the default location C:\Program Files\Inno Setup 5 will install to ~/.wine/drive_c/Programme/Inno Setup 5.

Luckily the Inno Setup compiler offers a command line interface, ISCC.exe, which will run in Wine without the necessity of having a X server running. So it is ideally suited for automated runs.

Here is a simple wrapper shell script called iscc:

#!/bin/sh
unset DISPLAY
scriptname=$1
[ -f "$scriptname" ] && scriptname=$(winepath -w "$scriptname")
wine "C:\Program Files\Inno Setup 5\ISCC.exe" "$scriptname" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"

I installed this script in my local bin directory (~/bin) and added it to the PATH environment variable.
This will allow running the Inno Setup compiler from anywhere and it also makes it very easy to integrate into a build script. You can even feed a script via stdin, e.g. something like:

iscc - < ./myscript.iss

Lazy source code comment stunts

Double-Slash-Whole-Block-Commenting

Here is a simple way to disable or enable whole code blocks with just two slashes:

PHP / C++:

/*
  Block (commented block)
//*/
///*
  Block (active block)
//*/

Object Pascal/Delphi:

(*
  Block (commented block)
//*)
//(*
  Block (active block)
//*)

Alternatively you can use { and } in the Object Pascal/Delphi example.


Double-Slash-Whole-Block-Switching (Object Pascal/Delphi only)

The Object Pascal dialect used in Delphi supports three ways of commenting code, two for commenting whole blocks ( { } and (* *) ) and one for commenting lines ( // ).
We can exploit this feature to switch between two code blocks easily and fast:

Block 2 is in the enabled state:

{
  Block 1  (commented block)
(*}
  Block 2  (active block)
//*)

Note, I am just adding two slashes in front of the first comment block to activate it again – similar to Double-Slash-Whole-Block-Commenting trick above. This will also magically disable the second block due to the way the comment marks are arranged:

//{
  Block 1  (active block)
(*}
  Block 2  (commented block)
//*)

These tricks are probably applicable to other programming languages as well. Please let me know.

Q…/Free: Bug in QProcess writeToStdin

All right, this post is just to stop somebody else’s suffering in figuring out why writing to stdin in QProcess on Version 3.3.x-8 of Q…/Free doesn’t work on Windows. Well, actually it works but just for the first line you write to stdin. There is a bug in qprocess.cpp at line 730:

void QProcess::writeToStdin( const QString& buf )
{
    QByteArray tmp = buf.local8Bit();
    tmp.resize( tmp.size() - 1 ); // drop the implicit \0
    writeToStdin( tmp );
}

should be:

void QProcess::writeToStdin( const QString& buf )
{
    QByteArray tmp = buf.local8Bit();
    tmp.resize( buf.length() );
    writeToStdin( tmp );
}

Verision 3.3.7-7 includes the latter method, same as the latest Qt 4.3 sources. So, it’s actually a regression in 3.3.x-8. If you require the latest Qt 3 / Q…/Free for your open source application and need to write to some other processes’ stdin, you can just use a wrapper workaround that uses the latter method and directly uses writeToStdin( const QByteArray& buf ) instead of the QString variant.

rdesktop: Connect to Windows 7 and Vista with ClearType font smoothing enabled

So Windows Vista finally allows to enable ClearType font smoothing for Remote Desktop / Terminal Services sessions. Update: Windows XP SP3 does too!
If you try to connect to a machine running Windows XP SP 3 or later using rdesktop, you won’t get smoothed font typing since at the time of this writing rdesktop does not officially offer an option to control this feature. However, here is a workaround:
Continue reading “rdesktop: Connect to Windows 7 and Vista with ClearType font smoothing enabled”