Commit Graph

40 Commits

Author SHA1 Message Date
Park Bumgyu
4eae6d1947 ANDROID: vendor_hook: modify cpuidle vendor hook
When entering cluster-wide or system-wide power mode, Exynos cpu
power management driver checks the next hrtimer events of cpu
composing the power domain to prevent unnecessary attempts to enter
the power mode. Since struct cpuidle_device has next_hrtimer, it
can be solved by passing cpuidle device as a parameter of vh.

In order to improve responsiveness, it is necessary to prevent
entering the deep idle state in boosting scenario. So, vendor
driver should be able to control the idle state.

Due to above requirements, the parameters required for idle enter
and exit different, so the vendor hook is separated into
cpu_idle_enter and cpu_idle_exit.

Bug: 176198732

Change-Id: I2262ba1bae5e6622a8e76bc1d5d16fb27af0bb8a
Signed-off-by: Park Bumgyu <bumgyu.park@samsung.com>
2021-01-04 18:51:30 +00:00
Choonghoon Park
d3092d8afd ANDROID: sched: Add rvh for cpu controller cgroup can attach
Add a restricted vendor hook to check whether a set of tasks can
move to other cgorup.

Bug: 175808144

Signed-off-by: Choonghoon Park <choong.park@samsung.com>
Change-Id: If7bac83e0d2d1069b1436331989c3926645eab19
2020-12-21 16:37:22 +00:00
Satya Durga Srinivasu Prabhala
90bd50a4d7 ANDROID: binder: consolidate wakeup vendor hooks into one
There are few vendor hooks available for binder wakeup related
functionality. As they both essentially do the same thing, we can
consolidate them into one.

Bug: 174219217
Change-Id: I44b472e7564eecbe8236ad2eb88b0433195f14d8
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-12-15 22:35:10 +00:00
Abhijeet Dharmapurikar
5fed80f580 ANDROID: sched: Add rvh for cpu controller cgroup attach
Add a restricted vendor hook when a set of tasks change the cgroups in
the cpu controller. This facilitates various scheduler value adds.

Bug: 175045928
Change-Id: I544046d631f4d6c9bc2b999e054b5a296ec31a81
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2020-12-10 18:12:07 +00:00
Stephen Dickey
782131fed0 ANDROID: cpu/hotplug: vendor hook for resume cpus
Incorporate a vendor hook in the resume cpus path
so that vendor specific activities may take place.

Bug: 161210528
Change-Id: I74d03247491b004e891dbcfe06a478d00a95ba9f
Signed-off-by: Stephen Dickey <dickey@codeaurora.org>
2020-12-08 19:09:34 +00:00
Shaleen Agrawal
292f430816 ANDROID: Sched: Add restricted vendor hooks for scheduler
Add vendors hooks for to facilitate various scheduler value adds.

Bug: 173725277
Change-Id: I4389f2a8121fe7ac49ad4610e25a77bfc38f4660
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2020-12-03 19:20:26 +00:00
Pavankumar Kondeti
2e14f01dc4 ANDROID: tracing: Add restricted vendor hooks for preemptirq events
We have debug infrastructure built on top of preempt/irq disable/enable
events. This requires modifications to the kernel tracing code. Since
this is not feasible with GKI, we started with registering to the
existing preemptirq trace events. However the performance of wide
variety of use cases are regressed as the rate of preemptirq events
is super high and generic trace events are slow.

Since GKI allows optimized trace events via restricted trace hooks,
add the same for preemptirq event.

Bug: 174541725
Change-Id: Ic8d3cdd1c1aa6a9267d0b755694fedffa2ea8e36
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2020-12-03 17:44:38 +00:00
Satya Durga Srinivasu Prabhala
37d7ed1b22 ANDROID: binder: Add vendor hooks
Add below vendor hooks to make vendor extensions possible.
	1. android_vh_binder_wakeup_poll_threads_ilocked
	2. android_vh_binder_wakeup_thread_ilocked

Bug: 174219217
Change-Id: I9f55ca4427583bbfb29a6808280a7d09e1fc22ee
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-12-02 16:25:08 +00:00
Chris Goldsworthy
62e32cf8f3 ANDROID: mm: Create vendor hooks to control ZONE_MOVABLE allocations
Create a vendor hook inside of gfp_zone() to modify which allocations
get to enter ZONE_MOVABLE, by zeroing out __GFP_HIGHMEM inside of the
trace hook based on certain conditions.

Separately, create separate trace hooks in the swap-in and readahead
paths to affect the behavior of the tracehook in gfp_zone().

Bug: 158645321
Change-Id: I4a4f0b724267ee120a1e5661f6da5d43d7ef6fc6
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
2020-12-01 18:07:54 +00:00
Satya Durga Srinivasu Prabhala
4d1ac6a160 ANDROID: sched/cpuset: Add vendor hook to change tasks affinity
Vendors might want to change tasks affinity settings when they are
moving from one cpuset into the other. Add vendor hook to give control
to vendor to implement what they need.

