Commit graph

29 commits

Author SHA1 Message Date
Frankie Chang
7285ca6e97 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 <frankie.chang@mediatek.com>
Change-Id: Ica42d80ab4b540045330e9c5b211e0e814eed0ff
(cherry picked from commit 6904f0001e4ec3c637539c18969e46755eaa01f4)
2021-03-09 21:57:07 +00:00
Frankie Chang
4b22a63233 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 <frankie.chang@mediatek.com>
Change-Id: I603afa3d893dd575a7dcb97f83bd9eacb8315bab
(cherry picked from commit bed1e2a75b0000d99a00177272b93e5c8430308b)
2021-03-09 21:56:56 +00:00
Yun Hsiang
b7f31af2f1 ANDROID: sched: add em_pd_energy vendor hook
We add a vendor hook for util to freq calculation in schedutil,
so we need to do corresponding change for energy calculation.

android_vh_em_pd_energy
	adjust energy calculation

Bug: 178021064

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: Iae772cf07881602eea3f27aeb75fba753e7c2635
2021-01-21 10:32:49 +08:00
Yun Hsiang
68ecddcda8 ANDROID: schedutil: add vendor hook for adjusting util to freq calculation
Currently, the frequency is calculated by max freq * 1.25 * util / max cap.
Add a vendor hook to adjust the frequency when the calculation
overestimate.

android_vh_map_util_freq
	adjust util to freq calculation

Bug: 177845438

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I9aa9079f00af7d3380b19f2fe21b75cddd107d15
2021-01-19 19:02:47 +00:00
Greg Kroah-Hartman
01435b2e91 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: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I67a9be129150690f8c1961accf7d5cdf0d5d50cc
2020-10-30 10:02:26 +01:00
Greg Kroah-Hartman
20dd49792a 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: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9ed93e8bffef3cd8fbde4d62fc14596764a85304
2020-10-30 10:02:26 +01:00
YT Chang
54cf84a595 ANDROID: sched: add restrict vendor hook to modify load balance behavior
For modifying load balance policy, we add the hook on
find_busiest_group().
It allows us to modify load balance paths.

Bug: 168248326
Signed-off-by: YT Chang <yt.chang@mediatek.com>
Change-Id: I77ec043576139806551b978eb1bdf9f637442dfb
(cherry picked from commit a2ca8408de6183364b4c17f341f06e875bc7a1c1)
(cherry picked from commit 489646b879ede582b6b00803edd3f777aede4d85)
2020-10-27 15:11:50 +00:00
Sangmoon Kim
32b2423372 ANDROID: sysrq: add vendor hook for sysrq crash information
- Add the hook to provide additional information
   of sysrq crash.

Bug: 170234110

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: Ib8f14eaa639b2ef959e911d611515868ff9f193d
2020-10-13 14:46:48 +09:00
Sangmoon Kim
2ea974a00c ANDROID: workqueue: add vendor hook for wq lockup information
- Add the hook to provide additional information like
   a task scheduling log.

Bug: 169374262

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I203dbc6faa77687ea48769f76658d28b29ef46fd
2020-10-05 10:27:15 +09:00
yong qian
802f342713 ANDROID: vendor_hooks: Add hooks for debugging exception context
When some processes crashed, we want to save cpu regs(x0-x30、pc、sp),
and context(task_struct、thread_info) to log for debugging

Bug: 166228327

Signed-off-by: yong qian <qianyong@oppo.com>
Change-Id: I4f49ffed583a0e20f1aaa7e445e85a0cbb603bbe
2020-09-15 18:02:49 +00:00
Changki Kim
bad091cc4b ANDROID: vendor_hooks: Add vendor hooks for getting printk messages
When sudden reset by watchdog occurs, kernel log is very helpful.
But the log has saved structure type in log_buf.
So we want to collect the log on runtime to string format at other
reserved memory.

Bug: 167766040

Change-Id: Ic9686acc7c284e2ab81395fb9cc076fafe142bf9
Signed-off-by: Changki Kim <changki.kim@samsung.com>
2020-09-14 14:42:20 +00:00
Changki Kim
bb168ca180 Revert "ANDROID: vendor_hooks: Add vendor hooks for key combination"
This reverts commit 72f2bc5fc2.

You can use input_handle_event instead of this vendor hook.

Change-Id: I8c6c5705f07181710c99a01239d75ecf43f9c5bf
Signed-off-by: Changki Kim <changki.kim@samsung.com>
2020-09-11 11:47:54 +09:00
Changki Kim
72f2bc5fc2 ANDROID: vendor_hooks: Add vendor hooks for key combination
When some problems happened in android, we can't use adb command because
android can be abnormal state. And we can't use uart because
uart pin is not connected in the board. So we need key combination
functions for debugging.
This function should only use in development environment.
In the market, this will be disabled.

Bug: 167516783

