GitHub/LineageOS/android_kernel_motorola_exynos9610.git
6 years agosched: schedutil: remove update_single function.
Youngtae Lee [Thu, 26 Apr 2018 12:27:22 +0000 (21:27 +0900)]
sched: schedutil: remove update_single function.

Change-Id: I870028b8b159501e79730f226e8c46c0c2bff50f
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpupm: change condition for cpuhp_last_cpu mask.
Youngtae Lee [Mon, 21 May 2018 05:03:20 +0000 (14:03 +0900)]
cpupm: change condition for cpuhp_last_cpu mask.

Change-Id: I2a276317d3857db99317f9314e5fe567b7bcc96d
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agoRevert "cpu: Add function to confirm last cpu of cluster".
Youngtae Lee [Mon, 21 May 2018 05:04:03 +0000 (14:04 +0900)]
Revert "cpu: Add function to confirm last cpu of cluster".

This reverts commit 0ef067b178779bee49c8cddf5ad9ff07eade0512.

Change-Id: I0defd8ea13a5435cedac4a4901033977e2e67975

6 years agosamsung: emc: Change max frequency control method.
Youngtae Lee [Wed, 16 May 2018 11:55:51 +0000 (20:55 +0900)]
samsung: emc: Change max frequency control method.

To fix bug that max frequency is not updated
when all cpus of cluster power down, add pre_update_constraints

Change-Id: Ie5c408dd5e4d1713868ef07c19c39989c45d1a21
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpu: Add CPUHP_EXYNOS_BOOST_CTRL_PRE event.
Youngtae Lee [Wed, 16 May 2018 11:59:53 +0000 (20:59 +0900)]
cpu: Add CPUHP_EXYNOS_BOOST_CTRL_PRE event.

Change-Id: I062f4fe5abae7fed4466b70a3e6176a3bf405249
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpufrqe: acme: remove exynos_cpufreq_allow_change_max.
Youngtae Lee [Wed, 16 May 2018 04:42:25 +0000 (13:42 +0900)]
cpufrqe: acme: remove exynos_cpufreq_allow_change_max.

Change-Id: Ibe558896a0fdd3c7daf8f844a8bff50bc54348f8
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: emc: change timer add condition.
Youngtae Lee [Tue, 15 May 2018 01:18:40 +0000 (10:18 +0900)]
samsung: emc: change timer add condition.

If req_mode and cur_mode is same, skip adding timer

Change-Id: I80ba564f705c131609e0b96ff99126a4495ae3dd
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: emc: change real frequency check function.
Youngtae Lee [Mon, 14 May 2018 02:08:23 +0000 (11:08 +0900)]
samsung: emc: change real frequency check function.

Use acme driver old frequency or real cmu value instead of policy->cur

Change-Id: Ide22cf698d0177bcebdba45d980886124ee3c74f
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agoDEBUG: Add trace for cpus_up/down.
Youngtae Lee [Mon, 23 Apr 2018 12:06:54 +0000 (21:06 +0900)]
DEBUG: Add trace for cpus_up/down.

Change-Id: Ic19ff47bd706813bafc99f2d3e421d846acb5c42
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpu: Add function to confirm last cpu of cluster.
Youngtae Lee [Wed, 9 May 2018 11:41:46 +0000 (20:41 +0900)]
cpu: Add function to confirm last cpu of cluster.

It shows whether last cpu of fasthp_cpus or not

Change-Id: Ibf7c6913d78ad32422572759b5576545c85302f5
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: cpupm: Change cluster disable condition
Youngtae Lee [Wed, 9 May 2018 11:36:07 +0000 (20:36 +0900)]
samsung: cpupm: Change cluster disable condition

1. reference cluster_mask instead of coregroup_mask because
   coregroup_mask no more couldn't show h/w clsuter information.

2. To support fast_hotplug, add function to confirm last cpu in the cluster.
   If many cpus power off at the sametime, cpu_online_mask couldn't guarantee
   last cpu of cluster.

Change-Id: Ic08fbdfa6ab981cf48d6c3f5e294f10d1f1a907a
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agoarm64: psci: Add affinity_lv for hotplug
Youngtae Lee [Fri, 4 May 2018 06:48:10 +0000 (15:48 +0900)]
arm64: psci: Add affinity_lv for hotplug

To indecating hotplug with cluster power down,
pass affinity_level EL3 by PSCI.

Change-Id: I4687c828e26150485e6ff426a815562322587ee9
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: cpupm: Add cpuhp_last_cpu mask to indecating last_cpu
Youngtae Lee [Fri, 4 May 2018 06:26:16 +0000 (15:26 +0900)]
samsung: cpupm: Add cpuhp_last_cpu mask to indecating last_cpu

this mask shows cpus that should perform
the cluster power down sequence.

Change-Id: If41ecb630191674dc47995808c383688aa0d8d55
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: emc: fix bug that return wrong pointer of head list
Youngtae Lee [Fri, 4 May 2018 01:26:58 +0000 (10:26 +0900)]
samsung: emc: fix bug that return wrong pointer of head list

Change-Id: I6ebfa125f5c60255dfcfc6cfe10510e273246559
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: emc: change print wrong message in pwr_check func
Youngtae Lee [Wed, 2 May 2018 08:48:17 +0000 (17:48 +0900)]
samsung: emc: change print wrong message in pwr_check func

Change-Id: If017f31c8ea587bd4aeeaedc40f4244e3779da7c
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: cpuhp: Add panic condition when requesting hotplug cpu0 out
Youngtae Lee [Wed, 2 May 2018 05:15:02 +0000 (14:15 +0900)]
samsung: cpuhp: Add panic condition when requesting hotplug cpu0 out

Change-Id: I24152b1f32b82c6d413f8a0158f508f08b696679
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: emc: set base mode when user_mode is disabled
Youngtae Lee [Wed, 2 May 2018 02:27:23 +0000 (11:27 +0900)]
samsung: emc: set base mode when user_mode is disabled

Change-Id: I12176542ddcba548913d5c0c0d14e81c4b9c9b6e
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpufreq: acme: get_freq returns cached freq when access offline cluster
Youngtae Lee [Wed, 2 May 2018 01:54:04 +0000 (10:54 +0900)]
cpufreq: acme: get_freq returns cached freq when access offline cluster

