2010-08-26 22:22:58 +04: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 21:42:27 +03:00
|
|
|
dnl # Default ZFS kernel configuration
|
2010-08-26 22:22:58 +04:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
|
|
|
ZFS_AC_KERNEL
|
2017-03-23 03:58:47 +03:00
|
|
|
ZFS_AC_QAT
|
2019-01-10 22:03:40 +03:00
|
|
|
ZFS_AC_KERNEL_ACCESS_OK_TYPE
|
2012-07-17 12:36:43 +04:00
|
|
|
ZFS_AC_TEST_MODULE
|
2018-03-13 20:45:55 +03:00
|
|
|
ZFS_AC_KERNEL_MISC_MINOR
|
2017-03-07 23:59:31 +03:00
|
|
|
ZFS_AC_KERNEL_OBJTOOL
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_CONFIG
|
2018-02-16 04:53:18 +03:00
|
|
|
ZFS_AC_KERNEL_CTL_NAME
|
|
|
|
ZFS_AC_KERNEL_PDE_DATA
|
|
|
|
ZFS_AC_KERNEL_2ARGS_VFS_FSYNC
|
|
|
|
ZFS_AC_KERNEL_FS_STRUCT_SPINLOCK
|
|
|
|
ZFS_AC_KERNEL_KUIDGID_T
|
|
|
|
ZFS_AC_KERNEL_FALLOCATE
|
|
|
|
ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
|
|
|
|
ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW
|
|
|
|
ZFS_AC_KERNEL_RWSEM_ACTIVITY
|
|
|
|
ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT
|
|
|
|
ZFS_AC_KERNEL_SCHED_RT_HEADER
|
|
|
|
ZFS_AC_KERNEL_SCHED_SIGNAL_HEADER
|
|
|
|
ZFS_AC_KERNEL_IO_SCHEDULE_TIMEOUT
|
|
|
|
ZFS_AC_KERNEL_4ARGS_VFS_GETATTR
|
|
|
|
ZFS_AC_KERNEL_3ARGS_VFS_GETATTR
|
|
|
|
ZFS_AC_KERNEL_2ARGS_VFS_GETATTR
|
|
|
|
ZFS_AC_KERNEL_USLEEP_RANGE
|
|
|
|
ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS
|
|
|
|
ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY
|
|
|
|
ZFS_AC_KERNEL_WAIT_ON_BIT
|
|
|
|
ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T
|
|
|
|
ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY
|
2018-06-20 07:51:18 +03:00
|
|
|
ZFS_AC_KERNEL_INODE_TIMES
|
2018-02-16 04:53:18 +03:00
|
|
|
ZFS_AC_KERNEL_INODE_LOCK
|
|
|
|
ZFS_AC_KERNEL_GROUP_INFO_GID
|
|
|
|
ZFS_AC_KERNEL_WRITE
|
|
|
|
ZFS_AC_KERNEL_READ
|
|
|
|
ZFS_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST
|
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 21:54:48 +04:00
|
|
|
ZFS_AC_KERNEL_DECLARE_EVENT_CLASS
|
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-05 02:43:47 +04:00
|
|
|
ZFS_AC_KERNEL_CURRENT_BIO_TAIL
|
2016-08-03 20:19:04 +03:00
|
|
|
ZFS_AC_KERNEL_SUPER_USER_NS
|
2016-07-27 05:23:53 +03:00
|
|
|
ZFS_AC_KERNEL_SUBMIT_BIO
|
2018-06-16 01:05:21 +03:00
|
|
|
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
|
2013-06-03 10:58:52 +04:00
|
|
|
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_TYPE_FMODE_T
|
2011-02-23 01:55:35 +03:00
|
|
|
ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
|
Add support for autoexpand property
While the autoexpand property may seem like a small feature it
depends on a significant amount of system infrastructure. Enough
of that infrastructure is now in place that with a few modifications
for Linux it can be supported.
Auto-expand works as follows; when a block device is modified
(re-sized, closed after being open r/w, etc) a change uevent is
generated for udev. The ZED, which is monitoring udev events,
passes the change event along to zfs_deliver_dle() if the disk
or partition contains a zfs_member as identified by blkid.
From here the device is matched against all imported pool vdevs
using the vdev_guid which was read from the label by blkid. If
a match is found the ZED reopens the pool vdev. This re-opening
is important because it allows the vdev to be briefly closed so
the disk partition table can be re-read. Otherwise, it wouldn't
be possible to report the maximum possible expansion size.
Finally, if the property autoexpand=on a vdev expansion will be
attempted. After performing some sanity checks on the disk to
verify that it is safe to expand, the primary partition (-part1)
will be expanded and the partition table updated. The partition
is then re-opened (again) to detect the updated size which allows
the new capacity to be used.
In order to make all of the above possible the following changes
were required:
* Updated the zpool_expand_001_pos and zpool_expand_003_pos tests.
These tests now create a pool which is layered on a loopback,
scsi_debug, and file vdev. This allows for testing of non-
partitioned block device (loopback), a partition block device
(scsi_debug), and a file which does not receive udev change
events. This provided for better test coverage, and by removing
the layering on ZFS volumes there issues surrounding layering
one pool on another are avoided.
* zpool_find_vdev_by_physpath() updated to accept a vdev guid.
This allows for matching by guid rather than path which is a
more reliable way for the ZED to reference a vdev.
* Fixed zfs_zevent_wait() signal handling which could result
in the ZED spinning when a signal was not handled.
* Removed vdev_disk_rrpart() functionality which can be abandoned
in favor of kernel provided blkdev_reread_part() function.
* Added a rwlock which is held as a writer while a disk is being
reopened. This is important to prevent errors from occurring
for any configuration related IOs which bypass the SCL_ZIO lock.
The zpool_reopen_007_pos.ksh test case was added to verify IO
error are never observed when reopening. This is not expected
to impact IO performance.
Additional fixes which aren't critical but were discovered and
resolved in the course of developing this functionality.
* Added PHYS_PATH="/dev/zvol/dataset" to the vdev configuration for
ZFS volumes. This is as good as a unique physical path, while the
volumes are not used in the test cases anymore for other reasons
this improvement was included.
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Signed-off-by: Sara Hartse <sara.hartse@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #120
Closes #2437
Closes #5771
Closes #7366
Closes #7582
Closes #7629
2018-07-24 01:40:15 +03:00
|
|
|
ZFS_AC_KERNEL_BLKDEV_REREAD_PART
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE
|
2013-01-29 02:15:39 +04:00
|
|
|
ZFS_AC_KERNEL_LOOKUP_BDEV
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS
|
|
|
|
ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE
|
2012-09-03 03:34:12 +04:00
|
|
|
ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE
|
2014-03-28 11:08:21 +04:00
|
|
|
ZFS_AC_KERNEL_BIO_BVEC_ITER
|
2010-11-11 01:40:38 +03:00
|
|
|
ZFS_AC_KERNEL_BIO_FAILFAST_DTD
|
2017-09-16 21:00:19 +03:00
|
|
|
ZFS_AC_KERNEL_BIO_SET_DEV
|
2010-11-11 01:40:38 +03:00
|
|
|
ZFS_AC_KERNEL_REQ_FAILFAST_MASK
|
2016-08-09 21:22:30 +03:00
|
|
|
ZFS_AC_KERNEL_REQ_OP_DISCARD
|
|
|
|
ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE
|
|
|
|
ZFS_AC_KERNEL_REQ_OP_FLUSH
|
|
|
|
ZFS_AC_KERNEL_BIO_BI_OPF
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_BIO_END_IO_T_ARGS
|
2017-07-24 05:37:12 +03:00
|
|
|
ZFS_AC_KERNEL_BIO_BI_STATUS
|
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-05 02:43:47 +04:00
|
|
|
ZFS_AC_KERNEL_BIO_RW_BARRIER
|
|
|
|
ZFS_AC_KERNEL_BIO_RW_DISCARD
|
2014-07-11 22:35:58 +04:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_BDI
|
2018-04-10 20:32:14 +03:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR
|
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET
|
2011-09-05 13:11:38 +04:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_FLUSH
|
2011-09-05 17:15:45 +04:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS
|
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
|
Fix sync behavior for disk vdevs
Prior to b39c22b, which was first generally available in the 0.6.5
release as b39c22b, ZoL never actually submitted synchronous read or write
requests to the Linux block layer. This means the vdev_disk_dio_is_sync()
function had always returned false and, therefore, the completion in
dio_request_t.dr_comp was never actually used.
In b39c22b, synchronous ZIO operations were translated to synchronous
BIO requests in vdev_disk_io_start(). The follow-on commits 5592404 and
aa159af fixed several problems introduced by b39c22b. In particular,
5592404 introduced the new flag parameter "wait" to __vdev_disk_physio()
but under ZoL, since vdev_disk_physio() is never actually used, the wait
flag was always zero so the new code had no effect other than to cause
a bug in the use of the dio_request_t.dr_comp which was fixed by aa159af.
The original rationale for introducing synchronous operations in b39c22b
was to hurry certains requests through the BIO layer which would have
otherwise been subject to its unplug timer which would increase the
latency. This behavior of the unplug timer, however, went away during the
transition of the plug/unplug system between kernels 2.6.32 and 2.6.39.
To handle the unplug timer behavior on 2.6.32-2.6.35 kernels the
BIO_RW_UNPLUG flag is used as a hint to suppress the plugging behavior.
For kernels 2.6.36-2.6.38, the REQ_UNPLUG macro will be available and
ise used for the same purpose.
Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4858
2016-07-08 18:33:01 +03:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BIO_RW_UNPLUG
|
2016-09-29 23:13:31 +03:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BLK_PLUG
|
2018-03-05 23:44:35 +03:00
|
|
|
ZFS_AC_KERNEL_GET_DISK_AND_MODULE
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_GET_DISK_RO
|
2016-12-31 01:03:59 +03:00
|
|
|
ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS
|
|
|
|
ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL
|
2012-08-01 12:29:59 +04:00
|
|
|
ZFS_AC_KERNEL_DISCARD_GRANULARITY
|
2011-02-11 03:16:52 +03:00
|
|
|
ZFS_AC_KERNEL_CONST_XATTR_HANDLER
|
2016-04-22 03:19:07 +03:00
|
|
|
ZFS_AC_KERNEL_XATTR_HANDLER_NAME
|
2011-02-11 21:33:01 +03:00
|
|
|
ZFS_AC_KERNEL_XATTR_HANDLER_GET
|
|
|
|
ZFS_AC_KERNEL_XATTR_HANDLER_SET
|
2013-10-28 20:22:15 +04:00
|
|
|
ZFS_AC_KERNEL_XATTR_HANDLER_LIST
|
|
|
|
ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE
|
|
|
|
ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS
|
|
|
|
ZFS_AC_KERNEL_POSIX_ACL_RELEASE
|
2016-11-02 03:19:52 +03:00
|
|
|
ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE
|
2013-10-28 20:22:15 +04:00
|
|
|
ZFS_AC_KERNEL_POSIX_ACL_CHMOD
|
|
|
|
ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
|
2016-08-02 21:11:45 +03:00
|
|
|
ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS
|
2013-10-28 20:22:15 +04:00
|
|
|
ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION
|
|
|
|
ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA
|
|
|
|
ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL
|
|
|
|
ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS
|
|
|
|
ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
|
2016-11-09 21:37:17 +03:00
|
|
|
ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
|
2017-03-21 03:51:16 +03:00
|
|
|
ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR
|
2016-12-17 00:54:51 +03:00
|
|
|
ZFS_AC_KERNEL_INODE_SET_FLAGS
|
2018-02-09 01:27:59 +03:00
|
|
|
ZFS_AC_KERNEL_INODE_SET_IVERSION
|
2016-11-02 03:19:52 +03:00
|
|
|
ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
|
2012-02-02 23:55:48 +04:00
|
|
|
ZFS_AC_KERNEL_SHOW_OPTIONS
|
2015-02-07 15:41:01 +03:00
|
|
|
ZFS_AC_KERNEL_FILE_INODE
|
2016-08-04 18:57:35 +03:00
|
|
|
ZFS_AC_KERNEL_FILE_DENTRY
|
2011-11-10 08:47:59 +04:00
|
|
|
ZFS_AC_KERNEL_FSYNC
|
2011-02-12 00:46:10 +03:00
|
|
|
ZFS_AC_KERNEL_EVICT_INODE
|
2012-12-12 04:58:44 +04:00
|
|
|
ZFS_AC_KERNEL_DIRTY_INODE_WITH_FLAGS
|
2011-12-23 00:20:43 +04:00
|
|
|
ZFS_AC_KERNEL_NR_CACHED_OBJECTS
|
|
|
|
ZFS_AC_KERNEL_FREE_CACHED_OBJECTS
|
2011-09-02 11:42:07 +04:00
|
|
|
ZFS_AC_KERNEL_FALLOCATE
|
2016-11-15 20:20:46 +03:00
|
|
|
ZFS_AC_KERNEL_AIO_FSYNC
|
2012-08-17 03:31:54 +04:00
|
|
|
ZFS_AC_KERNEL_MKDIR_UMODE_T
|
2012-10-12 18:41:06 +04:00
|
|
|
ZFS_AC_KERNEL_LOOKUP_NAMEIDATA
|
2012-10-12 19:20:58 +04:00
|
|
|
ZFS_AC_KERNEL_CREATE_NAMEIDATA
|
2016-01-14 21:25:10 +03:00
|
|
|
ZFS_AC_KERNEL_GET_LINK
|
2015-07-15 20:54:26 +03:00
|
|
|
ZFS_AC_KERNEL_PUT_LINK
|
2016-01-26 23:29:46 +03:00
|
|
|
ZFS_AC_KERNEL_TMPFILE
|
2012-07-23 22:11:25 +04:00
|
|
|
ZFS_AC_KERNEL_TRUNCATE_RANGE
|
2011-11-11 11:15:53 +04:00
|
|
|
ZFS_AC_KERNEL_AUTOMOUNT
|
2012-07-23 21:55:48 +04:00
|
|
|
ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE
|
2012-09-16 10:03:04 +04:00
|
|
|
ZFS_AC_KERNEL_COMMIT_METADATA
|
2012-07-23 22:39:25 +04:00
|
|
|
ZFS_AC_KERNEL_CLEAR_INODE
|
2016-10-19 02:49:23 +03:00
|
|
|
ZFS_AC_KERNEL_SETATTR_PREPARE
|
2011-03-22 19:55:09 +03:00
|
|
|
ZFS_AC_KERNEL_INSERT_INODE_LOCKED
|
2012-06-06 21:08:00 +04:00
|
|
|
ZFS_AC_KERNEL_D_MAKE_ROOT
|
2011-04-28 20:35:50 +04:00
|
|
|
ZFS_AC_KERNEL_D_OBTAIN_ALIAS
|
2015-06-18 19:21:19 +03:00
|
|
|
ZFS_AC_KERNEL_D_PRUNE_ALIASES
|
2013-01-15 01:59:14 +04:00
|
|
|
ZFS_AC_KERNEL_D_SET_D_OP
|
|
|
|
ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA
|
|
|
|
ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS
|
2011-06-25 16:30:29 +04:00
|
|
|
ZFS_AC_KERNEL_TRUNCATE_SETSIZE
|
2011-05-19 23:47:32 +04:00
|
|
|
ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY
|
2012-01-13 01:59:44 +04:00
|
|
|
ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY
|
2018-04-12 22:24:38 +03:00
|
|
|
ZFS_AC_KERNEL_FST_MOUNT
|
2011-12-23 00:20:43 +04:00
|
|
|
ZFS_AC_KERNEL_SHRINK
|
2015-06-14 19:19:40 +03:00
|
|
|
ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID
|
2018-02-16 04:53:18 +03:00
|
|
|
ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT
|
|
|
|
ZFS_AC_KERNEL_SHRINKER_CALLBACK
|
2013-07-16 00:37:51 +04:00
|
|
|
ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD
|
2013-01-19 02:11:40 +04:00
|
|
|
ZFS_AC_KERNEL_S_D_OP
|
2017-05-02 19:46:18 +03:00
|
|
|
ZFS_AC_KERNEL_BDI
|
2011-12-17 01:15:12 +04:00
|
|
|
ZFS_AC_KERNEL_SET_NLINK
|
2012-08-27 00:38:06 +04:00
|
|
|
ZFS_AC_KERNEL_ELEVATOR_CHANGE
|
2012-10-12 17:40:53 +04:00
|
|
|
ZFS_AC_KERNEL_5ARG_SGET
|
2013-06-13 21:51:09 +04:00
|
|
|
ZFS_AC_KERNEL_LSEEK_EXECUTE
|
2013-08-07 16:53:45 +04:00
|
|
|
ZFS_AC_KERNEL_VFS_ITERATE
|
2015-05-12 02:26:18 +03:00
|
|
|
ZFS_AC_KERNEL_VFS_RW_ITERATE
|
2018-08-27 20:04:21 +03:00
|
|
|
ZFS_AC_KERNEL_VFS_DIRECT_IO
|
2017-01-27 21:43:39 +03:00
|
|
|
ZFS_AC_KERNEL_GENERIC_WRITE_CHECKS
|
2015-05-11 17:22:56 +03:00
|
|
|
ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS
|
2015-04-25 02:21:13 +03: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-05 02:43:47 +04:00
|
|
|
ZFS_AC_KERNEL_MAKE_REQUEST_FN
|
2017-09-16 21:00:19 +03:00
|
|
|
ZFS_AC_KERNEL_GENERIC_IO_ACCT_3ARG
|
|
|
|
ZFS_AC_KERNEL_GENERIC_IO_ACCT_4ARG
|
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 21:42:27 +03:00
|
|
|
ZFS_AC_KERNEL_FPU
|
2016-05-30 20:37:36 +03:00
|
|
|
ZFS_AC_KERNEL_KUID_HELPERS
|
2016-08-21 22:29:49 +03:00
|
|
|
ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
|
2016-10-19 21:19:01 +03:00
|
|
|
ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
|
2016-10-19 21:19:17 +03:00
|
|
|
ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR
|
2017-05-10 19:30:48 +03:00
|
|
|
ZFS_AC_KERNEL_CURRENT_TIME
|
Fix free memory calculation on v3.14+
Provide infrastructure to auto-configure to enum and API changes in the
global page stats used for our free memory calculations.
arc_free_memory has been broken since an API change in Linux v3.14:
2016-07-28 v4.8 599d0c95 mm, vmscan: move LRU lists to node
2016-07-28 v4.8 75ef7184 mm, vmstat: add infrastructure for per-node
vmstats
These commits moved some of global_page_state() into
global_node_page_state(). The API change was particularly egregious as,
instead of breaking the old code, it silently did the wrong thing and we
continued using global_page_state() where we should have been using
global_node_page_state(), thus indexing into the wrong array via
NR_SLAB_RECLAIMABLE et al.
There have been further API changes along the way:
2017-07-06 v4.13 385386cf mm: vmstat: move slab statistics from zone to
node counters
2017-09-06 v4.14 c41f012a mm: rename global_page_state to
global_zone_page_state
...and various (incomplete, as it turns out) attempts to accomodate
these changes in ZoL:
2017-08-24 2209e409 Linux 4.8+ compatibility fix for vm stats
2017-09-16 787acae0 Linux 3.14 compat: IO acct, global_page_state, etc
2017-09-19 661907e6 Linux 4.14 compat: IO acct, global_page_state, etc
The config infrastructure provided here resolves these issues going back
to the original API change in v3.14 and is robust against further Linux
changes in this area.
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Chris Dunlop <chris@onthe.net.au>
Closes #7170
2018-02-23 19:50:06 +03:00
|
|
|
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE
|
2018-02-22 20:02:06 +03:00
|
|
|
ZFS_AC_KERNEL_ACL_HAS_REFCOUNT
|
2018-03-08 02:40:42 +03:00
|
|
|
ZFS_AC_KERNEL_USERNS_CAPABILITIES
|
2018-09-25 03:11:25 +03:00
|
|
|
ZFS_AC_KERNEL_IN_COMPAT_SYSCALL
|
2019-01-10 00:16:39 +03:00
|
|
|
ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64
|
2019-01-11 01:28:10 +03:00
|
|
|
ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC
|
2019-05-05 02:40:48 +03:00
|
|
|
ZFS_AC_KERNEL_TOTALHIGH_PAGES
|
2019-03-29 19:13:20 +03:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
|
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
|
2019-05-24 22:26:18 +03:00
|
|
|
ZFS_AC_KERNEL_KSTRTOUL
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
|
2018-01-10 21:49:27 +03:00
|
|
|
KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-09-05 00:26:23 +04:00
|
|
|
|
2018-01-10 21:49:27 +03:00
|
|
|
AC_SUBST(KERNEL_MAKE)
|
2010-08-26 22:22:58 +04: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 12:36:43 +04:00
|
|
|
AS_IF([test "x$enable_linux_builtin" != xyes -a -f "$modpost"], [
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([grep -q Modules.symvers $modpost], [
|
2010-08-26 22:22:58 +04:00
|
|
|
LINUX_SYMBOLS=Modules.symvers
|
2011-08-24 20:52:16 +04:00
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
LINUX_SYMBOLS=Module.symvers
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2011-03-08 00:03:48 +03:00
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test ! -f "$LINUX_OBJ/$LINUX_SYMBOLS"], [
|
2011-03-08 00:03:48 +03:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the kernel devel package for your distribution
|
2013-03-30 06:27:50 +04:00
|
|
|
*** is installed. If you are building with a custom kernel, make sure the
|
2011-03-08 00:03:48 +03:00
|
|
|
*** kernel is configured, built, and the '--with-linux=PATH' configure
|
|
|
|
*** option refers to the location of the kernel source.])
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
LINUX_SYMBOLS=NONE
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT($LINUX_SYMBOLS)
|
|
|
|
AC_SUBST(LINUX_SYMBOLS)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Detect the kernel to be built against
|
|
|
|
dnl #
|
|
|
|
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"])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([kernel source directory])
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -z "$kernelsrc"], [
|
|
|
|
AS_IF([test -e "/lib/modules/$(uname -r)/source"], [
|
2011-02-11 01:54:33 +03:00
|
|
|
headersdir="/lib/modules/$(uname -r)/source"
|
|
|
|
sourcelink=$(readlink -f "$headersdir")
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -e "/lib/modules/$(uname -r)/build"], [
|
2011-02-11 01:54:33 +03:00
|
|
|
headersdir="/lib/modules/$(uname -r)/build"
|
2010-08-26 22:22:58 +04:00
|
|
|
sourcelink=$(readlink -f "$headersdir")
|
2011-08-24 20:52:16 +04:00
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
sourcelink=$(ls -1d /usr/src/kernels/* \
|
2011-08-24 20:52:16 +04:00
|
|
|
/usr/src/linux-* \
|
2010-08-26 22:22:58 +04:00
|
|
|
2>/dev/null | grep -v obj | tail -1)
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -n "$sourcelink" && test -e ${sourcelink}], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernelsrc=`readlink -f ${sourcelink}`
|
2011-08-24 20:52:16 +04:00
|
|
|
], [
|
2012-11-30 08:19:25 +04:00
|
|
|
kernelsrc="[Not found]"
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
], [
|
|
|
|
AS_IF([test "$kernelsrc" = "NONE"], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernsrcver=NONE
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2017-05-25 02:02:04 +03:00
|
|
|
withlinux=yes
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$kernelsrc])
|
2012-11-30 08:19:25 +04:00
|
|
|
AS_IF([test ! -d "$kernelsrc"], [
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the kernel devel package for your distribution
|
2013-03-30 06:27:50 +04:00
|
|
|
*** is installed and then try again. If that fails, you can specify the
|
2012-11-30 08:19:25 +04:00
|
|
|
*** location of the kernel source with the '--with-linux=PATH' option.])
|
|
|
|
])
|
|
|
|
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_CHECKING([kernel build directory])
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -z "$kernelbuild"], [
|
2017-05-25 02:02:04 +03:00
|
|
|
AS_IF([test x$withlinux != xyes -a -e "/lib/modules/$(uname -r)/build"], [
|
2011-02-11 01:54:33 +03:00
|
|
|
kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -d ${kernelsrc}-obj/${target_cpu}/default], [
|
2012-07-26 01:38:58 +04:00
|
|
|
kernelbuild=${kernelsrc}-obj/${target_cpu}/default
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -d `dirname ${kernelsrc}`/build-${target_cpu}], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
|
2011-08-24 20:52:16 +04:00
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernelbuild=${kernelsrc}
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([$kernelbuild])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([kernel source version])
|
|
|
|
utsrelease1=$kernelbuild/include/linux/version.h
|
|
|
|
utsrelease2=$kernelbuild/include/linux/utsrelease.h
|
|
|
|
utsrelease3=$kernelbuild/include/generated/utsrelease.h
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1], [
|
2010-08-26 22:22:58 +04:00
|
|
|
utsrelease=linux/version.h
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2], [
|
2010-08-26 22:22:58 +04:00
|
|
|
utsrelease=linux/utsrelease.h
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3], [
|
2010-08-26 22:22:58 +04:00
|
|
|
utsrelease=generated/utsrelease.h
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test "$utsrelease"], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernsrcver=`(echo "#include <$utsrelease>";
|
|
|
|
echo "kernsrcver=UTS_RELEASE") |
|
2018-12-05 20:31:44 +03:00
|
|
|
${CPP} -I $kernelbuild/include - |
|
2010-08-26 22:22:58 +04:00
|
|
|
grep "^kernsrcver=" | cut -d \" -f 2`
|
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -z "$kernsrcver"], [
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([Not found])
|
|
|
|
AC_MSG_ERROR([*** Cannot determine kernel version.])
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([Not found])
|
2012-07-17 12:36:43 +04:00
|
|
|
if test "x$enable_linux_builtin" != xyes; then
|
|
|
|
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Cannot find UTS_RELEASE definition.
|
|
|
|
*** Please run 'make prepare' inside the kernel source tree.])
|
|
|
|
fi
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$kernsrcver])
|
|
|
|
|
|
|
|
LINUX=${kernelsrc}
|
|
|
|
LINUX_OBJ=${kernelbuild}
|
|
|
|
LINUX_VERSION=${kernsrcver}
|
|
|
|
|
|
|
|
AC_SUBST(LINUX)
|
|
|
|
AC_SUBST(LINUX_OBJ)
|
|
|
|
AC_SUBST(LINUX_VERSION)
|
|
|
|
|
|
|
|
ZFS_AC_MODULE_SYMVERS
|
|
|
|
])
|
|
|
|
|
2017-03-23 03:58:47 +03:00
|
|
|
dnl #
|
|
|
|
dnl # Detect the QAT module to be built against
|
|
|
|
dnl # QAT provides hardware acceleration for data compression:
|
|
|
|
dnl # https://01.org/intel-quickassist-technology
|
|
|
|
dnl # * Download and install QAT driver from the above link
|
|
|
|
dnl # * Start QAT driver in your system:
|
|
|
|
dnl # service qat_service start
|
|
|
|
dnl # * Enable QAT in ZFS, e.g.:
|
|
|
|
dnl # ./configure --with-qat=<qat-driver-path>/QAT1.6
|
|
|
|
dnl # make
|
|
|
|
dnl # * Set GZIP compression in ZFS dataset:
|
|
|
|
dnl # zfs set compression = gzip <dataset>
|
|
|
|
dnl # Then the data written to this ZFS pool is compressed
|
|
|
|
dnl # by QAT accelerator automatically, and de-compressed by
|
|
|
|
dnl # QAT when read from the pool.
|
|
|
|
dnl # * Get QAT hardware statistics by:
|
|
|
|
dnl # cat /proc/icp_dh895xcc_dev/qat
|
|
|
|
dnl # * To disable QAT:
|
|
|
|
dnl # insmod zfs.ko zfs_qat_disable=1
|
|
|
|
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([
|
|
|
|
*** 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])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
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 21:11:25 +03:00
|
|
|
AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"], [
|
2017-03-23 03:58:47 +03:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the qat driver is installed then try again.
|
2017-10-20 21:11:25 +03:00
|
|
|
*** Failed to find icp_qa_al.ko or qat_api.ko in:
|
2017-03-23 03:58:47 +03:00
|
|
|
$QAT_OBJ])
|
|
|
|
])
|
|
|
|
|
|
|
|
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)
|
|
|
|
],[
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the qat driver is installed then try again.
|
|
|
|
*** Failed to find Module.symvers in:
|
|
|
|
$QAT_SYMBOLS])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2012-07-17 12:36:43 +04:00
|
|
|
dnl #
|
|
|
|
dnl # Basic toolchain sanity check.
|
|
|
|
dnl #
|
2014-10-03 21:58:47 +04:00
|
|
|
AC_DEFUN([ZFS_AC_TEST_MODULE], [
|
|
|
|
AC_MSG_CHECKING([whether modules can be built])
|
2012-07-17 12:36:43 +04:00
|
|
|
ZFS_LINUX_TRY_COMPILE([],[],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
if test "x$enable_linux_builtin" != xyes; then
|
|
|
|
AC_MSG_ERROR([*** Unable to build an empty module.])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Unable to build an empty module.
|
|
|
|
*** Please run 'make scripts' inside the kernel source tree.])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2011-03-07 21:59:26 +03:00
|
|
|
dnl #
|
|
|
|
dnl # Certain kernel build options are not supported. These must be
|
|
|
|
dnl # detected at configure time and cause a build failure. Otherwise
|
|
|
|
dnl # modules may be successfully built that behave incorrectly.
|
|
|
|
dnl #
|
2012-05-21 23:59:58 +04:00
|
|
|
AC_DEFUN([ZFS_AC_KERNEL_CONFIG], [
|
2015-12-16 19:24:28 +03:00
|
|
|
AS_IF([test "x$cross_compiling" != xyes], [
|
|
|
|
AC_RUN_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
|
|
|
#include "$LINUX/include/linux/license.h"
|
|
|
|
], [
|
|
|
|
return !license_is_gpl_compatible("$ZFS_META_LICENSE");
|
|
|
|
])
|
|
|
|
], [
|
|
|
|
AC_DEFINE([ZFS_IS_GPL_COMPATIBLE], [1],
|
|
|
|
[Define to 1 if GPL-only symbols can be used])
|
2014-10-03 21:58:47 +04:00
|
|
|
], [
|
|
|
|
])
|
2012-05-21 23:59:58 +04:00
|
|
|
])
|
|
|
|
|
2015-12-02 22:53:37 +03:00
|
|
|
ZFS_AC_KERNEL_CONFIG_THREAD_SIZE
|
2012-05-21 23:59:58 +04:00
|
|
|
ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
|
2018-02-16 04:53:18 +03:00
|
|
|
ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS
|
|
|
|
ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE
|
|
|
|
ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE
|
2012-05-21 23:59:58 +04:00
|
|
|
])
|
|
|
|
|
2015-12-02 22:53:37 +03:00
|
|
|
dnl #
|
|
|
|
dnl # Check configured THREAD_SIZE
|
|
|
|
dnl #
|
|
|
|
dnl # The stack size will vary by architecture, but as of Linux 3.15 on x86_64
|
|
|
|
dnl # the default thread stack size was increased to 16K from 8K. Therefore,
|
|
|
|
dnl # on newer kernels and some architectures stack usage optimizations can be
|
|
|
|
dnl # conditionally applied to improve performance without negatively impacting
|
|
|
|
dnl # stability.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_THREAD_SIZE], [
|
|
|
|
AC_MSG_CHECKING([whether kernel was built with 16K or larger stacks])
|
|
|
|
ZFS_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/module.h>
|
|
|
|
],[
|
|
|
|
#if (THREAD_SIZE < 16384)
|
|
|
|
#error "THREAD_SIZE is less than 16K"
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_DEFINE(HAVE_LARGE_STACKS, 1, [kernel has large stacks])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2012-05-21 23:59:58 +04:00
|
|
|
dnl #
|
|
|
|
dnl # Check CONFIG_DEBUG_LOCK_ALLOC
|
|
|
|
dnl #
|
|
|
|
dnl # This is typically only set for debug kernels because it comes with
|
|
|
|
dnl # a performance penalty. However, when it is set it maps the non-GPL
|
|
|
|
dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol.
|
|
|
|
dnl # This will cause a failure at link time which we'd rather know about
|
|
|
|
dnl # at compile time.
|
|
|
|
dnl #
|
|
|
|
dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol
|
|
|
|
dnl # with the upstream community we add a check to detect this case.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
|
|
|
|
|
|
|
|
ZFS_LINUX_CONFIG([DEBUG_LOCK_ALLOC], [
|
|
|
|
AC_MSG_CHECKING([whether mutex_lock() is GPL-only])
|
|
|
|
tmp_flags="$EXTRA_KCFLAGS"
|
|
|
|
ZFS_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
|
|
|
|
MODULE_LICENSE("$ZFS_META_LICENSE");
|
|
|
|
],[
|
|
|
|
struct mutex lock;
|
|
|
|
|
|
|
|
mutex_init(&lock);
|
|
|
|
mutex_lock(&lock);
|
|
|
|
mutex_unlock(&lock);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
|
2012-06-05 23:45:37 +04:00
|
|
|
*** with the CDDL license and will prevent the module linking stage
|
|
|
|
*** from succeeding. You must rebuild your kernel without this
|
|
|
|
*** option enabled.])
|
2012-05-21 23:59:58 +04:00
|
|
|
])
|
|
|
|
EXTRA_KCFLAGS="$tmp_flags"
|
|
|
|
], [])
|
2010-08-26 22:22:58 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
2018-02-16 04:53:18 +03:00
|
|
|
dnl # Check CONFIG_TRIM_UNUSED_KSYMS
|
|
|
|
dnl #
|
|
|
|
dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [
|
|
|
|
AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
|
|
|
|
ZFS_LINUX_TRY_COMPILE([
|
|
|
|
#if defined(CONFIG_TRIM_UNUSED_KSYMS)
|
|
|
|
#error CONFIG_TRIM_UNUSED_KSYMS not defined
|
|
|
|
#endif
|
|
|
|
],[ ],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
2019-06-05 04:12:16 +03:00
|
|
|
AS_IF([test "x$enable_linux_builtin" != xyes], [
|
|
|
|
AC_MSG_ERROR([
|
2018-02-16 04:53:18 +03:00
|
|
|
*** This kernel has unused symbols trimming enabled, please disable.
|
|
|
|
*** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
|
2019-06-05 04:12:16 +03:00
|
|
|
])])
|
2018-02-16 04:53:18 +03:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
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 21:54:48 +04:00
|
|
|
dnl # ZFS_LINUX_CONFTEST_H
|
2010-08-26 22:22:58 +04:00
|
|
|
dnl #
|
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 21:54:48 +04:00
|
|
|
AC_DEFUN([ZFS_LINUX_CONFTEST_H], [
|
|
|
|
cat - <<_ACEOF >conftest.h
|
|
|
|
$1
|
|
|
|
_ACEOF
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_CONFTEST_C
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_CONFTEST_C], [
|
2010-08-26 22:22:58 +04:00
|
|
|
cat confdefs.h - <<_ACEOF >conftest.c
|
|
|
|
$1
|
|
|
|
_ACEOF
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LANG_PROGRAM(C)([PROLOGUE], [BODY])
|
|
|
|
dnl #
|
|
|
|
m4_define([ZFS_LANG_PROGRAM], [
|
|
|
|
$1
|
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
dnl Do *not* indent the following line: there may be CPP directives.
|
|
|
|
dnl Don't move the `;' right after for the same reason.
|
|
|
|
$2
|
|
|
|
;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [
|
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 21:54:48 +04:00
|
|
|
m4_ifvaln([$1], [ZFS_LINUX_CONFTEST_C([$1])])
|
|
|
|
m4_ifvaln([$6], [ZFS_LINUX_CONFTEST_H([$6])], [ZFS_LINUX_CONFTEST_H([])])
|
Fake modpost stage for LINUX_COMPILE.
Currently, when building a test case, we're compiling an entire Linux
module from beginning to end. This includes the MODPOST stage, which
generates a "conftest.mod.c" file with some boilerplate module
declaration code.
This poses a problem when configuring for built-in on kernels which have
loadable module support disabled. In this case conftest.mod.c is
referencing disabled code, resulting in a compilation failure, thus
breaking the tests.
This patch fixes the issue by faking the modpost stage when the
--enable-linux-builtin option is provided. It does so by forcing the
modpost command to be /bin/true, and using an empty conftest.mod.c file.
The test module still compiles fine, although the result isn't loadable,
but we don't really care at this point.
Note it is important to preserve the modpost stage when building out of
tree. The ZFS_AC_KERNEL_BLK_END_REQUEST, ZFS_AC_KERNEL_BLK_QUEUE_FLUSH,
and ZFS_AC_KERNEL_BLK_RQ_BYTES configure checks all depend on it to
identify GPL-only symbols.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #851
2012-07-16 11:37:38 +04:00
|
|
|
rm -Rf build && mkdir -p build && touch build/conftest.mod.c
|
2010-08-26 22:22:58 +04:00
|
|
|
echo "obj-m := conftest.o" >build/Makefile
|
Fake modpost stage for LINUX_COMPILE.
Currently, when building a test case, we're compiling an entire Linux
module from beginning to end. This includes the MODPOST stage, which
generates a "conftest.mod.c" file with some boilerplate module
declaration code.
This poses a problem when configuring for built-in on kernels which have
loadable module support disabled. In this case conftest.mod.c is
referencing disabled code, resulting in a compilation failure, thus
breaking the tests.
This patch fixes the issue by faking the modpost stage when the
--enable-linux-builtin option is provided. It does so by forcing the
modpost command to be /bin/true, and using an empty conftest.mod.c file.
The test module still compiles fine, although the result isn't loadable,
but we don't really care at this point.
Note it is important to preserve the modpost stage when building out of
tree. The ZFS_AC_KERNEL_BLK_END_REQUEST, ZFS_AC_KERNEL_BLK_QUEUE_FLUSH,
and ZFS_AC_KERNEL_BLK_RQ_BYTES configure checks all depend on it to
identify GPL-only symbols.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #851
2012-07-16 11:37:38 +04:00
|
|
|
modpost_flag=''
|
|
|
|
test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
|
2010-08-26 22:22:58 +04:00
|
|
|
AS_IF(
|
2018-02-15 23:58:23 +03:00
|
|
|
[AC_TRY_COMMAND(cp conftest.c conftest.h build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $FRAME_LARGER_THAN $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
|
2010-08-26 22:22:58 +04:00
|
|
|
[$4],
|
|
|
|
[_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
|
|
|
|
)
|
|
|
|
rm -Rf build
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_TRY_COMPILE like AC_TRY_COMPILE
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TRY_COMPILE],
|
|
|
|
[ZFS_LINUX_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_SOURCE([ZFS_LANG_PROGRAM([[$1]], [[$2]])])],
|
|
|
|
[modules],
|
|
|
|
[test -s build/conftest.o],
|
|
|
|
[$3], [$4])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_CONFIG
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_CONFIG],
|
2015-12-02 22:53:37 +03:00
|
|
|
[AC_MSG_CHECKING([whether kernel was built with CONFIG_$1])
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_LINUX_TRY_COMPILE([
|
2011-07-23 01:10:38 +04:00
|
|
|
#include <linux/module.h>
|
2010-08-26 22:22:58 +04:00
|
|
|
],[
|
|
|
|
#ifndef CONFIG_$1
|
|
|
|
#error CONFIG_$1 not #defined
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
$2
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
$3
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_CHECK_SYMBOL_EXPORT
|
|
|
|
dnl # check symbol exported or not
|
|
|
|
dnl #
|
2012-07-26 01:38:58 +04:00
|
|
|
AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], [
|
2010-08-26 22:22:58 +04:00
|
|
|
grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
|
|
|
|
$LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null
|
|
|
|
rc=$?
|
2012-07-26 01:38:58 +04:00
|
|
|
if test $rc -ne 0; then
|
2010-08-26 22:22:58 +04:00
|
|
|
export=0
|
|
|
|
for file in $2; do
|
2012-07-26 01:38:58 +04:00
|
|
|
grep -q -E "EXPORT_SYMBOL.*($1)" \
|
|
|
|
"$LINUX/$file" 2>/dev/null
|
2010-08-26 22:22:58 +04:00
|
|
|
rc=$?
|
2012-07-26 01:38:58 +04:00
|
|
|
if test $rc -eq 0; then
|
2011-08-24 20:52:16 +04:00
|
|
|
export=1
|
|
|
|
break;
|
2012-07-26 01:38:58 +04:00
|
|
|
fi
|
2010-08-26 22:22:58 +04:00
|
|
|
done
|
2012-07-26 01:38:58 +04:00
|
|
|
if test $export -eq 0; then :
|
2010-08-26 22:22:58 +04:00
|
|
|
$4
|
2012-07-26 01:38:58 +04:00
|
|
|
else :
|
2010-08-26 22:22:58 +04:00
|
|
|
$3
|
2012-07-26 01:38:58 +04:00
|
|
|
fi
|
|
|
|
else :
|
2010-08-26 22:22:58 +04:00
|
|
|
$3
|
2012-07-26 01:38:58 +04:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_TRY_COMPILE_SYMBOL
|
|
|
|
dnl # like ZFS_LINUX_TRY_COMPILE, except ZFS_CHECK_SYMBOL_EXPORT
|
|
|
|
dnl # is called if not compiling for builtin
|
|
|
|
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 22:22:58 +04: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 21:54:48 +04: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 #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER],
|
|
|
|
[ZFS_LINUX_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_SOURCE([ZFS_LANG_PROGRAM([[$1]], [[$2]])])],
|
|
|
|
[modules],
|
|
|
|
[test -s build/conftest.o],
|
2014-12-16 00:53:00 +03:00
|
|
|
[$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 21:54:48 +04:00
|
|
|
])
|