summaryrefslogtreecommitdiffstats
path: root/module/spl/spl-debug.c
Commit message (Collapse)AuthorAgeFilesLines
* Rate limit debugging stack tracesBrian Behlendorf2014-07-221-7/+15
| | | | | | | | | | | | There have been issues in the past where excessive debug logging to the console has resulted in significant performance impacts. In the vast majority of these cases only a few stack traces are required to diagnose the issue. Therefore, stack traces dumped to the console will now we limited to 5 every 60s. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Prakash Surya <[email protected]> Closes #374
* Support post-3.13 kthread_create() semantics.Tim Chase2014-04-081-1/+2
| | | | | | | | | | | Provide spl_kthread_create() as a wrapper to the kernel's kthread_create() to provide pre-3.13 semantics. Re-try if the call is interrupted or if it would have returned -ENOMEM. Otherwise return NULL. Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #339
* Linux 3.11 compat: Replace num_physpages with totalram_pagesRichard Yao2013-08-081-2/+3
| | | | | | | | | | | | | | | | | | | | num_physpages was removed by torvalds/linux@cfa11e08ed39eb28a9eff9a907b20913020c69b5, so lets replace it with totalram_pages. This is a bug fix as much as it is a compatibility fix because num_physpages did not reflect the number of pages actually available to the kernel: http://lkml.indiana.edu/hypermail/linux/kernel/0908.2/01001.html Also, there are known issues with memory calculations when ZFS is in a Xen dom0. There is a chance that using totalram_pages could resolve them. This conjecture is untested at the time of writing. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #273
* Refresh links to web siteNed Bass2013-03-041-1/+1
| | | | | | | Update links to refer to the official ZFS on Linux website instead of @behlendorf's personal fork on github. Signed-off-by: Brian Behlendorf <[email protected]>
* Disable automatic log dumpingBrian Behlendorf2013-02-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Long ago infrastructure was added to the SPL to keep an internal debug log of the last few seconds of activity. This was helpful during the early development, but these days it is no longer needed. I haven't had to resort to this debug buffer to resolve an issue for several years now. Today better more generic tools like systemtap and ftrace have evolved to the point where they can be used for this purpose. Along with the stack trace dumped to the system console, and in rare cases a crash dump we almost always have the debug we need. Therefore, I'm disabling the code which automatically dumps this log to disk during an assertion except for the case where spl_debug_panic_on_bug is set (disabled by default). This should be viewed as a first step towards either. a) Retiring this infrastructure and complexity entirely, or b) Integrating this logging more properly with ftrace. As part of this change I'm also removing from the packages the undocumented spl utility which is used to decode the binary logs. Signed-off-by: Brian Behlendorf <[email protected]>
* Wrap trace_set_debug_header in trace_[get|put]_tcdPrakash Surya2012-08-231-2/+1
| | | | | | | | | | | | To properly support CONFIG_PREEMPT enabled kernels, we must refrain from using a CPU index when preemption is enabled. As a result, this change moves the trace_set_debug_header call (which calls smp_processor_id) within trace_get_tcd and trace_put_tcd (which disable and enable preemption respectively). Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #160
* Add --enable-debug-log configure optionBrian Behlendorf2012-02-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Until now the notion of an internal debug logging infrastructure was conflated with enabling ASSERT()s. This patch clarifies things by cleanly breaking the two subsystem apart. The result of this is the following behavior. --enable-debug - Enable/disable code wrapped in ASSERT()s. --disable-debug ASSERT()s are used to check invariants and are never required for correct operation. They are disabled by default because they may impact performance. --enable-debug-log - Enable/disable the debug log infrastructure. --disable-debug-log This infrastructure allows the spl code and its consumer to log messages to an in-kernel log. The granularity of the logging can be controlled by a debug mask. By default the mask disables most debug messages resulting in a negligible performance impact. Because of this the debug log is enabled by default. Signed-off-by: Brian Behlendorf <[email protected]>
* Prepend spl_ to all init/fini functionsBrian Behlendorf2011-11-111-2/+2
| | | | | | | | | | This is a bit of cleanup I'd been meaning to get to for a while to reduce the chance of a type conflict. Well that conflict finally occurred with the kstat_init() function which conflicts with a function in the 2.6.32-6-pve kernel. Signed-off-by: Brian Behlendorf <[email protected]> Closes #56
* Fix zlib compressionBrian Behlendorf2011-02-251-0/+2
| | | | | | | | | | | | | | | | While portions of the code needed to support z_compress_level() and z_uncompress() where in place. In reality the current implementation was non-functional, it just was compilable. The critical missing component was to setup a workspace for the compress/uncompress stream structures to use. A kmem_cache was added for the workspace area because we require a large chunk of memory. This avoids to need to continually alloc/free this memory and vmap() the pages which is very slow. Several objects will reside in the per-cpu kmem_cache making them quick to acquire and release. A further optimization would be to adjust the implementation to additional ensure the memory is local to the cpu. Currently that may not be the case.
* Add Thread Specific Data (TSD) ImplementationBrian Behlendorf2010-12-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thread specific data has implemented using a hash table, this avoids the need to add a member to the task structure and allows maximum portability between kernels. This implementation has been optimized to keep the tsd_set() and tsd_get() times as small as possible. The majority of the entries in the hash table are for specific tsd entries. These entries are hashed by the product of their key and pid because by design the key and pid are guaranteed to be unique. Their product also has the desirable properly that it will be uniformly distributed over the hash bins providing neither the pid nor key is zero. Under linux the zero pid is always the init process and thus won't be used, and this implementation is careful to never to assign a zero key. By default the hash table is sized to 512 bins which is expected to be sufficient for light to moderate usage of thread specific data. The hash table contains two additional type of entries. They first type is entry is called a 'key' entry and it is added to the hash during tsd_create(). It is used to store the address of the destructor function and it is used as an anchor point. All tsd entries which use the same key will be linked to this entry. This is used during tsd_destory() to quickly call the destructor function for all tsd associated with the key. The 'key' entry may be looked up with tsd_hash_search() by passing the key you wish to lookup and DTOR_PID constant as the pid. The second type of entry is called a 'pid' entry and it is added to the hash the first time a process set a key. The 'pid' entry is also used as an anchor and all tsd for the process will be linked to it. This list is using during tsd_exit() to ensure all registered destructors are run for the process. The 'pid' entry may be looked up with tsd_hash_search() by passing the PID_KEY constant as the key, and the process pid. Note that tsd_exit() is called by thread_exit() so if your using the Solaris thread API you should not need to call tsd_exit() directly.
* Remove deadcode caused by removal of format1 argBrian Behlendorf2010-07-211-14/+5
| | | | | | Commit 55abb0929e4fbe326a9737650a167a1a988ad86b removed the never used format1 argument of spl_debug_msg(). That in turn resulted in some deadcode which should be removed since it's now useless.
* Prefix all SPL debug macros with 'S'Brian Behlendorf2010-07-201-44/+64
| | | | | | | | To avoid conflicts with symbols defined by dependent packages all debugging symbols have been prefixed with a 'S' for SPL. Any dependent package needing to integrate with the SPL debug should include the spl-debug.h header and use the 'S' prefixed macros. They must also build with DEBUG defined.
* Split <sys/debug.h> headerBrian Behlendorf2010-07-201-41/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid symbol conflicts with dependent packages the debug header must be split in to several parts. The <sys/debug.h> header now only contains the Solaris macro's such as ASSERT and VERIFY. The spl-debug.h header contain the spl specific debugging infrastructure and should be included by any package which needs to use the spl logging. Finally the spl-trace.h header contains internal data structures only used for the log facility and should not be included by anythign by spl-debug.c. This way dependent packages can include the standard Solaris headers without picking up any SPL debug macros. However, if the dependant package want to integrate with the SPL debugging subsystem they can then explicitly include spl-debug.h. Along with this change I have dropped the CHECK_STACK macros because the upstream Linux kernel now has much better stack depth checking built in and we don't need this complexity. Additionally SBUG has been replaced with PANIC and provided as part of the Solaris macro set. While the Solaris version is really panic() that conflicts with the Linux kernel so we'll just have to make due to PANIC. It should rarely be called directly, the prefered usage would be an ASSERT or VERIFY. There's lots of change here but this cleanup was overdue.
* Linux 2.6.35 compat: filp_fsync() dropped 'stuct dentry *'Brian Behlendorf2010-07-141-27/+6
| | | | | | | The prototype for filp_fsync() drop the unused argument 'stuct dentry *'. I've fixed this by adding the needed autoconf check and moving all of those filp related functions to file_compat.h. This will simplify handling any further API changes in the future.
* Cleanly split Linux proc.h (fs) from conflicting Solaris proc.h (process)Brian Behlendorf2010-06-111-1/+1
| | | | | | | | Under linux the proc.h header is for the /proc filesystem, and under Solaris the proc/h header if for processes. This patch correctly moves the Linux proc functionality in a linux/proc_compat.h header and leaves the sys/proc.h for use by Solaris. Minor updates were required to all the call sites where it was included of course.
* Disable spl_debug_panic_on_bug by default.Brian Behlendorf2010-05-201-1/+1
| | | | | | | | While I may prefer to have the system panic on an SBUG and to get crash dump for analysis. I suspect most peoples systems are not configured from crash dump and the best thing to so is to simply halt the thread and print an error to the console. This way they have a good chance of actually saving the stack trace and debug log.
* Set default debug log patch to /tmp/spl-log.Brian Behlendorf2010-05-191-3/+3
| | | | | | | | Using /tmp/ is a preferable default, it can always be overriden using the module option on a case-by-case basis. Additionally standardize some log messages based on the same default log level used by the kernel.
* Public Release PrepBrian Behlendorf2010-05-171-24/+17
| | | | | | Updated AUTHORS, COPYING, DISCLAIMER, and INSTALL files. Added standardized headers to all source file to clearly indicate the copyright, license, and to give credit where credit is due.
* Dump log from current process when requiredBrian Behlendorf2010-04-231-0/+3
| | | | | | | When dumping a debug log first check that it is safe to create a new thread and block waiting for it. If we are in an atomic context or irqs and disabled it is not safe to sleep and we must write out of the debug log from the current process.
* Rebase cmn_err on vcmn_err and don't warn about missing \nBrian Behlendorf2009-10-271-4/+0
| | | | | | | | | | | The cmn_err/vcmn_err functions are layered on top of the debug system which usually expects a newline at the end. However, there really doesn't need to be a newline there and there in fact should not be for the CE_CONT case so let's just drop the warning. Also we make a half-hearted attempt to handle a leading ! which means only send it to the syslog not the console. In this case we just send to the the debug logs and not the console.
* Add basic credential support and splat tests.Brian Behlendorf2009-07-271-0/+2
| | | | | | | | | | | | | | | | | | | The previous credential implementation simply provided the needed types and a couple of dummy functions needed. This update correctly ties the basic Solaris credential API in to one of two Linux kernel APIs. Prior to 2.6.29 the linux kernel embeded all credentials in the task structure. For these kernels, we pass around the entire task struct as if it were the credential, then we use the helper functions to extract the credential related bits. As of 2.6.29 a new credential type was added which we can and do fairly cleanly layer on top of. Once again the helper functions nicely hide the implementation details from all callers. Three tests were added to the splat test framework to verify basic correctness. They should be extended as needed when need credential functions are added.
* SLES10 Fixes (part 7)Brian Behlendorf2009-05-201-1/+1
| | | | | | | | | | | - Initial SLES testing uncovered a long standing bug in the debug tracing. The tcd_for_each() macro expected a NULL to terminate the trace_data[i] array but this was only ever true due to luck. All trace_data[] iterators are now properly capped by TCD_TYPE_MAX. - SPLAT_MAJOR 229 conflicted with a 'hvc' device on my SLES system. Since this was always an arbitrary choice I picked something else. - The HAVE_PGDAT_LIST case should set pgdat_list_addr to the value stored at the address of the memory location returned by kallsyms_lookup_name().
* Ensure -NDEBUG does not get added to spl_config.h and is only set in the ↵Brian Behlendorf2009-01-201-2/+0
| | | | build options. This allows other kernel modules to use spl_config to leverage the reset of the config checks without getting confused with the debug options
* Rename modules to module and update referencesBrian Behlendorf2009-01-151-0/+1276