From b93ce1853e1a28bbd6ca992c5b646aa2d2699892 Mon Sep 17 00:00:00 2001 From: Kevin Brodsky Date: Thu, 15 Dec 2016 14:23:09 +0000 Subject: Clarify comment on JIT cache flush issue The original fix (#304947) is needed, but the comment was suggesting a hardware cause and a link with A53 errata. In all likelihood neither of these is true, and the issue is actually caused by a kernel issue affecting many Qualcomm devices (like those using the msm tree). Change-Id: Ie750e6fd9eb7130982d184c22917b5c3ea4beed0 --- runtime/jit/jit_code_cache.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index f5151b588a..0ac388ac02 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -556,12 +556,13 @@ uint8_t* JitCodeCache::CommitCodeInternal(Thread* self, // Flush data cache, as compiled code references literals in it. FlushDataCache(reinterpret_cast(roots_data), reinterpret_cast(roots_data + data_size)); - // Flush caches before we remove write permission because on some ARMv8 hardware, - // flushing caches require write permissions. + // Flush caches before we remove write permission because some ARMv8 Qualcomm kernels may + // trigger a segfault if a page fault occurs when requesting a cache maintenance operation. + // This is a kernel bug that we need to work around until affected devices (e.g. Nexus 5X and + // 6P) stop being supported or their kernels are fixed. // - // For reference, here are kernel patches discussing about this issue: - // https://android.googlesource.com/kernel/msm/%2B/0e7f7bcc3fc87489cda5aa6aff8ce40eed912279 - // https://patchwork.kernel.org/patch/9047921/ + // For reference, this behavior is caused by this commit: + // https://android.googlesource.com/kernel/msm/+/3fbe6bc28a6b9939d0650f2f17eb5216c719950c FlushInstructionCache(reinterpret_cast(code_ptr), reinterpret_cast(code_ptr + code_size)); DCHECK(!Runtime::Current()->IsAotCompiler()); -- cgit v1.2.3-59-g8ed1b