DTrace cannot get correct values of ZFS tunable variables (e.g. zfs_dirty_data_max, zfs_txg_timeout)

I cannot use the script from ZFS dtrace scripts to print the correct value of zfs_dirty_data_max, and the output is as follows:
Code:
CPU     ID                    FUNCTION:NAME
  2  85224                 none:txg-syncing   41MB of    0MB used
  0  85224                 none:txg-syncing   25MB of    0MB used
  1  85224                 none:txg-syncing   18MB of    0MB used
vfs.zfs.dirty_data_max is
Code:
[fjc@freebsd ~]$ sysctl vfs.zfs.dirty_data_max
vfs.zfs.dirty_data_max: 3426727526
One could reproduce by executing
Code:
pkg install dtrace-toolkit
dtrace -s /usr/local/share/dtrace-toolkit/FS/zfstxgsyncbytes.d zroot
I also checked dtrace(1) output of zfs_txg_timeout,
Code:
[fjc@freebsd ~]$ sudo dtrace -n 'dtrace:::BEGIN {printf("%d\n", `zfs_txg_timeout);}'
dtrace: description 'dtrace:::BEGIN ' matched 1 probe
CPU     ID                    FUNCTION:NAME
  0      1                           :BEGIN 2184337368
It does not match vfs.zfs.txg.timeout either,
Code:
[fjc@freebsd ~]$ sysctl vfs.zfs.txg.timeout
vfs.zfs.txg.timeout: 5
Maybe my usage of dtrace(1) is wrong. Any suggestions?

My FreeBSD version is as below:
Code:
[fjc@freebsd ~]$ freebsd-version -kru
14.0-RELEASE-p6
14.0-RELEASE-p6
14.0-RELEASE-p8
Same error was founded in 14.0, but it's OK in 13.2. Other than dtrace.ko, opensolaris.ko, I see some additional modules loaded automatically in 14.0+ version, e.g.
Code:
dtraceall.ko
systrace.ko
 
After some more investigations, I found it doesn't work in 14.0 and 14.1 but works in 13.2 and 13.3. Reading zfs.ko parameters using dtrace(1), kgdb(1) ( kgdb /boot/kernel/kernel /dev/mem), and sysctl(8) is not always consistent. The results are as follows:

13.213.314.014.1
dtraceOKOKWRONG!WRONG!
kgdbOKOKOKOK
sysctlOKOKOKOK

Until now, this problem is only related to the zfs.ko module. I also checked parameters in the kernel ( kern.threads.max_threads_per_proc/ max_threads_per_proc) and vmm.ko ( hw.vmm.amdvi.ptp_level/ amdvi_ptp_level). These values are consistent among using dtrace(1), kgdb(1) , and sysctl(8) even in 14.0 and 14.1. So I guess the cause is not within dtrace(1). In contrast, the zfs.ko in 14.0+ needs more inspection.
 
Back
Top