Commit Graph

29652 Commits

Author SHA1 Message Date
b776547b65 Merge "sched: core: reset preemption/irqsoff disable timestamp" 2020-01-13 21:15:28 -08:00
1f2e22a5d5 Merge "sched/fair: bonus vruntime for task boost 3" 2020-01-13 21:15:27 -08:00
9ea1270d1c sched/fair: bonus vruntime for task boost 3
When task boost with special value 3 also have vruntime
bonus to run faster.

Change-Id: I7da2dd985a961671b27036a0d5b13cb79480c933
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
2020-01-08 22:37:04 -08:00
5e3f09ce21 sched: core: reset preemption/irqsoff disable timestamp
Preempt/irqsoff tracer notes down preemption/irqs disabled timestamp
and compares it with enable timestamp to report prolonged disabling
callers at latency tracking. But they don't reset the time stamp at
re-enable time. The time stamp could be stale and possible to report
same latency multiple times or false positive. This could be possible
when callsites uses notrace API (__preempt_) for preemption disable
and tracable API (preempt_) for enable (ex: softirq).

Fix it by resetting the preempt/irqsoff disable timestamp at
re-enable time.

Change-Id: I6790227998881922a9339869ce9ee2dab6202567
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2020-01-09 10:14:48 +05:30
b83b462e66 sched/walt: Fix kernel panic issue by uninitialized data
Threre is possible that time_delta is not initialized and caused
'Division by zero' exception, so move this trace into if condition
so that uninitialized data will not be used.

Change-Id: If7eb8df1c2cd7fe958b8a672d1f3b9c117caeed6
Signed-off-by: Biao long <blong@codeaurora.org>
2020-01-06 15:20:33 +08:00
ad677f2848 tracing: Fix lock inversion in trace_event_enable_tgid_record()
Task T2                             Task T3
trace_options_core_write()            subsystem_open()

 mutex_lock(trace_types_lock)           mutex_lock(event_mutex)

 set_tracer_flag()

   trace_event_enable_tgid_record()       mutex_lock(trace_types_lock)

    mutex_lock(event_mutex)

This gives a circular dependency deadlock between trace_types_lock and
event_mutex. To fix this invert the usage of trace_types_lock and
event_mutex in trace_options_core_write(). This keeps the sequence of
lock usage consistent.

Change-Id: Ide261e25fb15f79391a6220eef246e274b0c6a69
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
2019-12-27 18:57:40 -08:00
e064abaa80 Merge "sched/walt: Improve the scheduler" 2019-12-26 06:47:23 -08:00
cdf176a949 Merge "sched/fair: Don't place wakee on waker cpu if colocate enabled" 2019-12-24 07:08:47 -08:00
d0a662ae8e Merge "sched: walt: Improve the scheduler" 2019-12-22 23:09:38 -08:00
ef9b421ba1 sched: walt: Improve the scheduler
This change is for general scheduler improvements.

Change-Id: I3e0f7593e10d9d854f1953b74e420f9d07b3180f
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-12-20 10:51:36 +05:30
7d99db092e sched: walt: Improve the scheduler
This change is for general scheduler improvements.

Change-Id: Ib8505248b91fb33395fe53f2dfacc8ec68c0273c
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-12-20 10:50:45 +05:30
101f609855 sched/walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: I5fbadf248c0bfe27bc761686de7a925cec2e4163
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2019-12-20 10:11:00 +05:30
ff24bea23b sched/fair: Don't place wakee on waker cpu if colocate enabled
If both wakee and waker are in top-app,don't place wakee on waker
cpu, because most of this case waker is not going to sleep,this
will cause waker preempted and lead high runnable time,so let
scheduler to select the best cpu in this case.

Change-Id: If6eb3c0acb202197e9dd90205c581398ac049649
Signed-off-by: Biao Long <blong@codeaurora.org>
2019-12-19 16:44:05 -08:00
13dd4dd603 sched: walt: improve the scheduler
This change is for general scheduler improvements.

Change-Id: I567213580a970abc374d95e3d1fdc0aa73eaf705
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-12-19 10:07:04 +05:30
78a63621e8 Merge "mm: reorder oom kill logic in should_ulmk_retry()" 2019-12-17 01:32:03 -08:00
6ffbb5b010 Merge "sched/fair: Avoid force newly idle load balance if have iowait task" 2019-12-11 23:05:49 -08:00
478517b9dc Merge "sched/walt: Improve the scheduler" 2019-12-11 19:38:46 -08:00
b7dc11c3fb Merge "mm: correct the wdog_timer expires value in psi_emergency_trigger" 2019-12-11 05:29:21 -08:00
f9b1a9b755 mm: reap tasks only killed by low memory killer
Reap tasks that are killed by ulmk only.

