Commit graph

52701 commits

Author SHA1 Message Date
Yifan Hong
55fb297a0c libdm: Fix DmTable::num_sectors
Test: libdm_test
Change-Id: If147df2d5c4f3b3df7ca57200f16a9ad59ae8327
2019-10-01 19:43:33 -07:00
Yifan Hong
9c7903124c Fix fds libdm_test
Failed because of double free of fds.
Test: run it

Change-Id: I25d7d590ca52d57fb14a5483ff8751127f6a48a6
2019-10-01 19:43:33 -07:00
Alex Buynytskyy
43f0b0c4ba Using WideChar->UTF8 versions of Windows API to obtain temp folder.
This will correctly handle non-ascii chars in paths.
+Windows specific tests for non-unicode chars and root of disk as a temp
folder.

Test: atest libbase_test

Change-Id: Ief3ee26df93e122250441bfe41f0440fe62bfadc
2019-10-02 02:22:23 +00:00
Treehugger Robot
2becdb6579 Merge "libnativeloader: fix typo in README.md" 2019-10-02 02:02:53 +00:00
Treehugger Robot
c4876f1905 Merge "adb: disable failing test." 2019-10-02 01:00:41 +00:00
Tom Cherry
0f6ea6e8b6 liblog: remove a few unused items
Test: build
Change-Id: I8a31ad3a9fcd6f74f3a0221d38b64e8e2ea7ea2d
2019-10-01 17:29:13 -07:00
Tom Cherry
2187a41586 liblog: fix prio and tag validation code
These checks are not needed; all callers are in this file and there's
only one possible situation: that we have valid pointers and sizes.

Test: liblog-unit-tests, log.tag.* properties still work
Change-Id: I8b385d5124c2d93cd99a352e30f745b075c8bd09
2019-10-01 17:13:43 -07:00
Treehugger Robot
3e71c06d90 Merge "libprocessgroup: add support to set aggregate profiles" 2019-10-01 23:46:34 +00:00
Suren Baghdasaryan
a7ac578a9f lmkd: Change meminfo_log into killinfo_log and log additional fields
meminfo_log is used to log the state of the memory at the time of a kill.
Instead of reporting kill information and meminfo separately let's combine
them into one killinfo_log report. While normal logs can be trimmed by
chatty, meminfo_log uses a separate log context which gives it a better
chance of survival. As a result we will have all the information relevant
to a kill in one report which has higher chance of surviving chatty.

