Gentoo Archives: gentoo-dev

From: Richard Yao <ryao@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] What is the status of phone/tablet support?
Date: Sat, 12 Sep 2015 17:24:51
Message-Id: 20150912172441.GF7732@woodpecker.gentoo.org
1 I asked in #gentoo-embedded on freenode, but I would like to pose this question
2 to a wider auidence through the list.
3
4 What is the status of phone/tablet support? In specific, I am curious about:
5
6 * Modern hardware options (especially those without a hardware keyboard)
7 * Status of F/OSS drivers
8 * Xorg touch support (multitouch, virtual keyboards, etcetera)
9 * Desktop environments designed for multitouch in portage
10 * Graphical applications (e.g. dialer, calendar, web browser, email client)
11 * Reliable filesystem options for flash storage in small memory environments.
12
13 I know that the KDE project has Plasma Mobile, which gives us both a desktop
14 environment and many key graphical applications. However, I am not sure if much
15 has been done to support it in Gentoo's packaging and I would like to hear about
16 this:
17
18 http://www.youtube.com/watch?v=auuQA0Q8qpM
19
20 I realize that it is difficult to convey the sort of information that one wants
21 on an open ended topic such as this, so I will try to lead by example by talking
22 about filesystem options. First off, Linaro has some good summary:
23
24 https://wiki.linaro.org/Flash%20memory
25
26 Their summary consists entirely of log-based filesystems and CoW filesystems. It
27 omits in-place filesystems such as ext4 and XFS. In-place filesystems really
28 should not be appropriate for a phone or tablet because they are not designed to
29 gracefully recover from unclean unmounts caused by kernel panics or power loss
30 (e.g. dead battery, battery removal), although Android uses ext4 anyway.
31
32 A notable exception from Linaro's list that I happen to maintain in the tree is
33 the ZFSOnLinux driver. ZFS has many attributes that are desireable for phones,
34 such as easy backup through incremental send/recv (easy on bandwidth and battery
35 life), the ability to detect corrupt data (flash is not perfect), LZ4
36 compression (better throughput/latencies and less flash is need to store the
37 amount data) and ARC for a better cache hit rate when your working set exceeds
38 the amount of memory you have for cache (always true on phones).
39
40 ZFSOnLinux is currently behind other CoW filesystems in support for
41 phones/tablets. Upstream is gradually improving this and it should become a
42 competitive option in the future. The main areas that pose problems are:
43
44 1. Efficient use of minimal memory.
45
46 1a. Long held objects in SLABs cripple reclaim efficiency by preventing mostly
47 empty slabs from being reclaimed. On Solaris, some of the caches implement a
48 move callback that allows for compaction, but Linux's SLAB implementation does
49 not provide the option, ZoL's SLAB implementation does not implement it and it
50 is not clear if it is possible to defragment the things on Linux that use it
51 without modifications to the Linux kernel. Thankfully, nearly all of the memory
52 used by SLABs is in the ZIO buffers, which will be replaced with page-based
53 scatter-gather lists in the next release. That will go a long way to mitigating
54 this.
55
56 1b. mmap() double caches between the ARC and the page cache. This has been done
57 in OSv's ZFS driver and can be done in the ZFSOnLinux driver. It is currently
58 blocked on 1a as it does not make sense to implement sooner, but it will be
59 definitely be done.
60
61 2. 32-bit support (not an issue on 64-bit ARMv8 hardware, but ARMv8 is rare)
62
63 2a. Linux's kernel virtual memory allocator is crippled because the kernel
64 enters an infinite loop when it runs out of address space set aside for kernel
65 virtual memory. This is not a problem on 64-bit system swhere the amount set
66 aside exceeds the amount any single image system in existence currently has, but
67 it is a major problem on 32-bit. There is the further problem of a global
68 spinlock being used and certain accoutning functions iterating a linked list of
69 all virtual memory allocaitons, but this secondary has been mitigated mostly
70 through SLAB allocation. The main use of kernel virtual memory is to
71 avoid external fragmentation issues that come from allocting large buffers,
72 especially the SLABs that are used to minimize the number of kernel virtual
73 memory allocations that are done. The next release will implement scatter-gather
74 lists that should bypass this on the ZIO bufers while the other consumers either
75 have already been moved to kernel virtual memory or should be moved.
76
77 2b. There is no upstream test coverage on 32-bit and there are open issues
78 involving 32-bit runtime failures. The project has gradually fixed 32-bit
79 issues, but more work needs to be done here to make 32-bit as reliable as
80 64-bit. This will likely come after the solution to 2a makes 32-bit feasible
81 enough to subject it to regular testing.
82
83 3. Tweaks for flash storage.
84
85 3a. We will gain discard support from the Illumos community in the next release,
86 but the behavior of the hardware when discard is translated into the native
87 command needs to be studied. On SATA, discard is mapped to ATA TRIM. The design
88 of ATA TRIM is broken before SATA 3.1 where TRIM is an unqueued command that
89 introduces arbitrary lags. Consequently, continuous discard will be off by
90 default and the recommended way of doing discard will be to run a fstrim-like
91 command on the zpool. Research will be needed to determine if the continuous
92 discard is appropriate for NAND used in modern phones/tablets.
93
94 3b. We need to create pools with the correct alignment shift to set the flash
95 page size to avoid read-modify-write overhead on pages. On modern SATA/SAS hard
96 drives, we can read sector sizes from SMART data, but these are often wrong on
97 flash drives, so we rely on a list of drive identifiers. I am not sure what we
98 will have on phone hardware to determine the sector size.
99
100 Many of these improvements are not of exclusive benefit to phones/tablets, so we
101 will gain them out of work being done for traditional laptops, workstations,
102 servers and clusters. I expect to see the improvements avaliable from upstream
103 sometime in the next 12 months.
104
105 That said, I would love to hear similar descriptions of where we stand in other
106 areas with regard to mobile devices.

Replies

Subject Author
[gentoo-dev] Re: What is the status of phone/tablet support? Duncan <1i5t5.duncan@×××.net>