Commit Graph

313 Commits

Author SHA1 Message Date
Liujie Xie
8d6074509e ANDROID: vendor_hooks: Add hooks for binder
We want to add some hooks in the binder module so that we can reduce
block time until binder thread is available
Here are what new hooks do for:
1、android_vh_binder_looper_state_registered: choose a binder thread(do proc work) as a low-level thread.Only this thread has power to excute background binder transaction.
2、android_vh_binder_thread_read: let binder thread do works which come from
our list.
3、android_vh_binder_free_proc: free some pointers and variable.
4、android_vh_binder_thread_release: free the list that we create before.
5、android_vh_binder_has_work_ilocked: to check if our list has work.
6、android_vh_binder_read_done: because of we add hook in binder_has_work_ilocked,
7、android_vh_binder_preset: mark target proc's binder threads.
binder_has_work_ilocked may return true, so we try to wake up low-level thread immediately.

Bug: 212483521
Change-Id: Ic40f452cc4dcf8fc85422e23e6f1a7ad77547309
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
2022-06-23 20:50:59 +00:00
Jing-Ting Wu
c4f814c2f3 ANDROID: sched: add vendor hook to set_cpus_allowed
Add new vendor hook when set affinity to detect task status
for performance tuning.

Bug: 236775946
Change-Id: I407637c85e2ea93585877312f090981fee848979
Signed-off-by: Jing-Ting Wu <Jing-Ting.Wu@mediatek.com>
2022-06-23 18:06:57 +00:00
Giuliano Procida
b28706b731 ANDROID: GKI: forward declare struct cgroup_taskset in vendor hooks
The inclusion of the internal kernel/cgroup/cgroup-internal.h header
broke some androidci builds.

Bug: 233047575
Fixes: d5f809c84d ("ANDROID: GKI: use public type definitions in vendor hooks")
Change-Id: Iacca4b8518b9a9c45c927a58621383e66022cb5a
Signed-off-by: Giuliano Procida <gprocida@google.com>
2022-06-23 00:05:23 +00:00
Charan Teja Reddy
561fe20b66 ANDROID: signal: Add vendor hook for memory reaping
Add vendor hook to determine if the memory of a process that received
the SIGKILL can be reaped.

