Commit Graph

249 Commits

Author SHA1 Message Date
Di Shen
683fe954dc ANDROID: thermal: Add a vendor hook for thermal throttle update
Commit 602c233f65 added a conditional for
ops->get_trip_temp(). In the original code,
ops->get_trip_temp() is called unconditionally. So delete
the conditional to fix it. At the same time, modify the
comment of enable. Actually, IPA is always enable, but
sometimes it needs to be disabled for a while. Making
'enable' true or false, IPA can be enabled or disabled by
user requirement.

When the 'override' turns to false from true and current
temperature is below the switch_on_temp(means 'update' is
false), the cooling device state has not changed, also
the power could not be updated to the maximum power. So
add a vendor hook to renew the 'update' value, so that the
cooling device can be updated.

Fixes: 602c233f65 ("ANDROID: thermal: Add a flag for vendor hook enable_thermal_power_throttle")
Bug: 271370056
Signed-off-by: Di Shen <di.shen@unisoc.com>
Change-Id: I43191926f8da9016fe76d7cb78639b1cbd89c53e
2023-03-08 10:13:08 +08:00
Liujie Xie
05b5ff11ad ANDROID: vendor_hooks: Add hooks for mutex and rwsem optimistic spin
These hooks help us do the following things:
a) Record the number of mutex and rwsem optimistic spin.
b) Monitor the time of mutex and rwsem optimistic spin.
c) Make it possible if oems don't want mutex and rwsem to optimistic spin
for a long time.

Bug: 267565260
Change-Id: I2bee30fb17946be85e026213b481aeaeaee2459f
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
(cherry picked from commit d01f7e1269d2651768a0bd91a88f76339a1cb427)
2023-03-06 10:58:22 +08:00
Greg Kroah-Hartman
fda78dabca Revert "ANDROID: GKI: Add vendor hook to binder transaction"
This reverts commit cabca1b98e.

The hook android_rvh_binder_transaction is not used by any vendor, so
remove it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 205648032
Bug: 203756332
Cc: Liangliang Li <liliangliang@vivo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I46394ebf00b7aa882f6df37ee3eec5cdc0263579
2023-02-18 15:20:16 +00:00
Georgi Djakov
5a6502af11 ANDROID: psi: Add vendor hooks for PSI tracing
Add hooks to capture various per-zone memory stats when
a trigger threshold is hit.

Bug: 268290366
Change-Id: Ibe39263ddb05ffc3fa63b5225497a90c6480c8d7
Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com>
2023-02-17 16:40:43 +00:00
lijiaming
8501db9cda ANDROID: loop: Add vendor hook to update cmd
According to the value of OEM-specific field of struct bio, we need
to update the value of "iocb->ki_flags" or "iocb->ki_ioprio", so that
we can distinguish different IO's in lower level drivers and take
different measures.

Bug: 265611433
Change-Id: Id8ea3c3d064967b7a79fe24c48bf58d92c5d6e41
Signed-off-by: lijiaming <lijiaming3@xiaomi.com>
2023-01-16 21:01:33 +00:00
lijiaming
0f1629ced8 ANDROID: direct_io: Add a vendor hook to update OEM-specific field of struct bio
Based on the value of "dio->iocb->ki_ioprio" and "dio->iocb->ki_flags",
we can update OEM-specific field of struct bio through this hook. then
we can distinguish different IO's in lower level drivers and take different measures

Bug: 262939423
Change-Id: Ie84d737ca72c29737542f3783d27d7231a272cc4
Signed-off-by: lijiaming <lijiaming3@xiaomi.com>
2023-01-13 21:31:41 +00:00
xiaofeng
b3084d784b ANDROID: vendor_hooks:vendor hook for control memory dirty rate
When the IO pressure increases or the system performs dirty
page balancing, the frame rate of the foreground application
may become unstable. Therefore, a hook point is added to limit
the buffer IO rate from the source.

Bug: 262189942
Change-Id: I5214d611a388c5e8d87dc44ffde86ead1834ddff
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2023-01-11 03:39:54 +00:00
Nagireddy Annem
9d0ccb89bc ANDROID: irqchip/irq-gic-v3: Add vendor hook for gic suspend
This change adds vendor hook for gic suspend syscore ops callback.
And it is invoked during deepsleep and hibernation to store
gic register snapshot.

