History log of /src/sys/kern/kern_history.c |
Revision | | Date | Author | Comments |
1.19 |
| 09-Oct-2019 |
skrll | Traiing whitespace
|
1.18 |
| 03-Sep-2018 |
riastradh | Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended.
HOWEVER! Some subsystems have
#define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b))
even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation.
To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it.
I have left a handful of bootloaders that are too annoying to compile-test, and some dead code:
cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4))
It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them.
Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
|
1.17 |
| 13-Aug-2018 |
mrg | extend the ddb "show kernhist" command. the synopsis is now:
show kernhist[/i] [addr[,count]]
the i modifier means display info instead of entries, and the count restricts to the last count entries.
the count option is only supported for specified histories. it could be extended but requires more logic than the single history, as multiple histories are merged during display.
|
1.16 |
| 03-Nov-2017 |
pgoyette | branches: 1.16.2; 1.16.4; Remove the ABI version-and-length check that was recently introduced; sysctl(9) ABIs should be stable across versions.
XXX Pull-up to -8
|
1.15 |
| 28-Oct-2017 |
pgoyette | 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.
|
1.14 |
| 10-Jan-2017 |
pgoyette | branches: 1.14.8; Use membar_{producer,consumer}() to ensure proper access to the "ready" flag.
|
1.13 |
| 10-Jan-2017 |
pgoyette | Rework the sysctl initialization to avoid creating new nodes from within the helper function. This should avoid the "locking against myself" error reported earlier.
|
1.12 |
| 08-Jan-2017 |
christos | fix build without ddb.
|
1.11 |
| 05-Jan-2017 |
pgoyette | By popular demand, update kernhist to use bintime(9) as the basis for its timestamps.
As this changes storage structures for data passed between kernel and userland, welcome to 7.99.55!
XXX Output routines still use microsecond resolution when printf()ing.
XXX Possible future feature would be addition of option to use XXX getbintime(9) for less time-critical histories.
|
1.10 |
| 04-Jan-2017 |
pgoyette | Rearrange the sysctl export structure for better alignment.
|
1.9 |
| 01-Jan-2017 |
pgoyette | Provide a sysctl method of exporting the kernel history data.
XXX vmstat will be update soon to use the sysctl rather than grovelling XXX through kvm.
|
1.8 |
| 26-Dec-2016 |
pgoyette | #include giohist.h from proper location
|
1.7 |
| 26-Dec-2016 |
pgoyette | Add a BIOHIST option. As mentioned on tech-kern.
|
1.6 |
| 23-Jun-2016 |
skrll | branches: 1.6.2; Fix UVMHIST builds for kernels that don't include usb
|
1.5 |
| 22-Jun-2016 |
skrll | KNF . Sort includes
|
1.4 |
| 06-Apr-2016 |
skrll | Improve ddb(4) show kernhist
1) really prints all the histories merged together (rather than just the "first" when no argument specified 2) dumps a single history when an argument is given, e.g. "show kernhist usbhist" 3) uses db_printf correctly
|
1.3 |
| 29-Oct-2015 |
mrg | if NUSB == 0, don't look for usbhist.
|
1.2 |
| 29-Oct-2015 |
mrg | introduce a new way of handling SYSCALL_DEBUG messages -- send them to a kernel history, settable via the SCDEBUG_KERNHIST flag.
this requires a fairly significantly different set of messages than the normal debug as histories are restricted: - each message can take one literal format string and upto 4 arguments - the arguments can not be strings if you want vmstat -u to work (this could be fixed, and i might, as it would be nice if we could print syscall names as well as numbers.)
introduce SCDEBUG_DEFAULT that is settable in the kernel config.
fix a problem in kernhist_dump_histories() where it would crash when a history with no allocated entries was found.
extend kernhist_dumpmask() to handle the usbhist and scdebughist.
|
1.1 |
| 17-May-2011 |
mrg | branches: 1.1.2; 1.1.6; 1.1.18; 1.1.36; move and rename the uvm history code out of uvm_stat to "kernhist".
rename "UVMHIST" option to enable the uvm histories.
TODO: - make UVMHIST properly depend upon KERNHIST - enable dynamic registration of histories. this is mostly just allocating something in a bitmap, and is only for viewing multiple histories in a merged form.
tested on amd64 and sparc64.
|
1.1.36.4 |
| 05-Feb-2017 |
skrll | Sync with HEAD
|
1.1.36.3 |
| 09-Jul-2016 |
skrll | Sync with HEAD
|
1.1.36.2 |
| 06-Apr-2016 |
skrll | Pull across ddb(4) show kernhist updates from HEAD
|
1.1.36.1 |
| 27-Dec-2015 |
skrll | Sync with HEAD (as of 26th Dec)
|
1.1.18.1 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.1.6.2 |
| 06-Jun-2011 |
jruoho | Sync with HEAD.
|
1.1.6.1 |
| 17-May-2011 |
jruoho | file kern_history.c was added on branch jruoho-x86intr on 2011-06-06 09:09:28 +0000
|
1.1.2.2 |
| 31-May-2011 |
rmind | sync with head
|
1.1.2.1 |
| 17-May-2011 |
rmind | file kern_history.c was added on branch rmind-uvmplock on 2011-05-31 03:05:01 +0000
|
1.6.2.2 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.6.2.1 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.14.8.2 |
| 06-Nov-2017 |
snj | Pull up following revision(s) (requested by pgoyette in ticket #343): sys/kern/kern_history.c: revision 1.16 sys/sys/kernhist.h: revision 1.22 usr.bin/vmstat/vmstat.c: revision 1.220 Remove the ABI version-and-length check that was recently introduced; sysctl(9) ABIs should be stable across versions.
|
1.14.8.1 |
| 02-Nov-2017 |
snj | Pull up following revision(s) (requested by pgoyette in ticket #335): share/man/man9/kernhist.9: 1.5-1.8 sys/arch/acorn26/acorn26/pmap.c: 1.39 sys/arch/arm/arm32/fault.c: 1.105 via patch sys/arch/arm/arm32/pmap.c: 1.350, 1.359 sys/arch/arm/broadcom/bcm2835_bsc.c: 1.7 sys/arch/arm/omap/if_cpsw.c: 1.20 sys/arch/arm/omap/tiotg.c: 1.7 sys/arch/evbarm/conf/RPI2_INSTALL: 1.3 sys/dev/ic/sl811hs.c: 1.98 sys/dev/usb/ehci.c: 1.256 sys/dev/usb/if_axe.c: 1.83 sys/dev/usb/motg.c: 1.18 sys/dev/usb/ohci.c: 1.274 sys/dev/usb/ucom.c: 1.119 sys/dev/usb/uhci.c: 1.277 sys/dev/usb/uhub.c: 1.137 sys/dev/usb/umass.c: 1.160-1.162 sys/dev/usb/umass_quirks.c: 1.100 sys/dev/usb/umass_scsipi.c: 1.55 sys/dev/usb/usb.c: 1.168 sys/dev/usb/usb_mem.c: 1.70 sys/dev/usb/usb_subr.c: 1.221 sys/dev/usb/usbdi.c: 1.175 sys/dev/usb/usbdi_util.c: 1.67-1.70 sys/dev/usb/usbroothub.c: 1.3 sys/dev/usb/xhci.c: 1.75 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: 1.34 sys/kern/kern_history.c: 1.15 sys/kern/kern_xxx.c: 1.74 sys/kern/vfs_bio.c: 1.275-1.276 sys/miscfs/genfs/genfs_io.c: 1.71 sys/sys/kernhist.h: 1.21 sys/ufs/ffs/ffs_balloc.c: 1.63 sys/ufs/lfs/lfs_vfsops.c: 1.361 sys/ufs/lfs/ulfs_inode.c: 1.21 sys/ufs/lfs/ulfs_vnops.c: 1.52 sys/ufs/ufs/ufs_inode.c: 1.102 sys/ufs/ufs/ufs_vnops.c: 1.239 sys/uvm/pmap/pmap.c: 1.37-1.39 sys/uvm/pmap/pmap_tlb.c: 1.22 sys/uvm/uvm_amap.c: 1.108 sys/uvm/uvm_anon.c: 1.64 sys/uvm/uvm_aobj.c: 1.126 sys/uvm/uvm_bio.c: 1.91 sys/uvm/uvm_device.c: 1.66 sys/uvm/uvm_fault.c: 1.201 sys/uvm/uvm_km.c: 1.144 sys/uvm/uvm_loan.c: 1.85 sys/uvm/uvm_map.c: 1.353 sys/uvm/uvm_page.c: 1.194 sys/uvm/uvm_pager.c: 1.111 sys/uvm/uvm_pdaemon.c: 1.109 sys/uvm/uvm_swap.c: 1.175 sys/uvm/uvm_vnode.c: 1.103 usr.bin/vmstat/vmstat.c: 1.219 Reorder to test for null before null deref in debug code -- Reorder to test for null before null deref in debug code -- KNF -- No need for '\n' in UVMHIST_LOG -- normalise a BIOHIST 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. -- For some reason this single kernel seems to have outgrown its declared size as a result of the kernhist(9) changes. Bump the size. XXX The amount of increase may be excessive - anyone with more detailed XXX knowledge please feel free to further adjust the value appropriately. -- Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit -- And yet another one. :( -- Use correct mark-up for NetBSD version. -- More improvements in grammar and readability. -- Remove a stray '"' (obvious typo) and add a couple of casts that are probably needed. -- And replace an instance of "%p" conversion with "%#jx" -- Whitespace fix. Give Bl tag table a width. Fix Xr.
|
1.16.4.2 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.16.4.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.16.2.1 |
| 06-Sep-2018 |
pgoyette | Sync with HEAD
Resolve a couple of conflicts (result of the uimin/uimax changes)
|