linux/arch
Ralf Baechle a76ab5c10d [MIPS] MT: Fix bug in multithreaded kernels.
When GDB writes a breakpoint into address area of inferior process the
kernel needs to invalidate the modified memory in the inferior which
is done by calling flush_cache_page which in turns calls
r4k_flush_cache_page and local_r4k_flush_cache_page for VSMP or SMTC
kernel via r4k_on_each_cpu().

As the VSMP and SMTC SMP kernels for 34K are running on a single shared
caches it is possible to get away without interprocessor function calls.
This optimization is implemented in r4k_on_each_cpu, so
local_r4k_flush_cache_page is only ever called on the local CPU.

This is where the following code in local_r4k_flush_cache_page() strikes:

        /*
         * If ownes no valid ASID yet, cannot possibly have gotten
         * this page into the cache.
         */
        if (cpu_context(smp_processor_id(), mm) == 0)
                return;

On VSMP and SMTC had a function of cpu_context() for each CPU(TC).

So in case another CPU than the CPU executing local_r4k_cache_flush_page
has not accessed the mm but one of the other CPUs has there may be data
to be flushed in the cache yet local_r4k_cache_flush_page will falsely
return leaving the I-cache inconsistent for the breakpoint.

While the issue was discovered with GDB it also exists in
local_r4k_flush_cache_range() and local_r4k_flush_cache().

Fixed by introducing a new function has_valid_asid which on MT kernels
returns true if a mm is active on any processor in the system.

This is relativly expensive since for memory acccesses in that loop
cache misses have to be assumed but it seems the most viable solution
for 2.6.23 and older -stable kernels.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2007-10-29 19:35:37 +00:00
..
alpha alpha: sg_virt() fallout 2007-10-23 12:31:05 +02:00
arm Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2007-10-23 16:32:11 -07:00
avr32 [AVR32] ARRAY_SIZE() cleanup 2007-10-23 11:20:26 +02:00
blackfin blackfin: fix sg fallout 2007-10-24 14:09:25 +02:00
cris typo fixes 2007-10-20 01:34:40 +02:00
frv scatterlist fallout: frv 2007-10-27 22:18:11 -07:00
h8300 spelling fixes: arch/h8300/ 2007-10-20 01:10:46 +02:00
ia64 Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block 2007-10-22 19:11:06 -07:00
m32r spelling fixes: arch/m32r/ 2007-10-20 01:14:39 +02:00
m68k m68k: sg fallout 2007-10-24 08:55:40 +02:00
m68knommu m68knommu: mark mem init functions as __init 2007-10-23 20:45:44 -07:00
mips [MIPS] MT: Fix bug in multithreaded kernels. 2007-10-29 19:35:37 +00:00
parisc parisc: fix sg_page() fallout 2007-10-23 09:49:31 +02:00
powerpc Merge branch 'for-2.6.24' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer/powerpc-4xx into merge 2007-10-23 22:20:51 +10:00
ppc kbuild: restore arch/{ppc/xtensa}/boot cflags 2007-10-20 20:35:23 +02:00
s390 [S390] 4level-fixup cleanup 2007-10-22 12:52:49 +02:00
sh Combine instrumentation menus in kernel/Kconfig.instrumentation 2007-10-19 11:53:54 -07:00
sh64 Fix misspellings of "system", "controller", "interrupt" and "necessary". 2007-10-19 23:10:43 +02:00
sparc [SPARC32]: Fix build-warning in io-unit.c 2007-10-27 00:54:14 -07:00
sparc64 [SPARC64]: __inline__ --> inline 2007-10-27 00:13:04 -07:00
um arch/um/drivers/ubd_kern.c: fix a building error 2007-10-24 13:07:11 +02:00
v850 spelling fixes: arch/v850/ 2007-10-20 01:24:05 +02:00
x86 x86: Dump filtering supports x86_64 sparsemem 2007-10-27 20:57:43 +02:00
xtensa kbuild: restore arch/{ppc/xtensa}/boot cflags 2007-10-20 20:35:23 +02:00