Bug: 259163247
Change-Id: I4e3729afa4daf18d73e00ee9601b6da72a578b4a
Signed-off-by: Nagireddy Annem <quic_nannem@quicinc.com>
2023-01-04 15:44:09 +00:00
Jia-Wei Chang
cb0ff59972 ANDROID: cpufreq: add vendor hook in cpufreq_offline
Add vendor hook in cpufreq_offline to block uevent pathway before
cpufreq cooling unregister to prevent NETLINK broadcast waking up during
suspend.

The change is because android hardware health service will register
epoll with EPOLLWAKEUP flag [1].  Afterwards, when suspend starts,
NETLINK will hold the wakelock because the EPOLLWAKEUP flag registered
from health service.

One more key factor is the CAP_BLOCK_SUSPEND capability of health
service [2] that may affect suspend flow as well.

Currently only the patch [3] is available but not accepted in upstream.

[1] https://android.googlesource.com/platform/hardware/interfaces/+/master/health/utils/libhealthloop/HealthLoop.cpp#69
[2] https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1461242
[3] https://patchwork.kernel.org/project/linux-pm/list/?series=658300&state=%2A&archive=both

Bug: 260537724
Change-Id: Ifea4bff2d8fdc3b7e60e7f1cb7ec29a8d3c8771a
Signed-off-by: Jia-Wei Chang <jia-wei.chang@mediatek.com>
2022-12-21 10:45:13 +08:00
lijiaming
cac282fc1a ANDROID: dm: Add a vendor hook to update bio after clone
add a vendor hook to update bio after __bio_clone_fast()

Bug: 261942040
Change-Id: I5ff6f6df632bc9690ea588bc1cadbed670b78e5c
Signed-off-by: lijiaming <lijiaming3@xiaomi.com>
2022-12-15 19:36:01 +00:00
Shreyas K K
3cc69a0a0a ANDROID: vendor hooks: Encrypt snapshot for bootloader based hibernation
Add encryption support to bootloader based hibernation. This will
encrypt the hibernation snapshot image before it is written to the swap
partition.

Bug: 260069271
Change-Id: I07046ad7fb848fc62258871ab41b3e03246c40dc
Signed-off-by: Shreyas K K <quic_shrekk@quicinc.com>
2022-12-13 18:07:10 +00:00
Charan Teja Kalla
6f0ba6ad99 ANDROID: mm/cma: add vendor_hook in cma_alloc for retries
Add a vendor hook in the cma alloc for the allocation retries that can
be used by clients to control the number of retries before returning.

Bug: 242836407
Change-Id: Iccff0ac2a926d449da5af64086463bd8d93340fc
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
2022-12-08 01:10:32 +00:00
andrew.yang
564233e471 ANDROID: mm: add a vendor hook to rmqueue_bulk()
Add a vendor hook to requeme_bulk() to debug and avoid KE problem.

Bug: 259479254
Change-Id: I55353ff205250cbfb7e2f8d9dc2c6ec7718d77ab
Signed-off-by: andrew.yang <andrew.yang@mediatek.com>
2022-11-22 20:57:21 +00:00
Pavankumar Kondeti
99e3951ea4 ANDROID: vendor_hooks: Allow shared pages reclaim via MADV_PAGEOUT
Add a hook in madvise_cold_or_pageout_pte_range() to allow
vendor modules to influence the shared pages reclaim.

Bug: 242678506
Change-Id: I269a385b59f7291c2e96478674bb3d05f94584cb
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
2022-11-22 19:39:44 +00:00
T.J. Mercier
34e03c38fd ANDROID: dma-buf: Add vendor hook for deferred dmabuf sysfs stats release
This vendor hook allows for the sysfs activity associated with
dma-buf-sysfs-stats teardowns to be performed asynchronously similar
to how the initialization works.