Change-Id: Id3a3fb04256664644a4a3daf61f2764e0c10462e
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpufreq: acme: Add function to check max_constraints of boost domain.
Youngtae Lee [Fri, 27 Apr 2018 06:29:48 +0000 (15:29 +0900)]
cpufreq: acme: Add function to check max_constraints of boost domain.

Change-Id: I956942e6ed1ea6e1da8ccd1f747d9cf503b95b2b
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: emc: Add function to check target_freq is available
Youngtae Lee [Fri, 27 Apr 2018 06:28:58 +0000 (15:28 +0900)]
samsung: emc: Add function to check target_freq is available

Change-Id: Ie957e3d0c8064f5d8b2fa324fb1205d373554cf6
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpu: support cpus_up for fast hotplug in
Youngtae Lee [Fri, 27 Apr 2018 04:49:39 +0000 (13:49 +0900)]
cpu: support cpus_up for fast hotplug in

Change-Id: I5dc7103355eed846fdb839fbf721547055f5297f
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: emc: change msleep to udelay and expired time for power checking
Youngtae Lee [Thu, 26 Apr 2018 12:31:48 +0000 (21:31 +0900)]
samsung: emc: change msleep to udelay and expired time for power checking

Change-Id: I274968b7291ba0f23fcd1943e4dd2116ce62b680
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agoarm64: smp: change print level of "shutdown"
Youngtae Lee [Thu, 26 Apr 2018 12:29:58 +0000 (21:29 +0900)]
arm64: smp: change print level of "shutdown"

Change-Id: Ieb68cd68af9c7b98fb2fc0c6399be28766212719
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: emc: Change priority of change thread
Youngtae Lee [Thu, 26 Apr 2018 05:48:29 +0000 (14:48 +0900)]
samsung: emc: Change priority of change thread

Change-Id: I480a38e996aa94781811c18988d3c1232b5d1327
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agobase: topology: Don't add/remove sysfs for hotplug
Youngtae Lee [Thu, 26 Apr 2018 04:56:00 +0000 (13:56 +0900)]
base: topology: Don't add/remove sysfs for hotplug

To reduce hotplug time, don't add or remove sysfs group

Change-Id: I1b7cab11e9157f5291492d8412e4e815a6cec96c
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpu: Support to paraller takedown_cpus
Youngtae Lee [Tue, 24 Apr 2018 10:03:37 +0000 (19:03 +0900)]
cpu: Support to paraller takedown_cpus

Change-Id: Ia40b4c61adf95de510832bfd0d5fa4db0adda06d
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agoRevert "smp/hotplug: Differentiate the AP-work lockdep class between up and down"
Youngtae Lee [Tue, 24 Apr 2018 08:47:28 +0000 (17:47 +0900)]
Revert "smp/hotplug: Differentiate the AP-work lockdep class between up and down"

This reverts commit 5f4b55e10645b7371322c800a5ec745cab487a6c.

Change-Id: I841ec3c7ecd6197ae30c52987c8d6e86655d453e

6 years agoRevert "cpu/hotplug: Convert hotplug locking to percpu rwsem"
Youngtae Lee [Tue, 24 Apr 2018 08:44:52 +0000 (17:44 +0900)]
Revert "cpu/hotplug: Convert hotplug locking to percpu rwsem"

This reverts commit fc8dffd379ca5620664336eb895a426b42847558.

Change-Id: I842b5ee4c622f1a892a1a292f5a4ad886943320c

6 years agocpu: change order and mehod for sched_active/deactive
Youngtae Lee [Mon, 23 Apr 2018 11:16:21 +0000 (20:16 +0900)]
cpu: change order and mehod for sched_active/deactive

Change-Id: Ia456ad0febd5c63be8390f74ec6a80c6a60499f4
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: cpupm: Disable idle during hotplug in-out
Youngtae Lee [Mon, 23 Apr 2018 07:29:22 +0000 (16:29 +0900)]
samsung: cpupm: Disable idle during hotplug in-out

Change-Id: I4eaff38545bf584b3867da9078b16bebaf42499d
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agokernel: cpu: support to processe paraller cpus hp
Youngtae Lee [Mon, 23 Apr 2018 07:23:25 +0000 (16:23 +0900)]
kernel: cpu: support to processe paraller cpus hp

Change-Id: I0dc6c787a773b7784d7fc0ab566e47a49835b00b
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosched: schedutil: remove syncronize_rcu for fast hp
Youngtae Lee [Mon, 23 Apr 2018 04:06:33 +0000 (13:06 +0900)]
sched: schedutil: remove syncronize_rcu for fast hp

Change-Id: I3eebe5d8e12fc8fe5bc0810949c76883cb0564be
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpufreq: Add fast_on/offline for fast hotplug
Youngtae Lee [Mon, 23 Apr 2018 04:00:19 +0000 (13:00 +0900)]
cpufreq: Add fast_on/offline for fast hotplug

This function performs fast hotplug processing
on fast hp cpus at once. Even if cluster off,
executes only goernor stop & start for fast hp

Change-Id: I288ebd19ee0fbb91f596234eac0fb11fd71573c5
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosamsung: cpuhp: Support cpus_up/down for fast hotplug
Youngtae Lee [Mon, 23 Apr 2018 03:59:32 +0000 (12:59 +0900)]
samsung: cpuhp: Support cpus_up/down for fast hotplug

Change-Id: I02aa69a55c80e3e1ff43a2eb790b01adee6a78c7
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agocpu: Support cpus_up/dow for fast hotplug
Youngtae Lee [Mon, 23 Apr 2018 03:57:31 +0000 (12:57 +0900)]
cpu: Support cpus_up/dow for fast hotplug

Change-Id: Ib0b3da952426338a4afc7e388c9fd5d6874cdce7
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
6 years agosched: ems: introduce task band
Park Bumgyu [Fri, 25 May 2018 05:01:52 +0000 (14:01 +0900)]
sched: ems: introduce task band

Change-Id: Ic3fbe3e80c8033f5c1c77f02cb0eeb6ee04d9630
Signed-off-by: Park Bumgyu <bumgyu.park@samsung.com>
6 years agosched: fair: Add support to PELT ramp/decay timings
lakkyung.jung [Tue, 24 Apr 2018 14:02:12 +0000 (23:02 +0900)]
sched: fair: Add support to PELT ramp/decay timings

