Commit Graph

185 Commits

Author SHA1 Message Date
Stephen Dickey
40bcf12c6b ANDROID: sched: vendor hook for sched_getaffinity
Just as sched_getaffinity updates the affinity based upon the
active_mask, the vendor hook needs to be able to constrain
the task's affinity.

Introduce a hook to sched_getaffinity such that vendor modules
are able to update the affinity.

Bug: 229133948
Change-Id: I5c501e9204d4fcc6688f675a41be60ef5a2d1075
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-04-20 00:30:01 +00:00
Abhijeet Dharmapurikar
fad13230ac ANDROID: sched: create trace points for 32bit execve
Module code would like to hold some locks when affinity is being updated
for 32 bit task exec.

Create pre and post tracepoints in force_compatible_cpus_allowed_ptr()

Bug: 187917024
Change-Id: I95bff9f4d5b5d37c1d5440acbd6857d2855c2b43
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-04-19 22:23:21 +00:00
Gaofeng Sheng
8879650556 ANDROID: GKI: dma-buf: add vendor hook for dma_buf_release
The main function is to check whether the corresponding IOMMU buffer
is unmapped when dmabuf is released, so as to avoid memory coverage
caused by IOMMU.

Bug: 229552121
Change-Id: I56ae3f0994cd4f3d24494b7972e4d89d0f004da8
Signed-off-by: Gaofeng Sheng <gaofeng.sheng@unisoc.com>
2022-04-19 05:39:15 +00:00
Xiaopeng Bai
53e342c183 ANDROID: GKI: regmap: Add regmap vendor hook for of_syscon_register
For global registers access, UNISOC have one special method called set/clear
mechanism that would avoid using hardware spinlock. But now regmap framework
does not support our set/clear mechanism, so add vendor hook to support
this feature.

Bug: 228907258
Signed-off-by: Xiaopeng Bai <xiaopeng.bai@unisoc.com>
Change-Id: I9a6651f07a048ffebd5c2d8e369a4e7b374bc182
2022-04-19 08:57:22 +08:00
Yunxian He
0e10f65fa9 ANDROID: usb: Add vendor hook when core detect a new device
Add vendor hook when core detect a new device. Vendor side
can use this hook to do several things. Our Unisoc ASIC had
some drawback. most scene, we use DWC3 controller and
associated PHY, when digital headset plug in, we need end the
enumeration and switch to another controller and phy. Using this
hook, we can do the switch easily and efficiently.

Bug: 229330749
Change-Id: I1cba28b43ff1b1f5ac0138c0bb743f3d8e9f1e4b
Signed-off-by: Yunxian He <yunxian.he@unisoc.com>
2022-04-15 18:54:33 +08:00
Jack Pham
982c7ee3e3 ANDROID: sound: usb: Add vendor hooks for connect & disconnect
Add vendor hooks to capture when a USB audio interface is probed
and disconnected.  These will allow for supporting offloading of
audio device handling to a co-processor.

The disconnect hook needs to be restricted as the additional
vendor handling may need to perform operations (such as
wait_for_completion) in non-atomic context.

Bug: 224904393
Change-Id: Idf1da95556814e0ffbdc5f9fb5a25563ebee9be2
Signed-off-by: Jack Pham <quic_jackp@quicinc.com>
2022-04-08 15:28:33 -07:00
Di Shen
12b8ef18b2 ANDROID: thermal: Add vendor hook to get thermal zone device
Need to get temperature data and config info from thermal zone device.

Bug: 208946028

Signed-off-by: Di Shen <di.shen@unisoc.com>
Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Change-Id: I5945df5258181b4a441b6bbe09327099491418b3
(cherry picked from commit c53f0e3530641d6b696bae12eed55c58599ab516)
2022-04-08 18:46:55 +00:00
Jeson Gao
fbe6f8708d ANDROID: thermal: Add hook for cpufreq thermal
Add hook to get cpufreq policy data after registering and unregistering
cpufreq thermal for platform thermal requirement.

Bug: 228423762

Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Change-Id: I9c6bc88f348f252c428560427bd8bca91092edfa
2022-04-08 15:20:47 +00:00
Gaofeng Sheng
7b084e6135 ANDROID: GKI: drm: add vendor hook for drm_atomic_helper_check_modeset
Just mode changed no need to display previous planes. Deleted by SPRD
for HWC SR function. There is no need to add all old planes for sprd drm
according to plane mask. Because the dpu driver will display extra
planes which reduce display abnormal.

