Fix Your MTRR on Gentoo with Thinkpad x61 Intel x3100

Updated August 06, 2008 @ 10:23 PDT

I’ve noticed for ages that my thinkpad x61 with 4 gigs of ram has been sluggish on the desktop with redraws. Now that I have a bit more time, I looked into this, oh, and because I’ve been shamed into getting all the funky compiz-fusion graphics looking hot on my desktop by Freddie B and Mr. Adams.

After some gentoo forum spelunking into the issue across distros, I found out that at least with Intel 965 (x3100) and kernel 2.6.25-26, there are some major issues with mtrr not being set properly.

I took the plunge at trying to understand the issue and wrote a basic script to fix-up my mtrr settings from the commandline:

#!/bin/bash
#
# fixmtrr
#
# fixes /proc/mtrr
# based upon termites script from gentoo forums

# disable pre-existing ones and order does matter!
echo "disable=0" >| /proc/mtrr
echo "disable=1" >| /proc/mtrr
echo "disable=3" >| /proc/mtrr
echo "disable=4" >| /proc/mtrr
echo "disable=5" >| /proc/mtrr
echo "disable=2" >| /proc/mtrr

# Now create the right ones...

# These are powers of two, they get progressively smaller
# so we can get right up to the system device page below.
echo "base=0x00000000 size=0x80000000 type=write-back" >| /proc/mtrr
echo "base=0x80000000 size=0x40000000 type=write-back" >| /proc/mtrr
echo "base=0xC0000000 size=0x10000000 type=write-back" >| /proc/mtrr

# Video Card:
# 0x10000000 was the value for size trying for
echo "base=0xE0000000 size=0x10000000 type=write-combining" >| /proc/mtrr

# High memory area
echo "base=0x100000000 size=0x40000000 type=write-back" >| /proc/mtrr

This helped to set my mtrr up right so that X can find the dynamic shared memory to do all the fun compiz effects and more. If there is a better fix for the above, I’d love to hear about it! More than just bling bling, my overall computer is much much better. I can’t believe I put up with this!

Then, I started running powertop to test out my system, and noticed that there are many features that can be set after a computer is setup, so I created an init script to set all this at boot:

!/sbin/runscript
#
# This starts the thinkpad post-boot settings
#

TITLE="Thinkpad Specific Options"
LINKPOWER=/sys/class/scsi_host/host0/link_power_management_policy
FIXMTRR=/usr/local/bin/fixmtrr
WRITEBACK=/proc/sys/vm/dirty_writeback_centisecs

checkconfig() {
    if [ ! -e $LINKPOWER ] &&
       [ ! -e $FIXMTRR ] &&
       [ ! -e $WRITEBACK ] ; then
        eerror "You cannot set $TITLE. Check settings."
        return 1
    fi
}

start()
{
    checkconfig || return 1

    ebegin "Starting $TITLE"
    $FIXMTRR
    echo min_power > $LINKPOWER
    echo 1500 > $WRITEBACK
}

stop()
{
    checkconfig || return 1

    ebegin "Stopping $TITLE"
    echo 500 > $WRITEBACK
}

Make sure to put the fixmtrr script in /usr/local/bin or change the path to fixmtrr in your script. Then, set thinkpad script to run at boot before xdm kicks in:

rc-update add thinkpad boot

These are pretty basic scripts, but I wanted to dump them out for other users of this system. Its beyond just Gentoo-based distros, and will take a while to get into main kernel especially for slow distros like Ubuntu, Fedora, etc ;)

I had to put that one in there for those who try to convert or chide me off Gentoo.

Brilliant Submissions to Open Clip Art Library

Updated November 12, 2007 @ 17:13 PST

I live in San Francisco and I try to keep up on the various metrics, searches, and so forth in my various involvements. I came across these beautiful vector graphics generated for San Francisco Arts Commission’s Art on Market Street Program by Steve Lambert.

In looking closer at these images, I noticed that Steve released them all into the public domain and uploaded ALL the assets to the Open Clip Art Library for ANYONE to use. Hats off to Steve and this is an open invitation for anyone to use these great images in your work!

Steve Lambert image
This image is under a CC BY-NC-SA 2.0 license by Steve Lambert.

Read more from Steve’s site:

Packard Jennings and Steve Lambert asked architects, city planners, and transportation engineers, “what would you do if you didn’t have to worry about budgets, beauracracy, politics, or physics?” Ideas from these conversations were then merged, developed, and perhaps mildly exaggerated by Steve and Packard to create a series of 6 posters for the San Francisco Arts Commission’s Art on Market Street Program.

6 foot tall by 4 foot wide giclee prints (Don’t let the postcard name fool ya, these are big)
6 designs, each in edition of 4 (24 total)

Steve and Packard would like to thank:
Peter Albert SF Municipal Transportation Agency
Prof. Nezar AlSayaad, Dept. of Architecture, UC Berkeley
Prof. Timothy P. Duane, Dept. of Architecture, UC Berkeley
Drew Howard, SF Muni Light Rail
John Peterson,, Public Architecture
Tom Radulovich, Livable City, BART
Seleta Reynolds, Fehr & Peeers

It looks like some great people worked on this project and it was also developed through the other great Creative Commons supporter, Eyebeam’s OpenLab.

UPDATE: Also, I should have noted that half of this work was done by Packard Jennings. A big thanks to him as a well and hopefully he will also release his parts to the Open Clip Art Library and into the public domain. CHeers!