From 4b22a63233e445b8f910023b6f21436c5fa1bf82 Mon Sep 17 00:00:00 2001 From: Frankie Chang Date: Tue, 12 Jan 2021 14:07:38 +0800 Subject: [PATCH 1/3] ANDROID: cgroup: Add vendor hook to the cgroup Add a vendor hook after attaching a task to a cgroup to recognize the group_id for performance tuning Bug: 181917687 Signed-off-by: Frankie Chang Change-Id: I603afa3d893dd575a7dcb97f83bd9eacb8315bab (cherry picked from commit bed1e2a75b0000d99a00177272b93e5c8430308b) --- drivers/android/vendor_hooks.c | 2 ++ include/trace/hooks/cgroup.h | 17 +++++++++++++++++ kernel/cgroup/cgroup-v1.c | 2 ++ 3 files changed, 21 insertions(+) create mode 100644 include/trace/hooks/cgroup.h diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 6686dbc0f1af..b13367deba9d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -20,6 +20,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -69,3 +70,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sysrq_crash); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_group); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_pd_energy); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_set_task); diff --git a/include/trace/hooks/cgroup.h b/include/trace/hooks/cgroup.h new file mode 100644 index 000000000000..cc44ccf9e109 --- /dev/null +++ b/include/trace/hooks/cgroup.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM cgroup +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH trace/hooks +#if !defined(_TRACE_HOOK_CGROUP_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_CGROUP_H +#include +#include + +struct task_struct; +DECLARE_HOOK(android_vh_cgroup_set_task, + TP_PROTO(int ret, struct task_struct *task), + TP_ARGS(ret, task)); +#endif + +#include diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 7b9ee484abab..c91f8a1e012b 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -17,6 +17,7 @@ #include #include +#include #define cg_invalf(fc, fmt, ...) invalf(fc, fmt, ## __VA_ARGS__) @@ -522,6 +523,7 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, goto out_finish; ret = cgroup_attach_task(cgrp, task, threadgroup); + trace_android_vh_cgroup_set_task(ret, task); out_finish: cgroup_procs_write_finish(task); From 7285ca6e97203728ff5eddcbabedd27ca72576aa Mon Sep 17 00:00:00 2001 From: Frankie Chang Date: Wed, 13 Jan 2021 10:45:58 +0800 Subject: [PATCH 2/3] ANDROID: Add vendor hooks when syscall prctl finished Add vendor hook when syscall prctl finished for vendor-specific tuning. Bug: 181819699 Signed-off-by: Frankie Chang Change-Id: Ica42d80ab4b540045330e9c5b211e0e814eed0ff (cherry picked from commit 6904f0001e4ec3c637539c18969e46755eaa01f4) --- drivers/android/vendor_hooks.c | 2 ++ include/trace/hooks/sys.h | 17 +++++++++++++++++ kernel/sys.c | 3 +++ 3 files changed, 22 insertions(+) create mode 100644 include/trace/hooks/sys.h diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index b13367deba9d..0830f821d49b 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -21,6 +21,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -71,3 +72,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_group); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_pd_energy); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_set_task); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_syscall_prctl_finished); diff --git a/include/trace/hooks/sys.h b/include/trace/hooks/sys.h new file mode 100644 index 000000000000..9e5d7a5cb2cf --- /dev/null +++ b/include/trace/hooks/sys.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM sys +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH trace/hooks +#if !defined(_TRACE_HOOK_SYS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_SYS_H +#include +#include + +struct task_struct; +DECLARE_HOOK(android_vh_syscall_prctl_finished, + TP_PROTO(int option, struct task_struct *task), + TP_ARGS(option, task)); +#endif + +#include diff --git a/kernel/sys.c b/kernel/sys.c index 730672cc1942..ccad9fef972d 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -75,6 +75,8 @@ #include "uid16.h" +#include + #ifndef SET_UNALIGN_CTL # define SET_UNALIGN_CTL(a, b) (-EINVAL) #endif @@ -2644,6 +2646,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, error = -EINVAL; break; } + trace_android_vh_syscall_prctl_finished(option, me); return error; } From 5d7dfa34c6221c8b16825a8cc0725a2e47d889a7 Mon Sep 17 00:00:00 2001 From: Woogeun Lee Date: Mon, 8 Mar 2021 19:40:04 +0900 Subject: [PATCH 3/3] ANDROID: ABI: update allowed list for galaxy Leaf changes summary: 31 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 31 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 31 Added functions: [A] 'function void* __alloc_percpu_gfp(size_t, size_t, gfp_t)' [A] 'function int __sbitmap_queue_get(sbitmap_queue*)' [A] 'function bool blk_mq_bio_list_merge(request_queue*, list_head*, bio*, unsigned int)' [A] 'function bool blk_mq_run_hw_queue(blk_mq_hw_ctx*, bool)' [A] 'function void blk_mq_sched_mark_restart_hctx(blk_mq_hw_ctx*)' [A] 'function void blk_mq_sched_request_inserted(request*)' [A] 'function bool blk_mq_sched_try_insert_merge(request_queue*, request*)' [A] 'function bool blk_mq_sched_try_merge(request_queue*, bio*, unsigned int, request**)' [A] 'function void blk_stat_enable_accounting(request_queue*)' [A] 'function elevator_queue* elevator_alloc(request_queue*, elevator_type*)' [A] 'function bool elv_bio_merge_ok(request*, bio*)' [A] 'function void elv_rb_add(rb_root*, request*)' [A] 'function void elv_rb_del(rb_root*, request*)' [A] 'function request* elv_rb_find(rb_root*, long long unsigned int)' [A] 'function request* elv_rb_former_request(request_queue*, request*)' [A] 'function request* elv_rb_latter_request(request_queue*, request*)' [A] 'function int elv_register(elevator_type*)' [A] 'function void elv_rqhash_add(request_queue*, request*)' [A] 'function void elv_rqhash_del(request_queue*, request*)' [A] 'function void elv_unregister(elevator_type*)' [A] 'function io_cq* ioc_lookup_icq(io_context*, request_queue*)' [A] 'function cgroup_subsys_state* kthread_blkcg()' [A] 'function void sbitmap_add_wait_queue(sbitmap_queue*, sbq_wait_state*, sbq_wait*)' [A] 'function bool sbitmap_any_bit_set(const sbitmap*)' [A] 'function void sbitmap_del_wait_queue(sbq_wait*)' [A] 'function int sbitmap_init_node(sbitmap*, unsigned int, int, unsigned int, int)' [A] 'function void sbitmap_queue_clear(sbitmap_queue*, unsigned int, unsigned int)' [A] 'function int sbitmap_queue_init_node(sbitmap_queue*, unsigned int, int, bool, unsigned int, int)' [A] 'function void sbitmap_queue_min_shallow_depth(sbitmap_queue*, unsigned int)' [A] 'function void sbitmap_queue_resize(sbitmap_queue*, unsigned int)' [A] 'function int timer_reduce(timer_list*, unsigned long int)' Bug: 182221332 Change-Id: Iff73dcf495c3c138dc8009d941a5990291fc636d Signed-off-by: Woogeun Lee Signed-off-by: Giuliano Procida --- android/abi_gki_aarch64.xml | 1078 +++++++++++++++++++------------- android/abi_gki_aarch64_galaxy | 31 + 2 files changed, 663 insertions(+), 446 deletions(-) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index 79e1098f2dc0..1989997c9623 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -8,6 +8,7 @@ + @@ -214,6 +215,7 @@ + @@ -405,6 +407,7 @@ + @@ -421,7 +424,12 @@ + + + + + @@ -470,6 +478,7 @@ + @@ -1548,6 +1557,17 @@ + + + + + + + + + + + @@ -2058,6 +2078,7 @@ + @@ -2298,6 +2319,7 @@ + @@ -3344,6 +3366,14 @@ + + + + + + + + @@ -3939,6 +3969,7 @@ + @@ -4821,7 +4852,7 @@ - + @@ -13348,7 +13379,7 @@ - + @@ -13824,7 +13855,7 @@ - + @@ -13840,7 +13871,7 @@ - + @@ -13867,9 +13898,9 @@ - + - + @@ -13948,7 +13979,6 @@ - @@ -15158,7 +15188,6 @@ - @@ -17129,7 +17158,17 @@ - + + + + + + + + + + + @@ -17733,7 +17772,7 @@ - + @@ -17928,7 +17967,6 @@ - @@ -18376,7 +18414,6 @@ - @@ -21153,7 +21190,7 @@ - + @@ -26452,7 +26489,7 @@ - + @@ -29990,6 +30027,7 @@ + @@ -30006,6 +30044,7 @@ + @@ -32371,6 +32410,11 @@ + + + + + @@ -32492,9 +32536,25 @@ + + + + + + + + + + + + + + + + @@ -32505,6 +32565,20 @@ + + + + + + + + + + + + + + @@ -32516,6 +32590,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -32560,11 +32661,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -32592,70 +32730,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -33012,10 +33086,18 @@ + + + + + + + + @@ -33073,6 +33155,10 @@ + + + + @@ -33097,6 +33183,14 @@ + + + + + + + + @@ -33221,7 +33315,7 @@ - + @@ -33324,7 +33418,7 @@ - + @@ -33422,6 +33516,12 @@ + + + + + + @@ -33598,6 +33698,16 @@ + + + + + + + + + + @@ -33884,6 +33994,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -33907,7 +34043,46 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -34012,7 +34187,7 @@ - + @@ -34086,54 +34261,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -34210,6 +34337,15 @@ + + + + + + + + + @@ -34321,32 +34457,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -53191,7 +53391,7 @@ - + @@ -54940,7 +55140,7 @@ - + @@ -54984,7 +55184,6 @@ - @@ -62543,7 +62742,7 @@ - + @@ -62551,7 +62750,7 @@ - + @@ -62559,17 +62758,17 @@ - + - + - + @@ -63035,7 +63234,7 @@ - + @@ -65973,7 +66172,6 @@ - @@ -66926,6 +67124,7 @@ + @@ -69685,7 +69884,6 @@ - @@ -72302,6 +72500,7 @@ + @@ -79780,7 +79979,6 @@ - @@ -80400,46 +80598,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -80464,7 +80622,6 @@ - @@ -80482,7 +80639,6 @@ - @@ -81030,7 +81186,6 @@ - @@ -93025,17 +93180,6 @@ - - - - - - - - - - - @@ -93089,6 +93233,17 @@ + + + + + + + + + + + @@ -107060,6 +107215,8 @@ + + @@ -108215,11 +108372,6 @@ - - - - - @@ -108388,6 +108540,11 @@ + + + + + @@ -117302,22 +117459,6 @@ - - - - - - - - - - - - - - - - @@ -117823,6 +117964,22 @@ + + + + + + + + + + + + + + + + @@ -137589,7 +137746,7 @@ - + @@ -140983,7 +141140,7 @@ - + @@ -141686,6 +141843,9 @@ + + + @@ -143624,7 +143784,17 @@ - + + + + + + + + + + + @@ -155655,6 +155825,11 @@ + + + + + @@ -157157,6 +157332,12 @@ + + + + + + @@ -158100,6 +158281,12 @@ + + + + + + @@ -158656,209 +158843,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -158994,18 +158981,7 @@ - - - - - - - - - - - @@ -159194,13 +159170,6 @@ - - - - - - - @@ -159208,10 +159177,6 @@ - - - - @@ -168813,7 +168778,7 @@ - + @@ -171946,7 +171911,7 @@ - + @@ -171975,8 +171940,218 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -172060,6 +172235,17 @@ + + + + + + + + + + + @@ -175200,7 +175386,7 @@ - + diff --git a/android/abi_gki_aarch64_galaxy b/android/abi_gki_aarch64_galaxy index e460d3ff7965..bef65a0d87b9 100644 --- a/android/abi_gki_aarch64_galaxy +++ b/android/abi_gki_aarch64_galaxy @@ -3,6 +3,7 @@ __alloc_disk_node __alloc_pages_nodemask __alloc_percpu + __alloc_percpu_gfp __alloc_skb __arch_clear_user __arch_copy_from_user @@ -133,6 +134,7 @@ __request_module __request_percpu_irq __request_region + __sbitmap_queue_get __scsi_device_lookup_by_target __scsi_execute __scsi_print_sense @@ -267,7 +269,13 @@ blk_execute_rq_nowait blk_get_request blk_lookup_devt + blk_mq_bio_list_merge blk_mq_rq_cpu + blk_mq_run_hw_queue + blk_mq_sched_mark_restart_hctx + blk_mq_sched_request_inserted + blk_mq_sched_try_insert_merge + blk_mq_sched_try_merge blk_put_request blk_queue_bounce_limit blk_queue_max_hw_sectors @@ -275,6 +283,7 @@ blk_rq_map_user blk_rq_map_user_iov blk_rq_unmap_user + blk_stat_enable_accounting blk_verify_command blkdev_get_by_dev blkdev_get_by_path @@ -955,6 +964,17 @@ dw_pcie_read dw_pcie_setup_rc dw_pcie_write + elevator_alloc + elv_bio_merge_ok + elv_rb_add + elv_rb_del + elv_rb_find + elv_rb_former_request + elv_rb_latter_request + elv_register + elv_rqhash_add + elv_rqhash_del + elv_unregister emergency_restart enable_irq enable_percpu_irq @@ -1233,6 +1253,7 @@ int_sqrt int_to_scsilun invalidate_mapping_pages + ioc_lookup_icq iomem_resource iommu_alloc_resv_region iommu_attach_device @@ -1406,6 +1427,7 @@ kstrtoull kstrtoull_from_user kthread_bind + kthread_blkcg kthread_cancel_delayed_work_sync kthread_cancel_work_sync kthread_create_on_node @@ -2011,6 +2033,14 @@ runqueues save_stack_trace save_stack_trace_tsk + sbitmap_add_wait_queue + sbitmap_any_bit_set + sbitmap_del_wait_queue + sbitmap_init_node + sbitmap_queue_clear + sbitmap_queue_init_node + sbitmap_queue_min_shallow_depth + sbitmap_queue_resize sched_clock sched_setscheduler sched_setscheduler_nocheck @@ -2386,6 +2416,7 @@ thermal_zone_of_sensor_register thermal_zone_of_sensor_unregister time64_to_tm + timer_reduce timespec64_to_jiffies touch_softlockup_watchdog trace_define_field