summaryrefslogtreecommitdiffstats
path: root/sys/cddl/dev/dtrace
Commit message (Collapse)AuthorAgeFilesLines
* MFC r314370,r318130,r318167:jhibbits2017-05-201-30/+27
| | | | | | | | | | | DTrace related fixes for PowerPC. r314370: Unbreak kernel breakpoints, broken for ~4 years now r318130: Fix the encoded instruction for FBT traps on powerpc r318167: Fix stack tracing in dtrace for powerpc
* MFC r315208:markj2017-04-111-1/+1
| | | | Fix a backwards comparison in the code to dump a DTrace debug buffer.
* MFC r313841, r313850:markj2017-03-102-2/+20
| | | | Prevent CPU migration when checking the DTrace nofault flag on x86.
* MFC r313133:markj2017-02-172-53/+639
| | | | Sync the x86 dis_tables.c with upstream.
* MFC r303796:jhibbits2016-12-232-2/+8
| | | | | | | Two fixups for dtrace * Use the right incantation to get the next stack pointer. * Clear EE using the correct instruction sequence.
* MFC: 309069gnn2016-12-202-0/+14
| | | | | | | Add tunable to disable destructive dtrace Submitted by: Joerg Pernfuss <code.jpe@gmail.com> Reviewed by: rstone, markj
* Set oldfp so the check for fp == oldfp works as expected.andrew2016-05-311-1/+3
| | | | | Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation
* Correct the implementation of dtrace_interrupt_disable/enable.br2016-05-271-2/+3
| | | | | | Pointed out by: andrew Sponsored by: DARPA, AFRL Sponsored by: HEIF5
* Fix dtrace_interrupt_disable and dtrace_interrupt_enable by having theandrew2016-05-271-1/+2
| | | | | | | | | | | | former return the current status for the latter to use. Without this we could enable interrupts when they shouldn't be. It's still not quite right as it should only update the bits we care about, bit should be good enough until the correct fix can be tested. PR: 204270 Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation
* Try to unbreak the build after r300611 by including the headerbz2016-05-241-0/+1
| | | | | | defining VM_MIN_KERNEL_ADDRESS. Sponsored by: DARPA/AFRL
* Add initial DTrace support for RISC-V.br2016-05-244-0/+903
| | | | | Sponsored by: DARPA, AFRL Sponsored by: HEIF5
* Mark all memory before the kernel as toxic to DTrace.andrew2016-05-241-1/+1
| | | | | Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation
* Add an EARLY_AP_STARTUP option to start APs earlier during boot.jhb2016-05-144-24/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, Application Processors (non-boot CPUs) are started by MD code at SI_SUB_CPU, but they are kept waiting in a "pen" until SI_SUB_SMP at which point they are released to run kernel threads. SI_SUB_SMP is one of the last SYSINIT levels, so APs don't enter the scheduler and start running threads until fairly late in the boot. This change moves SI_SUB_SMP up to just before software interrupt threads are created allowing the APs to start executing kernel threads much sooner (before any devices are probed). This allows several initialization routines that need to perform initialization on all CPUs to now perform that initialization in one step rather than having to defer the AP initialization to a second SYSINIT run at SI_SUB_SMP. It also permits all CPUs to be available for handling interrupts before any devices are probed. This last feature fixes a problem on with interrupt vector exhaustion. Specifically, in the old model all device interrupts were routed onto the boot CPU during boot. Later after the APs were released at SI_SUB_SMP, interrupts were redistributed across all CPUs. However, several drivers for multiqueue hardware allocate N interrupts per CPU in the system. In a system with many CPUs, just a few drivers doing this could exhaust the available pool of interrupt vectors on the boot CPU as each driver was allocating N * mp_ncpu vectors on the boot CPU. Now, drivers will allocate interrupts on their desired CPUs during boot meaning that only N interrupts are allocated from the boot CPU instead of N * mp_ncpu. Some other bits of code can also be simplified as smp_started is now true much earlier and will now always be true for these bits of code. This removes the need to treat the single-CPU boot environment as a special case. As a transition aid, the new behavior is available under a new kernel option (EARLY_AP_STARTUP). This will allow the option to be turned off if need be during initial testing. I plan to enable this on x86 by default in a followup commit in the next few days and to have all platforms moved over before 11.0. Once the transition is complete, the option will be removed along with the !EARLY_AP_STARTUP code. These changes have only been tested on x86. Other platform maintainers are encouraged to port their architectures over as well. The main things to check for are any uses of smp_started in MD code that can be simplified and SI_SUB_SMP SYSINITs in MD code that can be removed in the EARLY_AP_STARTUP case (e.g. the interrupt shuffling). PR: kern/199321 Reviewed by: markj, gnn, kib Sponsored by: Netflix
* Implement FBT provider (MD part) for DTrace on MIPS.br2016-05-052-25/+85
| | | | | | | Tested on MIPS64. Sponsored by: DARPA, AFRL Sponsored by: HEIF5
* add invpcid instruction to i386 dtrace disassembler tablesavg2016-04-291-1/+1
| | | | MFC after: 2 weeks
* Add a kern.dtrace.err_verbose sysctl to control dtrace_err_verbose.markj2016-04-251-5/+6
| | | | | | | When this flag is turned on, DOF and DIF validation errors are printed to the kernel message buffer. This is useful for debugging. Also remove the debug.dtrace.debug sysctl, which has no effect.
* lahf/sahf are supported on some amd64 processorsavg2016-04-221-1/+1
| | | | | | | | | | | | | | While the instructions were not included into the original instruction set, their support can be indicated by a special feature bit. For example: CPU: AMD Phenom(tm) II X4 955 Processor (3214.71-MHz K8-class CPU) ... AMD Features2=0x37ff<LAHF, ...> Clang 3.8 uses lahf/sahf as a faster alternative to pushf/popf where possible. MFC after: 2 weeks
* Make the second argument of dtrace_invop() a trapframe pointer.markj2016-04-1710-53/+53
| | | | | | | | | | | | | Currently this argument is a pointer into the stack which is used by FBT to fetch the first five probe arguments. On all non-x86 architectures it's simply the trapframe address, so this change has no functional impact. On amd64 it's a pointer into the trapframe such that stack[1 .. 5] gives the first five argument registers, which are deliberately grouped together in the amd64 trapframe definition. A trapframe argument simplifies the invop handlers on !x86 and makes the x86 FBT invop handler easier to understand. Moreover, it allows for invop handlers that may want to modify the register set of the interrupted thread.
* Initialize DTrace hrtimer frequency during SI_SUB_CPU on i386 and amd64.markj2016-04-102-36/+60
| | | | | | | | | This allows the hrtimer to be used earlier during boot. This is required for boot-time DTrace: anonymous enablings are created during SI_SUB_DTRACE_ANON, which runs before APs are started. In particular, the DTrace deadman timer requires that the hrtimer be functional. MFC after: 2 weeks
* Implement dtrace_getupcstack in ARM64wma2016-04-061-1/+118
| | | | | | | | | | | Allow using DTRACE for performance analysis of userspace applications - the function call stack can be captured. This is almost an exact copy of AMD64 solution. Obtained from: Semihalf Sponsored by: Cavium Reviewed by: emaste, gnn, jhibbits Differential Revision: https://reviews.freebsd.org/D5779
* Remove unused variables dtrace_in_probe and dtrace_in_probe_addr.markj2016-03-176-13/+0
|
* Fix a couple of silly mistakes in r291962.markj2016-03-081-2/+2
| | | | | | | - Handle the case where no DOF helper is provided. This occurs with the currently-unused DTRACEHIOC_ADD ioctl. - Fix some checks that prevented the loading DOF in the (non-default) lazyload mode.
* As <machine/vmparam.h> is included from <vm/vm_param.h>, there is noskra2016-02-223-3/+0
| | | | | | | | need to include it explicitly when <vm/vm_param.h> is already included. Suggested by: alc Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D5379
* Support an arbitrary number of arguments to DTrace syscall probes.markj2015-12-171-1/+2
| | | | | | | | | | Rather than pushing all eight possible arguments into dtrace_probe()'s stack frame, make the syscall_args struct for the current syscall available via the current thread. Using a custom getargval method for the systrace provider, this allows any syscall argument to be fetched, even in kernels that have modified the maximum number of system call arguments. Sponsored by: EMC / Isilon Storage Division
* Modify DTRACEHIOC_ADDDOF to copy the DOF section from the target process.markj2015-12-071-16/+38
| | | | | | | | | | | r281257 added support for lazyload mode by allowing dtrace(1) to register a DOF section on behalf of a traced process. This was implemented by having libdtrace copy the DOF section into a heap-allocated buffer and passing its address to the ioctl handler. However, DTrace uses the DOF section address as a lookup key in certain cases, so the ioctl handler should be given the target process' DOF section address instead. This change modifies the ADDDOF handler to copy the DOF section in from the target process, rather than from dtrace(1).
* Fix a bug in the amd64 dtrace_getarg() implementation: when unwinding themarkj2015-11-191-2/+2
| | | | | | | | stack, take into account the copy of rsi pushed between the breakpoint trapframe and the dtrace_invop frame. Prior to r287644, this was covered by the fact that sizeof(struct amd64_frame) was 24 rather than 16. Reported by: smh
* dtrace_getarg: remove stray return statement on amd64, powerpcavg2015-09-292-2/+0
| | | | MFC after: 10 days
* Remove the arg0 field from struct amd64_frame. Its existence was a bug,markj2015-09-111-1/+1
| | | | | | | | | | | | since on amd64 the first argument to a function is generally not on the stack. Revert an old DTrace bug fix to some code that assumed that sizeof(struct amd64_frame) == 16. Reviewed by: jhb, kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3255
* When checking for the valid value of the frame pointer, verify that itkib2015-07-162-8/+8
| | | | | | | | | | | | belongs to the kernel stack address range for the thread. Right now, code checks that new frame is not farther then KSTACK_PAGES pages from the current frame, which allows the address to point past the top of the stack. Reviewed by: andrew, emaste, markj Differential revision: https://reviews.freebsd.org/D3108 Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Use single instance of the identical INKERNEL() and PMC_IN_KERNEL()kib2015-07-021-3/+0
| | | | | | | | | | | | | macros on amd64 and i386. Move the definition to machine/param.h. kgdb defines INKERNEL() too, the conflict is resolved by renaming kgdb version to PINKERNEL(). On i386, correct the lowest kernel address. After the shared page was introduced, USRSTACK no longer points to the last user address + 1 [*] Submitted by: Oliver Pinter [*] Sponsored by: The FreeBSD Foundation MFC after: 1 week
* First cut of DTrace for AArch64.br2015-07-014-0/+822
| | | | | | Reviewed by: andrew, emaste Sponsored by: ARM Limited Differential Revision: https://reviews.freebsd.org/D2738
* Don't re-define LOCORE when dtrace is built-in to the kernel.br2015-06-101-1/+0
|
* Remove unused references to calltrap.markj2015-05-252-4/+0
| | | | MFC after: 3 days
* Remove some commented-out upstream code for handling traps from usermodemarkj2015-05-102-224/+0
| | | | DTrace probes. This handling is already done in trap() on i386 and amd64.
* Fix DTrace's panic() action.markj2015-04-246-477/+0
| | | | | | | | | | | | It would previously call into some unfinished Solaris compatibility code and return without actually calling panic(9). The compatibility code is unneeded, however, so just remove it and have dtrace_panic() call vpanic(9) directly. Differential Revision: https://reviews.freebsd.org/D2349 Reviewed by: avg MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
* libdtrace: add support for lazyload mode.markj2015-04-081-3/+4
| | | | | | | | | | | Passing "-x lazyload" to dtrace -G during compilation causes dtrace(1) to not link drti.o into the output object file, so the USDT probes are not created during process startup. Instead, dtrace(1) will automatically discover and create probes on the process' behalf when attaching. Differential Revision: https://reviews.freebsd.org/D2203 Reviewed by: rpaulo MFC after: 1 month
* Import a missing piece of commit b8fac8e162eda7e98d from illumos-gate.markj2015-03-302-2/+44
| | | | | | | | | This adds an upper bound, dtrace_ustackdepth_max, to the number of frames traversed when computing the userland stack depth. Some programs - notably firefox - are otherwise able to trigger an infinite loop in dtrace_getustack_common(), causing a panic. MFC after: 1 week
* On ARM, unlike some other architectures, saved $pc values from in-kernelrwatson2015-03-151-6/+6
| | | | | | | | | traps do appear in the regular call stack, rather than only in a special trap frame, so we don't need to inject the trap-frame $pc into a returned stack trace in DTrace. MFC after: 3 days Sponsored by: DARPA, AFRL
* Add support for walltimestamp to DTrace on ARM.gnn2015-03-071-3/+4
|
* dtrace_cas32 and dtrace_casptr should retrn the data loaded from targetandrew2015-03-051-5/+3
| | | | | | not the new value. Sponsored by: ABT Systems Ltd
* Add the MD parts of dtrace needed to use fbt on ARM. For this we need toandrew2015-03-051-6/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | emulate the instructions used in function entry and exit. For function entry ARM will use a push instruction to push up to 16 registers to the stack. While we don't expect all 16 to be used we need to handle any combination the compiler may generate, even if it doesn't make sense (e.g. pushing the program counter). On function return we will either have a pop or branch instruction. The former is similar to the push instruction, but with care to make sure we update the stack pointer and program counter correctly in the cases they are either in the list of registers or not. For branch we need to take the 24-bit offset, sign-extend it, and add that number of 4-byte words to the program counter. Care needs to be taken as, due to historical reasons, the address the branch is relative to is not the current instruction, but 8 bytes later. This allows us to use the following probes on ARM boards: dtrace -n 'fbt::malloc:entry { stack() }' and dtrace -n 'fbt::free:return { stack() }' Differential Revision: https://reviews.freebsd.org/D2007 Reviewed by: gnn, rpaulo Sponsored by: ABT Systems Ltd
* Fix build after unifying DAR/DEAR storage in trap frame.nwhitehorn2015-03-051-1/+1
|
* Fix the dtrace ARM atomic compare-and-set functions. These functions areandrew2015-03-012-31/+22
| | | | | | | | | | | expected to return the data in the memory location pointed at by target after the operation. The FreeBSD atomic functions previously used return either 0 or 1 to indicate if the comparison succeeded or not respectively. With this change these functions only support ARMv6 and later are supported by these functions. Sponsored by: ABT Systems Ltd
* Use the ARM unwinder with dtrace to extract the stack when asked. With thisandrew2015-02-191-90/+29
| | | | | | | | | | | | | | | | | | | | | | dtrace is able to display a stack trace similar to the one below. # dtrace -p 603 -n 'tcp:kernel::receive { stack(); }' 0 70 :receive kernel`ip_input+0x140 kernel`netisr_dispatch_src+0xb8 kernel`ether_demux+0x1c4 kernel`ether_nh_input+0x3a8 kernel`netisr_dispatch_src+0xb8 kernel`ether_input+0x60 kernel`cpsw_intr_rx+0xac kernel`intr_event_execute_handlers+0x128 kernel`ithread_loop+0xb4 kernel`fork_exit+0x84 kernel`swi_exit kernel`swi_exit Tested by: gnn Sponsored by: ABT Systems Ltd
* Initial version of DTrace on ARM32.gnn2015-02-104-0/+871
| | | | | Submitted by: Howard Su based on work by Oleksandr Tymoshenko Reviewed by: ian, andrew, rpaulo, markj
* MFV r266993:pfg2015-02-032-16/+0
| | | | | | | | | | | | 4469 DTrace helper tracing should be dynamic Reference: https://illumos.org/issues/4469 Obtained from: Illumos Phabric: D1551 Reviewed by: markj MFC after: 2 weeks
* Mechanically convert cddl sun #ifdef's to illumossmh2015-01-174-17/+17
| | | | | | | | | | | | Since the upstream for cddl code is now illumos not sun, mechanically convert all sun #ifdef's to illumos #ifdef's which have been used in all newer code for some time. Also do a manual pass to correct the use if #ifdef comments as per style(9) as well as few uses of #if defined(__FreeBSD__) vs #ifndef illumos. MFC after: 1 month Sponsored by: Multiplay
* Restore the trap type argument to the DTrace trap hook, removed in r268600.markj2014-12-234-10/+8
| | | | | | It's redundant at the moment since it can be obtained from the trapframe on the architectures where DTrace is supported, but this won't be the case with ARM.
* Fix multiple incorrect SYSCTL arguments in the kernel:hselasky2014-10-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Wrong integer type was specified. - Wrong or missing "access" specifier. The "access" specifier sometimes included the SYSCTL type, which it should not, except for procedural SYSCTL nodes. - Logical OR where binary OR was expected. - Properly assert the "access" argument passed to all SYSCTL macros, using the CTASSERT macro. This applies to both static- and dynamically created SYSCTLs. - Properly assert the the data type for both static and dynamic SYSCTLs. In the case of static SYSCTLs we only assert that the data pointed to by the SYSCTL data pointer has the correct size, hence there is no easy way to assert types in the C language outside a C-function. - Rewrote some code which doesn't pass a constant "access" specifier when creating dynamic SYSCTL nodes, which is now a requirement. - Updated "EXAMPLES" section in SYSCTL manual page. MFC after: 3 days Sponsored by: Mellanox Technologies
* Fix the stack tracing for dtrace/powerpc.jhibbits2014-09-171-19/+121
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Fix the stack tracing for dtrace/powerpc by using the trapexit/asttrapexit return address sentinels instead of checking within the kernel address space. As part of this, I had to add new inline functions. FBT traces the kernel, so we have to have special case handling for this, since a trap will create a full new trap frame, and there's no way to pass around the 'real' stack. I handle this by special-casing 'aframes == 0' with the trap frame. If aframes counts out to the trap frame, then assume we're looking for the full kernel trap frame, so switch to the real stack pointer. Test Plan: Tested on powerpc64 Reviewers: rpaulo, markj, nwhitehorn Reviewed By: markj, nwhitehorn Differential Revision: https://reviews.freebsd.org/D788 MFC after: 3 week Relnotes: Yes
OpenPOWER on IntegriCloud