Change-Id: If12dd8b4df211c898667cdb7c8b42d0eba9ac200
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Signed-off-by: lakkyung.jung <lakkyung.jung@samsung.com>
6 years agosched: fair/ems: Add schedtune_util_est
lakkyung.jung [Fri, 4 May 2018 11:16:53 +0000 (20:16 +0900)]
sched: fair/ems: Add schedtune_util_est

Change-Id: I0a0f1723356683829ce709ec750f4f013aa1c75b
Signed-off-by: lakkyung.jung <lakkyung.jung@samsung.com>
6 years agosched: tune: Add utilest interface to schedtune.
lakkyung.jung [Fri, 4 May 2018 01:20:03 +0000 (10:20 +0900)]
sched: tune: Add utilest interface to schedtune.

Change-Id: I4e5313f7128f5aa599b7214eaf13679d1f9484ef
Signed-off-by: lakkyung.jung <lakkyung.jung@samsung.com>
6 years agosched: fair/ems: Add to apply util-est to wake up balance.
lakkyung.jung [Mon, 16 Apr 2018 14:05:00 +0000 (23:05 +0900)]
sched: fair/ems: Add to apply util-est to wake up balance.

Change-Id: Ia3ff1303d3180612308399d0f311d6c278ddefa9
Signed-off-by: lakkyung.jung <lakkyung.jung@samsung.com>
6 years agosched/events: Introduce util_est trace events
lakkyung.jung [Mon, 16 Apr 2018 13:22:43 +0000 (22:22 +0900)]
sched/events: Introduce util_est trace events

Change-Id: I22c98bbaa7dda598d31a20b310afbf16d5fb8208
Signed-off-by: lakkyung.jung <lakkyung.jung@samsung.com>
6 years agosched/fair: update util_est only on util_avg updates
lakkyung.jung [Mon, 16 Apr 2018 06:46:16 +0000 (15:46 +0900)]
sched/fair: update util_est only on util_avg updates

The estimated utilization of a task is currently updated every time the
task is dequeued. However, to keep overheads under control, PELT signals
are effectively updated at maximum once every 1ms.

Thus, for really short running tasks, it can happen that their util_avg
value has not been updates since their last enqueue.  If such tasks are
also frequently running tasks (e.g. the kind of workload generated by
hackbench) it can also happen that their util_avg is updated only every
few activations.

This means that updating util_est at every dequeue potentially introduces
not necessary overheads and it's also conceptually wrong if the util_avg
signal has never been updated during a task activation.

Let's introduce a throttling mechanism on task's util_est updates
to sync them with util_avg updates. To make the solution memory
efficient, both in terms of space and load/store operations, we encode a
synchronization flag into the LSB of util_est.enqueued.
This makes util_est an even values only metric, which is still
considered good enough for its purpose.
The synchronization bit is (re)set by __update_load_avg_se() once the
PELT signal of a task has been updated during its last activation.

Such a throttling mechanism allows to keep under control util_est
overheads in the wakeup hot path, thus making it a suitable mechanism
which can be enabled also on high-intensity workload systems.
Thus, this now switches on by default the estimation utilization
scheduler feature.

Change-Id: Ia548c1fa33ab1e9d20faa0bf7503ebaba5946063
Suggested-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Turner <pjt@google.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Morten Rasmussen <morten.rasmussen@arm.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: linux-kernel@vger.kernel.org
6 years agosched/cpufreq_schedutil: use util_est for OPP selection
lakkyung.jung [Mon, 16 Apr 2018 02:23:13 +0000 (11:23 +0900)]
sched/cpufreq_schedutil: use util_est for OPP selection

- backport util-est from linux-power.git

When schedutil looks at the CPU utilization, the current PELT value for
that CPU is returned straight away. In certain scenarios this can have
undesired side effects and delays on frequency selection.

For example, since the task utilization is decayed at wakeup time, a
long sleeping big task newly enqueued does not add immediately a
significant contribution to the target CPU. This introduces some latency
before schedutil will be able to detect the best frequency required by
that task.

Moreover, the PELT signal build-up time is a function of the current
frequency, because of the scale invariant load tracking support. Thus,
starting from a lower frequency, the utilization build-up time will
increase even more and further delays the selection of the actual
frequency which better serves the task requirements.

In order to reduce this kind of latencies, we integrate the usage
of the CPU's estimated utilization in the sugov_get_util function.
This allows to properly consider the expected utilization of a CPU which,
for example, has just got a big task running after a long sleep period.
Ultimately this allows to select the best frequency to run a task
right after its wake-up.

Change-Id: Ibf98a4be222546733cbd88b9a8f2c8858319dd96
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Paul Turner <pjt@google.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Morten Rasmussen <morten.rasmussen@arm.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org
6 years agosched/fair: use util_est in LB and WU paths
lakkyung.jung [Mon, 16 Apr 2018 02:07:57 +0000 (11:07 +0900)]
sched/fair: use util_est in LB and WU paths

When the scheduler looks at the CPU utilization, the current PELT value
for a CPU is returned straight away. In certain scenarios this can have
undesired side effects on task placement.

For example, since the task utilization is decayed at wakeup time, when
a long sleeping big task is enqueued it does not add immediately a
significant contribution to the target CPU.
As a result we generate a race condition where other tasks can be placed
on the same CPU while it is still considered relatively empty.

In order to reduce this kind of race conditions, this patch introduces the
required support to integrate the usage of the CPU's estimated utilization
in the wakeup path, via cpu_util_wake(), as well as in the load-balance
path, via cpu_util() which is used by update_sg_lb_stats().

The estimated utilization of a CPU is defined to be the maximum between
its PELT's utilization and the sum of the estimated utilization (at
previous dequeue time) of all the tasks currently RUNNABLE on that CPU.
This allows to properly represent the spare capacity of a CPU which, for
example, has just got a big task running since a long sleep period.

Change-Id: Iab14de2d509a15974c3176f091c0d5197cdbd081
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Paul Turner <pjt@google.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Morten Rasmussen <morten.rasmussen@arm.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org
6 years agosched/fair: add util_est on top of PELT
lakkyung.jung [Mon, 16 Apr 2018 01:25:28 +0000 (10:25 +0900)]
sched/fair: add util_est on top of PELT

 - backport util-est from linux-power.git

