summaryrefslogtreecommitdiffstats
path: root/sys/cddl/dev
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove unused references to calltrap.markj2015-05-252-4/+0
| | | | MFC after: 3 days
* CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than tenjkim2015-05-221-2/+2
| | | | | | | | | | years for head. However, it is continuously misused as the mpsafe argument for callout_init(9). Deprecate the flag and clean up callout_init() calls to make them more consistent. Differential Revision: https://reviews.freebsd.org/D2613 Reviewed by: jhb MFC after: 2 weeks
* 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.
* Adjust PROF_ARTIFICIAL_FRAMES in the DTrace profile provider on ARM torwatson2015-04-251-2/+4
| | | | | | | | | | | skip 10, rather than 9, frames. This appears to work quite well in practice on the BeagleBone Black, so remove a comment about the value being bogus and replace it with a slightly less negative one. However, the number of frames to skip is quite sensitive to details of the timer and interrupt handling paths, so this is necessarily fragile -- but no more so than on x86. Sponsored by: DARPA, AFRL
* 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
* Now that DTrace stack traces handle exception frames better, skip fewerrwatson2015-03-151-1/+1
| | | | | | | stack frames for FBT 'entry' probes on ARM. MFC after: 3 days Sponsored by: DARPA, AFRL
* 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
* Replace the completely arbitrary '3' with '9' for the number of frames torwatson2015-03-151-1/+1
| | | | | | | | | | skip using the DTrace 'profile' provider on ARM. This causes stack traces to skip various driver-and callout-related things as they do on x86, where the likewise arbitrary values are '6' (32-bit) and '10' (64-bit) for similar sorts of reasons. 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-052-8/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
|
* Don't all DTrace's FBT on ARM to instrument undefinedinstruction(), asrwatson2015-03-051-0/+7
| | | | | | this would lead to DTrace reentrance. Sponsored by: DARPA, AFRL
* 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
* Clean up machine dependent code for DTrace on ARM.gnn2015-02-111-1142/+31
| | | | Submitted by: markj
* Initial version of DTrace on ARM32.gnn2015-02-108-1/+2216
| | | | | 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.
* remove opensolaris cyclic code, replace with high-precision calloutsavg2014-12-075-1865/+169
| | | | | | | | | | | In the old days callout(9) had 1 tick precision and that was inadequate for some uses, e.g. DTrace profile module, so we had to emulate cyclic API and behavior. Now we can directly use callout(9) in the very few places where cyclic was used. Differential Revision: https://reviews.freebsd.org/D1161 Reviewed by: gnn, jhb, markj MFC after: 2 weeks
* Whitespacejhibbits2014-10-241-1/+1
| | | | | X-MFC-with: r273570 MFC after: 1 week
* Three updates to PowerPC FBT:jhibbits2014-10-241-3/+15
| | | | | | | | | * Use a constant to define the number of stack frames in a probe exception. * Only allow function symbols in powerpc64 ('.' prefixed) * Set the fbtp_roffset for return probes, so the correct dtrace_probe call is made. MFC after: 1 week
* 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-172-21/+123
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Restore the correct value when disabling probes. Otherwise the instrumentedmarkj2014-08-241-3/+3
| | | | | | | | tracepoints would continue to generate traps, which would be ignored but could consume noticeable amounts of CPU if, say, all functions in the kernel were instrumented. X-MFC-With: r270067
* Factor out the common code for function boundary tracing instead ofmarkj2014-08-167-1652/+702
| | | | | | | | | | | duplicating the entire implementation for both x86 and powerpc. This makes it easier to add support for other architectures and has no functional impact. Phabric: D613 Reviewed by: gnn, jhibbits, rpaulo Tested by: jhibbits (powerpc) MFC after: 2 weeks
* Use a C wrapper for trap() instead of checking and calling the DTrace trapmarkj2014-07-192-5/+8
| | | | | | | | hook in assembly. Suggested by: kib Reviewed by: kib (original version) X-MFC-With: r268600
* Invoke the DTrace trap handler before calling trap() on amd64. This matchesmarkj2014-07-144-19/+18
| | | | | | | | | | | the upstream implementation and helps ensure that a trap induced by tracing fbt::trap:entry is handled without recursively generating another trap. This makes it possible to run most (but not all) of the DTrace tests under common/safety/ without triggering a kernel panic. Submitted by: Anton Rang <anton.rang@isilon.com> (original version) Phabric: D95
* Pull in r267961 and r267973 again. Fix for issues reported will follow.hselasky2014-06-281-2/+1
|
* Revert r267961, r267973:gjb2014-06-271-1/+2
| | | | | | | | | | 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
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifhselasky2014-06-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* MFV illumos r266986:rpaulo2014-06-261-0/+1
| | | | | | | | 2915 DTrace in a zone should see "cpu", "curpsinfo", et al 2916 DTrace in a zone should be able to access fds[] 2917 DTrace in a zone should have limited provider access MFC after: 2 weeks
* Continue the crusade towards a dev_clone()-free kernel, removing itsdavide2014-06-254-84/+1
| | | | | | | | | usage from dtrace. The dtrace code already uses cdevpriv(9) since FreeBSD 8, so this change should be quite harmless. Reviewed by: markj Approved by: markj MFC after: never
* Fix some bugs when fetching probe arguments in i386. Firstly ensure thatmarkj2014-06-232-10/+5
| | | | | | | | | | | the 4 byte-aligned dtrace_invop_callsite can be found and that it immediately follows the call to dtrace_invop(). Secondly, fix some pointer arithmetic to account for differences between struct i386_frame and illumos' struct frame. Finally, ensure that dtrace_getarg() isn't inlined. It works by following a fixed number of frame pointers to the probe site, so inlining breaks it. MFC after: 3 weeks
* Fix a couple of bugs on amd64 when fetching probe arguments beyond themarkj2014-06-231-10/+11
| | | | | | | | | | | | | first five for probes entered through a UD fault (i.e. FBT probes). Specifically, handle the fact that dtrace_invop_callsite must be 16 byte-aligned and thus may not immediately follow the call to dtrace_invop() in dtrace_invop_start(). Also fetch register arguments and the stack pointer through a struct trapframe instead of a struct reg. PR: 191260 Submitted by: luke.tw@gmail.com MFC after: 3 weeks
* Allow creation of SDT probes from a module in which no providers aremarkj2014-06-211-16/+17
| | | | | | | | | defined. This ensures that the sdt:zfs:: probes appear despite the fact the sdt provider is defined in the kernel rather than in zfs.ko. Reported by: hiren Tested by: hiren MFC after: 2 weeks
* Update dis_tables.c to the latest Illumos version.grehan2014-05-151-17/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | This includes decodes of recent Intel instructions, in particular VT-x and related instructions. This allows the FBT provider to locate the exit points of routines that include these new instructions. Illumos issues: 3414 Need a new word of AT_SUN_HWCAP bits 3415 Add isainfo support for f16c and rdrand 3416 Need disassembler support for rdrand and f16c 3413 isainfo -v overflows 80 columns 3417 mdb disassembler confuses rdtscp for invlpg 1518 dis should support AMD SVM/AMD-V/Pacifica instructions 1096 i386 disassembler should understand complex nops 1362 add kvmstat for monitoring of KVM statistics 1363 add vmregs[] variable to DTrace 1364 need disassembler support for VMX instructions 1365 mdb needs 16-bit disassembler support This corresponds to Illumos-gate (github) version eb23829ff08a873c612ac45d191d559394b4b408 Reviewed by: markj MFC after: 1 week
* Ensure that all eight syscall arguments are available to dtrace_probe(),markj2014-04-141-1/+7
| | | | | | | rather than just the first five. This is done by calling dtrace_probe() through a function pointer, as in illumos. MFC after: 3 weeks
* DTrace's pid provider works by inserting breakpoint instructions at probemarkj2014-04-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sites and installing a hook at the kernel's trap handler. The fasttrap code will emulate the overwritten instruction in some common cases, but otherwise copies it out into some scratch space in the traced process' address space and ensures that it's executed after returning from the trap. In Solaris and illumos, this (per-thread) scratch space comes from some reserved space in TLS, accessible via the fs segment register. This approach is somewhat unappealing on FreeBSD since it would require some modifications to rtld and jemalloc (for static TLS) to ensure that TLS is executable, and would thus introduce dependencies on their implementation details. I think it would also be impossible to safely trace static binaries compiled without these modifications. This change implements the functionality in a different way, by having fasttrap map pages into the target process' address space on demand. Each page is divided into 64-byte chunks for use by individual threads, and fasttrap's process descriptor struct has been extended to keep track of any scratch space allocated for the corresponding process. With this change it's possible to trace all libc functions in a program, e.g. with pid$target:libc.so.*::entry {@[probefunc] = count();} Previously this would generally cause the victim process to crash, as tracing memcpy on amd64 requires the functionality described above. Tested by: Prashanth Kumar <pra_udupi@yahoo.co.in> (earlier version) MFC after: 6 weeks
* Expose a few DTrace parameters as sysctls under kern.dtrace and addmarkj2014-03-012-3/+14
| | | | | | | | descriptions for several existing sysctls. PR: 187027 Submitted by: Fedor Indutny <fedor@indutny.com> (original version) MFC after: 2 weeks
* Fix the struct reg mappings for i386 and amd64, which differ between illumosmarkj2014-02-271-0/+51
| | | | | | | and FreeBSD. Submitted by: Prashanth Kumar <pra_udupi@yahoo.co.in> MFC after: 2 weeks
* Move some files that are identical on i386 and amd64 to an x86 subdirectorymarkj2014-02-276-5078/+0
| | | | | | | rather than keeping duplicate copies. Discussed with: avg MFC after: 1 week
* Revert r262466, as it does not compile on PowerPC.markj2014-02-261-5/+1
| | | | Reported by: jhibbits
* Make all 8 syscall arguments available to syscall probes in the same waymarkj2014-02-251-1/+5
| | | | | | | | that this is done for SDT probes. This fixes the syscall/tst.args.d test, which was failing because mmap(2)'s sixth argument wasn't available to the probe. MFC after: 2 weeks
* Allocate the probe ID unrhdr before the DTrace kld_* event handlers aremarkj2013-12-311-2/+2
| | | | | | | registered. Otherwise there is a small window during which probe IDs may be allocated before the unrhdr is allocated. MFC after: 2 weeks
* Revert r260091. The vmem calls seem to be slower than the *_unr() calls thatmarkj2013-12-312-4/+3
| | | | | they replaced, which is important considering that probe IDs are allocated during process startup for USDT probes.
* Now that vmem(9) is available, use vmem arenas to allocate probe andmarkj2013-12-302-3/+4
| | | | | | | | aggregation IDs, as is done in the upstream illumos code. This still requires some FreeBSD-specific code, as our vmem API is not identical to the one in illumos. Submitted by: Mike Ma <mikemandarine@gmail.com>
OpenPOWER on IntegriCloud