Bug: 74119935
Test: lmkd_unit_test
Change-Id: I83a9c12d538e1fb107721b04fdafc3c6c0d83b60
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-10-01 23:26:56 +00:00
Treehugger Robot
9a66161585 Merge "Fix memory leak in String16" 2019-10-01 23:17:30 +00:00
Treehugger Robot
88f50f536f Merge "Remove references to /sys/android_power/*" 2019-10-01 22:25:54 +00:00
Josh Gao
ea3f43ccf2 adb: disable failing test.
Bug: http://b/141943968
Bug: http://b/141923622
Test: python -m unittest test_device.FileOperationsTest
Change-Id: Ie384c71c3d6875db74982a398fb66f035ce9f408
2019-10-01 14:15:31 -07:00
Suren Baghdasaryan
7718c75bc2 Merge "lmkd: Isolate statslog related code from lmkd code" 2019-10-01 20:38:23 +00:00
Suren Baghdasaryan
46bc39ba23 Merge "lmkd: Fix kill failure handling" 2019-10-01 20:38:02 +00:00
Tom Cherry
6ddce6b015 Remove references to /sys/android_power/*
It looks like these were deprecated a very long time ago.

Bug: 141939924
Test: tree-hugger
Change-Id: I4fc098b2a45c81fe2af49c0ed4248dc14489f8b1
2019-10-01 13:30:41 -07:00
Tom Cherry
2beabe5c26 liblog: remove config_write.cpp/.h
Now that we only have one transport in a given build configuration,
there is no need to have these lists.

Test: liblog-unit-tests
Change-Id: I3fdcdc33c1224a9522080ea06f36f14c83d946ac
2019-10-01 13:05:58 -07:00
Yifan Hong
20ec0cd6ce Merge "libsnapshot: Remove GetSnapshotSize" 2019-10-01 18:37:48 +00:00
Suren Baghdasaryan
b72c66515b lmkd: Isolate statslog related code from lmkd code
Move statsd related code out of lmkd.c to minimize ifdefs sprinkled around
the code and make it more maintainable.

Bug: 74119935
Test: lmkd_unit_test
Change-Id: Ib22f90fd380b9a31e09ab18ef16787bc07415ddf
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-10-01 16:36:08 +00:00
Suren Baghdasaryan
ce862df992 lmkd: Fix kill failure handling
When lmkd fails to kill it should log the error, remove the process record
and exit immediately.

Bug: 74119935
Test: lmkd_unit_test
Change-Id: I26b0fd873eeed325f7dd56097ec31abc0d63f3a1
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-10-01 16:35:49 +00:00
Suren Baghdasaryan
c67350bc68 Merge changes from topic "default_psi_kill_mode"
* changes:
  lmkd: Prevent killing foreground processes due to thrashing
  lmkd: Add optional kill reason description into kill reports
  lmkd: Enable new kill strategy, add and adjust required system properties
  lmkd: Use aggregate zone watermarks as low memory threshold
  lmkd: Introduce kill strategy based on zone watermarks, swap and thrashing
  lmkd: Support variable polling intervals set by event handlers
  lmkd: Change zoneinfo parsing to retrieve zone watermarks
  lmkd: Change procfs read routine to handle files larger than 1 page in size
2019-10-01 16:35:14 +00:00
Tom Cherry
9d35034437 liblog: remove log/log_transport.h
There are no users; future versions will need to be more generic to
support the libbase style Logger/Aborter options.

Test: build, liblog-unit-tests
Change-Id: Ia4571cd39d3e499f18306920ecbf40ea8878fb81
2019-10-01 08:14:40 -07:00
Tom Cherry
7709bcf840 Merge changes Ieea7af39,Ic3755d1c,Ifad24b27,I3b33f2b8
* changes:
  liblog: remove endianness functions
  liblog: remove unused test #defines and transport code
  liblog: remove stderr logger
  liblog: add -Wall,-Wextra and do related clean-up.
2019-10-01 15:12:44 +00:00
Tom Cherry
aa3160abd8 Merge "logwrapper: update benchmark and remove old functions" 2019-10-01 15:09:29 +00:00
Florian Mayer
07001d909f Merge "Further document MapInfo::elf_offset." 2019-10-01 09:36:42 +00:00
Kiyoung Kim
f064a1dd8c Deprecate ld.config.txt for fully treblelized devices
From latest change fully treblelized devices started to use
ld.config.txt from generator instead of the one under /system/etc. As so
existing ld.config.txt is no longer required. This change removes all
ld.config.txt content and build script for it.

Bug: 138920271
Test: m -j passed
Test: Tested from Cuttlefish
Change-Id: I9e2d4b305442a4fccc4378a997ec92bfd6cddb84
2019-10-01 13:31:05 +09:00
Yifan Hong
0a14d17665 libsnapshot: Remove GetSnapshotSize
A single number is not enough to represent the ranges
that needs to be snapshotted in the target partition. For
prototyping now, just use device_size instead.

Add test in PartitionCowCreatorTest to ensure that this
doesn't regress. Also fix some trivial tests.

In follow-up CLs, snapshot ranges should be represented
with a more complicated structure. See b/141889746.

Bug: 141889746
Test: libsnapshot_test

Change-Id: I1a508c2464abce216ad4049cc2533ffdaa8cd14f
2019-09-30 18:11:23 -07:00
Tom Cherry
4c63e04f2a liblog: remove endianness functions
Android is little endian.

Test: liblog unit tests
Change-Id: Ieea7af39013a97f9f0d138a6d1ada3524d94e710
2019-09-30 14:39:37 -07:00
Tom Cherry
ebb7cdd0ac liblog: remove unused test #defines and transport code
We only ever have the default logger now, so we can remove this code.

Test: liblog unit tests

Change-Id: Ic3755d1c807c53192c614860a3cbe985748a3fe8
2019-09-30 14:16:08 -07:00
Tom Cherry
2238ce2d7f liblog: remove stderr logger
There are no users of the liblog stderr logger, but 66 users of
android::base::StderrLogger.  We'll prefer that format and work to
merge it into liblog.

Test: liblog-unit-tests
Change-Id: Ifad24b27ac0f51379b925f6644caa1f6f3d9ad81
2019-09-30 13:51:09 -07:00
Tom Cherry
7d045f6b74 liblog: add -Wall,-Wextra and do related clean-up.
Test: build
Change-Id: I3b33f2b896cb8bf7ad9edf110d1739d559028282
2019-09-30 12:58:55 -07:00
Eric Biggers
eaadc9d426 init/fscrypt_init_extensions: support setting v2 encryption policies
Support setting v2 encryption policies on init-created directories.  The
policy version to set is gotten from a new field in
/data/unencrypted/mode, which is the file that's used to pass the
encryption options from vold to init.

Also don't bother falling back to defaults if fields are missing from
this file, since it's re-written on every boot by vold.

Bug: 140500999
Test: tested as series; see If64028d8580584b2c33c614cabd5d6b93657f608
Change-Id: Ia9c5d4b80199686799e3ac80de78a50ed3bdabf4
2019-09-30 10:27:38 -07:00
Eric Biggers
d964376a92 fs_mgr_fstab: support specifying encryption policy version in fstab
Allow the encryption policy version to be specified as a third field in
the "fileencryption=" fstab option, and expose it through the fstab
record so that vold can use it.

Bug: 140500999
Test: tested as series; see If64028d8580584b2c33c614cabd5d6b93657f608.
      Also updated and ran the fs_mgr unit tests.
Change-Id: If5d56f4c84c4cd51e3f14c0a861c3e3ab6ff903f
2019-09-30 10:27:38 -07:00
Suren Baghdasaryan
17e920dbe4 Merge "libmeminfo: Report VMA flags in procmem report" 2019-09-30 17:25:34 +00:00
Suren Baghdasaryan
4b75088810 lmkd: Prevent killing foreground processes due to thrashing
Page cache thrashing affects device performance and by killing a process
we try to stop it. However if the thrashing application is the one which
user is interacting with then lmkd should not kill it even though it might
affect device performance.

Bug: 141286980
Test: SequentialRWTest CTS test
Change-Id: If86c0e7e8ad9adf1816659562151ca083eaa65c4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:55 +00:00
Suren Baghdasaryan
fd7518f8c1 lmkd: Add optional kill reason description into kill reports
Allow kill report to be appended with the explanation of the reasons
killing has been done. This would help identify kill reasons while
troubleshooting lmkd kills.

Change-Id: Ie5dd7a44e51d04c43c2492be8c1bc964d1b03555
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:39 +00:00
Suren Baghdasaryan
844f26bc24 lmkd: Enable new kill strategy, add and adjust required system properties
Enable new kill strategy when PSI mode is used in combination with
ro.lmk.use_minfree_levels=false. Adjust ro.lmk.swap_free_low_percentage,
introduce ro.lmk.psi_partial_stall_ms and ro.lmk.psi_complete_stall_ms
system properties to support two levels of PSI events measuring partial
and complete stalls. Add ro.lmk.use_new_strategy system property to switch
to the old strategy if necessary.

Bug: 132642304
Test: lmkd_unit_test, ACT memory pressure tests
Change-Id: I6f1b65e19dbe9b58c862e5e4255270c82f0afb9a
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:27 +00:00
Suren Baghdasaryan
4787ab452f lmkd: Use aggregate zone watermarks as low memory threshold
Parsing /proc/zoneinfo is expensive and zone watermarks normally do no
change often. Instead of checking free memory per each zone we aggregate
zone watermarks and compare them with MemFree from meminfo as an
approximation of memory being under a given watermark.
zoneinfo parsing is rate limited to once per minute to detect a possible
change of the memory margins from userspace.

Bug: 132642304
Test: lmkd_unit_test, ACT memory pressure tests
Change-Id: If4a8154c004e24324e6de44359de416766139df6
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:16 +00:00
Suren Baghdasaryan
561cfd9478 lmkd: Introduce kill strategy based on zone watermarks, swap and thrashing
Add new kill strategy which makes kill decisions based on which zone
watermark is breached, how much free swap space is still available and
what percentage of the file-backed page cache has been refaulted. This mode
is designed to be used only with PSI signals. It kills unconditionally when
a critical pressure event is received, therefore PSI stall for that event
should be set to a value representing a truly non-responding system
(currently set to 700ms out of 1sec spent in complete stall). New event
handler also controls polling interval based on current memory conditions.

Bug: 132642304
Test: lmkd_unit_test, ACT memory pressure tests
Change-Id: Ia213ef2bb06b245d651ebf2d813e944b4ae7565f
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:54:05 +00:00
Suren Baghdasaryan
ef3650f8a0 lmkd: Support variable polling intervals set by event handlers
After a memory event happens event handler can assess current memory
condition and decide if and when lmkd should re-check memory metrics in
order to respond to changing memory conditions. Change the event handler
interface to allow control over polling period and ability to start/extend
polling session.

Bug: 132642304
Test: lmkd_unit_test
Change-Id: Ia74011e943140b6cffbf452ff8e1744b7336eacf
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:53:46 +00:00
Suren Baghdasaryan
94ce3dd573 lmkd: Change zoneinfo parsing to retrieve zone watermarks
/proc/zoneinfo contains per-node data and each node contains per-zone
section for each zone. Current parser does not recognize this hierarchy
and useful per-zone information like zone watermarks cannot be retrieved.
Change the parser to parse zoneinfo into a hierarchical structure. New
parser also handles up to 2 nodes and can be easily extended to handle
more if needed by changing MAX_NR_NODES.

Bug: 132642304
Test: lmkd_unit_test
Change-Id: I9306289ea6d30d78a261c5d5c29f4f6ea167807d
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:53:34 +00:00
Suren Baghdasaryan
a77b327bb9 lmkd: Change procfs read routine to handle files larger than 1 page in size
Files like /proc/zoneinfo or /proc/<pid>/status can be larger than 4KB
page size. Change reread_file routine to resize read buffer whenever
it is not big enough to read the entire file. Start with 1-page buffer
and double its size until it's big enough to read the entire file.
Read /proc/zoneinfo during initialization to initialize the buffer
to a big enough size and avoid re-allocations when under memory pressure.

Bug: 137010962
Test: lmkd_unit_test
Change-Id: If9a5b0d27c2f4de9063f0fd0f36f908ece87dcce
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:53:18 +00:00
Suren Baghdasaryan
7c2f94bdf0 Merge "lmkd: Fix killed process name reporting" 2019-09-30 16:53:05 +00:00
Suren Baghdasaryan
9e359dbe61 lmkd: Fix killed process name reporting
Fix termination of killed process name in proc_get_name function. While at
it also fix the coding style in the function.

Test: lmkd_unit_test
Bug: 141780598
Change-Id: I3f99b3e37b9a9d0750ece94f08f0b50ac839dacb
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:02:35 +00:00
Florian Mayer
922eecc5a0 Further document MapInfo::elf_offset.
Change-Id: I291d8a61cb400fdf5795a85c4e9a65406124717e
2019-09-30 16:23:39 +01:00
Rick Yiu
0b211fa8b3 libprocessgroup: add support to set aggregate profiles
To support setting multiple profiles with one call. The json format
is as below example.

  "AggregateProfiles": [
    ...
    {
      "Name": "SCHED_SP_BACKGROUND",
      "Profiles": [ "HighEnergySaving", "LowIoPriority", "TimerSlackHigh" ]
    },
    ...
  }

Bug: 139521784
Test: SetProfile works as expected
Change-Id: Ibe14ed57d5169cafcbcbbdb054df3ed171a2f6a2
2019-09-30 08:35:28 +00:00
Orion Hodson
2c392b6d0a Merge "Add temporary CPPLINT.cfg files to libnative{bridge,loader}" 2019-09-30 06:43:39 +00:00
Treehugger Robot
a18907da54 Merge "[vts-core] Remove extra folder for vts_core_liblp_test and vts_libdm_test" 2019-09-30 05:34:15 +00:00
Jooyung Han
0839e5afdc libnativeloader: fix typo in README.md
Test: N/A
Change-Id: I7766ebaafa193b90096c5061adbf67eaf26e651c
2019-09-30 13:20:04 +09:00
Kiyoung Kim
e99728fcf2 Merge "Add library list for VNDK using core variant" 2019-09-30 01:51:26 +00:00
Tom Cherry
a0e4af67eb logwrapper: update benchmark and remove old functions
All of the previous callers have been updated, so we can remove these
old functions.

Test: build
Change-Id: I31597a69635795bacf9bb8054ccf5ffa8089e481
2019-09-28 07:27:26 -07:00