Merge "Merge android11-5.4.60+ (22550de) into msm-5.4"

This commit is contained in:
qctecmdr 2020-09-01 11:50:48 -07:00 • committed by Gerrit - the friendly Code Review server
commit e2d2f0e595
15 changed files with 5443 additions and 5248 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -165,6 +165,7 @@
cpu_up
crypto_alloc_shash
crypto_destroy_tfm
crypto_shash_digest
crypto_shash_final
crypto_shash_update
_ctype
@ -182,6 +183,7 @@
_dev_err
devfreq_add_device
devfreq_add_governor
devfreq_get_devfreq_by_phandle
devfreq_recommended_opp
devfreq_register_opp_notifier
devfreq_remove_device
@ -227,6 +229,7 @@
devm_clk_get
devm_clk_get_optional
devm_clk_put
devm_devfreq_register_notifier
devm_extcon_dev_allocate
devm_extcon_dev_register
devm_extcon_dev_unregister
@ -305,6 +308,7 @@
dma_buf_begin_cpu_access
dma_buf_detach
dma_buf_end_cpu_access
dma_buf_end_cpu_access_partial
dma_buf_export
dma_buf_fd
dma_buf_get
@ -317,6 +321,11 @@
dma_buf_unmap_attachment
dma_buf_vmap
dma_buf_vunmap
dma_common_get_sgtable
dma_common_mmap
dma_direct_alloc
dma_direct_free
dma_direct_get_required_mask
dma_direct_map_page
dma_direct_map_resource
dma_direct_map_sg
@ -357,6 +366,7 @@
down_read
down_trylock
down_write
d_path
driver_find
driver_find_device
driver_register
@ -594,6 +604,7 @@
jiffies
jiffies_64
jiffies_64_to_clock_t
jiffies64_to_msecs
jiffies_to_msecs
jiffies_to_usecs
kasprintf
@ -639,6 +650,7 @@
kstrtou16
kstrtou8
kstrtouint
kstrtouint_from_user
kstrtoull
kstrtoull_from_user
kthread_bind
@ -658,6 +670,7 @@
kthread_worker_fn
ktime_get
ktime_get_mono_fast_ns
ktime_get_raw
ktime_get_raw_ts64
ktime_get_real_ts64
ktime_get_ts64
@ -672,6 +685,7 @@
llist_add_batch
__lock_buffer
loops_per_jiffy
map_vm_area
match_string
media_create_intf_link
media_create_pad_link
@ -725,6 +739,7 @@
mutex_lock_interruptible
mutex_trylock
mutex_unlock
names_cachep
__napi_alloc_skb
napi_complete_done
napi_disable
@ -1313,6 +1328,7 @@
trace_event_reg
trace_handle_return
trace_output_call
__tracepoint_android_vh_is_fpsimd_save
__tracepoint_device_pm_callback_end
__tracepoint_device_pm_callback_start
__tracepoint_pelt_cfs_tp
@ -1367,6 +1383,7 @@
ufshcd_shutdown
ufshcd_system_resume
ufshcd_system_suspend
ufshcd_wb_ctrl
unmap_mapping_range
__unregister_chrdev
unregister_chrdev_region

View file

@ -43,9 +43,9 @@
/* Translate a kernel address of @sym into its equivalent linear mapping */
#define kvm_ksym_ref(sym) \
({ \
void *val = &sym; \
void *val = __va_function(sym); \
if (!is_kernel_in_hyp_mode()) \
val = lm_alias(&sym); \
val = lm_alias(val); \
val; \
})

View file

@ -321,13 +321,15 @@ static inline void *phys_to_virt(phys_addr_t x)
* virtual address. Therefore, use inline assembly to ensure we are
* always taking the address of the actual function.
*/
#define __pa_function(x) ({ \
unsigned long addr; \
#define __va_function(x) ({ \
void *addr; \
asm("adrp %0, " __stringify(x) "\n\t" \
"add %0, %0, :lo12:" __stringify(x) : "=r" (addr)); \
__pa_symbol(addr); \
addr; \
})
#define __pa_function(x) __pa_symbol(__va_function(x))
/*
* virt_to_page(x) convert a _valid_ virtual address to struct page *
* virt_addr_valid(x) indicates whether a virtual address is valid

View file

@ -15,12 +15,20 @@
#include <trace/hooks/rwsem.h>
#include <trace/hooks/futex.h>
#include <trace/hooks/fpsimd.h>
#include <trace/hooks/topology.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
* associated with them) to allow external modules to probe them.
*/
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_select_task_rq_fair);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_select_task_rq_rt);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_select_fallback_rq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_scheduler_tick);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_enqueue_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dequeue_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_can_migrate_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_lowest_rq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_rtmutex_prepare_setprio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_prepare_prio_fork);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_finish_prio_fork);
@ -35,6 +43,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_wait_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_show_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ptype_head);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kfree_skb);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_arch_set_freq_scale);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_transaction_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_set_priority);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_restore_priority);

View file

