Module Name: src Committed By: pgoyette Date: Sat Oct 28 00:37:14 UTC 2017
Modified Files: src/share/man/man9: kernhist.9 src/sys/arch/acorn26/acorn26: pmap.c src/sys/arch/arm/arm32: fault.c pmap.c src/sys/arch/arm/broadcom: bcm2835_bsc.c src/sys/arch/arm/omap: if_cpsw.c tiotg.c src/sys/dev/ic: sl811hs.c src/sys/dev/usb: ehci.c if_axe.c motg.c ohci.c ucom.c uhci.c uhub.c umass.c umass_quirks.c umass_scsipi.c usb.c usb_mem.c usb_subr.c usbdi.c usbdi_util.c usbroothub.c xhci.c src/sys/external/bsd/drm2/dist/drm/i915: i915_gem.c src/sys/kern: kern_history.c kern_xxx.c vfs_bio.c src/sys/miscfs/genfs: genfs_io.c src/sys/sys: kernhist.h src/sys/ufs/ffs: ffs_balloc.c src/sys/ufs/lfs: lfs_vfsops.c ulfs_inode.c ulfs_vnops.c src/sys/ufs/ufs: ufs_inode.c ufs_vnops.c src/sys/uvm: uvm_amap.c uvm_anon.c uvm_aobj.c uvm_bio.c uvm_device.c uvm_fault.c uvm_km.c uvm_loan.c uvm_map.c uvm_page.c uvm_pager.c uvm_pdaemon.c uvm_swap.c uvm_vnode.c src/sys/uvm/pmap: pmap.c pmap_tlb.c src/usr.bin/vmstat: vmstat.c Log Message: Update the kernhist(9) kernel history code to address issues identified in PR kern/52639, as well as some general cleaning-up... (As proposed on tech-kern@ with additional changes and enhancements.) Details of changes: * All history arguments are now stored as uintmax_t values[1], both in the kernel and in the structures used for exporting the history data to userland via sysctl(9). This avoids problems on some architectures where passing a 64-bit (or larger) value to printf(3) can cause it to process the value as multiple arguments. (This can be particularly problematic when printf()'s format string is not a literal, since in that case the compiler cannot know how large each argument should be.) * Update the data structures used for exporting kernel history data to include a version number as well as the length of history arguments. * All [2] existing users of kernhist(9) have had their format strings updated. Each format specifier now includes an explicit length modifier 'j' to refer to numeric values of the size of uintmax_t. * All [2] existing users of kernhist(9) have had their format strings updated to replace uses of "%p" with "%#jx", and the pointer arguments are now cast to (uintptr_t) before being subsequently cast to (uintmax_t). This is needed to avoid compiler warnings about casting "pointer to integer of a different size." * All [2] existing users of kernhist(9) have had instances of "%s" or "%c" format strings replaced with numeric formats; several instances of mis-match between format string and argument list have been fixed. * vmstat(1) has been modified to handle the new size of arguments in the history data as exported by sysctl(9). * vmstat(1) now provides a warning message if the history requested with the -u option does not exist (previously, this condition was silently ignored, with only a single blank line being printed). * vmstat(1) now checks the version and argument length included in the data exported via sysctl(9) and exits if they do not match the values with which vmstat was built. * The kernhist(9) man-page has been updated to note the additional requirements imposed on the format strings, along with several other minor changes and enhancements. [1] It would have been possible to use an explicit length (for example, uint64_t) for the history arguments. But that would require another "rototill" of all the users in the future when we add support for an architecture that supports a larger size. Also, the printf(3) format specifiers for explicitly-sized values, such as "%"PRIu64, are much more verbose (and less aesthetically appealing, IMHO) than simply using "%ju". [2] I've tried very hard to find "all [the] existing users of kernhist(9)" but it is possible that I've missed some of them. I would be glad to update any stragglers that anyone identifies. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/share/man/man9/kernhist.9 cvs rdiff -u -r1.38 -r1.39 src/sys/arch/acorn26/acorn26/pmap.c cvs rdiff -u -r1.104 -r1.105 src/sys/arch/arm/arm32/fault.c cvs rdiff -u -r1.358 -r1.359 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/broadcom/bcm2835_bsc.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/omap/if_cpsw.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/tiotg.c cvs rdiff -u -r1.97 -r1.98 src/sys/dev/ic/sl811hs.c cvs rdiff -u -r1.255 -r1.256 src/sys/dev/usb/ehci.c cvs rdiff -u -r1.82 -r1.83 src/sys/dev/usb/if_axe.c cvs rdiff -u -r1.17 -r1.18 src/sys/dev/usb/motg.c cvs rdiff -u -r1.273 -r1.274 src/sys/dev/usb/ohci.c cvs rdiff -u -r1.118 -r1.119 src/sys/dev/usb/ucom.c cvs rdiff -u -r1.276 -r1.277 src/sys/dev/usb/uhci.c cvs rdiff -u -r1.136 -r1.137 src/sys/dev/usb/uhub.c cvs rdiff -u -r1.159 -r1.160 src/sys/dev/usb/umass.c cvs rdiff -u -r1.99 -r1.100 src/sys/dev/usb/umass_quirks.c cvs rdiff -u -r1.54 -r1.55 src/sys/dev/usb/umass_scsipi.c cvs rdiff -u -r1.167 -r1.168 src/sys/dev/usb/usb.c cvs rdiff -u -r1.69 -r1.70 src/sys/dev/usb/usb_mem.c \ src/sys/dev/usb/usbdi_util.c cvs rdiff -u -r1.220 -r1.221 src/sys/dev/usb/usb_subr.c cvs rdiff -u -r1.174 -r1.175 src/sys/dev/usb/usbdi.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/usb/usbroothub.c cvs rdiff -u -r1.74 -r1.75 src/sys/dev/usb/xhci.c cvs rdiff -u -r1.33 -r1.34 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c cvs rdiff -u -r1.14 -r1.15 src/sys/kern/kern_history.c cvs rdiff -u -r1.73 -r1.74 src/sys/kern/kern_xxx.c cvs rdiff -u -r1.275 -r1.276 src/sys/kern/vfs_bio.c cvs rdiff -u -r1.70 -r1.71 src/sys/miscfs/genfs/genfs_io.c cvs rdiff -u -r1.20 -r1.21 src/sys/sys/kernhist.h cvs rdiff -u -r1.62 -r1.63 src/sys/ufs/ffs/ffs_balloc.c cvs rdiff -u -r1.360 -r1.361 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.20 -r1.21 src/sys/ufs/lfs/ulfs_inode.c cvs rdiff -u -r1.51 -r1.52 src/sys/ufs/lfs/ulfs_vnops.c cvs rdiff -u -r1.101 -r1.102 src/sys/ufs/ufs/ufs_inode.c cvs rdiff -u -r1.238 -r1.239 src/sys/ufs/ufs/ufs_vnops.c cvs rdiff -u -r1.107 -r1.108 src/sys/uvm/uvm_amap.c cvs rdiff -u -r1.63 -r1.64 src/sys/uvm/uvm_anon.c cvs rdiff -u -r1.125 -r1.126 src/sys/uvm/uvm_aobj.c cvs rdiff -u -r1.90 -r1.91 src/sys/uvm/uvm_bio.c cvs rdiff -u -r1.65 -r1.66 src/sys/uvm/uvm_device.c cvs rdiff -u -r1.200 -r1.201 src/sys/uvm/uvm_fault.c cvs rdiff -u -r1.143 -r1.144 src/sys/uvm/uvm_km.c cvs rdiff -u -r1.84 -r1.85 src/sys/uvm/uvm_loan.c cvs rdiff -u -r1.352 -r1.353 src/sys/uvm/uvm_map.c cvs rdiff -u -r1.193 -r1.194 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.110 -r1.111 src/sys/uvm/uvm_pager.c cvs rdiff -u -r1.108 -r1.109 src/sys/uvm/uvm_pdaemon.c cvs rdiff -u -r1.174 -r1.175 src/sys/uvm/uvm_swap.c cvs rdiff -u -r1.102 -r1.103 src/sys/uvm/uvm_vnode.c cvs rdiff -u -r1.36 -r1.37 src/sys/uvm/pmap/pmap.c cvs rdiff -u -r1.21 -r1.22 src/sys/uvm/pmap/pmap_tlb.c cvs rdiff -u -r1.218 -r1.219 src/usr.bin/vmstat/vmstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.