aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug23
-rw-r--r--lib/bitmap.c11
-rw-r--r--lib/debug_locks.c2
-rw-r--r--lib/debugobjects.c31
-rw-r--r--lib/kobject.c3
-rw-r--r--lib/lmb.c2
-rw-r--r--lib/vsprintf.c13
7 files changed, 61 insertions, 24 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 2fb6d90bf1e6..ccede1aeab38 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -394,7 +394,7 @@ config LOCKDEP
394 bool 394 bool
395 depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT 395 depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
396 select STACKTRACE 396 select STACKTRACE
397 select FRAME_POINTER if !X86 && !MIPS 397 select FRAME_POINTER if !X86 && !MIPS && !PPC
398 select KALLSYMS 398 select KALLSYMS
399 select KALLSYMS_ALL 399 select KALLSYMS_ALL
400 400
@@ -689,13 +689,13 @@ config FAULT_INJECTION_STACKTRACE_FILTER
689 depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT 689 depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
690 depends on !X86_64 690 depends on !X86_64
691 select STACKTRACE 691 select STACKTRACE
692 select FRAME_POINTER 692 select FRAME_POINTER if !PPC
693 help 693 help
694 Provide stacktrace filter for fault-injection capabilities 694 Provide stacktrace filter for fault-injection capabilities
695 695
696config LATENCYTOP 696config LATENCYTOP
697 bool "Latency measuring infrastructure" 697 bool "Latency measuring infrastructure"
698 select FRAME_POINTER if !MIPS 698 select FRAME_POINTER if !MIPS && !PPC
699 select KALLSYMS 699 select KALLSYMS
700 select KALLSYMS_ALL 700 select KALLSYMS_ALL
701 select STACKTRACE 701 select STACKTRACE
@@ -706,6 +706,14 @@ config LATENCYTOP
706 Enable this option if you want to use the LatencyTOP tool 706 Enable this option if you want to use the LatencyTOP tool
707 to find out which userspace is blocking on what kernel operations. 707 to find out which userspace is blocking on what kernel operations.
708 708
709config SYSCTL_SYSCALL_CHECK
710 bool "Sysctl checks"
711 depends on SYSCTL_SYSCALL
712 ---help---
713 sys_sysctl uses binary paths that have been found challenging
714 to properly maintain and use. This enables checks that help
715 you to keep things correct.
716
709source kernel/trace/Kconfig 717source kernel/trace/Kconfig
710 718
711config PROVIDE_OHCI1394_DMA_INIT 719config PROVIDE_OHCI1394_DMA_INIT
@@ -748,6 +756,15 @@ config FIREWIRE_OHCI_REMOTE_DMA
748 756
749 If unsure, say N. 757 If unsure, say N.
750 758
759menuconfig BUILD_DOCSRC
760 bool "Build targets in Documentation/ tree"
761 depends on HEADERS_CHECK
762 help
763 This option attempts to build objects from the source files in the
764 kernel Documentation/ tree.
765
766 Say N if you are unsure.
767
751source "samples/Kconfig" 768source "samples/Kconfig"
752 769
753source "lib/Kconfig.kgdb" 770source "lib/Kconfig.kgdb"
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 482df94ea21e..06fb57c86de0 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -316,6 +316,17 @@ int bitmap_scnprintf(char *buf, unsigned int buflen,
316EXPORT_SYMBOL(bitmap_scnprintf); 316EXPORT_SYMBOL(bitmap_scnprintf);
317 317
318/** 318/**
319 * bitmap_scnprintf_len - return buffer length needed to convert
320 * bitmap to an ASCII hex string
321 * @nr_bits: number of bits to be converted
322 */
323int bitmap_scnprintf_len(unsigned int nr_bits)
324{
325 unsigned int nr_nibbles = ALIGN(nr_bits, 4) / 4;
326 return nr_nibbles + ALIGN(nr_nibbles, CHUNKSZ / 4) / (CHUNKSZ / 4) - 1;
327}
328
329/**
319 * __bitmap_parse - convert an ASCII hex string into a bitmap. 330 * __bitmap_parse - convert an ASCII hex string into a bitmap.
320 * @buf: pointer to buffer containing string. 331 * @buf: pointer to buffer containing string.
321 * @buflen: buffer size in bytes. If string is smaller than this 332 * @buflen: buffer size in bytes. If string is smaller than this
diff --git a/lib/debug_locks.c b/lib/debug_locks.c
index 0ef01d14727c..0218b4693dd8 100644
--- a/lib/debug_locks.c
+++ b/lib/debug_locks.c
@@ -8,6 +8,7 @@
8 * 8 *
9 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 9 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
10 */ 10 */
11#include <linux/kernel.h>
11#include <linux/rwsem.h> 12#include <linux/rwsem.h>
12#include <linux/mutex.h> 13#include <linux/mutex.h>
13#include <linux/module.h> 14#include <linux/module.h>
@@ -37,6 +38,7 @@ int debug_locks_off(void)
37{ 38{
38 if (xchg(&debug_locks, 0)) { 39 if (xchg(&debug_locks, 0)) {
39 if (!debug_locks_silent) { 40 if (!debug_locks_silent) {
41 oops_in_progress = 1;
40 console_verbose(); 42 console_verbose();
41 return 1; 43 return 1;
42 } 44 }
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 45a6bde762d1..e3ab374e1334 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -112,6 +112,7 @@ static struct debug_obj *lookup_object(void *addr, struct debug_bucket *b)
112 112
113/* 113/*
114 * Allocate a new object. If the pool is empty, switch off the debugger. 114 * Allocate a new object. If the pool is empty, switch off the debugger.
115 * Must be called with interrupts disabled.
115 */ 116 */
116static struct debug_obj * 117static struct debug_obj *
117alloc_object(void *addr, struct debug_bucket *b, struct debug_obj_descr *descr) 118alloc_object(void *addr, struct debug_bucket *b, struct debug_obj_descr *descr)
@@ -148,17 +149,18 @@ alloc_object(void *addr, struct debug_bucket *b, struct debug_obj_descr *descr)
148static void free_object(struct debug_obj *obj) 149static void free_object(struct debug_obj *obj)
149{ 150{
150 unsigned long idx = (unsigned long)(obj - obj_static_pool); 151 unsigned long idx = (unsigned long)(obj - obj_static_pool);
152 unsigned long flags;
151 153
152 if (obj_pool_free < ODEBUG_POOL_SIZE || idx < ODEBUG_POOL_SIZE) { 154 if (obj_pool_free < ODEBUG_POOL_SIZE || idx < ODEBUG_POOL_SIZE) {
153 spin_lock(&pool_lock); 155 spin_lock_irqsave(&pool_lock, flags);
154 hlist_add_head(&obj->node, &obj_pool); 156 hlist_add_head(&obj->node, &obj_pool);
155 obj_pool_free++; 157 obj_pool_free++;
156 obj_pool_used--; 158 obj_pool_used--;
157 spin_unlock(&pool_lock); 159 spin_unlock_irqrestore(&pool_lock, flags);
158 } else { 160 } else {
159 spin_lock(&pool_lock); 161 spin_lock_irqsave(&pool_lock, flags);
160 obj_pool_used--; 162 obj_pool_used--;
161 spin_unlock(&pool_lock); 163 spin_unlock_irqrestore(&pool_lock, flags);
162 kmem_cache_free(obj_cache, obj); 164 kmem_cache_free(obj_cache, obj);
163 } 165 }
164} 166}
@@ -171,6 +173,7 @@ static void debug_objects_oom(void)
171{ 173{
172 struct debug_bucket *db = obj_hash; 174 struct debug_bucket *db = obj_hash;
173 struct hlist_node *node, *tmp; 175 struct hlist_node *node, *tmp;
176 HLIST_HEAD(freelist);
174 struct debug_obj *obj; 177 struct debug_obj *obj;
175 unsigned long flags; 178 unsigned long flags;
176 int i; 179 int i;
@@ -179,11 +182,14 @@ static void debug_objects_oom(void)
179 182
180 for (i = 0; i < ODEBUG_HASH_SIZE; i++, db++) { 183 for (i = 0; i < ODEBUG_HASH_SIZE; i++, db++) {
181 spin_lock_irqsave(&db->lock, flags); 184 spin_lock_irqsave(&db->lock, flags);
182 hlist_for_each_entry_safe(obj, node, tmp, &db->list, node) { 185 hlist_move_list(&db->list, &freelist);
186 spin_unlock_irqrestore(&db->lock, flags);
187
188 /* Now free them */
189 hlist_for_each_entry_safe(obj, node, tmp, &freelist, node) {
183 hlist_del(&obj->node); 190 hlist_del(&obj->node);
184 free_object(obj); 191 free_object(obj);
185 } 192 }
186 spin_unlock_irqrestore(&db->lock, flags);
187 } 193 }
188} 194}
189 195
@@ -498,8 +504,9 @@ void debug_object_free(void *addr, struct debug_obj_descr *descr)
498 return; 504 return;
499 default: 505 default:
500 hlist_del(&obj->node); 506 hlist_del(&obj->node);
507 spin_unlock_irqrestore(&db->lock, flags);
501 free_object(obj); 508 free_object(obj);
502 break; 509 return;
503 } 510 }
504out_unlock: 511out_unlock:
505 spin_unlock_irqrestore(&db->lock, flags); 512 spin_unlock_irqrestore(&db->lock, flags);
@@ -510,6 +517,7 @@ static void __debug_check_no_obj_freed(const void *address, unsigned long size)
510{ 517{
511 unsigned long flags, oaddr, saddr, eaddr, paddr, chunks; 518 unsigned long flags, oaddr, saddr, eaddr, paddr, chunks;
512 struct hlist_node *node, *tmp; 519 struct hlist_node *node, *tmp;
520 HLIST_HEAD(freelist);
513 struct debug_obj_descr *descr; 521 struct debug_obj_descr *descr;
514 enum debug_obj_state state; 522 enum debug_obj_state state;
515 struct debug_bucket *db; 523 struct debug_bucket *db;
@@ -545,11 +553,18 @@ repeat:
545 goto repeat; 553 goto repeat;
546 default: 554 default:
547 hlist_del(&obj->node); 555 hlist_del(&obj->node);
548 free_object(obj); 556 hlist_add_head(&obj->node, &freelist);
549 break; 557 break;
550 } 558 }
551 } 559 }
552 spin_unlock_irqrestore(&db->lock, flags); 560 spin_unlock_irqrestore(&db->lock, flags);
561
562 /* Now free them */
563 hlist_for_each_entry_safe(obj, node, tmp, &freelist, node) {
564 hlist_del(&obj->node);
565 free_object(obj);
566 }
567
553 if (cnt > debug_objects_maxchain) 568 if (cnt > debug_objects_maxchain)
554 debug_objects_maxchain = cnt; 569 debug_objects_maxchain = cnt;
555 } 570 }
diff --git a/lib/kobject.c b/lib/kobject.c
index bd732ffebc85..fbf0ae282376 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -223,8 +223,7 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
223 return -ENOMEM; 223 return -ENOMEM;
224 224
225 /* ewww... some of these buggers have '/' in the name ... */ 225 /* ewww... some of these buggers have '/' in the name ... */
226 s = strchr(kobj->name, '/'); 226 while ((s = strchr(kobj->name, '/')))
227 if (s)
228 s[0] = '!'; 227 s[0] = '!';
229 228
230 kfree(old_name); 229 kfree(old_name);
diff --git a/lib/lmb.c b/lib/lmb.c
index 5d7b9286503e..97e547037084 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -462,6 +462,8 @@ void __init lmb_enforce_memory_limit(u64 memory_limit)
462 if (lmb.memory.region[0].size < lmb.rmo_size) 462 if (lmb.memory.region[0].size < lmb.rmo_size)
463 lmb.rmo_size = lmb.memory.region[0].size; 463 lmb.rmo_size = lmb.memory.region[0].size;
464 464
465 memory_limit = lmb_end_of_DRAM();
466
465 /* And truncate any reserves above the limit also. */ 467 /* And truncate any reserves above the limit also. */
466 for (i = 0; i < lmb.reserved.cnt; i++) { 468 for (i = 0; i < lmb.reserved.cnt; i++) {
467 p = &lmb.reserved.region[i]; 469 p = &lmb.reserved.region[i];
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 1dc2d1d18fa8..c399bc1093cb 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -27,6 +27,7 @@
27 27
28#include <asm/page.h> /* for PAGE_SIZE */ 28#include <asm/page.h> /* for PAGE_SIZE */
29#include <asm/div64.h> 29#include <asm/div64.h>
30#include <asm/sections.h> /* for dereference_function_descriptor() */
30 31
31/* Works only for digits and letters, but small and fast */ 32/* Works only for digits and letters, but small and fast */
32#define TOLOWER(x) ((x) | 0x20) 33#define TOLOWER(x) ((x) | 0x20)
@@ -220,7 +221,7 @@ int strict_strtou##type(const char *cp, unsigned int base, valtype *res)\
220 if (len == 0) \ 221 if (len == 0) \
221 return -EINVAL; \ 222 return -EINVAL; \
222 \ 223 \
223 val = simple_strtoul(cp, &tail, base); \ 224 val = simple_strtou##type(cp, &tail, base); \
224 if ((*tail == '\0') || \ 225 if ((*tail == '\0') || \
225 ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {\ 226 ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {\
226 *res = val; \ 227 *res = val; \
@@ -513,16 +514,6 @@ static char *string(char *buf, char *end, char *s, int field_width, int precisio
513 return buf; 514 return buf;
514} 515}
515 516
516static inline void *dereference_function_descriptor(void *ptr)
517{
518#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
519 void *p;
520 if (!probe_kernel_address(ptr, p))
521 ptr = p;
522#endif
523 return ptr;
524}
525
526static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int precision, int flags) 517static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int precision, int flags)
527{ 518{
528 unsigned long value = (unsigned long) ptr; 519 unsigned long value = (unsigned long) ptr;