Bug: 254192604
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Change-Id: Ie076d0f8f67b96a97c71d9e6bf90539ebd9807bf
2022-11-14 20:41:00 +00:00
Shreyas K K
d2cb755a43 ANDROID: vendor hooks: Add hooks to support bootloader based hibernation
Add vendor hooks to disable randomization of swap slot allocation for
swap partition used for saving hibernation image. Another level of
randomization of swap slots takes place at the firmware level as well
in order to address the wear leveling for UFS/MMC devices, so this
vendor hook checks if a block device represents the swap partition being
used for saving hibernation image, if yes, the swap slot allocation for
such partition is serialized at kernel level.

There is a performance advantage of reading contiguous pages of hibernation
image, it makes the restore logic of hibernation image simpler and faster
as there are no seeks involved in the secondary storage to read multiple
contiguous pages of the image.

Bug: 228815136
Change-Id: Id41a25fd15c5b71f8064f1c7d9cac9560fcdde85
Signed-off-by: Vivek Kumar <quic_vivekuma@quicinc.com>
Signed-off-by: Shreyas K K <quic_shrekk@quicinc.com>
2022-10-11 18:35:52 +00:00
Charan Teja Kalla
041ffcd941 ANDROID: mm: add a vendor_hook to change the gfp flags
Add a vendorhook to change the gfp flags while doing the file read_ahead
allocations.

Bug: 248404104
Change-Id: Ifcf1b29177eed2fee79f83764278d67dab221bc5
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
2022-10-10 17:49:13 +00:00
Konstantin Vyshetsky
285d4132a6 ANDROID: scsi: ufs: add complete init vendor hook
Currently the core UFS driver does not have a vops to notify when the
device is operational. This commit introduces a hook, which serves to
notify device completing initialization and is ready to accept I/O.

This is required by the FIPS140-2 [1] self integrity test of inline
encryption engine, which must run whenever the host controller is reset.
The code requires sleeping while waiting for I/O to complete and allocating
some memory dynamically, which requires the vendor hook to be restricted.

[1] https://csrc.nist.gov/publications/detail/fips/140/2/final

Bug: 185809932
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I6f476f9c2e2b50574d2898c3f1ef6b648d92df24
(cherry picked from commit e774e4eca69ce8ab60df04b27f524b586ab74f17)
2022-10-04 16:09:05 +00:00
Liujie Xie
9122cbfc55 ANDROID: Fix lost track action type in save_track_hash
Transmit the track action type to save_track_hash, otherwise we do not know it is allocation stack or free stack.

Fixes: 8bc6337823c6 ("ANDROID: vendor_hooks: add hooks for slab memory leak debugging")
Bug: 184928480
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I74c50c02cfb4ebbf3e9fecdf125e76946ff4e7d1
(cherry picked from commit 7d216e2512082853f4cf0c220a1b48119203144f)
2022-09-28 18:59:15 +00:00
Peifeng Li
ac82d34706 ANDROID: vendor_hook: rename the the name of hooks
Renamed trace_android_vh_record_percpu_rwsem_lock_starttime to
trace_android_vh_record_pcpu_rwsem_starttime.

Because the orignal name is too long, which results to the
compile-err of .ko that uses the symbol:

ERROR: modpost:
too long symbol "__tracepoint_android_vh_record_percpu_rwsem_lock_starttime"

There is not any users of the the orignal hooks so that it is safe to
rename it.

Bug: 241191475
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Ie246a933414db5e9e28a65a4c280fae3a1cbefe3
2022-09-28 17:07:23 +08:00
Liujie Xie
4a9e3b2ca6 ANDROID: vendor_hooks: Add hook in kmalloc_slab()
Add hook in kmalloc_slab() for debug kmalloc slab memory leak.