Bug: 227721498
Signed-off-by: Gaofeng Sheng <gaofeng.sheng@unisoc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Change-Id: I47048e430d2b2605b9111b6c9ee4958443dc7239
2022-04-07 23:11:29 +00:00
Gaofeng Sheng
a63a546b89 ANDROID: GKI: drm: add vendor hook for atomic_remove_fb
Deleted by SPRD for HWC performance. There is no need to
disable old planes for sprd drm. Because the dpu driver
will clean all the planes first before flip each time.

Bug: 227721498
Signed-off-by: Gaofeng Sheng <gaofeng.sheng@unisoc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Change-Id: I81275ae86064d0b30163be17bce266120c90b130
2022-04-07 20:37:32 +00:00
Wei.Chen
7c380c0057 ANDROID: Add vendor hook to support audio usb offload
android_vh_audio_usb_offload_vendor_set:
	To set vendor data, used in sound/usb/card.c
android_vh_audio_usb_offload_ep_action:
	To start/stop offload ep, used in sound/usb/endpoiont.c
android_vh_audio_usb_offload_synctype:
	To ignore specific synctype usb device, used in sound/usb/pcm.c

Bug: 228276284
Test: build pass

Signed-off-by: Wei Chen <wei.chen3@unisoc.com>
Change-Id: I121ece1fee1934366c0b3b91b4f035ffac35d555
2022-04-07 19:30:41 +00:00
Saravana Kannan
0ef21e1c1a ANDROID: vendor_hooks: Reduce pointless modversions CRC churn
When vendor hooks are added to a file that previously didn't have any
vendor hooks, we end up indirectly including linux/tracepoint.h.  This
causes some data types that used to be opaque (forward declared) to the
code to become visible to the code.

Modversions correctly catches this change in visibility, but we don't
really care about the data types made visible when linux/tracepoint.h is
included. So, hide this from modversions in the central vendor_hooks.h file
instead of having to fix this on a case by case basis.

This change itself will cause a one time CRC breakage/churn because it's
fixing the existing vendor hook headers, but should reduce unnecessary CRC
churns in the future.

To avoid future pointless CRC churn, vendor hook header files that include
vendor_hooks.h should not include linux/tracepoint.h directly.

Bug: 227513263
Bug: 226140073
Signed-off-by: Saravana Kannan <saravanak@google.com>
Change-Id: Ia88e6af11dd94fe475c464eb30a6e5e1e24c938b
2022-04-06 08:31:36 -07:00
Charan Teja Reddy
d831f07038 ANDROID: vmscan: Support multiple kswapd threads per node
Page replacement is handled in the Linux Kernel in one of two ways:

1) Asynchronously via kswapd
2) Synchronously, via direct reclaim

At page allocation time the allocating task is immediately given a page
from the zone free list allowing it to go right back to work doing
whatever it was doing; Probably directly or indirectly executing business
logic.

Just prior to satisfying the allocation, free pages is checked to see if
it has reached the zone low watermark and if so, kswapd is awakened.
Kswapd will start scanning pages looking for inactive pages to evict to
make room for new page allocations. The work of kswapd allows tasks to
continue allocating memory from their respective zone free list without
incurring any delay.

When the demand for free pages exceeds the rate that kswapd tasks can
supply them, page allocation works differently. Once the allocating task
finds that the number of free pages is at or below the zone min watermark,
the task will no longer pull pages from the free list. Instead, the task
will run the same CPU-bound routines as kswapd to satisfy its own
allocation by scanning and evicting pages. This is called a direct reclaim.

The time spent performing a direct reclaim can be substantial, often
taking tens to hundreds of milliseconds for small order0 allocations to
half a second or more for order9 huge-page allocations. In fact, kswapd is
not actually required on a linux system. It exists for the sole purpose of
optimizing performance by preventing direct reclaims.

When memory shortfall is sufficient to trigger direct reclaims, they can
occur in any task that is running on the system. A single aggressive
memory allocating task can set the stage for collateral damage to occur in
small tasks that rarely allocate additional memory. Consider the impact of
injecting an additional 100ms of latency when nscd allocates memory to
facilitate caching of a DNS query.

The presence of direct reclaims 10 years ago was a fairly reliable
indicator that too much was being asked of a Linux system. Kswapd was
likely wasting time scanning pages that were ineligible for eviction.
Adding RAM or reducing the working set size would usually make the problem
go away. Since then hardware has evolved to bring a new struggle for
kswapd. Storage speeds have increased by orders of magnitude while CPU
clock speeds stayed the same or even slowed down in exchange for more
cores per package. This presents a throughput problem for a single
threaded kswapd that will get worse with each generation of new hardware.

