Archive for the ‘Uncategorized’ Category

Linux (Fedora 20) on Dell Precision M6800

Monday, December 23rd, 2013

This post describes the issues and some solutions for using Linux on a Dell Precision M6800, the one described in the previous post. This probably largely applies to Precision M4800 too.

TL;DR: Don’t buy it for now if you’re not ready to tweak stuff. Otherwise you may consider. Personally I am quite happy and expect some things to improve in the future.

This exact model has an i7-4800MQ, 16GB of RAM, Nvidia Quadro K3100M and a 512GB SSD.

I have updated the bios to version A05, which was published just a few days ago. It seems likely that Dell will publish further updates too, as the hardware is relatively new.

I’m using Fedora 20. It boots up fine and installs fine, no surprises there. Altough it’s kind of a mess to try to figure out how to layout the two disk drives. I recommend using only the SSD and leaving the HDD for backups or alternate OSes or something. It also booted up with some recent version of Ubuntu, but it had an old kernel so I decided to try something else.

WLAN

This model comes with a Dell Wireless 1550 WiFi+Bluetooth card. It basically doesn’t work on Linux, as it uses the BCM4352 chip; neither with Broadcom’s proprietary driver (it works a bit and then doesn’t), nor any open source drivers (they don’t even try). I inserted a BCM4311 card that I already have in one of the extra slots (the WWAN slot; an ancient Intel card didn’t work in it) and it works with Linux 3.12′s built-in b43 driver… mostly. It has some problems too (dies under heavy load until reboot) but those probably aren’t related to the M6800.

(The proprietary driver claims to support BCM4311 too, but causes some kind of an error in the kernel’s built-in 80211 stuff requiring a reboot… go figure. If someone is interested, I can provide logs.)

The Nvidia Quadro K3100M

When I started writing this post, I didn’t have this working the way I wanted to. However, I decided to retry still once more and now got it working.

So, I now have an apparently working bumblebee + nvidia configuration on a Dell Precision M6800. It’s mostly set up like this; the non-nouveau way: https://fedoraproject.org/wiki/Bumblebee. I manually ran /usr/sbin/bumblebee-nvidia on the command line without Xorg being running. Maybe that affects something, maybe not. Also it needed some library paths to be set up. Maybe.

Also make sure to not have nouveau installed at all; many drivers include their own blacklists and whatever directives in random places and ultimately nothing will work if more than one is installed. I have also heard that nouveau won’t work on a K3100M at all, or at least not with bumblebee.

It looks like the GPU will throttle down heavily when running on battery; leading to a difference of running smoothly at 60fps vs. running clearly not smoothly at maybe 15fps. That’s in Kerbal Space Program that I’m testing this with.

If you fail to install working bbswitch, you get constant 30W idle power consumption, which will lead to fans spinning constantly and battery life being limited to 3 hours.

ACPI

I have put manually into use the kernel parameter acpi_backlight=vendor, which changes the exact namings and details in /sys/class/backlight, and added the following into /etc/X11/xorg.conf.d/10-device.conf:

Section "Device"
	Identifier "Haswell Integrated Graphics"
	Driver "intel"
	Option "Backlight" "intel_backlight"
EndSection

I also experimented with a bunch of custom acpid actions for backlight and volume, and ended up leaving the backlight in there but doing volume control using shortcuts keys in IceWM. Your mileage will vary, and all this is dependent on your desktop environment, display manager and whatever. Most of them try to do much of this by themselves, to various degree of success.

Sound (ALSA)

I added some quite agressive power saving set-up scripts, and it turned out you shouldn’t set up any power-saving for the snd_hda_intel module, as it will disconnect the signal from the headphone jack when being automatically shut down. If it’s connected to a badly grounded audio amplifier and speakers, mains electricity noise and popping noise will be heard. Talk about random issues. 8)

Touchpad

By default the touchpad doesn’t allow clicking or dragging by tapping (either due to itself or due to changes in Xorg). I’m not sure if I like that; I’ll have to experiment. It’s configurable with various tools and Xorg’s configuration though.

Stability?