Change-Id: I4af044b3b8fb5fe1dcef6bac70c475cf949d0505
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
2019-12-11 12:34:02 +05:30
fbd15b6297 sched/fair: Avoid force newly idle load balance if have iowait task
If this runqueue have iowait task and still force newly
idle load balance, will make iowait task performance
worse. Need to do the average idle time check if
there is iowait task on this runqueue to have upcoming
iowait task have enough cpu resource.

Change-Id: I8e4dd440edbbd14d5170fbcf358bdaf5cc5b26e8
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
Signed-off-by: Biao Long <blong@codeaurora.org>
2019-12-10 21:53:43 -08:00
5250fc5df0 sched/fair: Force gold cpus to do idle lb when silver has big tasks
We often see traces that gold cpus goes to idle even when silver
has big tasks. This is because avg_idle checks does not allow
the gold cpus to enter idle balance. This is NOT okay when
silver CPUs have big tasks.

Change-Id: Ice00d43c70be105b5bc3ad09caa6047aa98d7402
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Runmin Wang <runminw@codeaurora.org>
2019-12-10 21:53:08 -08:00
44843c4316 sched/walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: I33e9ec890f8b54d673770d5d02dba489a8e08ce7
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2019-12-10 19:31:15 -08:00
0b47617031 Merge "sched/fair: Improve the scheduler" 2019-12-10 07:14:54 -08:00
37a184473d Merge "rcu: Allow only one expedited GP to run concurrently with wakeups" 2019-12-08 22:58:46 -08:00
1ed46cb3af lockdep: suppress extra lockdep logging
suppress lockdep locking to avoid console flooding
resulting watchdog bite.

Change-Id: I0b3a56d3541cdf03872709731c34aef8d177c0da
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
2019-12-06 01:19:23 -08:00
23483948b7 lockdep: make lockdep track owners after error
Lockdep stops book keeping of locks and its owners
after an error is detected. Keep lockdep tracking
on after an error is reported.

Change-Id: I0209a929a8da564ccda33d5af8b714594a62800c
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
2019-12-06 01:18:57 -08:00
fbda00ce1d lockdep: disable lockdep logging
When lockdep reports a locking error, it disables global
debug_locks which results in other lock debugging features
getting disabled.

Disable only lockdep logging once a locking error is reported.
This will help in tracking lock owners and their stacks from
ramdumps even when lockdep is not reporting them on console.

Change-Id: Ie7b6aa57df84aaa4cf90fc912969d4ca49f77997
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
2019-12-06 01:18:34 -08:00
65ab504db4 lockdep: save caller1 for locks in task_struct
Currently lockdep saves caller0 for locking API's in
task_struct. Save caller1 also for a task acquiring the
lock. This is helpful for locks like cpu_hotplug_lock
which is acquired/release inside a helper function like
cpus_read_lock(). Caller1 shall help in getting caller of
cpus_read_lock().

Change-Id: I3ea30990245f478778c2e58348a84ab40610056d
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
2019-12-06 01:18:09 -08:00
aaf50297c3 sched/fair: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: I7e6cc760a6add9ebdab7d67a176559bc640f7790
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-12-05 21:12:18 -08:00
92854f1f2d Merge "cpufreq: schedutil: Queue sugov irq work on policy online cpu" 2019-12-05 20:53:42 -08:00
a1e22684b5 cpufreq: schedutil: Queue sugov irq work on policy online cpu
Got never update frequency if scheduled the irq
work on an offlined cpu and it will always pending.
Queue sugov irq work on any online cpu if current
cpu is offline.

Change-Id: I33fc691917b5866488b6aeb11ed902a2753130b2
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
[clingutla@codeaurora.org: Resolved minor merge conflicts]
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-12-05 09:26:45 +05:30
8016929861 sched/walt: Avoid walt irq work in offlined cpu
Avoid walt irq work in offlined cpu.

Change-Id: Ia4410562f66bfa57daa15d8c0a785a2c7a95f2a0
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
[clingutla@codeaurora.org: Resolved trivial merge conflicts]
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-12-05 09:26:01 +05:30
beb2ec8fe8 rcu: Allow only one expedited GP to run concurrently with wakeups
The current expedited RCU grace-period code expects that a task
requesting an expedited grace period cannot awaken until that grace
period has reached the wakeup phase.  However, it is possible for a long
preemption to result in the waiting task never sleeping.  For example,
consider the following sequence of events:

1.      Task A starts an expedited grace period by invoking
        synchronize_rcu_expedited().  It proceeds normally up to the
        wait_event() near the end of that function, and is then preempted
        (or interrupted or whatever).

