8/7/2019 Highlights of LinuxCon 2010
1/29
Highlights of LinuxCon 2010
Alison Chaiken
14th September 2010
Power management
Android boot-time
New filesystems
kvm
1
8/7/2019 Highlights of LinuxCon 2010
2/29
Power management: LinuxCons biggestcontroversy
Contending approaches:
Current mainline approach represented by Rafael J. Wysocki
Intel embellishments and optimization presented by Len
BrownAndroid wake_locks and early_suspend, alternate mechanism
from OHA
1
8/7/2019 Highlights of LinuxCon 2010
3/29
Additions to existing runtime powermanagement patch
Linux ACPI has replaced earlier BIOS-based APM.Kernel already has support for underclocking (cpu_freq == "P
states") and hibernation (cpu_idle == "C states")
Next step is to implement per-bus and per-device granularity.
Traditional device-driver approach is addition of newdev_pm_ops methods to API.
Runtime power management framework provides the kernel
interface for the new driver methods.
1
8/7/2019 Highlights of LinuxCon 2010
4/29
dev_pm_ops methodsinclude/linux/pm.h
struct dev_pm_ops {
...
int (*runtime_suspend)(struct device *dev);int (*runtime_resume)(struct device *dev);
int (*runtime_idle)(struct device *dev);
};
include/linux/device.h
struct device_driver { struct struct bus_type {... ...
const struct dev_pm_ops *pm; const struct dev_pm_ops *pm;
... ...
}; };
1
8/7/2019 Highlights of LinuxCon 2010
5/29
For example, seesrc/kernels/2.6.34.6-47.fc13.x86_64 . . .
2
8/7/2019 Highlights of LinuxCon 2010
6/29
Subtleties of runtime power managementframework
Devices run if they please: OS does not, in general, force ashut-down.
System hibernate and wakeup must bring all devices up and
down.
Settings are configured through /sys/devices//power.Event-listener-callback paradigm for wakeup.
A queue holds per-device requests to sleep and wake.
Reference-counting mechanism blocks suspension of devices.
1
8/7/2019 Highlights of LinuxCon 2010
7/29
Powertop and turbostatLen Brown, Intel
1
8/7/2019 Highlights of LinuxCon 2010
8/29
8/7/2019 Highlights of LinuxCon 2010
9/29
Intels power measurementspowertop screenshot
Linux trails Windows in idle power management, at least for recent
Intel CPUs.
1
8/7/2019 Highlights of LinuxCon 2010
10/29
8/7/2019 Highlights of LinuxCon 2010
11/29
Android power management architecture
1
8/7/2019 Highlights of LinuxCon 2010
12/29
2
8/7/2019 Highlights of LinuxCon 2010
13/29
Fedora 13alison@tomales ;-) ls -l /sys/power
-rw-r--r-- 1 root root 4096 Sep 5 16:00 disk
-rw-r--r-- 1 root root 4096 Sep 5 17:41 image_size
-rw-r--r-- 1 root root 4096 Sep 5 17:41 pm_async
-rw-r--r-- 1 root root 4096 Sep 5 17:41 pm_test
-rw-r--r-- 1 root root 4096 Sep 5 17:41 pm_trace
-rw-r--r-- 1 root root 4096 Sep 5 17:41 resume
-rw-r--r-- 1 root root 4096 Sep 5 16:00 state
1
8/7/2019 Highlights of LinuxCon 2010
14/29
Android 1.6# ls -l /sys/power
-rw-rw---- radio system 4096 2010-09-04 19:14 state
-rw-rw---- radio system 4096 2010-09-04 19:14 wake_lock
-rw-rw---- radio system 4096 2010-09-04 19:14 wake_unlock
-r--r--r-- root root 4096 2010-09-05 15:11 wait_for_fb_sleep
-r--r--r-- root root 4096 2010-09-05 15:11 wait_for_fb_wake
2
8/7/2019 Highlights of LinuxCon 2010
15/29
Granularity in Android PowerManagement
Flag Value CPU Screen Keyboard
PARTIAL_WAKE_LOCK On* Off Off
SCREEN_DIM_WAKE_LOCK On Dim Off
SCREEN_BRIGHT_WAKE_LOCK On Bright Off
FULL_WAKE_LOCK On Bright Bright
1
8/7/2019 Highlights of LinuxCon 2010
16/29
8/7/2019 Highlights of LinuxCon 2010
17/29
Improving Android boot up timeMajor delay during boot is due to pre-loading of Java classes:
about 1500.
"System And Method For Dynamic Preloading Of Classes . . .(7,426,720)": Oracle vs. Google lawsuit!
Birds attempt to reduce boot-time not exhaustive, but also
not successful so far.
1
8/7/2019 Highlights of LinuxCon 2010
18/29
One Billion Files: Scalability Limits inLinux FS
Ric Wheeler, Red Hat
fsck exhausts system memory at less than a billion files
ext4 rules, but Oracles btrfs (MeeGo) is hot and xfs (SGI)
and zfs (BSD/Solaris) have supporters.Features: xfs, enterprise performance and scalability; zfs,
native support for encryption; btrfs, snapshotting and
reversion.
Observed dramatic implementation-specific effects at largescale:
ext4 is slow where stat() must be run on each file (e.g.
"ls").
1
8/7/2019 Highlights of LinuxCon 2010
19/29
8/7/2019 Highlights of LinuxCon 2010
20/29
8/7/2019 Highlights of LinuxCon 2010
21/29
KVM: the Latest from the DevelopmentTeam
Chris Wright, Red Hat
kvm has replaced xen as the VM integrated directly with the
kernel.
qemu emulator is heavily reliant on the kvm device driver.Machine-to-machine paradigm for servers rather than
user-target in embedded.
Support for direct control and communication with hosts
peripherals, esp. PCI, is being added.Guests can run at 80% native speed although implementation
remains buggy!
1
8/7/2019 Highlights of LinuxCon 2010
22/29
Challenges include guest-host coordination of memory (viaNested Page Tables) and scheduling.
2
8/7/2019 Highlights of LinuxCon 2010
23/29
PC-BSD Running in Qemu-KVM onFedora 13
1
8/7/2019 Highlights of LinuxCon 2010
24/29
2
8/7/2019 Highlights of LinuxCon 2010
25/29
Invocation of kvm for PCBSDalison@tomales ;-) sudo /bin/rm /tmp/pcbsd.img; qemu-img create \
-f qcow2 /tmp/pcbsd.img 10G
Formatting /tmp/pcbsd.img, fmt=qcow2 size=10737418240 \
encryption=off cluster_size=0
alison@tomales ;-) sudo qemu-kvm -cdrom /opt/PCBSD8.1-x64-DVD.iso -m \
2048 -vga std -hda /tmp/pcbsd.img -writeconfig pcbsd.config
alison@tomales ;-) cat pcbsd.config
# qemu config file[drive]
index = "2"
media = "cdrom"
file = "/opt/PCBSD8.1-x64-DVD.iso"
[drive]
index = "0"media = "disk"
file = "/tmp/pcbsd.img"
1
8/7/2019 Highlights of LinuxCon 2010
26/29
SummaryPower management is the greatest current area of controversy.
Linux lags other OSs in energy conservation.
Android presents both problems and opportunities for Linux.Healthy competition among filesystems leads to rapid
innovation.
Qemu and kvm are both impressive and incredibly useful.
1
8/7/2019 Highlights of LinuxCon 2010
27/29
Without d_type, must stat() and readdir()to list files
/usr/include/dirent.h
#ifdef __USE_BSD /* File types for d_type. */
enum
{ DT_UNKNOWN = 0, # define DT_UNKNOWN DT_UNKNOWN
DT_FIFO = 1, # define DT_FIFO DT_FIFO
DT_CHR = 2, # define DT_CHR DT_CHR
DT_DIR = 4, # define DT_DIR DT_DIR
DT_BLK = 6, # define DT_BLK DT_BLK
DT_REG = 8, # define DT_REG DT_REG
DT_LNK = 10, # define DT_LNK DT_LNKDT_SOCK = 12, # define DT_SOCK DT_SOCK
DT_WHT = 14 # define DT_WHT DT_WHT
};
1
8/7/2019 Highlights of LinuxCon 2010
28/29
No concept of file type in POSIX standard.
2
8/7/2019 Highlights of LinuxCon 2010
29/29
FS Comparative Performance
1