mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
7c1e5b9690
The icache will be flushed in switch_to() if force_icache_flush is true,
or in flush_icache_deferred() if icache_stale_mask is set. Between
setting force_icache_flush to false and calculating the new
icache_stale_mask, preemption needs to be disabled. There are two
reasons for this:
1. If CPU migration happens between force_icache_flush = false, and the
icache_stale_mask is set, an icache flush will not be emitted.
2. smp_processor_id() is used in set_icache_stale_mask() to mark the
current CPU as not needing another flush since a flush will have
happened either by userspace or by the kernel when performing the
migration. smp_processor_id() is currently called twice with preemption
enabled which causes a race condition. It allows
icache_stale_mask to be populated with inconsistent CPU ids.
Resolve these two issues by setting the icache_stale_mask before setting
force_icache_flush to false, and using get_cpu()/put_cpu() to obtain the
smp_processor_id().
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Fixes:
|
||
---|---|---|
.. | ||
boot | ||
configs | ||
crypto | ||
errata | ||
include | ||
kernel | ||
kvm | ||
lib | ||
mm | ||
net | ||
purgatory | ||
tools | ||
Kbuild | ||
Kconfig | ||
Kconfig.debug | ||
Kconfig.errata | ||
Kconfig.socs | ||
Kconfig.vendor | ||
Makefile | ||
Makefile.postlink |