…Aand there it goes. I was running Kerbal Space Program on an another workspace with optirun while writing this, and suddenly X went completely black (only mouse was visible and moveable) and I had to kill it in a virtual console. So there clearly is some unstability here – dunno if it would have worked better if I hadn’t been switching workspaces, or if SELinux wouldn’t have prevented Xorg from doing something, or… yeah. I’ll amend this when I get to know the stability of things better. I have played a lighter game (not Minetest!) using integrated graphics for many hours already though, and I’ve experienced zero crashes with that. So clearly something does work.

Power Consumption

If everything is correctly configured, the laptop will take about 17W at idle from the battery at a low-ish screen birghtness, and about 44W when running Minetest with integrated graphics, and about 58W when running Minetest using discrete graphics. The performance difference between those when the AC adapter is removed is very small though, and I can’t measure how much the K3100M takes when running on external power. Still, the fans don’t come out that loud with such load. You can compare those numbers to the 99Wh capacity of the battery.

I need to figure out if it’s possible to let the K3100M run faster from the battery. If I run something using optirun, it’s not like I want to save battery in the first place. I can just use the integrated GPU in that case, saving a lot of power.

The HDD

My M6800 came with a 750GB hard disk drive. It’s fairly useless as I can fit everything I need on the 512GB SSD, but the drive is quite loud and doesn’t spin down automatically. Put this into /etc/systemd/system/boot_setup_hdd.service and run systemctl start boot_setup_hdd && systemctl enable boot_setup_hdd:

[Unit]
Description=Setup HDD powersave (By c55)

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/hdparm -B 1 -S 5 -y /dev/sda

[Install]
WantedBy=multi-user.target

This will make the HDD spin down immediately when it is run, and if the HDD is accessed, 25 seconds after not being used anymore.

kernel

Linux localhost.localdomain 3.12.5-302.fc20.x86_64 #1 SMP Tue Dec 17 20:42:32 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

lspci (including my BCM4311 that didn’t come with the M6800):

lspci -nnk
00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller [8086:0c04] (rev 06)
	Subsystem: Dell Device [1028:05cd]
00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller [8086:0c01] (rev 06)
	Kernel driver in use: pcieport
00:02.0 VGA compatible controller [0300]: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller [8086:0416] (rev 06)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: i915
00:03.0 Audio device [0403]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [8086:0c0c] (rev 06)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: snd_hda_intel
00:14.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI [8086:8c31] (rev 04)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: xhci_hcd
00:16.0 Communication controller [0780]: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 [8086:8c3a] (rev 04)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: mei_me
00:19.0 Ethernet controller [0200]: Intel Corporation Ethernet Connection I217-LM [8086:153a] (rev 04)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: e1000e
00:1a.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 [8086:8c2d] (rev 04)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: ehci-pci
00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller [8086:8c20] (rev 04)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: snd_hda_intel
00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 [8086:8c10] (rev d4)
	Kernel driver in use: pcieport
00:1c.3 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 [8086:8c16] (rev d4)
	Kernel driver in use: pcieport
00:1c.4 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #5 [8086:8c18] (rev d4)
	Kernel driver in use: pcieport
00:1c.6 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #7 [8086:8c1c] (rev d4)
	Kernel driver in use: pcieport
00:1c.7 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #8 [8086:8c1e] (rev d4)
	Kernel driver in use: pcieport
00:1d.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 [8086:8c26] (rev 04)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: ehci-pci
00:1f.0 ISA bridge [0601]: Intel Corporation QM87 Express LPC Controller [8086:8c4f] (rev 04)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: lpc_ich
00:1f.2 SATA controller [0106]: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] [8086:8c03] (rev 04)
	Subsystem: Dell Device [1028:05cd]
	Kernel driver in use: ahci
00:1f.3 SMBus [0c05]: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller [8086:8c22] (rev 04)
	Subsystem: Dell Device [1028:05cd]
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK104GLM [Quadro K3100M] [10de:11b6] (rev ff)
07:00.0 Network controller [0280]: Broadcom Corporation BCM4311 802.11a/b/g [14e4:4312] (rev 01)
	Subsystem: Hewlett-Packard Company Broadcom 802.11a/b/g WLAN [103c:1361]
	Kernel driver in use: b43-pci-bridge
