aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_ktr.c
Commit message (Collapse)AuthorAgeFilesLines
* - Change the ddb paging "support" to use a variable (db_lines_per_page) toJohn Baldwin2004-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | control the number of lines per page rather than a constant. The variable can be examined and changed in ddb as '$lines'. Setting the variable to 0 will effectively turn off paging. - Change db_putchar() to force out pending whitespace before outputting newlines and carriage returns so that one can rub out content on the current line via '\r \r' type strings. - Change the simple pager to rub out the --More-- prompt explicitly when the routine exits. - Add some aliases to the simple pager to make it more compatible with more(1): 'e' and 'j' do a single line. 'd' does half a page, and 'f' does a full page. MFC after: 1 month Inspired by: kris Notes: svn path=/head/; revision=137117
* Remove unused macro.John Baldwin2004-09-201-2/+0
| | | | Notes: svn path=/head/; revision=135528
* Export KTR_COMPILE as a sysctl so you can easily check from user spaceRobert Watson2004-07-231-0/+3
| | | | | | | what event mask has been compiled into the kernel. Notes: svn path=/head/; revision=132583
* Update the license on this file to be a bit more sane.John Baldwin2003-09-101-13/+13
| | | | Notes: svn path=/head/; revision=119936
* Both 'c' an 'lines' are unused, the bogus init of lines was accidentallyJohn Baldwin2003-08-021-2/+1
| | | | | | | left behind. Notes: svn path=/head/; revision=118362
* Fix kernel build -- 'c' was the unused var, not 'lines'.David E. O'Brien2003-08-011-1/+1
| | | | Notes: svn path=/head/; revision=118311
* Update the 'ps', 'show pci', and 'show ktr' ddb commands to use the newJohn Baldwin2003-07-311-23/+11
| | | | | | | pager callout instead of homerolling their own paging facility. Notes: svn path=/head/; revision=118269
* Add an explicit credential argument to alq_open() to allow the caller toRobert Watson2003-06-221-2/+3
| | | | | | | | | | | | | | specify what credential to use when authorizing vn_open() and later write operations, rather than curthread->td_ucred. When writing KTR traces to an ALQ, specify the credential of the thread generating the sysctl request. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=116697
* Use __FBSDID().David E. O'Brien2003-06-111-2/+3
| | | | Notes: svn path=/head/; revision=116182
* - Add a td_pflags field to struct thread for private flags accessed only byJohn Baldwin2003-06-091-3/+3
| | | | | | | | | | | curthread. Unlike td_flags, this field does not need any locking. - Replace the td_inktr and td_inktrace variables with equivalent private thread flags. - Move TDF_OLDMASK over to the private flags field so it no longer requires sched_lock. Notes: svn path=/head/; revision=116101
* Move the flag that indicates an idle thread from the KSE to the thread.Julian Elischer2003-05-021-1/+1
| | | | | | | | | It was always referenced via the thread anyhow. Reviewed by: jhb (a LOOOOONG time ago) Notes: svn path=/head/; revision=114471
* Trim leading "../" sequences from filenames.John Baldwin2003-03-111-0/+3
| | | | Notes: svn path=/head/; revision=112105
* Add a /a modifier to the show ktr ddb command, which prints the whole traceJake Burkholder2003-02-221-1/+7
| | | | | | | | buffer without stopping. Useful if you just want to capture the output but can't run ktrdump. Notes: svn path=/head/; revision=111270
* - Export the alq daemon thread pointer.Jeff Roberson2002-09-261-1/+2
| | | | | | | - Don't log ktr events from the alq daemon. Notes: svn path=/head/; revision=103995
* - Add support for logging KTR via ALQ. This is optional and enabled by theJeff Roberson2002-09-221-3/+92
| | | | | | | KTR_ALQ config option. Notes: svn path=/head/; revision=103787
* Remove a stale comment.Jake Burkholder2002-04-061-4/+0
| | | | Notes: svn path=/head/; revision=93951
* Include machine/ktr.h for sparc64 so we pick up KTR_CPU.Jake Burkholder2002-04-061-0/+3
| | | | Notes: svn path=/head/; revision=93950
* ktr changes to improve performance and make writing a userland utility toJake Burkholder2002-04-011-70/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | dump the trace buffer feasible. - Remove KTR_EXTEND. This changes the format of the trace entries when activated, making writing a userland tool which is not tied to a specific kernel configuration difficult. - Use get_cyclecount() for timestamps. nanotime() is much too heavy weight and requires recursion protection due to ktr traces occuring as a result of ktr traces. KTR_VERBOSE may still require recursion protection, which is now conditional on it. - Allow KTR_CPU to be overridden by MD code. This is so that it is possible to trace early in startup before pcpu and/or curthread are setup. - Add a version number for the ktr interface. A userland tool can check this to detect mismatches. - Use an array for the parameters to make decoding in userland easier. - Add file and line recording to the non-extended traces now that the extended version is no more. These changes will break gdb macros to decode the extended version of the trace buffer which are floating around. Users of these macros should either use the show ktr command in ddb, or use the userland utility which can be run on a core dump. Approved by: jhb Tested on: i386, sparc64 Notes: svn path=/head/; revision=93503
* Read KTR_CPU into a temporary variable so that we use a consistent valueJohn Baldwin2002-03-081-7/+4
| | | | | | | | for both the cpumask check and the cpu entry field w/o needing to use a critical section. Notes: svn path=/head/; revision=91904
* Print parm6 too in the !KTR_EXTEND case.Jake Burkholder2002-01-011-1/+1
| | | | Notes: svn path=/head/; revision=88793
* Modify the critical section API as follows:John Baldwin2001-12-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | - The MD functions critical_enter/exit are renamed to start with a cpu_ prefix. - MI wrapper functions critical_enter/exit maintain a per-thread nesting count and a per-thread critical section saved state set when entering a critical section while at nesting level 0 and restored when exiting to nesting level 0. This moves the saved state out of spin mutexes so that interlocking spin mutexes works properly. - Most low-level MD code that used critical_enter/exit now use cpu_critical_enter/exit. MI code such as device drivers and spin mutexes use the MI wrappers. Note that since the MI wrappers store the state in the current thread, they do not have any return values or arguments. - mtx_intr_enable() is replaced with a constant CRITICAL_FORK which is assigned to curthread->td_savecrit during fork_exit(). Tested on: i386, alpha Notes: svn path=/head/; revision=88088
* Use a per-thread variable for keeping state when a thread is processingJohn Baldwin2001-12-131-10/+8
| | | | | | | | | | | a KTR log entry. Any KTR requests made while working on an entry are ignored/discarded to prevent recursion. This is a better fix for the hack to futz with the CPU mask and call getnanotime() if KTR_LOCK or KTR_WITNESS was on. It also covers the actual formatting of the log entry including dumping it to the display which the earlier hacks did not. Notes: svn path=/head/; revision=87793
* Overhaul the per-CPU support a bit:John Baldwin2001-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - The MI portions of struct globaldata have been consolidated into a MI struct pcpu. The MD per-CPU data are specified via a macro defined in machine/pcpu.h. A macro was chosen over a struct mdpcpu so that the interface would be cleaner (PCPU_GET(my_md_field) vs. PCPU_GET(md.md_my_md_field)). - All references to globaldata are changed to pcpu instead. In a UP kernel, this data was stored as global variables which is where the original name came from. In an SMP world this data is per-CPU and ideally private to each CPU outside of the context of debuggers. This also included combining machine/globaldata.h and machine/globals.h into machine/pcpu.h. - The pointer to the thread using the FPU on i386 was renamed from npxthread to fpcurthread to be identical with other architectures. - Make the show pcpu ddb command MI with a MD callout to display MD fields. - The globaldata_register() function was renamed to pcpu_init() and now init's MI fields of a struct pcpu in addition to registering it with the internal array and list. - A pcpu_destroy() function was added to remove a struct pcpu from the internal array and list. Tested on: alpha, i386 Reviewed by: peter, jake Notes: svn path=/head/; revision=87702
* Missed an assignment of arg6 in previous commit.David E. O'Brien2001-12-101-0/+1
| | | | Notes: svn path=/head/; revision=87627
* Adjust for the addition of CTR6.David E. O'Brien2001-12-101-1/+1
| | | | Notes: svn path=/head/; revision=87622
* - Replace the unused KTR_IDLELOOP trace class with a new KTR_WITNESS traceJohn Baldwin2001-06-251-14/+17
| | | | | | | | | | | | | | | | | class to trace witness events. - Make the ktr_cpu field of ktr_entry be a standard field rather than one present only in the KTR_EXTEND case. - Move the default definition of KTR_ENTRIES from sys/ktr.h to kern/kern_ktr.c. It has not been needed in the header file since KTR was un-inlined. - Minor include cleanup in kern/kern_ktr.c. - Fiddle with the ktr_cpumask in ktr_tracepoint() to disable KTR events on the current CPU while we are processing an event. - Set the current CPU inside of the critical section to ensure we don't migrate CPU's after the critical section but before we set the CPU. Notes: svn path=/head/; revision=78784
* With this commit, I hereby pronounce gensetdefs past its use-by date.Peter Wemm2001-06-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the a.out emulation of 'struct linker_set' with something a little more flexible. <sys/linker_set.h> now provides macros for accessing elements and completely hides the implementation. The linker_set.h macros have been on the back burner in various forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()), John Polstra (ELF clue) and myself (cleaned up API and the conversion of the rest of the kernel to use it). The macros declare a strongly typed set. They return elements with the type that you declare the set with, rather than a generic void *. For ELF, we use the magic ld symbols (__start_<setname> and __stop_<setname>). Thanks to Richard Henderson <rth@redhat.com> for the trick about how to force ld to provide them for kld's. For a.out, we use the old linker_set struct. NOTE: the item lists are no longer null terminated. This is why the code impact is high in certain areas. The runtime linker has a new method to find the linker set boundaries depending on which backend format is in use. linker sets are still module/kld unfriendly and should never be used for anything that may be modular one day. Reviewed by: eivind Notes: svn path=/head/; revision=78161
* "Fix" the previous initial attempt at fixing TUNABLE_INT(). This timePeter Wemm2001-06-081-3/+3
| | | | | | | | | | around, use a common function for looking up and extracting the tunables from the kernel environment. This saves duplicating the same function over and over again. This way typically has an overhead of 8 bytes + the path string, versus about 26 bytes + the path string. Notes: svn path=/head/; revision=77900
* Back out part of my previous commit. This was a last minute changePeter Wemm2001-06-071-3/+3
| | | | | | | | and I botched testing. This is a perfect example of how NOT to do this sort of thing. :-( Notes: svn path=/head/; revision=77853
* Make the TUNABLE_*() macros look and behave more consistantly like thePeter Wemm2001-06-061-6/+6
| | | | | | | | SYSCTL_*() macros. TUNABLE_INT_DECL() was an odd name because it didn't actually declare the int, which is what the name suggests it would do. Notes: svn path=/head/; revision=77843
* Switch from save/disable/restore_intr() to critical_enter/exit().John Baldwin2001-03-281-4/+4
| | | | Notes: svn path=/head/; revision=74903
* - In the KTR_EXTEND case, use a const char * to point to the passed inJohn Baldwin2001-02-201-5/+5
| | | | | | | | | filename insteada of copying the first 32 characters of it. - Add in const modifiers for the passed in format strings and filenames and their respective members in the ktr_entry struct. Notes: svn path=/head/; revision=72761
* - Abolish the 'show ktr_first' and 'show ktr_next' commands.John Baldwin2001-02-201-40/+38
| | | | | | | | | - Add pager capability to the 'show ktr' command. It functions much like 'ps': Enter at the prompt displays one more entry, Space displays another page, and any other key quits. Notes: svn path=/head/; revision=72755
* Work around some sizeof(long) != sizeof(int) bogons.John Baldwin2001-02-091-1/+1
| | | | Notes: svn path=/head/; revision=72250
* Change the ktr ddb commands to be show commands. The commands are now asJohn Baldwin2001-02-091-4/+4
| | | | | | | | | | | | | | follows: - show ktr_first display the first entry - show ktr_next display the next entry - show ktr display the entire buffer The /v modifiers continue to work as described previously. Requested by: bde Notes: svn path=/head/; revision=72223
* Use PCPU_GET, PCPU_PTR and PCPU_SET to access all per-cpu variablesJake Burkholder2001-01-101-1/+1
| | | | | | | other then curproc. Notes: svn path=/head/; revision=70861
* - Move all of the KTR sysctl's under a new debug.ktr mib.John Baldwin2001-01-061-17/+26
| | | | | | | | | | - Provide TUNABLE_INT() hooks for ktr_cpumask, ktr_mask, and ktr_verbose so that they can be set from the loader by their respective sysctl names. For example, to turn on KTR_INTR and KTR_PROC in ktr_mask, one could stick 'debug.ktr.mask="0x1200"' in /boot/loader.conf. Notes: svn path=/head/; revision=70705
* Partially revert revision 1.7: Only use getnanotime instead ofGreg Lehey2000-12-291-1/+9
| | | | | | | | | | nanotime if we would run into trouble with nanotime (i.e. if we are tracing KTR_LOCK). Reviewed by: jhb Notes: svn path=/head/; revision=70464
* Add in MI implementations of the KTR trace buffer ddb commands. TheJohn Baldwin2000-12-151-0/+97
| | | | | | | | | | | | | | | | | | commands have also been slightly updated as follows: - Use ktr_idx to find the newest entry rather than walking the buffer comparing timespecs. Timespecs are not always unique after the change to use getnanotime(9). - Add a new verbose setting. When the verbose setting is on, then the timestamp is printed with each message. If KTR_EXTEND is on, then the filename and line number are output as well. By default this option is off. It can be turned on with the 'v' modifier passed to the 'tbuf' and 'tall' commands. For the 'tnext' command, the 'v' modifier toggles the verbose mode. - Only display the cpu number for each message on SMP systems. - Don't display anything for an empty entry that hasn't been used yet. Notes: svn path=/head/; revision=70035
* - Don't bother taking a trace message if we have panic'd since doing soJohn Baldwin2000-12-121-1/+3
| | | | | | | | | | | | | | can lead to further panics. - Call getnanotime() instead of nanotime() for the timestamp. nanotime() is more precise, but it also calls into the timer code, which results in mutex operations on the i386 arch. If KTR_LOCK is turned on, then ktr_tracepoint() recurses on itself until it exhausts the kernel stack. Eventually this should change to use get_cyclecount() instead, but that can't happen if get_cyclecount() is calling nanotime() instead of getnanotime(). Notes: svn path=/head/; revision=69880
* Ahem, fix the disclaimer portion of the copyright so it disclaim's theJohn Baldwin2000-11-211-2/+2
| | | | | | | | | | voices in my head. You can sue the voices in Bill Paul's head all you want. Noticed by: jhb Notes: svn path=/head/; revision=69012
* Make ktr_verbose a bit more useful:John Baldwin2000-11-151-0/+5
| | | | | | | | | - On SMP systems display the cpu number with each message - If ktr_verbose > 1, then include the filename and line number with each trace message Notes: svn path=/head/; revision=68782
* Don't overwrite the filename for KTR_EXTEND with "../../kern/kern_ktr.c".John Baldwin2000-11-101-1/+0
| | | | Notes: svn path=/head/; revision=68587
* Fix SMP kernel compiles by #include'ing machine/globals.h to get theJohn Baldwin2000-11-101-0/+1
| | | | | | | cpuid variable. Notes: svn path=/head/; revision=68584
* - Remove much of the inlining of the KTR tracepoints into a ktr_tracepoint()John Baldwin2000-11-071-2/+86
| | | | | | | | | | | | | | | | | | | | | function declared in kern_ktr.c. The only inline checks left are the checks that compare KTR_COMPILE with the supplied mask and thus should be optimized away into either nothing or a direct call to ktr_tracepoint(). - Move several KTR-related options to opt_ktr.h now that they are only needed by kern_ktr.c and not by ktr.h. - Add in the ktr_verbose functionality if KTR_EXTEND is turned on. If the global variable 'ktr_verbose' is non-zero, then KTR messages will be dumped to the console. This variable can be set by either kernel code or via the 'debug.ktr_verbose' sysctl. It defaults to off unless the KTR_VERBOSE kernel option is specified in which case it defaults to on. This can be useful when the machine locks up spinning in a loop with interrupts disabled as you might be able to see what it is doing when it locks up. Requested by: phk Notes: svn path=/head/; revision=68420
* Add KTR, a facility that logs kernel events in order to to facilitateJason Evans2000-09-071-0/+64
debugging. Acquired from: BSDi (BSD/OS) Submitted by: dfr, grog, jake, jhb Notes: svn path=/head/; revision=65556