2.      The expedited grace period completes, and a kworker task starts
        the awaken phase, having incremented the counter and acquired
        the rcu_state structure's .exp_wake_mutex.  This kworker task
        is then preempted or interrupted or whatever.

3.      Task A resumes and enters wait_event(), which notes that the
        expedited grace period has completed, and thus doesn't sleep.

4.      Task B starts an expedited grace period exactly as did Task A,
        complete with the preemption (or whatever delay) just before
        the call to wait_event().

5.      The expedited grace period completes, and another kworker
        task starts the awaken phase, having incremented the counter.
        However, it blocks when attempting to acquire the rcu_state
        structure's .exp_wake_mutex because step 2's kworker task has
        not yet released it.

6.      Steps 4 and 5 repeat, resulting in overflow of the rcu_node
        structure's ->exp_wq[] array.

In theory, this is harmless.  Tasks waiting on the various ->exp_wq[]
array will just be spuriously awakened, but they will just sleep again
on noting that the rcu_state structure's ->expedited_sequence value has
not advanced far enough.

In practice, this wastes CPU time and is an accident waiting to happen.
This commit therefore moves the rcu_exp_gp_seq_end() call that officially
ends the expedited grace period (along with associate tracing) until
after the ->exp_wake_mutex has been acquired.  This prevents Task A from
awakening prematurely, thus preventing more than one expedited grace
period from being in flight during a previous expedited grace period's
wakeup phase.

Fixes: 3b5f668e71 ("rcu: Overlap wakeups with next expedited grace period")
Change-Id: I9bd12a8d639deec801b4e3546a1cf4729fe3f26c
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
[ paulmck: Added updated comment. ]
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Git-commit: 3dcffb240ef452fd97aa30d9c88efd4f4b030a68
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
[prsood@codeaurora.org: improved comment style]
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
2019-12-04 20:08:25 +05:30
87988027ae rcu: Fix missed wakeup of exp_wq waiters
Tasks waiting within exp_funnel_lock() for an expedited grace period to
elapse can be starved due to the following sequence of events:

1.      Tasks A and B both attempt to start an expedited grace
        period at about the same time.  This grace period will have
        completed when the lower four bits of the rcu_state structure's
        ->expedited_sequence field are 0b'0100', for example, when the
        initial value of this counter is zero.  Task A wins, and thus
        does the actual work of starting the grace period, including
        acquiring the rcu_state structure's .exp_mutex and sets the
        counter to 0b'0001'.

2.      Because task B lost the race to start the grace period, it
        waits on ->expedited_sequence to reach 0b'0100' inside of
        exp_funnel_lock(). This task therefore blocks on the rcu_node
        structure's ->exp_wq[1] field, keeping in mind that the
        end-of-grace-period value of ->expedited_sequence (0b'0100')
        is shifted down two bits before indexing the ->exp_wq[] field.

3.      Task C attempts to start another expedited grace period,
        but blocks on ->exp_mutex, which is still held by Task A.

4.      The aforementioned expedited grace period completes, so that
        ->expedited_sequence now has the value 0b'0100'.  A kworker task
        therefore acquires the rcu_state structure's ->exp_wake_mutex
        and starts awakening any tasks waiting for this grace period.

5.      One of the first tasks awakened happens to be Task A.  Task A
        therefore releases the rcu_state structure's ->exp_mutex,
        which allows Task C to start the next expedited grace period,
        which causes the lower four bits of the rcu_state structure's
        ->expedited_sequence field to become 0b'0101'.

6.      Task C's expedited grace period completes, so that the lower four
        bits of the rcu_state structure's ->expedited_sequence field now
        become 0b'1000'.

7.      The kworker task from step 4 above continues its wakeups.
        Unfortunately, the wake_up_all() refetches the rcu_state
        structure's .expedited_sequence field:

        wake_up_all(&rnp->exp_wq[rcu_seq_ctr(rcu_state.expedited_sequence) & 0x3]);

        This results in the wakeup being applied to the rcu_node
        structure's ->exp_wq[2] field, which is unfortunate given that
        Task B is instead waiting on ->exp_wq[1].

On a busy system, no harm is done (or at least no permanent harm is done).
Some later expedited grace period will redo the wakeup.  But on a quiet
system, such as many embedded systems, it might be a good long time before
there was another expedited grace period.  On such embedded systems,
this situation could therefore result in a system hang.

This issue manifested as DPM device timeout during suspend (which
usually qualifies as a quiet time) due to a SCSI device being stuck in
_synchronize_rcu_expedited(), with the following stack trace:

        schedule()
        synchronize_rcu_expedited()
        synchronize_rcu()
        scsi_device_quiesce()
        scsi_bus_suspend()
        dpm_run_callback()
        __device_suspend()

