diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 65 | ||||
-rw-r--r-- | lib/bug.c | 18 | ||||
-rw-r--r-- | lib/decompress_bunzip2.c | 10 | ||||
-rw-r--r-- | lib/dma-debug.c | 1 | ||||
-rw-r--r-- | lib/dynamic_debug.c | 140 | ||||
-rw-r--r-- | lib/inflate.c | 2 | ||||
-rw-r--r-- | lib/kobject.c | 39 | ||||
-rw-r--r-- | lib/kobject_uevent.c | 4 | ||||
-rw-r--r-- | lib/list_sort.c | 2 | ||||
-rw-r--r-- | lib/radix-tree.c | 70 | ||||
-rw-r--r-- | lib/raid6/.gitignore | 4 | ||||
-rw-r--r-- | lib/raid6/Makefile | 81 | ||||
-rw-r--r-- | lib/raid6/algos.c (renamed from lib/raid6/raid6algos.c) | 4 | ||||
-rw-r--r-- | lib/raid6/altivec.uc (renamed from lib/raid6/raid6altivec.uc) | 0 | ||||
-rw-r--r-- | lib/raid6/int.uc (renamed from lib/raid6/raid6int.uc) | 0 | ||||
-rw-r--r-- | lib/raid6/mmx.c (renamed from lib/raid6/raid6mmx.c) | 6 | ||||
-rw-r--r-- | lib/raid6/raid6test/Makefile | 75 | ||||
-rw-r--r-- | lib/raid6/recov.c (renamed from lib/raid6/raid6recov.c) | 2 | ||||
-rw-r--r-- | lib/raid6/sse1.c (renamed from lib/raid6/raid6sse1.c) | 6 | ||||
-rw-r--r-- | lib/raid6/sse2.c (renamed from lib/raid6/raid6sse2.c) | 4 | ||||
-rw-r--r-- | lib/raid6/test/Makefile | 72 | ||||
-rw-r--r-- | lib/raid6/test/test.c (renamed from lib/raid6/raid6test/test.c) | 0 | ||||
-rw-r--r-- | lib/raid6/x86.h (renamed from lib/raid6/raid6x86.h) | 2 | ||||
-rw-r--r-- | lib/scatterlist.c | 14 | ||||
-rw-r--r-- | lib/swiotlb.c | 18 |
25 files changed, 398 insertions, 241 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 9e06b7f5ecf1..69a32664c289 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -353,7 +353,7 @@ config SLUB_DEBUG_ON | |||
353 | config SLUB_STATS | 353 | config SLUB_STATS |
354 | default n | 354 | default n |
355 | bool "Enable SLUB performance statistics" | 355 | bool "Enable SLUB performance statistics" |
356 | depends on SLUB && SLUB_DEBUG && SYSFS | 356 | depends on SLUB && SYSFS |
357 | help | 357 | help |
358 | SLUB statistics are useful to debug SLUBs allocation behavior in | 358 | SLUB statistics are useful to debug SLUBs allocation behavior in |
359 | order find ways to optimize the allocator. This should never be | 359 | order find ways to optimize the allocator. This should never be |
@@ -461,6 +461,15 @@ config DEBUG_MUTEXES | |||
461 | This feature allows mutex semantics violations to be detected and | 461 | This feature allows mutex semantics violations to be detected and |
462 | reported. | 462 | reported. |
463 | 463 | ||
464 | config BKL | ||
465 | bool "Big Kernel Lock" if (SMP || PREEMPT) | ||
466 | default y | ||
467 | help | ||
468 | This is the traditional lock that is used in old code instead | ||
469 | of proper locking. All drivers that use the BKL should depend | ||
470 | on this symbol. | ||
471 | Say Y here unless you are working on removing the BKL. | ||
472 | |||
464 | config DEBUG_LOCK_ALLOC | 473 | config DEBUG_LOCK_ALLOC |
465 | bool "Lock debugging: detect incorrect freeing of live locks" | 474 | bool "Lock debugging: detect incorrect freeing of live locks" |
466 | depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT | 475 | depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT |
@@ -482,6 +491,7 @@ config PROVE_LOCKING | |||
482 | select DEBUG_SPINLOCK | 491 | select DEBUG_SPINLOCK |
483 | select DEBUG_MUTEXES | 492 | select DEBUG_MUTEXES |
484 | select DEBUG_LOCK_ALLOC | 493 | select DEBUG_LOCK_ALLOC |
494 | select TRACE_IRQFLAGS | ||
485 | default n | 495 | default n |
486 | help | 496 | help |
487 | This feature enables the kernel to prove that all locking | 497 | This feature enables the kernel to prove that all locking |
@@ -539,6 +549,23 @@ config PROVE_RCU_REPEATEDLY | |||
539 | disabling, allowing multiple RCU-lockdep warnings to be printed | 549 | disabling, allowing multiple RCU-lockdep warnings to be printed |
540 | on a single reboot. | 550 | on a single reboot. |
541 | 551 | ||
552 | Say Y to allow multiple RCU-lockdep warnings per boot. | ||
553 | |||
554 | Say N if you are unsure. | ||
555 | |||
556 | config SPARSE_RCU_POINTER | ||
557 | bool "RCU debugging: sparse-based checks for pointer usage" | ||
558 | default n | ||
559 | help | ||
560 | This feature enables the __rcu sparse annotation for | ||
561 | RCU-protected pointers. This annotation will cause sparse | ||
562 | to flag any non-RCU used of annotated pointers. This can be | ||
563 | helpful when debugging RCU usage. Please note that this feature | ||
564 | is not intended to enforce code cleanliness; it is instead merely | ||
565 | a debugging aid. | ||
566 | |||
567 | Say Y to make sparse flag questionable use of RCU-protected pointers | ||
568 | |||
542 | Say N if you are unsure. | 569 | Say N if you are unsure. |
543 | 570 | ||
544 | config LOCKDEP | 571 | config LOCKDEP |
@@ -579,11 +606,10 @@ config DEBUG_LOCKDEP | |||
579 | of more runtime overhead. | 606 | of more runtime overhead. |
580 | 607 | ||
581 | config TRACE_IRQFLAGS | 608 | config TRACE_IRQFLAGS |
582 | depends on DEBUG_KERNEL | ||
583 | bool | 609 | bool |
584 | default y | 610 | help |
585 | depends on TRACE_IRQFLAGS_SUPPORT | 611 | Enables hooks to interrupt enabling and disabling for |
586 | depends on PROVE_LOCKING | 612 | either tracing or lock debugging. |
587 | 613 | ||
588 | config DEBUG_SPINLOCK_SLEEP | 614 | config DEBUG_SPINLOCK_SLEEP |
589 | bool "Spinlock debugging: sleep-inside-spinlock checking" | 615 | bool "Spinlock debugging: sleep-inside-spinlock checking" |
@@ -832,6 +858,30 @@ config RCU_CPU_STALL_DETECTOR | |||
832 | 858 | ||
833 | Say Y if you are unsure. | 859 | Say Y if you are unsure. |
834 | 860 | ||
861 | config RCU_CPU_STALL_TIMEOUT | ||
862 | int "RCU CPU stall timeout in seconds" | ||
863 | depends on RCU_CPU_STALL_DETECTOR | ||
864 | range 3 300 | ||
865 | default 60 | ||
866 | help | ||
867 | If a given RCU grace period extends more than the specified | ||
868 | number of seconds, a CPU stall warning is printed. If the | ||
869 | RCU grace period persists, additional CPU stall warnings are | ||
870 | printed at more widely spaced intervals. | ||
871 | |||
872 | config RCU_CPU_STALL_DETECTOR_RUNNABLE | ||
873 | bool "RCU CPU stall checking starts automatically at boot" | ||
874 | depends on RCU_CPU_STALL_DETECTOR | ||
875 | default y | ||
876 | help | ||
877 | If set, start checking for RCU CPU stalls immediately on | ||
878 | boot. Otherwise, RCU CPU stall checking must be manually | ||
879 | enabled. | ||
880 | |||
881 | Say Y if you are unsure. | ||
882 | |||
883 | Say N if you wish to suppress RCU CPU stall checking during boot. | ||
884 | |||
835 | config RCU_CPU_STALL_VERBOSE | 885 | config RCU_CPU_STALL_VERBOSE |
836 | bool "Print additional per-task information for RCU_CPU_STALL_DETECTOR" | 886 | bool "Print additional per-task information for RCU_CPU_STALL_DETECTOR" |
837 | depends on RCU_CPU_STALL_DETECTOR && TREE_PREEMPT_RCU | 887 | depends on RCU_CPU_STALL_DETECTOR && TREE_PREEMPT_RCU |
@@ -994,13 +1044,16 @@ config FAULT_INJECTION_STACKTRACE_FILTER | |||
994 | 1044 | ||
995 | config LATENCYTOP | 1045 | config LATENCYTOP |
996 | bool "Latency measuring infrastructure" | 1046 | bool "Latency measuring infrastructure" |
1047 | depends on HAVE_LATENCYTOP_SUPPORT | ||
1048 | depends on DEBUG_KERNEL | ||
1049 | depends on STACKTRACE_SUPPORT | ||
1050 | depends on PROC_FS | ||
997 | select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE | 1051 | select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE |
998 | select KALLSYMS | 1052 | select KALLSYMS |
999 | select KALLSYMS_ALL | 1053 | select KALLSYMS_ALL |
1000 | select STACKTRACE | 1054 | select STACKTRACE |
1001 | select SCHEDSTATS | 1055 | select SCHEDSTATS |
1002 | select SCHED_DEBUG | 1056 | select SCHED_DEBUG |
1003 | depends on HAVE_LATENCYTOP_SUPPORT | ||
1004 | help | 1057 | help |
1005 | Enable this option if you want to use the LatencyTOP tool | 1058 | Enable this option if you want to use the LatencyTOP tool |
1006 | to find out which userspace is blocking on what kernel operations. | 1059 | to find out which userspace is blocking on what kernel operations. |
@@ -72,8 +72,8 @@ static const struct bug_entry *module_find_bug(unsigned long bugaddr) | |||
72 | return NULL; | 72 | return NULL; |
73 | } | 73 | } |
74 | 74 | ||
75 | int module_bug_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, | 75 | void module_bug_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, |
76 | struct module *mod) | 76 | struct module *mod) |
77 | { | 77 | { |
78 | char *secstrings; | 78 | char *secstrings; |
79 | unsigned int i; | 79 | unsigned int i; |
@@ -97,8 +97,6 @@ int module_bug_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, | |||
97 | * could potentially lead to deadlock and thus be counter-productive. | 97 | * could potentially lead to deadlock and thus be counter-productive. |
98 | */ | 98 | */ |
99 | list_add(&mod->bug_list, &module_bug_list); | 99 | list_add(&mod->bug_list, &module_bug_list); |
100 | |||
101 | return 0; | ||
102 | } | 100 | } |
103 | 101 | ||
104 | void module_bug_cleanup(struct module *mod) | 102 | void module_bug_cleanup(struct module *mod) |
@@ -136,8 +134,6 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
136 | 134 | ||
137 | bug = find_bug(bugaddr); | 135 | bug = find_bug(bugaddr); |
138 | 136 | ||
139 | printk(KERN_EMERG "------------[ cut here ]------------\n"); | ||
140 | |||
141 | file = NULL; | 137 | file = NULL; |
142 | line = 0; | 138 | line = 0; |
143 | warning = 0; | 139 | warning = 0; |
@@ -156,19 +152,25 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
156 | 152 | ||
157 | if (warning) { | 153 | if (warning) { |
158 | /* this is a WARN_ON rather than BUG/BUG_ON */ | 154 | /* this is a WARN_ON rather than BUG/BUG_ON */ |
155 | printk(KERN_WARNING "------------[ cut here ]------------\n"); | ||
156 | |||
159 | if (file) | 157 | if (file) |
160 | printk(KERN_ERR "Badness at %s:%u\n", | 158 | printk(KERN_WARNING "WARNING: at %s:%u\n", |
161 | file, line); | 159 | file, line); |
162 | else | 160 | else |
163 | printk(KERN_ERR "Badness at %p " | 161 | printk(KERN_WARNING "WARNING: at %p " |
164 | "[verbose debug info unavailable]\n", | 162 | "[verbose debug info unavailable]\n", |
165 | (void *)bugaddr); | 163 | (void *)bugaddr); |
166 | 164 | ||
165 | print_modules(); | ||
167 | show_regs(regs); | 166 | show_regs(regs); |
167 | print_oops_end_marker(); | ||
168 | add_taint(BUG_GET_TAINT(bug)); | 168 | add_taint(BUG_GET_TAINT(bug)); |
169 | return BUG_TRAP_TYPE_WARN; | 169 | return BUG_TRAP_TYPE_WARN; |
170 | } | 170 | } |
171 | 171 | ||
172 | printk(KERN_EMERG "------------[ cut here ]------------\n"); | ||
173 | |||
172 | if (file) | 174 | if (file) |
173 | printk(KERN_CRIT "kernel BUG at %s:%u!\n", | 175 | printk(KERN_CRIT "kernel BUG at %s:%u!\n", |
174 | file, line); | 176 | file, line); |
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c index a4e971dee102..81c8bb1cc6aa 100644 --- a/lib/decompress_bunzip2.c +++ b/lib/decompress_bunzip2.c | |||
@@ -107,6 +107,8 @@ struct bunzip_data { | |||
107 | unsigned char selectors[32768]; /* nSelectors = 15 bits */ | 107 | unsigned char selectors[32768]; /* nSelectors = 15 bits */ |
108 | struct group_data groups[MAX_GROUPS]; /* Huffman coding tables */ | 108 | struct group_data groups[MAX_GROUPS]; /* Huffman coding tables */ |
109 | int io_error; /* non-zero if we have IO error */ | 109 | int io_error; /* non-zero if we have IO error */ |
110 | int byteCount[256]; | ||
111 | unsigned char symToByte[256], mtfSymbol[256]; | ||
110 | }; | 112 | }; |
111 | 113 | ||
112 | 114 | ||
@@ -158,14 +160,16 @@ static int INIT get_next_block(struct bunzip_data *bd) | |||
158 | int *base = NULL; | 160 | int *base = NULL; |
159 | int *limit = NULL; | 161 | int *limit = NULL; |
160 | int dbufCount, nextSym, dbufSize, groupCount, selector, | 162 | int dbufCount, nextSym, dbufSize, groupCount, selector, |
161 | i, j, k, t, runPos, symCount, symTotal, nSelectors, | 163 | i, j, k, t, runPos, symCount, symTotal, nSelectors, *byteCount; |
162 | byteCount[256]; | 164 | unsigned char uc, *symToByte, *mtfSymbol, *selectors; |
163 | unsigned char uc, symToByte[256], mtfSymbol[256], *selectors; | ||
164 | unsigned int *dbuf, origPtr; | 165 | unsigned int *dbuf, origPtr; |
165 | 166 | ||
166 | dbuf = bd->dbuf; | 167 | dbuf = bd->dbuf; |
167 | dbufSize = bd->dbufSize; | 168 | dbufSize = bd->dbufSize; |
168 | selectors = bd->selectors; | 169 | selectors = bd->selectors; |
170 | byteCount = bd->byteCount; | ||
171 | symToByte = bd->symToByte; | ||
172 | mtfSymbol = bd->mtfSymbol; | ||
169 | 173 | ||
170 | /* Read in header signature and CRC, then validate signature. | 174 | /* Read in header signature and CRC, then validate signature. |
171 | (last block signature means CRC is for whole file, return now) */ | 175 | (last block signature means CRC is for whole file, return now) */ |
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 01e64270e246..4bfb0471f106 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -590,6 +590,7 @@ out_unlock: | |||
590 | static const struct file_operations filter_fops = { | 590 | static const struct file_operations filter_fops = { |
591 | .read = filter_read, | 591 | .read = filter_read, |
592 | .write = filter_write, | 592 | .write = filter_write, |
593 | .llseek = default_llseek, | ||
593 | }; | 594 | }; |
594 | 595 | ||
595 | static int dma_debug_fs_init(void) | 596 | static int dma_debug_fs_init(void) |
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 02afc2533728..3094318bfea7 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -26,19 +26,11 @@ | |||
26 | #include <linux/dynamic_debug.h> | 26 | #include <linux/dynamic_debug.h> |
27 | #include <linux/debugfs.h> | 27 | #include <linux/debugfs.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/jump_label.h> | ||
29 | 30 | ||
30 | extern struct _ddebug __start___verbose[]; | 31 | extern struct _ddebug __start___verbose[]; |
31 | extern struct _ddebug __stop___verbose[]; | 32 | extern struct _ddebug __stop___verbose[]; |
32 | 33 | ||
33 | /* dynamic_debug_enabled, and dynamic_debug_enabled2 are bitmasks in which | ||
34 | * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They | ||
35 | * use independent hash functions, to reduce the chance of false positives. | ||
36 | */ | ||
37 | long long dynamic_debug_enabled; | ||
38 | EXPORT_SYMBOL_GPL(dynamic_debug_enabled); | ||
39 | long long dynamic_debug_enabled2; | ||
40 | EXPORT_SYMBOL_GPL(dynamic_debug_enabled2); | ||
41 | |||
42 | struct ddebug_table { | 34 | struct ddebug_table { |
43 | struct list_head link; | 35 | struct list_head link; |
44 | char *mod_name; | 36 | char *mod_name; |
@@ -88,26 +80,6 @@ static char *ddebug_describe_flags(struct _ddebug *dp, char *buf, | |||
88 | } | 80 | } |
89 | 81 | ||
90 | /* | 82 | /* |
91 | * must be called with ddebug_lock held | ||
92 | */ | ||
93 | |||
94 | static int disabled_hash(char hash, bool first_table) | ||
95 | { | ||
96 | struct ddebug_table *dt; | ||
97 | char table_hash_value; | ||
98 | |||
99 | list_for_each_entry(dt, &ddebug_tables, link) { | ||
100 | if (first_table) | ||
101 | table_hash_value = dt->ddebugs->primary_hash; | ||
102 | else | ||
103 | table_hash_value = dt->ddebugs->secondary_hash; | ||
104 | if (dt->num_enabled && (hash == table_hash_value)) | ||
105 | return 0; | ||
106 | } | ||
107 | return 1; | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * Search the tables for _ddebug's which match the given | 83 | * Search the tables for _ddebug's which match the given |
112 | * `query' and apply the `flags' and `mask' to them. Tells | 84 | * `query' and apply the `flags' and `mask' to them. Tells |
113 | * the user which ddebug's were changed, or whether none | 85 | * the user which ddebug's were changed, or whether none |
@@ -170,17 +142,9 @@ static void ddebug_change(const struct ddebug_query *query, | |||
170 | dt->num_enabled++; | 142 | dt->num_enabled++; |
171 | dp->flags = newflags; | 143 | dp->flags = newflags; |
172 | if (newflags) { | 144 | if (newflags) { |
173 | dynamic_debug_enabled |= | 145 | jump_label_enable(&dp->enabled); |
174 | (1LL << dp->primary_hash); | ||
175 | dynamic_debug_enabled2 |= | ||
176 | (1LL << dp->secondary_hash); | ||
177 | } else { | 146 | } else { |
178 | if (disabled_hash(dp->primary_hash, true)) | 147 | jump_label_disable(&dp->enabled); |
179 | dynamic_debug_enabled &= | ||
180 | ~(1LL << dp->primary_hash); | ||
181 | if (disabled_hash(dp->secondary_hash, false)) | ||
182 | dynamic_debug_enabled2 &= | ||
183 | ~(1LL << dp->secondary_hash); | ||
184 | } | 148 | } |
185 | if (verbose) | 149 | if (verbose) |
186 | printk(KERN_INFO | 150 | printk(KERN_INFO |
@@ -429,6 +393,40 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp, | |||
429 | return 0; | 393 | return 0; |
430 | } | 394 | } |
431 | 395 | ||
396 | static int ddebug_exec_query(char *query_string) | ||
397 | { | ||
398 | unsigned int flags = 0, mask = 0; | ||
399 | struct ddebug_query query; | ||
400 | #define MAXWORDS 9 | ||
401 | int nwords; | ||
402 | char *words[MAXWORDS]; | ||
403 | |||
404 | nwords = ddebug_tokenize(query_string, words, MAXWORDS); | ||
405 | if (nwords <= 0) | ||
406 | return -EINVAL; | ||
407 | if (ddebug_parse_query(words, nwords-1, &query)) | ||
408 | return -EINVAL; | ||
409 | if (ddebug_parse_flags(words[nwords-1], &flags, &mask)) | ||
410 | return -EINVAL; | ||
411 | |||
412 | /* actually go and implement the change */ | ||
413 | ddebug_change(&query, flags, mask); | ||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | static __initdata char ddebug_setup_string[1024]; | ||
418 | static __init int ddebug_setup_query(char *str) | ||
419 | { | ||
420 | if (strlen(str) >= 1024) { | ||
421 | pr_warning("ddebug boot param string too large\n"); | ||
422 | return 0; | ||
423 | } | ||
424 | strcpy(ddebug_setup_string, str); | ||
425 | return 1; | ||
426 | } | ||
427 | |||
428 | __setup("ddebug_query=", ddebug_setup_query); | ||
429 | |||
432 | /* | 430 | /* |
433 | * File_ops->write method for <debugfs>/dynamic_debug/conrol. Gathers the | 431 | * File_ops->write method for <debugfs>/dynamic_debug/conrol. Gathers the |
434 | * command text from userspace, parses and executes it. | 432 | * command text from userspace, parses and executes it. |
@@ -436,12 +434,8 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp, | |||
436 | static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf, | 434 | static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf, |
437 | size_t len, loff_t *offp) | 435 | size_t len, loff_t *offp) |
438 | { | 436 | { |
439 | unsigned int flags = 0, mask = 0; | ||
440 | struct ddebug_query query; | ||
441 | #define MAXWORDS 9 | ||
442 | int nwords; | ||
443 | char *words[MAXWORDS]; | ||
444 | char tmpbuf[256]; | 437 | char tmpbuf[256]; |
438 | int ret; | ||
445 | 439 | ||
446 | if (len == 0) | 440 | if (len == 0) |
447 | return 0; | 441 | return 0; |
@@ -455,16 +449,9 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf, | |||
455 | printk(KERN_INFO "%s: read %d bytes from userspace\n", | 449 | printk(KERN_INFO "%s: read %d bytes from userspace\n", |
456 | __func__, (int)len); | 450 | __func__, (int)len); |
457 | 451 | ||
458 | nwords = ddebug_tokenize(tmpbuf, words, MAXWORDS); | 452 | ret = ddebug_exec_query(tmpbuf); |
459 | if (nwords <= 0) | 453 | if (ret) |
460 | return -EINVAL; | 454 | return ret; |
461 | if (ddebug_parse_query(words, nwords-1, &query)) | ||
462 | return -EINVAL; | ||
463 | if (ddebug_parse_flags(words[nwords-1], &flags, &mask)) | ||
464 | return -EINVAL; | ||
465 | |||
466 | /* actually go and implement the change */ | ||
467 | ddebug_change(&query, flags, mask); | ||
468 | 455 | ||
469 | *offp += len; | 456 | *offp += len; |
470 | return len; | 457 | return len; |
@@ -725,13 +712,14 @@ static void ddebug_remove_all_tables(void) | |||
725 | mutex_unlock(&ddebug_lock); | 712 | mutex_unlock(&ddebug_lock); |
726 | } | 713 | } |
727 | 714 | ||
728 | static int __init dynamic_debug_init(void) | 715 | static __initdata int ddebug_init_success; |
716 | |||
717 | static int __init dynamic_debug_init_debugfs(void) | ||
729 | { | 718 | { |
730 | struct dentry *dir, *file; | 719 | struct dentry *dir, *file; |
731 | struct _ddebug *iter, *iter_start; | 720 | |
732 | const char *modname = NULL; | 721 | if (!ddebug_init_success) |
733 | int ret = 0; | 722 | return -ENODEV; |
734 | int n = 0; | ||
735 | 723 | ||
736 | dir = debugfs_create_dir("dynamic_debug", NULL); | 724 | dir = debugfs_create_dir("dynamic_debug", NULL); |
737 | if (!dir) | 725 | if (!dir) |
@@ -742,6 +730,16 @@ static int __init dynamic_debug_init(void) | |||
742 | debugfs_remove(dir); | 730 | debugfs_remove(dir); |
743 | return -ENOMEM; | 731 | return -ENOMEM; |
744 | } | 732 | } |
733 | return 0; | ||
734 | } | ||
735 | |||
736 | static int __init dynamic_debug_init(void) | ||
737 | { | ||
738 | struct _ddebug *iter, *iter_start; | ||
739 | const char *modname = NULL; | ||
740 | int ret = 0; | ||
741 | int n = 0; | ||
742 | |||
745 | if (__start___verbose != __stop___verbose) { | 743 | if (__start___verbose != __stop___verbose) { |
746 | iter = __start___verbose; | 744 | iter = __start___verbose; |
747 | modname = iter->modname; | 745 | modname = iter->modname; |
@@ -759,12 +757,26 @@ static int __init dynamic_debug_init(void) | |||
759 | } | 757 | } |
760 | ret = ddebug_add_module(iter_start, n, modname); | 758 | ret = ddebug_add_module(iter_start, n, modname); |
761 | } | 759 | } |
760 | |||
761 | /* ddebug_query boot param got passed -> set it up */ | ||
762 | if (ddebug_setup_string[0] != '\0') { | ||
763 | ret = ddebug_exec_query(ddebug_setup_string); | ||
764 | if (ret) | ||
765 | pr_warning("Invalid ddebug boot param %s", | ||
766 | ddebug_setup_string); | ||
767 | else | ||
768 | pr_info("ddebug initialized with string %s", | ||
769 | ddebug_setup_string); | ||
770 | } | ||
771 | |||
762 | out_free: | 772 | out_free: |
763 | if (ret) { | 773 | if (ret) |
764 | ddebug_remove_all_tables(); | 774 | ddebug_remove_all_tables(); |
765 | debugfs_remove(dir); | 775 | else |
766 | debugfs_remove(file); | 776 | ddebug_init_success = 1; |
767 | } | ||
768 | return 0; | 777 | return 0; |
769 | } | 778 | } |
770 | module_init(dynamic_debug_init); | 779 | /* Allow early initialization for boot messages via boot param */ |
780 | arch_initcall(dynamic_debug_init); | ||
781 | /* Debugfs setup must be done later */ | ||
782 | module_init(dynamic_debug_init_debugfs); | ||
diff --git a/lib/inflate.c b/lib/inflate.c index 677b738c2204..013a76193481 100644 --- a/lib/inflate.c +++ b/lib/inflate.c | |||
@@ -103,7 +103,9 @@ | |||
103 | the two sets of lengths. | 103 | the two sets of lengths. |
104 | */ | 104 | */ |
105 | #include <linux/compiler.h> | 105 | #include <linux/compiler.h> |
106 | #ifdef NO_INFLATE_MALLOC | ||
106 | #include <linux/slab.h> | 107 | #include <linux/slab.h> |
108 | #endif | ||
107 | 109 | ||
108 | #ifdef RCSID | 110 | #ifdef RCSID |
109 | static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #"; | 111 | static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #"; |
diff --git a/lib/kobject.c b/lib/kobject.c index f07c57252e82..82dc34c095c2 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -746,17 +746,56 @@ void kset_unregister(struct kset *k) | |||
746 | */ | 746 | */ |
747 | struct kobject *kset_find_obj(struct kset *kset, const char *name) | 747 | struct kobject *kset_find_obj(struct kset *kset, const char *name) |
748 | { | 748 | { |
749 | return kset_find_obj_hinted(kset, name, NULL); | ||
750 | } | ||
751 | |||
752 | /** | ||
753 | * kset_find_obj_hinted - search for object in kset given a predecessor hint. | ||
754 | * @kset: kset we're looking in. | ||
755 | * @name: object's name. | ||
756 | * @hint: hint to possible object's predecessor. | ||
757 | * | ||
758 | * Check the hint's next object and if it is a match return it directly, | ||
759 | * otherwise, fall back to the behavior of kset_find_obj(). Either way | ||
760 | * a reference for the returned object is held and the reference on the | ||
761 | * hinted object is released. | ||
762 | */ | ||
763 | struct kobject *kset_find_obj_hinted(struct kset *kset, const char *name, | ||
764 | struct kobject *hint) | ||
765 | { | ||
749 | struct kobject *k; | 766 | struct kobject *k; |
750 | struct kobject *ret = NULL; | 767 | struct kobject *ret = NULL; |
751 | 768 | ||
752 | spin_lock(&kset->list_lock); | 769 | spin_lock(&kset->list_lock); |
770 | |||
771 | if (!hint) | ||
772 | goto slow_search; | ||
773 | |||
774 | /* end of list detection */ | ||
775 | if (hint->entry.next == kset->list.next) | ||
776 | goto slow_search; | ||
777 | |||
778 | k = container_of(hint->entry.next, struct kobject, entry); | ||
779 | if (!kobject_name(k) || strcmp(kobject_name(k), name)) | ||
780 | goto slow_search; | ||
781 | |||
782 | ret = kobject_get(k); | ||
783 | goto unlock_exit; | ||
784 | |||
785 | slow_search: | ||
753 | list_for_each_entry(k, &kset->list, entry) { | 786 | list_for_each_entry(k, &kset->list, entry) { |
754 | if (kobject_name(k) && !strcmp(kobject_name(k), name)) { | 787 | if (kobject_name(k) && !strcmp(kobject_name(k), name)) { |
755 | ret = kobject_get(k); | 788 | ret = kobject_get(k); |
756 | break; | 789 | break; |
757 | } | 790 | } |
758 | } | 791 | } |
792 | |||
793 | unlock_exit: | ||
759 | spin_unlock(&kset->list_lock); | 794 | spin_unlock(&kset->list_lock); |
795 | |||
796 | if (hint) | ||
797 | kobject_put(hint); | ||
798 | |||
760 | return ret; | 799 | return ret; |
761 | } | 800 | } |
762 | 801 | ||
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index b93579504dfa..70af0a7f97c0 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -123,7 +123,7 @@ static int kobj_usermode_filter(struct kobject *kobj) | |||
123 | * @kobj: struct kobject that the action is happening to | 123 | * @kobj: struct kobject that the action is happening to |
124 | * @envp_ext: pointer to environmental data | 124 | * @envp_ext: pointer to environmental data |
125 | * | 125 | * |
126 | * Returns 0 if kobject_uevent() is completed with success or the | 126 | * Returns 0 if kobject_uevent_env() is completed with success or the |
127 | * corresponding error when it fails. | 127 | * corresponding error when it fails. |
128 | */ | 128 | */ |
129 | int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | 129 | int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, |
@@ -317,7 +317,7 @@ exit: | |||
317 | EXPORT_SYMBOL_GPL(kobject_uevent_env); | 317 | EXPORT_SYMBOL_GPL(kobject_uevent_env); |
318 | 318 | ||
319 | /** | 319 | /** |
320 | * kobject_uevent - notify userspace by ending an uevent | 320 | * kobject_uevent - notify userspace by sending an uevent |
321 | * | 321 | * |
322 | * @action: action that is happening | 322 | * @action: action that is happening |
323 | * @kobj: struct kobject that the action is happening to | 323 | * @kobj: struct kobject that the action is happening to |
diff --git a/lib/list_sort.c b/lib/list_sort.c index 4b5cb794c38b..a7616fa3162e 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c | |||
@@ -70,7 +70,7 @@ static void merge_and_restore_back_links(void *priv, | |||
70 | * element comparison is needed, so the client's cmp() | 70 | * element comparison is needed, so the client's cmp() |
71 | * routine can invoke cond_resched() periodically. | 71 | * routine can invoke cond_resched() periodically. |
72 | */ | 72 | */ |
73 | (*cmp)(priv, tail, tail); | 73 | (*cmp)(priv, tail->next, tail->next); |
74 | 74 | ||
75 | tail->next->prev = tail; | 75 | tail->next->prev = tail; |
76 | tail = tail->next; | 76 | tail = tail->next; |
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index e907858498a6..6f412ab4c24f 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -49,7 +49,7 @@ struct radix_tree_node { | |||
49 | unsigned int height; /* Height from the bottom */ | 49 | unsigned int height; /* Height from the bottom */ |
50 | unsigned int count; | 50 | unsigned int count; |
51 | struct rcu_head rcu_head; | 51 | struct rcu_head rcu_head; |
52 | void *slots[RADIX_TREE_MAP_SIZE]; | 52 | void __rcu *slots[RADIX_TREE_MAP_SIZE]; |
53 | unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS]; | 53 | unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS]; |
54 | }; | 54 | }; |
55 | 55 | ||
@@ -174,14 +174,16 @@ static void radix_tree_node_rcu_free(struct rcu_head *head) | |||
174 | { | 174 | { |
175 | struct radix_tree_node *node = | 175 | struct radix_tree_node *node = |
176 | container_of(head, struct radix_tree_node, rcu_head); | 176 | container_of(head, struct radix_tree_node, rcu_head); |
177 | int i; | ||
177 | 178 | ||
178 | /* | 179 | /* |
179 | * must only free zeroed nodes into the slab. radix_tree_shrink | 180 | * must only free zeroed nodes into the slab. radix_tree_shrink |
180 | * can leave us with a non-NULL entry in the first slot, so clear | 181 | * can leave us with a non-NULL entry in the first slot, so clear |
181 | * that here to make sure. | 182 | * that here to make sure. |
182 | */ | 183 | */ |
183 | tag_clear(node, 0, 0); | 184 | for (i = 0; i < RADIX_TREE_MAX_TAGS; i++) |
184 | tag_clear(node, 1, 0); | 185 | tag_clear(node, i, 0); |
186 | |||
185 | node->slots[0] = NULL; | 187 | node->slots[0] = NULL; |
186 | node->count = 0; | 188 | node->count = 0; |
187 | 189 | ||
@@ -623,17 +625,30 @@ EXPORT_SYMBOL(radix_tree_tag_get); | |||
623 | * also settag. The function stops either after tagging nr_to_tag items or | 625 | * also settag. The function stops either after tagging nr_to_tag items or |
624 | * after reaching last_index. | 626 | * after reaching last_index. |
625 | * | 627 | * |
628 | * The tags must be set from the leaf level only and propagated back up the | ||
629 | * path to the root. We must do this so that we resolve the full path before | ||
630 | * setting any tags on intermediate nodes. If we set tags as we descend, then | ||
631 | * we can get to the leaf node and find that the index that has the iftag | ||
632 | * set is outside the range we are scanning. This reults in dangling tags and | ||
633 | * can lead to problems with later tag operations (e.g. livelocks on lookups). | ||
634 | * | ||
626 | * The function returns number of leaves where the tag was set and sets | 635 | * The function returns number of leaves where the tag was set and sets |
627 | * *first_indexp to the first unscanned index. | 636 | * *first_indexp to the first unscanned index. |
637 | * WARNING! *first_indexp can wrap if last_index is ULONG_MAX. Caller must | ||
638 | * be prepared to handle that. | ||
628 | */ | 639 | */ |
629 | unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, | 640 | unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, |
630 | unsigned long *first_indexp, unsigned long last_index, | 641 | unsigned long *first_indexp, unsigned long last_index, |
631 | unsigned long nr_to_tag, | 642 | unsigned long nr_to_tag, |
632 | unsigned int iftag, unsigned int settag) | 643 | unsigned int iftag, unsigned int settag) |
633 | { | 644 | { |
634 | unsigned int height = root->height, shift; | 645 | unsigned int height = root->height; |
635 | unsigned long tagged = 0, index = *first_indexp; | 646 | struct radix_tree_path path[height]; |
636 | struct radix_tree_node *open_slots[height], *slot; | 647 | struct radix_tree_path *pathp = path; |
648 | struct radix_tree_node *slot; | ||
649 | unsigned int shift; | ||
650 | unsigned long tagged = 0; | ||
651 | unsigned long index = *first_indexp; | ||
637 | 652 | ||
638 | last_index = min(last_index, radix_tree_maxindex(height)); | 653 | last_index = min(last_index, radix_tree_maxindex(height)); |
639 | if (index > last_index) | 654 | if (index > last_index) |
@@ -653,6 +668,13 @@ unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, | |||
653 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; | 668 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; |
654 | slot = radix_tree_indirect_to_ptr(root->rnode); | 669 | slot = radix_tree_indirect_to_ptr(root->rnode); |
655 | 670 | ||
671 | /* | ||
672 | * we fill the path from (root->height - 2) to 0, leaving the index at | ||
673 | * (root->height - 1) as a terminator. Zero the node in the terminator | ||
674 | * so that we can use this to end walk loops back up the path. | ||
675 | */ | ||
676 | path[height - 1].node = NULL; | ||
677 | |||
656 | for (;;) { | 678 | for (;;) { |
657 | int offset; | 679 | int offset; |
658 | 680 | ||
@@ -661,21 +683,35 @@ unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, | |||
661 | goto next; | 683 | goto next; |
662 | if (!tag_get(slot, iftag, offset)) | 684 | if (!tag_get(slot, iftag, offset)) |
663 | goto next; | 685 | goto next; |
686 | if (height > 1) { | ||
687 | /* Go down one level */ | ||
688 | height--; | ||
689 | shift -= RADIX_TREE_MAP_SHIFT; | ||
690 | path[height - 1].node = slot; | ||
691 | path[height - 1].offset = offset; | ||
692 | slot = slot->slots[offset]; | ||
693 | continue; | ||
694 | } | ||
695 | |||
696 | /* tag the leaf */ | ||
697 | tagged++; | ||
664 | tag_set(slot, settag, offset); | 698 | tag_set(slot, settag, offset); |
665 | if (height == 1) { | 699 | |
666 | tagged++; | 700 | /* walk back up the path tagging interior nodes */ |
667 | goto next; | 701 | pathp = &path[0]; |
702 | while (pathp->node) { | ||
703 | /* stop if we find a node with the tag already set */ | ||
704 | if (tag_get(pathp->node, settag, pathp->offset)) | ||
705 | break; | ||
706 | tag_set(pathp->node, settag, pathp->offset); | ||
707 | pathp++; | ||
668 | } | 708 | } |
669 | /* Go down one level */ | 709 | |
670 | height--; | ||
671 | shift -= RADIX_TREE_MAP_SHIFT; | ||
672 | open_slots[height] = slot; | ||
673 | slot = slot->slots[offset]; | ||
674 | continue; | ||
675 | next: | 710 | next: |
676 | /* Go to next item at level determined by 'shift' */ | 711 | /* Go to next item at level determined by 'shift' */ |
677 | index = ((index >> shift) + 1) << shift; | 712 | index = ((index >> shift) + 1) << shift; |
678 | if (index > last_index) | 713 | /* Overflow can happen when last_index is ~0UL... */ |
714 | if (index > last_index || !index) | ||
679 | break; | 715 | break; |
680 | if (tagged >= nr_to_tag) | 716 | if (tagged >= nr_to_tag) |
681 | break; | 717 | break; |
@@ -685,7 +721,7 @@ next: | |||
685 | * last_index is guaranteed to be in the tree, what | 721 | * last_index is guaranteed to be in the tree, what |
686 | * we do below cannot wander astray. | 722 | * we do below cannot wander astray. |
687 | */ | 723 | */ |
688 | slot = open_slots[height]; | 724 | slot = path[height - 1].node; |
689 | height++; | 725 | height++; |
690 | shift += RADIX_TREE_MAP_SHIFT; | 726 | shift += RADIX_TREE_MAP_SHIFT; |
691 | } | 727 | } |
diff --git a/lib/raid6/.gitignore b/lib/raid6/.gitignore new file mode 100644 index 000000000000..162becacf97c --- /dev/null +++ b/lib/raid6/.gitignore | |||
@@ -0,0 +1,4 @@ | |||
1 | mktables | ||
2 | altivec*.c | ||
3 | int*.c | ||
4 | tables.c | ||
diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile index 19bf32da644f..8a38102770f3 100644 --- a/lib/raid6/Makefile +++ b/lib/raid6/Makefile | |||
@@ -1,11 +1,8 @@ | |||
1 | obj-$(CONFIG_RAID6_PQ) += raid6_pq.o | 1 | obj-$(CONFIG_RAID6_PQ) += raid6_pq.o |
2 | 2 | ||
3 | raid6_pq-y += raid6algos.o raid6recov.o raid6tables.o \ | 3 | raid6_pq-y += algos.o recov.o tables.o int1.o int2.o int4.o \ |
4 | raid6int1.o raid6int2.o raid6int4.o \ | 4 | int8.o int16.o int32.o altivec1.o altivec2.o altivec4.o \ |
5 | raid6int8.o raid6int16.o raid6int32.o \ | 5 | altivec8.o mmx.o sse1.o sse2.o |
6 | raid6altivec1.o raid6altivec2.o raid6altivec4.o \ | ||
7 | raid6altivec8.o \ | ||
8 | raid6mmx.o raid6sse1.o raid6sse2.o | ||
9 | hostprogs-y += mktables | 6 | hostprogs-y += mktables |
10 | 7 | ||
11 | quiet_cmd_unroll = UNROLL $@ | 8 | quiet_cmd_unroll = UNROLL $@ |
@@ -16,63 +13,63 @@ ifeq ($(CONFIG_ALTIVEC),y) | |||
16 | altivec_flags := -maltivec -mabi=altivec | 13 | altivec_flags := -maltivec -mabi=altivec |
17 | endif | 14 | endif |
18 | 15 | ||
19 | targets += raid6int1.c | 16 | targets += int1.c |
20 | $(obj)/raid6int1.c: UNROLL := 1 | 17 | $(obj)/int1.c: UNROLL := 1 |
21 | $(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | 18 | $(obj)/int1.c: $(src)/int.uc $(src)/unroll.awk FORCE |
22 | $(call if_changed,unroll) | 19 | $(call if_changed,unroll) |
23 | 20 | ||
24 | targets += raid6int2.c | 21 | targets += int2.c |
25 | $(obj)/raid6int2.c: UNROLL := 2 | 22 | $(obj)/int2.c: UNROLL := 2 |
26 | $(obj)/raid6int2.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | 23 | $(obj)/int2.c: $(src)/int.uc $(src)/unroll.awk FORCE |
27 | $(call if_changed,unroll) | 24 | $(call if_changed,unroll) |
28 | 25 | ||
29 | targets += raid6int4.c | 26 | targets += int4.c |
30 | $(obj)/raid6int4.c: UNROLL := 4 | 27 | $(obj)/int4.c: UNROLL := 4 |
31 | $(obj)/raid6int4.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | 28 | $(obj)/int4.c: $(src)/int.uc $(src)/unroll.awk FORCE |
32 | $(call if_changed,unroll) | 29 | $(call if_changed,unroll) |
33 | 30 | ||
34 | targets += raid6int8.c | 31 | targets += int8.c |
35 | $(obj)/raid6int8.c: UNROLL := 8 | 32 | $(obj)/int8.c: UNROLL := 8 |
36 | $(obj)/raid6int8.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | 33 | $(obj)/int8.c: $(src)/int.uc $(src)/unroll.awk FORCE |
37 | $(call if_changed,unroll) | 34 | $(call if_changed,unroll) |
38 | 35 | ||
39 | targets += raid6int16.c | 36 | targets += int16.c |
40 | $(obj)/raid6int16.c: UNROLL := 16 | 37 | $(obj)/int16.c: UNROLL := 16 |
41 | $(obj)/raid6int16.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | 38 | $(obj)/int16.c: $(src)/int.uc $(src)/unroll.awk FORCE |
42 | $(call if_changed,unroll) | 39 | $(call if_changed,unroll) |
43 | 40 | ||
44 | targets += raid6int32.c | 41 | targets += int32.c |
45 | $(obj)/raid6int32.c: UNROLL := 32 | 42 | $(obj)/int32.c: UNROLL := 32 |
46 | $(obj)/raid6int32.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE | 43 | $(obj)/int32.c: $(src)/int.uc $(src)/unroll.awk FORCE |
47 | $(call if_changed,unroll) | 44 | $(call if_changed,unroll) |
48 | 45 | ||
49 | CFLAGS_raid6altivec1.o += $(altivec_flags) | 46 | CFLAGS_altivec1.o += $(altivec_flags) |
50 | targets += raid6altivec1.c | 47 | targets += altivec1.c |
51 | $(obj)/raid6altivec1.c: UNROLL := 1 | 48 | $(obj)/altivec1.c: UNROLL := 1 |
52 | $(obj)/raid6altivec1.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE | 49 | $(obj)/altivec1.c: $(src)/altivec.uc $(src)/unroll.awk FORCE |
53 | $(call if_changed,unroll) | 50 | $(call if_changed,unroll) |
54 | 51 | ||
55 | CFLAGS_raid6altivec2.o += $(altivec_flags) | 52 | CFLAGS_altivec2.o += $(altivec_flags) |
56 | targets += raid6altivec2.c | 53 | targets += altivec2.c |
57 | $(obj)/raid6altivec2.c: UNROLL := 2 | 54 | $(obj)/altivec2.c: UNROLL := 2 |
58 | $(obj)/raid6altivec2.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE | 55 | $(obj)/altivec2.c: $(src)/altivec.uc $(src)/unroll.awk FORCE |
59 | $(call if_changed,unroll) | 56 | $(call if_changed,unroll) |
60 | 57 | ||
61 | CFLAGS_raid6altivec4.o += $(altivec_flags) | 58 | CFLAGS_altivec4.o += $(altivec_flags) |
62 | targets += raid6altivec4.c | 59 | targets += altivec4.c |
63 | $(obj)/raid6altivec4.c: UNROLL := 4 | 60 | $(obj)/altivec4.c: UNROLL := 4 |
64 | $(obj)/raid6altivec4.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE | 61 | $(obj)/altivec4.c: $(src)/altivec.uc $(src)/unroll.awk FORCE |
65 | $(call if_changed,unroll) | 62 | $(call if_changed,unroll) |
66 | 63 | ||
67 | CFLAGS_raid6altivec8.o += $(altivec_flags) | 64 | CFLAGS_altivec8.o += $(altivec_flags) |
68 | targets += raid6altivec8.c | 65 | targets += altivec8.c |
69 | $(obj)/raid6altivec8.c: UNROLL := 8 | 66 | $(obj)/altivec8.c: UNROLL := 8 |
70 | $(obj)/raid6altivec8.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE | 67 | $(obj)/altivec8.c: $(src)/altivec.uc $(src)/unroll.awk FORCE |
71 | $(call if_changed,unroll) | 68 | $(call if_changed,unroll) |
72 | 69 | ||
73 | quiet_cmd_mktable = TABLE $@ | 70 | quiet_cmd_mktable = TABLE $@ |
74 | cmd_mktable = $(obj)/mktables > $@ || ( rm -f $@ && exit 1 ) | 71 | cmd_mktable = $(obj)/mktables > $@ || ( rm -f $@ && exit 1 ) |
75 | 72 | ||
76 | targets += raid6tables.c | 73 | targets += tables.c |
77 | $(obj)/raid6tables.c: $(obj)/mktables FORCE | 74 | $(obj)/tables.c: $(obj)/mktables FORCE |
78 | $(call if_changed,mktable) | 75 | $(call if_changed,mktable) |
diff --git a/lib/raid6/raid6algos.c b/lib/raid6/algos.c index 1f8784bfd44d..b595f560bee7 100644 --- a/lib/raid6/raid6algos.c +++ b/lib/raid6/algos.c | |||
@@ -11,17 +11,17 @@ | |||
11 | * ----------------------------------------------------------------------- */ | 11 | * ----------------------------------------------------------------------- */ |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * raid6algos.c | 14 | * raid6/algos.c |
15 | * | 15 | * |
16 | * Algorithm list and algorithm selection for RAID-6 | 16 | * Algorithm list and algorithm selection for RAID-6 |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/raid/pq.h> | 19 | #include <linux/raid/pq.h> |
20 | #include <linux/gfp.h> | ||
21 | #ifndef __KERNEL__ | 20 | #ifndef __KERNEL__ |
22 | #include <sys/mman.h> | 21 | #include <sys/mman.h> |
23 | #include <stdio.h> | 22 | #include <stdio.h> |
24 | #else | 23 | #else |
24 | #include <linux/gfp.h> | ||
25 | #if !RAID6_USE_EMPTY_ZERO_PAGE | 25 | #if !RAID6_USE_EMPTY_ZERO_PAGE |
26 | /* In .bss so it's zeroed */ | 26 | /* In .bss so it's zeroed */ |
27 | const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256))); | 27 | const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256))); |
diff --git a/lib/raid6/raid6altivec.uc b/lib/raid6/altivec.uc index 2654d5c854be..2654d5c854be 100644 --- a/lib/raid6/raid6altivec.uc +++ b/lib/raid6/altivec.uc | |||
diff --git a/lib/raid6/raid6int.uc b/lib/raid6/int.uc index d1e276a14fab..d1e276a14fab 100644 --- a/lib/raid6/raid6int.uc +++ b/lib/raid6/int.uc | |||
diff --git a/lib/raid6/raid6mmx.c b/lib/raid6/mmx.c index e7f6c13132bf..279347f23094 100644 --- a/lib/raid6/raid6mmx.c +++ b/lib/raid6/mmx.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * ----------------------------------------------------------------------- */ | 11 | * ----------------------------------------------------------------------- */ |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * raid6mmx.c | 14 | * raid6/mmx.c |
15 | * | 15 | * |
16 | * MMX implementation of RAID-6 syndrome functions | 16 | * MMX implementation of RAID-6 syndrome functions |
17 | */ | 17 | */ |
@@ -19,9 +19,9 @@ | |||
19 | #if defined(__i386__) && !defined(__arch_um__) | 19 | #if defined(__i386__) && !defined(__arch_um__) |
20 | 20 | ||
21 | #include <linux/raid/pq.h> | 21 | #include <linux/raid/pq.h> |
22 | #include "raid6x86.h" | 22 | #include "x86.h" |
23 | 23 | ||
24 | /* Shared with raid6sse1.c */ | 24 | /* Shared with raid6/sse1.c */ |
25 | const struct raid6_mmx_constants { | 25 | const struct raid6_mmx_constants { |
26 | u64 x1d; | 26 | u64 x1d; |
27 | } raid6_mmx_constants = { | 27 | } raid6_mmx_constants = { |
diff --git a/lib/raid6/raid6test/Makefile b/lib/raid6/raid6test/Makefile deleted file mode 100644 index 2874cbef529d..000000000000 --- a/lib/raid6/raid6test/Makefile +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | # | ||
2 | # This is a simple Makefile to test some of the RAID-6 code | ||
3 | # from userspace. | ||
4 | # | ||
5 | |||
6 | CC = gcc | ||
7 | OPTFLAGS = -O2 # Adjust as desired | ||
8 | CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) | ||
9 | LD = ld | ||
10 | AWK = awk | ||
11 | AR = ar | ||
12 | RANLIB = ranlib | ||
13 | |||
14 | .c.o: | ||
15 | $(CC) $(CFLAGS) -c -o $@ $< | ||
16 | |||
17 | %.c: ../%.c | ||
18 | cp -f $< $@ | ||
19 | |||
20 | %.uc: ../%.uc | ||
21 | cp -f $< $@ | ||
22 | |||
23 | all: raid6.a raid6test | ||
24 | |||
25 | raid6.a: raid6int1.o raid6int2.o raid6int4.o raid6int8.o raid6int16.o \ | ||
26 | raid6int32.o \ | ||
27 | raid6mmx.o raid6sse1.o raid6sse2.o \ | ||
28 | raid6altivec1.o raid6altivec2.o raid6altivec4.o raid6altivec8.o \ | ||
29 | raid6recov.o raid6algos.o \ | ||
30 | raid6tables.o | ||
31 | rm -f $@ | ||
32 | $(AR) cq $@ $^ | ||
33 | $(RANLIB) $@ | ||
34 | |||
35 | raid6test: test.c raid6.a | ||
36 | $(CC) $(CFLAGS) -o raid6test $^ | ||
37 | |||
38 | raid6altivec1.c: raid6altivec.uc ../unroll.awk | ||
39 | $(AWK) ../unroll.awk -vN=1 < raid6altivec.uc > $@ | ||
40 | |||
41 | raid6altivec2.c: raid6altivec.uc ../unroll.awk | ||
42 | $(AWK) ../unroll.awk -vN=2 < raid6altivec.uc > $@ | ||
43 | |||
44 | raid6altivec4.c: raid6altivec.uc ../unroll.awk | ||
45 | $(AWK) ../unroll.awk -vN=4 < raid6altivec.uc > $@ | ||
46 | |||
47 | raid6altivec8.c: raid6altivec.uc ../unroll.awk | ||
48 | $(AWK) ../unroll.awk -vN=8 < raid6altivec.uc > $@ | ||
49 | |||
50 | raid6int1.c: raid6int.uc ../unroll.awk | ||
51 | $(AWK) ../unroll.awk -vN=1 < raid6int.uc > $@ | ||
52 | |||
53 | raid6int2.c: raid6int.uc ../unroll.awk | ||
54 | $(AWK) ../unroll.awk -vN=2 < raid6int.uc > $@ | ||
55 | |||
56 | raid6int4.c: raid6int.uc ../unroll.awk | ||
57 | $(AWK) ../unroll.awk -vN=4 < raid6int.uc > $@ | ||
58 | |||
59 | raid6int8.c: raid6int.uc ../unroll.awk | ||
60 | $(AWK) ../unroll.awk -vN=8 < raid6int.uc > $@ | ||
61 | |||
62 | raid6int16.c: raid6int.uc ../unroll.awk | ||
63 | $(AWK) ../unroll.awk -vN=16 < raid6int.uc > $@ | ||
64 | |||
65 | raid6int32.c: raid6int.uc ../unroll.awk | ||
66 | $(AWK) ../unroll.awk -vN=32 < raid6int.uc > $@ | ||
67 | |||
68 | raid6tables.c: mktables | ||
69 | ./mktables > raid6tables.c | ||
70 | |||
71 | clean: | ||
72 | rm -f *.o *.a mktables mktables.c raid6int.uc raid6*.c raid6test | ||
73 | |||
74 | spotless: clean | ||
75 | rm -f *~ | ||
diff --git a/lib/raid6/raid6recov.c b/lib/raid6/recov.c index 2609f00e0d61..8590d19cf522 100644 --- a/lib/raid6/raid6recov.c +++ b/lib/raid6/recov.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * ----------------------------------------------------------------------- */ | 11 | * ----------------------------------------------------------------------- */ |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * raid6recov.c | 14 | * raid6/recov.c |
15 | * | 15 | * |
16 | * RAID-6 data recovery in dual failure mode. In single failure mode, | 16 | * RAID-6 data recovery in dual failure mode. In single failure mode, |
17 | * use the RAID-5 algorithm (or, in the case of Q failure, just reconstruct | 17 | * use the RAID-5 algorithm (or, in the case of Q failure, just reconstruct |
diff --git a/lib/raid6/raid6sse1.c b/lib/raid6/sse1.c index b274dd5eab8f..10dd91948c07 100644 --- a/lib/raid6/raid6sse1.c +++ b/lib/raid6/sse1.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * ----------------------------------------------------------------------- */ | 11 | * ----------------------------------------------------------------------- */ |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * raid6sse1.c | 14 | * raid6/sse1.c |
15 | * | 15 | * |
16 | * SSE-1/MMXEXT implementation of RAID-6 syndrome functions | 16 | * SSE-1/MMXEXT implementation of RAID-6 syndrome functions |
17 | * | 17 | * |
@@ -24,9 +24,9 @@ | |||
24 | #if defined(__i386__) && !defined(__arch_um__) | 24 | #if defined(__i386__) && !defined(__arch_um__) |
25 | 25 | ||
26 | #include <linux/raid/pq.h> | 26 | #include <linux/raid/pq.h> |
27 | #include "raid6x86.h" | 27 | #include "x86.h" |
28 | 28 | ||
29 | /* Defined in raid6mmx.c */ | 29 | /* Defined in raid6/mmx.c */ |
30 | extern const struct raid6_mmx_constants { | 30 | extern const struct raid6_mmx_constants { |
31 | u64 x1d; | 31 | u64 x1d; |
32 | } raid6_mmx_constants; | 32 | } raid6_mmx_constants; |
diff --git a/lib/raid6/raid6sse2.c b/lib/raid6/sse2.c index 6ed6c6c0389f..bc2d57daa589 100644 --- a/lib/raid6/raid6sse2.c +++ b/lib/raid6/sse2.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * ----------------------------------------------------------------------- */ | 11 | * ----------------------------------------------------------------------- */ |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * raid6sse2.c | 14 | * raid6/sse2.c |
15 | * | 15 | * |
16 | * SSE-2 implementation of RAID-6 syndrome functions | 16 | * SSE-2 implementation of RAID-6 syndrome functions |
17 | * | 17 | * |
@@ -20,7 +20,7 @@ | |||
20 | #if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__) | 20 | #if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__) |
21 | 21 | ||
22 | #include <linux/raid/pq.h> | 22 | #include <linux/raid/pq.h> |
23 | #include "raid6x86.h" | 23 | #include "x86.h" |
24 | 24 | ||
25 | static const struct raid6_sse_constants { | 25 | static const struct raid6_sse_constants { |
26 | u64 x1d[2]; | 26 | u64 x1d[2]; |
diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile new file mode 100644 index 000000000000..aa651697b6dc --- /dev/null +++ b/lib/raid6/test/Makefile | |||
@@ -0,0 +1,72 @@ | |||
1 | # | ||
2 | # This is a simple Makefile to test some of the RAID-6 code | ||
3 | # from userspace. | ||
4 | # | ||
5 | |||
6 | CC = gcc | ||
7 | OPTFLAGS = -O2 # Adjust as desired | ||
8 | CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) | ||
9 | LD = ld | ||
10 | AWK = awk -f | ||
11 | AR = ar | ||
12 | RANLIB = ranlib | ||
13 | |||
14 | .c.o: | ||
15 | $(CC) $(CFLAGS) -c -o $@ $< | ||
16 | |||
17 | %.c: ../%.c | ||
18 | cp -f $< $@ | ||
19 | |||
20 | %.uc: ../%.uc | ||
21 | cp -f $< $@ | ||
22 | |||
23 | all: raid6.a raid6test | ||
24 | |||
25 | raid6.a: int1.o int2.o int4.o int8.o int16.o int32.o mmx.o sse1.o sse2.o \ | ||
26 | altivec1.o altivec2.o altivec4.o altivec8.o recov.o algos.o \ | ||
27 | tables.o | ||
28 | rm -f $@ | ||
29 | $(AR) cq $@ $^ | ||
30 | $(RANLIB) $@ | ||
31 | |||
32 | raid6test: test.c raid6.a | ||
33 | $(CC) $(CFLAGS) -o raid6test $^ | ||
34 | |||
35 | altivec1.c: altivec.uc ../unroll.awk | ||
36 | $(AWK) ../unroll.awk -vN=1 < altivec.uc > $@ | ||
37 | |||
38 | altivec2.c: altivec.uc ../unroll.awk | ||
39 | $(AWK) ../unroll.awk -vN=2 < altivec.uc > $@ | ||
40 | |||
41 | altivec4.c: altivec.uc ../unroll.awk | ||
42 | $(AWK) ../unroll.awk -vN=4 < altivec.uc > $@ | ||
43 | |||
44 | altivec8.c: altivec.uc ../unroll.awk | ||
45 | $(AWK) ../unroll.awk -vN=8 < altivec.uc > $@ | ||
46 | |||
47 | int1.c: int.uc ../unroll.awk | ||
48 | $(AWK) ../unroll.awk -vN=1 < int.uc > $@ | ||
49 | |||
50 | int2.c: int.uc ../unroll.awk | ||
51 | $(AWK) ../unroll.awk -vN=2 < int.uc > $@ | ||
52 | |||
53 | int4.c: int.uc ../unroll.awk | ||
54 | $(AWK) ../unroll.awk -vN=4 < int.uc > $@ | ||
55 | |||
56 | int8.c: int.uc ../unroll.awk | ||
57 | $(AWK) ../unroll.awk -vN=8 < int.uc > $@ | ||
58 | |||
59 | int16.c: int.uc ../unroll.awk | ||
60 | $(AWK) ../unroll.awk -vN=16 < int.uc > $@ | ||
61 | |||
62 | int32.c: int.uc ../unroll.awk | ||
63 | $(AWK) ../unroll.awk -vN=32 < int.uc > $@ | ||
64 | |||
65 | tables.c: mktables | ||
66 | ./mktables > tables.c | ||
67 | |||
68 | clean: | ||
69 | rm -f *.o *.a mktables mktables.c *.uc int*.c altivec*.c tables.c raid6test | ||
70 | |||
71 | spotless: clean | ||
72 | rm -f *~ | ||
diff --git a/lib/raid6/raid6test/test.c b/lib/raid6/test/test.c index 7a930318b17d..7a930318b17d 100644 --- a/lib/raid6/raid6test/test.c +++ b/lib/raid6/test/test.c | |||
diff --git a/lib/raid6/raid6x86.h b/lib/raid6/x86.h index 4c22c1568558..cb2a8c91c886 100644 --- a/lib/raid6/raid6x86.h +++ b/lib/raid6/x86.h | |||
@@ -11,7 +11,7 @@ | |||
11 | * ----------------------------------------------------------------------- */ | 11 | * ----------------------------------------------------------------------- */ |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * raid6x86.h | 14 | * raid6/x86.h |
15 | * | 15 | * |
16 | * Definitions common to x86 and x86-64 RAID-6 code only | 16 | * Definitions common to x86 and x86-64 RAID-6 code only |
17 | */ | 17 | */ |
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index a5ec42868f99..4ceb05d772ae 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c | |||
@@ -248,8 +248,18 @@ int __sg_alloc_table(struct sg_table *table, unsigned int nents, | |||
248 | left -= sg_size; | 248 | left -= sg_size; |
249 | 249 | ||
250 | sg = alloc_fn(alloc_size, gfp_mask); | 250 | sg = alloc_fn(alloc_size, gfp_mask); |
251 | if (unlikely(!sg)) | 251 | if (unlikely(!sg)) { |
252 | return -ENOMEM; | 252 | /* |
253 | * Adjust entry count to reflect that the last | ||
254 | * entry of the previous table won't be used for | ||
255 | * linkage. Without this, sg_kfree() may get | ||
256 | * confused. | ||
257 | */ | ||
258 | if (prv) | ||
259 | table->nents = ++table->orig_nents; | ||
260 | |||
261 | return -ENOMEM; | ||
262 | } | ||
253 | 263 | ||
254 | sg_init_table(sg, alloc_size); | 264 | sg_init_table(sg, alloc_size); |
255 | table->nents = table->orig_nents += sg_size; | 265 | table->nents = table->orig_nents += sg_size; |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 34e3082632d8..7c06ee51a29a 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -70,7 +70,7 @@ static unsigned long io_tlb_nslabs; | |||
70 | */ | 70 | */ |
71 | static unsigned long io_tlb_overflow = 32*1024; | 71 | static unsigned long io_tlb_overflow = 32*1024; |
72 | 72 | ||
73 | void *io_tlb_overflow_buffer; | 73 | static void *io_tlb_overflow_buffer; |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * This is a free list describing the number of free entries available from | 76 | * This is a free list describing the number of free entries available from |
@@ -147,16 +147,16 @@ void __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) | |||
147 | * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE | 147 | * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE |
148 | * between io_tlb_start and io_tlb_end. | 148 | * between io_tlb_start and io_tlb_end. |
149 | */ | 149 | */ |
150 | io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int)); | 150 | io_tlb_list = alloc_bootmem_pages(PAGE_ALIGN(io_tlb_nslabs * sizeof(int))); |
151 | for (i = 0; i < io_tlb_nslabs; i++) | 151 | for (i = 0; i < io_tlb_nslabs; i++) |
152 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | 152 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); |
153 | io_tlb_index = 0; | 153 | io_tlb_index = 0; |
154 | io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(phys_addr_t)); | 154 | io_tlb_orig_addr = alloc_bootmem_pages(PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t))); |
155 | 155 | ||
156 | /* | 156 | /* |
157 | * Get the overflow emergency buffer | 157 | * Get the overflow emergency buffer |
158 | */ | 158 | */ |
159 | io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow); | 159 | io_tlb_overflow_buffer = alloc_bootmem_low_pages(PAGE_ALIGN(io_tlb_overflow)); |
160 | if (!io_tlb_overflow_buffer) | 160 | if (!io_tlb_overflow_buffer) |
161 | panic("Cannot allocate SWIOTLB overflow buffer!\n"); | 161 | panic("Cannot allocate SWIOTLB overflow buffer!\n"); |
162 | if (verbose) | 162 | if (verbose) |
@@ -182,7 +182,7 @@ swiotlb_init_with_default_size(size_t default_size, int verbose) | |||
182 | /* | 182 | /* |
183 | * Get IO TLB memory from the low pages | 183 | * Get IO TLB memory from the low pages |
184 | */ | 184 | */ |
185 | io_tlb_start = alloc_bootmem_low_pages(bytes); | 185 | io_tlb_start = alloc_bootmem_low_pages(PAGE_ALIGN(bytes)); |
186 | if (!io_tlb_start) | 186 | if (!io_tlb_start) |
187 | panic("Cannot allocate SWIOTLB buffer"); | 187 | panic("Cannot allocate SWIOTLB buffer"); |
188 | 188 | ||
@@ -308,13 +308,13 @@ void __init swiotlb_free(void) | |||
308 | get_order(io_tlb_nslabs << IO_TLB_SHIFT)); | 308 | get_order(io_tlb_nslabs << IO_TLB_SHIFT)); |
309 | } else { | 309 | } else { |
310 | free_bootmem_late(__pa(io_tlb_overflow_buffer), | 310 | free_bootmem_late(__pa(io_tlb_overflow_buffer), |
311 | io_tlb_overflow); | 311 | PAGE_ALIGN(io_tlb_overflow)); |
312 | free_bootmem_late(__pa(io_tlb_orig_addr), | 312 | free_bootmem_late(__pa(io_tlb_orig_addr), |
313 | io_tlb_nslabs * sizeof(phys_addr_t)); | 313 | PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t))); |
314 | free_bootmem_late(__pa(io_tlb_list), | 314 | free_bootmem_late(__pa(io_tlb_list), |
315 | io_tlb_nslabs * sizeof(int)); | 315 | PAGE_ALIGN(io_tlb_nslabs * sizeof(int))); |
316 | free_bootmem_late(__pa(io_tlb_start), | 316 | free_bootmem_late(__pa(io_tlb_start), |
317 | io_tlb_nslabs << IO_TLB_SHIFT); | 317 | PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT)); |
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||