Power saving

From MythTV Official Wiki
Revision as of 09:21, 18 April 2012 by Pootle (Talk | contribs)

Jump to: navigation, search

Because MythTV frontends & backends are often running 24 hours a day, they can use a significant amount of power. This can be expensive on your power bill. By choosing hardware carefully and configuring it correctly, you can significantly reduce the power usage of your mythbox.

Hardware Selection

If designing a new MythBox, choose efficient hardware - low power CPUs, efficient hard drives, and efficient power supplies.

CPU

Low power CPUs such as the AMD 5050e 45W series should have more than enough power even for an HDTV frontend. (add other efficient CPUS here)

See also the frequency scaling selection below to run the cpu at a lower frequency when it's idle; this can save significant power.

Hard Drives

Western Digital Green Power drives and Seagate LP drives use much less power than their predecessors, especially when idle (~2W vs ~8W when idle), and should keep up fine with even demanding HDTV setups.

Consider an SSD for the root drive, so that the media drives can spin down easily when not in use. SSDs use as little as 1/2 Watt when idle. A CF card and adapter, or network boot would be cheaper alternatives.

Display adapters

Use onboard video, or a low end discrete adapter. MythTV only needs Xv support and only uses a small amount of performance even for OpenGL render modes. Cards supporting hardware video decoding do this using dedicated hardware and is unrelated to shader performance. For VDPAU, deinterlace filters are run on the shader hardware, however a midrange card will have sufficient performance to use all available filters.

Any card which needs a separate power plug is overkill for Myth's needs, and lower end cards can be purchased fanless, helping create a lower noise machine.

Power Supply

Choose an 80Plus power supply which are much more efficient, and often no more expensive.

Tuner Cards

Not a lot of information is available on tuner card power draw; if you measure yours, please add it to this list:

* Hauppauge HVR-1250: 6W in idle mode
* Hauppauge WinTV Nova-T 500: 20W idling

Automatic powerdown/wakeup

See http://www.mythtv.org/wiki/ACPI_Wakeup or http://mythtv.org/docs/mythtv-HOWTO-11.html#ss11.4

CPU Frequency Throttling

Powernowd can lower the clock frequency when the CPU is idle.

Powernowd is more or less deprecated, more recent distributions have other cpu throttling mechanisms.

On Fedora, for example, the cpufrequtils package contains similar tools. The kernel has an "ondemand" cpu governor which makes it all easy and automatic.

On my combined frontend/backend, starting the cpuspeed initscript with the ondemand regulator drops power consumption from 97W to 69W, saving 28W!

Display Power Management

DPMS will turn off your display when the PC has been idle for a while

Hard Drive Spin Down

Spinning down you harddrives not only will save power but save the life of your drives.

hdparm can be used to spin down internet IDE and SATA drives. First you must disable access times to the drives to keep them from waking up.

Edit your fstab adding noatime and nodiratime.

 vi /etc/fstab
 LABEL=d3       /tv/d3      xfs     rw,noatime,nodiratime   0 0

Now, add hdparm statements to rc.local to set the default spindown time, i have used 20mins as a timeout:

 vi /etc/rc.local
 
  /sbin/hdparm -S240 /dev/sda

Warning.png Warning: The Western Digital Green Series provides a feature called IntelliPark, causing the heads to be parked automatically after 8 seconds of inactivity. If the drive is used for bulk storage, the noatime and nodiratime settings above should be sufficient to prevent unnecessary access. If the drive holds the log files or MySQL backing, it will be frequently spun up and down, which causes unnecessary wear and can lead to premature failure. This problem can not be addressed with hdparm -S command due to the proprietary nature of this feature. The Western Digital has provided the utility to modify behavior at support page. For more information on the actual problem, see Western Digital Green Series and IntelliPark.

Animated Themes

Animated themes can actually add a few watts to your frontend usage! Consider using a non-animated theme, or modify your theme to remove animations.

Preview Window

The Preview window in the recorded show listing causes the CPU to do real work to display it - on my box an extra 15W was used, almost 25% above true idle. Worse, frontends are often left on this menu screen, so it's almost always playing.

Ideally MythTV could time out a preview after a set time, but in the meantime you can simply disable the live thumbnail preview to save power.

Sound Card Powersave

If you're using a sound card with the snd_hda_intel module, you can use the power_save option to tell the card to go into power saving mode after a period of inactivity.

For instance:

 options snd_hda_intel power_save=7200

in modprobe.conf or similar will tell the sound card to sleep after 7200 seconds (2 hours) of inactivity. Some cards work better than others with this; sometimes clicks and pops result, so it may take some experimentation.

Tuner Card Powersave

Many drivers in recent kernels support power save or sleep modes for various components of tuner cards. For this to work, the driver needs to know that the card is idle, so tell your backend to open video cards on demand in the card setup portion of mythtv-setup.

Network card speed reduction

Especially if you have an all-in-one frontend/backend mythbox, you may not need that gig-E connectivity, at least not all the time. You can tune the speed of the link:

 # ethtool -s eth0 advertise 0x002  (10 mbit)
 # ethtool -s eth0 advertise 0x008  (100 mbit)
 # ethtool -s eth0 advertise 0x020  (1000 mbit)
 # ethtool -s eth0 advertise 0x03F  (auto)

Note however that this doesn't work on all cards. Reducing my card from gig-e to 100 mbit saved a watt. On many switches this will save power on the switch end as well.

SATA Aggressive Link Power Management (ALPM)

From lesswatts.org:

 ALPM is a power-saving technique that focuses on the SATA link.
 When enabled, it allows the host controller and the disk to negotiate
 when to lower the power of the SATA link.  When it is enabled, it can
 provide power savings of anywhere from .5-1.5 Watts per disk, depending
 on the system.

You could add something like this to your local initscripts (rc.local) to set ALPM to save power at boot time:

 for HOST in `seq 0 3`; do
     echo min_power >  /sys/class/scsi_host/host$HOST/link_power_management_policy
 done

Note that not all hardware supports this feature.

PCI Express (PCIe) Active State Power Management (ASPM)

From the original LKML posting:

 PCI Express ASPM defines a protocol for PCI Express components in the D0
 state to reduce Link power by placing their Links into a low power state
 and instructing the other end of the Link to do likewise. This
 capability allows hardware-autonomous, dynamic Link power reduction
 beyond what is achievable by software-only controlled power management.
 However, The device should be configured by software appropriately.
 Enabling ASPM will save power, but will introduce device latency.
 
 This patch adds ASPM support in Linux. It introduces a global policy for
 ASPM, a sysfs file /sys/module/pcie_aspm/parameters/policy can control
 it. The interface can be used as a boot option too. Currently we have
 below setting:
 -default, BIOS default setting
 -powersave, highest power saving mode, enable all available ASPM state
 and clock power management
 -performance, highest performance, disable ASPM and clock power
 management
 By default, the 'default' policy is used currently.
 
 In my test, power difference between powersave mode and performance mode
 is about 1.3w in a system with 3 PCIE links.

You could add:

 echo powersave > /sys/module/pcie_aspm/parameters/policy

to your local initscripts (rc.local) to enable this.

Don't enable Commercial detection for commercial-free channels

Tell MythTV which channels are commercial-free, so the commercial detection job won't spend time (and cpu and disk power and energy) looking for something that's not there.