The util_avg signal computed by PELT is too variable for some use-cases.
For example, a big task waking up after a long sleep period will have its
utilization almost completely decayed. This introduces some latency before
schedutil will be able to pick the best frequency to run a task.

The same issue can affect task placement. Indeed, since the task
utilization is already decayed at wakeup, when the task is enqueued in a
CPU, this can result in a CPU running a big task as being temporarily
represented as being almost empty. This leads to a race condition where
other tasks can be potentially allocated on a CPU which just started to run
a big task which slept for a relatively long period.

Moreover, the PELT utilization of a task can be updated every [ms], thus
making it a continuously changing value for certain longer running
tasks. This means that the instantaneous PELT utilization of a RUNNING
task is not really meaningful to properly support scheduler decisions.

For all these reasons, a more stable signal can do a better job of
representing the expected/estimated utilization of a task/cfs_rq.
Such a signal can be easily created on top of PELT by still using it as
an estimator which produces values to be aggregated on meaningful
events.

This patch adds a simple implementation of util_est, a new signal built on
top of PELT's util_avg where:

    util_est(task) = max(task::util_avg, f(task::util_avg@dequeue))

This allows to remember how big a task has been reported by PELT in its
previous activations via f(task::util_avg@dequeue), which is the new
_task_util_est(struct task_struct*) function added by this patch.

If a task should change its behavior and it runs longer in a new
activation, after a certain time its util_est will just track the
original PELT signal (i.e. task::util_avg).

The estimated utilization of cfs_rq is defined only for root ones.
That's because the only sensible consumer of this signal are the
scheduler and schedutil when looking for the overall CPU utilization
due to FAIR tasks.
For this reason, the estimated utilization of a root cfs_rq is simply
defined as:

    util_est(cfs_rq) = max(cfs_rq::util_avg, cfs_rq::util_est::enqueued)

where:

    cfs_rq::util_est::enqueued = sum(_task_util_est(task))
                                 for each RUNNABLE task on that root cfs_rq

It's worth to note that the estimated utilization is tracked only for
objects of interests, specifically:
 - Tasks: to better support tasks placement decisions
 - root cfs_rqs: to better support both tasks placement decisions as
                 well as frequencies selection

Change-Id: Ic5cad5aab372a8a247024e5304e4a55191fe16ea
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Paul Turner <pjt@google.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Morten Rasmussen <morten.rasmussen@arm.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org
6 years agoarm64: dtsi: Modify lbt ratio to spread task within coregroup.
lakkyung.jung [Thu, 12 Jul 2018 03:58:44 +0000 (12:58 +0900)]
arm64: dtsi: Modify lbt ratio to spread task within coregroup.

Change-Id: I9eba9ffc0c9b9f42d9daca3474cd0570d6a45db4
Signed-off-by: lakkyung.jung <lakkyung.jung@samsung.com>
6 years agoarm64: dtsi: Modify ontime node structure.
lakkyung.jung [Thu, 12 Jul 2018 01:57:44 +0000 (10:57 +0900)]
arm64: dtsi: Modify ontime node structure.

 - Modify to define ontime conditions for each coregroup, not for each step
 - Rename threshold to boundary
 - Remove min-residency-us condition
 - Add coverage-ratio condition

Change-Id: I44e31dd1c68f017c288739699c74973c6d6d2107
Signed-off-by: lakkyung.jung <lakkyung.jung@samsung.com>
6 years agosched: ems: ontime: Rename ontime threshold to boundary.
Daeyeong Lee [Mon, 4 Jun 2018 06:57:36 +0000 (15:57 +0900)]
sched: ems: ontime: Rename ontime threshold to boundary.

Change-Id: I124f16d1cc884884fe0f58de5e871b53da6c1372
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Clear unnecessary sequence to migrate ontime task.
Daeyeong Lee [Thu, 31 May 2018 07:41:40 +0000 (16:41 +0900)]
sched: ems: ontime: Clear unnecessary sequence to migrate ontime task.

Change-Id: I29083497168ad57712394d12ba98d1997f5a6cba
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Change new entity's initial ontime load policy.
Daeyeong Lee [Wed, 23 May 2018 06:10:24 +0000 (15:10 +0900)]
sched: ems: ontime: Change new entity's initial ontime load policy.

Change-Id: I4688cd1fb459ca74092b386356843b37d361b07a
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Allow to migrate to active core within coverage ratio.
Daeyeong Lee [Fri, 18 May 2018 06:51:50 +0000 (15:51 +0900)]
sched: ems: ontime: Allow to migrate to active core within coverage ratio.

Change-Id: I501963c396772bdd5051e7c69e8d642bcbdfac59
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Don't allow to down-migrate heaviest task.
Daeyeong Lee [Mon, 14 May 2018 10:09:11 +0000 (19:09 +0900)]
sched: ems: ontime: Don't allow to down-migrate heaviest task.

Change-Id: I0daf9e82d69438155ce80c33a6a4709523462491
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Use fit cpus when ontime migration.
Daeyeong Lee [Mon, 14 May 2018 01:52:03 +0000 (10:52 +0900)]
sched: ems: ontime: Use fit cpus when ontime migration.

Change-Id: Icea69935638628cb8dc41d38a47a9bc4046110b0
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Use fit cpus when ontime task wake-up.
Daeyeong Lee [Fri, 18 May 2018 02:01:56 +0000 (11:01 +0900)]
sched: ems: ontime: Use fit cpus when ontime task wake-up.

Change-Id: I143735486cb003fea16d80144bb67ffaeb2bf01e
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Add API to find fit cpus for heavy task.
Daeyeong Lee [Fri, 18 May 2018 01:58:30 +0000 (10:58 +0900)]
sched: ems: ontime: Add API to find fit cpus for heavy task.

Change-Id: I833b0c6997c40eb239836ba54385d3acb782b9ec
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Modify message of ontime trace log.
Daeyeong Lee [Tue, 8 May 2018 11:05:16 +0000 (20:05 +0900)]
sched: ems: ontime: Modify message of ontime trace log.

Change-Id: I5560fd905fa03b77e4f609fc7d5d983b0405ac8c
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Remove distinction between ontime and normal task.
Daeyeong Lee [Tue, 8 May 2018 10:56:09 +0000 (19:56 +0900)]
sched: ems: ontime: Remove distinction between ontime and normal task.

