quick thoughts

nerdish look on Open Source

Linux on Lenovo ThinkPad T460 and Ultra Dock

I recently bought a Lenovo T460(20FNCTO1WW)  for work.  I’m not 100% sure if Linux laptop reviews still make sense today given that Linux supports most commodity components but for the sake of the old times here is my experience 🙂

Dock

Let’s start with the Lenovo Ultra Dock.  I have Ethernet cable, DisplayPort monitor and 4 USB devices plugged in.  The dock has a very nice selection of screen connectors, I feel like there could be more USB ports. There is also a head phone socket.  All connectors are in the back.

The Dock does not seem to contain much additional hardware it’s mostly just routing signals to existing devices.

Experience of connecting a ThinkPad into the dock could definitely be better. It’s not clear when plugging the machine in which the correct position is which leads to moving the laptop around until the connector finds the sockets.  Most of the time it’s also necessary to lift the dock for the mechanical clips to snap on – the angle of the docking pad is not wide enough and the front of the laptop is already touching the desk before it’s fully touching the dock.

Sometimes after unplugging and docking back in the external monitor will not come on.  Playing around with screen settings (disabling and enabling the DisplayPort) tends to help but not always.  Note, however, that I’m using Fluxbox so your experience on mainstream WM may be better.

Hardware (outside)

Keyboard is OK. I don’t like the fact that bottom left key is Fn instead of Ctrl by default. I’m definitely not a big fan of the touchpad, the mat surface makes it hard to slide fingers. I find it nearly impossible to make precise mouse movements (e.g. to grab a border of a window) without changing acceleration.

Having three USB ports seems pretty good these days, especially with the dock and Bluetooth I never felt the need for more. I also appreciate the Ethernet port on the machine itself, I found it useful a few times already to be able to just plug in when the office WiFi was busy.

The camera is a bit of a letdown, there is a lot of visible noise and color flicker even in well lit conditions.

I don’t use the built-in screen a lot so I won’t comment on it.

Hardware (inside)

The Intel Core i7-6600U and its HD520 iGPU are pretty satisfactory. The fan comes on quite a bit but it’s not very loud. In fact I’m working in a bit of a noisy environment and I didn’t even notice it before paying special attention for this review. The graphics driver crashed once (not fatally, i.e. I could still safely reboot) after dock reconnect.

WiFi and Bluetooth are provided by Intel Wireless 8260 device, 2×2 streams, dual band, no problems with it so far. Gigabit Ethernet is an integrated Intel I219-LM.

I have 12GB of RAM which may prove to be slightly limiting but is OK so far. According to system info it’s a 4GB Ramaxel module and a 8GB Samsung one.

256GB SSD is a SAMSUNG MZ7LN256.  Not the latest hardware but should be decent enough.

I haven’t tested battery life.

Software

The laptop comes with Windows 10 preinstalled (I may be wrong about the version).  Fedora 25 installation runs smoothly, no problems with UEFI. Boots nice and fast. I didn’t have to perform any special configuration or hacks to get any of the hardware going.

Conclusions

ThinkPad T460 paired with the Ultra Dock seems like a solid Linux laptop for non-compute heavy work. When you take into account that the laptop itself with decent internals costs around $1200 it does come slightly under the expectations, however.  My previous (Acer) laptop was definitely much inferior but certainly better value for money at a third of the price of the ThinkPad. Comparing the docking experience to an HP EliteBook I used a few years back I’m also a little bit disappointed. Lenovo dock feels cheaper and not particularly well designed.

I bought the ThinkPad to be able to easily switch between office and home environment.  If I was to only work at a single desk I would certainly be happier with a custom desktop PC and a cheap laptop for travel/meetings.

Let me know what your opinions about the recent ThinkPads are and what setups do you use to strike a balance between speed and mobility!

Advertisements

No rule to make target ‘include/config/hz.h’, needed by ‘kernel/time/hz.bc’. Stop.

I’ve been doing some work on Raspberry Pi recently and I came across following build error:

make[3]: *** No rule to make target 'include/config/hz.h', needed by 'kernel/time/hz.bc'. Stop.

It appeared when I switched from building in-source to building with an O=some_dir option which writes object files somewhere else than the code to keep the source tree clean (and make GIT work faster).

The problem was discussed on LKML but solution was not provided. It is actually caused by improper cross-compilation. When KBuild detected that the tree is not clean I automatically typed make mrproper missing all the cross compilation variables. As a result the arch/x86 directory was cleaned instead of arch/arm. To fix this error do mrproper with all the variables set, for me it was:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
and then delete and recreate the build dir (the O=dir).

