Merge android11-5.4.61+ (364ec3d) into msm-5.4

* refs/heads/tmp-364ec3d:
  UPSTREAM: futex: Don't enable IRQs unconditionally in put_pi_state()
  UPSTREAM: futex: Handle transient "ownerless" rtmutex state correctly
  UPSTREAM: futex: Fix incorrect should_fail_futex() handling
  ANDROID: add macros to create OEM data fields
  BACKPORT: arm64: perf: Support new DT compatibles
  UPSTREAM: usb: xhci-mtk: fix unreleased bandwidth data
  ANDROID: sched: add em_pd_energy vendor hook
  ANDROID: schedutil: add vendor hook for adjusting util to freq calculation
  ANDROID: ABI: update symbols of unisoc whitelist
  Revert "BACKPORT: FROMGIT: mm: improve mprotect(R|W) efficiency on pages referenced once"
  BACKPORT: FROMGIT: mm: improve mprotect(R|W) efficiency on pages referenced once
  ANDROID: simplify vendor hooks for non-GKI builds

 Conflicts:
	kernel/sched/cpufreq_schedutil.c

Change-Id: I9e98cddb693248a3c255d7010c8aeaad85b60ced
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
This commit is contained in:
Srinivasarao P 2021-02-16 10:24:52 +05:30
commit 022f93cd7d
17 changed files with 297 additions and 171 deletions

View file

@ -881,8 +881,9 @@ static void put_pi_state(struct futex_pi_state *pi_state)
*/
if (pi_state->owner) {
struct task_struct *owner;
unsigned long flags;
raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock);
raw_spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags);
owner = pi_state->owner;
if (owner) {
raw_spin_lock(&owner->pi_lock);
@ -890,7 +891,7 @@ static void put_pi_state(struct futex_pi_state *pi_state)
raw_spin_unlock(&owner->pi_lock);
}
rt_mutex_proxy_unlock(&pi_state->pi_mutex, owner);
raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags);
}
if (current->pi_state_cache) {
@ -1595,8 +1596,10 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_pi_state *pi_
*/
newval = FUTEX_WAITERS | task_pid_vnr(new_owner);
if (unlikely(should_fail_futex(true)))
if (unlikely(should_fail_futex(true))) {
ret = -EFAULT;
goto out_unlock;
}
ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, newval);
if (!ret && (curval != uval)) {
@ -2513,10 +2516,22 @@ retry:
}
/*
* Since we just failed the trylock; there must be an owner.
* The trylock just failed, so either there is an owner or
* there is a higher priority waiter than this one.
*/
newowner = rt_mutex_owner(&pi_state->pi_mutex);
BUG_ON(!newowner);
/*
* If the higher priority waiter has not yet taken over the
* rtmutex then newowner is NULL. We can't return here with
* that state because it's inconsistent vs. the user space
* state. So drop the locks and try again. It's a valid
* situation and not any different from the other retry
* conditions.
*/
if (unlikely(!newowner)) {
err = -EAGAIN;
goto handle_err;
}
} else {
WARN_ON_ONCE(argowner != current);
if (oldowner == current) {

View file

@ -13,6 +13,7 @@
#include <linux/sched/cpufreq.h>
#include <trace/events/power.h>
#include <linux/sched/sysctl.h>
#include <trace/hooks/sched.h>
#define IOWAIT_BOOST_MIN (SCHED_CAPACITY_SCALE / 8)
@ -295,10 +296,15 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
struct cpufreq_policy *policy = sg_policy->policy;
unsigned int freq = arch_scale_freq_invariant() ?
policy->cpuinfo.max_freq : policy->cur;
unsigned long next_freq = 0;
trace_android_vh_map_util_freq(util, freq, max, &next_freq);
if (next_freq)
freq = next_freq;
else
freq = map_util_freq(util, freq, max);
freq = map_util_freq(util, freq, max);
trace_sugov_next_freq(policy->cpu, util, max, freq);
if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update)
return sg_policy->next_freq;

View file

@ -6903,6 +6903,7 @@ compute_energy(struct task_struct *p, int dst_cpu, struct perf_domain *pd)
unsigned long cpu_cap = arch_scale_cpu_capacity(cpumask_first(pd_mask));
#endif
unsigned long max_util = 0, sum_util = 0;
unsigned long energy = 0;
int cpu;
unsigned long cpu_util;
@ -6945,7 +6946,11 @@ compute_energy(struct task_struct *p, int dst_cpu, struct perf_domain *pd)
max_util = max(max_util, cpu_util);
}
return em_pd_energy(pd->em_pd, max_util, sum_util);
trace_android_vh_em_pd_energy(pd->em_pd, max_util, sum_util, &energy);
if (!energy)
energy = em_pd_energy(pd->em_pd, max_util, sum_util);
return energy;
}
#ifdef CONFIG_SCHED_WALT

View file

@ -29,7 +29,8 @@ static unsigned int one_million = 1000000;
static DEFINE_PER_CPU(u64, irq_disabled_ts);
static DEFINE_PER_CPU(u64, preempt_disabled_ts);
static void note_irq_disable(void *u1, unsigned long u2, unsigned long u3)
static void __attribute__((__unused__))
note_irq_disable(void *u1, unsigned long u2, unsigned long u3)
{
if (is_idle_task(current))
return;
@ -41,7 +42,8 @@ static void note_irq_disable(void *u1, unsigned long u2, unsigned long u3)
this_cpu_write(irq_disabled_ts, sched_clock());
}
static void test_irq_disable_long(void *u1, unsigned long u2, unsigned long u3)
static void __attribute__((__unused__))
test_irq_disable_long(void *u1, unsigned long u2, unsigned long u3)
{
u64 ts = this_cpu_read(irq_disabled_ts);
@ -69,12 +71,14 @@ static void test_irq_disable_long(void *u1, unsigned long u2, unsigned long u3)
}
}
static void note_preempt_disable(void *u1, unsigned long u2, unsigned long u3)
static void __attribute__((__unused__))
note_preempt_disable(void *u1, unsigned long u2, unsigned long u3)
{
this_cpu_write(preempt_disabled_ts, sched_clock());
}
static void test_preempt_disable_long(void *u1, unsigned long u2,
static void __attribute__((__unused__))
test_preempt_disable_long(void *u1, unsigned long u2,
unsigned long u3)
{
u64 ts = this_cpu_read(preempt_disabled_ts);