Change-Id: I343feff2d7db0d97d3813b570193f1ee8e3af93e
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Remove min_residency at ontime condition.
Daeyeong Lee [Tue, 8 May 2018 10:34:41 +0000 (19:34 +0900)]
sched: ems: ontime: Remove min_residency at ontime condition.

Change-Id: I2263bff40f49ff9c9f112aac1db0546330c1447f
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Modify sysfs node for new structure.
Daeyeong Lee [Tue, 8 May 2018 10:11:05 +0000 (19:11 +0900)]
sched: ems: ontime: Modify sysfs node for new structure.

Change-Id: Iaf7001616dde4f95f126e2021e4efd42b90fcc69
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Modify ontime condition structure.
Daeyeong Lee [Tue, 8 May 2018 08:06:21 +0000 (17:06 +0900)]
sched: ems: ontime: Modify ontime condition structure.

- Modify the ontime condition to have each coregroup individually
- Use list_head struct instead of ontime_cond *next

Change-Id: I0e81c10af914a82d09ceedaf08975efdfb9f7e3a
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ems: ontime: Code clean-up for readability.
Daeyeong Lee [Tue, 8 May 2018 07:09:07 +0000 (16:09 +0900)]
sched: ems: ontime: Code clean-up for readability.

Change-Id: I93097d20d27b7899526b3569aaf99378ff6e1856
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agosched: ehmp: Check whether curr_task is perfer_perf when searching heavy task.
Daeyeong Lee [Tue, 8 May 2018 06:18:47 +0000 (15:18 +0900)]
sched: ehmp: Check whether curr_task is perfer_perf when searching heavy task.

Change-Id: Ic9cd388cc173fdca6c43ec9dec0b4db6c16df305
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
6 years agoRevert "sched: ems: Resolve prevent issue of ontime"
lakkyung.jung [Thu, 12 Jul 2018 01:46:06 +0000 (10:46 +0900)]
Revert "sched: ems: Resolve prevent issue of ontime"

This reverts commit 7798e78210369f2f81eb4d65cd1bb5e5f301efb8.

Change-Id: I17d22ed1d1d0d347e64f2d33ebc75e4ac31a00f4

6 years agosamsung: acme: skip unnecessary operation when frequency change.
Soohyun Kim [Fri, 8 Jun 2018 07:25:00 +0000 (16:25 +0900)]
samsung: acme: skip unnecessary operation when frequency change.

do nothing when target frequency is same with old frequency.

Change-Id: I9ca59361dd4849f27d2a1828f8dba28060ead5ef
Signed-off-by: Soohyun Kim <soohyuni.kim@samsung.com>
6 years agoarm64: dts: fill up the virtual cluster info
lakkyung.jung [Thu, 12 Jul 2018 01:44:27 +0000 (10:44 +0900)]
arm64: dts: fill up the virtual cluster info

Change-Id: I6bd3b3e43ca4af9de069bdc8e4f2f6b8d22c58c4
Signed-off-by: lakkyung.jung <lakkyung.jung@samsung.com>
6 years agosoc: samsung: cpupm: introduce virtual cluster info
Johnlay Park [Fri, 8 Jun 2018 14:45:20 +0000 (23:45 +0900)]
soc: samsung: cpupm: introduce virtual cluster info

to abstract the CPU topology

Change-Id: I4e13b6a45059743ceab143ba95826a35670b5357
Signed-off-by: Johnlay Park <jonglae.park@samsung.com>
6 years agocpufreq: acme: optimize the clock handling when buck off
Johnlay Park [Fri, 8 Jun 2018 11:41:00 +0000 (20:41 +0900)]
cpufreq: acme: optimize the clock handling when buck off

Change-Id: I661307b7c2045111166bbb269f675c8ba691841b
Signed-off-by: Johnlay Park <jonglae.park@samsung.com>
6 years agosched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
Davidlohr Bueso [Mon, 2 Apr 2018 16:49:54 +0000 (09:49 -0700)]
sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning

[ Upstream commit d29a20645d5e929aa7e8616f28e5d8e1c49263ec ]

While running rt-tests' pi_stress program I got the following splat:

  rq->clock_update_flags < RQCF_ACT_SKIP
  WARNING: CPU: 27 PID: 0 at kernel/sched/sched.h:960 assert_clock_updated.isra.38.part.39+0x13/0x20

  [...]

  <IRQ>
  enqueue_top_rt_rq+0xf4/0x150
  ? cpufreq_dbs_governor_start+0x170/0x170
  sched_rt_rq_enqueue+0x65/0x80
  sched_rt_period_timer+0x156/0x360
  ? sched_rt_rq_enqueue+0x80/0x80
  __hrtimer_run_queues+0xfa/0x260
  hrtimer_interrupt+0xcb/0x220
  smp_apic_timer_interrupt+0x62/0x120
  apic_timer_interrupt+0xf/0x20
  </IRQ>

  [...]

  do_idle+0x183/0x1e0
  cpu_startup_entry+0x5f/0x70
  start_secondary+0x192/0x1d0
  secondary_startup_64+0xa5/0xb0

We can get rid of it be the "traditional" means of adding an
update_rq_clock() call after acquiring the rq->lock in
do_sched_rt_period_timer().

The case for the RT task throttling (which this workload also hits)
can be ignored in that the skip_update call is actually bogus and
quite the contrary (the request bits are removed/reverted).

By setting RQCF_UPDATED we really don't care if the skip is happening
or not and will therefore make the assert_clock_updated() check happy.

Change-Id: I12014f33e599de5a35f39dd742555a2f99403b20
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dave@stgolabs.net
Cc: linux-kernel@vger.kernel.org
Cc: rostedt@goodmis.org
Link: http://lkml.kernel.org/r/20180402164954.16255-1-dave@stgolabs.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoUPSTREAM: sched/fair: Consider RT/IRQ pressure in capacity_spare_wake
Joel Fernandes [Thu, 9 Nov 2017 18:52:19 +0000 (10:52 -0800)]
UPSTREAM: sched/fair: Consider RT/IRQ pressure in capacity_spare_wake

capacity_spare_wake in the slow path influences choice of idlest groups,
as we search for groups with maximum spare capacity. In scenarios where
RT pressure is high, a sub optimal group can be chosen and hurt
performance of the task being woken up.