This commit therefore prevents such delays, timeouts, and hangs by
making rcu_exp_wait_wake() use its "s" argument consistently instead of
refetching from rcu_state.expedited_sequence.

Fixes: 3b5f668e71 ("rcu: Overlap wakeups with next expedited grace period")
Change-Id: I6cf7fbdee075b0243254b78f3f21a9d2b745fad5
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Git-commit: 97cb80092efe81f37fd4fee1ecbc64a167aa22f6
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
2019-12-04 20:03:42 +05:30
b690ed7000 sched: walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: I752b5518fd72f9c239d3f96e4c3e021a98a75684
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-12-04 05:06:27 -08:00
d96a353131 mm: correct the wdog_timer expires value in psi_emergency_trigger
Timer expects the 'expires' value in jiffies. Pass it accordingly.

Change-Id: Ic2f9338bd7144c5de59cf12edf8789703068891c
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
2019-11-29 19:55:03 +05:30
8787e484d7 Merge "sched/fair: Improve the scheduler" 2019-11-22 14:56:34 -08:00
97b4c06557 Revert "sched: fix single cpu running issue"
Previously, walt sched clusters prepared with empty cpumask for
single core bootup, which causes panic. Now sched clusters preparation
avoids empty cpu mask, so the commit 'c94eae6f4f4b0c("sched: fix single
cpu running issue")' becomes stale now, and it is adding extra
overhead in scheduler hotpaths, so remove it.

Change-Id: Ie6167e7c148d35b94fb8101caea16282d6d133fc
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-11-21 18:14:19 +05:30
dcc0e1895a sched: core: Use sched_clusters for updown migration handler
Currently, sched updown migration handler derives cluster topology
based on arch topology, the cluster information is already populated
in walt sched_cluster. So reuse it instead of deriving it again.

And move updown tunables support to under WALT.

Change-Id: Iddf4d18ddf75cc20637281d9889f671f42369513
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-11-21 18:14:19 +05:30
d6a3e2d307 sched: walt: fix sched_cluster initialization
If cluster topology parsing failed or system booted with single cpu,
then topology possible sibling mask could be empty. This leads to
initialization of sched_clusters with empty cpus and there are many
call sites, which use the cluster cpu mask without checking for empty mask.
They lead to accessing invalid cpus ( minus one) leading to crashes.
Fix it by resetting to an initial cluster structure that has all possible
cpus as cluster mask. Also, warn when an empty cluster is detected.

To continue using init_cluster on device tree failures:
- Use init_cluster as default entry in cluster_head, and once
  cluster topology parsed successfully, cluster_head gets updated with
  proper cpu cluster information.
- If cluster topology parsing failed, free allocated sched_clusters and
  make sure rq points to init_cluster instead of invalid address.
- Remove unused cluster id bitmaps.

Change-Id: Ic65ba86ff90a271098fb593221d1679d634930b1
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2019-11-21 18:11:24 +05:30
4f34d48a03 Merge "sched/walt: Improve the scheduler" 2019-11-20 21:37:05 -08:00
795441c2fa Merge "sched: walt: Dump walt status on BUG_ON" 2019-11-19 18:14:47 -08:00
b9173741fe sched/walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: If4e1dfbdb1f71989a75d33c8fa995ba0397b3ba9
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2019-11-18 15:40:25 -08:00
30a20ea725 sched/walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: I985879c5bf4951aeffaca1b43ea00f276e8c31d5
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2019-11-18 15:40:25 -08:00
34102ccdd5 sched: walt: Dump walt status on BUG_ON
If walt causes BUG_ON, then dump all cpu's current walt status.

Change-Id: Ie4b0f19f9598714a5479dd6426d0cc769ec562b1
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2019-11-18 15:40:14 -08:00
2eefeaa5c5 sched/walt: Improve the scheduler
This change is for scheduler improvement.

Change-Id: Ie922b3a672686e7a8f52dcaacdea03948e630a1c
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
2019-11-18 15:38:47 -08:00
50db4a3909 sched/walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: Ic6be9069f6119d52e3915ea032f72ea35d27ee3e
Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2019-11-18 15:37:24 -08:00
e2c44d5b41 sched/walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: I8459bcf7b412a5f301566054c28c910567548485
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2019-11-18 15:16:12 -08:00
02ea1cf218 Merge "sched/walt: Improve the scheduler" 2019-11-16 09:20:25 -08:00
dd8171dd87 sched/walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: I1aa4c378452c936a443a17e77834d1191b7b0563
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2019-11-14 14:19:09 -08:00