summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_ktr.c
Commit message (Collapse)AuthorAgeFilesLines
* Use uint instead of int for flags exported via sysctl.alfred2012-12-071-3/+3
|
* - Implement run-time expansion of the KTR buffer via sysctl.jeff2012-11-151-23/+89
| | | | | | | | | | - Implement a function to ensure that all preempted threads have switched back out at least once. Use this to make sure there are no stale references to the old ktr_buf or the lock profiling buffers before updating them. Reviewed by: marius (sparc64 parts), attilio (earlier patch) Sponsored by: EMC / Isilon Storage Division
* Post r222812 KTR_CPUMASK started being initialized only as a tunableattilio2012-08-301-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | handler and not more statically. Unfortunately, it seems that this is not ideal for new platform bringup and boot low level development (which needs ktr_cpumask to be effective before tunables can be setup). Because of this, add a way to statically initialize cpusets, by passing an list of initializers, divided by commas. Also, provide a way to enforce an all-set mask, for above mentioned initializers. This imposes some differences on how KTR_CPUMASK is setup now as a kernel option, and in particular this makes the words specifications backward wrt. what is currently in -CURRENT. In order to avoid mismatches between KTR_CPUMASK definition and other way to setup the mask (tunable, sysctl) and to print it, change the ordering how cpusetobj_print() and cpusetobj_scan() acquire the words belonging to the set. Please give a look to sys/conf/NOTES in order to understand how the new format is supposed to work. Also, ktr manpages will be updated shortly by gjb which volountereed for this. This patch won't be merged because it changes a POLA (at least from the theoretical standpoint) and this is however a patch that proves to be effective only in development environments. Requested by: rpaulo Reviewed by: jeff, rpaulo
* Until now KTR_ENTRIES, which defines the size of circular buffer used indavide2012-07-301-2/+2
| | | | | | | | | ktr(4), was constrained to be a power of two. Remove this constraint and update sys/conf/NOTES accordingly. Reviewed by: jhb Approved by: gnn (mentor) Sponsored by: Google Summer of Code 2012
* Use strchr() and strrchr().ed2012-01-021-3/+3
| | | | | | | | It seems strchr() and strrchr() are used more often than index() and rindex(). Therefore, simply migrate all kernel code to use it. For the XFS code, remove an empty line to make the code identical to the code in the Linux kernel.
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-071-1/+1
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Fix KTR_CPUMASK in order to accept a string representing a cpuset_t.attilio2011-05-311-10/+51
| | | | | | | | | | | | This introduce all the underlying support for making this possible (via the function cpusetobj_strscan() and keeps ktr_cpumask exported. sparc64 implements its own assembly primitives for tracing events and needs to properly check it. Anyway the sparc64 logic is not implemented yet due to lack of knowledge (by me) and time (by marius), but it is just a matter of using ktr_cpumask when possible. Tested and fixed by: pluknet Reviewed by: marius
* Revert a change that crept in during MFC.attilio2011-05-311-51/+10
|
* MFCattilio2011-05-311-10/+51
|\
* | Revert a patch that unvolountary sneaked in while I was MFCing.attilio2011-05-231-16/+9
| |
* | MFCattilio2011-05-231-9/+16
|/
* Add some FEATURE macros for various features (AUDIT/CAM/IPC/KTR/MAC/NFS/NTP/netchild2011-02-251-0/+2
| | | | | | | | | | | | | PMC/SYSV/...). No FreeBSD version bump, the userland application to query the features will be committed last and can serve as an indication of the availablility if needed. Sponsored by: Google Summer of Code 2010 Submitted by: kibab Reviewed by: arch@ (parts by rwatson, trasz, jhb) X-MFC after: to be determined in last commit with code from this project
* Probabilly defaulting to KTR_GEN is not the right decision when KTR_MASKattilio2010-07-211-1/+1
| | | | | | | | | | | is not defined at all because KTR_GEN is still a valid class and some traces may fit in. Default to 0, instead, and block any tracing. As long as this is a POLA violation (some thirdy-part code, even if that may be a questionable choice, could be rely on that feature) a MFC possibility might be carefully evaluated. Sponsored by: Sandvine Incorporated
* Change the semantics of the debug.ktr.alq_enable control so that when youjulian2010-04-141-24/+30
| | | | | | | | disable alq, it acts as if alq had not been enabled in the build. in other words, the rest of ktr is still available for use. If you really don't want that as well, set the mask to 0. MFC after:3 weeks
* Style fixes.jhb2010-03-111-10/+10
| | | | Submitted by: bde
* Add descriptions for debug.ktr sysctl nodes.jhb2010-03-101-5/+10
|
* Remove slightly oddly placed suser() call from the KTR/ALQ setup sysctl:rwatson2006-09-091-3/+0
| | | | | | | | | it was present only in the enable path, not the disable path, which one presumes would be equally of interest. Either way, it was not needed, as the sysctl framework already calls suser() if the operation is a write operation, which configuration requests are. Sponsored by: nCircle Network Security, Inc.
* Simplify the pager support in DDB. Allowing different db commands tojhb2006-07-121-10/+7
| | | | | | | | | | | | | | | | install custom pager functions didn't actually happen in practice (they all just used the simple pager and passed in a local quit pointer). So, just hardcode the simple pager as the only pager and make it set a global db_pager_quit flag that db commands can check when the user hits 'q' (or a suitable variant) at the pager prompt. Also, now that it's easy to do so, enable paging by default for all ddb commands. Any command that wishes to honor the quit flag can do so by checking db_pager_quit. Note that the pager can also be effectively disabled by setting $lines to 0. Other fixes: - 'show idt' on i386 and pc98 now actually checks the quit flag and terminates early. - 'show intr' now actually checks the quit flag and terminates early.
* Whitespace.jhb2006-01-271-3/+3
|
* Add a new sysctl, debug.ktr.clear. If you write a non-zero value to thisjhb2006-01-271-0/+20
| | | | | | sysctl then it will clear the KTR buffer. Note that if you have active KTR traces at the same time as a clear operation the behavior is undefined, though it shouldn't panic.
* Axe KTR_ALQ_MASK now that KTR_WITNESS is off unless you hack an #ifdefjhb2006-01-251-1/+0
| | | | | in subr_witness.c. I did add a comment in subr_witness.c noting that KTR_WITNESS is incompatible with KTR_ALQ.
* - Add curthread to the state that ktr is saving. The extra information isjeff2005-06-101-3/+6
| | | | | | | | well worth the bloat. - Change the formatting of 'show ktr' slightly to accommodate the additional field. Remove a tab from the verbose output and place the actual trace data after a : so it is more easy to understand which part is the event and which is part of the record.
* Modify the alq(9) alq_open() API to accept a file creation mode, ratherrwatson2005-04-161-2/+2
| | | | | | | | | than defaulting the cmode argument to vn_open() to 0. Supply a default argument of ALQ_DEFAULT_CMODE (0600) in current callers. Discussed with/pointed out by: hmp Reveiwed by: jeff, hmp MFC after: 3 days
* - Change the ddb paging "support" to use a variable (db_lines_per_page) tojhb2004-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
* Remove unused macro.jhb2004-09-201-2/+0
|
* Export KTR_COMPILE as a sysctl so you can easily check from user spacerwatson2004-07-231-0/+3
| | | | what event mask has been compiled into the kernel.
* Update the license on this file to be a bit more sane.jhb2003-09-101-13/+13
|
* Both 'c' an 'lines' are unused, the bogus init of lines was accidentallyjhb2003-08-021-2/+1
| | | | left behind.
* Fix kernel build -- 'c' was the unused var, not 'lines'.obrien2003-08-011-1/+1
|
* Update the 'ps', 'show pci', and 'show ktr' ddb commands to use the newjhb2003-07-311-23/+11
| | | | pager callout instead of homerolling their own paging facility.
* Add an explicit credential argument to alq_open() to allow the caller torwatson2003-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
* Use __FBSDID().obrien2003-06-111-2/+3
|
* - Add a td_pflags field to struct thread for private flags accessed only byjhb2003-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.
* Move the flag that indicates an idle thread from the KSE to the thread.julian2003-05-021-1/+1
| | | | | | It was always referenced via the thread anyhow. Reviewed by: jhb (a LOOOOONG time ago)
* Trim leading "../" sequences from filenames.jhb2003-03-111-0/+3
|
* Add a /a modifier to the show ktr ddb command, which prints the whole tracejake2003-02-221-1/+7
| | | | | buffer without stopping. Useful if you just want to capture the output but can't run ktrdump.
* - Export the alq daemon thread pointer.jeff2002-09-261-1/+2
| | | | - Don't log ktr events from the alq daemon.
* - Add support for logging KTR via ALQ. This is optional and enabled by thejeff2002-09-221-3/+92
| | | | KTR_ALQ config option.
* Remove a stale comment.jake2002-04-061-4/+0
|
* Include machine/ktr.h for sparc64 so we pick up KTR_CPU.jake2002-04-061-0/+3
|
* ktr changes to improve performance and make writing a userland utility tojake2002-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
* Read KTR_CPU into a temporary variable so that we use a consistent valuejhb2002-03-081-7/+4
| | | | | for both the cpumask check and the cpu entry field w/o needing to use a critical section.
* Print parm6 too in the !KTR_EXTEND case.jake2002-01-011-1/+1
|
* Modify the critical section API as follows:jhb2001-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
* Use a per-thread variable for keeping state when a thread is processingjhb2001-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.
* Overhaul the per-CPU support a bit:jhb2001-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
* Missed an assignment of arg6 in previous commit.obrien2001-12-101-0/+1
|
* Adjust for the addition of CTR6.obrien2001-12-101-1/+1
|
* - Replace the unused KTR_IDLELOOP trace class with a new KTR_WITNESS tracejhb2001-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.
* With this commit, I hereby pronounce gensetdefs past its use-by date.peter2001-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
OpenPOWER on IntegriCloud