...
 
Commits (4)
spl-linux (0.7.12-2) UNRELEASED; urgency=medium
[ Colin Ian King ]
* Add Linux 5.0 compat fixes.
+ 0001-Add-check-for-ktime_get_coarse_real_ts64-for-V5.0-ke.patch
+ 0002-Add-check-for-totalram-pages.patch
+ 0003-Add-check-for-ktime_get_ts64-for-V5.0-ke.patch
+ 0004-Add-check-for-timespec64-sub.patch
+ 0005-Use-64-bit-timespec-fixes.patch
* Fix autopkgtest depends, we really need to include @ too
* Just run the splat tests for now as these are the critical interface
tests and the will fail if spl modules are broken.
-- Mo Zhou <cdluminate@gmail.com> Sat, 02 Feb 2019 12:23:00 +0000
spl-linux (0.7.12-1) unstable; urgency=medium
* New upstream version 0.7.12
......
Add support for ktime_get_coarse_real_ts64 for 5.0
Signed-off-by; Colin Ian King <colin.king@canonical.com>
---
Index: spl-linux-0.7.12/config/kernel-ktime.m4
===================================================================
--- /dev/null
+++ spl-linux-0.7.12/config/kernel-ktime-get-coarse-real-ts64.m4
@@ -0,0 +1,20 @@
+dnl #
+dnl # 5.0 API change
+dnl # current_kernel_time64 to ktime_get_coarse_real_ts64 timespec64
+dnl #
+AC_DEFUN([SPL_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64], [
+ AC_MSG_CHECKING([whether ktime_get_coarse_real_ts64 exists])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/ktime.h>
+ ],[
+ struct timespec64 ts;
+
+ ktime_get_coarse_real_ts64(&ts);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KTIME_GET_COARSE_REAL_TS64, 1,
+ [ktime_get_coarse_real_ts64 is provided])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
Index: spl-linux-0.7.12/include/sys/time.h
===================================================================
--- spl-linux-0.7.12.orig/include/sys/time.h
+++ spl-linux-0.7.12/include/sys/time.h
@@ -71,22 +71,32 @@ typedef struct timespec inode_timespec_
static inline void
gethrestime(inode_timespec_t *ts)
- {
+{
+#if defined(HAVE_KTIME_GET_COARSE_REAL_TS64)
+ ktime_get_coarse_real_ts64(ts);
+#else
#if defined(HAVE_INODE_TIMESPEC64_TIMES)
*ts = current_kernel_time64();
#else
*ts = current_kernel_time();
#endif
+#endif
}
static inline time_t
gethrestime_sec(void)
{
+#if defined(HAVE_KTIME_GET_COARSE_REAL_TS64)
+ inode_timespec_t ts;
+
+ ktime_get_coarse_real_ts64(&ts);
+#else
#if defined(HAVE_INODE_TIMESPEC64_TIMES)
inode_timespec_t ts = current_kernel_time64();
#else
inode_timespec_t ts = current_kernel_time();
#endif
+#endif
return (ts.tv_sec);
}
Index: spl-linux-0.7.12/config/spl-build.m4
===================================================================
--- spl-linux-0.7.12.orig/config/spl-build.m4
+++ spl-linux-0.7.12/config/spl-build.m4
@@ -54,6 +54,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_KERNEL_WRITE
SPL_AC_KERNEL_READ
SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST
+ SPL_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
Add support for totalram-pages being a function for 5.0
Was a unsigned long, in 5.0 it is a inline'd function
Signed-off-by; Colin Ian King <colin.king@canonical.com>
---
Index: spl-linux-0.7.12/config/kernel-totalram-pages.m4
===================================================================
--- /dev/null
+++ spl-linux-0.7.12/config/kernel-totalram-pages.m4
@@ -0,0 +1,20 @@
+dnl #
+dnl # 5.0 API change
+dnl # check if totalram_pages is a function
+dnl #
+AC_DEFUN([SPL_AC_KERNEL_TOTALRAM_PAGES_FUNCTION], [
+ AC_MSG_CHECKING([whether totalram_pages is a function])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+ ],[
+ unsigned long t;
+
+ t = totalram_pages();
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TOTALRAM_PAGES_FUNCTION, 1,
+ [totalram_pages is a function])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
Index: spl-linux-0.7.12/config/spl-build.m4
===================================================================
--- spl-linux-0.7.12.orig/config/spl-build.m4
+++ spl-linux-0.7.12/config/spl-build.m4
@@ -55,6 +55,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_KERNEL_READ
SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST
SPL_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64
+ SPL_AC_KERNEL_TOTALRAM_PAGES_FUNCTION
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
Index: spl-linux-0.7.12/include/sys/vmsystm.h
===================================================================
--- spl-linux-0.7.12.orig/include/sys/vmsystm.h
+++ spl-linux-0.7.12/include/sys/vmsystm.h
@@ -34,7 +34,11 @@
#include <asm/uaccess.h>
#define membar_producer() smp_wmb()
+#if defined(HAVE_TOTALRAM_PAGES_FUNCTION)
+#define physmem totalram_pages()
+#else
#define physmem totalram_pages
+#endif
#define freemem (nr_free_pages() + \
global_page_state(NR_INACTIVE_FILE) + \
global_page_state(NR_INACTIVE_ANON) + \
Add support for ktime_get_ts64 for 5.0
Signed-off-by; Colin Ian King <colin.king@canonical.com>
---
Index: spl-linux-0.7.12/config/kernel-ktime-get-ts64.m4
===================================================================
--- /dev/null
+++ spl-linux-0.7.12/config/kernel-ktime-get-ts64.m4
@@ -0,0 +1,20 @@
+dnl #
+dnl # 4.20 API change
+dnl # check if ktime_get_ts64 exists
+dnl #
+AC_DEFUN([SPL_AC_KERNEL_KTIME_GET_TS64], [
+ AC_MSG_CHECKING([whether ktime_get_ts64 exists])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/ktime.h>
+ ],[
+ struct timespec64 ts;
+
+ ktime_get_ts64(&ts);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KTIME_GET_TS64, 1,
+ [ktime_get_ts64 is provided])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
Index: spl-linux-0.7.12/config/spl-build.m4
===================================================================
--- spl-linux-0.7.12.orig/config/spl-build.m4
+++ spl-linux-0.7.12/config/spl-build.m4
@@ -55,6 +55,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_KERNEL_READ
SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST
SPL_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64
+ SPL_AC_KERNEL_KTIME_GET_TS64
SPL_AC_KERNEL_TOTALRAM_PAGES_FUNCTION
])
Add support for timespec64 for 5.0
Signed-off-by; Colin Ian King <colin.king@canonical.com>
---
Index: spl-linux-0.7.12/config/kernel-timespec64.m4
===================================================================
--- /dev/null
+++ spl-linux-0.7.12/config/kernel-timespec64.m4
@@ -0,0 +1,20 @@
+dnl #
+dnl # 4.20 API change
+dnl # timespec64_sub replacing timespec_sub
+dnl #
+AC_DEFUN([SPL_AC_KERNEL_TIMESPEC64_SUB], [
+ AC_MSG_CHECKING([whether timespec64_sub exists])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/ktime.h>
+ ],[
+ struct timespec64 ts1 = { 0 }, ts2 = { 0 }, delta;
+
+ delta = timespec64_sub(ts1, ts2);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TIMESPEC64_SUB, 1,
+ [timespec64_sub is provided])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
Index: spl-linux-0.7.12/config/spl-build.m4
===================================================================
--- spl-linux-0.7.12.orig/config/spl-build.m4
+++ spl-linux-0.7.12/config/spl-build.m4
@@ -56,6 +56,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST
SPL_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64
SPL_AC_KERNEL_KTIME_GET_TS64
+ SPL_AC_KERNEL_TIMESPEC64_SUB
SPL_AC_KERNEL_TOTALRAM_PAGES_FUNCTION
])
Add 64 bit timespec support for 5.0
Signed-off-by; Colin Ian King <colin.king@canonical.com>
---
Index: spl-linux-0.7.12/module/splat/splat-kmem.c
===================================================================
--- spl-linux-0.7.12.orig/module/splat/splat-kmem.c
+++ spl-linux-0.7.12/module/splat/splat-kmem.c
@@ -713,7 +713,11 @@ splat_kmem_cache_thread_test(struct file
{
kmem_cache_priv_t *kcp;
kthread_t *thr;
+#if defined(HAVE_TIMESPEC64_SUB)
+ struct timespec64 start, stop, delta;
+#else
struct timespec start, stop, delta;
+#endif
char cache_name[32];
int i, rc = 0;
@@ -737,7 +741,11 @@ splat_kmem_cache_thread_test(struct file
goto out_kcp;
}
+#if defined(HAVE_KTIME_GET_TS64)
+ ktime_get_ts64(&start);
+#else
getnstimeofday(&start);
+#endif
for (i = 0; i < SPLAT_KMEM_THREADS; i++) {
thr = thread_create(NULL, 0,
@@ -762,14 +770,22 @@ splat_kmem_cache_thread_test(struct file
/* Sleep until all thread have finished */
wait_event(kcp->kcp_ctl_waitq, splat_kmem_cache_test_threads(kcp, 0));
+#if defined(HAVE_KTIME_GET_TS64)
+ ktime_get_ts64(&stop);
+#else
getnstimeofday(&stop);
+#endif
+#if defined(HAVE_TIMESPEC64_SUB)
+ delta = timespec64_sub(stop, start);
+#else
delta = timespec_sub(stop, start);
+#endif
splat_vprint(file, name,
- "%-22s %2ld.%09ld\t"
+ "%-22s %2lld.%09ld\t"
"%lu/%lu/%lu\t%lu/%lu/%lu\n",
kcp->kcp_cache->skc_name,
- delta.tv_sec, delta.tv_nsec,
+ (long long)delta.tv_sec, delta.tv_nsec,
(unsigned long)kcp->kcp_cache->skc_slab_total,
(unsigned long)kcp->kcp_cache->skc_slab_max,
(unsigned long)(kcp->kcp_alloc *
@@ -1226,7 +1242,11 @@ splat_kmem_test13(struct file *file, voi
kmem_cache_thread_t *kct;
dummy_page_t *dp;
struct list_head list;
+#if defined(HAVE_TIMESPEC64_SUB)
+ struct timespec64 start, stop, delta = { 0, 0 };
+#else
struct timespec start, stop, delta = { 0, 0 };
+#endif
int size, count, slabs, fails = 0;
int i, rc = 0, max_time = 10;
@@ -1274,7 +1294,11 @@ splat_kmem_test13(struct file *file, voi
i = 0;
slabs = kcp->kcp_cache->skc_slab_total;
INIT_LIST_HEAD(&list);
+#if defined(HAVE_KTIME_GET_TS64)
+ ktime_get_ts64(&start);
+#else
getnstimeofday(&start);
+#endif
/* Apply memory pressure */
while (kcp->kcp_cache->skc_slab_total > (slabs >> 2)) {
@@ -1283,8 +1307,16 @@ splat_kmem_test13(struct file *file, voi
splat_kmem_cache_test_debug(
file, SPLAT_KMEM_TEST13_NAME, kcp);
+#if defined(HAVE_KTIME_GET_TS64)
+ ktime_get_ts64(&stop);
+#else
getnstimeofday(&stop);
+#endif
+#if defined(HAVE_TIMESPEC64_SUB)
+ delta = timespec64_sub(stop, start);
+#else
delta = timespec_sub(stop, start);
+#endif
if (delta.tv_sec >= max_time) {
splat_vprint(file, SPLAT_KMEM_TEST13_NAME,
"Failed to reclaim 3/4 of cache in %ds, "
Index: spl-linux-0.7.12/module/splat/splat-taskq.c
===================================================================
--- spl-linux-0.7.12.orig/module/splat/splat-taskq.c
+++ spl-linux-0.7.12/module/splat/splat-taskq.c
@@ -1077,14 +1077,22 @@ splat_taskq_throughput_func(void *arg)
static int
splat_taskq_throughput(struct file *file, void *arg, const char *name,
int nthreads, int minalloc, int maxalloc, int flags, int tasks,
+#if defined(HAVE_TIMESPEC64_SUB)
+ struct timespec64 *delta)
+#else
struct timespec *delta)
+#endif
{
taskq_t *tq;
taskqid_t id;
splat_taskq_arg_t tq_arg;
taskq_ent_t **tqes;
atomic_t count;
+#if defined(HAVE_TIMESPEC64_SUB)
+ struct timespec64 start, stop;
+#else
struct timespec start, stop;
+#endif
int i, j, rc = 0;
tqes = vmalloc(sizeof (*tqes) * tasks);
@@ -1107,7 +1115,11 @@ splat_taskq_throughput(struct file *file
tq_arg.count = &count;
atomic_set(tq_arg.count, 0);
+#if defined(HAVE_KTIME_GET_TS64)
+ ktime_get_ts64(&start);
+#else
getnstimeofday(&start);
+#endif
for (i = 0; i < tasks; i++) {
tqes[i] = kmalloc(sizeof (taskq_ent_t), GFP_KERNEL);
@@ -1136,8 +1148,16 @@ splat_taskq_throughput(struct file *file
taskq_wait(tq);
if (delta != NULL) {
+#if defined(HAVE_KTIME_GET_TS64)
+ ktime_get_ts64(&stop);
+#else
getnstimeofday(&stop);
+#endif
+#if defined(HAVE_TIMESPEC64_SUB)
+ *delta = timespec64_sub(stop, start);
+#else
*delta = timespec_sub(stop, start);
+#endif
}
splat_vprint(file, name, "Taskq '%s' %d/%d dispatches finished\n",
@@ -1452,7 +1472,11 @@ out_free:
static int
splat_taskq_test11(struct file *file, void *arg)
{
+#if defined(HAVE_TIMESPEC64_SUB)
+ struct timespec64 normal, dynamic;
+#else
struct timespec normal, dynamic;
+#endif
int error;
error = splat_taskq_throughput(file, arg, SPLAT_TASKQ_TEST11_NAME,
@@ -1468,9 +1492,9 @@ splat_taskq_test11(struct file *file, vo
return (error);
splat_vprint(file, SPLAT_TASKQ_TEST11_NAME,
- "Timing taskq_wait(): normal=%ld.%09lds, dynamic=%ld.%09lds\n",
- normal.tv_sec, normal.tv_nsec,
- dynamic.tv_sec, dynamic.tv_nsec);
+ "Timing taskq_wait(): normal=%lld.%09lds, dynamic=%lld.%09lds\n",
+ (unsigned long long)normal.tv_sec, normal.tv_nsec,
+ (unsigned long long)dynamic.tv_sec, dynamic.tv_nsec);
/* A 10x increase in runtime is used to indicate a core problem. */
if (((int64_t)dynamic.tv_sec * NANOSEC + (int64_t)dynamic.tv_nsec) >
0001-Add-check-for-ktime_get_coarse_real_ts64-for-V5.0-ke.patch
0002-Add-check-for-totalram-pages.patch
0003-Add-check-for-ktime_get_ts64-for-V5.0-ke.patch
0004-Add-check-for-timespec64-sub.patch
0005-Use-64-bit-timespec-fixes.patch
Tests: dkms-test check.sh
Tests: check.sh
Restrictions: needs-root, allow-stderr, isolation-machine
Depends: dkms
Depends: dkms, @