linux/kernel/sched
Jing-Ting Wu 3c54070823 UPSTREAM: sched/core: Mitigate race cpus_share_cache()/update_top_cache_domain()
Nothing protects the access to the per_cpu variable sd_llc_id. When testing
the same CPU (i.e. this_cpu == that_cpu), a race condition exists with
update_top_cache_domain(). One scenario being:

              CPU1                            CPU2
  ==================================================================

  per_cpu(sd_llc_id, CPUX) => 0
                                    partition_sched_domains_locked()
      				      detach_destroy_domains()
  cpus_share_cache(CPUX, CPUX)          update_top_cache_domain(CPUX)
    per_cpu(sd_llc_id, CPUX) => 0
                                          per_cpu(sd_llc_id, CPUX) = CPUX
    per_cpu(sd_llc_id, CPUX) => CPUX
    return false

ttwu_queue_cond() wouldn't catch smp_processor_id() == cpu and the result
is a warning triggered from ttwu_queue_wakelist().

Avoid a such race in cpus_share_cache() by always returning true when
this_cpu == that_cpu.

Fixes: 518cd62341 ("sched: Only queue remote wakeups when crossing cache boundaries")
Reported-by: Jing-Ting Wu <jing-ting.wu@mediatek.com>
Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20211104175120.857087-1-vincent.donnefort@arm.com
Bug: 204726704
Change-Id: Ib6e59187b6d7d7dcabae84e3541d5fbe0dfc400a
(cherry picked from commit 42dc938a59)
Signed-off-by: Jing-Ting Wu <Jing-Ting.Wu@mediatek.com>
2021-12-01 11:10:58 +00:00
..
autogroup.c
autogroup.h
clock.c
completion.c
core.c UPSTREAM: sched/core: Mitigate race cpus_share_cache()/update_top_cache_domain() 2021-12-01 11:10:58 +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: android: Export symbols for invoking cpufreq_update_util() 2021-06-29 10:44:12 +00: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 irqtime process tick 2021-05-13 08:26:15 +00:00
deadline.c This is the 5.10.65 stable release 2021-09-15 14:16:47 +02:00
debug.c This is the 5.10.44 stable release 2021-06-16 13:14:03 +02:00
fair.c Revert "sched/fair: Keep load_avg and load_sum synced" 2021-11-16 21:07:58 +00:00
features.h Revert "Revert "sched,fair: Alternative sched_slice()"" 2021-05-21 13:17:06 -07:00
idle.c Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
isolation.c
loadavg.c
Makefile
membarrier.c sched/membarrier: fix missing local execution of ipi_sync_rq_state() 2021-03-17 17:06:35 +01:00
pelt.c ANDROID: sched: add a helper function to change PELT half-life 2021-08-07 00:03:23 +08:00
pelt.h sched/fair: Fix util_est UTIL_AVG_UNCHANGED handling 2021-06-16 12:01:46 +02:00
psi.c Merge branch 'android12-5.10' into android12-5.10-lts 2021-07-15 17:17:09 +02:00
rt.c ANDROID: vendor_hooks: Add hooks to record the time of the process in various states 2021-11-11 22:15:49 +08:00
sched-pelt.h ANDROID: sched: pelt: Fix the PELT arrays 2021-03-04 11:53:51 +00:00
sched.h sched/deadline: Fix reset_on_fork reporting of DL tasks 2021-09-15 09:50:24 +02: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 This is the 5.10.51 stable release 2021-07-19 17:29:53 +02:00