2010-08-26 18:22:58 +00:00
|
|
|
dnl #
|
Support for vectorized algorithms on x86
This is initial support for x86 vectorized implementations of ZFS parity
and checksum algorithms.
For the compilation phase, configure step checks if toolchain supports relevant
instruction sets. Each implementation must ensure that the code is not passed
to compiler if relevant instruction set is not supported. For this purpose,
following new defines are provided if instruction set is supported:
- HAVE_SSE,
- HAVE_SSE2,
- HAVE_SSE3,
- HAVE_SSSE3,
- HAVE_SSE4_1,
- HAVE_SSE4_2,
- HAVE_AVX,
- HAVE_AVX2.
For detecting if an instruction set can be used in runtime, following functions
are provided in (include/linux/simd_x86.h):
- zfs_sse_available()
- zfs_sse2_available()
- zfs_sse3_available()
- zfs_ssse3_available()
- zfs_sse4_1_available()
- zfs_sse4_2_available()
- zfs_avx_available()
- zfs_avx2_available()
- zfs_bmi1_available()
- zfs_bmi2_available()
These function should be called once, on module load, or initialization.
They are safe to use from user and kernel space.
If an implementation is using more than single instruction set, both compiler
and runtime support for all relevant instruction sets should be checked.
Kernel fpu methods:
- kfpu_begin()
- kfpu_end()
Use __get_cpuid_max and __cpuid_count from <cpuid.h>
Both gcc and clang have support for these. They also handle ebx register
in case it is used for PIC code.
Signed-off-by: Gvozden Neskovic <neskovic@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Closes #4381
2016-02-29 18:42:27 +00:00
|
|
|
dnl # Default ZFS kernel configuration
|
2010-08-26 18:22:58 +00:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
2020-04-14 18:36:28 +00:00
|
|
|
AM_COND_IF([BUILD_LINUX], [
|
|
|
|
dnl # Setup the kernel build environment.
|
|
|
|
ZFS_AC_KERNEL
|
|
|
|
ZFS_AC_QAT
|
2019-10-01 19:50:34 +00:00
|
|
|
|
2020-04-14 18:36:28 +00:00
|
|
|
dnl # Sanity checks for module building and CONFIG_* defines
|
|
|
|
ZFS_AC_KERNEL_CONFIG_DEFINED
|
2022-04-26 17:47:09 +00:00
|
|
|
ZFS_AC_MODULE_SYMVERS
|
2019-10-01 19:50:34 +00:00
|
|
|
|
2020-04-14 18:36:28 +00:00
|
|
|
dnl # Sequential ZFS_LINUX_TRY_COMPILE tests
|
|
|
|
ZFS_AC_KERNEL_FPU_HEADER
|
2020-11-02 21:39:50 +00:00
|
|
|
ZFS_AC_KERNEL_OBJTOOL_HEADER
|
2020-04-14 18:36:28 +00:00
|
|
|
ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T
|
|
|
|
ZFS_AC_KERNEL_MISC_MINOR
|
|
|
|
ZFS_AC_KERNEL_DECLARE_EVENT_CLASS
|
2019-10-01 19:50:34 +00:00
|
|
|
|
2020-04-14 18:36:28 +00:00
|
|
|
dnl # Parallel ZFS_LINUX_TEST_SRC / ZFS_LINUX_TEST_RESULT tests
|
|
|
|
ZFS_AC_KERNEL_TEST_SRC
|
|
|
|
ZFS_AC_KERNEL_TEST_RESULT
|
2019-10-01 19:50:34 +00:00
|
|
|
|
2020-04-14 18:36:28 +00:00
|
|
|
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
|
|
|
|
KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
|
|
|
|
])
|
2019-10-01 19:50:34 +00:00
|
|
|
|
2020-04-14 18:36:28 +00:00
|
|
|
AC_SUBST(KERNEL_MAKE)
|
|
|
|
])
|
2019-10-01 19:50:34 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Generate and compile all of the kernel API test cases to determine
|
|
|
|
dnl # which interfaces are available. By invoking the kernel build system
|
|
|
|
dnl # only once the compilation can be done in parallel significantly
|
|
|
|
dnl # speeding up the process.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
|
|
|
ZFS_AC_KERNEL_SRC_OBJTOOL
|
|
|
|
ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE
|
|
|
|
ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE
|
|
|
|
ZFS_AC_KERNEL_SRC_PDE_DATA
|
|
|
|
ZFS_AC_KERNEL_SRC_FALLOCATE
|
2022-09-08 17:29:41 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_FADVISE
|
|
|
|
ZFS_AC_KERNEL_SRC_GENERIC_FADVISE
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
|
|
|
|
ZFS_AC_KERNEL_SRC_RWSEM
|
|
|
|
ZFS_AC_KERNEL_SRC_SCHED
|
|
|
|
ZFS_AC_KERNEL_SRC_USLEEP_RANGE
|
|
|
|
ZFS_AC_KERNEL_SRC_KMEM_CACHE
|
2019-07-21 17:34:07 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_KVMALLOC
|
2020-06-08 23:32:02 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_WAIT
|
|
|
|
ZFS_AC_KERNEL_SRC_INODE_TIMES
|
|
|
|
ZFS_AC_KERNEL_SRC_INODE_LOCK
|
|
|
|
ZFS_AC_KERNEL_SRC_GROUP_INFO_GID
|
|
|
|
ZFS_AC_KERNEL_SRC_RW
|
|
|
|
ZFS_AC_KERNEL_SRC_TIMER_SETUP
|
|
|
|
ZFS_AC_KERNEL_SRC_SUPER_USER_NS
|
2020-02-06 18:30:41 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_PROC_OPERATIONS
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS
|
2019-11-12 16:59:06 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_BIO
|
|
|
|
ZFS_AC_KERNEL_SRC_BLKDEV
|
|
|
|
ZFS_AC_KERNEL_SRC_BLK_QUEUE
|
2022-04-19 17:38:04 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_GENHD_FLAGS
|
2020-12-22 21:53:25 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_REVALIDATE_DISK
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_GET_DISK_RO
|
|
|
|
ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL
|
|
|
|
ZFS_AC_KERNEL_SRC_DISCARD_GRANULARITY
|
|
|
|
ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE
|
|
|
|
ZFS_AC_KERNEL_SRC_XATTR
|
|
|
|
ZFS_AC_KERNEL_SRC_ACL
|
|
|
|
ZFS_AC_KERNEL_SRC_INODE_GETATTR
|
|
|
|
ZFS_AC_KERNEL_SRC_INODE_SET_FLAGS
|
|
|
|
ZFS_AC_KERNEL_SRC_INODE_SET_IVERSION
|
|
|
|
ZFS_AC_KERNEL_SRC_SHOW_OPTIONS
|
|
|
|
ZFS_AC_KERNEL_SRC_FILE_INODE
|
|
|
|
ZFS_AC_KERNEL_SRC_FILE_DENTRY
|
|
|
|
ZFS_AC_KERNEL_SRC_FSYNC
|
|
|
|
ZFS_AC_KERNEL_SRC_AIO_FSYNC
|
|
|
|
ZFS_AC_KERNEL_SRC_EVICT_INODE
|
|
|
|
ZFS_AC_KERNEL_SRC_DIRTY_INODE
|
|
|
|
ZFS_AC_KERNEL_SRC_SHRINKER
|
2021-03-20 04:00:59 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_MKDIR
|
2019-11-12 16:59:06 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS
|
2021-03-20 04:00:59 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_CREATE
|
2022-04-01 16:53:54 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_PERMISSION
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_GET_LINK
|
|
|
|
ZFS_AC_KERNEL_SRC_PUT_LINK
|
|
|
|
ZFS_AC_KERNEL_SRC_TMPFILE
|
|
|
|
ZFS_AC_KERNEL_SRC_AUTOMOUNT
|
|
|
|
ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE
|
|
|
|
ZFS_AC_KERNEL_SRC_COMMIT_METADATA
|
|
|
|
ZFS_AC_KERNEL_SRC_CLEAR_INODE
|
|
|
|
ZFS_AC_KERNEL_SRC_SETATTR_PREPARE
|
|
|
|
ZFS_AC_KERNEL_SRC_INSERT_INODE_LOCKED
|
|
|
|
ZFS_AC_KERNEL_SRC_DENTRY
|
2019-12-05 00:52:27 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_DENTRY_ALIAS_D_U
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_TRUNCATE_SETSIZE
|
|
|
|
ZFS_AC_KERNEL_SRC_SECURITY_INODE
|
|
|
|
ZFS_AC_KERNEL_SRC_FST_MOUNT
|
|
|
|
ZFS_AC_KERNEL_SRC_BDI
|
|
|
|
ZFS_AC_KERNEL_SRC_SET_NLINK
|
|
|
|
ZFS_AC_KERNEL_SRC_SGET
|
|
|
|
ZFS_AC_KERNEL_SRC_LSEEK_EXECUTE
|
2022-04-27 19:54:17 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_VFS_FILEMAP_DIRTY_FOLIO
|
2022-05-27 20:44:43 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_VFS_READ_FOLIO
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_VFS_GETATTR
|
|
|
|
ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS
|
|
|
|
ZFS_AC_KERNEL_SRC_VFS_ITERATE
|
|
|
|
ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO
|
2022-05-31 23:42:49 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_VFS_READPAGES
|
|
|
|
ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE
|
|
|
|
ZFS_AC_KERNEL_SRC_VFS_GENERIC_WRITE_CHECKS
|
2020-12-18 16:48:26 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_VFS_IOV_ITER
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_KMAP_ATOMIC_ARGS
|
|
|
|
ZFS_AC_KERNEL_SRC_FOLLOW_DOWN_ONE
|
|
|
|
ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN
|
|
|
|
ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT
|
|
|
|
ZFS_AC_KERNEL_SRC_FPU
|
|
|
|
ZFS_AC_KERNEL_SRC_FMODE_T
|
|
|
|
ZFS_AC_KERNEL_SRC_KUIDGID_T
|
|
|
|
ZFS_AC_KERNEL_SRC_KUID_HELPERS
|
2021-03-20 04:00:59 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_RENAME
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_CURRENT_TIME
|
|
|
|
ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES
|
|
|
|
ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL
|
2020-02-26 20:42:33 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_KTIME
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_TOTALRAM_PAGES_FUNC
|
|
|
|
ZFS_AC_KERNEL_SRC_TOTALHIGH_PAGES
|
|
|
|
ZFS_AC_KERNEL_SRC_KSTRTOUL
|
2020-06-27 01:06:50 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_PERCPU
|
2020-12-10 22:09:23 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_CPU_HOTPLUG
|
2021-03-20 04:00:59 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS
|
|
|
|
ZFS_AC_KERNEL_SRC_MKNOD
|
|
|
|
ZFS_AC_KERNEL_SRC_SYMLINK
|
2021-03-20 05:33:42 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS
|
2021-04-15 20:34:35 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_SIGNAL_STOP
|
|
|
|
ZFS_AC_KERNEL_SRC_SIGINFO
|
2022-04-21 14:27:15 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_SYSFS
|
2021-04-15 20:34:35 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE
|
2021-09-08 19:59:43 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG
|
2021-11-16 05:10:35 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT
|
2022-01-14 10:08:33 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_ADD_DISK
|
2022-01-19 20:10:49 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_KTHREAD
|
2022-03-14 19:37:39 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_ZERO_PAGE
|
2022-04-26 17:52:40 +00:00
|
|
|
ZFS_AC_KERNEL_SRC___COPY_FROM_USER_INATOMIC
|
2021-02-21 16:19:43 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_USER_NS_COMMON_INUM
|
2022-10-19 18:17:09 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_IDMAP_MNT_API
|
2022-11-08 18:28:56 +00:00
|
|
|
ZFS_AC_KERNEL_SRC_IATTR_VFSID
|
2019-10-01 19:50:34 +00:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([for available kernel interfaces])
|
|
|
|
ZFS_LINUX_TEST_COMPILE_ALL([kabi])
|
|
|
|
AC_MSG_RESULT([done])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Check results of kernel interface tests.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
|
|
|
ZFS_AC_KERNEL_ACCESS_OK_TYPE
|
|
|
|
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE
|
2017-03-07 20:59:31 +00:00
|
|
|
ZFS_AC_KERNEL_OBJTOOL
|
2018-02-16 01:53:18 +00:00
|
|
|
ZFS_AC_KERNEL_PDE_DATA
|
|
|
|
ZFS_AC_KERNEL_FALLOCATE
|
2022-09-08 17:29:41 +00:00
|
|
|
ZFS_AC_KERNEL_FADVISE
|
|
|
|
ZFS_AC_KERNEL_GENERIC_FADVISE
|
2018-02-16 01:53:18 +00:00
|
|
|
ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_RWSEM
|
|
|
|
ZFS_AC_KERNEL_SCHED
|
2018-02-16 01:53:18 +00:00
|
|
|
ZFS_AC_KERNEL_USLEEP_RANGE
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_KMEM_CACHE
|
2019-07-21 17:34:07 +00:00
|
|
|
ZFS_AC_KERNEL_KVMALLOC
|
2020-06-08 23:32:02 +00:00
|
|
|
ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_WAIT
|
2018-06-20 04:51:18 +00:00
|
|
|
ZFS_AC_KERNEL_INODE_TIMES
|
2018-02-16 01:53:18 +00:00
|
|
|
ZFS_AC_KERNEL_INODE_LOCK
|
|
|
|
ZFS_AC_KERNEL_GROUP_INFO_GID
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_RW
|
2019-05-23 21:40:28 +00:00
|
|
|
ZFS_AC_KERNEL_TIMER_SETUP
|
2016-08-03 17:19:04 +00:00
|
|
|
ZFS_AC_KERNEL_SUPER_USER_NS
|
2020-02-06 18:30:41 +00:00
|
|
|
ZFS_AC_KERNEL_PROC_OPERATIONS
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS
|
2019-11-12 16:59:06 +00:00
|
|
|
ZFS_AC_KERNEL_BIO
|
|
|
|
ZFS_AC_KERNEL_BLKDEV
|
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE
|
2022-04-19 17:38:04 +00:00
|
|
|
ZFS_AC_KERNEL_GENHD_FLAGS
|
2020-12-22 21:53:25 +00:00
|
|
|
ZFS_AC_KERNEL_REVALIDATE_DISK
|
2010-08-26 18:22:58 +00:00
|
|
|
ZFS_AC_KERNEL_GET_DISK_RO
|
2016-12-30 22:03:59 +00:00
|
|
|
ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL
|
2012-08-01 08:29:59 +00:00
|
|
|
ZFS_AC_KERNEL_DISCARD_GRANULARITY
|
2013-10-28 16:22:15 +00:00
|
|
|
ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_XATTR
|
|
|
|
ZFS_AC_KERNEL_ACL
|
|
|
|
ZFS_AC_KERNEL_INODE_GETATTR
|
2016-12-16 21:54:51 +00:00
|
|
|
ZFS_AC_KERNEL_INODE_SET_FLAGS
|
2018-02-08 22:27:59 +00:00
|
|
|
ZFS_AC_KERNEL_INODE_SET_IVERSION
|
2012-02-02 19:55:48 +00:00
|
|
|
ZFS_AC_KERNEL_SHOW_OPTIONS
|
2015-02-07 12:41:01 +00:00
|
|
|
ZFS_AC_KERNEL_FILE_INODE
|
2016-08-04 15:57:35 +00:00
|
|
|
ZFS_AC_KERNEL_FILE_DENTRY
|
2011-11-10 04:47:59 +00:00
|
|
|
ZFS_AC_KERNEL_FSYNC
|
2016-11-15 17:20:46 +00:00
|
|
|
ZFS_AC_KERNEL_AIO_FSYNC
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_EVICT_INODE
|
|
|
|
ZFS_AC_KERNEL_DIRTY_INODE
|
|
|
|
ZFS_AC_KERNEL_SHRINKER
|
2021-03-20 04:00:59 +00:00
|
|
|
ZFS_AC_KERNEL_MKDIR
|
2019-11-12 16:59:06 +00:00
|
|
|
ZFS_AC_KERNEL_LOOKUP_FLAGS
|
2021-03-20 04:00:59 +00:00
|
|
|
ZFS_AC_KERNEL_CREATE
|
2022-04-01 16:53:54 +00:00
|
|
|
ZFS_AC_KERNEL_PERMISSION
|
2016-01-14 18:25:10 +00:00
|
|
|
ZFS_AC_KERNEL_GET_LINK
|
2015-07-15 17:54:26 +00:00
|
|
|
ZFS_AC_KERNEL_PUT_LINK
|
2016-01-26 20:29:46 +00:00
|
|
|
ZFS_AC_KERNEL_TMPFILE
|
2011-11-11 07:15:53 +00:00
|
|
|
ZFS_AC_KERNEL_AUTOMOUNT
|
2012-07-23 17:55:48 +00:00
|
|
|
ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE
|
2012-09-16 06:03:04 +00:00
|
|
|
ZFS_AC_KERNEL_COMMIT_METADATA
|
2012-07-23 18:39:25 +00:00
|
|
|
ZFS_AC_KERNEL_CLEAR_INODE
|
2016-10-18 23:49:23 +00:00
|
|
|
ZFS_AC_KERNEL_SETATTR_PREPARE
|
2011-03-22 16:55:09 +00:00
|
|
|
ZFS_AC_KERNEL_INSERT_INODE_LOCKED
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_DENTRY
|
2019-12-05 00:52:27 +00:00
|
|
|
ZFS_AC_KERNEL_DENTRY_ALIAS_D_U
|
2011-06-25 12:30:29 +00:00
|
|
|
ZFS_AC_KERNEL_TRUNCATE_SETSIZE
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SECURITY_INODE
|
2018-04-12 19:24:38 +00:00
|
|
|
ZFS_AC_KERNEL_FST_MOUNT
|
2017-05-02 16:46:18 +00:00
|
|
|
ZFS_AC_KERNEL_BDI
|
2011-12-16 21:15:12 +00:00
|
|
|
ZFS_AC_KERNEL_SET_NLINK
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_SGET
|
2013-06-13 17:51:09 +00:00
|
|
|
ZFS_AC_KERNEL_LSEEK_EXECUTE
|
2022-04-27 19:54:17 +00:00
|
|
|
ZFS_AC_KERNEL_VFS_FILEMAP_DIRTY_FOLIO
|
2022-05-27 20:44:43 +00:00
|
|
|
ZFS_AC_KERNEL_VFS_READ_FOLIO
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_VFS_GETATTR
|
|
|
|
ZFS_AC_KERNEL_VFS_FSYNC_2ARGS
|
2013-08-07 12:53:45 +00:00
|
|
|
ZFS_AC_KERNEL_VFS_ITERATE
|
2018-08-27 17:04:21 +00:00
|
|
|
ZFS_AC_KERNEL_VFS_DIRECT_IO
|
2022-05-31 23:42:49 +00:00
|
|
|
ZFS_AC_KERNEL_VFS_READPAGES
|
|
|
|
ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_VFS_RW_ITERATE
|
|
|
|
ZFS_AC_KERNEL_VFS_GENERIC_WRITE_CHECKS
|
2020-12-18 16:48:26 +00:00
|
|
|
ZFS_AC_KERNEL_VFS_IOV_ITER
|
2015-05-11 14:22:56 +00:00
|
|
|
ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS
|
2015-04-24 23:21:13 +00:00
|
|
|
ZFS_AC_KERNEL_FOLLOW_DOWN_ONE
|
zvol processing should use struct bio
Internally, zvols are files exposed through the block device API. This
is intended to reduce overhead when things require block devices.
However, the ZoL zvol code emulates a traditional block device in that
it has a top half and a bottom half. This is an unnecessary source of
overhead that does not exist on any other OpenZFS platform does this.
This patch removes it. Early users of this patch reported double digit
performance gains in IOPS on zvols in the range of 50% to 80%.
Comments in the code suggest that the current implementation was done to
obtain IO merging from Linux's IO elevator. However, the DMU already
does write merging while arc_read() should implicitly merge read IOs
because only 1 thread is permitted to fetch the buffer into ARC. In
addition, commercial ZFSOnLinux distributions report that regular files
are more performant than zvols under the current implementation, and the
main consumers of zvols are VMs and iSCSI targets, which have their own
elevators to merge IOs.
Some minor refactoring allows us to register zfs_request() as our
->make_request() handler in place of the generic_make_request()
function. This eliminates the layer of code that broke IO requests on
zvols into a top half and a bottom half. This has several benefits:
1. No per zvol spinlocks.
2. No redundant IO elevator processing.
3. Interrupts are disabled only when actually necessary.
4. No redispatching of IOs when all taskq threads are busy.
5. Linux's page out routines will properly block.
6. Many autotools checks become obsolete.
An unfortunate consequence of eliminating the layer that
generic_make_request() is that we no longer calls the instrumentation
hooks for block IO accounting. Those hooks are GPL-exported, so we
cannot call them ourselves and consequently, we lose the ability to do
IO monitoring via iostat. Since zvols are internally files mapped as
block devices, this should be okay. Anyone who is willing to accept the
performance penalty for the block IO layer's accounting could use the
loop device in between the zvol and its consumer. Alternatively, perf
and ftrace likely could be used. Also, tools like latencytop will still
work. Tools such as latencytop sometimes provide a better view of
performance bottlenecks than the traditional block IO accounting tools
do.
Lastly, if direct reclaim occurs during spacemap loading and swap is on
a zvol, this code will deadlock. That deadlock could already occur with
sync=always on zvols. Given that swap on zvols is not yet production
ready, this is not a blocker.
Signed-off-by: Richard Yao <ryao@gentoo.org>
2014-07-04 22:43:47 +00:00
|
|
|
ZFS_AC_KERNEL_MAKE_REQUEST_FN
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_GENERIC_IO_ACCT
|
Support for vectorized algorithms on x86
This is initial support for x86 vectorized implementations of ZFS parity
and checksum algorithms.
For the compilation phase, configure step checks if toolchain supports relevant
instruction sets. Each implementation must ensure that the code is not passed
to compiler if relevant instruction set is not supported. For this purpose,
following new defines are provided if instruction set is supported:
- HAVE_SSE,
- HAVE_SSE2,
- HAVE_SSE3,
- HAVE_SSSE3,
- HAVE_SSE4_1,
- HAVE_SSE4_2,
- HAVE_AVX,
- HAVE_AVX2.
For detecting if an instruction set can be used in runtime, following functions
are provided in (include/linux/simd_x86.h):
- zfs_sse_available()
- zfs_sse2_available()
- zfs_sse3_available()
- zfs_ssse3_available()
- zfs_sse4_1_available()
- zfs_sse4_2_available()
- zfs_avx_available()
- zfs_avx2_available()
- zfs_bmi1_available()
- zfs_bmi2_available()
These function should be called once, on module load, or initialization.
They are safe to use from user and kernel space.
If an implementation is using more than single instruction set, both compiler
and runtime support for all relevant instruction sets should be checked.
Kernel fpu methods:
- kfpu_begin()
- kfpu_end()
Use __get_cpuid_max and __cpuid_count from <cpuid.h>
Both gcc and clang have support for these. They also handle ebx register
in case it is used for PIC code.
Signed-off-by: Gvozden Neskovic <neskovic@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Closes #4381
2016-02-29 18:42:27 +00:00
|
|
|
ZFS_AC_KERNEL_FPU
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_AC_KERNEL_FMODE_T
|
|
|
|
ZFS_AC_KERNEL_KUIDGID_T
|
2016-05-30 17:37:36 +00:00
|
|
|
ZFS_AC_KERNEL_KUID_HELPERS
|
2021-03-20 04:00:59 +00:00
|
|
|
ZFS_AC_KERNEL_RENAME
|
2017-05-10 16:30:48 +00:00
|
|
|
ZFS_AC_KERNEL_CURRENT_TIME
|
2018-03-07 23:40:42 +00:00
|
|
|
ZFS_AC_KERNEL_USERNS_CAPABILITIES
|
2018-09-25 00:11:25 +00:00
|
|
|
ZFS_AC_KERNEL_IN_COMPAT_SYSCALL
|
2020-02-26 20:42:33 +00:00
|
|
|
ZFS_AC_KERNEL_KTIME
|
2019-01-10 22:28:10 +00:00
|
|
|
ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC
|
2019-05-04 23:40:48 +00:00
|
|
|
ZFS_AC_KERNEL_TOTALHIGH_PAGES
|
2019-05-24 19:26:18 +00:00
|
|
|
ZFS_AC_KERNEL_KSTRTOUL
|
2020-06-27 01:06:50 +00:00
|
|
|
ZFS_AC_KERNEL_PERCPU
|
2020-12-10 22:09:23 +00:00
|
|
|
ZFS_AC_KERNEL_CPU_HOTPLUG
|
2021-03-20 04:00:59 +00:00
|
|
|
ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS
|
|
|
|
ZFS_AC_KERNEL_MKNOD
|
|
|
|
ZFS_AC_KERNEL_SYMLINK
|
2021-03-20 05:33:42 +00:00
|
|
|
ZFS_AC_KERNEL_BIO_MAX_SEGS
|
2021-04-15 20:34:35 +00:00
|
|
|
ZFS_AC_KERNEL_SIGNAL_STOP
|
|
|
|
ZFS_AC_KERNEL_SIGINFO
|
2022-04-21 14:27:15 +00:00
|
|
|
ZFS_AC_KERNEL_SYSFS
|
2021-04-15 20:34:35 +00:00
|
|
|
ZFS_AC_KERNEL_SET_SPECIAL_STATE
|
2021-09-08 19:59:43 +00:00
|
|
|
ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG
|
2021-11-16 05:10:35 +00:00
|
|
|
ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT
|
2022-01-14 10:08:33 +00:00
|
|
|
ZFS_AC_KERNEL_ADD_DISK
|
2022-01-19 20:10:49 +00:00
|
|
|
ZFS_AC_KERNEL_KTHREAD
|
2022-03-14 19:37:39 +00:00
|
|
|
ZFS_AC_KERNEL_ZERO_PAGE
|
2022-04-26 17:52:40 +00:00
|
|
|
ZFS_AC_KERNEL___COPY_FROM_USER_INATOMIC
|
2021-02-21 16:19:43 +00:00
|
|
|
ZFS_AC_KERNEL_USER_NS_COMMON_INUM
|
2022-10-19 18:17:09 +00:00
|
|
|
ZFS_AC_KERNEL_IDMAP_MNT_API
|
2022-11-08 18:28:56 +00:00
|
|
|
ZFS_AC_KERNEL_IATTR_VFSID
|
2010-08-26 18:22:58 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Detect name used for Module.symvers file in kernel
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_MODULE_SYMVERS], [
|
|
|
|
modpost=$LINUX/scripts/Makefile.modpost
|
|
|
|
AC_MSG_CHECKING([kernel file name for module symbols])
|
2012-07-17 08:36:43 +00:00
|
|
|
AS_IF([test "x$enable_linux_builtin" != xyes -a -f "$modpost"], [
|
2011-08-24 16:52:16 +00:00
|
|
|
AS_IF([grep -q Modules.symvers $modpost], [
|
2010-08-26 18:22:58 +00:00
|
|
|
LINUX_SYMBOLS=Modules.symvers
|
2011-08-24 16:52:16 +00:00
|
|
|
], [
|
2010-08-26 18:22:58 +00:00
|
|
|
LINUX_SYMBOLS=Module.symvers
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
2011-03-07 21:03:48 +00:00
|
|
|
|
2011-08-24 16:52:16 +00:00
|
|
|
AS_IF([test ! -f "$LINUX_OBJ/$LINUX_SYMBOLS"], [
|
2011-03-07 21:03:48 +00:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the kernel devel package for your distribution
|
2019-10-01 19:50:34 +00:00
|
|
|
*** is installed. If you are building with a custom kernel, make sure
|
|
|
|
*** the kernel is configured, built, and the '--with-linux=PATH'
|
|
|
|
*** configure option refers to the location of the kernel source.
|
|
|
|
])
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
|
|
|
], [
|
2010-08-26 18:22:58 +00:00
|
|
|
LINUX_SYMBOLS=NONE
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
AC_MSG_RESULT($LINUX_SYMBOLS)
|
|
|
|
AC_SUBST(LINUX_SYMBOLS)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Detect the kernel to be built against
|
|
|
|
dnl #
|
2022-02-16 23:17:16 +00:00
|
|
|
dnl # Most modern Linux distributions have separate locations for bare
|
|
|
|
dnl # source (source) and prebuilt (build) files. Additionally, there are
|
|
|
|
dnl # `source` and `build` symlinks in `/lib/modules/$(KERNEL_VERSION)`
|
|
|
|
dnl # pointing to them. The directory search order is now:
|
|
|
|
dnl #
|
|
|
|
dnl # - `configure` command line values if both `--with-linux` and
|
|
|
|
dnl # `--with-linux-obj` were defined
|
|
|
|
dnl #
|
|
|
|
dnl # - If only `--with-linux` was defined, `--with-linux-obj` is assumed
|
|
|
|
dnl # to have the same value as `--with-linux`
|
|
|
|
dnl #
|
|
|
|
dnl # - If neither `--with-linux` nor `--with-linux-obj` were defined
|
|
|
|
dnl # autodetection is used:
|
|
|
|
dnl #
|
|
|
|
dnl # - `/lib/modules/$(uname -r)/{source,build}` respectively, if exist.
|
|
|
|
dnl #
|
|
|
|
dnl # - If only `/lib/modules/$(uname -r)/build` exists, it is assumed
|
|
|
|
dnl # to be both source and build directory.
|
|
|
|
dnl #
|
|
|
|
dnl # - The first directory in `/lib/modules` with the highest version
|
|
|
|
dnl # number according to `sort -V` which contains both `source` and
|
|
|
|
dnl # `build` symlinks/directories. If module directory contains only
|
|
|
|
dnl # `build` component, it is assumed to be both source and build
|
|
|
|
dnl # directory.
|
|
|
|
dnl #
|
|
|
|
dnl # - Last resort: the first directory matching `/usr/src/kernels/*`
|
|
|
|
dnl # and `/usr/src/linux-*` with the highest version number according
|
|
|
|
dnl # to `sort -V` is assumed to be both source and build directory.
|
|
|
|
dnl #
|
2010-08-26 18:22:58 +00:00
|
|
|
AC_DEFUN([ZFS_AC_KERNEL], [
|
|
|
|
AC_ARG_WITH([linux],
|
|
|
|
AS_HELP_STRING([--with-linux=PATH],
|
|
|
|
[Path to kernel source]),
|
|
|
|
[kernelsrc="$withval"])
|
|
|
|
|
|
|
|
AC_ARG_WITH(linux-obj,
|
|
|
|
AS_HELP_STRING([--with-linux-obj=PATH],
|
|
|
|
[Path to kernel build objects]),
|
|
|
|
[kernelbuild="$withval"])
|
|
|
|
|
2022-02-16 23:17:16 +00:00
|
|
|
AC_MSG_CHECKING([kernel source and build directories])
|
|
|
|
AS_IF([test -n "$kernelsrc" && test -z "$kernelbuild"], [
|
|
|
|
kernelbuild="$kernelsrc"
|
|
|
|
], [test -z "$kernelsrc"], [
|
|
|
|
AS_IF([test -e "/lib/modules/$(uname -r)/source" && \
|
|
|
|
test -e "/lib/modules/$(uname -r)/build"], [
|
|
|
|
src="/lib/modules/$(uname -r)/source"
|
|
|
|
build="/lib/modules/$(uname -r)/build"
|
2011-08-24 16:52:16 +00:00
|
|
|
], [test -e "/lib/modules/$(uname -r)/build"], [
|
2022-02-16 23:17:16 +00:00
|
|
|
build="/lib/modules/$(uname -r)/build"
|
|
|
|
src="$build"
|
2011-08-24 16:52:16 +00:00
|
|
|
], [
|
2022-02-16 23:17:16 +00:00
|
|
|
src=
|
|
|
|
|
|
|
|
for d in $(ls -1d /lib/modules/* 2>/dev/null | sort -Vr); do
|
|
|
|
if test -e "$d/source" && test -e "$d/build"; then
|
|
|
|
src="$d/source"
|
|
|
|
build="$d/build"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -e "$d/build"; then
|
|
|
|
src="$d/build"
|
|
|
|
build="$d/build"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# the least reliable method
|
|
|
|
if test -z "$src"; then
|
|
|
|
src=$(ls -1d /usr/src/kernels/* /usr/src/linux-* \
|
|
|
|
2>/dev/null | grep -v obj | sort -Vr | head -1)
|
|
|
|
build="$src"
|
|
|
|
fi
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
|
2022-02-16 23:17:16 +00:00
|
|
|
AS_IF([test -n "$src" && test -e "$src"], [
|
|
|
|
kernelsrc=$(readlink -e "$src")
|
2011-08-24 16:52:16 +00:00
|
|
|
], [
|
2012-11-30 04:19:25 +00:00
|
|
|
kernelsrc="[Not found]"
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
2022-02-16 23:17:16 +00:00
|
|
|
AS_IF([test -n "$build" && test -e "$build"], [
|
|
|
|
kernelbuild=$(readlink -e "$build")
|
|
|
|
], [
|
|
|
|
kernelbuild="[Not found]"
|
|
|
|
])
|
2011-08-24 16:52:16 +00:00
|
|
|
], [
|
|
|
|
AS_IF([test "$kernelsrc" = "NONE"], [
|
2010-08-26 18:22:58 +00:00
|
|
|
kernsrcver=NONE
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
2017-05-24 23:02:04 +00:00
|
|
|
withlinux=yes
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
|
2022-02-16 23:17:16 +00:00
|
|
|
AC_MSG_RESULT([done])
|
|
|
|
AC_MSG_CHECKING([kernel source directory])
|
2010-08-26 18:22:58 +00:00
|
|
|
AC_MSG_RESULT([$kernelsrc])
|
2022-02-16 23:17:16 +00:00
|
|
|
AC_MSG_CHECKING([kernel build directory])
|
|
|
|
AC_MSG_RESULT([$kernelbuild])
|
|
|
|
AS_IF([test ! -d "$kernelsrc" || test ! -d "$kernelbuild"], [
|
2012-11-30 04:19:25 +00:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the kernel devel package for your distribution
|
2013-03-30 02:27:50 +00:00
|
|
|
*** is installed and then try again. If that fails, you can specify the
|
2022-02-16 23:17:16 +00:00
|
|
|
*** location of the kernel source and build with the '--with-linux=PATH' and
|
|
|
|
*** '--with-linux-obj=PATH' options respectively.])
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([kernel source version])
|
|
|
|
utsrelease1=$kernelbuild/include/linux/version.h
|
|
|
|
utsrelease2=$kernelbuild/include/linux/utsrelease.h
|
|
|
|
utsrelease3=$kernelbuild/include/generated/utsrelease.h
|
2022-03-11 23:26:46 +00:00
|
|
|
AS_IF([test -r $utsrelease1 && grep -qF UTS_RELEASE $utsrelease1], [
|
2021-01-03 00:55:55 +00:00
|
|
|
utsrelease=$utsrelease1
|
2022-03-11 23:26:46 +00:00
|
|
|
], [test -r $utsrelease2 && grep -qF UTS_RELEASE $utsrelease2], [
|
2021-01-03 00:55:55 +00:00
|
|
|
utsrelease=$utsrelease2
|
2022-03-11 23:26:46 +00:00
|
|
|
], [test -r $utsrelease3 && grep -qF UTS_RELEASE $utsrelease3], [
|
2021-01-03 00:55:55 +00:00
|
|
|
utsrelease=$utsrelease3
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
|
2021-01-03 00:55:55 +00:00
|
|
|
AS_IF([test -n "$utsrelease"], [
|
|
|
|
kernsrcver=$($AWK '/UTS_RELEASE/ { gsub(/"/, "", $[3]); print $[3] }' $utsrelease)
|
2011-08-24 16:52:16 +00:00
|
|
|
AS_IF([test -z "$kernsrcver"], [
|
2010-08-26 18:22:58 +00:00
|
|
|
AC_MSG_RESULT([Not found])
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Cannot determine kernel version.
|
|
|
|
])
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
|
|
|
], [
|
2010-08-26 18:22:58 +00:00
|
|
|
AC_MSG_RESULT([Not found])
|
2012-07-17 08:36:43 +00:00
|
|
|
if test "x$enable_linux_builtin" != xyes; then
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Cannot find UTS_RELEASE definition.
|
|
|
|
])
|
2012-07-17 08:36:43 +00:00
|
|
|
else
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Cannot find UTS_RELEASE definition.
|
|
|
|
*** Please run 'make prepare' inside the kernel source tree.])
|
|
|
|
fi
|
2011-08-24 16:52:16 +00:00
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$kernsrcver])
|
|
|
|
|
2019-11-12 16:59:06 +00:00
|
|
|
AS_VERSION_COMPARE([$kernsrcver], [$ZFS_META_KVER_MIN], [
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Cannot build against kernel version $kernsrcver.
|
|
|
|
*** The minimum supported kernel version is $ZFS_META_KVER_MIN.
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2010-08-26 18:22:58 +00:00
|
|
|
LINUX=${kernelsrc}
|
|
|
|
LINUX_OBJ=${kernelbuild}
|
|
|
|
LINUX_VERSION=${kernsrcver}
|
|
|
|
|
|
|
|
AC_SUBST(LINUX)
|
|
|
|
AC_SUBST(LINUX_OBJ)
|
|
|
|
AC_SUBST(LINUX_VERSION)
|
|
|
|
])
|
|
|
|
|
2017-03-23 00:58:47 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # Detect the QAT module to be built against, QAT provides hardware
|
|
|
|
dnl # acceleration for data compression:
|
|
|
|
dnl #
|
|
|
|
dnl # https://01.org/intel-quickassist-technology
|
|
|
|
dnl #
|
|
|
|
dnl # 1) Download and install QAT driver from the above link
|
|
|
|
dnl # 2) Start QAT driver in your system:
|
|
|
|
dnl # service qat_service start
|
|
|
|
dnl # 3) Enable QAT in ZFS, e.g.:
|
|
|
|
dnl # ./configure --with-qat=<qat-driver-path>/QAT1.6
|
|
|
|
dnl # make
|
|
|
|
dnl # 4) Set GZIP compression in ZFS dataset:
|
|
|
|
dnl # zfs set compression = gzip <dataset>
|
|
|
|
dnl #
|
|
|
|
dnl # Then the data written to this ZFS pool is compressed by QAT accelerator
|
|
|
|
dnl # automatically, and de-compressed by QAT when read from the pool.
|
|
|
|
dnl #
|
|
|
|
dnl # 1) Get QAT hardware statistics with:
|
|
|
|
dnl # cat /proc/icp_dh895xcc_dev/qat
|
|
|
|
dnl # 2) To disable QAT:
|
|
|
|
dnl # insmod zfs.ko zfs_qat_disable=1
|
2017-03-23 00:58:47 +00:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_QAT], [
|
|
|
|
AC_ARG_WITH([qat],
|
|
|
|
AS_HELP_STRING([--with-qat=PATH],
|
|
|
|
[Path to qat source]),
|
|
|
|
AS_IF([test "$withval" = "yes"],
|
|
|
|
AC_MSG_ERROR([--with-qat=PATH requires a PATH]),
|
|
|
|
[qatsrc="$withval"]))
|
|
|
|
|
|
|
|
AC_ARG_WITH([qat-obj],
|
|
|
|
AS_HELP_STRING([--with-qat-obj=PATH],
|
|
|
|
[Path to qat build objects]),
|
|
|
|
[qatbuild="$withval"])
|
|
|
|
|
|
|
|
AS_IF([test ! -z "${qatsrc}"], [
|
|
|
|
AC_MSG_CHECKING([qat source directory])
|
|
|
|
AC_MSG_RESULT([$qatsrc])
|
|
|
|
QAT_SRC="${qatsrc}/quickassist"
|
|
|
|
AS_IF([ test ! -e "$QAT_SRC/include/cpa.h"], [
|
|
|
|
AC_MSG_ERROR([
|
2019-10-01 19:50:34 +00:00
|
|
|
*** Please make sure the qat driver package is installed
|
|
|
|
*** and specify the location of the qat source with the
|
|
|
|
*** '--with-qat=PATH' option then try again. Failed to
|
|
|
|
*** find cpa.h in:
|
|
|
|
${QAT_SRC}/include])
|
2017-03-23 00:58:47 +00:00
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
AS_IF([test ! -z "${qatsrc}"], [
|
|
|
|
AC_MSG_CHECKING([qat build directory])
|
|
|
|
AS_IF([test -z "$qatbuild"], [
|
|
|
|
qatbuild="${qatsrc}/build"
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$qatbuild])
|
|
|
|
QAT_OBJ=${qatbuild}
|
2017-10-20 18:11:25 +00:00
|
|
|
AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"], [
|
2017-03-23 00:58:47 +00:00
|
|
|
AC_MSG_ERROR([
|
2019-10-01 19:50:34 +00:00
|
|
|
*** Please make sure the qat driver is installed then try again.
|
|
|
|
*** Failed to find icp_qa_al.ko or qat_api.ko in:
|
|
|
|
$QAT_OBJ])
|
2017-03-23 00:58:47 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_SUBST(QAT_SRC)
|
|
|
|
AC_SUBST(QAT_OBJ)
|
|
|
|
|
|
|
|
AC_DEFINE(HAVE_QAT, 1,
|
|
|
|
[qat is enabled and existed])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Detect the name used for the QAT Module.symvers file.
|
|
|
|
dnl #
|
|
|
|
AS_IF([test ! -z "${qatsrc}"], [
|
|
|
|
AC_MSG_CHECKING([qat file for module symbols])
|
|
|
|
QAT_SYMBOLS=$QAT_SRC/lookaside/access_layer/src/Module.symvers
|
|
|
|
|
|
|
|
AS_IF([test -r $QAT_SYMBOLS], [
|
|
|
|
AC_MSG_RESULT([$QAT_SYMBOLS])
|
|
|
|
AC_SUBST(QAT_SYMBOLS)
|
|
|
|
],[
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the qat driver is installed then try again.
|
|
|
|
*** Failed to find Module.symvers in:
|
|
|
|
$QAT_SYMBOLS
|
2017-03-23 00:58:47 +00:00
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2011-03-07 18:59:26 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_CONFTEST_H
|
2011-03-07 18:59:26 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_DEFUN([ZFS_LINUX_CONFTEST_H], [
|
|
|
|
test -d build/$2 || mkdir -p build/$2
|
|
|
|
cat - <<_ACEOF >build/$2/$2.h
|
|
|
|
$1
|
|
|
|
_ACEOF
|
|
|
|
])
|
2012-05-21 19:59:58 +00:00
|
|
|
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_CONFTEST_C
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_CONFTEST_C], [
|
|
|
|
test -d build/$2 || mkdir -p build/$2
|
|
|
|
cat confdefs.h - <<_ACEOF >build/$2/$2.c
|
|
|
|
$1
|
|
|
|
_ACEOF
|
2012-05-21 19:59:58 +00:00
|
|
|
])
|
|
|
|
|
2015-12-02 19:53:37 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_CONFTEST_MAKEFILE
|
2015-12-02 19:53:37 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # $1 - test case name
|
|
|
|
dnl # $2 - add to top-level Makefile
|
|
|
|
dnl # $3 - additional build flags
|
2015-12-02 19:53:37 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_DEFUN([ZFS_LINUX_CONFTEST_MAKEFILE], [
|
|
|
|
test -d build || mkdir -p build
|
|
|
|
test -d build/$1 || mkdir -p build/$1
|
|
|
|
|
|
|
|
file=build/$1/Makefile
|
|
|
|
|
|
|
|
dnl # Example command line to manually build source.
|
|
|
|
cat - <<_ACEOF >$file
|
|
|
|
# Example command line to manually build source
|
|
|
|
# make modules -C $LINUX_OBJ $ARCH_UM M=$PWD/build/$1
|
|
|
|
|
|
|
|
ccflags-y := -Werror $FRAME_LARGER_THAN
|
|
|
|
_ACEOF
|
|
|
|
|
|
|
|
dnl # Additional custom CFLAGS as requested.
|
|
|
|
m4_ifval($3, [echo "ccflags-y += $3" >>$file], [])
|
|
|
|
|
|
|
|
dnl # Test case source
|
|
|
|
echo "obj-m := $1.o" >>$file
|
|
|
|
|
|
|
|
AS_IF([test "x$2" = "xyes"], [echo "obj-m += $1/" >>build/Makefile], [])
|
2015-12-02 19:53:37 +00:00
|
|
|
])
|
|
|
|
|
2012-05-21 19:59:58 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_TEST_PROGRAM(C)([PROLOGUE], [BODY])
|
2012-05-21 19:59:58 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
m4_define([ZFS_LINUX_TEST_PROGRAM], [
|
2020-12-23 19:40:02 +00:00
|
|
|
#include <linux/module.h>
|
2019-10-01 19:50:34 +00:00
|
|
|
$1
|
2020-12-23 19:40:02 +00:00
|
|
|
|
2019-10-01 19:50:34 +00:00
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
$2
|
|
|
|
;
|
|
|
|
return 0;
|
|
|
|
}
|
2020-12-23 19:40:02 +00:00
|
|
|
|
|
|
|
MODULE_DESCRIPTION("conftest");
|
|
|
|
MODULE_AUTHOR(ZFS_META_AUTHOR);
|
|
|
|
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
|
|
|
MODULE_LICENSE($3);
|
2019-10-01 19:50:34 +00:00
|
|
|
])
|
|
|
|
|
2012-05-21 19:59:58 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_TEST_REMOVE
|
2012-05-21 19:59:58 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # Removes the specified test source and results.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TEST_REMOVE], [
|
|
|
|
test -d build/$1 && rm -Rf build/$1
|
|
|
|
test -f build/Makefile && sed '/$1/d' build/Makefile
|
|
|
|
])
|
2012-05-21 19:59:58 +00:00
|
|
|
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_COMPILE
|
|
|
|
dnl #
|
|
|
|
dnl # $1 - build dir
|
|
|
|
dnl # $2 - test command
|
|
|
|
dnl # $3 - pass command
|
|
|
|
dnl # $4 - fail command
|
|
|
|
dnl # $5 - set KBUILD_MODPOST_NOFINAL='yes'
|
|
|
|
dnl # $6 - set KBUILD_MODPOST_WARN='yes'
|
|
|
|
dnl #
|
|
|
|
dnl # Used internally by ZFS_LINUX_TEST_{COMPILE,MODPOST}
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_COMPILE], [
|
Add support for $KERNEL_{CC,LD,LLVM} variables
Currently, $(CC), $(LD), and $(LLVM) variables aren't passed to kbuild
while building modules. This causes modules to build with the default
GNU GCC toolchain and prevents experimenting with other toolchains such
as CLANG/LLVM. It can also lead to build failure if the CFLAGS/LDFLAGS
passed are incompatible with gcc/ld.
Pass $KERNEL_CC, $KERNEL_LD, and $KERNEL_LLVM as $(CC), $(LD), and
$(LLVM), respectively, to kbuild for each that is defined in the
environment. This should take care of the majority of alternative
toolchain use cases.
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Peter Levine <plevine457@gmail.com>
Closes #13046
2022-02-02 05:44:59 +00:00
|
|
|
AC_ARG_VAR([KERNEL_CC], [C compiler for
|
|
|
|
building kernel modules])
|
|
|
|
AC_ARG_VAR([KERNEL_LD], [Linker for
|
|
|
|
building kernel modules])
|
|
|
|
AC_ARG_VAR([KERNEL_LLVM], [Binary option to
|
|
|
|
build kernel modules with LLVM/CLANG toolchain])
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_TRY_COMMAND([
|
|
|
|
KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6"
|
2022-04-26 17:47:09 +00:00
|
|
|
make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC}
|
|
|
|
${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM}
|
|
|
|
CONFIG_MODULES=y CFLAGS_MODULE=-DCONFIG_MODULES
|
|
|
|
-C $LINUX_OBJ $ARCH_UM M=$PWD/$1 >$1/build.log 2>&1])
|
2019-10-01 19:50:34 +00:00
|
|
|
AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4])
|
2010-08-26 18:22:58 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_TEST_COMPILE
|
2018-02-16 01:53:18 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # Perform a full compile excluding the final modpost phase.
|
2018-02-16 01:53:18 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_DEFUN([ZFS_LINUX_TEST_COMPILE], [
|
|
|
|
ZFS_LINUX_COMPILE([$2], [test -f $2/build.log], [
|
|
|
|
mv $2/Makefile $2/Makefile.compile.$1
|
|
|
|
mv $2/build.log $2/build.log.$1
|
2018-02-16 01:53:18 +00:00
|
|
|
],[
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Unable to compile test source to determine kernel interfaces.])
|
|
|
|
], [yes], [])
|
2018-02-16 01:53:18 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_TEST_MODPOST
|
2010-08-26 18:22:58 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # Perform a full compile including the modpost phase. This may
|
|
|
|
dnl # be an incremental build if the objects have already been built.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TEST_MODPOST], [
|
|
|
|
ZFS_LINUX_COMPILE([$2], [test -f $2/build.log], [
|
|
|
|
mv $2/Makefile $2/Makefile.modpost.$1
|
|
|
|
cat $2/build.log >>build/build.log.$1
|
|
|
|
],[
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Unable to modpost test source to determine kernel interfaces.])
|
|
|
|
], [], [yes])
|
Swap DTRACE_PROBE* with Linux tracepoints
This patch leverages Linux tracepoints from within the ZFS on Linux
code base. It also refactors the debug code to bring it back in sync
with Illumos.
The information exported via tracepoints can be used for a variety of
reasons (e.g. debugging, tuning, general exploration/understanding,
etc). It is advantageous to use Linux tracepoints as the mechanism to
export this kind of information (as opposed to something else) for a
number of reasons:
* A number of external tools can make use of our tracepoints
"automatically" (e.g. perf, systemtap)
* Tracepoints are designed to be extremely cheap when disabled
* It's one of the "accepted" ways to export this kind of
information; many other kernel subsystems use tracepoints too.
Unfortunately, though, there are a few caveats as well:
* Linux tracepoints appear to only be available to GPL licensed
modules due to the way certain kernel functions are exported.
Thus, to actually make use of the tracepoints introduced by this
patch, one might have to patch and re-compile the kernel;
exporting the necessary functions to non-GPL modules.
* Prior to upstream kernel version v3.14-rc6-30-g66cc69e, Linux
tracepoints are not available for unsigned kernel modules
(tracepoints will get disabled due to the module's 'F' taint).
Thus, one either has to sign the zfs kernel module prior to
loading it, or use a kernel versioned v3.14-rc6-30-g66cc69e or
newer.
Assuming the above two requirements are satisfied, lets look at an
example of how this patch can be used and what information it exposes
(all commands run as 'root'):
# list all zfs tracepoints available
$ ls /sys/kernel/debug/tracing/events/zfs
enable filter zfs_arc__delete
zfs_arc__evict zfs_arc__hit zfs_arc__miss
zfs_l2arc__evict zfs_l2arc__hit zfs_l2arc__iodone
zfs_l2arc__miss zfs_l2arc__read zfs_l2arc__write
zfs_new_state__mfu zfs_new_state__mru
# enable all zfs tracepoints, clear the tracepoint ring buffer
$ echo 1 > /sys/kernel/debug/tracing/events/zfs/enable
$ echo 0 > /sys/kernel/debug/tracing/trace
# import zpool called 'tank', inspect tracepoint data (each line was
# truncated, they're too long for a commit message otherwise)
$ zpool import tank
$ cat /sys/kernel/debug/tracing/trace | head -n35
# tracer: nop
#
# entries-in-buffer/entries-written: 1219/1219 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
lt-zpool-30132 [003] .... 91344.200050: zfs_arc__miss: hdr...
z_rd_int/0-30156 [003] .... 91344.200611: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.201173: zfs_arc__miss: hdr...
z_rd_int/1-30157 [003] .... 91344.201756: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.201795: zfs_arc__miss: hdr...
z_rd_int/2-30158 [003] .... 91344.202099: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202126: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202130: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202134: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202146: zfs_arc__miss: hdr...
z_rd_int/3-30159 [003] .... 91344.202457: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202484: zfs_arc__miss: hdr...
z_rd_int/4-30160 [003] .... 91344.202866: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202891: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.203034: zfs_arc__miss: hdr...
z_rd_iss/1-30149 [001] .... 91344.203749: zfs_new_state__mru...
lt-zpool-30132 [001] .... 91344.203789: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.203878: zfs_arc__miss: hdr...
z_rd_iss/3-30151 [001] .... 91344.204315: zfs_new_state__mru...
lt-zpool-30132 [001] .... 91344.204332: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204337: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204352: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204356: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204360: zfs_arc__hit: hdr ...
To highlight the kind of detailed information that is being exported
using this infrastructure, I've taken the first tracepoint line from the
output above and reformatted it such that it fits in 80 columns:
lt-zpool-30132 [003] .... 91344.200050: zfs_arc__miss:
hdr {
dva 0x1:0x40082
birth 15491
cksum0 0x163edbff3a
flags 0x640
datacnt 1
type 1
size 2048
spa 3133524293419867460
state_type 0
access 0
mru_hits 0
mru_ghost_hits 0
mfu_hits 0
mfu_ghost_hits 0
l2_hits 0
refcount 1
} bp {
dva0 0x1:0x40082
dva1 0x1:0x3000e5
dva2 0x1:0x5a006e
cksum 0x163edbff3a:0x75af30b3dd6:0x1499263ff5f2b:0x288bd118815e00
lsize 2048
} zb {
objset 0
object 0
level -1
blkid 0
}
For the specific tracepoint shown here, 'zfs_arc__miss', data is
exported detailing the arc_buf_hdr_t (hdr), blkptr_t (bp), and
zbookmark_t (zb) that caused the ARC miss (down to the exact DVA!).
This kind of precise and detailed information can be extremely valuable
when trying to answer certain kinds of questions.
For anybody unfamiliar but looking to build on this, I found the XFS
source code along with the following three web links to be extremely
helpful:
* http://lwn.net/Articles/379903/
* http://lwn.net/Articles/381064/
* http://lwn.net/Articles/383362/
I should also node the more "boring" aspects of this patch:
* The ZFS_LINUX_COMPILE_IFELSE autoconf macro was modified to
support a sixth paramter. This parameter is used to populate the
contents of the new conftest.h file. If no sixth parameter is
provided, conftest.h will be empty.
* The ZFS_LINUX_TRY_COMPILE_HEADER autoconf macro was introduced.
This macro is nearly identical to the ZFS_LINUX_TRY_COMPILE macro,
except it has support for a fifth option that is then passed as
the sixth parameter to ZFS_LINUX_COMPILE_IFELSE.
These autoconf changes were needed to test the availability of the Linux
tracepoint macros. Due to the odd nature of the Linux tracepoint macro
API, a separate ".h" must be created (the path and filename is used
internally by the kernel's define_trace.h file).
* The HAVE_DECLARE_EVENT_CLASS autoconf macro was introduced. This
is to determine if we can safely enable the Linux tracepoint
functionality. We need to selectively disable the tracepoint code
due to the kernel exporting certain functions as GPL only. Without
this check, the build process will fail at link time.
In addition, the SET_ERROR macro was modified into a tracepoint as well.
To do this, the 'sdt.h' file was moved into the 'include/sys' directory
and now contains a userspace portion and a kernel space portion. The
dprintf and zfs_dbgmsg* interfaces are now implemented as tracepoint as
well.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2014-06-13 17:54:48 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # Perform the compilation of the test cases in two phases.
|
Swap DTRACE_PROBE* with Linux tracepoints
This patch leverages Linux tracepoints from within the ZFS on Linux
code base. It also refactors the debug code to bring it back in sync
with Illumos.
The information exported via tracepoints can be used for a variety of
reasons (e.g. debugging, tuning, general exploration/understanding,
etc). It is advantageous to use Linux tracepoints as the mechanism to
export this kind of information (as opposed to something else) for a
number of reasons:
* A number of external tools can make use of our tracepoints
"automatically" (e.g. perf, systemtap)
* Tracepoints are designed to be extremely cheap when disabled
* It's one of the "accepted" ways to export this kind of
information; many other kernel subsystems use tracepoints too.
Unfortunately, though, there are a few caveats as well:
* Linux tracepoints appear to only be available to GPL licensed
modules due to the way certain kernel functions are exported.
Thus, to actually make use of the tracepoints introduced by this
patch, one might have to patch and re-compile the kernel;
exporting the necessary functions to non-GPL modules.
* Prior to upstream kernel version v3.14-rc6-30-g66cc69e, Linux
tracepoints are not available for unsigned kernel modules
(tracepoints will get disabled due to the module's 'F' taint).
Thus, one either has to sign the zfs kernel module prior to
loading it, or use a kernel versioned v3.14-rc6-30-g66cc69e or
newer.
Assuming the above two requirements are satisfied, lets look at an
example of how this patch can be used and what information it exposes
(all commands run as 'root'):
# list all zfs tracepoints available
$ ls /sys/kernel/debug/tracing/events/zfs
enable filter zfs_arc__delete
zfs_arc__evict zfs_arc__hit zfs_arc__miss
zfs_l2arc__evict zfs_l2arc__hit zfs_l2arc__iodone
zfs_l2arc__miss zfs_l2arc__read zfs_l2arc__write
zfs_new_state__mfu zfs_new_state__mru
# enable all zfs tracepoints, clear the tracepoint ring buffer
$ echo 1 > /sys/kernel/debug/tracing/events/zfs/enable
$ echo 0 > /sys/kernel/debug/tracing/trace
# import zpool called 'tank', inspect tracepoint data (each line was
# truncated, they're too long for a commit message otherwise)
$ zpool import tank
$ cat /sys/kernel/debug/tracing/trace | head -n35
# tracer: nop
#
# entries-in-buffer/entries-written: 1219/1219 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
lt-zpool-30132 [003] .... 91344.200050: zfs_arc__miss: hdr...
z_rd_int/0-30156 [003] .... 91344.200611: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.201173: zfs_arc__miss: hdr...
z_rd_int/1-30157 [003] .... 91344.201756: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.201795: zfs_arc__miss: hdr...
z_rd_int/2-30158 [003] .... 91344.202099: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202126: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202130: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202134: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202146: zfs_arc__miss: hdr...
z_rd_int/3-30159 [003] .... 91344.202457: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202484: zfs_arc__miss: hdr...
z_rd_int/4-30160 [003] .... 91344.202866: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202891: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.203034: zfs_arc__miss: hdr...
z_rd_iss/1-30149 [001] .... 91344.203749: zfs_new_state__mru...
lt-zpool-30132 [001] .... 91344.203789: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.203878: zfs_arc__miss: hdr...
z_rd_iss/3-30151 [001] .... 91344.204315: zfs_new_state__mru...
lt-zpool-30132 [001] .... 91344.204332: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204337: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204352: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204356: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204360: zfs_arc__hit: hdr ...
To highlight the kind of detailed information that is being exported
using this infrastructure, I've taken the first tracepoint line from the
output above and reformatted it such that it fits in 80 columns:
lt-zpool-30132 [003] .... 91344.200050: zfs_arc__miss:
hdr {
dva 0x1:0x40082
birth 15491
cksum0 0x163edbff3a
flags 0x640
datacnt 1
type 1
size 2048
spa 3133524293419867460
state_type 0
access 0
mru_hits 0
mru_ghost_hits 0
mfu_hits 0
mfu_ghost_hits 0
l2_hits 0
refcount 1
} bp {
dva0 0x1:0x40082
dva1 0x1:0x3000e5
dva2 0x1:0x5a006e
cksum 0x163edbff3a:0x75af30b3dd6:0x1499263ff5f2b:0x288bd118815e00
lsize 2048
} zb {
objset 0
object 0
level -1
blkid 0
}
For the specific tracepoint shown here, 'zfs_arc__miss', data is
exported detailing the arc_buf_hdr_t (hdr), blkptr_t (bp), and
zbookmark_t (zb) that caused the ARC miss (down to the exact DVA!).
This kind of precise and detailed information can be extremely valuable
when trying to answer certain kinds of questions.
For anybody unfamiliar but looking to build on this, I found the XFS
source code along with the following three web links to be extremely
helpful:
* http://lwn.net/Articles/379903/
* http://lwn.net/Articles/381064/
* http://lwn.net/Articles/383362/
I should also node the more "boring" aspects of this patch:
* The ZFS_LINUX_COMPILE_IFELSE autoconf macro was modified to
support a sixth paramter. This parameter is used to populate the
contents of the new conftest.h file. If no sixth parameter is
provided, conftest.h will be empty.
* The ZFS_LINUX_TRY_COMPILE_HEADER autoconf macro was introduced.
This macro is nearly identical to the ZFS_LINUX_TRY_COMPILE macro,
except it has support for a fifth option that is then passed as
the sixth parameter to ZFS_LINUX_COMPILE_IFELSE.
These autoconf changes were needed to test the availability of the Linux
tracepoint macros. Due to the odd nature of the Linux tracepoint macro
API, a separate ".h" must be created (the path and filename is used
internally by the kernel's define_trace.h file).
* The HAVE_DECLARE_EVENT_CLASS autoconf macro was introduced. This
is to determine if we can safely enable the Linux tracepoint
functionality. We need to selectively disable the tracepoint code
due to the kernel exporting certain functions as GPL only. Without
this check, the build process will fail at link time.
In addition, the SET_ERROR macro was modified into a tracepoint as well.
To do this, the 'sdt.h' file was moved into the 'include/sys' directory
and now contains a userspace portion and a kernel space portion. The
dprintf and zfs_dbgmsg* interfaces are now implemented as tracepoint as
well.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2014-06-13 17:54:48 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # Phase 1) attempt to build the object files for all of the tests
|
|
|
|
dnl # defined by the ZFS_LINUX_TEST_SRC macro. But do not
|
|
|
|
dnl # perform the final modpost stage.
|
|
|
|
dnl #
|
|
|
|
dnl # Phase 2) disable all tests which failed the initial compilation,
|
|
|
|
dnl # then invoke the final modpost step for the remaining tests.
|
|
|
|
dnl #
|
|
|
|
dnl # This allows us efficiently build the test cases in parallel while
|
|
|
|
dnl # remaining resilient to build failures which are expected when
|
|
|
|
dnl # detecting the available kernel interfaces.
|
|
|
|
dnl #
|
|
|
|
dnl # The maximum allowed parallelism can be controlled by setting the
|
|
|
|
dnl # TEST_JOBS environment variable. Otherwise, it default to $(nproc).
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TEST_COMPILE_ALL], [
|
|
|
|
dnl # Phase 1 - Compilation only, final linking is skipped.
|
|
|
|
ZFS_LINUX_TEST_COMPILE([$1], [build])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Phase 2 - When building external modules disable test cases
|
|
|
|
dnl # which failed to compile and invoke modpost to verify the
|
|
|
|
dnl # final linking.
|
|
|
|
dnl #
|
|
|
|
dnl # Test names suffixed with '_license' call modpost independently
|
|
|
|
dnl # to ensure that a single incompatibility does not result in the
|
|
|
|
dnl # modpost phase exiting early. This check is not performed on
|
|
|
|
dnl # every symbol since the majority are compatible and doing so
|
|
|
|
dnl # would significantly slow down this phase.
|
|
|
|
dnl #
|
|
|
|
dnl # When configuring for builtin (--enable-linux-builtin)
|
|
|
|
dnl # fake the linking step artificially create the expected .ko
|
|
|
|
dnl # files for tests which did compile. This is required for
|
|
|
|
dnl # kernels which do not have loadable module support or have
|
|
|
|
dnl # not yet been built.
|
|
|
|
dnl #
|
|
|
|
AS_IF([test "x$enable_linux_builtin" = "xno"], [
|
|
|
|
for dir in $(awk '/^obj-m/ { print [$]3 }' \
|
|
|
|
build/Makefile.compile.$1); do
|
|
|
|
name=${dir%/}
|
|
|
|
AS_IF([test -f build/$name/$name.o], [
|
|
|
|
AS_IF([test "${name##*_}" = "license"], [
|
|
|
|
ZFS_LINUX_TEST_MODPOST([$1],
|
|
|
|
[build/$name])
|
|
|
|
echo "obj-n += $dir" >>build/Makefile
|
|
|
|
], [
|
|
|
|
echo "obj-m += $dir" >>build/Makefile
|
|
|
|
])
|
|
|
|
], [
|
|
|
|
echo "obj-n += $dir" >>build/Makefile
|
|
|
|
])
|
|
|
|
done
|
|
|
|
|
|
|
|
ZFS_LINUX_TEST_MODPOST([$1], [build])
|
|
|
|
], [
|
|
|
|
for dir in $(awk '/^obj-m/ { print [$]3 }' \
|
|
|
|
build/Makefile.compile.$1); do
|
|
|
|
name=${dir%/}
|
|
|
|
AS_IF([test -f build/$name/$name.o], [
|
|
|
|
touch build/$name/$name.ko
|
|
|
|
])
|
|
|
|
done
|
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_TEST_SRC
|
2010-08-26 18:22:58 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # $1 - name
|
|
|
|
dnl # $2 - global
|
|
|
|
dnl # $3 - source
|
|
|
|
dnl # $4 - extra cflags
|
|
|
|
dnl # $5 - check license-compatibility
|
|
|
|
dnl #
|
2020-12-23 19:40:02 +00:00
|
|
|
dnl # Check if the test source is buildable at all and then if it is
|
|
|
|
dnl # license compatible.
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # N.B because all of the test cases are compiled in parallel they
|
|
|
|
dnl # must never depend on the results of previous tests. Each test
|
|
|
|
dnl # needs to be entirely independent.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TEST_SRC], [
|
2020-12-23 19:40:02 +00:00
|
|
|
ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM([[$2]], [[$3]],
|
|
|
|
[["Dual BSD/GPL"]])], [$1])
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_LINUX_CONFTEST_MAKEFILE([$1], [yes], [$4])
|
|
|
|
|
|
|
|
AS_IF([ test -n "$5" ], [
|
2020-12-23 19:40:02 +00:00
|
|
|
ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM(
|
|
|
|
[[$2]], [[$3]], [[$5]])], [$1_license])
|
2019-10-01 19:50:34 +00:00
|
|
|
ZFS_LINUX_CONFTEST_MAKEFILE([$1_license], [yes], [$4])
|
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_TEST_RESULT
|
2010-08-26 18:22:58 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # $1 - name of a test source (ZFS_LINUX_TEST_SRC)
|
|
|
|
dnl # $2 - run on success (valid .ko generated)
|
|
|
|
dnl # $3 - run on failure (unable to compile)
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TEST_RESULT], [
|
|
|
|
AS_IF([test -d build/$1], [
|
|
|
|
AS_IF([test -f build/$1/$1.ko], [$2], [$3])
|
|
|
|
], [
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** No matching source for the "$1" test, check that
|
|
|
|
*** both the test source and result macros refer to the same name.
|
|
|
|
])
|
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_TEST_ERROR
|
2010-08-26 18:22:58 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # Generic error message which can be used when none of the expected
|
|
|
|
dnl # kernel interfaces were detected.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TEST_ERROR], [
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** None of the expected "$1" interfaces were detected.
|
|
|
|
*** This may be because your kernel version is newer than what is
|
|
|
|
*** supported, or you are using a patched custom kernel with
|
|
|
|
*** incompatible modifications.
|
|
|
|
***
|
|
|
|
*** ZFS Version: $ZFS_META_ALIAS
|
|
|
|
*** Compatible Kernels: $ZFS_META_KVER_MIN - $ZFS_META_KVER_MAX
|
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # ZFS_LINUX_TEST_RESULT_SYMBOL
|
2010-08-26 18:22:58 +00:00
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl # Like ZFS_LINUX_TEST_RESULT except ZFS_CHECK_SYMBOL_EXPORT is called to
|
|
|
|
dnl # verify symbol exports, unless --enable-linux-builtin was provided to
|
|
|
|
dnl # configure.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TEST_RESULT_SYMBOL], [
|
|
|
|
AS_IF([ ! test -f build/$1/$1.ko], [
|
|
|
|
$5
|
|
|
|
], [
|
|
|
|
AS_IF([test "x$enable_linux_builtin" != "xyes"], [
|
|
|
|
ZFS_CHECK_SYMBOL_EXPORT([$2], [$3], [$4], [$5])
|
|
|
|
], [
|
|
|
|
$4
|
|
|
|
])
|
2010-08-26 18:22:58 +00:00
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_COMPILE_IFELSE
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [
|
|
|
|
ZFS_LINUX_TEST_REMOVE([conftest])
|
|
|
|
|
|
|
|
m4_ifvaln([$1], [ZFS_LINUX_CONFTEST_C([$1], [conftest])])
|
|
|
|
m4_ifvaln([$5], [ZFS_LINUX_CONFTEST_H([$5], [conftest])],
|
|
|
|
[ZFS_LINUX_CONFTEST_H([], [conftest])])
|
|
|
|
|
|
|
|
ZFS_LINUX_CONFTEST_MAKEFILE([conftest], [no],
|
|
|
|
[m4_ifvaln([$5], [-I$PWD/build/conftest], [])])
|
|
|
|
ZFS_LINUX_COMPILE([build/conftest], [$2], [$3], [$4], [], [])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_TRY_COMPILE
|
|
|
|
dnl #
|
|
|
|
dnl # $1 - global
|
|
|
|
dnl # $2 - source
|
|
|
|
dnl # $3 - run on success (valid .ko generated)
|
|
|
|
dnl # $4 - run on failure (unable to compile)
|
|
|
|
dnl #
|
2020-02-28 17:23:48 +00:00
|
|
|
dnl # When configuring as builtin (--enable-linux-builtin) for kernels
|
|
|
|
dnl # without loadable module support (CONFIG_MODULES=n) only the object
|
|
|
|
dnl # file is created. See ZFS_LINUX_TEST_COMPILE_ALL for details.
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_DEFUN([ZFS_LINUX_TRY_COMPILE], [
|
2020-02-28 17:23:48 +00:00
|
|
|
AS_IF([test "x$enable_linux_builtin" = "xyes"], [
|
|
|
|
ZFS_LINUX_COMPILE_IFELSE(
|
2020-12-23 19:40:02 +00:00
|
|
|
[ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]],
|
|
|
|
[[ZFS_META_LICENSE]])],
|
2020-02-28 17:23:48 +00:00
|
|
|
[test -f build/conftest/conftest.o], [$3], [$4])
|
|
|
|
], [
|
|
|
|
ZFS_LINUX_COMPILE_IFELSE(
|
2020-12-23 19:40:02 +00:00
|
|
|
[ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]],
|
|
|
|
[[ZFS_META_LICENSE]])],
|
2020-02-28 17:23:48 +00:00
|
|
|
[test -f build/conftest/conftest.ko], [$3], [$4])
|
|
|
|
])
|
2019-10-01 19:50:34 +00:00
|
|
|
])
|
|
|
|
|
2010-08-26 18:22:58 +00:00
|
|
|
dnl #
|
|
|
|
dnl # ZFS_CHECK_SYMBOL_EXPORT
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl #
|
|
|
|
dnl # Check if a symbol is exported on not by consulting the symbols
|
|
|
|
dnl # file, or optionally the source code.
|
2010-08-26 18:22:58 +00:00
|
|
|
dnl #
|
2012-07-25 21:38:58 +00:00
|
|
|
AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], [
|
2010-08-26 18:22:58 +00:00
|
|
|
grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
|
|
|
|
$LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null
|
|
|
|
rc=$?
|
2012-07-25 21:38:58 +00:00
|
|
|
if test $rc -ne 0; then
|
2010-08-26 18:22:58 +00:00
|
|
|
export=0
|
|
|
|
for file in $2; do
|
2012-07-25 21:38:58 +00:00
|
|
|
grep -q -E "EXPORT_SYMBOL.*($1)" \
|
|
|
|
"$LINUX/$file" 2>/dev/null
|
2010-08-26 18:22:58 +00:00
|
|
|
rc=$?
|
2012-07-25 21:38:58 +00:00
|
|
|
if test $rc -eq 0; then
|
2011-08-24 16:52:16 +00:00
|
|
|
export=1
|
|
|
|
break;
|
2012-07-25 21:38:58 +00:00
|
|
|
fi
|
2010-08-26 18:22:58 +00:00
|
|
|
done
|
2012-07-25 21:38:58 +00:00
|
|
|
if test $export -eq 0; then :
|
2010-08-26 18:22:58 +00:00
|
|
|
$4
|
2012-07-25 21:38:58 +00:00
|
|
|
else :
|
2010-08-26 18:22:58 +00:00
|
|
|
$3
|
2012-07-25 21:38:58 +00:00
|
|
|
fi
|
|
|
|
else :
|
2010-08-26 18:22:58 +00:00
|
|
|
$3
|
2012-07-25 21:38:58 +00:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_TRY_COMPILE_SYMBOL
|
2019-10-01 19:50:34 +00:00
|
|
|
dnl #
|
|
|
|
dnl # Like ZFS_LINUX_TRY_COMPILER except ZFS_CHECK_SYMBOL_EXPORT is called
|
|
|
|
dnl # to verify symbol exports, unless --enable-linux-builtin was provided
|
|
|
|
dnl # to configure.
|
2012-07-25 21:38:58 +00:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TRY_COMPILE_SYMBOL], [
|
|
|
|
ZFS_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1])
|
|
|
|
if test $rc -ne 0; then :
|
|
|
|
$6
|
|
|
|
else
|
|
|
|
if test "x$enable_linux_builtin" != xyes; then
|
|
|
|
ZFS_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1])
|
|
|
|
fi
|
|
|
|
if test $rc -ne 0; then :
|
|
|
|
$6
|
|
|
|
else :
|
|
|
|
$5
|
|
|
|
fi
|
|
|
|
fi
|
2010-08-26 18:22:58 +00:00
|
|
|
])
|
Swap DTRACE_PROBE* with Linux tracepoints
This patch leverages Linux tracepoints from within the ZFS on Linux
code base. It also refactors the debug code to bring it back in sync
with Illumos.
The information exported via tracepoints can be used for a variety of
reasons (e.g. debugging, tuning, general exploration/understanding,
etc). It is advantageous to use Linux tracepoints as the mechanism to
export this kind of information (as opposed to something else) for a
number of reasons:
* A number of external tools can make use of our tracepoints
"automatically" (e.g. perf, systemtap)
* Tracepoints are designed to be extremely cheap when disabled
* It's one of the "accepted" ways to export this kind of
information; many other kernel subsystems use tracepoints too.
Unfortunately, though, there are a few caveats as well:
* Linux tracepoints appear to only be available to GPL licensed
modules due to the way certain kernel functions are exported.
Thus, to actually make use of the tracepoints introduced by this
patch, one might have to patch and re-compile the kernel;
exporting the necessary functions to non-GPL modules.
* Prior to upstream kernel version v3.14-rc6-30-g66cc69e, Linux
tracepoints are not available for unsigned kernel modules
(tracepoints will get disabled due to the module's 'F' taint).
Thus, one either has to sign the zfs kernel module prior to
loading it, or use a kernel versioned v3.14-rc6-30-g66cc69e or
newer.
Assuming the above two requirements are satisfied, lets look at an
example of how this patch can be used and what information it exposes
(all commands run as 'root'):
# list all zfs tracepoints available
$ ls /sys/kernel/debug/tracing/events/zfs
enable filter zfs_arc__delete
zfs_arc__evict zfs_arc__hit zfs_arc__miss
zfs_l2arc__evict zfs_l2arc__hit zfs_l2arc__iodone
zfs_l2arc__miss zfs_l2arc__read zfs_l2arc__write
zfs_new_state__mfu zfs_new_state__mru
# enable all zfs tracepoints, clear the tracepoint ring buffer
$ echo 1 > /sys/kernel/debug/tracing/events/zfs/enable
$ echo 0 > /sys/kernel/debug/tracing/trace
# import zpool called 'tank', inspect tracepoint data (each line was
# truncated, they're too long for a commit message otherwise)
$ zpool import tank
$ cat /sys/kernel/debug/tracing/trace | head -n35
# tracer: nop
#
# entries-in-buffer/entries-written: 1219/1219 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
lt-zpool-30132 [003] .... 91344.200050: zfs_arc__miss: hdr...
z_rd_int/0-30156 [003] .... 91344.200611: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.201173: zfs_arc__miss: hdr...
z_rd_int/1-30157 [003] .... 91344.201756: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.201795: zfs_arc__miss: hdr...
z_rd_int/2-30158 [003] .... 91344.202099: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202126: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202130: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202134: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202146: zfs_arc__miss: hdr...
z_rd_int/3-30159 [003] .... 91344.202457: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202484: zfs_arc__miss: hdr...
z_rd_int/4-30160 [003] .... 91344.202866: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202891: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.203034: zfs_arc__miss: hdr...
z_rd_iss/1-30149 [001] .... 91344.203749: zfs_new_state__mru...
lt-zpool-30132 [001] .... 91344.203789: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.203878: zfs_arc__miss: hdr...
z_rd_iss/3-30151 [001] .... 91344.204315: zfs_new_state__mru...
lt-zpool-30132 [001] .... 91344.204332: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204337: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204352: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204356: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204360: zfs_arc__hit: hdr ...
To highlight the kind of detailed information that is being exported
using this infrastructure, I've taken the first tracepoint line from the
output above and reformatted it such that it fits in 80 columns:
lt-zpool-30132 [003] .... 91344.200050: zfs_arc__miss:
hdr {
dva 0x1:0x40082
birth 15491
cksum0 0x163edbff3a
flags 0x640
datacnt 1
type 1
size 2048
spa 3133524293419867460
state_type 0
access 0
mru_hits 0
mru_ghost_hits 0
mfu_hits 0
mfu_ghost_hits 0
l2_hits 0
refcount 1
} bp {
dva0 0x1:0x40082
dva1 0x1:0x3000e5
dva2 0x1:0x5a006e
cksum 0x163edbff3a:0x75af30b3dd6:0x1499263ff5f2b:0x288bd118815e00
lsize 2048
} zb {
objset 0
object 0
level -1
blkid 0
}
For the specific tracepoint shown here, 'zfs_arc__miss', data is
exported detailing the arc_buf_hdr_t (hdr), blkptr_t (bp), and
zbookmark_t (zb) that caused the ARC miss (down to the exact DVA!).
This kind of precise and detailed information can be extremely valuable
when trying to answer certain kinds of questions.
For anybody unfamiliar but looking to build on this, I found the XFS
source code along with the following three web links to be extremely
helpful:
* http://lwn.net/Articles/379903/
* http://lwn.net/Articles/381064/
* http://lwn.net/Articles/383362/
I should also node the more "boring" aspects of this patch:
* The ZFS_LINUX_COMPILE_IFELSE autoconf macro was modified to
support a sixth paramter. This parameter is used to populate the
contents of the new conftest.h file. If no sixth parameter is
provided, conftest.h will be empty.
* The ZFS_LINUX_TRY_COMPILE_HEADER autoconf macro was introduced.
This macro is nearly identical to the ZFS_LINUX_TRY_COMPILE macro,
except it has support for a fifth option that is then passed as
the sixth parameter to ZFS_LINUX_COMPILE_IFELSE.
These autoconf changes were needed to test the availability of the Linux
tracepoint macros. Due to the odd nature of the Linux tracepoint macro
API, a separate ".h" must be created (the path and filename is used
internally by the kernel's define_trace.h file).
* The HAVE_DECLARE_EVENT_CLASS autoconf macro was introduced. This
is to determine if we can safely enable the Linux tracepoint
functionality. We need to selectively disable the tracepoint code
due to the kernel exporting certain functions as GPL only. Without
this check, the build process will fail at link time.
In addition, the SET_ERROR macro was modified into a tracepoint as well.
To do this, the 'sdt.h' file was moved into the 'include/sys' directory
and now contains a userspace portion and a kernel space portion. The
dprintf and zfs_dbgmsg* interfaces are now implemented as tracepoint as
well.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2014-06-13 17:54:48 +00:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_TRY_COMPILE_HEADER
|
|
|
|
dnl # like ZFS_LINUX_TRY_COMPILE, except the contents conftest.h are
|
|
|
|
dnl # provided via the fifth parameter
|
|
|
|
dnl #
|
2019-10-01 19:50:34 +00:00
|
|
|
AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER], [
|
2022-10-17 18:08:36 +00:00
|
|
|
AS_IF([test "x$enable_linux_builtin" = "xyes"], [
|
|
|
|
ZFS_LINUX_COMPILE_IFELSE(
|
|
|
|
[ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]],
|
|
|
|
[[ZFS_META_LICENSE]])],
|
|
|
|
[test -f build/conftest/conftest.o], [$3], [$4], [$5])
|
|
|
|
], [
|
|
|
|
ZFS_LINUX_COMPILE_IFELSE(
|
|
|
|
[ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]],
|
|
|
|
[[ZFS_META_LICENSE]])],
|
|
|
|
[test -f build/conftest/conftest.ko], [$3], [$4], [$5])
|
|
|
|
])
|
Swap DTRACE_PROBE* with Linux tracepoints
This patch leverages Linux tracepoints from within the ZFS on Linux
code base. It also refactors the debug code to bring it back in sync
with Illumos.
The information exported via tracepoints can be used for a variety of
reasons (e.g. debugging, tuning, general exploration/understanding,
etc). It is advantageous to use Linux tracepoints as the mechanism to
export this kind of information (as opposed to something else) for a
number of reasons:
* A number of external tools can make use of our tracepoints
"automatically" (e.g. perf, systemtap)
* Tracepoints are designed to be extremely cheap when disabled
* It's one of the "accepted" ways to export this kind of
information; many other kernel subsystems use tracepoints too.
Unfortunately, though, there are a few caveats as well:
* Linux tracepoints appear to only be available to GPL licensed
modules due to the way certain kernel functions are exported.
Thus, to actually make use of the tracepoints introduced by this
patch, one might have to patch and re-compile the kernel;
exporting the necessary functions to non-GPL modules.
* Prior to upstream kernel version v3.14-rc6-30-g66cc69e, Linux
tracepoints are not available for unsigned kernel modules
(tracepoints will get disabled due to the module's 'F' taint).
Thus, one either has to sign the zfs kernel module prior to
loading it, or use a kernel versioned v3.14-rc6-30-g66cc69e or
newer.
Assuming the above two requirements are satisfied, lets look at an
example of how this patch can be used and what information it exposes
(all commands run as 'root'):
# list all zfs tracepoints available
$ ls /sys/kernel/debug/tracing/events/zfs
enable filter zfs_arc__delete
zfs_arc__evict zfs_arc__hit zfs_arc__miss
zfs_l2arc__evict zfs_l2arc__hit zfs_l2arc__iodone
zfs_l2arc__miss zfs_l2arc__read zfs_l2arc__write
zfs_new_state__mfu zfs_new_state__mru
# enable all zfs tracepoints, clear the tracepoint ring buffer
$ echo 1 > /sys/kernel/debug/tracing/events/zfs/enable
$ echo 0 > /sys/kernel/debug/tracing/trace
# import zpool called 'tank', inspect tracepoint data (each line was
# truncated, they're too long for a commit message otherwise)
$ zpool import tank
$ cat /sys/kernel/debug/tracing/trace | head -n35
# tracer: nop
#
# entries-in-buffer/entries-written: 1219/1219 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
lt-zpool-30132 [003] .... 91344.200050: zfs_arc__miss: hdr...
z_rd_int/0-30156 [003] .... 91344.200611: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.201173: zfs_arc__miss: hdr...
z_rd_int/1-30157 [003] .... 91344.201756: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.201795: zfs_arc__miss: hdr...
z_rd_int/2-30158 [003] .... 91344.202099: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202126: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202130: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202134: zfs_arc__hit: hdr ...
lt-zpool-30132 [003] .... 91344.202146: zfs_arc__miss: hdr...
z_rd_int/3-30159 [003] .... 91344.202457: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202484: zfs_arc__miss: hdr...
z_rd_int/4-30160 [003] .... 91344.202866: zfs_new_state__mru...
lt-zpool-30132 [003] .... 91344.202891: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.203034: zfs_arc__miss: hdr...
z_rd_iss/1-30149 [001] .... 91344.203749: zfs_new_state__mru...
lt-zpool-30132 [001] .... 91344.203789: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.203878: zfs_arc__miss: hdr...
z_rd_iss/3-30151 [001] .... 91344.204315: zfs_new_state__mru...
lt-zpool-30132 [001] .... 91344.204332: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204337: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204352: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204356: zfs_arc__hit: hdr ...
lt-zpool-30132 [001] .... 91344.204360: zfs_arc__hit: hdr ...
To highlight the kind of detailed information that is being exported
using this infrastructure, I've taken the first tracepoint line from the
output above and reformatted it such that it fits in 80 columns:
lt-zpool-30132 [003] .... 91344.200050: zfs_arc__miss:
hdr {
dva 0x1:0x40082
birth 15491
cksum0 0x163edbff3a
flags 0x640
datacnt 1
type 1
size 2048
spa 3133524293419867460
state_type 0
access 0
mru_hits 0
mru_ghost_hits 0
mfu_hits 0
mfu_ghost_hits 0
l2_hits 0
refcount 1
} bp {
dva0 0x1:0x40082
dva1 0x1:0x3000e5
dva2 0x1:0x5a006e
cksum 0x163edbff3a:0x75af30b3dd6:0x1499263ff5f2b:0x288bd118815e00
lsize 2048
} zb {
objset 0
object 0
level -1
blkid 0
}
For the specific tracepoint shown here, 'zfs_arc__miss', data is
exported detailing the arc_buf_hdr_t (hdr), blkptr_t (bp), and
zbookmark_t (zb) that caused the ARC miss (down to the exact DVA!).
This kind of precise and detailed information can be extremely valuable
when trying to answer certain kinds of questions.
For anybody unfamiliar but looking to build on this, I found the XFS
source code along with the following three web links to be extremely
helpful:
* http://lwn.net/Articles/379903/
* http://lwn.net/Articles/381064/
* http://lwn.net/Articles/383362/
I should also node the more "boring" aspects of this patch:
* The ZFS_LINUX_COMPILE_IFELSE autoconf macro was modified to
support a sixth paramter. This parameter is used to populate the
contents of the new conftest.h file. If no sixth parameter is
provided, conftest.h will be empty.
* The ZFS_LINUX_TRY_COMPILE_HEADER autoconf macro was introduced.
This macro is nearly identical to the ZFS_LINUX_TRY_COMPILE macro,
except it has support for a fifth option that is then passed as
the sixth parameter to ZFS_LINUX_COMPILE_IFELSE.
These autoconf changes were needed to test the availability of the Linux
tracepoint macros. Due to the odd nature of the Linux tracepoint macro
API, a separate ".h" must be created (the path and filename is used
internally by the kernel's define_trace.h file).
* The HAVE_DECLARE_EVENT_CLASS autoconf macro was introduced. This
is to determine if we can safely enable the Linux tracepoint
functionality. We need to selectively disable the tracepoint code
due to the kernel exporting certain functions as GPL only. Without
this check, the build process will fail at link time.
In addition, the SET_ERROR macro was modified into a tracepoint as well.
To do this, the 'sdt.h' file was moved into the 'include/sys' directory
and now contains a userspace portion and a kernel space portion. The
dprintf and zfs_dbgmsg* interfaces are now implemented as tracepoint as
well.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2014-06-13 17:54:48 +00:00
|
|
|
])
|
2023-01-05 04:41:16 +00:00
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # AS_VERSION_COMPARE_LE
|
|
|
|
dnl # like AS_VERSION_COMPARE_LE, but runs $3 if (and only if) $1 <= $2
|
|
|
|
dnl # AS_VERSION_COMPARE_LE (version-1, version-2, [action-if-less-or-equal], [action-if-greater])
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([AS_VERSION_COMPARE_LE], [
|
|
|
|
AS_VERSION_COMPARE([$1], [$2], [$3], [$3], [$4])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_REQUIRE_API
|
|
|
|
dnl # like ZFS_LINUX_TEST_ERROR, except only fails if the kernel is
|
|
|
|
dnl # at least some specified version.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_REQUIRE_API], [
|
|
|
|
AS_VERSION_COMPARE_LE([$2], [$kernsrcver], [
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** None of the expected "$1" interfaces were detected. This
|
|
|
|
*** interface is expected for kernels version "$2" and above.
|
|
|
|
*** This may be because your kernel version is newer than what is
|
|
|
|
*** supported, or you are using a patched custom kernel with
|
|
|
|
*** incompatible modifications. Newer kernels may have incompatible
|
|
|
|
*** APIs.
|
|
|
|
***
|
|
|
|
*** ZFS Version: $ZFS_META_ALIAS
|
|
|
|
*** Compatible Kernels: $ZFS_META_KVER_MIN - $ZFS_META_KVER_MAX
|
|
|
|
])
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
])
|