Signed-off-by: Changki Kim <changki.kim@samsung.com>
Change-Id: I1cbbc93642fb45da161eee983380e48045153a66
[ Added "#ifdef __GENKSYMS__" around the include <<trace/hooks/debug.h>
to prevent CRC errors due to visibility of struct trace_eval_map ]
Signed-off-by: Todd Kjos <tkjos@google.com>
2020-09-08 18:04:18 +00:00
Todd Kjos
9d8606b94c Revert "ANDROID: vendor_hooks: Add vendor hooks for key combination"
This reverts commit ab2d60d901.

Caused KMI break (not detected by TH until after it was merged)

Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: If1b10072bf3758fdbb6e0e4e2cdacbcf010ab44d
2020-09-02 21:08:13 -07:00
Changki Kim
ab2d60d901 ANDROID: vendor_hooks: Add vendor hooks for key combination
When some problems happened in android, we can't use adb command because
android can be abnormal state. And we can't use uart because
uart pin is not connected in the board. So we need key combination
functions for debugging.
This function should only use in development environment.
In the market, this will be disabled.

Bug: 167516783

Change-Id: I82e096526b06570b4cc55bf04dc945940d1dd91a
Signed-off-by: Changki Kim <changki.kim@samsung.com>
2020-09-02 19:49:53 +00:00
Changki Kim
55ff3b05bf ANDROID: vendor_hooks: Add new android vendor hooks for ipi stop
When a kernel panic occurred, it is sometimes caused by a other cpu
than the panic cpu. When a panic cpu sends smp stop IPI, it can help to
solve the problem even more if aonther cpu stores registers and
run cache flush.

Bug: 165956922

Change-Id: I21c74fe0d047e49b676c502bc9b8d8830e5431de
Signed-off-by: Changki Kim <changki.kim@samsung.com>
2020-08-27 03:08:51 +00:00
Yun Hsiang
a7e0bc8f4c ANDROID: sched: add vendor hook for correcting cpu capacity
Current CPU capacity is scaled by frequency
but it will sometime overestimate.
Add vendor hook to adjust cpu capacity.

android_vh_arch_set_freq_scale
	Adjust cpu freq scale for each opp.

Bug: 165823138

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I054740a7f60301d5a3b085bfa540d52853f5eec5
(cherry picked from commit e209b3b88d9772ecd782d71c1ae7c5425dd20289)
2020-08-21 16:59:37 +00:00
JianMin Liu
98f3e290c5 ANDROID: sched: Use normal vendor hook in scheduler tick
The hooks function of scheduler tick will need to
  insert multiple instances, so that use vendor hook
  instead of restricted vendor hook.

Bug: 165787557

Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
Change-Id: I750da26452c657d83d5f8c520bf7008693c43a6b
2020-08-21 14:55:32 +00:00
Park Bumgyu
d56217b22e ANDROID: Add vendor hooks to the scheduler
Add vendor hooks for vendor-specific scheduling.

  android_rvh_select_task_rq_rt:
    To perform vendor-specific RT task placement.

  android_rvh_select_fallback_rq:
    To restrict cpu usage.

  android_rvh_scheduler_tick:
    To collect periodic scheduling information and to schedule tasks.

  android_rvh_enqueue_tas/android_rvh_dequeue_task:
    For vendor to be aware of the task schedule in/out.

  android_rvh_can_migrate_task:
    To limit task migration based on vendor requirements.

  android_rvh_find_lowest_rq:
    To find the lowest rq for RT task with vendor-specific way.

Bug: 155241766

Change-Id: I926458b0a911d564e5932e200125b12406c2deee
Signed-off-by: Park Bumgyu <bumgyu.park@samsung.com>
Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
2020-08-21 14:55:19 +00:00
Wooyeon Kim
25451dc193 ANDROID: vendor_hooks: FPSIMD save/restore by using vendor_hooks
- To use fpsimd in kernel task, vendor_hook call is needed to
   save/restore fpsimd at scheduling time.
 - ANDROID_VENDOR_DATA added to thread_struct.
 - Vendor_hooks is called when thread is switching for save/restore
   fpsimd states.
  (trace_android_vh_is_fpsimd_save(prev, next))

Bug: 149632552
Bug: 165161482

Signed-off-by: Wooyeon Kim <wooy88.kim@samsung.com>
Change-Id: I853e1b6a9a51e24f770423bbc39fdd84265d78fc
2020-08-20 14:27:55 -07:00
JianMin Liu
2f0f512eb0 ANDROID: futex: Add vendor hook for wait queue
Add the hook for the waiter list of futex to allow
vendor perform wait queue enhancement

Bug: 163431711

Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
Change-Id: I68218b89c35b23aa5529099bb0bbbd031bdeafef
2020-08-20 19:30:35 +00:00
JianMin Liu
3b773b24e6 ANDROID: sched: add vendor hooks to handle scheduling priority
Add hooks to collect scheduling information and apply vendor's
tuning when task's scheduling priority is changed