Bug: 174125747
Change-Id: Icee0405be0bca432002dae4a26ebe945082ce052
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-11-30 14:28:11 +00:00
Satya Durga Srinivasu Prabhala
f34f38632f ANDROID: sched/core: Add vendor hook to change task affinity
Vendors might want to change tasks affinity settings when they are
moving from one cpuset into the other. Add vendor hook to give control
to vendor to implement what they need in sched_setaffinity().

Bug: 174125747
Change-Id: Ie703448147377cd62e76a58b620a7ab849a04924
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-11-30 14:27:59 +00:00
Wei Wang
846bf8e8cb ANDROID: sched: Add vendor hooks for skipping sugov update
This is to add capability for vendor to decide whether a cpufreq update
is needed, e.g. up/down rate limit.

Using restricted hook since it can be called from scheduler wakeup path.

Bug: 170511085
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: If9adea3a3e31efbf3858fbd009665a07dc70c638
(cherry picked from commit f9f3464532a045257f8138338b1beda86ef0a3be)
Signed-off-by: Will McVicker <willmcvicker@google.com>
2020-11-27 16:25:31 +00:00
Wei Wang
06881e01b5 ANDROID: sched: Add vendor hooks for override sugov behavior
Upstream moved the sugov to DEADLINE class which has higher prio than RT
so it can potentially block many RT use case in Android.

Also currently iowait doesn't distinguish background/foreground tasks
and we have seen cases where device run to high frequency unnecessarily
when running some background I/O.

Bug: 171598214
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I21e9bfe9ef75a4178279574389e417c3f38e65ac
(cherry picked from commit 03177ef82bd942a3f163e826063491bae6ff0ac9)
Signed-off-by: Will McVicker <willmcvicker@google.com>
2020-11-27 16:25:08 +00:00
Rick Yiu
147a9b3d9e ANDROID: sched: Add vendor hooks for find_energy_efficient_cpu
Add hooks for vendor specific find_energy_efficient_cpu logic.

Bug: 170507310
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: I064b501017e32d4f22f8128bed8bf3a1508ab15b
(cherry picked from commit 2f108e2ec6e89609cbae32c5d13d6ad9f2e858cb)
Signed-off-by: Will McVicker <willmcvicker@google.com>
2020-11-27 16:21:19 +00:00
Pavankumar Kondeti
878495dacd ANDROID: sched: Add restrict vendor hooks for load balance
The following restrict vendor hooks are added. The vendor hook
can selectively opt in for the default scheduler behavior by not
modifying the done argument.

- android_rvh_sched_newidle_balance: For newly idle load balance.

- android_rvh_sched_nohz_balancer_kick: For deciding if an idle
CPU is woken up to do nohz balance or not.

- android_rvh_find_busiest_queue: For selecting the busiest runqueue
among the CPUs in the busiest group selected in find_busiest_group.

- android_rvh_migrate_queued_task: Vendor implementations may require
both source and destination CPUs runqueue locks to be held while
calling set_task_cpu() during a task migration. Add a hook when
a queued task is migration so that vendor implementation can detach
the task and call set_task_cpu() with both runqueue locks held.

Bug: 173661641
Change-Id: I6a09226081061b6433e4231359be252a0f28f04b
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2020-11-24 01:27:26 +00:00
Todd Kjos
efab334061 ANDROID: add vendor hooks to override show_cpufinfo_max_freq
QC value-add requires the ability to override the value displayed
by show_cpuinfo_max_freq.

Bug: 173984660
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ida11256f399f0730bc1228524b9687df3e7b8bf4
2020-11-23 21:01:12 +00:00
Murali Nalajala
76b58ff07b ANDROID: sched_clock: Add vendor hook to print epoch values
Add vendor hook to print epoch values when system enter and exit
out of suspend and resume. These epoch values are useful to know
how long the device is in suspend state. These values can be used
to synchronize various subsystem timestamps and have an unique
timestamp to correlate between various subsystems.

Bug: 172945021
Change-Id: I82a01e348d05a46c9c3921869cc9d2fc0fd28867
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2020-11-13 20:55:38 +00:00
Neeraj Upadhyay
00c6f53e03 ANDROID: gic-v3: Add vendor hook to GIC v3
Add vendor hook for affinity settings to GIC v3 irqchip
driver.

Bug: 172637074
Change-Id: I65ec8bedcb88c680ba1d6fcd2ffc5944c5a8a89c
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2020-11-12 02:15:25 +00:00
Amir Vajid
9bdaa3fa87 ANDROID: vendor_hooks: Add hook for jiffies updates
Create a vendor hook for jiffies updates by the
tick_do_timer_cpu.