10:00.0 SD Host controller [0805]: O2 Micro, Inc. Device [1217:8520] (rev 01)
	Subsystem: Dell Device [1028:05cd]

lsusb:

Bus 002 Device 003: ID 0a5c:5800 Broadcom Corp. BCM5880 Secure Applications Processor
Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0c45:64d0 Microdia 
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lsmod:

Module                  Size  Used by
cpufreq_stats          13469  0 
fuse                   82701  3 
nf_conntrack_netbios_ns    12665  0 
nf_conntrack_broadcast    12527  1 nf_conntrack_netbios_ns
ipt_MASQUERADE         12880  1 
ip6t_REJECT            12939  2 
bnep                   19704  2 
xt_conntrack           12760  42 
bluetooth             366020  5 bnep
ebtable_nat            12807  0 
ebtable_broute         12731  0 
bridge                110618  1 ebtable_broute
stp                    12868  1 bridge
llc                    14045  2 stp,bridge
ebtable_filter         12827  0 
ebtables               30758  3 ebtable_broute,ebtable_nat,ebtable_filter
ip6table_nat           13015  1 
nf_conntrack_ipv6      18738  24 
nf_defrag_ipv6         34595  1 nf_conntrack_ipv6
nf_nat_ipv6            13213  1 ip6table_nat
ip6table_mangle        12700  1 
ip6table_security      12710  1 
ip6table_raw           12683  1 
ip6table_filter        12815  1 
ip6_tables             26808  5 ip6table_filter,ip6table_mangle,ip6table_security,ip6table_nat,ip6table_raw
iptable_nat            13011  1 
nf_conntrack_ipv4      14808  20 
nf_defrag_ipv4         12702  1 nf_conntrack_ipv4
nf_nat_ipv4            13199  1 iptable_nat
nf_nat                 20712  5 ipt_MASQUERADE,nf_nat_ipv4,nf_nat_ipv6,ip6table_nat,iptable_nat
nf_conntrack           91283  11 nf_conntrack_netbios_ns,ipt_MASQUERADE,nf_nat,nf_nat_ipv4,nf_nat_ipv6,xt_conntrack,ip6table_nat,nf_conntrack_broadcast,iptable_nat,nf_conntrack_ipv4,nf_conntrack_ipv6
iptable_mangle         12695  1 
iptable_security       12705  1 
iptable_raw            12678  1 
bbswitch               13943  0 
snd_hda_codec_realtek    56591  1 
snd_hda_codec_hdmi     41070  1 
vfat                   17411  1 
fat                    60886  1 vfat
arc4                   12608  2 
b43                   387900  0 
bcma                   45511  1 b43
mac80211              579060  1 b43
cfg80211              478020  2 b43,mac80211
iTCO_wdt               13480  0 
ppdev                  17635  0 
iTCO_vendor_support    13419  1 iTCO_wdt
x86_pkg_temp_thermal    14162  0 
coretemp               13435  0 
dell_wmi               12681  0 
sparse_keymap          13584  1 dell_wmi
kvm_intel             142832  0 
kvm                   430555  1 kvm_intel
crct10dif_pclmul       14289  0 
crc32_pclmul           13113  0 
crc32c_intel           22079  0 
dell_laptop            18168  0 
ghash_clmulni_intel    13259  0 
rfkill                 21979  5 cfg80211,bluetooth,dell_laptop
uvcvideo               80968  0 
snd_hda_intel          48171  7 
dcdbas                 14885  1 dell_laptop
videobuf2_vmalloc      13163  1 uvcvideo
snd_hda_codec         179279  3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel
videobuf2_memops       13161  1 videobuf2_vmalloc
videobuf2_core         38899  1 uvcvideo
snd_hwdep              13554  1 snd_hda_codec
videodev              132922  2 uvcvideo,videobuf2_core
snd_seq                60752  0 
joydev                 17332  0 
microcode              44087  0 
i2c_i801               18135  0 
snd_seq_device         14136  1 snd_seq
nouveau               952573  0 
media                  20840  2 uvcvideo,videodev
serio_raw              13413  0 
snd_pcm                98141  3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel
sdhci_pci              18927  0 
e1000e                254311  0 
sdhci                  38255  1 sdhci_pci
snd_page_alloc         18268  2 snd_pcm,snd_hda_intel
mxm_wmi                12865  1 nouveau
ssb                    65906  1 b43
ttm                    79787  1 nouveau
snd_timer              28698  2 snd_pcm,snd_seq
mmc_core              116378  3 b43,ssb,sdhci
mei_me                 18421  0 
ptp                    18725  1 e1000e
snd                    75313  23 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_hda_codec,snd_hda_intel,snd_seq_device
lpc_ich                21080  0 
mei                    76906  1 mei_me
shpchp                 37032  0 
soundcore              14491  1 snd
pps_core               19130  1 ptp
mfd_core               13182  1 lpc_ich
parport_pc             28048  0 
parport                40425  2 ppdev,parport_pc
i915                  701832  12 
i2c_algo_bit           13257  2 i915,nouveau
drm_kms_helper         50287  2 i915,nouveau
drm                   283349  5 ttm,i915,drm_kms_helper,nouveau
i2c_core               38302  7 drm,i915,i2c_i801,drm_kms_helper,i2c_algo_bit,nouveau,videodev
wmi                    18804  3 dell_wmi,mxm_wmi,nouveau
video                  19104  2 i915,nouveau