Test Details

NOTE: The tests below were run with shadow entries disabled. See the
associated patch and cover letter for details

The tests below were designed with the assumption that a kswapd bottleneck
is best demonstrated using filesystem reads. This way, the inactive list
will be full of clean pages, simplifying the analysis and allowing kswapd
to achieve the highest possible steal rate. Maximum steal rates for kswapd
are likely to be the same or lower for any other mix of page types on the
system.

Tests were run on a 2U Oracle X7-2L with 52 Intel Xeon Skylake 2GHz cores,
756GB of RAM and 8 x 3.6 TB NVMe Solid State Disk drives. Each drive has
an XFS file system mounted separately as /d0 through /d7. SSD drives
require multiple concurrent streams to show their potential, so I created
eleven 250GB zero-filled files on each drive so that I could test with
parallel reads.

The test script runs in multiple stages. At each stage, the number of dd
tasks run concurrently is increased by 2. I did not include all of the
test output for brevity.

During each stage dd tasks are launched to read from each drive in a round
robin fashion until the specified number of tasks for the stage has been
reached. Then iostat, vmstat and top are started in the background with 10
second intervals. After five minutes, all of the dd tasks are killed and
the iostat, vmstat and top output is parsed in order to report the
following:

CPU consumption
- sy - aggregate kernel mode CPU consumption from vmstat output. The value
       doesn't tend to fluctuate much so I just grab the highest value.
       Each sample is averaged over 10 seconds
- dd_cpu - for all of the dd tasks averaged across the top samples since
           there is a lot of variation.

Throughput
- in Kbytes
- Command is iostat -x -d 10 -g total

This first test performs reads using O_DIRECT in order to show the maximum
throughput that can be obtained using these drives. It also demonstrates
how rapidly throughput scales as the number of dd tasks are increased.

The dd command for this test looks like this:

Command Used: dd iflag=direct if=/d${i}/$n of=/dev/null bs=4M

Test #1: Direct IO
dd sy dd_cpu throughput
6  0  2.33   14726026.40
10 1  2.95   19954974.80
16 1  2.63   24419689.30
22 1  2.63   25430303.20
28 1  2.91   26026513.20
34 1  2.53   26178618.00
40 1  2.18   26239229.20
46 1  1.91   26250550.40
52 1  1.69   26251845.60
58 1  1.54   26253205.60
64 1  1.43   26253780.80
70 1  1.31   26254154.80
76 1  1.21   26253660.80
82 1  1.12   26254214.80
88 1  1.07   26253770.00
90 1  1.04   26252406.40

Throughput was close to peak with only 22 dd tasks. Very little system CPU
was consumed as expected as the drives DMA directly into the user address
space when using direct IO.

In this next test, the iflag=direct option is removed and we only run the
test until the pgscan_kswapd from /proc/vmstat starts to increment. At
that point metrics are parsed and reported and the pagecache contents are
dropped prior to the next test. Lather, rinse, repeat.

Test #2: standard file system IO, no page replacement
dd sy dd_cpu throughput
6  2  28.78  5134316.40
10 3  31.40  8051218.40
16 5  34.73  11438106.80
22 7  33.65  14140596.40
28 8  31.24  16393455.20
34 10 29.88  18219463.60
40 11 28.33  19644159.60
46 11 25.05  20802497.60
52 13 26.92  22092370.00
58 13 23.29  22884881.20
64 14 23.12  23452248.80
70 15 22.40  23916468.00
76 16 22.06  24328737.20
82 17 20.97  24718693.20
88 16 18.57  25149404.40
90 16 18.31  25245565.60

Each read has to pause after the buffer in kernel space is populated while
those pages are added to the pagecache and copied into the user address
space. For this reason, more parallel streams are required to achieve peak
throughput. The copy operation consumes substantially more CPU than direct
IO as expected.

The next test measures throughput after kswapd starts running. This is the
same test only we wait for kswapd to wake up before we start collecting
metrics. The script actually keeps track of a few things that were not
mentioned earlier. It tracks direct reclaims and page scans by watching
the metrics in /proc/vmstat. CPU consumption for kswapd is tracked the
same way it is tracked for dd.

Since the test is 100% reads, you can assume that the page steal rate for
kswapd and direct reclaims is almost identical to the scan rate.

