Use LOGW when membarrier_function is not present in L3

membarrier_function() for clearing cache in L3 is optional and good to
have. Currently we log it as error if it is not available, which caused
some confusion for CE CDM L3 partners building their own L3.

Also corrected a typo in the function name.

Test: build L3 and run dynamic level3 tests
Change-Id: If20bcb1fe2bace33c43aa178af699f3b190a1fd2
This commit is contained in:
Cong Lin
2023-05-30 17:44:13 -07:00
committed by Robert Shih
parent 6327211db6
commit dff87f04a9

View File

@@ -16,7 +16,7 @@
namespace wvoec3 {
bool supports_membarier_syscall() {
bool supports_membarrier_syscall() {
// Check kernel version supports membarrier(2); version 4.16 is required.
static constexpr int kRequiredMajor = 4;
static constexpr int kRequiredMinor = 16;
@@ -29,8 +29,11 @@ bool supports_membarier_syscall() {
}
if (major < kRequiredMajor ||
(major == kRequiredMajor && minor < kRequiredMinor)) {
LOGE("Kernel version %d, %d < required %d, %d", major, minor,
kRequiredMajor, kRequiredMinor);
LOGW(
"Kernel version %d, %d < required %d, %d. Some membarrier_function "
"calls may not be available. Although this is not fatal, missing "
"membarrier support may cause run-time errors on some platforms.",
major, minor, kRequiredMajor, kRequiredMinor);
return false;
}
return true;
@@ -43,8 +46,8 @@ bool supports_membarier_syscall() {
// * membarrier(2)
// * art::jit::JitMemoryRegion::CommitCode
int membarrier_function(int command) {
static bool supports_membarier = supports_membarier_syscall();
if (supports_membarier) {
static bool supports_membarrier = supports_membarrier_syscall();
if (supports_membarrier) {
return syscall(__NR_membarrier, command, 0);
}
errno = ENOSYS;