Ethernet numbers cheat sheet

Every now and then I find myself calculating basic things like maximum frame rate or UDP throughput for one version of Ethernet or the other. It usually involve googling one or two values (every version of Ethernet seems to have different IFG length, hallelujah!). I intend to write down here every Ethernet number I calculate from now on, so I don’t have to keep the posted notes with them around my desk.

min - value for minimal size frame
max - value for maximal size frame
jum - value for 4k-payload jumbo frame

Packets per second: rate/(IFG + Preamble + L2 header + payload + FCS)

PPS min max jum
10M 14,881 813 302
100M 148,810 8,127 3,024
1G 1,562,500 81,486 30,266
10G 16,233,766 816,460 302,883
100G 171,232,877 8,185,986 3,031,773

UDP throughput: (paload – L3/L4 headers) * PPS

UDP tp [bps] min max jum
10M 2,142,857 9,570,871 9,840,348
100M 21,428,571 95,708,713 98,403,483
1G 225,000,000 959,582,790 984,987,893
10G 2,337,662,338 9,614,630,960 9,857,039,011
100G 24,657,534,247 96,398,166,339 98,666,019,888

Frame transmission time: (L2 header + payload + FCS)/rate

frame time min max jum
10M 51.2us 1.214ms 3.291ms
100M 5.12us 121.4us 329.1us
1G 512ns 12.144us 32.91us
10G 51.2ns 1.214us 3.291us
40G 12.8ns 304ns 822ns
100G 5.12ns 121.4ns 329.1ns

Two things that came to my mind while writing this:

  • If Cisco Nexus 9000 supports 36x 40GbE ports per board that board could be forwarding 2.5Gpps with minimal packets! That’s a packet per cycle if you use Intel CPUs!
  • Enabling jumbo frames with anything < 1GbE kills real time. If you want 9k frames you should probably go 10 GbE…

 

For calculations I used:
speed – nominal (10 Mbps for 10M Ethernet; 100 Mbps for Fast Ethernet etc)
preamble – 8B (note: preamble is optional/reusable in some variants of 100/10/1GbE)
L2 header + FCS – 6+6+2+4 = 18B
payload min – 46B
payload max – 1500B
IP + UDP header – 28B
IFG:

10M 12 100M 12
1G 8 10G 5 100G 1

Acer E1 and V3 ACPI

As I have written in the previous post, to get brightness control working on Acer E1-571 I had to add acpi_osi=Linux to kernel boot parameters. It makes kernel introduce itself to the BIOS as a Linux-based OS. It may come as a surprise to you but by default Linux tries to imitate Windows in every aspect of OS – firmware interaction, which includes calling itself Windows xxxx when asked about OS name. I guess there are ACPI implementations that won’t work or will disable some of the features when they see something other than Windows running. Because the disguising technique is unlikely to go away in foreseeable future we will have to continue including acpi_osi=Linux every time we want to install Linux. Because I don’t like that I set off in an attempt to make Linux work without adding the magic parameter i.e. out-of-box on any Acer E1/V3 laptop.

ACPI

Before diving into my specific problem let me first explain what ACPI is about. It’s about standardizing hardware description and access. There is a universal problem of discoverability and auto-configuration of hardware in computer systems. More advanced buses like USB or PCI (Express) make it possible for the operating system to ask the controller: What devices are connected to the bus, what are vendors and product ids of those devices and what type of devices are they (storage, network etc.) Unfortunately many simple devices either connect to simple buses or are not connected to any bus at all. ACPI defines the language in which firmware can describe the hardware that is available on the system. This description is then handed by the BIOS to the operating system.

If you look into ACPI specification you will see a multitude of method names starting with an underscore like _BST. All those method names are standardized by ACPI and the specification states what they do and how to invoke them. Now, when your vendor wants to give you control over the fan speed, he creates a device of fan class (always named PNP0C0B) inside the ACPI description of hardware and provides a few standard methods to it. One thing which confused me at the beginning is that methods are executed by the OS. There is a special ACPI language called ASL, which is interpreted by the OS. When your system loads up it will see the PNP0C0B device, recognize it as a fan and call (i.e. execute interpreter for) appropriate method to get current speed etc. The problem is that not all device interfaces are standardized. Most notably hotkeys and backlight control are not (I heard that they are in new versions of ACPI, but vendors still rely on old ones – this was supposed to change with Windows 8…)