Test #3: 1 kswapd thread per node
dd sy dd_cpu kswapd0 kswapd1 throughput  dr    pgscan_kswapd pgscan_direct
10 4  26.07  28.56   27.03   7355924.40  0     459316976     0
16 7  34.94  69.33   69.66   10867895.20 0     872661643     0
22 10 36.03  93.99   99.33   13130613.60 489   1037654473    11268334
28 10 30.34  95.90   98.60   14601509.60 671   1182591373    15429142
34 14 34.77  97.50   99.23   16468012.00 10850 1069005644    249839515
40 17 36.32  91.49   97.11   17335987.60 18903 975417728     434467710
46 19 38.40  90.54   91.61   17705394.40 25369 855737040     582427973
52 22 40.88  83.97   83.70   17607680.40 31250 709532935     724282458
58 25 40.89  82.19   80.14   17976905.60 35060 657796473     804117540
64 28 41.77  73.49   75.20   18001910.00 39073 561813658     895289337
70 33 45.51  63.78   64.39   17061897.20 44523 379465571     1020726436
76 36 46.95  57.96   60.32   16964459.60 47717 291299464     1093172384
82 39 47.16  55.43   56.16   16949956.00 49479 247071062     1134163008
88 42 47.41  53.75   47.62   16930911.20 51521 195449924     1180442208
90 43 47.18  51.40   50.59   16864428.00 51618 190758156     1183203901

In the previous test where kswapd was not involved, the system-wide kernel
mode CPU consumption with 90 dd tasks was 16%. In this test CPU consumption
with 90 tasks is at 43%. With 52 cores, and two kswapd tasks (one per NUMA
node), kswapd can only be responsible for a little over 4% of the increase.
The rest is likely caused by 51,618 direct reclaims that scanned 1.2
billion pages over the five minute time period of the test.

Same test, more kswapd tasks:

Test #4: 4 kswapd threads per node
dd sy dd_cpu kswapd0 kswapd1 throughput  dr    pgscan_kswapd pgscan_direct
10 5  27.09  16.65   14.17   7842605.60  0     459105291     0
16 10 37.12  26.02   24.85   11352920.40 15    920527796     358515
22 11 36.94  37.13   35.82   13771869.60 0     1132169011     0
28 13 35.23  48.43   46.86   16089746.00 0     1312902070     0
34 15 33.37  53.02   55.69   18314856.40 0     1476169080     0
40 19 35.90  69.60   64.41   19836126.80 0     1629999149     0
46 22 36.82  88.55   57.20   20740216.40 0     1708478106     0
52 24 34.38  93.76   68.34   21758352.00 0     1794055559     0
58 24 30.51  79.20   82.33   22735594.00 0     1872794397     0
64 26 30.21  97.12   76.73   23302203.60 176   1916593721     4206821
70 33 32.92  92.91   92.87   23776588.00 3575  1817685086     85574159
76 37 31.62  91.20   89.83   24308196.80 4752  1812262569     113981763
82 29 25.53  93.23   92.33   24802791.20 306   2032093122     7350704
88 43 37.12  76.18   77.01   25145694.40 20310 1253204719     487048202
90 42 38.56  73.90   74.57   22516787.60 22774 1193637495     545463615

By increasing the number of kswapd threads, throughput increased by ~50%
while kernel mode CPU utilization decreased or stayed the same, likely due
to a decrease in the number of parallel tasks at any given time doing page
replacement.

Signed-off-by: Buddy Lumpkin <buddy.lumpkin@oracle.com>
Bug: 201263306
Link: https://lore.kernel.org/lkml/1522661062-39745-1-git-send-email-buddy.lumpkin@oracle.com
[charante@codeaurora.org]: Changes made to select number of kswapds through uapi
Change-Id: I8425cab7f40cbeaf65af0ea118c1a9ac7da0930e
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
[quic_vjitta@quicinc.com]: Changes made to move multiple kswapd threads logic to vendor hooks
Signed-off-by: Vijayanand Jitta <quic_vjitta@quicinc.com>
(cherry picked from commit 0d61a651e4)
2022-04-06 08:31:35 -07:00
weidong guan
5168caa32a ANDROID: Add vendor hook for tk_based_time_sync
android_rvh_tk_based_time_sync:
	to get vendor-specific time sync func

Bug: 223950152
Test: build pass

