summaryrefslogtreecommitdiffstats
path: root/sys/cddl/dev
Commit message (Collapse)AuthorAgeFilesLines
* MFC r314370,r318130,r318167:jhibbits2017-05-202-31/+28
| | | | | | | | | | | 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
* MFC r306570:markj2016-10-244-13/+0
| | | | Allow tracing of functions prefixed by "__".
* MFC r306220:markj2016-10-021-2/+4
| | | | Re-check the systrace probe ID before calling dtrace_probe().
* 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-247-0/+1103
| | | | | 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-054-25/+280
| | | | | | | 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-1715-73/+95
| | | | | | | | | | | | | 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 SDT probes during SI_SUB_DTRACE_PROVIDER.markj2016-04-101-13/+5
| | | | | | | This is consistent with all other DTrace providers and ensures that SDT probes are available for boot-time tracing. MFC after: 2 weeks
* 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
* ARM: Rename remaining ARMv4 specific function in DTrace code.mmel2016-02-061-1/+1
| | | | | | I missed it in r295319. Pointed by: tuexen
* Be stricter on which functions we can probe with FBT. We now only check theandrew2015-12-231-5/+13
| | | | | | | | | | | first instruction to see if it's either a pushm with lr, or a sub with sp. The former is the common case, with the latter used with va_args. This removes 12 probes. These are all hand-written assembly, with a few C functions with no stack usage. Submitted by: Howard Su <howard0su@gmail.com> Differential Revision: https://reviews.freebsd.org/D4419
* Support an arbitrary number of arguments to DTrace syscall probes.markj2015-12-172-38/+54
| | | | | | | | | | 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
* Remove the unused systrace device file and fix style bugs.markj2015-12-161-61/+41
| | | | MFC after: 1 week
* 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).
* Allow the artificial profile frames to be adjusted as needed by the user.andrew2015-12-051-6/+9
| | | | | | | | While here update for armv6 to a tested value. Submitted by: Howard Su <howard0su@gmail.com> Reviewed by: stat Differential Revision: https://reviews.freebsd.org/D4315
* Move the check to see if we are tracing a function with the DTrace Functionandrew2015-12-051-17/+13
| | | | | | | | Boundary Trace to assembly to reduce the overhead of these checks. Submitted by: Howard Su <howard0su@gmail.com> Relnotes: Yes Differential Revision: https://reviews.freebsd.org/D4266
* 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
* Rename remaining linux32 symbols such as linux_sysent[] andjhb2015-10-221-10/+34
| | | | | | | | | | | | | | | | | linux_syscallnames[] from linux_* to linux32_* to avoid conflicts with linux64.ko. While here, add support for linux64 binaries to systrace. - Update NOPROTO entries in amd64/linux/syscalls.master to match the main table to fix systrace build. - Add a special case for union l_semun arguments to the systrace generation. - The systrace_linux32 module now only builds the systrace_linux32.ko. module on amd64. - Add a new systrace_linux module that builds on both i386 and amd64. For i386 it builds the existing systrace_linux.ko. For amd64 it builds a systrace_linux.ko for 64-bit binaries. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D3954
* sdt: static-ize couple of variablesavg2015-09-291-2/+2
| | | | MFC after: 11 days
* sdt module does not seem to actually use any symbol from opensolaris moduleavg2015-09-291-1/+0
| | | | MFC after: 11 days
* std: it is important that func name is never an empty stringavg2015-09-291-0/+2
| | | | | | | | | | | | | | otherwise DTRACE_ANCHORED() returns false and that makes stack() insert a bogus frame at the top. For example: dtrace -n 'test:dtrace_test::sdttest { stack(); } This change is not really a solution, but just a work-around. The real solution is to record the probe's call site and to use that for resolving a function name. PR: 195222 MFC after: 22 days
* sdt: start checking version field when parsing probe definitionsavg2015-09-291-0/+6
| | | | | | This is an extra safety measure. MFC after: 21 days
* 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
* Remove a couple of unused fields from the FBT probe struct.markj2015-08-035-6/+0
|
* Remove checks for a NULL return value from M_WAITOK allocations.markj2015-07-211-10/+4
|
* Implement the lockstat provider using SDT(9) instead of the custom providermarkj2015-07-192-330/+5
| | | | | | | | in lockstat.ko. This means that lockstat probes now have typed arguments and will utilize SDT probe hot-patching support when it arrives. Reviewed by: gnn Differential Revision: https://reviews.freebsd.org/D2993
* Modify lockstat_nsecs() to just return unless lockstat probes are actuallymarkj2015-07-181-0/+4
| | | | | | | | | | | | enabled. The cost of a timecounter read can be quite significant, and the problem became more apparent after r284297, since that change resulted in a call to lockstat_nsecs() for each acquisition of an rwlock read lock. PR: 201642 Reviewed by: avg Tested by: Jason Unovitch MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D3073
* 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-018-3/+1039
| | | | | | Reviewed by: andrew, emaste Sponsored by: ARM Limited Differential Revision: https://reviews.freebsd.org/D2738
* Add a central location for exclusion checks. We checkbr2015-07-012-0/+32
| | | | | | | here if function is excluded from FBT instrumentation. Reviewed by: andrew, emaste, markj Differential Revision: https://reviews.freebsd.org/D2899
* Don't re-define LOCORE when dtrace is built-in to the kernel.br2015-06-101-1/+0
|
OpenPOWER on IntegriCloud