@ -21,6 +21,7 @@
#include <linux/sched.h>
#include <linux/smp.h>
#include <linux/sched.h>
#include <trace/hooks/topology.h>
DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
DEFINE_PER_CPU(unsigned long, max_cpu_freq);
@ -34,7 +35,9 @@ void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
scale = (cur_freq << SCHED_CAPACITY_SHIFT) / max_freq;
for_each_cpu(i, cpus) {
trace_android_vh_arch_set_freq_scale(cur_freq, max_freq, &scale);
for_each_cpu(i, cpus){
per_cpu(freq_scale, i) = scale;
per_cpu(max_cpu_freq, i) = max_freq;
}
@ -55,6 +58,8 @@ void arch_set_max_freq_scale(struct cpumask *cpus,
scale = (policy_max_freq << SCHED_CAPACITY_SHIFT) / max_freq;
trace_android_vh_arch_set_freq_scale(policy_max_freq, max_freq, &scale);
for_each_cpu(cpu, cpus)
per_cpu(max_freq_scale, cpu) = scale;
}

View file

@ -301,12 +301,16 @@ struct device *serdev_tty_port_register(struct tty_port *port,
* be ignored.
*/
if (parent->bus == &platform_bus_type) {
char tty_port_name[7];
if (pdev_tty_port) {
unsigned long pdev_idx;
int tty_len = strlen(drv->name);
sprintf(tty_port_name, "%s%d", drv->name, idx);
if (pdev_tty_port &&
!strcmp(pdev_tty_port, tty_port_name)) {
platform = true;
if (!strncmp(pdev_tty_port, drv->name, tty_len)) {
if (!kstrtoul(pdev_tty_port + tty_len, 10,
&pdev_idx) && pdev_idx == idx) {
platform = true;
}
}
}
}

View file

@ -16,6 +16,36 @@ DECLARE_RESTRICTED_HOOK(android_rvh_select_task_rq_fair,
TP_PROTO(struct task_struct *p, int prev_cpu, int sd_flag, int wake_flags, int *new_cpu),
TP_ARGS(p, prev_cpu, sd_flag, wake_flags, new_cpu), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_select_task_rq_rt,
TP_PROTO(struct task_struct *p, int prev_cpu, int sd_flag, int wake_flags, int *new_cpu),
TP_ARGS(p, prev_cpu, sd_flag, wake_flags, new_cpu), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_select_fallback_rq,
TP_PROTO(int cpu, struct task_struct *p, int *new_cpu),
TP_ARGS(cpu, p, new_cpu), 1);
struct rq;
DECLARE_HOOK(android_vh_scheduler_tick,
TP_PROTO(struct rq *rq),
TP_ARGS(rq));
DECLARE_RESTRICTED_HOOK(android_rvh_enqueue_task,
TP_PROTO(struct rq *rq, struct task_struct *p),
TP_ARGS(rq, p), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_task,
TP_PROTO(struct rq *rq, struct task_struct *p),
TP_ARGS(rq, p), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_can_migrate_task,
TP_PROTO(struct task_struct *p, int dst_cpu, int *can_migrate),
TP_ARGS(p, dst_cpu, can_migrate), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_find_lowest_rq,
TP_PROTO(struct task_struct *p, struct cpumask *local_cpu_mask,
int *lowest_cpu),
TP_ARGS(p, local_cpu_mask, lowest_cpu), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_prepare_prio_fork,
TP_PROTO(struct task_struct *p),
TP_ARGS(p), 1);
@ -37,6 +67,13 @@ DECLARE_RESTRICTED_HOOK(android_rvh_setscheduler,
TP_ARGS(p), 1);
#else
#define trace_android_rvh_select_task_rq_fair(p, prev_cpu, sd_flag, wake_flags, new_cpu)
#define trace_android_rvh_select_task_rq_rt(p, prev_cpu, sd_flag, wake_flags, new_cpu)
#define trace_android_rvh_select_fallback_rq(cpu, p, dest_cpu)
#define trace_android_vh_scheduler_tick(rq)
#define trace_android_rvh_enqueue_task(rq, p)
#define trace_android_rvh_dequeue_task(rq, p)
#define trace_android_rvh_can_migrate_task(p, dst_cpu, can_migrate)
#define trace_android_rvh_find_lowest_rq(p, local_cpu_mask, lowest_cpu)
#define trace_android_rvh_prepare_prio_fork(p)
#define trace_android_rvh_finish_prio_fork(p)
#define trace_android_rvh_rtmutex_prepare_setprio(p, pi_task)

View file

@ -0,0 +1,27 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM topology
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_TOPOLOGY_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_TOPOLOGY_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
DECLARE_HOOK(android_vh_arch_set_freq_scale,
TP_PROTO(unsigned long freq, unsigned long max, unsigned long *scale),
TP_ARGS(freq, max, scale));
#else
#define trace_android_vh_arch_set_freq_scale(freq, max, scale)
#endif
#endif /* _TRACE_HOOK_TOPOLOGY_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View file

@ -1331,6 +1331,8 @@ static inline void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
p->sched_class->enqueue_task(rq, p, flags);
walt_update_last_enqueue(p);
trace_sched_enq_deq_task(p, 1, cpumask_bits(&p->cpus_mask)[0]);
trace_android_rvh_enqueue_task(rq, p);
}
static inline void dequeue_task(struct rq *rq, struct task_struct *p, int flags)
@ -1350,6 +1352,8 @@ static inline void dequeue_task(struct rq *rq, struct task_struct *p, int flags)
early_detection_notify(rq, sched_ktime_clock());
#endif
trace_sched_enq_deq_task(p, 0, cpumask_bits(&p->cpus_mask)[0]);
trace_android_rvh_dequeue_task(rq, p);
}
void activate_task(struct rq *rq, struct task_struct *p, int flags)
@ -2101,11 +2105,15 @@ static int select_fallback_rq(int cpu, struct task_struct *p, bool allow_iso)
int nid = cpu_to_node(cpu);
const struct cpumask *nodemask = NULL;
enum { cpuset, possible, fail, bug } state = cpuset;
int dest_cpu;
int dest_cpu = -1;
#ifdef CONFIG_SCHED_WALT
int isolated_candidate = -1;
#endif
trace_android_rvh_select_fallback_rq(cpu, p, &dest_cpu);
if (dest_cpu >= 0)
return dest_cpu;
/*
* If the node that the CPU is on has been offlined, cpu_to_node()
* will return -1. There is no CPU on the node, and we should
@ -3781,6 +3789,8 @@ void scheduler_tick(void)
if (curr->sched_class == &fair_sched_class)
check_for_migration(rq, curr);
trace_android_vh_scheduler_tick(rq);
}
#ifdef CONFIG_NO_HZ_FULL

View file

@ -8111,9 +8111,14 @@ static
int can_migrate_task(struct task_struct *p, struct lb_env *env)
{
int tsk_cache_hot;
int can_migrate = 1;
lockdep_assert_held(&env->src_rq->lock);
trace_android_rvh_can_migrate_task(p, env->dst_cpu, &can_migrate);
if (!can_migrate)
return 0;
/*
* We do not migrate tasks that are:
* 1) throttled_lb_pair, or

View file

@ -13,6 +13,8 @@
#include "walt.h"
#include <trace/hooks/sched.h>
int sched_rr_timeslice = RR_TIMESLICE;
int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
/* More than 4 hours if BW_SHIFT equals 20. */
@ -1536,6 +1538,12 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)
struct rq *rq;
bool may_not_preempt;
bool test;
int target_cpu = -1;
trace_android_rvh_select_task_rq_rt(p, cpu, sd_flag,
flags, &target_cpu);
if (target_cpu >= 0)
return target_cpu;
/* For anything but wake ups, just return the task_cpu */
if (sd_flag != SD_BALANCE_WAKE && sd_flag != SD_BALANCE_FORK)
@ -1924,6 +1932,11 @@ static int find_lowest_rq(struct task_struct *task)
int this_cpu = smp_processor_id();
int cpu = -1;
int ret;
int lowest_cpu = -1;
trace_android_rvh_find_lowest_rq(task, lowest_mask, &lowest_cpu);
if (lowest_cpu >= 0)
return lowest_cpu;
/* Make sure the mask is initialized first */
if (unlikely(!lowest_mask))