Several tests with results are included below to show improvements with
this change.

1) Hackbench on Pixel 2 Android device (4x4 ARM64 Octa core)
------------------------------------------------------------
Here we have RT activity running on big CPU cluster induced with rt-app,
and running hackbench in parallel. The RT tasks are bound to 4 CPUs on
the big cluster (cpu 4,5,6,7) and have 100ms periodicity with
runtime=20ms sleep=80ms.

Hackbench shows big benefit (30%) improvement when number of tasks is 8
and 32: Note: data is completion time in seconds (lower is better).
Number of loops for 8 and 16 tasks is 50000, and for 32 tasks its 20000.
+--------+-----+-------+-------------------+---------------------------+
| groups | fds | tasks | Without Patch     | With Patch                |
+--------+-----+-------+---------+---------+-----------------+---------+
|        |     |       | Mean    | Stdev   | Mean            | Stdev   |
|        |     |       +-------------------+-----------------+---------+
|      1 |   8 |     8 | 1.0534  | 0.13722 | 0.7293 (+30.7%) | 0.02653 |
|      2 |   8 |    16 | 1.6219  | 0.16631 | 1.6391 (-1%)    | 0.24001 |
|      4 |   8 |    32 | 1.2538  | 0.13086 | 1.1080 (+11.6%) | 0.16201 |
+--------+-----+-------+---------+---------+-----------------+---------+

2) Rohit ran barrier.c test (details below) with following improvements:
------------------------------------------------------------------------
This was Rohit's original use case for a patch he posted at [1] however
from his recent tests he showed my patch can replace his slow path
changes [1] and there's no need to selectively scan/skip CPUs in
find_idlest_group_cpu in the slow path to get the improvement he sees.

barrier.c (open_mp code) as a micro-benchmark. It does a number of
iterations and barrier sync at the end of each for loop.

Here barrier,c is running in along with ping on CPU 0 and 1 as:
'ping -l 10000 -q -s 10 -f hostX'

barrier.c can be found at:
http://www.spinics.net/lists/kernel/msg2506955.html

Following are the results for the iterations per second with this
micro-benchmark (higher is better), on a 44 core, 2 socket 88 Threads
Intel x86 machine:
+--------+------------------+---------------------------+
|Threads | Without patch    | With patch                |
|        |                  |                           |
+--------+--------+---------+-----------------+---------+
|        | Mean   | Std Dev | Mean            | Std Dev |
+--------+--------+---------+-----------------+---------+
|1       | 539.36 | 60.16   | 572.54 (+6.15%) | 40.95   |
|2       | 481.01 | 19.32   | 530.64 (+10.32%)| 56.16   |
|4       | 474.78 | 22.28   | 479.46 (+0.99%) | 18.89   |
|8       | 450.06 | 24.91   | 447.82 (-0.50%) | 12.36   |
|16      | 436.99 | 22.57   | 441.88 (+1.12%) | 7.39    |
|32      | 388.28 | 55.59   | 429.4  (+10.59%)| 31.14   |
|64      | 314.62 | 6.33    | 311.81 (-0.89%) | 11.99   |
+--------+--------+---------+-----------------+---------+

3) ping+hackbench test on bare-metal sever (Rohit ran this test)
----------------------------------------------------------------
Here hackbench is running in threaded mode along
with, running ping on CPU 0 and 1 as:
'ping -l 10000 -q -s 10 -f hostX'

This test is running on 2 socket, 20 core and 40 threads Intel x86
machine:
Number of loops is 10000 and runtime is in seconds (Lower is better).

+--------------+-----------------+--------------------------+
|Task Groups   | Without patch   |  With patch              |
|              +-------+---------+----------------+---------+
|(Groups of 40)| Mean  | Std Dev |  Mean          | Std Dev |
+--------------+-------+---------+----------------+---------+
|1             | 0.851 | 0.007   |  0.828 (+2.77%)| 0.032   |
|2             | 1.083 | 0.203   |  1.087 (-0.37%)| 0.246   |
|4             | 1.601 | 0.051   |  1.611 (-0.62%)| 0.055   |
|8             | 2.837 | 0.060   |  2.827 (+0.35%)| 0.031   |
|16            | 5.139 | 0.133   |  5.107 (+0.63%)| 0.085   |
|25            | 7.569 | 0.142   |  7.503 (+0.88%)| 0.143   |
+--------------+-------+---------+----------------+---------+

[1] https://patchwork.kernel.org/patch/9991635/

Matt Fleming also ran cyclictest and several different hackbench tests
on his test machines to santiy-check that the patch doesn't harm any
of his usecases.

Change-Id: I75826f9541ebe2e324fac2454790c5f5dff0d9b6
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Morten Ramussen <morten.rasmussen@arm.com>
Cc: Brendan Jackman <brendan.jackman@arm.com>
Tested-by: Rohit Jain <rohit.k.jain@oracle.com>
Tested-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
6 years agocpufreq: schedutil: Avoid using invalid next_freq.
Rafael J. Wysocki [Wed, 9 May 2018 09:44:56 +0000 (11:44 +0200)]
cpufreq: schedutil: Avoid using invalid next_freq.

commit 97739501f207efe33145b918817f305b822987f8 upstream.

If the next_freq field of struct sugov_policy is set to UINT_MAX,
it shouldn't be used for updating the CPU frequency (this is a
special "invalid" value), but after commit b7eaf1aab9f8 (cpufreq:
schedutil: Avoid reducing frequency of busy CPUs prematurely) it
may be passed as the new frequency to sugov_update_commit() in
sugov_update_single().

Fix that by adding an extra check for the special UINT_MAX value
of next_freq to sugov_update_single().

Change-Id: I516963d8b0fda677e9d82290c0f3d4dc3cb6e477
Fixes: b7eaf1aab9f8 (cpufreq: schedutil: Avoid reducing frequency of busy CPUs prematurely)
Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 4.12+ <stable@vger.kernel.org> # 4.12+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomedia: scaler: remove unnecessary definition
Janghyuck Kim [Fri, 20 Jul 2018 04:14:27 +0000 (13:14 +0900)]
media: scaler: remove unnecessary definition