If your device’s interface is not standardized you won’t be able to find out how to operate it in the ACPI standard and because every vendor likes to do things differently, you’ll need a separate driver for all the vendors. That’s why we have vendor specific ACPI modules like “ACPI for Lenovo” or “ACPI for Asus”. The “real”/standardized ACPI is handled by core OS and we rarely have to worry about it. What is handled by vendor-specific ACPI modules and causes a lot of headaches to Linux users is only the additional non-standardized functionality.

Problem environment

Before I begun I read these two (one, two) articles by Matthew Garrett and Corentin Chary and investigated how does ACPI – OS interaction look a little bit. I also watched this very helpful talk by Matthew.

Picture below shows all the elements that are important to us.

ACPI elements

As mentioned above ACPI provides OS with descriptions of what hardware is available and what to do to get specific things done by this hardware. Methods usually involve things like hardware register access or communication with an embedded controller (motherboard microcontroller). For instance to set fan speed ACPI method may write speed in RPM multiplied by 4 to physical address 0xFF00005C… (BTW you obviously can write to the registers directly once you know their locations, without invoking ACPI interpreter, just as you would do in a standalone driver, but register location can change from a one laptop model to another so it’s better to use ACPI as a layer of indirection.) From this description it should be clear that writing ACPI drivers for not-standardized functions is pretty straightforward. You see register names, you see what ACPI interpreter will do with the values passed to the methods, so you can figure out what a method is for. Then it’s just a matter of finding right method to call!

There are two problems though – one is called Microsoft and the other Intel. Microsoft has a closed “standard” for describing driver interfaces called WMI. WMI information can be embedded inside ACPI table and there is little or no information in the public on how to interpret it. If your device’s interface is described in WMI Windows will understand how to operate it, but you won’t. Intel contributed to the problem by introducing (back in the 80s, I think) a special System Management Mode to their processors. In this mode CPU stops executing user-visible code and jumps to a hidden firmware which can do whatever it wants to. Problem here is – again – visibility, if ACPI method triggers jump to SMM firmware, you won’t be able to see what the code does.

The problem

Unfortunately firmware in new Acer laptops uses both WMI and SMM making it practically impossible to figure out how to operate the laptop without hardcore methods like trying all possible combinations or executing Windows in virtual environment and observing it’s interactions with the hardware. I’m not saying that I’ll not do one of those in the future but for now I give up… the only thing that doesn’t work with acpi_osi=Linux are the Euro and Dollar keys near arrows and being a simple Linux guy I don’t use those two a lot 😉

From what I gathered about brightness: _BCM and _BCQ methods which are supposed to modify and query brightness value do nothing but write passed value to a Embedded Controller register. We can only suspect that EC is then supposed to do its magic and eventually write that value to a graphics card register, but this never happens. When OS is set to Linux, instead of relying on EC, ACPI method AINT is called and it sets brightness in graphics register directly… maybe we should enable EC or set its operation mode first? Yes, and probably do that with a WMI method, but all they do is call SMM! Some older Acer laptops had WMI methods coded in ACPI (without SMM involvement), I hoped that methods and parameters will be the same, but unfortunately the are not.

More links:
Links to Ubuntu wiki pages by Colin King
Some documentation on debugging backlight problems
Account of Matthew’s talk on x86 platform drivers, I couldn’t find the talk itself

Acer Aspire E1-571 (Linux) review

To a universal disapproval of my friends I bought an Acer laptop. A Aspire E1-571 in the (almost) cheapest form possible to be precise – it has no OS, no Bluetooth, no USB 3.0. It’ a good match for my requirements and … a prefect match my pocket as it costed $450 (350€). I suspect it may to fall apart in 16 to 24 months… Let me attempt to write a simple second-day review.

Hardware

First of all, Acer Aspire E1-571 seems to be a refreshed version of an old design – there are notebooks still available with 2nd generation of Intel Core processors. Because of this there is a bit of confusion around the net about components to be found inside the machine. Some places mention that Broadcom’s WiFi chip is used. Luckily information provided on Acer’s site holds true and the WiFi in my laptop was made by Atheros (AR9485). It’s a simple single-stream device (for non-WiFi nerds single stream means max throughput is 150Mbps) without Bluetooth working in 2.4GHz band only. Atheros advertises this chip as being super energy efficient but I guess it’s mostly cost-efficient if Acer is using it.

On board I have Intel Core i3-3120 @2.5GHz with 6GB of 1600Mhz RAM which I think is quite descent. I haven’t experienced any hiccups or stalls neither under AwsomeWM nor with KDE. It’s obviously not a performance daemon – kernel compilation for instance takes painfully long time, but I suspect HDD to be the main culprit there. Apart form CPU itself I’m absolutely loving HD4000 graphics, it just works – boot screen, suspend/resume, OpenGL, external ports – you name it.