Signed-off-by: weidong guan <weidong.guan@unisoc.com>
Change-Id: I4c540e077668bff548c55d4afba3a7bd6725497e
2022-04-06 08:31:30 -07:00
Jeson Gao
97a290b0e5 ANDROID: thermal: Add vendor hook to check power range
For SoC's skin temperature, we have to use more stringent temperature
control to make IPA can monitor and mitigate temperature control earlier
and faster, so add it to meet platform thermal requirement.

Bug: 211564753

Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Signed-off-by: Di Shen <di.shen@unisoc.com>
Change-Id: Iaef87287eef93d6fdbc3c58c93f70c1525e38296
(cherry picked from commit 6709f523251f77dc1e9ea643668c630db1f7db80)
2022-04-01 17:16:02 +00:00
Xuewen Yan
c6fb9f6636 ANDROID: Add vendor hook to the effective_cpu_util
android_rvh_effective_cpu_util:
	To perform vendor-specific cpu util, it is used in EAS/schedutil/thermal.

The effective_cpu_util would be called when thermal calc the dynamic power,
it's non-atomic context, so set the hook be restricted.

Bug: 226686099
Test: build pass

Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
Change-Id: I6fd77f44ca4328f5ef37d96989aa2e08d65e29bb
2022-04-01 17:12:18 +00:00
Liujie Xie
d5aece2586 ANDROID: vendor_hooks: Add hooks for frequency optimization
These hooks will do the following works:
a) Record the number of times when target_freq being clamped
b) Record the number of times when target_freq is greater than policy->cur
c) Make corresponding optimization strategies in different hooks
d) change the value of target_freq for some scenarios

Bug: 205906618
Bug: 206896672

Change-Id: I8eba66fd0c6d36393ca39045cf228b659834e0ae
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: vincent.wang <vincent.wang@unisoc.com>
(cherry picked from commit 7e2fbdaeab)
(cherry picked from commit cf551f380a3c47894accfffc2c8b3d4547a60f9a)
2022-03-24 15:49:56 +00:00
JianMin Liu
46dfaf84ab ANDROID: rwsem: Add vendor hook to the rw-semaphore
Add the hook to apply vendor's performance tune for owner
of rwsem.

Add the hook for the waiter list of rwsem to allow
vendor perform waiting queue enhancement

ANDROID_VENDOR_DATA added to rw_semaphore

Bug: 222402411

Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
Signed-off-by: Jino Hsu <jino.hsu@mediatek.com>
Change-Id: I007a5e26f3db2adaeaf4e5ccea414ce7abfa83b8
2022-03-23 11:32:20 -07:00
Jeson Gao
78c7e3132d ANDROID: thermal: Add hook to enable/disable thermal power throttle
By default, thermal power throttle is always enable, but sometimes it
need to be disabled for a period of time, so add it to meet platform
thermal requirement.

Bug: 209386157

Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Change-Id: If9c53a9669eec8e2821d837cfa3c660a9cfbf934
(cherry picked from commit 64999249d5fecc79805fd799bdf71bc5b554efc1)
2022-03-21 14:21:33 +08:00
Elliot Berman
a7e175e112 ANDROID: rproc: Add vendor hook when setting recovery mode
Add vendor hook when setting recovery mode to notify coprocessor when
mode is changed.

Bug: 205534894
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Change-Id: Ie41170deb0426a7bcfeed8a51cc4e8e1a427592a
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
2022-03-18 18:49:01 +00:00
Jeson Gao
11f1be4453 ANDROID: thermal: Add vendor hooks for thermal
Need to get the request frequency and target frequency
use it to do frequency check and modify it according to
the platform thermal requirements.

Bug: 208166320

Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Change-Id: I776b43c8f559b8a072abd8d3abcb3528348b2c5d
(cherry picked from commit fc827b344f76709dc7f242c7db32e1828f510fdd)
2022-03-17 02:58:54 +00:00
Xuewen Yan
74710cbec0 ANDROID: Add vendor hook to the deadline scheduler
android_rvh_select_task_rq_dl:
    To perform vendor-specific DL task placement.

Bug: 207585485
Test: build pass

Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
Change-Id: Ibe147276b52a1be877802a2e53e87ba3eb8c9161
(cherry picked from commit 478f3ee1d3e5be03ecd3603643abfc1186468881)
2022-03-16 14:10:39 +08:00
Ard Biesheuvel
b6180f8b81 ANDROID: crypto: lib/aes - add vendor hooks for AES library routines
Add vendor hooks that will allow the FIPS140 kernel module to override
the implementations of the AES library routines. The FIPS 140 versions
are identical to the normal ones, but their code and rodata will have been
integrity checked at module load time.