Change-Id: I39a83673bb2b5f9cfc740c97cf32163371102229
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: support linear P010 format
Janghyuck Kim [Wed, 20 Jun 2018 04:32:45 +0000 (13:32 +0900)]
[COMMON] media: scaler: support linear P010 format

Change-Id: I0a647422214c8fc8b7f9cf60972265b27365fab6
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years agoinclude: linux: add linear P010 format
Janghyuck Kim [Wed, 20 Jun 2018 04:32:12 +0000 (13:32 +0900)]
include: linux: add linear P010 format

Change-Id: I9dbe5a25b615704a6f7c566094850ca42646d3c3
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: m2m1shot: support IO coherency
Janghyuck Kim [Wed, 2 May 2018 05:32:19 +0000 (14:32 +0900)]
[COMMON] media: m2m1shot: support IO coherency

IO coherency is supported by checking dma-coherent property and passed
IOMMU_CACHE property to ion_iovmm_map().

Change-Id: I5afb0849ebf11030e6c765e160e50dd973f8df79
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years agomedia: videobuf2-core: add error handling for fence
Janghyuck Kim [Wed, 20 Jun 2018 07:46:08 +0000 (16:46 +0900)]
media: videobuf2-core: add error handling for fence

Vb2-core supports in-fence and out-fence for buffer synchronization.
However, in-fence might not be signaled by unexpected situation. Current
logic is waiting for fence signaling infinitely.

This patch added timer when in-fence without signaled is coming, and it
will be expired if callback for in-fence would not be called, which
means in-fence was not signaled during 1000 ms. This case is timeout and
buffer is passed into driver by buf_queue callback, however, it would be
marked with error status.

To support this error handling, vb2-core logic is changed to use
workqueue to avoid calling buf_queue callback in interrupt context.

Change-Id: Icd533c355fa83605e958c8058a676256a6940f14
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years agomedia: videobuf2-core: fix wrong jump
Janghyuck Kim [Mon, 9 Jul 2018 04:51:23 +0000 (13:51 +0900)]
media: videobuf2-core: fix wrong jump

In error case handling, wrong jump was detected and fixed.

Change-Id: I76006903406354c69b232fa6eee22034bfae0101
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years agomedia: scaler: improve alignment check
Janghyuck Kim [Fri, 6 Jul 2018 10:10:19 +0000 (19:10 +0900)]
media: scaler: improve alignment check

This patch improved alignment checking to make returning error instead
of the error interrupt after H/W operation.

Change-Id: I06df771d24fe5d1626bf4c33b6c1da1e1ecf3ba8
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years agomedia: scaler: add job scheduling in buf_queue
Janghyuck Kim [Tue, 26 Jun 2018 11:43:53 +0000 (20:43 +0900)]
media: scaler: add job scheduling in buf_queue

buf_queue callback will be called when fence is signaled.
At that time, job should be tried to run because this buffer
queueing might satisfy the condition to work. Job would be never
triggered without this scheduling.

Change-Id: Iba5a25b1280e60b35f431266d289f1d5b2af5fdb
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: add version information
Janghyuck Kim [Wed, 11 Jul 2018 02:19:58 +0000 (11:19 +0900)]
[COMMON] media: scaler: add version information

Change-Id: I64af7122ccc5fee89c57235a3e2c968d3300e2a0
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: apply 16 alignment for 2bit span
Janghyuck Kim [Thu, 28 Jun 2018 08:29:58 +0000 (17:29 +0900)]
[COMMON] media: scaler: apply 16 alignment for 2bit span

Span value of 2 bit should be 16 aligned.

Change-Id: Ibf26a8da49e14f7610f342596a4d87dbf303979f
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: fix middle buffer calculation
Janghyuck Kim [Tue, 5 Jun 2018 05:44:23 +0000 (14:44 +0900)]
[COMMON] media: scaler: fix middle buffer calculation

This patch added size calculation for 10bit pixel format to avoid page
fault when double scaling is operated with 10bit pixel format.

Change-Id: I1b00d991d08498131299f99476ccf398a6d77a2e
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: fix config value for S10B
Janghyuck Kim [Mon, 21 May 2018 09:54:17 +0000 (18:54 +0900)]
[COMMON] media: scaler: fix config value for S10B

Change-Id: I3c62349eb1dac8da032e34f64e7fe897cee9f13d
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: add byteswap seting for P010
Janghyuck Kim [Mon, 28 May 2018 07:24:07 +0000 (16:24 +0900)]
[COMMON] media: scaler: add byteswap seting for P010

When source format is P010, reading order is different than standard
format, so byteswap should be set to correct order.

Change-Id: Ib07d44edd98e29db95e006c470679f6b9bd80c42
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: fix condition for clk request
Janghyuck Kim [Fri, 1 Jun 2018 04:58:38 +0000 (13:58 +0900)]
[COMMON] media: scaler: fix condition for clk request

After 5.0.1 version, clk request setting is supported.

Change-Id: Iaf5d476e75ce93746e0c575e189698557b0f3296
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: add framerate interface for m2m1shot
Janghyuck Kim [Fri, 27 Apr 2018 10:03:58 +0000 (19:03 +0900)]
[COMMON] media: scaler: add framerate interface for m2m1shot

framerate interface for m2m1shot is added and common setting code is
separated as common function.

Change-Id: I84a77a2e97dba857d2da8d45a43a5cf390a7c7f8
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: change clk request sequence
Janghyuck Kim [Fri, 27 Apr 2018 04:30:48 +0000 (13:30 +0900)]
[COMMON] media: scaler: change clk request sequence

CLK request should be the first before scaler S/W reset.

Change-Id: I4e0133e141a6fd8ba79bf5b5c749a337775e6926
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMON] media: scaler: improve scaler SFR dump
Janghyuck Kim [Tue, 6 Mar 2018 10:06:50 +0000 (19:06 +0900)]
[COMMON] media: scaler: improve scaler SFR dump

This patch improved scaler SFR dump that reduced redundant dump and
added mandatory dump for debug status.

Change-Id: Icd5114d766135594948a3172493996b141e6cf63
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
6 years ago[COMMOn] g2d: enable secure mode when self protection
hyesoo.yu [Fri, 1 Jun 2018 12:11:06 +0000 (21:11 +0900)]
[COMMOn] g2d: enable secure mode when self protection

G2D always enable the secure mode before the job
is executed to enable the firewall regardless of
self protection.

