diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-12-27 19:18:38 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-12-27 19:18:38 +0000 |
commit | 483dea1f6457fcb58dbe62a48e1affc2b2c07e90 (patch) | |
tree | 55fa1a04c0ce33a92d2e87dafd16989df460607f /sys/arch | |
parent | 78329395c602671b8f14019fcf41d35bd50da075 (diff) |
Do not issue a cache maintainance operation until the last one is not
completed; this used to be the case, but revision 1.25 of this file, close
to four years ago, changed this behaviour by mistake. The side effects of this
mishandling of the cache did not show up until the kernel memory allocation
strategy moved towards fast reuse of freed pages.
Took me a while to track this down, maybe I'm getting too old to write code,
I probably should write backdoors instead.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/m88k/m88k/m8820x_machdep.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c index c097ea2f022..aa1130f89dc 100644 --- a/sys/arch/m88k/m88k/m8820x_machdep.c +++ b/sys/arch/m88k/m88k/m8820x_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m8820x_machdep.c,v 1.40 2010/04/25 21:03:53 miod Exp $ */ +/* $OpenBSD: m8820x_machdep.c,v 1.41 2010/12/27 19:18:37 miod Exp $ */ /* * Copyright (c) 2004, 2007, Miodrag Vallat. * @@ -619,20 +619,19 @@ m8820x_flush_cache(cpuid_t cpu, paddr_t pa, psize_t size) CMMU_LOCK; while (size != 0) { - count = (pa & PAGE_MASK) == 0 && size >= PAGE_SIZE ? - PAGE_SIZE : MC88200_CACHE_LINE; - - if (count <= MC88200_CACHE_LINE) - m8820x_cmmu_set_cmd(CMMU_FLUSH_CACHE_CBI_LINE, - 0, cpu, 0, pa); - else + if ((pa & PAGE_MASK) == 0 && size >= PAGE_SIZE) { m8820x_cmmu_set_cmd(CMMU_FLUSH_CACHE_CBI_PAGE, 0, cpu, 0, pa); - + count = PAGE_SIZE; + } else { + m8820x_cmmu_set_cmd(CMMU_FLUSH_CACHE_CBI_LINE, + 0, cpu, 0, pa); + count = MC88200_CACHE_LINE; + } pa += count; size -= count; + m8820x_cmmu_wait(cpu); } - m8820x_cmmu_wait(cpu); CMMU_UNLOCK; set_psr(psr); @@ -655,20 +654,19 @@ m8820x_flush_inst_cache(cpuid_t cpu, paddr_t pa, psize_t size) CMMU_LOCK; while (size != 0) { - count = (pa & PAGE_MASK) == 0 && size >= PAGE_SIZE ? - PAGE_SIZE : MC88200_CACHE_LINE; - - if (count <= MC88200_CACHE_LINE) - m8820x_cmmu_set_cmd(CMMU_FLUSH_CACHE_INV_LINE, - MODE_VAL, cpu, INST_CMMU, pa); - else + if ((pa & PAGE_MASK) == 0 && size >= PAGE_SIZE) { m8820x_cmmu_set_cmd(CMMU_FLUSH_CACHE_INV_PAGE, MODE_VAL, cpu, INST_CMMU, pa); - + count = PAGE_SIZE; + } else { + m8820x_cmmu_set_cmd(CMMU_FLUSH_CACHE_INV_LINE, + MODE_VAL, cpu, INST_CMMU, pa); + count = MC88200_CACHE_LINE; + } pa += count; size -= count; + m8820x_cmmu_wait(cpu); } - m8820x_cmmu_wait(cpu); CMMU_UNLOCK; set_psr(psr); |