Commit 944b758fdf
("coresight: enable stm logging for trace events, marker and printk")
changed the trace_event_buffer prototypes but didn't update all of the
usages in the rest of the kernel.
Fixes: 944b758fdf ("coresight: enable stm logging for trace events, marker and printk")
Change-Id: Ic0dedbad441c7ae88564ee57d0d95e23b0e6fc39
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
During the cpu hot plug stress testing, couple of messages
continuous flooding on to the console is causing timers
migration delay. Delayed time migrations from hot plugging
core is causing device instability with watchdog. So reduce
log level for couple of prints in cpu hot plug flow.
Change-Id: I14f034765b063fb2a83a2a9489c664eb2504a770
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Signed-off-by: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>
Below compilation issues are observed when CONFIG_SCHED_WALT is disabled.
1. kernel/sched/cpufreq_schedutil.c:408:23: \
error: implicit declaration of function 'boosted_cpu_util'
2. kernel/sched/core_ctl.c:1291:2: \
error: implicit declaration of function 'for_each_sched_cluster'
Fix these compilation issues by adding/updating proper checks
and dependencies as needed.
Change-Id: I59d3714a9fca0ff58758ec974f50eb5f3f00ae98
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Idle/newly idle cpu finds busiest runqueue to pull tasks from it.
It is possible that, the busiest cpu might have already marked for
active_balance by other cpu. But current balancing cpu still finds
it as busiest cpu and tries to pull tasks from it.
Which may have subtle impact, if higher capacity cpu has marked busy
cpu for active balance, and before active balance kicks in by the
busy cpu, the lower capacity cpu pulling tasks from the busy cpu
ruins the higher capacity cpu's active balance.
Fix this, by skipping the cpu which is undergoing active_balance
for finding busiest queue and do not detach tasks if busiest cpu
marked for active balance.
Change-Id: If3ebe1a026cf62f055bb42c3f3ed62f3624c704a
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
sched_energy_present can be used to check if EAS is enabled or not,
and there is no need of additional functions like sched_is_energy_aware()
& energy_aware().
Change-Id: I7e5697d556d1edacd88cf3c6f2c9480bd769f4bc
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Some PMUs events can be read from more than the one CPU. So allow the
PMU driver to mark events as such. For these events, we don't need to
reject reads or make smp calls to the event's CPU (and cause
unnecessary overhead and wake ups).
When a PMU driver marks an event as such, care must be taken by the
driver to make sure they can handle the event being read/updated from
more than 1 CPU at the same time (Eg: due to an IRQ indicating event
counter overflow and another thread trying to read the latest values).
Good examples of such events would be events from caches shared across
CPUs.
Change-Id: I3dad97fc95849e26bd2bb3e418cdb4d47f2e335c
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rama Aparna Mallavarapu <aparnam@codeaurora.org>
Add a check for cpu unbound deferrable timer expiry and raise
softirq for handling the expired timers so that the CPU can
process the cpu unbound deferrable times as early as possible
when a cpu tries to enter/exit idle loop.
Change-Id: Ieffa74fa22a4d25493f5590b5ac1e0d784fcbbad
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
[rishabhb@codeaurora.org: Resolved conflicts due to addition of
commit: time: tick-sched: Reorganize idle tick management code]
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
Tight loops of spin_lock_irqsave() and spin_unlock_irqrestore()
in timer and hrtimer are causing scheduling delays. Add delay of
few nano seconds after cpu_relax in the timer/hrtimer tight loops.
Change-Id: Iaa0ab92da93f7b245b1d922b6edca2bebdc0fbce
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Division of a 64 bit variable isn't supported by the "/" operator in
a 32-bit architecture. So, use do_div() instead.
Change-Id: Id07ce36166ee1ee88ff6519dc26724c4e847890b
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
WARN_ON is used in calculating schedutil average capacity
this is called under rq->lock held, when WARN_ON is triggered
it tries to wake_up the process on the same CPU for debug
prints inturn waits for the rq->lock triggering dead lock
Update WARN_ON with BUG_ON avoiding the debug prints.
Change-Id: I8db35a2165e68765b4ab2f132a571ad00311ba25
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
Signed-off-by: Kyle Yan <kyan@codeaurora.org>
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
When sysctl_sched_use_walt_cpu_util is set to 0, WALT stats are no longer
updated. As a result, the schedutil governor throws excessive warnings.
Fix this by not running any WALT-related logic when
sysctl_sched_use_walt_cpu_util is 0.
Change-Id: Ibdbc5243c6f3d11071f8ab715ca76e0e840f8090
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Currently, sugov_update_single will apply its busy logic, keeping frequency
high. However, this is only required for PELT, not WALT; remove this
logic if PELT is not in use.
Change-Id: Ia0d9523d683568e373fa0d459eecbd3fae78fcff
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
There is no need to change cluster frequency if there are still other
notifications pending for the cluster. Check SCHED_CPUFREQ_CONTINUE
to check when final frequency adjustment should be made.
Change-Id: Ie6c7941eb1fdad5930844ec5022bdfae8923ce68
Signed-off-by: Kyle Yan <kyan@codeaurora.org>
[avilaj@codeaurora.org: Fix a minor merge conflict.]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Currently, cycle tracking is not consistently applied in all cases in the
schedutil governor, which can lead to errors in the calculation of average
capacity. Fix this.
Change-Id: Idbdc6d1516abd20466c78f79c6524b3348b922f9
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Add cpu_frequency traces for each online CPU in the policy for more
consistent outputs of most standard trace analysis tools.
Change-Id: I01cd48909316f861cb601c2ce74330351320f1b5
Signed-off-by: Kyle Yan <kyan@codeaurora.org>
[avilaj@codeaurora.org: Port to 4.19, fix conflicts]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Currently the tracepoint displays the average capacity from the
previous load update. Move the call to update average capacity
before the tracepoint so that the average capacity recorded by
the tracepoint is the one that is used in the current load update.
Change-Id: I1e9cbfbe9431844587c0a704c9563cfa786a9c24
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[avilaj@codeaurora.org: Fix merge conflicts on 4.19]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
The schedutil is calling twice into the scheduler while querying
the load of each CPU. The cpu_util_freq() is called first to
get the CPU un-boosted load and WALT stats. Then boosted_cpu_util()
is called to get the boosted CPU load. This results in doing the
the same calculations twice in the scheduler and printing
sched_load_to_gov trace point twice. Fix this inefficiency by
changing boosted_cpu_util() to update WALT stats along with
boosted CPU load.
Change-Id: Ia825cafca6a25c56b0edb1ae8c55e7c7277f2968
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
[satyap@codeaurora.org: trivial merge conflict resolution]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
[avilaj@codeaurora.org: merge conflicts due to 4.19 port]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
This snapshot is taken from msm-4.14 as of commit 4b54d9aab0f1c939eec1
(Merge "net: qrtr: Handle IPCR control port format of older targets").
Change-Id: Ib66005e34e57707882e3139265c9866df306e741
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
[avilaj@codeaurora.org: Fix merge conflicts in porting.]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Prevent processing notifications from scheduler for pl if pl is
not enabled.
Change-Id: I091ee107af21fe94177e0bd051f8ee546f3a1678
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[avilaj@codeaurora.org: Fix some merge conflicts.]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Currently when all the related CPUs from a policy go offline or the
governor is switched, cpufreq framework calls sugov_exit() that
frees the governor tunables. When any of the related CPUs comes back
online or governor is switched back to schedutil sugov_init() gets
called which allocates a fresh set of tunables that are set to
default values. This can cause the userspace settings to those
tunables to be lost across governor switches or when an entire
cluster is hotplugged out.
To prevent this, save the tunable values on governor exit. Restore
these values to the newly allocated tunables on governor init.
Change-Id: I671d4d0e1a4e63e948bfddb0005367df33c0c249
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[avilaj@codeaurora.org: Modify to handle new tunables on 4.19]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Checking the utilization against current capacity can cause the hispeed
load condition to be unreliable. This can happen if the hispeed condition
is reevaluated after some other event (say, migration) causes the current
frequency (and thereby current capacity) to change.
So, instead of checking against current capacity, check against the average
capacity that is less temperamental.
Change-Id: Ic1277908f7d42848ded5dd450146d1d04572eaab
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Add trace points when load gets updated and when frequency is chosen
to facilitate better debugging.
Change-Id: Ib19911a03fc941bc7db76ab07394e152d0572871
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[avilaj@codeaurora.org: Fix some conflicts introduced by reordering this patch]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Average policy capacity will be used in future patches to improve detection
of hispeed load condition.
Change-Id: Icab992243b83eb5feaae619d16b22510010f54c5
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[avilaj@codeaurora.org: Fix merge conflicts caused by moving around tracepoint patch]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
The old code used to ignore CPU load older than 1 tick. Since the WALT
window size can be more than 1 tick (and is configurable), this can cause
an incorrect frequency drop in the middle of a WALT window. Use WALT window
size to ignore CPU load instead.
Change-Id: If42420f595ba9722866174c2cda8b6c2fdf34f92
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[avilaj@codeaurora.org: Fixed merge conflicts.]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
WALT load works better for UX workloads which are important for a
commercial mobile device.
Change-Id: I33fbb5c0566176288029e3249532f8c4b389add3
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[avilaj@codeaurora.org: Fix merge conflict]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Blindly ignoring frequency updates because of work_in_progress can leave
the CPUs at the wrong frequency for a long time. It's better to update the
frequency immediately than wait for a future event that might take a long
time to come. The irq_work code already ignores double queuing of work. So,
that part of the code is still safe when the work_in_progress flag is
ignored.
Change-Id: Id0b3711314dfbfa18b5f4bce30a239ee3cf962d6
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[avilaj@codeaurora.org: Port to 4.19]
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Sprintf has security issues; replace with scnprintf where appropriate.
Change-Id: I5b4bce0d37e2ede73324dc753f298d8ac236ddd9
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
While migrating a task, move_queued_task() updates current cpu's
rq clock (which sets RQCF_UPDATED) with rq->lock held, and
momentarly releases the rq->lock and reaquire it along with new cpu
rq->lock. In between, if any other cpu takes the current rq->lock,
which might have called rq_pin_lock() (which clears RQCF_UPDATED) and
released the lock without updating cpu rq clock, then rq's
clock_update_flags becomes stale until rq_pin_lock() called again.
If the migration tries to reports load to cpufreq governor, then it would
access the stale rq_clock, and the assert_clock_updated reports warning
with below call stack:
detach_entity_cfs_rq+0x71c/0x780
migrate_task_rq_fair+0x50/0xd0
set_task_cpu+0x150/0x238
move_queued_task+0x1b4/0x3e8
migration_cpu_stop+0x188/0x1f0
cpu_stopper_thread+0xac/0x150
smpboot_thread_fn+0x1c4/0x2e8
Also as commit '2463f46361a02d("sched: Fix assert_clock_updated
warning emitted during CPU isolation")' mentioned, this warning
could lead to deadlock when console enabled.
To fix this, while reacquring the cpu rq->lock, if RQCF_UPDATED is
not set then force update the rq clock.
Change-Id: Ibc7bae4fc489e7f182339e6195cb440af6d7676b
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
Commit 39d60ed915 ("sched/fair: Add snapshot of placement changes")
introduced a bug where we end up calling rcu_read_unlock() without
calling rcu_read_lock() and leading to warning "BUG: sleeping function
called from invalid context" while trying to find the energy efficient CPU
for the tasks.
Change-Id: I727d11660ed43341751dfb6e6f8d23968dfe9b49
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Ksfotirqd is a normal priority CFS task. It can experience higher
scheduling latency under heavy load conditions. Currently once
asynchronous softirq processing is deferred to ksoftirqd, softirqs
are not processed further until ksoftirqd task gets a chance to run.
High latencies for softirqs like TIMER, HI TASKLET is not acceptable.
So revert 'commit 4cd13c21b2 ("softirq: Let ksoftirqd do its job")'.
Change-Id: I38a1a88b5f42dd534c65d739dbb7e4321a7904db
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
[satyap@codeaurora.org: Fix trivial merge conflicts]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This reverts commit 3c53776e29.
Reverting the change to match what we have on previous Kernels.
Change-Id: I4af64cd7e2c4291dda5f503bf2d74ede459a76c6
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>