linux/kernel/sched
Stephen Dickey a64f42d1df ANDROID: sched: Fix missing RQCF_UPDATED in migrate_tasks
Currently, the sched code checks if the rq clock has been
updated after its lock has been held when CONFIG_SCHED_DEBUG
is enabled. It tracks this by clearing the RQCF_UPDATED bit
when a lock is acquired and setting it upon a subsequent
update_rq_clock() call. It warns if rq clock is read without
RQCF_UPDATED flag indicating the code path missed updating
the clock.

When migrate_tasks() is called during a pause_cpus() event,
the local variable orf is updated with the contents of *rf,
prior to the call to update_rq_clock(). As a result, when
migrate_tasks() restores *rf from the local variable the
RQCF_UPDATED flag is lost. This clearing out of the
RQCF_UPDATED flag leads to a warning when the next task
is being pushed out.

For example in migrate_tasks()

   orf = rf; // save flags, RQCF_UPDATE cleared
   update_rq_clock() // set RQCF_UPDATE
   for()
      ...
      __migrate_task(dead_rq, new_cpu)
      ...
      --> if migration, restore dead_rq's flags with orf.
         --> We loose RQCF_UPDATE
	 rq_relock(dead_rq, orf)

This leaves the current cpu's rq clock_update_flags with the
RQCF_UPDATED flag cleared, an error condition with
CONFIG_SCHED_DEBUG enabled.

Fix the issue for by ensuring that the local variable orf
has the RQCF_UPDATED flag set, allowing the current
CPU's rq to have the flag set and leaving it in a good state
for future usage.

pause_cpus() is currently Android specific. As cpu_pause does
not rely on stop_machine_cpuslocked() like the regular
hotunplug path does, there's a risk for another CPU to
read the rq_clock, after we cleared RQCF_UPDATE, when using
pause_cpus(). This change will have little or no impact outside
of Android currently. If pause_cpus() or drain_rq_cpu_stop()
are merged upstream this change should be merged as well.

Bug: 186222712
Change-Id: Id241122e1449cdd4dcd15f94eb68735b40e3d6f5
Signed-off-by: Stephen Dickey <dickey@codeaurora.org>
2021-04-28 21:28:55 +00:00
..
autogroup.c
autogroup.h
clock.c
completion.c
core.c ANDROID: sched: Fix missing RQCF_UPDATED in migrate_tasks 2021-04-28 21:28:55 +00:00
cpuacct.c
cpudeadline.c
cpudeadline.h
cpufreq_schedutil.c ANDROID: sched: Add vendor hooks to compute new cpu freq. 2021-04-23 18:42:38 -07:00
cpufreq.c ANDROID: sched: time: Export symbols needed for schedutil module 2021-02-22 11:58:23 -08:00
cpupri.c ANDROID: sched: Export symbol for vendor RT hook funcion 2021-01-12 12:57:37 -08:00
cpupri.h
cputime.c ANDROID: vendor_hooks: Add hooks for account process tick 2021-03-23 03:18:15 +00:00
deadline.c FROMGIT: sched/deadline: Reduce rq lock contention in dl_add_task_root_domain() 2021-02-10 10:48:24 +00:00
debug.c ANDROID: Sched: Add export symbols for sched features 2021-01-12 22:01:04 +00:00
fair.c ANDROID: sched: Add vendor hooks for update_load_avg 2021-04-26 13:29:25 +00:00
features.h sched/rt: Disable RT_RUNTIME_SHARE by default 2020-09-25 14:23:24 +02:00
idle.c Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
isolation.c
loadavg.c ANDROID: GKI: loadavg: Export for get_avenrun 2020-08-12 15:08:42 +00:00
Makefile
membarrier.c sched/membarrier: fix missing local execution of ipi_sync_rq_state() 2021-03-17 17:06:35 +01:00
OWNERS ANDROID: Add OWNERS files referring to the respective android-mainline OWNERS 2021-04-03 14:11:30 +00:00
pelt.c ANDROID: sched: pelt: Fix the PELT arrays 2021-03-04 11:53:51 +00:00
pelt.h
psi.c ANDROID: psi: Add vendor hooks for PSI tracing 2021-04-21 05:08:41 -07:00
rt.c ANDROID: sched/rt: Only enable RT sync for SMP targets 2021-03-01 18:50:27 +00:00
sched-pelt.h ANDROID: sched: pelt: Fix the PELT arrays 2021-03-04 11:53:51 +00:00
sched.h ANDROID: GKI: sched: add Android ABI padding to some structures 2021-03-23 08:00:57 +01:00
smp.h
stats.c
stats.h
stop_task.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
swait.c
topology.c ANDROID: vendor_hooks: Add hooks for scheduler 2021-03-16 09:08:22 +00:00
wait_bit.c
wait.c ANDROID: Add a vendor hook that allow a module to modify the wake flag 2021-03-04 16:19:04 +00:00