Bug: 197614797
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I402a9f968f2bf1e75daa461c05a53a8fabf70028
(cherry picked from commit 94fbab9d6c82befb547f75433dd886f2611071a6)
2022-09-27 22:16:12 +00:00
liuhailong
54f780d093 ANDROID: signal: Add vendor hook for memory reaping
Since commit 3bcdb496f496 ("ANDROID: signal: Add vendor hook
for memory reaping"), but *current* does not need.  Add another
hook here to determine killed process need be reaped.
(e.g. get_mm_counter)

Bug: 232062955
Change-Id: Ide13d3a2e8c199b063f41e071a2bf2fd60a91b04
Signed-off-by: liuhailong <liuhailong@oppo.com>
(cherry picked from commit e27ad1d21124c25259911574775fafb5f60bb53e)
2022-09-27 20:02:43 +00:00
Greg Kroah-Hartman
b80df8c286 Revert "ANDROID: vendor_hooks: Add hooks to tcp/udp send/recv msg functions."
This reverts commit e4e3aadd01.

The hooks android_rvh_tcp_sendmsg_locked, android_rvh_tcp_recvmsg,
android_rvh_udp_sendmsg, android_rvh_udp_recvmsg, and
android_rvh_tcp_recvmsg_stat, are not used by any vendor, so remove it
to help with merge issues with future LTS releases.

If they are needed by any real user, it can easily be reverted to add
them back and then the symbols should be added to the abi list at the
same time to prevent it from being removed again later.

Bug: 190523684
Bug: 203756332
Cc: Liangliang Li <liliangliang@vivo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Id562bc858612e059b1605655128783042740ff8a
2022-09-27 11:49:43 +02:00
Eddie Huang
afa76a1c3a ANDROID: scsi: ufs: Improve MCQ error handling
Changes
- Add new android vendor hook: android_vh_ufs_mcq_retry_complete()
- Retry mcq complete on reset in error handling flow
- Check mcq oustanding reqs instead of DB reg under MCQ mode

Bug: 248447556
Change-Id: Ie658edcef0f9b155eefb4462c99f40557cb64c68
Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
2022-09-26 18:24:05 +00:00
qizhong cheng
a89fbc0de0 ANDROID: fix add vendor hooks for unusual abort cases
Add hooks to check the do_serror can be recover or not.
When PCIe encounters completion timeout, PCIe hardware will
reply slave error to bus, which will causes the system to panic.

Bug: 247846368

Signed-off-by: qizhong cheng <qizhong.cheng@mediatek.com>
Change-Id: Iaef6c9a6ac07e552939c0f8e386213cb930cfb6e
2022-09-23 21:05:40 +00:00
Todd Kjos
0c3d2d04cc ANDROID: make sure all types for hooks are defined in KMI
There were 3 remaining types directly referenced by vendor
hooks that were not fully-defined in the KMI:

struct blk_mq_alloc_data : defined in block/blk-mq.h
struct readahead_control ; defined include/linux/pagemap.h
struct selinux_state : defined in security/selinux/include/security.h

libabigail is not finding definitions based on the instantiation
of the hooks, so force them to be defined by defining dummy exported
symbols. Since blk_mq_alloc_data and selinux_state are defined in
subsystem-private headers, create new vendor_hooks.c files in
those subsystems to instantiate the related hooks and the dummy
symbols.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ib228449ff500dd5cbffd5788effdab5c581b65b7
2022-09-21 16:33:58 +00:00
Todd Kjos
ca319dfc39 ANDROID: Add headers to vendor_hooks.c for type visibility
Include headers in vendor_hooks.c to improve type visibilty.
With this change, 46 types that were unknown in the previous
XML were fully defined and 16 types that were previously opaque
became fully defined.

Of the 96 remaining opaque types, 43 are defined in C files, so
they are truly opaque and inaccessible to vendor modules. This
leaves 53 opaque types that need some investigation.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I2ede44177d7028cee93e69cc866b4c80e7229116
2022-09-13 15:39:49 +00:00
Todd Kjos
ecb7d6b106 ANDROID: remove inclusions from hook definition headers
To avoid changing the visibiliy of data types when including
hook definition headers remove header file inclusions from
the hook definition header files.

Instead, the hook definition headers should just have forward
declarations that don't require full definition.

To provide full definitions of the types for the KMI, the
headers that define the types should be included by the
source file that instantiates the hooks - normally
vendor_hooks.c.

Since the KMI is frozen, some of the inclusions are still
required to preserve the CRC associated with symbols. Keep
these inclusions under #ifdef __GENKSYMS__.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ibc1173eb4b07fcec21c7abd8e0ab1950b3fb5b34
2022-09-07 13:18:14 -07:00
Chiawei Wang
fb2bb8f3ad ANDROID: mm: Add vendor hook in rmqueue()
Add a vendor hook for costly order page counting
and other vendor specific functions.

Bug: 174521902
Bug: 172987241
Bug: 244409558
Signed-off-by: Chiawei Wang <chiaweiwang@google.com>
Signed-off-by: Oven <liyangouwen1@oppo.com>
Change-Id: I89206727a462548cc3500b695d85c83ff003eec7
(cherry picked from commit 369de3780428a17e9afece2f5747f03619d589b6)
2022-09-02 20:54:45 +00:00
Todd Kjos
e6c826aa9b ANDROID: reduce number of opaque structs in KMI
Change how vendor hooks are instantiated to promote
more complete structure definition in the ABI XML
description without complicating hook definition for
partners.

We don't want to force partners to include all
headers as part of the hook definition in include/trace/hooks/
since that causes extra headers to be included in
source files that runs the risk of changing visibility
resulting in CRC changes to KMI symbols. Instead continue
the practice of using forward declarations in the hook
header files.

Instead of instantiating hook tracepoints globally in
drivers/android/vendor_hooks.c, use subsystem-specific
vendor_hooks.c. This avoids namespace collisions between
internal header files and limits the exposure to the internal
headers to the instantiation, not the call sites.

In this patch, all of the scheduler related hooks are
instantiated in kernel/sched/vendor_hooks.c which can
cleanly include scheduler-related header files to
provide full type visibility.

Since this is being done on a KMI frozen branch, there
are some __GENKSYMS__ tricks needed to preserve the
existing CRC as we increase the number of fully typed
structs. These tricks won't be needed when this is
introduced on a non-KMI-frozen branch.

With this patch, the number of undefined types was
reduced from 108 to 68.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ife5a66c2968de73e3f6d05840411310611e2e175
2022-08-30 17:31:23 +00:00
zhouhuacai
0226fc2e18 ANDROID: vendor_hooks: tune reclaim inactive ratio
Add hooks to apply oem's memory reclaim optimization

Bug: 186669330
Change-Id: I9a1c713bf3eea2823b2758ee44284a244b1ca7a1
Signed-off-by: zhouhuacai <zhouohuacai@oppo.com>
Signed-off-by: Oven <liyangouwen1@oppo.com>
(cherry picked from commit 577f73412f579ef493e8e67795b3fd93f1a47dfd)
2022-08-30 17:17:32 +00:00
zhengding chen
55f112e068 ANDROID: vendor_hooks: Add hooks for cpufreq_acct_update_power
We want to record the cputime of each running process by adding
hooks for cpufreq_acct_update_power.

Bug: 186604985

Signed-off-by: zhengding chen <chenzhengding@oppo.com>
Change-Id: I35e38be4680781df3338b4a01041922294aecaa0
(cherry picked from commit 3983753280987d68138ce249232b3d1b775ab1e6)
2022-08-29 22:44:45 +00:00
xieliujie
cc724041ce ANDROID: vendor_hooks: Add hooks for oem futex optimization
If an important task is going to sleep through do_futex(),
find out it's futex-owner by the pid comes from userspace,
and boost the owner by some means to shorten the sleep time.
How to boost? Depends on these hooks:
commit 53e809978443 ("ANDROID: vendor_hooks: Add hooks for scheduler")

Bug: 243110112
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I9a315cfb414fd34e0ef7a2cf9d57df50d4dd984f
(cherry picked from commit 548da5d23d98b796cf9a478675622a606b3307c8)
2022-08-29 16:57:50 +00:00
xiaofeng
0312e9cd22 ANDROID: vendor_hooks:vendor hook for __alloc_pages_slowpath.
add vendor hook in __alloc_pages_slowpath ahead of
__alloc_pages_direct_reclaim and warn_alloc.

Bug: 243629905
Change-Id: Ieacc6cf79823c0bfacfdeec9afb55ed66f40d0b0
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2022-08-24 22:16:36 +00:00
Aran Dalton
5dc0125847 ANDROID: vendor_hooks: Add hooks for page_cache_sync_ra
Add hooks to modify the policy of page_cache_sync_ra for oem's optimization
of synchronous readahead.

Bug: 243477375

Signed-off-by: Aran Dalton <arda@allwinnertech.com>
Change-Id: Ic3397d26e58d2d1189d9db25914c2f3d95c69226
2022-08-23 19:34:18 +00:00
xieliujie
a60c2d4f12 ANDROID: vendor_hooks: Add hooks for ipa
Add hooks to support oem's thermal feature.

Bug: 242662879

Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I4731948e92e9becb2dbd1f13851b7f849dcfd57c
2022-08-19 16:07:28 +00:00
Wenchao Chen
e956d16bc2 ANDROID: GKI: add restricted vendor hook for mmc
We need to add three restricted vendor hooks to implement mmc protection
and support sd card hs mode tuning.

If you are using a function that needs to sleep, then use the restricted
vendor hook.
- android_rvh_mmc_partition_status
- android_rvh_mmc_sd_cmdline_timing
- android_rvh_mmc_sd_dataline_timing

If you're using functions that don't sleep, then use vendor hooks.
- android_vh_mmc_update_partition_status
- android_vh_mmc_sd_update_cmdline_timing
- android_vh_mmc_sd_update_dataline_timing

Bug: 242645760
Change-Id: I880436e3159bec30d7d92c620b268ec350e97235
Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
2022-08-19 15:49:31 +00:00
davidwang
fc9630b3cb ANDROID: vendor_hooks: add vendor hook for dma_heap_buffer_alloc
Add android_vh_dmabuf_heap_flags_validation vh for
heap flags with vendor valid check.

Bug: 241733930
Signed-off-by: davidwang <davidwang@realtek.com>
Change-Id: I5c1c111b8231a05f733bc56bda34bc408e708554
2022-08-19 15:19:36 +00:00
Peifeng Li
f729494767 ANDROID: vendor_hook: add hooks to protect locking-tsk in cpu scheduler
Providing vendor hooks to record the start time of holding the lock, which
protects rwsem/mutex locking-process from being preemptedfor a short time
in some cases.

- android_vh_record_mutex_lock_starttime
- android_vh_record_rtmutex_lock_starttime
- android_vh_record_rwsem_lock_starttime
- android_vh_record_percpu_rwsem_lock_starttime

Bug: 241191475

Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0e967a1e8b77c32a1ad588acd54028fae2f90c4e
2022-08-19 09:26:28 +00:00
Peifeng Li
309a6bf81a ANDROID: vendor_hook: Add hook to not be stuck ro rmap lock in kswapd or direct_reclaim
Add hooks to support trylock in rmaplock when reclaiming in kswapd or
direct_reclaim, in order to avoid wait lock for a long time.

- android_vh_handle_failed_page_trylock
- android_vh_page_trylock_set
- android_vh_page_trylock_clear
- android_vh_page_trylock_get_result
- android_vh_do_page_trylock

Bug: 240003372

Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0f605b35ae41f15b3ca7bc72cd5f003175c318a5
2022-08-16 15:13:18 +08:00
heshuai1
2487db8d59 ANDROID: freezer: Add vendor hook to freezer for GKI purpose.
Add the vendor hook to freezer.c, because of some special cases related to our feature, we do not want the process to be frozen immediately, so we add the hook at __refrigerator to make sure we can go to our own freeze logic when the process is about to be frozen.

Bug: 187458531

Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Change-Id: Iea42fd9604d6b33ccd6502425416f0dd28eecebb
(cherry picked from commit a1580311c36ca28344b2f03b3c8a72d9f8db5bde)
2022-08-15 18:32:23 +00:00
heshuai1
9ac0923ef5 ANDROID: user: Add vendor hook to user for GKI purpose
Add the vendor hook to user.c, because of some speical cases related to
our feature, we need to initialize the variables defined by ourselves in
user_struct, so we add the hook at alloc_uid to make sure we can go to
our own logic when the user_struct is about to initialize.

Bug: 187458531

Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Change-Id: I078484aac2c3d396aba5971d6d0f491652f3781c
(cherry picked from commit c9b8fa644f45e9c99da85d8947f6c7e06771f205)
2022-08-15 18:19:32 +00:00
Zhenxiong Lai
6349c3bbd5 ANDROID: GKI: add vendor hook to support emmc FFU
We need this vendor hook to support emmc FFU. Avoid init card fail
due to changes in PRV of cid in the new firmware.

Bug: 241854943
Change-Id: Ib92105264daabedcb68aa99d0b4c0d45b5b741b1
Signed-off-by: Zhenxiong Lai <zhenxiong.lai@unisoc.com>
2022-08-12 19:28:51 +00:00
Peifeng Li
ce8b55bb08 ANDROID: vendor_hooks: protect multi-mapcount pages in kernel
Support two hooks as follows to protect multi-mapcount pages in kernel:

- trace_android_vh_page_should_be_protect
- trace_android_vh_mapped_page_try_sorthead

Bug: 236578020
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I688aceabf17d9de2feac7c3ad7144d307de6ef29
2022-08-10 04:38:19 +00:00
Peifeng Li
efbe140e82 ANDROID: vendor_hooks: account page-mapcount
Support five hooks as follows to account
the amount of multi-mapped pages in kernel:

- android_vh_show_mapcount_pages
- android_vh_do_traversal_lruvec
- android_vh_update_page_mapcount
- android_vh_add_page_to_lrulist
- android_vh_del_page_from_lrulist

Bug: 236578020
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Ia2c7015aab442be7dbb496b8b630b9dff59ab935
2022-08-10 04:38:06 +00:00
Eric Biggers
60714690fe ANDROID: scsi: ufs: add vendor hook to override key reprogramming
Some hardware has a way to restore all keyslots at once that is
significantly faster than restoring each keyslot individually, as is
done by blk_ksm_reprogram_all_keys().  Add a hook
"android_rvh_ufs_reprogram_all_keys" that allows overriding the
restoration of all keyslots after UFS reset.  This may sleep, so this
must be a "restricted" Android vendor hook rather than a regular one.

Note that currently this functionality can't be upstreamed, as support
for the hardware that needs it would need to be upstreamed first.

(cherry picked from commit e2e063f5074e2e14a96875e5e5670314a41e1c34)

Bug: 162257402
Bug: 181905172
Bug: 241106918
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Kenny Root <kroot@google.com>
Change-Id: I0b25393a5131941f085892560e08a64e63cd1369
2022-08-04 16:29:33 +00:00
Rick Yiu
d66cc0913f ANDROID: sched: Add vendor hook for rt util update
Vendor may have need to track rt util.

Bug: 201261299
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: I2f4e5142c6bc8574ee3558042e1fb0dae13b702d
2022-08-01 20:51:13 +00:00
Rick Yiu
eb994f2728 ANDROID: sched: Add vendor hook for util-update related functions
Vendor may have the need to implement their own util tracking.

Bug: 201260585
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: I973902e6ff82a85ecd029ac5a78692d629df1ebe
2022-08-01 20:51:13 +00:00
Darren Hsu
9204c086fe ANDROID: power: add a vendor hook to log unfrozen tasks
We recently noticed an issue where freezing of user space tasks is
failed due to a process being in uninterruptible sleep state.
Currently, the logging of unfrozen tasks is disabled by default.
Although it can be enabled for debugging via a adb command, it's
usually hard to reproduce the issue. So we want to add a vendor hook
to log unfrozen tasks.

pm_debug_messages enables a large amount of log output during every
suspend/resume cycle of which at most 1 line is helpful for
investigating this recurring class of battery life issues. Deploying
builds with pm_debug_messages is therefore not viable, as it
substantially shortens the temporal span of the log. The new vendor
hook will only emit logs specific to this class of problem, and only
when the problem actually manifests.

Bug: 240091483
Test: all presubmit tests passed
Change-Id: Ief3d4196ea7220d4897c00a37ab96f456dbf2259
Signed-off-by: Darren Hsu <darrenhsu@google.com>
(cherry picked from commit 3821e5b25c4067d2263bc47c674fde57a17cf7c4)
2022-08-01 20:47:29 +00:00
Wenchao Chen
a8c1d81605 ANDROID: GKI: add vendor hook for sd
Modify the timing of cmd line and data line in HS mode to improve the compatibility of SD cards that only support HS mode.

Bug: 240510879
Change-Id: Ia1c98845f63b4b051d0b1db80856ee98dc5da8c1
Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
2022-07-28 15:36:32 +00:00