diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-08-20 06:39:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-20 06:39:18 -0400 |
commit | 170465ee7f5a9a2d0ac71285507e52642e040353 (patch) | |
tree | dbca81f04cde9e625170abbd6a72555cfbeb194e /lib | |
parent | 169ad16bb87c10a3f7c108bb7008ebc0270f617a (diff) | |
parent | 1fca25427482387689fa27594c992a961d98768f (diff) |
Merge branch 'linus' into x86/xen
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 17 | ||||
-rw-r--r-- | lib/Kconfig.kgdb | 11 | ||||
-rw-r--r-- | lib/bitmap.c | 11 | ||||
-rw-r--r-- | lib/debug_locks.c | 2 | ||||
-rw-r--r-- | lib/lmb.c | 2 | ||||
-rw-r--r-- | lib/random32.c | 48 | ||||
-rw-r--r-- | lib/vsprintf.c | 2 |
7 files changed, 67 insertions, 26 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index e1d4764435ed..8b5a7d304a5f 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -693,6 +693,14 @@ config LATENCYTOP | |||
693 | Enable this option if you want to use the LatencyTOP tool | 693 | Enable this option if you want to use the LatencyTOP tool |
694 | to find out which userspace is blocking on what kernel operations. | 694 | to find out which userspace is blocking on what kernel operations. |
695 | 695 | ||
696 | config SYSCTL_SYSCALL_CHECK | ||
697 | bool "Sysctl checks" | ||
698 | depends on SYSCTL_SYSCALL | ||
699 | ---help--- | ||
700 | sys_sysctl uses binary paths that have been found challenging | ||
701 | to properly maintain and use. This enables checks that help | ||
702 | you to keep things correct. | ||
703 | |||
696 | source kernel/trace/Kconfig | 704 | source kernel/trace/Kconfig |
697 | 705 | ||
698 | config PROVIDE_OHCI1394_DMA_INIT | 706 | config PROVIDE_OHCI1394_DMA_INIT |
@@ -735,6 +743,15 @@ config FIREWIRE_OHCI_REMOTE_DMA | |||
735 | 743 | ||
736 | If unsure, say N. | 744 | If unsure, say N. |
737 | 745 | ||
746 | menuconfig BUILD_DOCSRC | ||
747 | bool "Build targets in Documentation/ tree" | ||
748 | depends on HEADERS_CHECK | ||
749 | help | ||
750 | This option attempts to build objects from the source files in the | ||
751 | kernel Documentation/ tree. | ||
752 | |||
753 | Say N if you are unsure. | ||
754 | |||
738 | source "samples/Kconfig" | 755 | source "samples/Kconfig" |
739 | 756 | ||
740 | source "lib/Kconfig.kgdb" | 757 | source "lib/Kconfig.kgdb" |
diff --git a/lib/Kconfig.kgdb b/lib/Kconfig.kgdb index 2cfd2721f7ed..9b5d1d7f2ef7 100644 --- a/lib/Kconfig.kgdb +++ b/lib/Kconfig.kgdb | |||
@@ -4,14 +4,17 @@ config HAVE_ARCH_KGDB | |||
4 | 4 | ||
5 | menuconfig KGDB | 5 | menuconfig KGDB |
6 | bool "KGDB: kernel debugging with remote gdb" | 6 | bool "KGDB: kernel debugging with remote gdb" |
7 | select FRAME_POINTER | ||
8 | depends on HAVE_ARCH_KGDB | 7 | depends on HAVE_ARCH_KGDB |
9 | depends on DEBUG_KERNEL && EXPERIMENTAL | 8 | depends on DEBUG_KERNEL && EXPERIMENTAL |
10 | help | 9 | help |
11 | If you say Y here, it will be possible to remotely debug the | 10 | If you say Y here, it will be possible to remotely debug the |
12 | kernel using gdb. Documentation of kernel debugger is available | 11 | kernel using gdb. It is recommended but not required, that |
13 | at http://kgdb.sourceforge.net as well as in DocBook form | 12 | you also turn on the kernel config option |
14 | in Documentation/DocBook/. If unsure, say N. | 13 | CONFIG_FRAME_POINTER to aid in producing more reliable stack |
14 | backtraces in the external debugger. Documentation of | ||
15 | kernel debugger is available at http://kgdb.sourceforge.net | ||
16 | as well as in DocBook form in Documentation/DocBook/. If | ||
17 | unsure, say N. | ||
15 | 18 | ||
16 | if KGDB | 19 | if KGDB |
17 | 20 | ||
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, | |||
316 | EXPORT_SYMBOL(bitmap_scnprintf); | 316 | EXPORT_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 | */ | ||
323 | int 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 | } |
@@ -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/random32.c b/lib/random32.c index ca87d86992bd..217d5c4b666d 100644 --- a/lib/random32.c +++ b/lib/random32.c | |||
@@ -56,23 +56,12 @@ static u32 __random32(struct rnd_state *state) | |||
56 | return (state->s1 ^ state->s2 ^ state->s3); | 56 | return (state->s1 ^ state->s2 ^ state->s3); |
57 | } | 57 | } |
58 | 58 | ||
59 | static void __set_random32(struct rnd_state *state, unsigned long s) | 59 | /* |
60 | * Handle minimum values for seeds | ||
61 | */ | ||
62 | static inline u32 __seed(u32 x, u32 m) | ||
60 | { | 63 | { |
61 | if (s == 0) | 64 | return (x < m) ? x + m : x; |
62 | s = 1; /* default seed is 1 */ | ||
63 | |||
64 | #define LCG(n) (69069 * n) | ||
65 | state->s1 = LCG(s); | ||
66 | state->s2 = LCG(state->s1); | ||
67 | state->s3 = LCG(state->s2); | ||
68 | |||
69 | /* "warm it up" */ | ||
70 | __random32(state); | ||
71 | __random32(state); | ||
72 | __random32(state); | ||
73 | __random32(state); | ||
74 | __random32(state); | ||
75 | __random32(state); | ||
76 | } | 65 | } |
77 | 66 | ||
78 | /** | 67 | /** |
@@ -107,7 +96,7 @@ void srandom32(u32 entropy) | |||
107 | */ | 96 | */ |
108 | for_each_possible_cpu (i) { | 97 | for_each_possible_cpu (i) { |
109 | struct rnd_state *state = &per_cpu(net_rand_state, i); | 98 | struct rnd_state *state = &per_cpu(net_rand_state, i); |
110 | __set_random32(state, state->s1 ^ entropy); | 99 | state->s1 = __seed(state->s1 ^ entropy, 1); |
111 | } | 100 | } |
112 | } | 101 | } |
113 | EXPORT_SYMBOL(srandom32); | 102 | EXPORT_SYMBOL(srandom32); |
@@ -122,7 +111,19 @@ static int __init random32_init(void) | |||
122 | 111 | ||
123 | for_each_possible_cpu(i) { | 112 | for_each_possible_cpu(i) { |
124 | struct rnd_state *state = &per_cpu(net_rand_state,i); | 113 | struct rnd_state *state = &per_cpu(net_rand_state,i); |
125 | __set_random32(state, i + jiffies); | 114 | |
115 | #define LCG(x) ((x) * 69069) /* super-duper LCG */ | ||
116 | state->s1 = __seed(LCG(i + jiffies), 1); | ||
117 | state->s2 = __seed(LCG(state->s1), 7); | ||
118 | state->s3 = __seed(LCG(state->s2), 15); | ||
119 | |||
120 | /* "warm it up" */ | ||
121 | __random32(state); | ||
122 | __random32(state); | ||
123 | __random32(state); | ||
124 | __random32(state); | ||
125 | __random32(state); | ||
126 | __random32(state); | ||
126 | } | 127 | } |
127 | return 0; | 128 | return 0; |
128 | } | 129 | } |
@@ -135,13 +136,18 @@ core_initcall(random32_init); | |||
135 | static int __init random32_reseed(void) | 136 | static int __init random32_reseed(void) |
136 | { | 137 | { |
137 | int i; | 138 | int i; |
138 | unsigned long seed; | ||
139 | 139 | ||
140 | for_each_possible_cpu(i) { | 140 | for_each_possible_cpu(i) { |
141 | struct rnd_state *state = &per_cpu(net_rand_state,i); | 141 | struct rnd_state *state = &per_cpu(net_rand_state,i); |
142 | u32 seeds[3]; | ||
143 | |||
144 | get_random_bytes(&seeds, sizeof(seeds)); | ||
145 | state->s1 = __seed(seeds[0], 1); | ||
146 | state->s2 = __seed(seeds[1], 7); | ||
147 | state->s3 = __seed(seeds[2], 15); | ||
142 | 148 | ||
143 | get_random_bytes(&seed, sizeof(seed)); | 149 | /* mix it in */ |
144 | __set_random32(state, seed); | 150 | __random32(state); |
145 | } | 151 | } |
146 | return 0; | 152 | return 0; |
147 | } | 153 | } |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 1dc2d1d18fa8..d8d1d1142248 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -220,7 +220,7 @@ int strict_strtou##type(const char *cp, unsigned int base, valtype *res)\ | |||
220 | if (len == 0) \ | 220 | if (len == 0) \ |
221 | return -EINVAL; \ | 221 | return -EINVAL; \ |
222 | \ | 222 | \ |
223 | val = simple_strtoul(cp, &tail, base); \ | 223 | val = simple_strtou##type(cp, &tail, base); \ |
224 | if ((*tail == '\0') || \ | 224 | if ((*tail == '\0') || \ |
225 | ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {\ | 225 | ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {\ |
226 | *res = val; \ | 226 | *res = val; \ |