Bug: 189803002
Bug: 236430563
Change-Id: Ie6802b9bf93ddffb0ceef615d7cca40c23219e57
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
Signed-off-by: Isaac J. Manjarres <quic_isaacm@quicinc.com>
2022-06-21 20:43:36 +00:00
Florian Fainelli
8deaa6958e ANDROID: Fix build error with CONFIG_UCLAMP_TASK disabled
After 7b26719a77 ("ANDROID: GKI: use internal type definitions in
vendor hooks") we stopped providing a forward declaration of 'struct
uclamp_se' and instead relied on pulling its definition from
linux/sched.h. the 'uclamp_se' structure is conditionally defined based
upon CONFIG_UCLAMP_TASK therefore causing a build error to show up for
the android_rvh_uclamp_eff_get trace point.

Fix this by providing a forward declaration of 'struct uclamp_se' like
before.

Fixes: 7b26719a77 ("ANDROID: GKI: use internal type definitions in vendor hooks")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Change-Id: Iaa803d149150c1703435f9cfa52ea1406a9521fd
2022-06-21 19:09:01 +00:00
Liujie Xie
f50ef59058 ANDROID: vendor_hooks: add hooks in mem_cgroup subsystem
Add hooks to tune memory policy based on mem_cgroup.

Bug: 192052083

Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: Ica1a5409eed86fbd466edd2c7557f94972a40175
(cherry picked from commit 1cdcf76b1532ca8092bb6601f45d27c1ed19f448)
2022-06-18 13:20:29 -07:00
Neeraj Upadhyay
1c450d2d9e ANDROID: gic-v3: Update vendor hook to set affinity in GIC v3
Update android_rvh_gic_v3_set_affinity vendor hook to pass
redistributor information. This allows configuring affinity
controls in the GIC redistributor space.

Bug: 180471389
Change-Id: I7325fea4338b39b65027e310a0461b7e7d32e6aa
Signed-off-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Signed-off-by: Yogesh Lal <quic_ylal@quicinc.com>
2022-06-18 18:45:00 +00:00
Veerendranath Jakkam
bee631cec5 ANDROID: nl80211/cfg80211: Add support to do API changes after GKI freeze
Reserve sufficient nl80211 attributes in enum nl80211_commands and enum
nl80211_attr to backport upstream UAPI changes.

Reserve data fields for upstream backport changes and vendor hooks.
Also, add vendor hooks to set/get additional info from driver based on
the cfg80211 current context. These APIs can be used to configure/fetch
data of the new params added in upstream cfg80211_op calls.

Ex:
upstream kernel added a new param to existing cfg80211_op "add_key()".
The addtional param info added in the upstream kernel can be configured
using "android_vh_cfg80211_set_context" before calling "add_key".

Bug: 233387627
Change-Id: I99f696ad291ae5965fc6d91bf565cc0c9d423dd5
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
2022-06-18 18:44:19 +00:00
Giuliano Procida
7b26719a77 ANDROID: GKI: use internal type definitions in vendor hooks
This change is intended to reduce the chance of a missed ABI break
involving vendor hooks.

The following types are now fully defined in ABI XML.

* `struct binder_transaction`
* `struct binder_thread`
* `struct binder_proc`
* `struct printk_ringbuffer`
* `struct printk_record`

symbol '__alloc_pages' changed
  CRC changed from 0x6497cbd to 0x230fd8e5

symbol '__find_vma' changed
  CRC changed from 0xf11b619f to 0xb0069a61

symbol '__free_pages' changed
  CRC changed from 0xba5eeb68 to 0xdc394265

... 195 omitted; 198 symbols have only CRC changes

Bug: 233047575
Change-Id: I807227f6161f0a44ec3657dc8cdb8a3fdffc40b3
Signed-off-by: Giuliano Procida <gprocida@google.com>
2022-06-18 18:44:18 +00:00
Giuliano Procida
d5f809c84d ANDROID: GKI: use public type definitions in vendor hooks
This change is intended to reduce the chance of a missed ABI break
involving vendor hooks.

The following type is now fully defined in ABI XML.

* `struct timekeeper`

symbol '__traceiter_android_rvh_account_irq' changed
  CRC changed from 0x18e0dccf to 0x4e82c102

symbol '__traceiter_android_rvh_after_dequeue_task' changed
  CRC changed from 0x7efc419b to 0x1c0066e1

symbol '__traceiter_android_rvh_after_enqueue_task' changed
  CRC changed from 0xd6f0f603 to 0xf7eaafb8

... 75 omitted; 78 symbols have only CRC changes

Bug: 233047575
Change-Id: I8c04eede1b9d9e788abce95cb31dbd19916774ef
Signed-off-by: Giuliano Procida <gprocida@google.com>
2022-06-18 18:44:18 +00:00
rongqianfeng
7a43f1f694 ANDROID: vendor_hooks: add hook and OEM data for slab shrink
Some shrinker add lock in count_objects() may cause lock contention
issues and lead all task stall on slab shrink. Add vendor hook in
do_shrink_slab() for shrinker->count_objects() latency measuring.

Add 3 oem data in shrink_control struct. Two is for
shrinker->count_objects() and shrinker->scan_objects() latency
measuring, other one to store priority, some shrinker know the reclaimer
priority can control the memory reclaim more better.

Bug: 188684131

Change-Id: I80e9d90179bb52a99c54d9a067c6fcee835bb2ad
Signed-off-by: rongqianfeng <rongqianfeng@vivo.com>
2022-06-18 18:44:17 +00:00
Aking Chen
071859b45a ANDROID: mmc: Add vendor hooks
Add vendor hooks to support vendor-specific exception handling features.

Bug: 185083720

Change-Id: I30381ed9835338308f2b03856f510a2982db6e6a
Signed-off-by: Mingli Feng <mingli.feng@vivo.com>
Signed-off-by: Aking Chen <akingchen@vivo.com>
(cherry picked from commit e80bcd46271b80971283b64b4c8298100d1a8737)
Signed-off-by: Aking Chen <akingchen@vivo.corp-partner.google.com>
2022-06-18 18:28:49 +00:00
Vignesh Saravanaperumal
1dc9f51423 ANDROID: GKI: net: add vendor hooks for 'struct sock' lifecycle
Some vendors want to add a field when a 'sruct sock' is added so give a
hook to handle this.  Any memory allocated when
trace_android_rvh_sk_alloc() is called needs to be freed when
trace_android_rvh_sk_free() is called.

Note, if trace_android_rvh_sk_alloc() fails, be sure to be able to
handle this in trace_android_rvh_sk_free(), but that should not be an
issue as that needs to be addressed in vendor code that runs for 'struct
sock' objects that have been created before the vendor code is loaded no
matter what.

Bug: 171013716
Signed-off-by: Vignesh Saravanaperumal <vignesh1.s@samsung.com>
Change-Id: I108a2f31d2dcc228f46159816deee6235afafbbd
2022-06-18 18:28:48 +00:00
Vignesh Saravanaperumal
72c4b4cdad ANDROID: GKI: net: add vendor hooks for 'struct nf_conn' lifecycle
Some vendors want to add a field when a 'sruct nf_conn' is added so give a
hook to handle this.  Any memory allocated when
trace_android_rvh_nf_conn_alloc() is called needs to be freed when
trace_android_rvh_nf_conn_free() is called.

Note, if trace_android_rvh_nf_conn_alloc() fails, be sure to be able to
handle this in trace_android_rvh_nf_conn_free(), but that should not be
an issue as that needs to be addressed in vendor code that runs for
'struct nf_conn' objects that have been created before the vendor code
is loaded no matter what.

Bug: 171013716
Signed-off-by: Vignesh Saravanaperumal <vignesh1.s@samsung.com>
Change-Id: I4d2b025196a3df7ba4adec313c90483811cac728
2022-06-18 18:28:48 +00:00
zhaoyang.huang
ebc5cf22b4 ANDROID: Add vendor hook for MemcgV2 optimization
The associated vendor hooks/data are used for implementing dynamic memory.low protection based on memcgv2.

Bug: 232723420
Test: build pass
Change-Id: I2e92bdc2840af1eaaa08ee6427d2a82d78390005
Signed-off-by: zhaoyang.huang <zhaoyang.huang@unisoc.com>
2022-06-18 18:28:48 +00:00
Eddie Huang
8ee9980737 ANDROID: scsi: ufs: Support Multi-Circular Queue
To improve performance, UFS4.0 HCI introduce the option to use
Multi-Circular Queue. With the availability of this option,
HCI can operate in legacy queue mode and be backward compatible
with older UFS device. Or the HCI can enable MCQ for improve
performance with UFS4.0 device or later.

Since MCQ specification is just finalized recently, some vendors
have non-standard design at this time due to following the earlier
draft versions.

This patch provides ways to support such non-standard MCQ
implementation by vendors by using add-on hooks in existed UFS
driver. Vendors can implement their own "draft design" in vendor
drivers, and meanwhile not breaking the legacy non-MCQ path.

Bug: 228783879
Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
Signed-off-by: CC Chou <cc.chou@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Powen Kao <powen.kao@medaitek.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Change-Id: I8541626b01c3d2426bdd51d62f15b37bc7728c44
2022-06-18 18:28:47 +00:00
Zhuguangqing
4f746c15d7 ANDROID: Add vendor hooks to signal.
Add vendor hook to get signal for vendor-specific tuning.

Conflicts:
    drivers/android/vendor_hooks.c

Bug: 184898838

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: I83a28b0a6eb413976f4c57f2314d008ad792fa0d
(cherry picked from commit d623f1ff724d5cdc0913e020b2a1b562868aa4d8)
2022-06-16 20:28:30 +00:00
wudean
348b1456e9 ANDROID: vendor_hooks: bypass shrink slab
Add hooks for bypass shrink slab.

Bug: 185951972
(cherry picked from commit 396a6adfd31573ee8f53a86f84372cfb4d228e95)

Change-Id: I343e02ae5cd6d076d525d0e4bfc09ecdfeda1d7b
Signed-off-by: wudean <dean.wu@vivo.com>
2022-06-16 11:37:09 -07:00
xieliujie
c8a2e13615 ANDROID: vendor_hooks: Add hook for binder
Add hook to support oem's performance feature.

Bug: 186482511

Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: Ib495e80e569cc293eaa98d87a050aee8915eb415
(cherry picked from commit 2337b9185a7e8ebf9748c9fa8eacc0e2b995797b)
2022-06-15 16:54:00 +00:00
Naina Mehta
368cd63a4a ANDROID: fault: Add vendor hook for TLB conflict
Add android_vh_handle_tlb_conf vendor hook to gracefully
handle TLB conflict.

Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

1 Added variable:

  [A] 'tracepoint __tracepoint_android_vh_handle_tlb_conf'

Bug: 222637802
Change-Id: I3d6814cd950e77e1a15ce444764078692724cd0a
Signed-off-by: Naina Mehta <quic_nainmeht@quicinc.com>
Signed-off-by: Vamsi Krishna Lanka <quic_vamslank@quicinc.com>
2022-06-14 10:33:17 -07:00
zhang chuang
1502f0ea7c ANDROID: Add hook to show vendor info for transactions
When watchdog or anr occur, we need to read
dev/binderfs/binder_logs/proc/pid or dev/binderfs/binder_logs/state
node to know the time-consuming information of the binder call.
We need to add the time-consuming information of binder transaction.

Bug: 190413570

Signed-off-by: zhang chuang <zhangchuang3@xiaomi.com>
Change-Id: I0423d4e821d5cd725a848584133dc7245cbc233a
(cherry picked from commit eabe9707f264c859d5b0b5b1740a97f8eef97d67)
Signed-off-by: Carlos Llamas <cmllamas@google.com>
[cmllamas: fix trivial merge conflict in vendor_hooks.c]
2022-06-13 17:28:41 +00:00
kamasali
e8b5afb658 ANDROID: vendor_hooks: Add hook for partial_init
Need this vendor hook to support patial init functionality. This hook needs to be restricted as the additional vendor handling need to perform operations (such as wait_for_completion) in non-atomic context.
One of the main functionality of Partial init feature is to reduce latency during resume.

Bug: 231654364
Link: https://lore.kernel.org/lkml/ea318551ec0b43429ce47bfac9ebf285@quicinc.com/#r

Change-Id: Ia1cb0b7173db3318d2d6686f4bd4719f3cfefd8b
Signed-off-by: kamasali <quic_kamasali@quicinc.com>
2022-06-11 07:59:11 +05:30
Dezhi Huang
854f840411 ANDROID: mutex: Add vendor hook to init mutex oem data.
Add hooks to init oem data of mutex.

Bug: 231527236
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
Change-Id: Id0aeac168e81bd3d88051657c32ba709c329dbdd
2022-06-10 18:14:26 +00:00
xiaofeng
4d242c3433 ANDROID: vendor_hooks: tune reclaim swappiness or scan type
Add hooks for reclaim

Bug: 185438290
Change-Id: Ib9eec302b1df4da7e98c77b94541af28c34a8613
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
(cherry picked from commit 35dafe72dd7f7802f941f441f32b9d85efce8803)
2022-06-09 14:40:08 -07:00
Liangliang Li
e4e3aadd01 ANDROID: vendor_hooks: Add hooks to tcp/udp send/recv msg functions.
Add hook to tcp/udp to collect network info and do performance tuning.

Bug: 190523684

Change-Id: Id790a381d5ce6c35a747697510f14678ccf3ff2f
Signed-off-by: Liangliang Li <liliangliang@vivo.com>
(cherry picked from commit 81c8161bed77ae0da88c78ff822220ba1a2a7a8a)
2022-06-09 21:32:54 +00:00
Liangliang Li
cabca1b98e ANDROID: GKI: Add vendor hook to binder transaction
We want to get binder free space information in the binder
transaction, but this needs to hold the mutex lock. So we add
this restrict hook to do this.

Bug: 205648032
Change-Id: Ie1f377018da686bd62f5ac2d1e5421899741e6d5
Signed-off-by: Liangliang Li <liliangliang@vivo.com>
(cherry picked from commit 2f3f5731de0536a6a1048ae01e129cebec48e664)
2022-06-09 21:27:46 +00:00
Liujie Xie
6fbdd5a252 ANDROID: vendor_hooks: Add hooks for account process tick
Add a hook in account_process_tick, which help us to get information
about the high load task and the cpu they running on.

Bug: 183260319
Change-Id: I54162ce3c65bd69e08d2d4747e4d4883efe4c442
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
(cherry picked from commit 63399b4e2e25b0a1522deb724f1de269ac4c8f8b)
2022-06-09 18:57:17 +00:00
xieliujie
0902cc73b7 ANDROID: vendor_hooks: Add hooks for rwsem and mutex
Add hooks to apply oem's optimization of rwsem and mutex

Bug: 182237112
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I6332623732e2d6826b8b61087ca74e55393e0c3d
(cherry picked from commit 80b4341d0520dce2ef1e33aef06c6a2bc8ada518)
2022-06-09 18:25:12 +00:00
HongCheol Shim
9a7732c0b2 ANDROID: input: Add vendor hook for __pass_event in evdev.c
Add vendor hook for passing events to client drivers.

We have some limitation to achieve the goal of input performance
without modification of kernel. So I would like you to add vendor
hook and please review the reason why I want to add it.

As the users trigger input actions, we need to support the input
operation and the what the users want to do so that there's no delay.
So we've developed and used "input booster" controling some resources
properly during input operations according to input type.

Android already has the booster in framework to support input actions
however this way has a long latency to control resources.

To reduce latency, we've placed the booster in kernel side for high
responsiveness and it guarantees faster than framework booster.
In addtion, I applied Samsung's own concept to the booster.
And it has been operated stably on all Galaxy models for about 10 years.

So we need
  - add function to notify input events delivered to client in evdev.

Bug: 228927595
Signed-off-by: HongCheol Shim <hongc.shim@samsung.corp-partner.google.com>
Change-Id: Ibe199c148974b6788e02c192f950cb6802745f68
2022-06-09 03:21:26 +00:00
Liangliang Li
50a2b178c5 ANDROID: vendor_hooks: Add hooks to dup_task_struct
Add hook to dup_task_struct for vendor data fields initialisation.

Bug: 188004638

Change-Id: I4b58604ee822fb8d1e0cc37bec72e820e7318427
Signed-off-by: Liangliang Li <liliangliang@vivo.com>
(cherry picked from commit f66d96b14aab5051fdf6b5054d87362c17a7b365)
2022-06-09 00:04:53 +00:00
kamasali
596dcf7986 ANDROID: vendor_hooks: Add hook in wakeup functionality
Need this verndor hook to support wakeup functionality
for sdio cards.

Bug: 231668342
Change-Id: I1d1a34d6d02f4558edf56eccdd09df57d6232c05
Signed-off-by: Sarthak Garg <sartgarg@codeaurora.org>
Signed-off-by: Kamasali Satyanarayan <quic_kamasali@quicinc.com>
2022-06-08 19:35:41 +00:00
Liangliang Li
53df1b822d ANDROID: vendor_hooks: Add hooks for account irqtime process tick
Add a hook in irqtime_account_process_tick, which helps to get
information about the high load task.

Bug: 187904818

Change-Id: I644f7d66b09d047ca6b0a0fbd2915a6387c8c007
Signed-off-by: Liangliang Li <liliangliang@vivo.com>
(cherry picked from commit fe580539f6cec43ddb0d6ecfd39aa2f4e45754ca)
2022-06-08 02:17:10 +00:00
Manaf Meethalavalappu Pallikunhi
f6e47fd00f ANDROID: thermal: vendor hook to disable thermal cooling stats
Add vendor hook to thermal to allow vendor to selectively disable
thermal cooling device stats feature based on requirement. It helps
vendor to optimize memory footprint due to this feature especially
for low memory devices.

Bug: 218825214
Change-Id: I2ec72505f03575e09229c54765584614b16a3904
Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
2022-06-06 18:26:47 +00:00
Liujie Xie
d1b6bd094b ANDROID: vendor_hooks: Add hook in shrink_node_memcgs
Add vendor hook in shrink_node_memcgs to adjust whether
to skip memory reclamation of memcg.

Bug: 226482420
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I925856353e63c5a821027de4f8476c833e21b982
2022-06-03 19:57:21 +00:00
Liujie Xie
50e4cd9df7 ANDROID: vendor_hooks: Add hooks for memory when debug
Add vendors hooks for recording memory used

Bug: 182443489
Bug: 234407991
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I62d8bb2b6650d8b187b433f97eb833ef0b784df1
2022-06-02 14:37:19 -07:00
Jiewen Wang
5a70133feb ANDROID: vendor_hooks: Add hook in try_to_unmap_one()
Add hook in try_to_unmap_one() to trace this function for debug memory
swap bugs.

Bug: 198385827
Change-Id: I1fdbe60e09bb491b949e06a07133710453ecca03
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
(cherry picked from commit 955f917251d8ff9c04cf0404e35bf6be5e3666c5)
2022-06-02 20:45:07 +00:00
Jiewen Wang
73c9d4a9d5 ANDROID: vendor_hooks: Add hook in mmap_region()
Add hook in mmap_region() to record the vma and address information
of monitored processes.

Bug: 198385827
Change-Id: I0bde29113b47ca7f4a9f5d42a54188e791ca3b7e
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
(cherry picked from commit 878e0caa773151b8a9445f24d3e059d0ece5566d)
2022-06-02 20:45:01 +00:00
Sachin Gupta
3ff9481aad ANDROID: scsi: ufs: Add hook to influence the UFS clock scaling policy
Add a vendor hook in ufshcd_devfreq_target() to allow vendor modules to
influence the UFS clock scaling policy.

Bug: 234112523

Change-Id: I64b9b77661fffc6cc96fa610985483e6cfc6542b
Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Signed-off-by: Sachin Gupta <quic_sachgupt@quicinc.com>
2022-06-02 18:55:36 +00:00
Yang Yang
a41c70ee0b ANDROID: vendor_hooks: add vendor hook in blk_mq_rq_ctx_init()
This vendor hook let us initialize payload of the request.

Bug: 188749221
Change-Id: I51d6a3010ac0ab36066dbe1368158592832112b7
Signed-off-by: Yang Yang <yang.yang@vivo.com>
(cherry picked from commit 2faed7779206367f40c9687e029b5bd168a646da)
2022-06-01 22:17:28 +00:00
Yang Yang
1c6391dd7a ANDROID: vendor_hooks: add vendor hook in blk_mq_alloc_rqs()
This vendor hook let us attach oem data as payload to the request.
The payload is used by oem driver for debugging purpose.

Bug: 188749221
Change-Id: Iac598bd9cce836dac0efe9198a3e7752928f351a
Signed-off-by: Yang Yang <yang.yang@vivo.com>
(cherry picked from commit eecc725a8e0b7c10f3b37f7c80531dc859c7dc99)
2022-06-01 22:17:20 +00:00
Peifeng Li
c249ab0433 ANDROID: vendor_hooks: Add hooks to for free_unref_page_commit
Provide a vendor hook to skip cma-pages to add in pcplist when
free_unref_page_commit.

The patch is revelant to skip drain_all_pages in alloc_contig_range,
the revelant hooks is android_vh_cma_drain_all_pages_bypass
which is to avoid to delay in drain pcppages when drain_all_pages.

In most case, pcp->high is small so that free-pages with other mt_types
can also fill with pcplist full.

Bug: 224732340
Bug: 234405962
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Ifdeeed9f8934d87671ec3fa6787a02675b993082
2022-06-01 20:35:06 +00:00
Peifeng Li
03e8a086d0 ANDROID: vendor_hooks: Add hooks to for alloc_contig_range
Provide a vendor hook to allow drain_all_pages to be skipped
during alloc_contig_range in some cases to avoid delays caused by
it in cases when the benefits of draining pcp lists are known
to be small.

Bug: 224732340
Bug: 234405962
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0a82f668cf985ad5344d666c0c6372a7e61c3798
2022-06-01 20:34:55 +00:00
Liujie Xie
8148c29ecf ANDROID: vendor_hooks: Add hooks for __alloc_pages_direct_reclaim
Provide a vendor hook to allow drain_all_pages to be skipped
during direct reclaim in some cases to avoid delays caused by
it in cases when the benefits of draining pcp lists are known
to be small.

Bug: 220811627
Bug: 234405962
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I0805241f81e0a94afcf62c98e97cff125d4061e2
2022-06-01 20:34:46 +00:00
Liujie Xie
8db64c33f1 ANDROID: vendor_hooks: Add hooks for shrink_active_list
Provide a vendor hook to allow page_referenced to be skipped
during shrink_active_list to avoid heavy cpuloading caused by
it.

Bug: 220878851
Bug: 234405962
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Ie0e369f8f8739fea59a95470af20ab0e976869d1
2022-06-01 20:34:38 +00:00
Abhijeet Dharmapurikar
ec0c9b3ae6 ANDROID: sched/core: pass the target cpu in rvh_ttwu_cond hook
Allow the vendor module to know the target cpu for better decisions on
whether to enforce __ttwu_queue_wakelist() based wakeup.

Bug: 234483895
Change-Id: Ic27054a5f6adc040fa3cadbd57d37608bf353c5f
Signed-off-by: Abhijeet Dharmapurikar <quic_adharmap@quicinc.com>
2022-06-01 09:32:35 -07:00
Neeraj Upadhyay
d8b0682620 ANDROID: gic-v3: Change GIC v3 vendor hook to restricted
Some of the irq migration paths call chip set affinity, after
current CPU is marked offline in cpu_online_mask. These
chip set affinity calls do not invoke vendor trace hooks.
So, convert gic_v3_set_affinity() vendor hook to a restricted
hook, to allow trace hook to be called from these irq migration
paths.

Bug: 187161770
Change-Id: I8f45536deb1ba1dc6be861ca4fc2b32306a5c50a
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
(cherry picked from commit 3bd9ad7eb4a7cdd14a08859a1d1edee72883dd7d)
2022-06-01 09:32:34 -07:00
Elliot Berman
d3616c7e0b ANDROID: Disable CFI on restricted vendor hooks in TRACE_HEADER_MULTI_READ
commit 5e767aa07e ("ANDROID: use static_call() for restricted hooks")
introduced an implementation of __iteriter_##_name when
TRACE_HEADER_MULTI_READ is defined. __nocfi that function as well in
order to keep the performance optimizations from commit 384becf1643b
("ANDROID: Disable CFI on restricted vendor hooks").

Fixes: 384becf1643b ("ANDROID: Disable CFI on restricted vendor hooks")
Change-Id: I6ea1cd767bad95c324c06398475174b710ae4dbe
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
(cherry picked from commit 774f1bd29cbaa84a9b211216099559c96b2bbab0)
2022-05-23 16:57:40 +00:00
Todd Kjos
949edf7539 ANDROID: Fix suspicious RCU usage warning
The hooks added in the suspend path can be called in a
state where RCU locking is not safe. Change the hooks
to restricted hooks which are safe in this context.

Bug: 232468327
Fixes: ace93ca5ef ("ANDROID: GKI: psci: add hook to check if cpu is allowed to power off")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I5b887d34ca05e995030ef0c8f39488d932c52770
2022-05-17 23:33:11 +00:00
Quentin Perret
d6a300eb7a ANDROID: Disable CFI on restricted vendor hooks
CFI has additional overhead on indirect branches to modules as the
target is not known at kernel compile-time. This has been demonstrated
to cause problematic performance regressions on benchmarks using GKI
together with modularized scheduler callbacks attached to restricted
vendor hooks.

To restore some of the performance back, let's disable CFI around the
restricted hook call sites and issue a raw indirect call in fast paths.

We should be able to drop this patch when/if the arm64 static_call
port lands upstream [1] as this would make tracepoints circumvent some
of the CFI checks using text patching, but that still remain to be
proven.

[1] https://lore.kernel.org/linux-arm-kernel/20201028184114.6834-1-ardb@kernel.org/

Bug: 168521642
Change-Id: I7cd59f582b12fed15be64059f08122f96786e650
Signed-off-by: Quentin Perret <qperret@google.com>
2022-05-16 15:28:06 +00:00
Shaleen Agrawal
aec40de3d7 ANDROID: cputime: seprate irq entry and exit tracehooks
Currently the code has single hook for tracking irqs. However
modules need to deduce start and end of the irq.

Create separate hooks for irq start and end since the
cputime has already figured it out.

Bug: 231341763
Change-Id: Ie0dd503b283d83f69d01171ebd1cd6127c3bafd0
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
2022-05-12 10:02:42 +05:30