Data Locality for Game Programmers

Monday, December 9th, 2013

I stumbled upon this funny and accurate write-up about CPU cache and data locality: http://gameprogrammingpatterns.com/data-locality.html

I’m sure reading it will make every programmer better in some way. Even if you’re not a programmer, the first part is interesting.

This what I think of Youtube’s new google+ integration.

Friday, November 8th, 2013

Random stuff

Monday, December 3rd, 2012

WTF is musicd?

Saturday, November 24th, 2012

You may have stumbled upon this scenario: You have a server with large, reliable storage, and a bunch of computers that you use, with limited disk space. So you decide to store your music files on the server, because they fit nicely in there.

You may be familiar with MPD. It is a thing that lets you do this:

MPD Usage

MPD Usage

…but how often do you actually want this? It’s useful only if your server is also your HTPC-kind of thing. My friend stumbled upon this issue, and came up with Musicd. It does this:

Musicd usage

Musicd usage

That is, it streams music from your server to your computer, letting the server transparently do the storage thing, and your computer do the playback thing.

It’s a bit like hosting your own Spotify, Magnatune or so.

The current stable version (0.2.0) of Musicd allows you to connect to it using the qmdc client, which plays stuff, shows a playlist and handles the UI part of searching.

(There are no Windows clients, and musicd only works on *NIX systems.)

Experimental Awesomeness: HTTP Support

There has been some interesting development going on recently. More namely, a HTTP-based protocol. The github version does not have full HTTP support yet, but a fairly well working version is available at http://tsundere.fi/b/musicdhttpdev.tar.

You may need to start it up with the –enable-http option. Input goes as GET parameters, output comes as JSON and audio streams.

You can test it by using eg. curl and mplayer:

curl "http://localhost:6800/tracks?search=Rick%20Astley"
curl "http://localhost:6800/tracks?album=derp&artist=herp"
curl "http://localhost:6800/artists"
curl "http://localhost:6800/albums"
curl "http://localhost:6800/albumimg?album=4"
mplayer "http://localhost:6800/open?id=39"

There is a browser client in the works, but it hasn’t been released yet.

Clementine Support
I picked up the awesome Clementine-player source code and added Musicd-HTTP support to it.

You can find my work here: https://github.com/celeron55/clementine/commits/master

After building it, launch it up and select the “Internet” side tab, right click “Musicd”, and then “Configure Musicd”. After setting the server address, use “Refresh library” from the same context menu, and you’re good to go.

Also, in case somebody wants to discuss stuff, we created the IRC channel #musicd @ Freenode.net. (beware of the occasional Finnish speaking in there)