summaryrefslogtreecommitdiff
path: root/compiler/common_compiler_test.cc
diff options
context:
space:
mode:
authorOrion Hodson <oth@google.com>2019-06-25 14:18:18 +0100
committerTreehugger Robot <treehugger-gerrit@google.com>2019-06-26 14:59:58 +0000
commitaeb0223f14a9dbd9e7caaa177d055684b4819799 (patch)
treed396dcddb3afa328d192776bc1856a48f5f52583 /compiler/common_compiler_test.cc
parent05f87217ddc9b4b9186710c0135b918f456c5aef (diff)
Retry cache flushes on ARMv7 devices
On ARMv7, CPU cache flushing requires a system call. This system call can fail and return an error. This change moves to using the system call directly (cacheflush) so flush failures can be detected and flushing can be re-attempted. For other platforms we continue using __builtin___clear_cache which is an intrinsic with a void return type. The strategy for ARMv7 is to attempt to flush the entire range required. If this fails (a rare occurance), we visit the pages in the flush range sequentially, first reading a byte from the page to maximize it's chance of being resident and then flushing the cache lines. We repeat this up to 4 times per page if there are failures. As a final fallback, when neither approach to flushing the JIT code cache pages succeeds, the code is not committed to the JIT code cache as the cache lines for the new code are in an unknown state. This complexity is necessary for the dual view JIT because the executable range is not writable so the kernel logic does not (appear to) anticipate the need to flush (or invalidate) cache lines there. Previously the failing cache flush operations went undetected and result in bad i-cache state and cause crashes. These issues have only been reported on devices with 32-bit kernels. Bug: 132205399 Test: art/test.py --host --jit -j32 Test: Manual (described in bug) Change-Id: I63b56beaac610ea973def0a57118be9a2647da23
Diffstat (limited to 'compiler/common_compiler_test.cc')
-rw-r--r--compiler/common_compiler_test.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index a44b9ae523..18f00e21e4 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -99,7 +99,7 @@ void CommonCompilerTest::MakeExecutable(const void* code_start, size_t code_leng
int result = mprotect(reinterpret_cast<void*>(base), len, PROT_READ | PROT_WRITE | PROT_EXEC);
CHECK_EQ(result, 0);
- FlushInstructionCache(reinterpret_cast<void*>(base), reinterpret_cast<void*>(base + len));
+ CHECK(FlushCpuCaches(reinterpret_cast<void*>(base), reinterpret_cast<void*>(base + len)));
}
void CommonCompilerTest::SetUp() {