Bug: 153614920
Bug: 188620248
Change-Id: I5711fc42eced903565fd3c8d41ca7cdd82641148
Signed-off-by: Ard Biesheuvel <ardb@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-03-15 21:24:21 +00:00
Ard Biesheuvel
e9a7155221 ANDROID: crypto: lib/sha256 - add vendor hook for sha256() routine
Add a vendor hook that will allow the FIPS140 kernel module to override
the implementation of the sha256() library routine. The FIPS 140 version
is identical to the normal one, but its code and rodata will have been
integrity checked at module load time.

Bug: 153614920
Bug: 188620248
Change-Id: I8ccc4f0cc8206af39fa922134b438dacac2a614a
Signed-off-by: Ard Biesheuvel <ardb@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-03-15 21:24:21 +00:00
Sangmoon Kim
102255d1e4 ANDROID: arm64: add vendor hooks for unusal abort cases
Add hooks to gather data of unsual aborts and summarize it with
other information.

Bug: 222638752

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I74eb36b8551ed9a5e6dc87507939a7f4d81c9c18
2022-03-15 14:23:51 +09:00
Sangmoon Kim
61d7b6c741 ANDROID: arm64: add vendor hooks for kernel fault cases
Add hooks to gather data of kernel fault and summarize it with
other information.

Bug: 222638752

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I7d6a66837f2e896a413bd8d878f26928669d96e6
2022-03-15 14:23:51 +09:00
Sangmoon Kim
2232e3fc85 ANDROID: power: add vendor hooks for try_to_freeze fail
Add hooks to gather data of unfrozen tasks and summarize it
with other information.

Bug: 222638752

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I61da3d253bd9959c6f06e09c9a35c4b242cedafe
2022-03-15 11:18:09 +09:00
Sangmoon Kim
5cc613a916 ANDROID: softlockup: add vendor hook for a softlockup task
Add hook to gather data of softlockup and summarize it with
other information.

Bug: 222638752

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I5263bbd573c3fa4b4c981ac26c943721ce09506d
2022-03-15 11:18:09 +09:00
Sangmoon Kim
ba7e9d1a77 ANDROID: bug: add vendor hook for bug trap
Add hook to gather data of bug trap and summarize it with other
information.

Bug: 222638752

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I1f347c20629786f9bf0b9c50c7f96b50b4360504
2022-03-15 11:18:09 +09:00
Ben Dai
307ad9fb59 ANDROID: printk: add vendor hook to record more information about caller
With these hooks, printk can provide more information, such as the
processor ID.

Bug: 223302138
Signed-off-by: Ben Dai <ben.dai@unisoc.com>
Change-Id: Iac60ffd49640d8badf5c5dd446c211d37bbbc6a6
2022-03-14 14:30:51 +00:00
Namkyu Kim
f79e49085d ANDROID: Add a vendor hook that allow a module to modify the wake flag
android_vh_do_wake_up_sync:
  To modify the mode value of __wake_up_sync_key

 android_vh_set_wake_flags:
  To modify the wake flag from a module

Bug: 181743516
Signed-off-by: Namkyu Kim <namkyu78.kim@samsung.com>
Change-Id: I972e2469c3f139373d21f1e8c85974763388a693
(cherry picked from commit 97368fc2dc)
(cherry picked from commit 0d0f0c5020bc425c9a51c8d17b16ca831c2598fb)
2022-02-19 17:08:19 +00:00
Rick Yiu
97d6c580df ANDROID: sched: Add trace for __setscheduler_uclamp
To know per-task uclamp request.

Bug: 191973176
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: Ibd40391f2228db5daa410198339237879e67a078
Signed-off-by: Will McVicker <willmcvicker@google.com>
2022-02-08 11:33:22 -08:00
Rick Yiu
265615cfd3 ANDROID: sched: Add vendor hook for util_est_update
Vendor may have its own estimated utilization.

Bug: 170508405
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: I6055907de75ace4586c3ad854d40f42e3bf40147
Signed-off-by: Will McVicker <willmcvicker@google.com>
2022-02-08 11:33:22 -08:00
Rick Yiu
abf44714df ANDROID: sched: Add vendor hook for uclamp_eff_get
Vendor may have their own behavior for determing uclamp value. Also
uclamp_eff_get() is used in uclamp_rq_inc_id() when task is enqueued,
and it is contained in uclamp_eff_value(), there is no much benefit to
hook uclamp_eff_value(), so remove the hook in uclamp_eff_value().