Change-Id: Ie1ff1528d5f83563c1ee202254a826edda97a8c1
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years agog2d: fix using virt_to_phys against stack variable
Cho KyongHo [Fri, 13 Jul 2018 08:10:32 +0000 (17:10 +0900)]
g2d: fix using virt_to_phys against stack variable

If CONFIG_VMAP_STACK is enabled, kernel stack is not physically linear
any more. Instead, it is allocated from vmap area and virt_to_phys and
similar macros are not available on that area.

G2D driver needs to get phyical address of a structure that describes
job properties to deliver the information to the secure world if G2D
H/W is not capable of protecting secure content leak.

Instead allocating the descriptor from the kernel stack, it is now
placed in g2d_task. It helps reducing data redundancy because all
values of the descriptor are also stored in g2d_task.

Change-Id: I91f9c9c5f3806890b4625db87e8b01627d58e5a0
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years agog2d: handle fence errors
Cho KyongHo [Wed, 20 Jun 2018 07:03:04 +0000 (16:03 +0900)]
g2d: handle fence errors

dma_fence supports delivering error to the fence waiters. The fences
with error are also signaled like good fences. The waiters then should
check if the signaled fence has error status.
G2D driver now checks the status of all signaled before pushing a task
to H/W. If it finds an error from  the fences, it does not run H/W with
the task and push the back to the free task pool after resolving all
acquired resources including fences attached to the task. If the task
has a release fence, it is also signaled with -EIO error status.
G2D driver also signals release fences with error status when the a
fence is timed out or H/W does not incur interrupt until the deadline.
Signaling release fence with an error is helpful for the system
stability because the reader of the G2D output can determine if the
data from G2D is complete.

Change-Id: Ia54fafed45d1f8f0e0e1c2e3e81f084746ef02e5
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] g2d: schedule the task directly on ioctl
hyesoo.yu [Wed, 23 May 2018 02:27:18 +0000 (11:27 +0900)]
[COMMON] g2d: schedule the task directly on ioctl

Task of g2d should be scheduled on process context
due to power management, so every task are executed
on workqueue. However, task on state that all
fences are signaled on ioctl could be scheduled
directly without queueing and it make remove the delay
for workqueue.

Change-Id: I72475096165237eccba8172e0c8a7d9e6e3c34c9
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years ago[COMMON] g2d: split timer as purpose
hyesoo.yu [Tue, 3 Apr 2018 10:25:30 +0000 (19:25 +0900)]
[COMMON] g2d: split timer as purpose

One timer is used for two purposes, but it may cause
unexpected race condition between timer handler
and deletion, initialization for another purpose.

So, we seperate timers into two for each purpose.

Change-Id: I44831a4a7b663d75c5d5d4297a78e245f3b4d3ef
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years ago[COMMON] g2d: fix the compat ioctl
Hyesoo Yu [Tue, 27 Mar 2018 10:57:16 +0000 (19:57 +0900)]
[COMMON] g2d: fix the compat ioctl

The variable of buffer is corrupted while looping,
so incorrect data is written to the user's area in
the loop.

And user address of buffer is possible to be
corrupted when union variable is not initialized,
so fix it.

Change-Id: I5bb38eb4dd548a868153a32ebd5b31a76a20f112
Signed-off-by: Hyesoo Yu <hyesoo.yu@samsung.com>
6 years agomedia: vb2: fix missing iovmm_unmap in vb2-dma-sg
Seungchul Kim [Fri, 8 Jun 2018 02:04:16 +0000 (11:04 +0900)]
media: vb2: fix missing iovmm_unmap in vb2-dma-sg

Change-Id: Id5d9cb3c4c687b5daf5ad339cb67e990056551ab
Signed-off-by: Seungchul Kim <sc377.kim@samsung.com>
6 years ago[COMMON] ion: fix conflicts
Cho KyongHo [Tue, 3 Apr 2018 14:12:17 +0000 (23:12 +0900)]
[COMMON] ion: fix conflicts

Change-Id: I250c65be08f436f8cef3fc00674587a74886ea61
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
6 years ago[COMMON] ion: add ion_exynos_dma_buf_start[end]_cpu_access
hyesoo.yu [Thu, 31 May 2018 09:30:06 +0000 (18:30 +0900)]
[COMMON] ion: add ion_exynos_dma_buf_start[end]_cpu_access

The function provides cache flush for the buffer
if start[end] of cpu access from dmabuf framework
has direction of DMA_BIDIRECTIONAL even if there
is no attached device.

Change-Id: I22800e0abcc51b7f4e93d1d58dc55c0fd84901bb
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years agoRevert "android: ion: add dmabuf cpu access ops for exynos"
hyesoo.yu [Thu, 31 May 2018 09:15:29 +0000 (18:15 +0900)]
Revert "android: ion: add dmabuf cpu access ops for exynos"

This reverts commit 6e3e01a3504e7873d16777b1bf3f2ee54ec97cb7.

Change-Id: I843b42d82681c25fbec7df58710e2b00cd70caf6

6 years ago[COMMON] ion: skip cache maintenance when DMA_NONE
hyesoo.yu [Thu, 31 May 2018 09:03:10 +0000 (18:03 +0900)]
[COMMON] ion: skip cache maintenance when DMA_NONE

Change-Id: Ifd6fc48d15a7d5b1330431e8bf0366441e2e9dba
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years ago[COMMON] g2d: remove unnecessary sharable mapping
hyesoo.yu [Sun, 3 Jun 2018 08:10:03 +0000 (17:10 +0900)]
[COMMON] g2d: remove unnecessary sharable mapping

e3364c5c3c68 [COMMON] iommu/exynos: set sharable mapping for dma coherent device
6d648acaeb84 [COMMON] ion: set sharable mapping for dma coherent device

The iovmm mapping of dma coherent device is always
treated sharable mapping on exynos for cachable
memory.

Change-Id: I7b770f90f2a6cb3af8c6ef987109a33b747325a3
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
6 years ago[COMMON] ion: set sharable mapping for dma coherent device
hyesoo.yu [Thu, 31 May 2018 09:07:55 +0000 (18:07 +0900)]
[COMMON] ion: set sharable mapping for dma coherent device

Change-Id: Ia2c32882772adc6a8f8cce3a4de28f24d44f9e98
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>