aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2009-03-24dma-debug: make memory range checks more consistentJoerg Roedel
Impact: extend on-kernel-stack DMA debug checks to all !highmem pages We only checked dma_map_single() - extend it to dma_map_page() and dma_map_sg() as well. Also, fix dma_map_single() corner case bug: make sure we dont stack-check highmem (not mapped) pages. Reported-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org LKML-Reference: <1237818908-26516-1-git-send-email-joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-24Merge commit 'origin/master' into nextBenjamin Herrenschmidt
2009-03-19dma-debug: warn of unmapping an invalid dma addressFUJITA Tomonori
Impact: extend DMA-debug checks Calling dma_unmap families against an invalid dma address should be a bug. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Joerg Roedel <joerg.roedel@amd.com> LKML-Reference: <20090319103743N.fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-18Merge branch 'dma-api/debug' of ↵Ingo Molnar
git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into core/iommu
2009-03-18Merge branch 'linus' into core/iommuIngo Molnar
2009-03-18Merge branches 'sched/cleanups' and 'linus' into sched/coreIngo Molnar
2009-03-17Merge branch 'linus' into core/printkIngo Molnar
2009-03-17dma-debug: add a check dma memory leaksJoerg Roedel
Impact: allow architectures to monitor busses for dma mem leakage This patch adds checking code to detect if a device has pending DMA operations when it is about to be unbound from its device driver. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-17dma-debug: add checks for kernel text and rodataJoerg Roedel
Impact: get notified if a device dma maps illegal areas This patch adds a check to print a warning message when a device driver tries to map a memory area from the kernel text segment or rodata. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-17dma-debug: print stacktrace of mapping path on unmap errorDavid Woodhouse
Impact: saves stacktrace of a dma mapping and prints it if there is an error Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-17dma-debug: add function to dump dma mappingsDavid Woodhouse
This adds a function to dump the DMA mappings that the debugging code is aware of -- either for a single device, or for _all_ devices. This can be useful for debugging -- sticking a call to it in the DMA page fault handler, for example, to see if the faulting address _should_ be mapped or not, and hence work out whether it's IOMMU bugs we're seeing, or driver bugs. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-03-17debugobjects: delay free of internal objectsThomas Gleixner
Impact: avoid recursive kfree calls, less slab activity on heavy load debugobjects checks on kfree whether tracked objects are freed. When a tracked object is freed debugobjects frees the internal reference object as well. The debug object slab cache is marked to not recurse into debugobjects when a slab objects is freed, but the recursive call can be problematic versus locking in the memory allocator. Defer the freeing of debug slab objects via schedule_work. The reasons not to use RCU are: 1) rcu makes the data structure larger 2) there is no real need for rcu as nothing references the obj after we freed it 3) under heavy load it is easier to reuse the to be freed objects instead of allocating new objects from the slab. This lowered the slab activity significantly in a heavy load networking test where lots of timers are created/destroyed. The workqueue based delayed free allows us just to put the to be freed objects back into the object pool and reuse them right away. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> LKML-Reference: <200903162049.58058.nickpiggin@yahoo.com.au>
2009-03-17debugobjects: replace static objects when slab cache becomes availableThomas Gleixner
Impact: refactor/consolidate object management, prepare for delayed free debugobjects allocates static reference objects to track objects which are initialized or activated before the slab cache becomes available. These static reference objects have to be handled seperately in free_object(). The handling of these objects is in the way of implementing a delayed free functionality. The delayed free is required to avoid callbacks into the mm code from debug_check_no_obj_freed(). Replace the static object references with dynamic ones after the slab cache has been initialized. The static objects are now marked initdata. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> LKML-Reference: <200903162049.58058.nickpiggin@yahoo.com.au>
2009-03-14vsprintf: unify the format decoding layer for its 3 users, cleanupVegard Nossum
Impact: cleanup Rename FORMAT_TYPE_WITDH to => FORMAT_TYPE_WIDTH Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-14fix regression from "vsprintf: unify the format decoding layer for its 3 users"Vegard Nossum
Jeremy Fitzhardinge reported: > Change fef20d9c1380f04ba9492d6463148db07b413708, "vsprintf: > unify the format decoding layer for its 3 users", causes a > regression in xenbus which results in no devices getting > attached to a new domain. %.*s is broken - fix it. Reported-by: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-13Merge branch 'for-rmk' of git://git.pengutronix.de/git/imx/linux-2.6 into develRussell King
Conflicts: arch/arm/mach-at91/gpio.c
2009-03-13Merge commit 'v2.6.29-rc8' into tracing/ftraceIngo Molnar
2009-03-13Merge branches 'sched/clock', 'sched/urgent' and 'linus' into sched/coreIngo Molnar
2009-03-12bitmap: fix end condition in bitmap_find_free_regionLinus Torvalds
Guennadi Liakhovetski noticed that the end condition for the loop in bitmap_find_free_region() is wrong, and the "return if error" was also using the wrong conditional that would only trigger if the bitmap was an exact multiple of the allocation size, which is not necessarily the case with dma_alloc_from_coherent(). Such a failure would end up in bitmap_find_free_region() accessing beyond the end of the bitmap. Reported-by: Guennadi Liakhovetski <lg@denx.de> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-03-13Merge branch 'core/locking' into tracing/ftraceIngo Molnar
2009-03-13locking: rename trace_softirq_[enter|exit] => lockdep_softirq_[enter|exit]Ingo Molnar
Impact: cleanup The naming clashes with upcoming softirq tracepoints, so rename the APIs to lockdep_*(). Requested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-13Merge branch 'linus' into core/lockingIngo Molnar
2009-03-11nlattr: Fix build error with NET offHerbert Xu
We moved the netlink attribute support from net to lib in order for it to be available for general consumption. However, parts of the code (the bits that we don't need :) really depends on NET because the target object is sk_buff. This patch fixes this by wrapping them in CONFIG_NET. Some EXPORTs have been moved to make this work. Tested-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-03-11Merge commit 'origin/master' into nextBenjamin Herrenschmidt
2009-03-10idr: make idr_remove_all() do removal -before- free_layer()Paul E. McKenney
Fix a problem in the IDR system, where an idr_remove_all() hands a data element to call_rcu() (via free_layer()) before making that data element inaccessible to new readers. This is very bad, and results in readers still having a reference to this data element at the end of the grace period. Tests on large machines that concurrently map and unmap user-space memory within the same multithreaded process result in crashes within about five minutes. Applying this patch increases the kernel's longevity to the three-to-eight-hour range. There appear to be other similar problems in idr_get_empty_slot() and sub_remove(), but I fixed the easy one in idr_remove_all() first. It is therefore no surprise that failures still occur. Located-by: Milton Miller II <miltonm@austin.ibm.com> Tested-by: Milton Miller II <miltonm@austin.ibm.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-03-10Merge branch 'core/printk' into tracing/ftraceIngo Molnar
2009-03-10vsprintf: fix bug in negative value printingFrederic Weisbecker
Sitsofe Wheeler found and bisected that while unifying the vsprintf format decoding in: fef20d9: vsprintf: unify the format decoding layer for its 3 users The sign flag has been dropped out in favour of precise types (ie: LONG/ULONG). But the format helper number() still needs this flag to keep track of the signedness unless it will consider all numbers as unsigned. Also add an explicit cast to int (for %d) while parsing with va_arg() to ensure the highest bit is well extended on the 64 bits number that hosts the value in case of negative values. Reported-Bisected-Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> LKML-Reference: <20090309201503.GA5010@nowhere> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-08Merge branches 'tracing/doc', 'tracing/ftrace', 'tracing/printk' and ↵Ingo Molnar
'tracing/textedit' into tracing/core
2009-03-06Merge branch 'core/printk' into tracing/ftraceIngo Molnar
2009-03-06vsprintf: unify the format decoding layer for its 3 usersFrederic Weisbecker
An new optimization is making its way to ftrace. Its purpose is to make trace_printk() consuming less memory and be faster. Written by Lai Jiangshan, the approach is to delay the formatting job from tracing time to output time. Currently, a call to trace_printk() will format the whole string and insert it into the ring buffer. Then you can read it on /debug/tracing/trace file. The new implementation stores the address of the format string and the binary parameters into the ring buffer, making the packet more compact and faster to insert. Later, when the user exports the traces, the format string is retrieved with the binary parameters and the formatting job is eventually done. The new implementation rewrites a lot of format decoding bits from vsnprintf() function, making now 3 differents functions to maintain in their duplicated parts of printf format decoding bits. Suggested by Ingo Molnar, this patch tries to factorize the most possible common bits from these functions. The real common part between them is the format decoding. Although they do somewhat similar jobs, their way to export or import the parameters is very different. Thus, only the decoding layer is extracted, unless you see other parts that could be worth factorized. Changes in V2: - Address a suggestion from Linus to group the format_decode() parameters inside a structure. Changes in v3: - Address other cleanups suggested by Ingo and Linus such as passing the printf_spec struct to the format helpers: pointer()/number()/string() Note that this struct is passed by copy and not by address. This is to avoid side effects because these functions often change these values and the changes shoudn't be persistant when a callee helper returns. It would be too risky. - Various cleanups (code alignement, switch/case instead of if/else fountains). - Fix a bug that printed the first format specifier following a %p Changes in v4: - drop unapropriate const qualifier loss while casting fmt to a char * (thanks to Vegard Nossum for having pointed this out). Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <1236356510-8381-6-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-06vsprintf: add binary printfLai Jiangshan
Impact: add new APIs for binary trace printk infrastructure vbin_printf(): write args to binary buffer, string is copied when "%s" is occurred. bstr_printf(): read from binary buffer for args and format a string [fweisbec@gmail.com: rebase] Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> LKML-Reference: <1236356510-8381-2-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-06Merge branch 'x86/core' into tracing/texteditIngo Molnar
Conflicts: arch/x86/Kconfig block/blktrace.c kernel/irq/handle.c Semantic conflict: kernel/trace/blktrace.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-06sched: TIF_NEED_RESCHED -> need_reshed() cleanupLai Jiangshan
Impact: cleanup Use test_tsk_need_resched(), set_tsk_need_resched(), need_resched() instead of using TIF_NEED_RESCHED. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <49B10BA4.9070209@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-05dma-debug: add checks for sync_single_sg_*Joerg Roedel
Impact: add debug callbacks for dma_sync_sg_* functions Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add checks for sync_single_range_*Joerg Roedel
Impact: add debug callbacks for dma_sync_single_range_for_* functions Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add checks for sync_single_*Joerg Roedel
Impact: add debug callbacks for dma_sync_single_for_* functions Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add checking for [alloc|free]_coherentJoerg Roedel
Impact: add debug callbacks for dma_[alloc|free]_coherent Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add add checking for map/unmap_sgJoerg Roedel
Impact: add debug callbacks for dma_{un}map_sg Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add checking for map/unmap_page/singleJoerg Roedel
Impact: add debug callbacks for dma_{un}map_[page|single] Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add core checking functionsJoerg Roedel
Impact: add functions to check on dma unmap and sync Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add debugfs interfaceJoerg Roedel
Impact: add debugfs interface for configuring DMA-API debugging Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add kernel command line parametersJoerg Roedel
Impact: add dma_debug= and dma_debug_entries= kernel parameters Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add initialization codeJoerg Roedel
Impact: add code to initialize dma-debug core data structures Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add allocator codeJoerg Roedel
Impact: add allocator code for struct dma_debug_entry Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add hash functions for dma_debug_entriesJoerg Roedel
Impact: implement necessary functions for the core hash Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add header file and core data structuresJoerg Roedel
Impact: add groundwork for DMA-API debugging Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add Kconfig entryJoerg Roedel
Impact: add a Kconfig entry for DMA-API debugging Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05Merge branch 'linus' into core/iommuIngo Molnar
2009-03-05Merge commit 'v2.6.29-rc7' into core/lockingIngo Molnar
2009-03-04Merge branch 'core/locking' into tracing/ftraceIngo Molnar