Bug: 148928265
Change-Id: Ia442e20d446b8ce4f2b3f2be76655e72919c76eb
Signed-off-by: Amir Vajid <avajid@codeaurora.org>
2020-11-10 21:50:56 +00:00
Prasad Sodagudi
7aaa29b82b ANDROID: printk: add vendor hook for console flush
Add vendor hook for skipping console flush in cpu hotplug.

Bug: 165340180
Change-Id: I167e1595bbb50e57371bfabfde638624761d5f8a
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2020-11-10 20:07:49 +00:00
Sai Harshini Nimmala
bf3d991a7d ANDROID: sched: Add trace hook for rt throttle dump
Create a trace hook when RT tasks are throttled. This allows
vendors to debug long RT runs.

Bug: 172264047
Change-Id: I534959f8e8d714463aac2f9f1c5627d2e735f543
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2020-11-05 19:50:27 +00:00
Sangmoon Kim
0d8928ed6e 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
(cherry picked from commit 32b242337266a3b8e170b0ddc4bec478d5cf1f94)
2020-10-15 09:33:26 +09:00
Changki Kim
56da24e7a9 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: I747f776456330d904015cfe4ae423e4b63f18f85
Signed-off-by: Changki Kim <changki.kim@samsung.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Jonglin Lee <jonglin@google.com>
2020-10-07 14:30:30 -07:00
Sangmoon Kim
34f087452f 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
(cherry picked from commit 2ea974a00c7bdbbee140d68d8867ddcbfb529ecc)
2020-10-06 16:09:23 +00:00
Elliot Berman
0df7b95498 ANDROID: gic: Add vendor hook for gic-v3 resume
Add vendor hook for gic-v3 resume to allow vendor GIC enhancement.

Bug: 168730134
Change-Id: Id3298715355c8f592f58393db6aa903b18dd812c
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-09-20 22:10:33 +00:00
YT Chang
a2ca8408de 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
2020-09-11 01:47:17 +00:00
C-J.Chen
1aa1f6a7cf ANDROID: mpam: add vendor hook to record MPAM
- To use MPAM in kernel task, vendor_hook call is needed to
  set MPAM at scheduling time.
- Vendor_hooks is call ed when task is switching for MPAM state

Bug: 165333282
Signed-off-by: C-J.Chen <C-J.Chen@mediatek.com>
Change-Id: I30270c667c26e1a7039580b33011665bb3a8cce7
2020-08-28 00:05:35 +00:00
Yun Hsiang
e209b3b88d 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: 163935827

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I054740a7f60301d5a3b085bfa540d52853f5eec5
2020-08-20 21:31:45 +00:00
JianMin Liu
2935d588b1 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-20 19:41:06 +00:00
Park Bumgyu
322f59e742 ANDROID: vendor_hooks: add cpuidle event
An event that gather the idle state that the cpu attempted to enter and
actually entered is added. Through this, the idle statistics of the cpu
can be obtained and used for vendor specific algorithms or for system
analysis.

Bug: 162980647

Change-Id: I9c2491d524722042e881864488f7b3cf7e903d1e
Signed-off-by: Park Bumgyu <bumgyu.park@samsung.com>
2020-08-20 14:34:44 +09:00
Sangmoon Kim
9ad8ff902e 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
(cherry picked from commit b519ac4237)
2020-08-19 14:52:44 +00:00
JianMin Liu
3ba4b6d6a3 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-12 17:29:28 +00:00
JianMin Liu
f39f3ac200 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-12 17:29:18 +00:00
JianMin Liu
df18d99dab 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-07-28 03:04:13 +00:00
JianMin Liu
3fc5e94255 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-07-28 03:03:52 +00:00
Park Bumgyu
16330b3560 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>
2020-07-17 14:38:05 +00:00
Wooyeon Kim
74555f3992 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

Signed-off-by: Wooyeon Kim <wooy88.kim@samsung.com>
Change-Id: I853e1b6a9a51e24f770423bbc39fdd84265d78fc
2020-07-13 16:02:02 +00:00
Yun Hsiang
a1fc1fba46 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: 158263250
Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I80ff870453472e183ab2aae7381bff91e49ae296
2020-07-10 06:54:27 +00:00
Todd Kjos
dc419bab74 ANDROID: fix copyright notice
New vendor hook files cite Google, Inc instead of Google LLC

Fixes: 7f62740112 ("ANDROID: add support for vendor hooks")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: If42762c4bbe6d0a7ff1cc75b64a3b224902e121c
2020-05-18 20:58:23 +00:00
Todd Kjos
7f62740112 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
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I6a7d1c8919dae91c965e2a0450df50eac2d282db
2020-05-12 19:47:44 +00:00