Bug: 170507972
Bug: 180859906
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: Ibf7c043188a77c40baf5b4040b198a4197236089
Signed-off-by: Will McVicker <willmcvicker@google.com>
2022-02-08 11:33:22 -08:00
Rick Yiu
87475cbbe1 ANDROID: sched: Add vendor hook for cpu_overutilized
Currently, cpu_overutilized uses the threshold 80% of cpu capacity, Add
vendor hook so that vendor could define other values.

Bug: 176722431
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: Ic10bd8ebb40f7321cfa10e33ac020e3347ca6550
(cherry picked from commit b199c6e8795791e008cfff6e214676857cd0651c)
Signed-off-by: J. Avila <elavila@google.com>
(cherry picked from commit f5998fbf2d)
2022-02-08 11:33:21 -08:00
Georgi Djakov
2ab4227174 ANDROID: qcom: iommu: Use restricted vendor hook for dma ops
Use rvh instead of vh for the iommu_setup_dma_ops to prevent
sleeping while atomic bugs as mutexes are used to serialize
access to iova regions.

Bug: 216657571
Change-Id: If90d0714576ed6ca4b014b1447a1518f05a7ed0b
Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com>
2022-02-01 17:44:12 +00:00
Huang Yiwei
88c67dcda4 ANDROID: hung_task: Add vendor hook for hung task detect
Add vendor hook for hung task detect, so we can decide which
threads need to check, avoiding false alarms.

Bug: 188684133
Change-Id: I5d7dfeb071cbfda8121134c38a458202aaa3a8c6
Signed-off-by: Huang Yiwei <hyiwei@codeaurora.org>
Signed-off-by: Vamsi Krishna Lanka <quic_vamslank@quicinc.com>
2022-01-31 17:38:45 +00:00
Prakash Gupta
4d7fc7aaec ANDROID: mm, oom: add vendor hook to prevent oom panic
In some cases we would like to bypass oom panic and give the system more
time to cleanup memory. Add vendor hook to allow skipping the oom panic.

Bug: 186875166
Change-Id: I64e74b2c013d6f18d74504777c6559d9ae07e008
Signed-off-by: Prakash Gupta <guptap@codeaurora.org>
Signed-off-by: Sudarshan Rajagopalan <quic_sudaraja@quicinc.com>
2022-01-25 23:20:59 +00:00
Gokul krishna Krishnakumar
24bfd162f9 ANDROID: rproc: Add vendor hook for recovery
Add vendor hook for rproc recovery to allow vendor enhancements.

