Shay Gal-On created TS-4233:
-------------------------------
Summary: ATS on AARCH64 with 64K page kernel crashes
Key: TS-4233
URL: https://issues.apache.org/jira/browse/TS-4233
Project: Traffic Server
Issue Type: Bug
Components: Core
Reporter: Shay Gal-On
Tested on linux aarch64 Cavium ThunderX platform, 4.2 kernel configured with
64K pages. Crashes are caused by 2 issues:
1. Freelist pointer versioning sign extends upper 16 bits. Does not work well
for 48b va on aarch64.
Patch:
--- orig-trafficserver-5.3.2/lib/ts/ink_queue.h 2015-09-08 13:05:06.000000000
-0700
+++ trafficserver-5.3.2/lib/ts/ink_queue.h 2016-02-18 09:02:36.899451000
-0800
@@ -135,11 +135,16 @@
#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) \
(_x).s.pointer = _p; \
(_x).s.version = _v
-#elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) ||
defined(__aarch64__)
+#elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__)
#define FREELIST_POINTER(_x) \
((void *)(((((intptr_t)(_x).data) << 16) >> 16) |
(((~((((intptr_t)(_x).data) << 16 >> 63) - 1)) >> 48) << 48))) // sign extend
#define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 48)
#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data =
((((intptr_t)(_p)) & 0x0000FFFFFFFFFFFFULL) | (((_v)&0xFFFFULL) << 48))
+#elif defined(__aarch64__)
+#define FREELIST_POINTER(_x) \
+ ((void *)(((((intptr_t)(_x).data) & 0x0000FFFFFFFFFFFFULL )))) // clear the
version
+#define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 48)
+#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data =
((((intptr_t)(_p)) & 0x0000FFFFFFFFFFFFULL) | (((_v)&0xFFFFULL) << 48))
#else
#error "unsupported processor"
#endif
2. The iocore cache sets the STORE_BLOCK_SIZE to 8k. However, in order to mmap
files, the size has to be a multiple of kernel page size, so that with 64K
pages it is possible to get bad offsets when remapping the cache blocks.
Following patch wraps the block size, and adds configure check for 64K pages to
override it in that case.
diff -Naur orig-trafficserver-5.3.2/iocore/cache/I_Store.h
trafficserver-5.3.2/iocore/cache/I_Store.h
--- orig-trafficserver-5.3.2/iocore/cache/I_Store.h 2015-09-08
13:05:06.000000000 -0700
+++ trafficserver-5.3.2/iocore/cache/I_Store.h 2016-02-18 08:52:32.459451000
-0800
@@ -33,7 +33,9 @@
#include "libts.h"
+#ifndef STORE_BLOCK_SIZE
#define STORE_BLOCK_SIZE 8192
+#endif
#define STORE_BLOCK_SHIFT 13
#define DEFAULT_HW_SECTOR_SIZE 512
--- orig-trafficserver-5.3.2/configure.ac 2015-09-08 13:05:06.000000000
-0700
+++ trafficserver-5.3.2/configure.ac 2016-02-26 11:09:12.099451000 -0800
@@ -1324,6 +1324,14 @@
TS_ADDTO(CFLAGS, [-mcx16])
TS_ADDTO(CXXFLAGS, [-mcx16])
])
+AC_MSG_CHECKING([TESTING KERNEL PAGE SIZE])
+kernel_page_size=`getconf PAGE_SIZE`
+AS_IF([test "x${kernel_page_size}" = "x65536"],
+[
+ TS_ADDTO(CXXFLAGS, [-DSTORE_BLOCK_SIZE=65536])
+]
+)
+AC_MSG_RESULT([$kernel_page_size])
# Check for POSIX capabilities library.
# If we don't find it, disable checking for header.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)