View file

@ -5699,7 +5699,7 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf)
}
/* If trace pipe files are being read, we can't change the tracer */
if (tr->trace_ref) {
if (tr->current_trace->ref) {
ret = -EBUSY;
goto out;
}
@ -5915,7 +5915,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
nonseekable_open(inode, filp);
tr->trace_ref++;
tr->current_trace->ref++;
out:
mutex_unlock(&trace_types_lock);
return ret;
@ -5934,7 +5934,7 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)
mutex_lock(&trace_types_lock);
tr->trace_ref--;
tr->current_trace->ref--;
if (iter->trace->pipe_close)
iter->trace->pipe_close(iter);
@ -7246,7 +7246,7 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp)
filp->private_data = info;
tr->trace_ref++;
tr->current_trace->ref++;
mutex_unlock(&trace_types_lock);
@ -7347,7 +7347,7 @@ static int tracing_buffers_release(struct inode *inode, struct file *file)
mutex_lock(&trace_types_lock);
iter->tr->trace_ref--;
iter->tr->current_trace->ref--;
__trace_array_put(iter->tr);
@ -8486,7 +8486,7 @@ static int __remove_instance(struct trace_array *tr)
{
int i;
if (tr->ref || (tr->current_trace && tr->trace_ref))
if (tr->ref || (tr->current_trace && tr->current_trace->ref))
return -EBUSY;
list_del(&tr->list);

View file

@ -309,7 +309,6 @@ struct trace_array {
struct trace_event_file *trace_marker_file;
cpumask_var_t tracing_cpumask; /* only trace on set CPUs */
int ref;
int trace_ref;
#ifdef CONFIG_FUNCTION_TRACER
struct ftrace_ops *ops;
struct trace_pid_list __rcu *function_pids;
@ -499,6 +498,7 @@ struct tracer {
struct tracer *next;
struct tracer_flags *flags;
int enabled;
int ref;
bool print_max;
bool allow_instances;
#ifdef CONFIG_TRACER_MAX_TRACE