Bug: 215224270
Change-Id: If6f0846c141a4ad40748d552002f65b94d9c52d5
Signed-off-by: Siddharth Gupta <quic_sidgup@quicinc.com>
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
2022-01-25 19:16:52 +00:00
Sangmoon Kim
b35a3d1bad ANDROID: Re-apply vendor hooks for rt_mutex information of blocked tasks
This reverts commit bf2290a48a (Revert "ANDROID: vendor_hooks: set
debugging data when rt_mutex is working")

The original patch has been reverted to resolve merge issues.
This patch adds again the vendor hooks for the original purpose.

Bug: 216016261

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I00162d88e2a446e9ece4804def098fcdc63fceb9
(cherry picked from commit d497887b00ac3e5e380123cac4a303d009b570ee)
2022-01-25 12:05:42 +09:00
Sangmoon Kim
3aabda4d52 ANDROID: Re-apply vendor hooks for information of blocked tasks
This reverts commit 31c9ccb138 (Revert "ANDROID: vendor_hooks: add
waiting information for blocked tasks")

And also revert portions of 396a501b1743 (Revert "ANDROID: rwsem: Add
vendor hook to the rw-semaphore")

The original patch has been reverted to resolve merge issues.
This patch adds again the vendor hooks for the original purpose.

Bug: 216016261

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I04ed7b055eee40f7975bd5d74fb73dd080cd76bf
(cherry picked from commit c23da05eac0d35441695caff0b7d0220f92ca8a0)
2022-01-25 12:04:38 +09:00
Stephen Dickey
1050e6e021 ANDROID: sched: core: hook for get_nohz_timer_target
Allow module to control behavior of get_nohz_timer_target.

Bug: 205164003
Change-Id: I38cb201ebf06db7bbce0d6cb68dbbe3729355be8
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-01-24 19:25:26 +00:00
Stephen Dickey
a243208877 ANDROID: kernel: sched: tracehook for is_cpu_allowed
To support the replacement of pause, is_cpu_allowed is the best
place to hook into the code to restrict CPUs for a module based
implementation. This restricts select_fallback_rq, select_task_rq,
and __migate_task, to ensure the cpu is allowed.

Include a hook in is_cpu_allowed to allow the module to control
which cpu is allowed during a migration event.

Bug: 205164003
Change-Id: I665e4d39318079bdb99bd248969ecb9eb528f9df
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-01-24 19:25:13 +00:00
Hajun Sung
9c25e5d6f5 ANDROID: gic: Add vendor hook to GIC
Add vendor hook for affinity setting to GIC irqchip driver.

GIC irqchip driver support only single CPU for affinity setting.
But GIC HW can support multi target IRQ action, any available CPU can
service IRQ when requested irq arised. This feature is very useful
for some fast irq action required device.
So Add vendor hook to support multi target affinity setting.

Bug: 210559155
Change-Id: If44b2244bb623bf8d4755109a6dca32ac35df795
Signed-off-by: Hajun Sung <hajun.sung@samsung.com>
2022-01-17 08:32:50 +00:00
Choonghoon Park
cabf26b4eb ANDROID: sched: Add vendor hook to select ilb cpu
Add android_rvh_find_new_ilb to select a next ilb cpu for vendors.

Bug: 190228983

Change-Id: Iba1a0cd9cdc22dcf628dd33f8d838fe513a4818f
Signed-off-by: Choonghoon Park <choong.park@samsung.com>
2022-01-10 17:11:39 +00:00
Choonghoon Park
25d620ba79 ANDROID: GKI: sched: add rvh for new cfs task util
A vendor hook is added in post_init_entity_util_avg before
a new cfs task's util is attached to cfs_rq's util so that
vendors can gather and modify se's information to modify
scheduling behavior and DVFS as they want.

trace_android_rvh_new_task_stats is not a proper hook because
it is called after the task's util is attached to cfs_rq's util,
which means updating cfs_rq's sched_avg and DVFS request are done.

Bug: 184219858

Signed-off-by: Choonghoon Park <choong.park@samsung.com>
Change-Id: I2deaa93297f8464895978496c9838cdffaa35b7f
2022-01-10 17:11:30 +00:00
Park Bumgyu
ca6883251a ANDROID: sched: add rvh for rebalance domains
Vendor scheduler may not want to rebalance between domains in some case.
New vendor hook is added for vendor to decide whether rebalance domains.

Bug: 176952463

Change-Id: Ie2edbd4b11679786096dd0170496904ae180583c
Signed-off-by: Park Bumgyu <bumgyu.park@samsung.com>
2022-01-10 17:11:25 +00:00
Tengfei Fan
46161882da ANDROID: sched: add hook point in do_sched_yield()
When a task yields, it relinquishes the cpu and
scheduler is tasked to find another task.
However our vendor scheduler logic implementation
could return the same task leading to a loop where
the yielded task gets to run back, so add hook point
in do_sched_yield() for vendor can do some work
before task is scheduled.

Bug: 205804537
Change-Id: I6528c3f4b0ee360559ef9c97cb1eb2b2d1357870
Signed-off-by: Tengfei Fan <quic_tengfan@quicinc.com>
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2021-12-14 15:21:59 +00:00
Liujie Xie
f4450be6e7 ANDROID: vendor_hooks: Add hooks for improving binder trans
Recognize important binder proc & binder thread and improve their sched
lantency.

Bug: 182952552
Change-Id: I174949bf90a4215a6d27f24abbc7d324a321e662
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2021-12-06 15:14:18 -08:00
Greg Kroah-Hartman
ae4825a553 Revert "ANDROID: rwsem: Add vendor hook to the rw-semaphore"
This reverts commit df18d99dab.

And also revert portions of 9ad8ff902e ("ANDROID: vendor_hooks: add
waiting information for blocked tasks")

In the 5.15.6 kernel release, the rwsem code was reworked such that the
existing Android trace hooks became incorrect and were causing major
merge issues.  Revert the hooks and if they are still needed, they can
be added back later.

Bug: 161400830
Bug: 162776704
Cc: Sangmoon Kim <sangmoon.kim@samsung.com>
Cc: JianMin Liu <jian-min.liu@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ifb3d2ed0bdc73b70718820fbf31e775fedb387c5
2021-12-01 13:17:46 +01:00