aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_ktr.c
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* ddb: annotate some commands with DB_CMD_MEMSAFEMitchell Horne2022-07-181-1/+1
| | | | | | | | | | This is not completely exhaustive, but covers a large majority of commands in the tree. Reviewed by: markj Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35583
* kern: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+1
| | | | Notes: svn path=/head/; revision=365222
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-9/+16
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Add KERNEL_PANICKED macro for use in place of direct panicstr testsMateusz Guzik2020-01-121-1/+1
| | | | Notes: svn path=/head/; revision=356655
* Drop "All rights reserved" from my copyright statements.John Baldwin2019-03-061-1/+0
| | | | | | | | | Reviewed by: rgrimes MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D19485 Notes: svn path=/head/; revision=344855
* Use TD_IS_IDLETHREAD instead of unrolled version.Xin LI2019-01-151-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=343038
* sys/kern: adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326271
* Fix a couple of comment typosConrad Meyer2017-08-151-1/+1
| | | | | | | | | | No functional change. Submitted by: Anton Rang <anton.rang AT isilon.com> Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=322526
* Fix the logic in the ddb command 'show ktr /a'. Prior to r118269 it wouldAndrew Turner2016-01-311-1/+1
| | | | | | | | | | | | | print until cncheckc returned a non -1, i.e. a character had been entered. After this change it would print only if cncheckc returned a character. As this was before each call to db_mach_vtrace the normal outcome was nothing was printed. With this change 'show ktr /a' will now keep printing until the user stops the command with a key press, or there is no more entries to print. Notes: svn path=/head/; revision=295098
* - (Ab)use udivx for dividing the u_int pc_cpuid when implementingMarius Strobl2015-12-301-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | CPU_ISSET(), CPU_SET etc. in sparc64 asm. This approach has the benefit of not clobbering %y, allowing to revert r222827 and partially r222828. - In r222828, CATR() already was changed to use the equivalent of PCPU_GET(cpuid) instead of the MD module ID for KTR_CPU, so belatedly also catch up with the C side of ktr(9). Originally, in r203838 CATR() was moved away from directly reading the module ID or equivalent as that became impractical with other CPU types than USI/II supported. With r222828 in place, per-CPU data generally is set up soon enough, though, that employing PCPU things in ktr(9) also for use during early stages works. - Unfortunately, an exception to the latter is the ktr(9) use in pmap_bootstrap(), which actually is run so early that even checking for bootverbose being set via the loader doesn't work. Consequently, replace the ktr(9) use in pmap_bootstrap() with OF_printf(9) and put it under #ifdef DIAGNOSTIC instead. MFC after: 3 days Notes: svn path=/head/; revision=292943
* Expand ktr_mask to be a 64-bit unsigned integer.John Baldwin2015-05-221-12/+14
| | | | | | | | | | | | | The mask does not really need to be updated with atomic operations and the downside of losing races during transitions is not great (it is not marked volatile, so those races are pretty wide open as it is). Differential Revision: https://reviews.freebsd.org/D2595 Reviewed by: emaste, neel, rpaulo MFC after: 2 weeks Notes: svn path=/head/; revision=283283
* Drop KTR records when we're in the debugger so that the debugger isn'tMarcel Moolenaar2014-07-021-1/+2
| | | | | | | | changing or overwriting the trace buffer. When KTR is enabled for things like traps or pmap functions, the amount of logging can be substantial. Notes: svn path=/head/; revision=268186
* Compile fixes:Hans Petter Selasky2014-06-281-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | Remove duplicate "debug_ktr.mask" sysctl definition. Remove now unused variable from "kern_ktr.c". This fixes build of "ktr" which was broken by r267961. Let the default value for "vm_kmem_size_scale" be zero. It is setup after that the sysctl has been initialized from "getenv()" in the "kmeminit()" function to equal the "VM_KMEM_SIZE_MAX" value, if zero. On Sparc64 the "VM_KMEM_SIZE_MAX" macro is not a constant. This fixes build of Sparc64 which was broken by r267961. Add a special macro to dynamically create SYSCTL root nodes, because root nodes have a special parent. This fixes build of existing OFED module and CANBUS module for pc98 which was broken by r267961. Add missing "sysctl.h" includes to get the needed sysctl header file declarations. This is needed after r267961. MFC after: 2 weeks Notes: svn path=/head/; revision=268005
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-281-20/+4
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-271-4/+20
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-271-20/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* Don't lose track of the KTR entries copied from 'ktr_buf_init[]' to theNeel Natu2014-03-221-1/+3
| | | | | | | | | | dynamically allocated 'ktr_buf[]'. The memcpy arranges 'ktr_buf[]' such that the latest KTR entry is at 'KTR_BOOT_ENTRIES - 1'. Notes: svn path=/head/; revision=263651
* Drop the 3rd clause from all 3 clause BSD licenses where I am the soleJohn Baldwin2014-02-051-3/+0
| | | | | | | | | holder to convert them to 2 clause BSD licenses. MFC after: 1 week Notes: svn path=/head/; revision=261520
* ktr: correctly handle possible wrap-around in the boot bufferAndriy Gapon2013-02-081-1/+5
| | | | | | | | | | | | Older entries should be 'before' newer entries in the new buffer too and there should be no zero-filled gap between them. Pointed out by: jhb MFC after: 3 days X-MFC with: r246282 Notes: svn path=/head/; revision=246530
* ktr: prevent possible footshooting with KTR_ENTRIES and KTR_BOOT_ENTRIESAndriy Gapon2013-02-041-1/+1
| | | | | | | | | Suggested by: adrian MFC after: 14 days X-MFC with: r246282 Notes: svn path=/head/; revision=246331
* ktr: copy content from the early static buffer if KTR_ENTRIES !=Andriy Gapon2013-02-041-0/+1
| | | | | | | | | | | | KTR_BOOT_ENTRIES Reported by: glebius, jhb Pointyhat to: avg MFC after: 14 days X-MFC with: r246282 Notes: svn path=/head/; revision=246330
* allow for large KTR_ENTRIES values by allocating ktr_buf using malloc(9)Andriy Gapon2013-02-031-2/+28
| | | | | | | | | | | | | | Only during very early boot, before malloc(9) is functional (SI_SUB_KMEM), the static ktr_buf_init is used. Size of the static buffer is determined by a new kernel option KTR_BOOT_ENTRIES. Its default value is 1024. This commit builds on top of r243046. Reviewed by: alc MFC after: 17 days Notes: svn path=/head/; revision=246282
* Use uint instead of int for flags exported via sysctl.Alfred Perlstein2012-12-071-3/+3
| | | | Notes: svn path=/head/; revision=243971
* - Implement run-time expansion of the KTR buffer via sysctl.Jeff Roberson2012-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 Notes: svn path=/head/; revision=243046
* Post r222812 KTR_CPUMASK started being initialized only as a tunableAttilio Rao2012-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 Notes: svn path=/head/; revision=239923
* Until now KTR_ENTRIES, which defines the size of circular buffer used inDavide Italiano2012-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 Notes: svn path=/head/; revision=238925
* Use strchr() and strrchr().Ed Schouten2012-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. Notes: svn path=/head/; revision=229272
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-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. Notes: svn path=/head/; revision=227309
* Fix KTR_CPUMASK in order to accept a string representing a cpuset_t.Attilio Rao2011-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 Notes: svn path=/projects/largeSMP/; revision=222546
* Revert a change that crept in during MFC.Attilio Rao2011-05-311-51/+10
| | | | Notes: svn path=/projects/largeSMP/; revision=222545
* MFCAttilio Rao2011-05-311-10/+51
|\ | | | | | | Notes: svn path=/projects/largeSMP/; revision=222526
* | Revert a patch that unvolountary sneaked in while I was MFCing.Attilio Rao2011-05-231-16/+9
| | | | | | | | Notes: svn path=/projects/largeSMP/; revision=222235
* | MFCAttilio Rao2011-05-231-9/+16
|/ | | | Notes: svn path=/projects/largeSMP/; revision=222209
* Add some FEATURE macros for various features (AUDIT/CAM/IPC/KTR/MAC/NFS/NTP/Alexander Leidinger2011-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 Notes: svn path=/head/; revision=219028
* Probabilly defaulting to KTR_GEN is not the right decision when KTR_MASKAttilio Rao2010-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 Notes: svn path=/head/; revision=210337
* Change the semantics of the debug.ktr.alq_enable control so that when youJulian Elischer2010-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 Notes: svn path=/head/; revision=206632
* Style fixes.John Baldwin2010-03-111-10/+10
| | | | | | | Submitted by: bde Notes: svn path=/head/; revision=205017
* Add descriptions for debug.ktr sysctl nodes.John Baldwin2010-03-101-5/+10
| | | | Notes: svn path=/head/; revision=204980
* Remove slightly oddly placed suser() call from the KTR/ALQ setup sysctl:Robert Watson2006-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. Notes: svn path=/head/; revision=162181
* Simplify the pager support in DDB. Allowing different db commands toJohn Baldwin2006-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. Notes: svn path=/head/; revision=160312
* Whitespace.John Baldwin2006-01-271-3/+3
| | | | Notes: svn path=/head/; revision=154940
* Add a new sysctl, debug.ktr.clear. If you write a non-zero value to thisJohn Baldwin2006-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. Notes: svn path=/head/; revision=154933
* Axe KTR_ALQ_MASK now that KTR_WITNESS is off unless you hack an #ifdefJohn Baldwin2006-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. Notes: svn path=/head/; revision=154818
* - Add curthread to the state that ktr is saving. The extra information isJeff Roberson2005-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. Notes: svn path=/head/; revision=147278
* Modify the alq(9) alq_open() API to accept a file creation mode, ratherRobert Watson2005-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 Notes: svn path=/head/; revision=145142
* - 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