Third nice piece of hardware is definitely the LCD. It’s very bright and the colours are vivid – much more vivid than on my SyncMaster 2443…

There have been no major problems with touchpad, although I wasn’t able to configure middle-click by corner tap, yet. Keyboard feels cheap.

What stands out negatively is most definately the HDD. I didn’t have time to measure the performance, but it’s perceptibly slow.

Software

I started with an attempt to install Fedora 18 x86_64 Alpha because I already had it on DVD. Before running the installer I entered the setup (AKA BIOS) in order to disable UEFI secure boot. It turned out that UEFI was disabled altogether – probably Linpus Linux, which was pre-installed, doesn’t handle it very well. Enabling UEFI is a matter of three key presses but to disable secure boot I had to set a supervisor password first. Luckily disabling the password doesn’t re-enable secure boot so the password is only a temporary requirement.

Unfortunately Anaconda (the Fedora installer) on F18 Alpha defeated me again and I had to retreat to downloading a final release. After installation everything seemed to be working just fine, I only had to configure synaptics (touchpad) to my taste.

Problems

The only real problem a I have with Aspire E1-571 are the hotkeys. From what I read there are two major ways to report hotkey events to the OS on this laptop – WMI and ACPI. Some of the keys are reported through both, some only through WMI. On E1-571 three of the hotkeys associated with display control do not work – toggle display and brightness control.

Toggle display does nothing but spawns a following message to kernel log:

acer_wmi: Unknown function number - 2 - 97

in the case of brightness control button presses are reported correctly through ACPI (I guess), nonetheless brightness does not change and following message is written to dmesg:

acer_wmi: Unknown function number - 4 - 0

Update: adding acpi_osi=Linux to kernel parameters seems to fix the brightness hotkeys problem!

Firefox for privacy paranoid

Do I take my privacy too seriously? No.

Do I want Web giants to know everything I do on the Web? No!

I don’t use Google Account, I don’t log into Facebook in my everyday-use web browser. I felt that Adblock+ and Flashblock gave me enough protection from ads, and there is nothing else to be afraid of if one uses Linux, right?

I’ve recently installed DoNotTrack plugin, just to check it out. Amount of pages which report every move that you make back to the mother ship (Google) is just amazing. Analitics, Ads and Google+ will follow you wherever you go. So I took another precaution and… disabled cookies in Firefox. It turns out you can use a whitelist for sites that you trust, so after a month or so of filling it in I don’t feel any discomfort.

Fluxbox quickly add/kill workspaces

I like the idea of automatic workspace creation and recycling. AwesomeWM does have it, KDE has activities which I suppose are even more powerful. But I use fluxbox which doesn’t support this feature out of box. Or does it? All you need to do is write a few lines of code in your favourite scripting language. Here is my version in BASH using wmctrl and fluxbox-remote commands:

fbaddws:

#!/bin/bash

# Add WS
fluxbox-remote addworkspace

# Switch to it
wmctrl -s $(wmctrl -d | tail -1 | cut -d' ' -f1)

# Rename
fluxbox-remote setworkspacenamedialog

When adding a workspace I need to find out its number, beware of numbering in wmctrl, it’s zero based.

fbkillws:

#!/bin/bash

# Find out current WS no.
ws_no=$(wmctrl -d | awk '{ if ($2 == "*") printf $1; }')

# Kill all windows on current WS.
for win_id in $(wmctrl -l | grep "^[0-9a-fx]*  $ws_no" | cut -d' ' -f1)
do
    wmctrl -i -c $win_id
done

max_ws=$(wmctrl -d | tail -1 | cut -f1 -d' ')
for ws in `seq $ws_no $((max_ws-1))`
do
    # Rename later WSes
    wmctrl -s $ws
    next_ws_name=$(wmctrl -d | grep "^$((ws+1))" | sed -e 's/.*  \(.*\)/\1/')
    fluxbox-remote "setworkspacename $next_ws_name"

    # Move windows
    for win in $(wmctrl -l | grep "^[0-9a-fx]*  $((ws+1))" | cut -d' ' -f1)
    do
        wmctrl -i -R $win
    done
done

wmctrl -s $max_ws
fluxbox-remote removelastworkspace

Removing is a little bit complicated since fluxbox can only remove last workspace and will not close windows on it (which I want) just move them to other workspace instead. I also have to take care of workspace names manually.

Remember that you have to set session.screen0.allowRemoteActions to true to use fluxbox-remote!