Bug: 163431711

Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
Change-Id: Ic85835852690d0060666107d9108560f5023496b
2020-08-20 19:28:42 +00:00
JianMin Liu
cfde7b838c 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: 161400830

Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
Change-Id: I007a5e26f3db2adaeaf4e5ccea414ce7abfa83b8
2020-08-20 19:28:23 +00:00
JianMin Liu
06f8eab9f4 ANDROID: binder: Add vendor hook to the binder
- To apply vendor's performance tune for blocked binder transaction,
     add the hook on the begin/end of transaction.

   - ANDROID_VENDOR_DATA added to binder_transaction.

Bug: 161400830

Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
Change-Id: If60870623ce2669200238172737dd8455ac34b02
2020-08-20 19:28:04 +00:00
Yun Hsiang
93e0737326 ANDROID: sched: add restrict vendor hook to modify task placement policy in EAS
For modifying task placement policy, we add the hook on the top of
select_task_rq_fair(). It allows us to modify wakeup/fork/exec balance
paths.

Bug: 165660734
Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I80ff870453472e183ab2aae7381bff91e49ae296
(cherry picked from commit a1fc1fba460be48dff2484b438888ede557930d4)
2020-08-20 06:40:02 +00:00
Bae Soukjin
d88b2969cf ANDROID: vendor_hooks: Add vendor hook to the net
android_vh_ptype_head:
    To add a debugging chain to ptype list

  android_vh_kfree_skb
    To sniff the dropped packet at kernel network

Bug: 163716381

Signed-off-by: Bae Soukjin <soukjin.bae@samsung.com>
Change-Id: Ide80bf0a129da31a1824d4a33026ac42be327361
2020-08-19 14:29:16 +00:00
Sangmoon Kim
b519ac4237 ANDROID: vendor_hooks: add waiting information for blocked tasks
- Add the hook to get mutex/rwsem information that the tasks
   are waiting for.

 - Add the hook to print messages for sched_show_task.

 - ANDROID_VENDOR_DATA_ARRAY added to task_struct

Bug: 162776704

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: Ib436fbd8d0ad509c3b5a73ea8f5170e0761a13fd
2020-08-12 19:30:03 +00:00
Todd Kjos
2e904b4388 ANDROID: fix copyright notice
New vendor hook files cite Google, Inc instead of Google LLC

Bug: 149632552
Fixes: 7f62740112ef ("ANDROID: add support for vendor hooks")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: If42762c4bbe6d0a7ff1cc75b64a3b224902e121c
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2020-07-09 15:26:50 +02:00
Todd Kjos
5965ee663d ANDROID: add support for vendor hooks
Add support for vendor hooks. Adds include/trace/hooks
directory for trace definition headers where hooks
can be defined and vendor_hook.c for instantiating
and exporting them for vendor modules.

There are two variants of vendor hooks, both based
on tracepoints:

Normal: this uses the DECLARE_HOOK macro
to create a tracepoint function with the name trace_<name>
where <name> is the unique identifier for the trace.

Restricted: restricted hooks are needed for cases like
scheduler hooks where the attached function must be
called even if the cpu is offline or requires a
non-atomic context. Restricted vendor hooks cannot
be detached, so modules that attach to a restricted
hook can never unload. Also, only 1 attachment is
allowed (any other attempts to attach will fail with
-EBUSY).

For either case, modules attach to the hook by using
register_trace_<name>(func_ptr, NULL).

New hooks should be defined in headers in the
include/trace/hooks/ directory using the
DECLARE_HOOK() or DECLARE_RESTRICTED_HOOK()
macros.

New files added to include/trace/hooks should
be #include'd from drivers/android/vendor_hooks.c.
The EXPORT_TRACEPOINT_SYMBOL_GPL() should be
also added to drivers/android/vendor_hooks.c.

For example, if a new hook, 'android_vh_foo(int &ret)'
is added in do_exit() in exit.c, these changes are
needed:

1. create a new header file include/trace/hooks/foo.h
which contains:
	#include <trace/hooks/vendor_hooks.h>
	...
 	DECLARE_HOOK(android_vh_foo,
		     TP_PROTO(int *retp),
		     TP_ARGS(retp);

2. in exit.c, add
	#include <trace/hooks/foo.h>
	...
  	int ret = 0;
	...
  	android_vh_foo(&ret);
  	if (ret)
    		return ret;
	...

3. in drivers/android/vendor_hooks.c, add
	#include <trace/hooks/foo.h>
	...
	EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_foo);

The hook can then be attached by adding the registration code
to the module:

	#include <trace/hooks/sched.h>
	...
	static void my_foo(int *retp)
	{
		*retp = 0;
	}
	...
	rc = register_trace_android_vh_sched_exit(my_foo, NULL);

Bug: 156285741
Bug: 149632552
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I6a7d1c8919dae91c965e2a0450df50eac2d282db
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2020-07-09 15:26:29 +02:00