diff options
66 files changed, 387 insertions, 396 deletions
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl index 2f7fd4360848..9c27e5125dd2 100644 --- a/Documentation/DocBook/device-drivers.tmpl +++ b/Documentation/DocBook/device-drivers.tmpl | |||
@@ -102,9 +102,12 @@ X!Iinclude/linux/kobject.h | |||
102 | !Iinclude/linux/device.h | 102 | !Iinclude/linux/device.h |
103 | </sect1> | 103 | </sect1> |
104 | <sect1><title>Device Drivers Base</title> | 104 | <sect1><title>Device Drivers Base</title> |
105 | !Idrivers/base/init.c | ||
105 | !Edrivers/base/driver.c | 106 | !Edrivers/base/driver.c |
106 | !Edrivers/base/core.c | 107 | !Edrivers/base/core.c |
108 | !Edrivers/base/syscore.c | ||
107 | !Edrivers/base/class.c | 109 | !Edrivers/base/class.c |
110 | !Idrivers/base/node.c | ||
108 | !Edrivers/base/firmware_class.c | 111 | !Edrivers/base/firmware_class.c |
109 | !Edrivers/base/transport_class.c | 112 | !Edrivers/base/transport_class.c |
110 | <!-- Cannot be included, because | 113 | <!-- Cannot be included, because |
@@ -113,7 +116,7 @@ X!Iinclude/linux/kobject.h | |||
113 | exceed allowed 44 characters maximum | 116 | exceed allowed 44 characters maximum |
114 | X!Edrivers/base/attribute_container.c | 117 | X!Edrivers/base/attribute_container.c |
115 | --> | 118 | --> |
116 | !Edrivers/base/sys.c | 119 | !Edrivers/base/dd.c |
117 | <!-- | 120 | <!-- |
118 | X!Edrivers/base/interface.c | 121 | X!Edrivers/base/interface.c |
119 | --> | 122 | --> |
@@ -121,6 +124,11 @@ X!Edrivers/base/interface.c | |||
121 | !Edrivers/base/platform.c | 124 | !Edrivers/base/platform.c |
122 | !Edrivers/base/bus.c | 125 | !Edrivers/base/bus.c |
123 | </sect1> | 126 | </sect1> |
127 | <sect1><title>Device Drivers DMA Management</title> | ||
128 | !Edrivers/base/dma-buf.c | ||
129 | !Edrivers/base/dma-coherent.c | ||
130 | !Edrivers/base/dma-mapping.c | ||
131 | </sect1> | ||
124 | <sect1><title>Device Drivers Power Management</title> | 132 | <sect1><title>Device Drivers Power Management</title> |
125 | !Edrivers/base/power/main.c | 133 | !Edrivers/base/power/main.c |
126 | </sect1> | 134 | </sect1> |
@@ -219,7 +227,7 @@ X!Isound/sound_firmware.c | |||
219 | <chapter id="uart16x50"> | 227 | <chapter id="uart16x50"> |
220 | <title>16x50 UART Driver</title> | 228 | <title>16x50 UART Driver</title> |
221 | !Edrivers/tty/serial/serial_core.c | 229 | !Edrivers/tty/serial/serial_core.c |
222 | !Edrivers/tty/serial/8250.c | 230 | !Edrivers/tty/serial/8250/8250.c |
223 | </chapter> | 231 | </chapter> |
224 | 232 | ||
225 | <chapter id="fbdev"> | 233 | <chapter id="fbdev"> |
diff --git a/MAINTAINERS b/MAINTAINERS index a1fce9a3ab20..252972b6c4a0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -159,7 +159,7 @@ S: Maintained | |||
159 | F: drivers/net/ethernet/realtek/r8169.c | 159 | F: drivers/net/ethernet/realtek/r8169.c |
160 | 160 | ||
161 | 8250/16?50 (AND CLONE UARTS) SERIAL DRIVER | 161 | 8250/16?50 (AND CLONE UARTS) SERIAL DRIVER |
162 | M: Greg Kroah-Hartman <gregkh@suse.de> | 162 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
163 | L: linux-serial@vger.kernel.org | 163 | L: linux-serial@vger.kernel.org |
164 | W: http://serial.sourceforge.net | 164 | W: http://serial.sourceforge.net |
165 | S: Maintained | 165 | S: Maintained |
@@ -1783,9 +1783,9 @@ X: net/wireless/wext* | |||
1783 | 1783 | ||
1784 | CHAR and MISC DRIVERS | 1784 | CHAR and MISC DRIVERS |
1785 | M: Arnd Bergmann <arnd@arndb.de> | 1785 | M: Arnd Bergmann <arnd@arndb.de> |
1786 | M: Greg Kroah-Hartman <greg@kroah.com> | 1786 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
1787 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git | 1787 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git |
1788 | S: Maintained | 1788 | S: Supported |
1789 | F: drivers/char/* | 1789 | F: drivers/char/* |
1790 | F: drivers/misc/* | 1790 | F: drivers/misc/* |
1791 | 1791 | ||
@@ -2320,7 +2320,7 @@ F: lib/lru_cache.c | |||
2320 | F: Documentation/blockdev/drbd/ | 2320 | F: Documentation/blockdev/drbd/ |
2321 | 2321 | ||
2322 | DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS | 2322 | DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS |
2323 | M: Greg Kroah-Hartman <gregkh@suse.de> | 2323 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
2324 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git | 2324 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git |
2325 | S: Supported | 2325 | S: Supported |
2326 | F: Documentation/kobject.txt | 2326 | F: Documentation/kobject.txt |
@@ -6276,15 +6276,15 @@ S: Maintained | |||
6276 | F: arch/alpha/kernel/srm_env.c | 6276 | F: arch/alpha/kernel/srm_env.c |
6277 | 6277 | ||
6278 | STABLE BRANCH | 6278 | STABLE BRANCH |
6279 | M: Greg Kroah-Hartman <greg@kroah.com> | 6279 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
6280 | L: stable@vger.kernel.org | 6280 | L: stable@vger.kernel.org |
6281 | S: Maintained | 6281 | S: Supported |
6282 | 6282 | ||
6283 | STAGING SUBSYSTEM | 6283 | STAGING SUBSYSTEM |
6284 | M: Greg Kroah-Hartman <gregkh@suse.de> | 6284 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
6285 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git | 6285 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git |
6286 | L: devel@driverdev.osuosl.org | 6286 | L: devel@driverdev.osuosl.org |
6287 | S: Maintained | 6287 | S: Supported |
6288 | F: drivers/staging/ | 6288 | F: drivers/staging/ |
6289 | 6289 | ||
6290 | STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS | 6290 | STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS |
@@ -6669,8 +6669,8 @@ S: Maintained | |||
6669 | K: ^Subject:.*(?i)trivial | 6669 | K: ^Subject:.*(?i)trivial |
6670 | 6670 | ||
6671 | TTY LAYER | 6671 | TTY LAYER |
6672 | M: Greg Kroah-Hartman <gregkh@suse.de> | 6672 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
6673 | S: Maintained | 6673 | S: Supported |
6674 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git | 6674 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git |
6675 | F: drivers/tty/ | 6675 | F: drivers/tty/ |
6676 | F: drivers/tty/serial/serial_core.c | 6676 | F: drivers/tty/serial/serial_core.c |
@@ -6958,7 +6958,7 @@ S: Maintained | |||
6958 | F: drivers/usb/serial/digi_acceleport.c | 6958 | F: drivers/usb/serial/digi_acceleport.c |
6959 | 6959 | ||
6960 | USB SERIAL DRIVER | 6960 | USB SERIAL DRIVER |
6961 | M: Greg Kroah-Hartman <gregkh@suse.de> | 6961 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
6962 | L: linux-usb@vger.kernel.org | 6962 | L: linux-usb@vger.kernel.org |
6963 | S: Supported | 6963 | S: Supported |
6964 | F: Documentation/usb/usb-serial.txt | 6964 | F: Documentation/usb/usb-serial.txt |
@@ -6973,9 +6973,8 @@ S: Maintained | |||
6973 | F: drivers/usb/serial/empeg.c | 6973 | F: drivers/usb/serial/empeg.c |
6974 | 6974 | ||
6975 | USB SERIAL KEYSPAN DRIVER | 6975 | USB SERIAL KEYSPAN DRIVER |
6976 | M: Greg Kroah-Hartman <greg@kroah.com> | 6976 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
6977 | L: linux-usb@vger.kernel.org | 6977 | L: linux-usb@vger.kernel.org |
6978 | W: http://www.kroah.com/linux/ | ||
6979 | S: Maintained | 6978 | S: Maintained |
6980 | F: drivers/usb/serial/*keyspan* | 6979 | F: drivers/usb/serial/*keyspan* |
6981 | 6980 | ||
@@ -7003,7 +7002,7 @@ F: Documentation/video4linux/sn9c102.txt | |||
7003 | F: drivers/media/video/sn9c102/ | 7002 | F: drivers/media/video/sn9c102/ |
7004 | 7003 | ||
7005 | USB SUBSYSTEM | 7004 | USB SUBSYSTEM |
7006 | M: Greg Kroah-Hartman <gregkh@suse.de> | 7005 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
7007 | L: linux-usb@vger.kernel.org | 7006 | L: linux-usb@vger.kernel.org |
7008 | W: http://www.linux-usb.org | 7007 | W: http://www.linux-usb.org |
7009 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git | 7008 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git |
@@ -7090,7 +7089,7 @@ F: fs/hppfs/ | |||
7090 | 7089 | ||
7091 | USERSPACE I/O (UIO) | 7090 | USERSPACE I/O (UIO) |
7092 | M: "Hans J. Koch" <hjk@hansjkoch.de> | 7091 | M: "Hans J. Koch" <hjk@hansjkoch.de> |
7093 | M: Greg Kroah-Hartman <gregkh@suse.de> | 7092 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
7094 | S: Maintained | 7093 | S: Maintained |
7095 | F: Documentation/DocBook/uio-howto.tmpl | 7094 | F: Documentation/DocBook/uio-howto.tmpl |
7096 | F: drivers/uio/ | 7095 | F: drivers/uio/ |
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c index d4fc1a971779..604cd9dd1333 100644 --- a/arch/microblaze/kernel/setup.c +++ b/arch/microblaze/kernel/setup.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/cache.h> | 26 | #include <linux/cache.h> |
27 | #include <linux/of_platform.h> | 27 | #include <linux/of_platform.h> |
28 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
29 | #include <linux/cpu.h> | ||
30 | #include <asm/cacheflush.h> | 29 | #include <asm/cacheflush.h> |
31 | #include <asm/entry.h> | 30 | #include <asm/entry.h> |
32 | #include <asm/cpuinfo.h> | 31 | #include <asm/cpuinfo.h> |
@@ -227,23 +226,5 @@ static int __init setup_bus_notifier(void) | |||
227 | 226 | ||
228 | return 0; | 227 | return 0; |
229 | } | 228 | } |
230 | arch_initcall(setup_bus_notifier); | ||
231 | |||
232 | static DEFINE_PER_CPU(struct cpu, cpu_devices); | ||
233 | |||
234 | static int __init topology_init(void) | ||
235 | { | ||
236 | int i, ret; | ||
237 | |||
238 | for_each_present_cpu(i) { | ||
239 | struct cpu *c = &per_cpu(cpu_devices, i); | ||
240 | 229 | ||
241 | ret = register_cpu(c, i); | 230 | arch_initcall(setup_bus_notifier); |
242 | if (ret) | ||
243 | printk(KERN_WARNING "topology_init: register_cpu %d " | ||
244 | "failed (%d)\n", i, ret); | ||
245 | } | ||
246 | |||
247 | return 0; | ||
248 | } | ||
249 | subsys_initcall(topology_init); | ||
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 96657992a72e..ca5580e4d813 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -33,6 +33,7 @@ config SPARC | |||
33 | config SPARC32 | 33 | config SPARC32 |
34 | def_bool !64BIT | 34 | def_bool !64BIT |
35 | select GENERIC_ATOMIC64 | 35 | select GENERIC_ATOMIC64 |
36 | select CLZ_TAB | ||
36 | 37 | ||
37 | config SPARC64 | 38 | config SPARC64 |
38 | def_bool 64BIT | 39 | def_bool 64BIT |
diff --git a/arch/sparc/lib/divdi3.S b/arch/sparc/lib/divdi3.S index 681b3683da9e..d74bc0925f2d 100644 --- a/arch/sparc/lib/divdi3.S +++ b/arch/sparc/lib/divdi3.S | |||
@@ -17,23 +17,9 @@ along with GNU CC; see the file COPYING. If not, write to | |||
17 | the Free Software Foundation, 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. */ | 18 | Boston, MA 02111-1307, USA. */ |
19 | 19 | ||
20 | .data | ||
21 | .align 8 | ||
22 | .globl __clz_tab | ||
23 | __clz_tab: | ||
24 | .byte 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 | ||
25 | .byte 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6 | ||
26 | .byte 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 | ||
27 | .byte 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 | ||
28 | .byte 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 | ||
29 | .byte 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 | ||
30 | .byte 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 | ||
31 | .byte 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 | ||
32 | .size __clz_tab,256 | ||
33 | .global .udiv | ||
34 | |||
35 | .text | 20 | .text |
36 | .align 4 | 21 | .align 4 |
22 | .global .udiv | ||
37 | .globl __divdi3 | 23 | .globl __divdi3 |
38 | __divdi3: | 24 | __divdi3: |
39 | save %sp,-104,%sp | 25 | save %sp,-104,%sp |
diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h index 0c9fa2745f13..b3b733262909 100644 --- a/arch/x86/include/asm/cmpxchg.h +++ b/arch/x86/include/asm/cmpxchg.h | |||
@@ -145,13 +145,13 @@ extern void __add_wrong_size(void) | |||
145 | 145 | ||
146 | #ifdef __HAVE_ARCH_CMPXCHG | 146 | #ifdef __HAVE_ARCH_CMPXCHG |
147 | #define cmpxchg(ptr, old, new) \ | 147 | #define cmpxchg(ptr, old, new) \ |
148 | __cmpxchg((ptr), (old), (new), sizeof(*ptr)) | 148 | __cmpxchg(ptr, old, new, sizeof(*(ptr))) |
149 | 149 | ||
150 | #define sync_cmpxchg(ptr, old, new) \ | 150 | #define sync_cmpxchg(ptr, old, new) \ |
151 | __sync_cmpxchg((ptr), (old), (new), sizeof(*ptr)) | 151 | __sync_cmpxchg(ptr, old, new, sizeof(*(ptr))) |
152 | 152 | ||
153 | #define cmpxchg_local(ptr, old, new) \ | 153 | #define cmpxchg_local(ptr, old, new) \ |
154 | __cmpxchg_local((ptr), (old), (new), sizeof(*ptr)) | 154 | __cmpxchg_local(ptr, old, new, sizeof(*(ptr))) |
155 | #endif | 155 | #endif |
156 | 156 | ||
157 | /* | 157 | /* |
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 1aae78f775fc..4025fe4f928f 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c | |||
@@ -252,7 +252,8 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err) | |||
252 | unsigned short ss; | 252 | unsigned short ss; |
253 | unsigned long sp; | 253 | unsigned long sp; |
254 | #endif | 254 | #endif |
255 | printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter); | 255 | printk(KERN_DEFAULT |
256 | "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter); | ||
256 | #ifdef CONFIG_PREEMPT | 257 | #ifdef CONFIG_PREEMPT |
257 | printk("PREEMPT "); | 258 | printk("PREEMPT "); |
258 | #endif | 259 | #endif |
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index 6d728d9284bd..17107bd6e1f0 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
@@ -129,7 +129,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, | |||
129 | if (!stack) { | 129 | if (!stack) { |
130 | if (regs) | 130 | if (regs) |
131 | stack = (unsigned long *)regs->sp; | 131 | stack = (unsigned long *)regs->sp; |
132 | else if (task && task != current) | 132 | else if (task != current) |
133 | stack = (unsigned long *)task->thread.sp; | 133 | stack = (unsigned long *)task->thread.sp; |
134 | else | 134 | else |
135 | stack = &dummy; | 135 | stack = &dummy; |
@@ -269,11 +269,11 @@ void show_registers(struct pt_regs *regs) | |||
269 | unsigned char c; | 269 | unsigned char c; |
270 | u8 *ip; | 270 | u8 *ip; |
271 | 271 | ||
272 | printk(KERN_EMERG "Stack:\n"); | 272 | printk(KERN_DEFAULT "Stack:\n"); |
273 | show_stack_log_lvl(NULL, regs, (unsigned long *)sp, | 273 | show_stack_log_lvl(NULL, regs, (unsigned long *)sp, |
274 | 0, KERN_EMERG); | 274 | 0, KERN_DEFAULT); |
275 | 275 | ||
276 | printk(KERN_EMERG "Code: "); | 276 | printk(KERN_DEFAULT "Code: "); |
277 | 277 | ||
278 | ip = (u8 *)regs->ip - code_prologue; | 278 | ip = (u8 *)regs->ip - code_prologue; |
279 | if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) { | 279 | if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) { |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 37a458b521a6..d840e69a853c 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -39,6 +39,14 @@ static int reboot_mode; | |||
39 | enum reboot_type reboot_type = BOOT_ACPI; | 39 | enum reboot_type reboot_type = BOOT_ACPI; |
40 | int reboot_force; | 40 | int reboot_force; |
41 | 41 | ||
42 | /* This variable is used privately to keep track of whether or not | ||
43 | * reboot_type is still set to its default value (i.e., reboot= hasn't | ||
44 | * been set on the command line). This is needed so that we can | ||
45 | * suppress DMI scanning for reboot quirks. Without it, it's | ||
46 | * impossible to override a faulty reboot quirk without recompiling. | ||
47 | */ | ||
48 | static int reboot_default = 1; | ||
49 | |||
42 | #if defined(CONFIG_X86_32) && defined(CONFIG_SMP) | 50 | #if defined(CONFIG_X86_32) && defined(CONFIG_SMP) |
43 | static int reboot_cpu = -1; | 51 | static int reboot_cpu = -1; |
44 | #endif | 52 | #endif |
@@ -67,6 +75,12 @@ bool port_cf9_safe = false; | |||
67 | static int __init reboot_setup(char *str) | 75 | static int __init reboot_setup(char *str) |
68 | { | 76 | { |
69 | for (;;) { | 77 | for (;;) { |
78 | /* Having anything passed on the command line via | ||
79 | * reboot= will cause us to disable DMI checking | ||
80 | * below. | ||
81 | */ | ||
82 | reboot_default = 0; | ||
83 | |||
70 | switch (*str) { | 84 | switch (*str) { |
71 | case 'w': | 85 | case 'w': |
72 | reboot_mode = 0x1234; | 86 | reboot_mode = 0x1234; |
@@ -295,14 +309,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
295 | DMI_MATCH(DMI_BOARD_NAME, "P4S800"), | 309 | DMI_MATCH(DMI_BOARD_NAME, "P4S800"), |
296 | }, | 310 | }, |
297 | }, | 311 | }, |
298 | { /* Handle problems with rebooting on VersaLogic Menlow boards */ | ||
299 | .callback = set_bios_reboot, | ||
300 | .ident = "VersaLogic Menlow based board", | ||
301 | .matches = { | ||
302 | DMI_MATCH(DMI_BOARD_VENDOR, "VersaLogic Corporation"), | ||
303 | DMI_MATCH(DMI_BOARD_NAME, "VersaLogic Menlow board"), | ||
304 | }, | ||
305 | }, | ||
306 | { /* Handle reboot issue on Acer Aspire one */ | 312 | { /* Handle reboot issue on Acer Aspire one */ |
307 | .callback = set_kbd_reboot, | 313 | .callback = set_kbd_reboot, |
308 | .ident = "Acer Aspire One A110", | 314 | .ident = "Acer Aspire One A110", |
@@ -316,7 +322,12 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
316 | 322 | ||
317 | static int __init reboot_init(void) | 323 | static int __init reboot_init(void) |
318 | { | 324 | { |
319 | dmi_check_system(reboot_dmi_table); | 325 | /* Only do the DMI check if reboot_type hasn't been overridden |
326 | * on the command line | ||
327 | */ | ||
328 | if (reboot_default) { | ||
329 | dmi_check_system(reboot_dmi_table); | ||
330 | } | ||
320 | return 0; | 331 | return 0; |
321 | } | 332 | } |
322 | core_initcall(reboot_init); | 333 | core_initcall(reboot_init); |
@@ -465,7 +476,12 @@ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { | |||
465 | 476 | ||
466 | static int __init pci_reboot_init(void) | 477 | static int __init pci_reboot_init(void) |
467 | { | 478 | { |
468 | dmi_check_system(pci_reboot_dmi_table); | 479 | /* Only do the DMI check if reboot_type hasn't been overridden |
480 | * on the command line | ||
481 | */ | ||
482 | if (reboot_default) { | ||
483 | dmi_check_system(pci_reboot_dmi_table); | ||
484 | } | ||
469 | return 0; | 485 | return 0; |
470 | } | 486 | } |
471 | core_initcall(pci_reboot_init); | 487 | core_initcall(pci_reboot_init); |
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 9d74824a708d..f0b4caf85c1a 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -673,7 +673,7 @@ no_context(struct pt_regs *regs, unsigned long error_code, | |||
673 | 673 | ||
674 | stackend = end_of_stack(tsk); | 674 | stackend = end_of_stack(tsk); |
675 | if (tsk != &init_task && *stackend != STACK_END_MAGIC) | 675 | if (tsk != &init_task && *stackend != STACK_END_MAGIC) |
676 | printk(KERN_ALERT "Thread overran stack, or stack corrupted\n"); | 676 | printk(KERN_EMERG "Thread overran stack, or stack corrupted\n"); |
677 | 677 | ||
678 | tsk->thread.cr2 = address; | 678 | tsk->thread.cr2 = address; |
679 | tsk->thread.trap_no = 14; | 679 | tsk->thread.trap_no = 14; |
@@ -684,7 +684,7 @@ no_context(struct pt_regs *regs, unsigned long error_code, | |||
684 | sig = 0; | 684 | sig = 0; |
685 | 685 | ||
686 | /* Executive summary in case the body of the oops scrolled away */ | 686 | /* Executive summary in case the body of the oops scrolled away */ |
687 | printk(KERN_EMERG "CR2: %016lx\n", address); | 687 | printk(KERN_DEFAULT "CR2: %016lx\n", address); |
688 | 688 | ||
689 | oops_end(flags, regs, sig); | 689 | oops_end(flags, regs, sig); |
690 | } | 690 | } |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 6628feaa7622..7f5f0da726da 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -263,6 +263,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card) | |||
263 | static char ohci_driver_name[] = KBUILD_MODNAME; | 263 | static char ohci_driver_name[] = KBUILD_MODNAME; |
264 | 264 | ||
265 | #define PCI_DEVICE_ID_AGERE_FW643 0x5901 | 265 | #define PCI_DEVICE_ID_AGERE_FW643 0x5901 |
266 | #define PCI_DEVICE_ID_CREATIVE_SB1394 0x4001 | ||
266 | #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 | 267 | #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 |
267 | #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 | 268 | #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 |
268 | #define PCI_DEVICE_ID_TI_TSB12LV26 0x8020 | 269 | #define PCI_DEVICE_ID_TI_TSB12LV26 0x8020 |
@@ -289,6 +290,9 @@ static const struct { | |||
289 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, | 290 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, |
290 | QUIRK_NO_MSI}, | 291 | QUIRK_NO_MSI}, |
291 | 292 | ||
293 | {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID, | ||
294 | QUIRK_RESET_PACKET}, | ||
295 | |||
292 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID, | 296 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID, |
293 | QUIRK_NO_MSI}, | 297 | QUIRK_NO_MSI}, |
294 | 298 | ||
@@ -299,7 +303,7 @@ static const struct { | |||
299 | QUIRK_NO_MSI}, | 303 | QUIRK_NO_MSI}, |
300 | 304 | ||
301 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID, | 305 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID, |
302 | QUIRK_CYCLE_TIMER}, | 306 | QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, |
303 | 307 | ||
304 | {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID, | 308 | {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID, |
305 | QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A}, | 309 | QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A}, |
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index b37b0c02a7b9..5034a87cc72d 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -808,9 +808,12 @@ static ssize_t ucma_accept(struct ucma_file *file, const char __user *inbuf, | |||
808 | return PTR_ERR(ctx); | 808 | return PTR_ERR(ctx); |
809 | 809 | ||
810 | if (cmd.conn_param.valid) { | 810 | if (cmd.conn_param.valid) { |
811 | ctx->uid = cmd.uid; | ||
812 | ucma_copy_conn_param(&conn_param, &cmd.conn_param); | 811 | ucma_copy_conn_param(&conn_param, &cmd.conn_param); |
812 | mutex_lock(&file->mut); | ||
813 | ret = rdma_accept(ctx->cm_id, &conn_param); | 813 | ret = rdma_accept(ctx->cm_id, &conn_param); |
814 | if (!ret) | ||
815 | ctx->uid = cmd.uid; | ||
816 | mutex_unlock(&file->mut); | ||
814 | } else | 817 | } else |
815 | ret = rdma_accept(ctx->cm_id, NULL); | 818 | ret = rdma_accept(ctx->cm_id, NULL); |
816 | 819 | ||
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index b930da4c0c63..4d27e4c3fe34 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -1485,6 +1485,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, | |||
1485 | qp->event_handler = attr.event_handler; | 1485 | qp->event_handler = attr.event_handler; |
1486 | qp->qp_context = attr.qp_context; | 1486 | qp->qp_context = attr.qp_context; |
1487 | qp->qp_type = attr.qp_type; | 1487 | qp->qp_type = attr.qp_type; |
1488 | atomic_set(&qp->usecnt, 0); | ||
1488 | atomic_inc(&pd->usecnt); | 1489 | atomic_inc(&pd->usecnt); |
1489 | atomic_inc(&attr.send_cq->usecnt); | 1490 | atomic_inc(&attr.send_cq->usecnt); |
1490 | if (attr.recv_cq) | 1491 | if (attr.recv_cq) |
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 602b1bd723a9..575b78045aaf 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c | |||
@@ -421,6 +421,7 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, | |||
421 | qp->uobject = NULL; | 421 | qp->uobject = NULL; |
422 | qp->qp_type = qp_init_attr->qp_type; | 422 | qp->qp_type = qp_init_attr->qp_type; |
423 | 423 | ||
424 | atomic_set(&qp->usecnt, 0); | ||
424 | if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) { | 425 | if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) { |
425 | qp->event_handler = __ib_shared_qp_event_handler; | 426 | qp->event_handler = __ib_shared_qp_event_handler; |
426 | qp->qp_context = qp; | 427 | qp->qp_context = qp; |
@@ -430,7 +431,6 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, | |||
430 | qp->xrcd = qp_init_attr->xrcd; | 431 | qp->xrcd = qp_init_attr->xrcd; |
431 | atomic_inc(&qp_init_attr->xrcd->usecnt); | 432 | atomic_inc(&qp_init_attr->xrcd->usecnt); |
432 | INIT_LIST_HEAD(&qp->open_list); | 433 | INIT_LIST_HEAD(&qp->open_list); |
433 | atomic_set(&qp->usecnt, 0); | ||
434 | 434 | ||
435 | real_qp = qp; | 435 | real_qp = qp; |
436 | qp = __ib_open_qp(real_qp, qp_init_attr->event_handler, | 436 | qp = __ib_open_qp(real_qp, qp_init_attr->event_handler, |
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index b7d4216db3c3..a4de9d58e9b4 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
@@ -89,7 +89,7 @@ static int create_file(const char *name, umode_t mode, | |||
89 | error = ipathfs_mknod(parent->d_inode, *dentry, | 89 | error = ipathfs_mknod(parent->d_inode, *dentry, |
90 | mode, fops, data); | 90 | mode, fops, data); |
91 | else | 91 | else |
92 | error = PTR_ERR(dentry); | 92 | error = PTR_ERR(*dentry); |
93 | mutex_unlock(&parent->d_inode->i_mutex); | 93 | mutex_unlock(&parent->d_inode->i_mutex); |
94 | 94 | ||
95 | return error; | 95 | return error; |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 95c94d8f0254..259b0670b51c 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -257,12 +257,9 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | |||
257 | return IB_MAD_RESULT_SUCCESS; | 257 | return IB_MAD_RESULT_SUCCESS; |
258 | 258 | ||
259 | /* | 259 | /* |
260 | * Don't process SMInfo queries or vendor-specific | 260 | * Don't process SMInfo queries -- the SMA can't handle them. |
261 | * MADs -- the SMA can't handle them. | ||
262 | */ | 261 | */ |
263 | if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO || | 262 | if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO) |
264 | ((in_mad->mad_hdr.attr_id & IB_SMP_ATTR_VENDOR_MASK) == | ||
265 | IB_SMP_ATTR_VENDOR_MASK)) | ||
266 | return IB_MAD_RESULT_SUCCESS; | 263 | return IB_MAD_RESULT_SUCCESS; |
267 | } else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT || | 264 | } else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT || |
268 | in_mad->mad_hdr.mgmt_class == MLX4_IB_VENDOR_CLASS1 || | 265 | in_mad->mad_hdr.mgmt_class == MLX4_IB_VENDOR_CLASS1 || |
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c index 7013da5e9eda..7140199f562e 100644 --- a/drivers/infiniband/hw/nes/nes.c +++ b/drivers/infiniband/hw/nes/nes.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. | 3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h index 568b4f11380a..c438e4691b3c 100644 --- a/drivers/infiniband/hw/nes/nes.h +++ b/drivers/infiniband/hw/nes/nes.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. | 3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 425065b36b8c..a4972abedef1 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -233,6 +233,7 @@ static int send_mpa_reject(struct nes_cm_node *cm_node) | |||
233 | u8 *start_ptr = &start_addr; | 233 | u8 *start_ptr = &start_addr; |
234 | u8 **start_buff = &start_ptr; | 234 | u8 **start_buff = &start_ptr; |
235 | u16 buff_len = 0; | 235 | u16 buff_len = 0; |
236 | struct ietf_mpa_v1 *mpa_frame; | ||
236 | 237 | ||
237 | skb = dev_alloc_skb(MAX_CM_BUFFER); | 238 | skb = dev_alloc_skb(MAX_CM_BUFFER); |
238 | if (!skb) { | 239 | if (!skb) { |
@@ -242,6 +243,8 @@ static int send_mpa_reject(struct nes_cm_node *cm_node) | |||
242 | 243 | ||
243 | /* send an MPA reject frame */ | 244 | /* send an MPA reject frame */ |
244 | cm_build_mpa_frame(cm_node, start_buff, &buff_len, NULL, MPA_KEY_REPLY); | 245 | cm_build_mpa_frame(cm_node, start_buff, &buff_len, NULL, MPA_KEY_REPLY); |
246 | mpa_frame = (struct ietf_mpa_v1 *)*start_buff; | ||
247 | mpa_frame->flags |= IETF_MPA_FLAGS_REJECT; | ||
245 | form_cm_frame(skb, cm_node, NULL, 0, *start_buff, buff_len, SET_ACK | SET_FIN); | 248 | form_cm_frame(skb, cm_node, NULL, 0, *start_buff, buff_len, SET_ACK | SET_FIN); |
246 | 249 | ||
247 | cm_node->state = NES_CM_STATE_FIN_WAIT1; | 250 | cm_node->state = NES_CM_STATE_FIN_WAIT1; |
@@ -1360,8 +1363,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi | |||
1360 | if (!memcmp(nesadapter->arp_table[arpindex].mac_addr, | 1363 | if (!memcmp(nesadapter->arp_table[arpindex].mac_addr, |
1361 | neigh->ha, ETH_ALEN)) { | 1364 | neigh->ha, ETH_ALEN)) { |
1362 | /* Mac address same as in nes_arp_table */ | 1365 | /* Mac address same as in nes_arp_table */ |
1363 | ip_rt_put(rt); | 1366 | goto out; |
1364 | return rc; | ||
1365 | } | 1367 | } |
1366 | 1368 | ||
1367 | nes_manage_arp_cache(nesvnic->netdev, | 1369 | nes_manage_arp_cache(nesvnic->netdev, |
@@ -1377,6 +1379,8 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi | |||
1377 | neigh_event_send(neigh, NULL); | 1379 | neigh_event_send(neigh, NULL); |
1378 | } | 1380 | } |
1379 | } | 1381 | } |
1382 | |||
1383 | out: | ||
1380 | rcu_read_unlock(); | 1384 | rcu_read_unlock(); |
1381 | ip_rt_put(rt); | 1385 | ip_rt_put(rt); |
1382 | return rc; | 1386 | return rc; |
diff --git a/drivers/infiniband/hw/nes/nes_cm.h b/drivers/infiniband/hw/nes/nes_cm.h index bdfa1fbb35fc..4646e6666087 100644 --- a/drivers/infiniband/hw/nes/nes_cm.h +++ b/drivers/infiniband/hw/nes/nes_cm.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_context.h b/drivers/infiniband/hw/nes/nes_context.h index b4393a16099d..a69eef16d72d 100644 --- a/drivers/infiniband/hw/nes/nes_context.h +++ b/drivers/infiniband/hw/nes/nes_context.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index 055f4b545df0..d42c9f435b1b 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h index 0b590e152c6a..d748e4b31b8d 100644 --- a/drivers/infiniband/hw/nes/nes_hw.h +++ b/drivers/infiniband/hw/nes/nes_hw.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_mgt.c b/drivers/infiniband/hw/nes/nes_mgt.c index b3b2a240c6e9..3ba7be369452 100644 --- a/drivers/infiniband/hw/nes/nes_mgt.c +++ b/drivers/infiniband/hw/nes/nes_mgt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel-NE, Inc. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel-NE, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_mgt.h b/drivers/infiniband/hw/nes/nes_mgt.h index 8c8af254555a..4f7f701c4a81 100644 --- a/drivers/infiniband/hw/nes/nes_mgt.h +++ b/drivers/infiniband/hw/nes/nes_mgt.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2010 Intel-NE, Inc. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel-NE, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index 4b3fa711a247..f3a3ecf8d09e 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_user.h b/drivers/infiniband/hw/nes/nes_user.h index 71e133ab209b..4926de744488 100644 --- a/drivers/infiniband/hw/nes/nes_user.h +++ b/drivers/infiniband/hw/nes/nes_user.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2005 Topspin Communications. All rights reserved. | 3 | * Copyright (c) 2005 Topspin Communications. All rights reserved. |
4 | * Copyright (c) 2005 Cisco Systems. All rights reserved. | 4 | * Copyright (c) 2005 Cisco Systems. All rights reserved. |
5 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. | 5 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. |
diff --git a/drivers/infiniband/hw/nes/nes_utils.c b/drivers/infiniband/hw/nes/nes_utils.c index 8b4c2ff54888..e98f4fc0b768 100644 --- a/drivers/infiniband/hw/nes/nes_utils.c +++ b/drivers/infiniband/hw/nes/nes_utils.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 5095bc41c6cc..0927b5cc65d3 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -3428,6 +3428,8 @@ static int nes_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr, | |||
3428 | NES_IWARP_SQ_FMR_WQE_LENGTH_LOW_IDX, | 3428 | NES_IWARP_SQ_FMR_WQE_LENGTH_LOW_IDX, |
3429 | ib_wr->wr.fast_reg.length); | 3429 | ib_wr->wr.fast_reg.length); |
3430 | set_wqe_32bit_value(wqe->wqe_words, | 3430 | set_wqe_32bit_value(wqe->wqe_words, |
3431 | NES_IWARP_SQ_FMR_WQE_LENGTH_HIGH_IDX, 0); | ||
3432 | set_wqe_32bit_value(wqe->wqe_words, | ||
3431 | NES_IWARP_SQ_FMR_WQE_MR_STAG_IDX, | 3433 | NES_IWARP_SQ_FMR_WQE_MR_STAG_IDX, |
3432 | ib_wr->wr.fast_reg.rkey); | 3434 | ib_wr->wr.fast_reg.rkey); |
3433 | /* Set page size: */ | 3435 | /* Set page size: */ |
@@ -3724,7 +3726,7 @@ static int nes_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry) | |||
3724 | entry->opcode = IB_WC_SEND; | 3726 | entry->opcode = IB_WC_SEND; |
3725 | break; | 3727 | break; |
3726 | case NES_IWARP_SQ_OP_LOCINV: | 3728 | case NES_IWARP_SQ_OP_LOCINV: |
3727 | entry->opcode = IB_WR_LOCAL_INV; | 3729 | entry->opcode = IB_WC_LOCAL_INV; |
3728 | break; | 3730 | break; |
3729 | case NES_IWARP_SQ_OP_FAST_REG: | 3731 | case NES_IWARP_SQ_OP_FAST_REG: |
3730 | entry->opcode = IB_WC_FAST_REG_MR; | 3732 | entry->opcode = IB_WC_FAST_REG_MR; |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.h b/drivers/infiniband/hw/nes/nes_verbs.h index fe6b6e92fa90..0eff7c44d76b 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.h +++ b/drivers/infiniband/hw/nes/nes_verbs.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. | 3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c index 4f18e2d332df..d0c64d514813 100644 --- a/drivers/infiniband/hw/qib/qib_iba6120.c +++ b/drivers/infiniband/hw/qib/qib_iba6120.c | |||
@@ -2105,7 +2105,7 @@ static void alloc_dummy_hdrq(struct qib_devdata *dd) | |||
2105 | dd->cspec->dummy_hdrq = dma_alloc_coherent(&dd->pcidev->dev, | 2105 | dd->cspec->dummy_hdrq = dma_alloc_coherent(&dd->pcidev->dev, |
2106 | dd->rcd[0]->rcvhdrq_size, | 2106 | dd->rcd[0]->rcvhdrq_size, |
2107 | &dd->cspec->dummy_hdrq_phys, | 2107 | &dd->cspec->dummy_hdrq_phys, |
2108 | GFP_KERNEL | __GFP_COMP); | 2108 | GFP_ATOMIC | __GFP_COMP); |
2109 | if (!dd->cspec->dummy_hdrq) { | 2109 | if (!dd->cspec->dummy_hdrq) { |
2110 | qib_devinfo(dd->pcidev, "Couldn't allocate dummy hdrq\n"); | 2110 | qib_devinfo(dd->pcidev, "Couldn't allocate dummy hdrq\n"); |
2111 | /* fallback to just 0'ing */ | 2111 | /* fallback to just 0'ing */ |
diff --git a/drivers/infiniband/hw/qib/qib_pcie.c b/drivers/infiniband/hw/qib/qib_pcie.c index f695061d688e..0fde788e1100 100644 --- a/drivers/infiniband/hw/qib/qib_pcie.c +++ b/drivers/infiniband/hw/qib/qib_pcie.c | |||
@@ -560,7 +560,7 @@ static int qib_tune_pcie_coalesce(struct qib_devdata *dd) | |||
560 | * BIOS may not set PCIe bus-utilization parameters for best performance. | 560 | * BIOS may not set PCIe bus-utilization parameters for best performance. |
561 | * Check and optionally adjust them to maximize our throughput. | 561 | * Check and optionally adjust them to maximize our throughput. |
562 | */ | 562 | */ |
563 | static int qib_pcie_caps = 0x51; | 563 | static int qib_pcie_caps; |
564 | module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO); | 564 | module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO); |
565 | MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (0..3), ReadReq (4..7)"); | 565 | MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (0..3), ReadReq (4..7)"); |
566 | 566 | ||
diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c index 70e006b50f29..5443e25086e9 100644 --- a/drivers/staging/media/go7007/go7007-usb.c +++ b/drivers/staging/media/go7007/go7007-usb.c | |||
@@ -1279,3 +1279,4 @@ static struct usb_driver go7007_usb_driver = { | |||
1279 | }; | 1279 | }; |
1280 | 1280 | ||
1281 | module_usb_driver(go7007_usb_driver); | 1281 | module_usb_driver(go7007_usb_driver); |
1282 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c index e97404d611e0..9c501449450d 100644 --- a/fs/logfs/dev_mtd.c +++ b/fs/logfs/dev_mtd.c | |||
@@ -152,9 +152,6 @@ static struct page *logfs_mtd_find_first_sb(struct super_block *sb, u64 *ofs) | |||
152 | filler_t *filler = logfs_mtd_readpage; | 152 | filler_t *filler = logfs_mtd_readpage; |
153 | struct mtd_info *mtd = super->s_mtd; | 153 | struct mtd_info *mtd = super->s_mtd; |
154 | 154 | ||
155 | if (!mtd_can_have_bb(mtd)) | ||
156 | return NULL; | ||
157 | |||
158 | *ofs = 0; | 155 | *ofs = 0; |
159 | while (mtd_block_isbad(mtd, *ofs)) { | 156 | while (mtd_block_isbad(mtd, *ofs)) { |
160 | *ofs += mtd->erasesize; | 157 | *ofs += mtd->erasesize; |
@@ -172,9 +169,6 @@ static struct page *logfs_mtd_find_last_sb(struct super_block *sb, u64 *ofs) | |||
172 | filler_t *filler = logfs_mtd_readpage; | 169 | filler_t *filler = logfs_mtd_readpage; |
173 | struct mtd_info *mtd = super->s_mtd; | 170 | struct mtd_info *mtd = super->s_mtd; |
174 | 171 | ||
175 | if (!mtd_can_have_bb(mtd)) | ||
176 | return NULL; | ||
177 | |||
178 | *ofs = mtd->size - mtd->erasesize; | 172 | *ofs = mtd->size - mtd->erasesize; |
179 | while (mtd_block_isbad(mtd, *ofs)) { | 173 | while (mtd_block_isbad(mtd, *ofs)) { |
180 | *ofs -= mtd->erasesize; | 174 | *ofs -= mtd->erasesize; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 9cde9edf9c4d..d9512bd03e6c 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -711,6 +711,13 @@ static int mem_open(struct inode* inode, struct file* file) | |||
711 | if (IS_ERR(mm)) | 711 | if (IS_ERR(mm)) |
712 | return PTR_ERR(mm); | 712 | return PTR_ERR(mm); |
713 | 713 | ||
714 | if (mm) { | ||
715 | /* ensure this mm_struct can't be freed */ | ||
716 | atomic_inc(&mm->mm_count); | ||
717 | /* but do not pin its memory */ | ||
718 | mmput(mm); | ||
719 | } | ||
720 | |||
714 | /* OK to pass negative loff_t, we can catch out-of-range */ | 721 | /* OK to pass negative loff_t, we can catch out-of-range */ |
715 | file->f_mode |= FMODE_UNSIGNED_OFFSET; | 722 | file->f_mode |= FMODE_UNSIGNED_OFFSET; |
716 | file->private_data = mm; | 723 | file->private_data = mm; |
@@ -718,57 +725,13 @@ static int mem_open(struct inode* inode, struct file* file) | |||
718 | return 0; | 725 | return 0; |
719 | } | 726 | } |
720 | 727 | ||
721 | static ssize_t mem_read(struct file * file, char __user * buf, | 728 | static ssize_t mem_rw(struct file *file, char __user *buf, |
722 | size_t count, loff_t *ppos) | 729 | size_t count, loff_t *ppos, int write) |
723 | { | 730 | { |
724 | int ret; | ||
725 | char *page; | ||
726 | unsigned long src = *ppos; | ||
727 | struct mm_struct *mm = file->private_data; | 731 | struct mm_struct *mm = file->private_data; |
728 | 732 | unsigned long addr = *ppos; | |
729 | if (!mm) | 733 | ssize_t copied; |
730 | return 0; | ||
731 | |||
732 | page = (char *)__get_free_page(GFP_TEMPORARY); | ||
733 | if (!page) | ||
734 | return -ENOMEM; | ||
735 | |||
736 | ret = 0; | ||
737 | |||
738 | while (count > 0) { | ||
739 | int this_len, retval; | ||
740 | |||
741 | this_len = (count > PAGE_SIZE) ? PAGE_SIZE : count; | ||
742 | retval = access_remote_vm(mm, src, page, this_len, 0); | ||
743 | if (!retval) { | ||
744 | if (!ret) | ||
745 | ret = -EIO; | ||
746 | break; | ||
747 | } | ||
748 | |||
749 | if (copy_to_user(buf, page, retval)) { | ||
750 | ret = -EFAULT; | ||
751 | break; | ||
752 | } | ||
753 | |||
754 | ret += retval; | ||
755 | src += retval; | ||
756 | buf += retval; | ||
757 | count -= retval; | ||
758 | } | ||
759 | *ppos = src; | ||
760 | |||
761 | free_page((unsigned long) page); | ||
762 | return ret; | ||
763 | } | ||
764 | |||
765 | static ssize_t mem_write(struct file * file, const char __user *buf, | ||
766 | size_t count, loff_t *ppos) | ||
767 | { | ||
768 | int copied; | ||
769 | char *page; | 734 | char *page; |
770 | unsigned long dst = *ppos; | ||
771 | struct mm_struct *mm = file->private_data; | ||
772 | 735 | ||
773 | if (!mm) | 736 | if (!mm) |
774 | return 0; | 737 | return 0; |
@@ -778,31 +741,54 @@ static ssize_t mem_write(struct file * file, const char __user *buf, | |||
778 | return -ENOMEM; | 741 | return -ENOMEM; |
779 | 742 | ||
780 | copied = 0; | 743 | copied = 0; |
744 | if (!atomic_inc_not_zero(&mm->mm_users)) | ||
745 | goto free; | ||
746 | |||
781 | while (count > 0) { | 747 | while (count > 0) { |
782 | int this_len, retval; | 748 | int this_len = min_t(int, count, PAGE_SIZE); |
783 | 749 | ||
784 | this_len = (count > PAGE_SIZE) ? PAGE_SIZE : count; | 750 | if (write && copy_from_user(page, buf, this_len)) { |
785 | if (copy_from_user(page, buf, this_len)) { | ||
786 | copied = -EFAULT; | 751 | copied = -EFAULT; |
787 | break; | 752 | break; |
788 | } | 753 | } |
789 | retval = access_remote_vm(mm, dst, page, this_len, 1); | 754 | |
790 | if (!retval) { | 755 | this_len = access_remote_vm(mm, addr, page, this_len, write); |
756 | if (!this_len) { | ||
791 | if (!copied) | 757 | if (!copied) |
792 | copied = -EIO; | 758 | copied = -EIO; |
793 | break; | 759 | break; |
794 | } | 760 | } |
795 | copied += retval; | 761 | |
796 | buf += retval; | 762 | if (!write && copy_to_user(buf, page, this_len)) { |
797 | dst += retval; | 763 | copied = -EFAULT; |
798 | count -= retval; | 764 | break; |
765 | } | ||
766 | |||
767 | buf += this_len; | ||
768 | addr += this_len; | ||
769 | copied += this_len; | ||
770 | count -= this_len; | ||
799 | } | 771 | } |
800 | *ppos = dst; | 772 | *ppos = addr; |
801 | 773 | ||
774 | mmput(mm); | ||
775 | free: | ||
802 | free_page((unsigned long) page); | 776 | free_page((unsigned long) page); |
803 | return copied; | 777 | return copied; |
804 | } | 778 | } |
805 | 779 | ||
780 | static ssize_t mem_read(struct file *file, char __user *buf, | ||
781 | size_t count, loff_t *ppos) | ||
782 | { | ||
783 | return mem_rw(file, buf, count, ppos, 0); | ||
784 | } | ||
785 | |||
786 | static ssize_t mem_write(struct file *file, const char __user *buf, | ||
787 | size_t count, loff_t *ppos) | ||
788 | { | ||
789 | return mem_rw(file, (char __user*)buf, count, ppos, 1); | ||
790 | } | ||
791 | |||
806 | loff_t mem_lseek(struct file *file, loff_t offset, int orig) | 792 | loff_t mem_lseek(struct file *file, loff_t offset, int orig) |
807 | { | 793 | { |
808 | switch (orig) { | 794 | switch (orig) { |
@@ -822,8 +808,8 @@ loff_t mem_lseek(struct file *file, loff_t offset, int orig) | |||
822 | static int mem_release(struct inode *inode, struct file *file) | 808 | static int mem_release(struct inode *inode, struct file *file) |
823 | { | 809 | { |
824 | struct mm_struct *mm = file->private_data; | 810 | struct mm_struct *mm = file->private_data; |
825 | 811 | if (mm) | |
826 | mmput(mm); | 812 | mmdrop(mm); |
827 | return 0; | 813 | return 0; |
828 | } | 814 | } |
829 | 815 | ||
diff --git a/include/linux/mpi.h b/include/linux/mpi.h index 06f88994ccaa..d02cca6cc8ce 100644 --- a/include/linux/mpi.h +++ b/include/linux/mpi.h | |||
@@ -57,8 +57,6 @@ struct gcry_mpi { | |||
57 | 57 | ||
58 | typedef struct gcry_mpi *MPI; | 58 | typedef struct gcry_mpi *MPI; |
59 | 59 | ||
60 | #define MPI_NULL NULL | ||
61 | |||
62 | #define mpi_get_nlimbs(a) ((a)->nlimbs) | 60 | #define mpi_get_nlimbs(a) ((a)->nlimbs) |
63 | #define mpi_is_neg(a) ((a)->sign) | 61 | #define mpi_is_neg(a) ((a)->sign) |
64 | 62 | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 221295208fd0..887ebe318c75 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -489,7 +489,7 @@ static inline int mtd_has_oob(const struct mtd_info *mtd) | |||
489 | 489 | ||
490 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) | 490 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) |
491 | { | 491 | { |
492 | return 0; | 492 | return !!mtd->block_isbad; |
493 | } | 493 | } |
494 | 494 | ||
495 | /* Kernel-side ioctl definitions */ | 495 | /* Kernel-side ioctl definitions */ |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 08855613ceb3..abb2776be1ba 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -587,6 +587,7 @@ struct hw_perf_event { | |||
587 | u64 sample_period; | 587 | u64 sample_period; |
588 | u64 last_period; | 588 | u64 last_period; |
589 | local64_t period_left; | 589 | local64_t period_left; |
590 | u64 interrupts_seq; | ||
590 | u64 interrupts; | 591 | u64 interrupts; |
591 | 592 | ||
592 | u64 freq_time_stamp; | 593 | u64 freq_time_stamp; |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 32b48c889711..ba36013cfb21 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -2300,6 +2300,9 @@ do { \ | |||
2300 | return div64_u64(dividend, divisor); | 2300 | return div64_u64(dividend, divisor); |
2301 | } | 2301 | } |
2302 | 2302 | ||
2303 | static DEFINE_PER_CPU(int, perf_throttled_count); | ||
2304 | static DEFINE_PER_CPU(u64, perf_throttled_seq); | ||
2305 | |||
2303 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) | 2306 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) |
2304 | { | 2307 | { |
2305 | struct hw_perf_event *hwc = &event->hw; | 2308 | struct hw_perf_event *hwc = &event->hw; |
@@ -2325,16 +2328,29 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) | |||
2325 | } | 2328 | } |
2326 | } | 2329 | } |
2327 | 2330 | ||
2328 | static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period) | 2331 | /* |
2332 | * combine freq adjustment with unthrottling to avoid two passes over the | ||
2333 | * events. At the same time, make sure, having freq events does not change | ||
2334 | * the rate of unthrottling as that would introduce bias. | ||
2335 | */ | ||
2336 | static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, | ||
2337 | int needs_unthr) | ||
2329 | { | 2338 | { |
2330 | struct perf_event *event; | 2339 | struct perf_event *event; |
2331 | struct hw_perf_event *hwc; | 2340 | struct hw_perf_event *hwc; |
2332 | u64 interrupts, now; | 2341 | u64 now, period = TICK_NSEC; |
2333 | s64 delta; | 2342 | s64 delta; |
2334 | 2343 | ||
2335 | if (!ctx->nr_freq) | 2344 | /* |
2345 | * only need to iterate over all events iff: | ||
2346 | * - context have events in frequency mode (needs freq adjust) | ||
2347 | * - there are events to unthrottle on this cpu | ||
2348 | */ | ||
2349 | if (!(ctx->nr_freq || needs_unthr)) | ||
2336 | return; | 2350 | return; |
2337 | 2351 | ||
2352 | raw_spin_lock(&ctx->lock); | ||
2353 | |||
2338 | list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { | 2354 | list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { |
2339 | if (event->state != PERF_EVENT_STATE_ACTIVE) | 2355 | if (event->state != PERF_EVENT_STATE_ACTIVE) |
2340 | continue; | 2356 | continue; |
@@ -2344,13 +2360,8 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period) | |||
2344 | 2360 | ||
2345 | hwc = &event->hw; | 2361 | hwc = &event->hw; |
2346 | 2362 | ||
2347 | interrupts = hwc->interrupts; | 2363 | if (needs_unthr && hwc->interrupts == MAX_INTERRUPTS) { |
2348 | hwc->interrupts = 0; | 2364 | hwc->interrupts = 0; |
2349 | |||
2350 | /* | ||
2351 | * unthrottle events on the tick | ||
2352 | */ | ||
2353 | if (interrupts == MAX_INTERRUPTS) { | ||
2354 | perf_log_throttle(event, 1); | 2365 | perf_log_throttle(event, 1); |
2355 | event->pmu->start(event, 0); | 2366 | event->pmu->start(event, 0); |
2356 | } | 2367 | } |
@@ -2358,14 +2369,26 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period) | |||
2358 | if (!event->attr.freq || !event->attr.sample_freq) | 2369 | if (!event->attr.freq || !event->attr.sample_freq) |
2359 | continue; | 2370 | continue; |
2360 | 2371 | ||
2361 | event->pmu->read(event); | 2372 | /* |
2373 | * stop the event and update event->count | ||
2374 | */ | ||
2375 | event->pmu->stop(event, PERF_EF_UPDATE); | ||
2376 | |||
2362 | now = local64_read(&event->count); | 2377 | now = local64_read(&event->count); |
2363 | delta = now - hwc->freq_count_stamp; | 2378 | delta = now - hwc->freq_count_stamp; |
2364 | hwc->freq_count_stamp = now; | 2379 | hwc->freq_count_stamp = now; |
2365 | 2380 | ||
2381 | /* | ||
2382 | * restart the event | ||
2383 | * reload only if value has changed | ||
2384 | */ | ||
2366 | if (delta > 0) | 2385 | if (delta > 0) |
2367 | perf_adjust_period(event, period, delta); | 2386 | perf_adjust_period(event, period, delta); |
2387 | |||
2388 | event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0); | ||
2368 | } | 2389 | } |
2390 | |||
2391 | raw_spin_unlock(&ctx->lock); | ||
2369 | } | 2392 | } |
2370 | 2393 | ||
2371 | /* | 2394 | /* |
@@ -2388,16 +2411,13 @@ static void rotate_ctx(struct perf_event_context *ctx) | |||
2388 | */ | 2411 | */ |
2389 | static void perf_rotate_context(struct perf_cpu_context *cpuctx) | 2412 | static void perf_rotate_context(struct perf_cpu_context *cpuctx) |
2390 | { | 2413 | { |
2391 | u64 interval = (u64)cpuctx->jiffies_interval * TICK_NSEC; | ||
2392 | struct perf_event_context *ctx = NULL; | 2414 | struct perf_event_context *ctx = NULL; |
2393 | int rotate = 0, remove = 1, freq = 0; | 2415 | int rotate = 0, remove = 1; |
2394 | 2416 | ||
2395 | if (cpuctx->ctx.nr_events) { | 2417 | if (cpuctx->ctx.nr_events) { |
2396 | remove = 0; | 2418 | remove = 0; |
2397 | if (cpuctx->ctx.nr_events != cpuctx->ctx.nr_active) | 2419 | if (cpuctx->ctx.nr_events != cpuctx->ctx.nr_active) |
2398 | rotate = 1; | 2420 | rotate = 1; |
2399 | if (cpuctx->ctx.nr_freq) | ||
2400 | freq = 1; | ||
2401 | } | 2421 | } |
2402 | 2422 | ||
2403 | ctx = cpuctx->task_ctx; | 2423 | ctx = cpuctx->task_ctx; |
@@ -2405,37 +2425,26 @@ static void perf_rotate_context(struct perf_cpu_context *cpuctx) | |||
2405 | remove = 0; | 2425 | remove = 0; |
2406 | if (ctx->nr_events != ctx->nr_active) | 2426 | if (ctx->nr_events != ctx->nr_active) |
2407 | rotate = 1; | 2427 | rotate = 1; |
2408 | if (ctx->nr_freq) | ||
2409 | freq = 1; | ||
2410 | } | 2428 | } |
2411 | 2429 | ||
2412 | if (!rotate && !freq) | 2430 | if (!rotate) |
2413 | goto done; | 2431 | goto done; |
2414 | 2432 | ||
2415 | perf_ctx_lock(cpuctx, cpuctx->task_ctx); | 2433 | perf_ctx_lock(cpuctx, cpuctx->task_ctx); |
2416 | perf_pmu_disable(cpuctx->ctx.pmu); | 2434 | perf_pmu_disable(cpuctx->ctx.pmu); |
2417 | 2435 | ||
2418 | if (freq) { | 2436 | cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); |
2419 | perf_ctx_adjust_freq(&cpuctx->ctx, interval); | 2437 | if (ctx) |
2420 | if (ctx) | 2438 | ctx_sched_out(ctx, cpuctx, EVENT_FLEXIBLE); |
2421 | perf_ctx_adjust_freq(ctx, interval); | ||
2422 | } | ||
2423 | |||
2424 | if (rotate) { | ||
2425 | cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); | ||
2426 | if (ctx) | ||
2427 | ctx_sched_out(ctx, cpuctx, EVENT_FLEXIBLE); | ||
2428 | 2439 | ||
2429 | rotate_ctx(&cpuctx->ctx); | 2440 | rotate_ctx(&cpuctx->ctx); |
2430 | if (ctx) | 2441 | if (ctx) |
2431 | rotate_ctx(ctx); | 2442 | rotate_ctx(ctx); |
2432 | 2443 | ||
2433 | perf_event_sched_in(cpuctx, ctx, current); | 2444 | perf_event_sched_in(cpuctx, ctx, current); |
2434 | } | ||
2435 | 2445 | ||
2436 | perf_pmu_enable(cpuctx->ctx.pmu); | 2446 | perf_pmu_enable(cpuctx->ctx.pmu); |
2437 | perf_ctx_unlock(cpuctx, cpuctx->task_ctx); | 2447 | perf_ctx_unlock(cpuctx, cpuctx->task_ctx); |
2438 | |||
2439 | done: | 2448 | done: |
2440 | if (remove) | 2449 | if (remove) |
2441 | list_del_init(&cpuctx->rotation_list); | 2450 | list_del_init(&cpuctx->rotation_list); |
@@ -2445,10 +2454,22 @@ void perf_event_task_tick(void) | |||
2445 | { | 2454 | { |
2446 | struct list_head *head = &__get_cpu_var(rotation_list); | 2455 | struct list_head *head = &__get_cpu_var(rotation_list); |
2447 | struct perf_cpu_context *cpuctx, *tmp; | 2456 | struct perf_cpu_context *cpuctx, *tmp; |
2457 | struct perf_event_context *ctx; | ||
2458 | int throttled; | ||
2448 | 2459 | ||
2449 | WARN_ON(!irqs_disabled()); | 2460 | WARN_ON(!irqs_disabled()); |
2450 | 2461 | ||
2462 | __this_cpu_inc(perf_throttled_seq); | ||
2463 | throttled = __this_cpu_xchg(perf_throttled_count, 0); | ||
2464 | |||
2451 | list_for_each_entry_safe(cpuctx, tmp, head, rotation_list) { | 2465 | list_for_each_entry_safe(cpuctx, tmp, head, rotation_list) { |
2466 | ctx = &cpuctx->ctx; | ||
2467 | perf_adjust_freq_unthr_context(ctx, throttled); | ||
2468 | |||
2469 | ctx = cpuctx->task_ctx; | ||
2470 | if (ctx) | ||
2471 | perf_adjust_freq_unthr_context(ctx, throttled); | ||
2472 | |||
2452 | if (cpuctx->jiffies_interval == 1 || | 2473 | if (cpuctx->jiffies_interval == 1 || |
2453 | !(jiffies % cpuctx->jiffies_interval)) | 2474 | !(jiffies % cpuctx->jiffies_interval)) |
2454 | perf_rotate_context(cpuctx); | 2475 | perf_rotate_context(cpuctx); |
@@ -4509,6 +4530,7 @@ static int __perf_event_overflow(struct perf_event *event, | |||
4509 | { | 4530 | { |
4510 | int events = atomic_read(&event->event_limit); | 4531 | int events = atomic_read(&event->event_limit); |
4511 | struct hw_perf_event *hwc = &event->hw; | 4532 | struct hw_perf_event *hwc = &event->hw; |
4533 | u64 seq; | ||
4512 | int ret = 0; | 4534 | int ret = 0; |
4513 | 4535 | ||
4514 | /* | 4536 | /* |
@@ -4518,14 +4540,20 @@ static int __perf_event_overflow(struct perf_event *event, | |||
4518 | if (unlikely(!is_sampling_event(event))) | 4540 | if (unlikely(!is_sampling_event(event))) |
4519 | return 0; | 4541 | return 0; |
4520 | 4542 | ||
4521 | if (unlikely(hwc->interrupts >= max_samples_per_tick)) { | 4543 | seq = __this_cpu_read(perf_throttled_seq); |
4522 | if (throttle) { | 4544 | if (seq != hwc->interrupts_seq) { |
4545 | hwc->interrupts_seq = seq; | ||
4546 | hwc->interrupts = 1; | ||
4547 | } else { | ||
4548 | hwc->interrupts++; | ||
4549 | if (unlikely(throttle | ||
4550 | && hwc->interrupts >= max_samples_per_tick)) { | ||
4551 | __this_cpu_inc(perf_throttled_count); | ||
4523 | hwc->interrupts = MAX_INTERRUPTS; | 4552 | hwc->interrupts = MAX_INTERRUPTS; |
4524 | perf_log_throttle(event, 0); | 4553 | perf_log_throttle(event, 0); |
4525 | ret = 1; | 4554 | ret = 1; |
4526 | } | 4555 | } |
4527 | } else | 4556 | } |
4528 | hwc->interrupts++; | ||
4529 | 4557 | ||
4530 | if (event->attr.freq) { | 4558 | if (event->attr.freq) { |
4531 | u64 now = perf_clock(); | 4559 | u64 now = perf_clock(); |
diff --git a/kernel/exit.c b/kernel/exit.c index 294b1709170d..4b4042f9bc6a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -1038,6 +1038,22 @@ void do_exit(long code) | |||
1038 | if (tsk->nr_dirtied) | 1038 | if (tsk->nr_dirtied) |
1039 | __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied); | 1039 | __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied); |
1040 | exit_rcu(); | 1040 | exit_rcu(); |
1041 | |||
1042 | /* | ||
1043 | * The setting of TASK_RUNNING by try_to_wake_up() may be delayed | ||
1044 | * when the following two conditions become true. | ||
1045 | * - There is race condition of mmap_sem (It is acquired by | ||
1046 | * exit_mm()), and | ||
1047 | * - SMI occurs before setting TASK_RUNINNG. | ||
1048 | * (or hypervisor of virtual machine switches to other guest) | ||
1049 | * As a result, we may become TASK_RUNNING after becoming TASK_DEAD | ||
1050 | * | ||
1051 | * To avoid it, we have to wait for releasing tsk->pi_lock which | ||
1052 | * is held by try_to_wake_up() | ||
1053 | */ | ||
1054 | smp_mb(); | ||
1055 | raw_spin_unlock_wait(&tsk->pi_lock); | ||
1056 | |||
1041 | /* causes final put_task_struct in finish_task_switch(). */ | 1057 | /* causes final put_task_struct in finish_task_switch(). */ |
1042 | tsk->state = TASK_DEAD; | 1058 | tsk->state = TASK_DEAD; |
1043 | tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */ | 1059 | tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */ |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index df00cb09263e..5255c9d2e053 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -74,6 +74,7 @@ | |||
74 | 74 | ||
75 | #include <asm/tlb.h> | 75 | #include <asm/tlb.h> |
76 | #include <asm/irq_regs.h> | 76 | #include <asm/irq_regs.h> |
77 | #include <asm/mutex.h> | ||
77 | #ifdef CONFIG_PARAVIRT | 78 | #ifdef CONFIG_PARAVIRT |
78 | #include <asm/paravirt.h> | 79 | #include <asm/paravirt.h> |
79 | #endif | 80 | #endif |
@@ -723,9 +724,6 @@ static void dequeue_task(struct rq *rq, struct task_struct *p, int flags) | |||
723 | p->sched_class->dequeue_task(rq, p, flags); | 724 | p->sched_class->dequeue_task(rq, p, flags); |
724 | } | 725 | } |
725 | 726 | ||
726 | /* | ||
727 | * activate_task - move a task to the runqueue. | ||
728 | */ | ||
729 | void activate_task(struct rq *rq, struct task_struct *p, int flags) | 727 | void activate_task(struct rq *rq, struct task_struct *p, int flags) |
730 | { | 728 | { |
731 | if (task_contributes_to_load(p)) | 729 | if (task_contributes_to_load(p)) |
@@ -734,9 +732,6 @@ void activate_task(struct rq *rq, struct task_struct *p, int flags) | |||
734 | enqueue_task(rq, p, flags); | 732 | enqueue_task(rq, p, flags); |
735 | } | 733 | } |
736 | 734 | ||
737 | /* | ||
738 | * deactivate_task - remove a task from the runqueue. | ||
739 | */ | ||
740 | void deactivate_task(struct rq *rq, struct task_struct *p, int flags) | 735 | void deactivate_task(struct rq *rq, struct task_struct *p, int flags) |
741 | { | 736 | { |
742 | if (task_contributes_to_load(p)) | 737 | if (task_contributes_to_load(p)) |
@@ -4134,7 +4129,7 @@ recheck: | |||
4134 | on_rq = p->on_rq; | 4129 | on_rq = p->on_rq; |
4135 | running = task_current(rq, p); | 4130 | running = task_current(rq, p); |
4136 | if (on_rq) | 4131 | if (on_rq) |
4137 | deactivate_task(rq, p, 0); | 4132 | dequeue_task(rq, p, 0); |
4138 | if (running) | 4133 | if (running) |
4139 | p->sched_class->put_prev_task(rq, p); | 4134 | p->sched_class->put_prev_task(rq, p); |
4140 | 4135 | ||
@@ -4147,7 +4142,7 @@ recheck: | |||
4147 | if (running) | 4142 | if (running) |
4148 | p->sched_class->set_curr_task(rq); | 4143 | p->sched_class->set_curr_task(rq); |
4149 | if (on_rq) | 4144 | if (on_rq) |
4150 | activate_task(rq, p, 0); | 4145 | enqueue_task(rq, p, 0); |
4151 | 4146 | ||
4152 | check_class_changed(rq, p, prev_class, oldprio); | 4147 | check_class_changed(rq, p, prev_class, oldprio); |
4153 | task_rq_unlock(rq, p, &flags); | 4148 | task_rq_unlock(rq, p, &flags); |
@@ -4998,9 +4993,9 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu) | |||
4998 | * placed properly. | 4993 | * placed properly. |
4999 | */ | 4994 | */ |
5000 | if (p->on_rq) { | 4995 | if (p->on_rq) { |
5001 | deactivate_task(rq_src, p, 0); | 4996 | dequeue_task(rq_src, p, 0); |
5002 | set_task_cpu(p, dest_cpu); | 4997 | set_task_cpu(p, dest_cpu); |
5003 | activate_task(rq_dest, p, 0); | 4998 | enqueue_task(rq_dest, p, 0); |
5004 | check_preempt_curr(rq_dest, p, 0); | 4999 | check_preempt_curr(rq_dest, p, 0); |
5005 | } | 5000 | } |
5006 | done: | 5001 | done: |
@@ -7032,10 +7027,10 @@ static void normalize_task(struct rq *rq, struct task_struct *p) | |||
7032 | 7027 | ||
7033 | on_rq = p->on_rq; | 7028 | on_rq = p->on_rq; |
7034 | if (on_rq) | 7029 | if (on_rq) |
7035 | deactivate_task(rq, p, 0); | 7030 | dequeue_task(rq, p, 0); |
7036 | __setscheduler(rq, p, SCHED_NORMAL, 0); | 7031 | __setscheduler(rq, p, SCHED_NORMAL, 0); |
7037 | if (on_rq) { | 7032 | if (on_rq) { |
7038 | activate_task(rq, p, 0); | 7033 | enqueue_task(rq, p, 0); |
7039 | resched_task(rq->curr); | 7034 | resched_task(rq->curr); |
7040 | } | 7035 | } |
7041 | 7036 | ||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 84adb2d66cbd..7c6414fc669d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -4866,6 +4866,15 @@ static void nohz_balancer_kick(int cpu) | |||
4866 | return; | 4866 | return; |
4867 | } | 4867 | } |
4868 | 4868 | ||
4869 | static inline void clear_nohz_tick_stopped(int cpu) | ||
4870 | { | ||
4871 | if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) { | ||
4872 | cpumask_clear_cpu(cpu, nohz.idle_cpus_mask); | ||
4873 | atomic_dec(&nohz.nr_cpus); | ||
4874 | clear_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)); | ||
4875 | } | ||
4876 | } | ||
4877 | |||
4869 | static inline void set_cpu_sd_state_busy(void) | 4878 | static inline void set_cpu_sd_state_busy(void) |
4870 | { | 4879 | { |
4871 | struct sched_domain *sd; | 4880 | struct sched_domain *sd; |
@@ -4904,6 +4913,12 @@ void select_nohz_load_balancer(int stop_tick) | |||
4904 | { | 4913 | { |
4905 | int cpu = smp_processor_id(); | 4914 | int cpu = smp_processor_id(); |
4906 | 4915 | ||
4916 | /* | ||
4917 | * If this cpu is going down, then nothing needs to be done. | ||
4918 | */ | ||
4919 | if (!cpu_active(cpu)) | ||
4920 | return; | ||
4921 | |||
4907 | if (stop_tick) { | 4922 | if (stop_tick) { |
4908 | if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu))) | 4923 | if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu))) |
4909 | return; | 4924 | return; |
@@ -4914,6 +4929,18 @@ void select_nohz_load_balancer(int stop_tick) | |||
4914 | } | 4929 | } |
4915 | return; | 4930 | return; |
4916 | } | 4931 | } |
4932 | |||
4933 | static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb, | ||
4934 | unsigned long action, void *hcpu) | ||
4935 | { | ||
4936 | switch (action & ~CPU_TASKS_FROZEN) { | ||
4937 | case CPU_DYING: | ||
4938 | clear_nohz_tick_stopped(smp_processor_id()); | ||
4939 | return NOTIFY_OK; | ||
4940 | default: | ||
4941 | return NOTIFY_DONE; | ||
4942 | } | ||
4943 | } | ||
4917 | #endif | 4944 | #endif |
4918 | 4945 | ||
4919 | static DEFINE_SPINLOCK(balancing); | 4946 | static DEFINE_SPINLOCK(balancing); |
@@ -5070,11 +5097,7 @@ static inline int nohz_kick_needed(struct rq *rq, int cpu) | |||
5070 | * busy tick after returning from idle, we will update the busy stats. | 5097 | * busy tick after returning from idle, we will update the busy stats. |
5071 | */ | 5098 | */ |
5072 | set_cpu_sd_state_busy(); | 5099 | set_cpu_sd_state_busy(); |
5073 | if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) { | 5100 | clear_nohz_tick_stopped(cpu); |
5074 | clear_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)); | ||
5075 | cpumask_clear_cpu(cpu, nohz.idle_cpus_mask); | ||
5076 | atomic_dec(&nohz.nr_cpus); | ||
5077 | } | ||
5078 | 5101 | ||
5079 | /* | 5102 | /* |
5080 | * None are in tickless mode and hence no need for NOHZ idle load | 5103 | * None are in tickless mode and hence no need for NOHZ idle load |
@@ -5590,6 +5613,7 @@ __init void init_sched_fair_class(void) | |||
5590 | 5613 | ||
5591 | #ifdef CONFIG_NO_HZ | 5614 | #ifdef CONFIG_NO_HZ |
5592 | zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT); | 5615 | zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT); |
5616 | cpu_notifier(sched_ilb_notifier, 0); | ||
5593 | #endif | 5617 | #endif |
5594 | #endif /* SMP */ | 5618 | #endif /* SMP */ |
5595 | 5619 | ||
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 3640ebbb466b..f42ae7fb5ec5 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
@@ -1587,6 +1587,11 @@ static int push_rt_task(struct rq *rq) | |||
1587 | if (!next_task) | 1587 | if (!next_task) |
1588 | return 0; | 1588 | return 0; |
1589 | 1589 | ||
1590 | #ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW | ||
1591 | if (unlikely(task_running(rq, next_task))) | ||
1592 | return 0; | ||
1593 | #endif | ||
1594 | |||
1590 | retry: | 1595 | retry: |
1591 | if (unlikely(next_task == rq->curr)) { | 1596 | if (unlikely(next_task == rq->curr)) { |
1592 | WARN_ON(1); | 1597 | WARN_ON(1); |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 1d7bca7f4f52..d117262deba3 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -296,7 +296,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) | |||
296 | if (__this_cpu_read(soft_watchdog_warn) == true) | 296 | if (__this_cpu_read(soft_watchdog_warn) == true) |
297 | return HRTIMER_RESTART; | 297 | return HRTIMER_RESTART; |
298 | 298 | ||
299 | printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", | 299 | printk(KERN_EMERG "BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", |
300 | smp_processor_id(), duration, | 300 | smp_processor_id(), duration, |
301 | current->comm, task_pid_nr(current)); | 301 | current->comm, task_pid_nr(current)); |
302 | print_modules(); | 302 | print_modules(); |
diff --git a/lib/Kconfig b/lib/Kconfig index 169eb7c598e5..d69d321a0997 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -279,6 +279,9 @@ config AVERAGE | |||
279 | 279 | ||
280 | If unsure, say N. | 280 | If unsure, say N. |
281 | 281 | ||
282 | config CLZ_TAB | ||
283 | bool | ||
284 | |||
282 | config CORDIC | 285 | config CORDIC |
283 | tristate "CORDIC algorithm" | 286 | tristate "CORDIC algorithm" |
284 | help | 287 | help |
@@ -287,6 +290,7 @@ config CORDIC | |||
287 | 290 | ||
288 | config MPILIB | 291 | config MPILIB |
289 | tristate | 292 | tristate |
293 | select CLZ_TAB | ||
290 | help | 294 | help |
291 | Multiprecision maths library from GnuPG. | 295 | Multiprecision maths library from GnuPG. |
292 | It is used to implement RSA digital signature verification, | 296 | It is used to implement RSA digital signature verification, |
diff --git a/lib/Makefile b/lib/Makefile index d71aae1b01b3..18515f0267c4 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -121,6 +121,8 @@ obj-$(CONFIG_DQL) += dynamic_queue_limits.o | |||
121 | obj-$(CONFIG_MPILIB) += mpi/ | 121 | obj-$(CONFIG_MPILIB) += mpi/ |
122 | obj-$(CONFIG_SIGNATURE) += digsig.o | 122 | obj-$(CONFIG_SIGNATURE) += digsig.o |
123 | 123 | ||
124 | obj-$(CONFIG_CLZ_TAB) += clz_tab.o | ||
125 | |||
124 | hostprogs-y := gen_crc32table | 126 | hostprogs-y := gen_crc32table |
125 | clean-files := crc32table.h | 127 | clean-files := crc32table.h |
126 | 128 | ||
@@ -169,7 +169,7 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
169 | return BUG_TRAP_TYPE_WARN; | 169 | return BUG_TRAP_TYPE_WARN; |
170 | } | 170 | } |
171 | 171 | ||
172 | printk(KERN_EMERG "------------[ cut here ]------------\n"); | 172 | printk(KERN_DEFAULT "------------[ cut here ]------------\n"); |
173 | 173 | ||
174 | if (file) | 174 | if (file) |
175 | printk(KERN_CRIT "kernel BUG at %s:%u!\n", | 175 | printk(KERN_CRIT "kernel BUG at %s:%u!\n", |
diff --git a/lib/clz_tab.c b/lib/clz_tab.c new file mode 100644 index 000000000000..7287b4a991a7 --- /dev/null +++ b/lib/clz_tab.c | |||
@@ -0,0 +1,18 @@ | |||
1 | const unsigned char __clz_tab[] = { | ||
2 | 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, | ||
3 | 5, 5, 5, 5, 5, 5, 5, 5, | ||
4 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
5 | 6, 6, 6, 6, 6, 6, 6, 6, | ||
6 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
7 | 7, 7, 7, 7, 7, 7, 7, 7, | ||
8 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
9 | 7, 7, 7, 7, 7, 7, 7, 7, | ||
10 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
11 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
12 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
13 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
14 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
15 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
16 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
17 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
18 | }; | ||
diff --git a/lib/digsig.c b/lib/digsig.c index fd2402f67f89..286d558033e2 100644 --- a/lib/digsig.c +++ b/lib/digsig.c | |||
@@ -34,14 +34,9 @@ static int pkcs_1_v1_5_decode_emsa(const unsigned char *msg, | |||
34 | unsigned long msglen, | 34 | unsigned long msglen, |
35 | unsigned long modulus_bitlen, | 35 | unsigned long modulus_bitlen, |
36 | unsigned char *out, | 36 | unsigned char *out, |
37 | unsigned long *outlen, | 37 | unsigned long *outlen) |
38 | int *is_valid) | ||
39 | { | 38 | { |
40 | unsigned long modulus_len, ps_len, i; | 39 | unsigned long modulus_len, ps_len, i; |
41 | int result; | ||
42 | |||
43 | /* default to invalid packet */ | ||
44 | *is_valid = 0; | ||
45 | 40 | ||
46 | modulus_len = (modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0); | 41 | modulus_len = (modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0); |
47 | 42 | ||
@@ -50,39 +45,30 @@ static int pkcs_1_v1_5_decode_emsa(const unsigned char *msg, | |||
50 | return -EINVAL; | 45 | return -EINVAL; |
51 | 46 | ||
52 | /* separate encoded message */ | 47 | /* separate encoded message */ |
53 | if ((msg[0] != 0x00) || (msg[1] != (unsigned char)1)) { | 48 | if ((msg[0] != 0x00) || (msg[1] != (unsigned char)1)) |
54 | result = -EINVAL; | 49 | return -EINVAL; |
55 | goto bail; | ||
56 | } | ||
57 | 50 | ||
58 | for (i = 2; i < modulus_len - 1; i++) | 51 | for (i = 2; i < modulus_len - 1; i++) |
59 | if (msg[i] != 0xFF) | 52 | if (msg[i] != 0xFF) |
60 | break; | 53 | break; |
61 | 54 | ||
62 | /* separator check */ | 55 | /* separator check */ |
63 | if (msg[i] != 0) { | 56 | if (msg[i] != 0) |
64 | /* There was no octet with hexadecimal value 0x00 | 57 | /* There was no octet with hexadecimal value 0x00 |
65 | to separate ps from m. */ | 58 | to separate ps from m. */ |
66 | result = -EINVAL; | 59 | return -EINVAL; |
67 | goto bail; | ||
68 | } | ||
69 | 60 | ||
70 | ps_len = i - 2; | 61 | ps_len = i - 2; |
71 | 62 | ||
72 | if (*outlen < (msglen - (2 + ps_len + 1))) { | 63 | if (*outlen < (msglen - (2 + ps_len + 1))) { |
73 | *outlen = msglen - (2 + ps_len + 1); | 64 | *outlen = msglen - (2 + ps_len + 1); |
74 | result = -EOVERFLOW; | 65 | return -EOVERFLOW; |
75 | goto bail; | ||
76 | } | 66 | } |
77 | 67 | ||
78 | *outlen = (msglen - (2 + ps_len + 1)); | 68 | *outlen = (msglen - (2 + ps_len + 1)); |
79 | memcpy(out, &msg[2 + ps_len + 1], *outlen); | 69 | memcpy(out, &msg[2 + ps_len + 1], *outlen); |
80 | 70 | ||
81 | /* valid packet */ | 71 | return 0; |
82 | *is_valid = 1; | ||
83 | result = 0; | ||
84 | bail: | ||
85 | return result; | ||
86 | } | 72 | } |
87 | 73 | ||
88 | /* | 74 | /* |
@@ -96,7 +82,7 @@ static int digsig_verify_rsa(struct key *key, | |||
96 | unsigned long len; | 82 | unsigned long len; |
97 | unsigned long mlen, mblen; | 83 | unsigned long mlen, mblen; |
98 | unsigned nret, l; | 84 | unsigned nret, l; |
99 | int valid, head, i; | 85 | int head, i; |
100 | unsigned char *out1 = NULL, *out2 = NULL; | 86 | unsigned char *out1 = NULL, *out2 = NULL; |
101 | MPI in = NULL, res = NULL, pkey[2]; | 87 | MPI in = NULL, res = NULL, pkey[2]; |
102 | uint8_t *p, *datap, *endp; | 88 | uint8_t *p, *datap, *endp; |
@@ -105,6 +91,10 @@ static int digsig_verify_rsa(struct key *key, | |||
105 | 91 | ||
106 | down_read(&key->sem); | 92 | down_read(&key->sem); |
107 | ukp = key->payload.data; | 93 | ukp = key->payload.data; |
94 | |||
95 | if (ukp->datalen < sizeof(*pkh)) | ||
96 | goto err1; | ||
97 | |||
108 | pkh = (struct pubkey_hdr *)ukp->data; | 98 | pkh = (struct pubkey_hdr *)ukp->data; |
109 | 99 | ||
110 | if (pkh->version != 1) | 100 | if (pkh->version != 1) |
@@ -117,18 +107,23 @@ static int digsig_verify_rsa(struct key *key, | |||
117 | goto err1; | 107 | goto err1; |
118 | 108 | ||
119 | datap = pkh->mpi; | 109 | datap = pkh->mpi; |
120 | endp = datap + ukp->datalen; | 110 | endp = ukp->data + ukp->datalen; |
111 | |||
112 | err = -ENOMEM; | ||
121 | 113 | ||
122 | for (i = 0; i < pkh->nmpi; i++) { | 114 | for (i = 0; i < pkh->nmpi; i++) { |
123 | unsigned int remaining = endp - datap; | 115 | unsigned int remaining = endp - datap; |
124 | pkey[i] = mpi_read_from_buffer(datap, &remaining); | 116 | pkey[i] = mpi_read_from_buffer(datap, &remaining); |
117 | if (!pkey[i]) | ||
118 | goto err; | ||
125 | datap += remaining; | 119 | datap += remaining; |
126 | } | 120 | } |
127 | 121 | ||
128 | mblen = mpi_get_nbits(pkey[0]); | 122 | mblen = mpi_get_nbits(pkey[0]); |
129 | mlen = (mblen + 7)/8; | 123 | mlen = (mblen + 7)/8; |
130 | 124 | ||
131 | err = -ENOMEM; | 125 | if (mlen == 0) |
126 | goto err; | ||
132 | 127 | ||
133 | out1 = kzalloc(mlen, GFP_KERNEL); | 128 | out1 = kzalloc(mlen, GFP_KERNEL); |
134 | if (!out1) | 129 | if (!out1) |
@@ -167,10 +162,9 @@ static int digsig_verify_rsa(struct key *key, | |||
167 | memset(out1, 0, head); | 162 | memset(out1, 0, head); |
168 | memcpy(out1 + head, p, l); | 163 | memcpy(out1 + head, p, l); |
169 | 164 | ||
170 | err = -EINVAL; | 165 | err = pkcs_1_v1_5_decode_emsa(out1, len, mblen, out2, &len); |
171 | pkcs_1_v1_5_decode_emsa(out1, len, mblen, out2, &len, &valid); | ||
172 | 166 | ||
173 | if (valid && len == hlen) | 167 | if (!err && len == hlen) |
174 | err = memcmp(out2, h, hlen); | 168 | err = memcmp(out2, h, hlen); |
175 | 169 | ||
176 | err: | 170 | err: |
@@ -178,8 +172,8 @@ err: | |||
178 | mpi_free(res); | 172 | mpi_free(res); |
179 | kfree(out1); | 173 | kfree(out1); |
180 | kfree(out2); | 174 | kfree(out2); |
181 | mpi_free(pkey[0]); | 175 | while (--i >= 0) |
182 | mpi_free(pkey[1]); | 176 | mpi_free(pkey[i]); |
183 | err1: | 177 | err1: |
184 | up_read(&key->sem); | 178 | up_read(&key->sem); |
185 | 179 | ||
diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h index b87487b40a8b..29f98624ef93 100644 --- a/lib/mpi/longlong.h +++ b/lib/mpi/longlong.h | |||
@@ -1200,18 +1200,40 @@ do { \ | |||
1200 | "r" ((USItype)(v)) \ | 1200 | "r" ((USItype)(v)) \ |
1201 | : "%g1", "%g2" __AND_CLOBBER_CC) | 1201 | : "%g1", "%g2" __AND_CLOBBER_CC) |
1202 | #define UMUL_TIME 39 /* 39 instructions */ | 1202 | #define UMUL_TIME 39 /* 39 instructions */ |
1203 | #endif | 1203 | /* It's quite necessary to add this much assembler for the sparc. |
1204 | #ifndef udiv_qrnnd | 1204 | The default udiv_qrnnd (in C) is more than 10 times slower! */ |
1205 | #ifndef LONGLONG_STANDALONE | ||
1206 | #define udiv_qrnnd(q, r, n1, n0, d) \ | 1205 | #define udiv_qrnnd(q, r, n1, n0, d) \ |
1207 | do { USItype __r; \ | 1206 | __asm__ ("! Inlined udiv_qrnnd\n\t" \ |
1208 | (q) = __udiv_qrnnd(&__r, (n1), (n0), (d)); \ | 1207 | "mov 32,%%g1\n\t" \ |
1209 | (r) = __r; \ | 1208 | "subcc %1,%2,%%g0\n\t" \ |
1210 | } while (0) | 1209 | "1: bcs 5f\n\t" \ |
1211 | extern USItype __udiv_qrnnd(); | 1210 | "addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n\t" \ |
1212 | #define UDIV_TIME 140 | 1211 | "sub %1,%2,%1 ! this kills msb of n\n\t" \ |
1213 | #endif /* LONGLONG_STANDALONE */ | 1212 | "addx %1,%1,%1 ! so this can't give carry\n\t" \ |
1214 | #endif /* udiv_qrnnd */ | 1213 | "subcc %%g1,1,%%g1\n\t" \ |
1214 | "2: bne 1b\n\t" \ | ||
1215 | "subcc %1,%2,%%g0\n\t" \ | ||
1216 | "bcs 3f\n\t" \ | ||
1217 | "addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n\t" \ | ||
1218 | "b 3f\n\t" \ | ||
1219 | "sub %1,%2,%1 ! this kills msb of n\n\t" \ | ||
1220 | "4: sub %1,%2,%1\n\t" \ | ||
1221 | "5: addxcc %1,%1,%1\n\t" \ | ||
1222 | "bcc 2b\n\t" \ | ||
1223 | "subcc %%g1,1,%%g1\n\t" \ | ||
1224 | "! Got carry from n. Subtract next step to cancel this carry.\n\t" \ | ||
1225 | "bne 4b\n\t" \ | ||
1226 | "addcc %0,%0,%0 ! shift n1n0 and a 0-bit in lsb\n\t" \ | ||
1227 | "sub %1,%2,%1\n\t" \ | ||
1228 | "3: xnor %0,0,%0\n\t" \ | ||
1229 | "! End of inline udiv_qrnnd\n" \ | ||
1230 | : "=&r" ((USItype)(q)), \ | ||
1231 | "=&r" ((USItype)(r)) \ | ||
1232 | : "r" ((USItype)(d)), \ | ||
1233 | "1" ((USItype)(n1)), \ | ||
1234 | "0" ((USItype)(n0)) : "%g1", "cc") | ||
1235 | #define UDIV_TIME (3+7*32) /* 7 instructions/iteration. 32 iterations. */ | ||
1236 | #endif | ||
1215 | #endif /* __sparc__ */ | 1237 | #endif /* __sparc__ */ |
1216 | 1238 | ||
1217 | /*************************************** | 1239 | /*************************************** |
diff --git a/lib/mpi/mpi-bit.c b/lib/mpi/mpi-bit.c index 854c9c6da025..2f526627e4f5 100644 --- a/lib/mpi/mpi-bit.c +++ b/lib/mpi/mpi-bit.c | |||
@@ -21,25 +21,6 @@ | |||
21 | #include "mpi-internal.h" | 21 | #include "mpi-internal.h" |
22 | #include "longlong.h" | 22 | #include "longlong.h" |
23 | 23 | ||
24 | const unsigned char __clz_tab[] = { | ||
25 | 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, | ||
26 | 5, 5, 5, 5, 5, 5, 5, 5, | ||
27 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
28 | 6, 6, 6, 6, 6, 6, 6, 6, | ||
29 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
30 | 7, 7, 7, 7, 7, 7, 7, 7, | ||
31 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
32 | 7, 7, 7, 7, 7, 7, 7, 7, | ||
33 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
34 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
35 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
36 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
37 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
38 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
39 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
40 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
41 | }; | ||
42 | |||
43 | #define A_LIMB_1 ((mpi_limb_t) 1) | 24 | #define A_LIMB_1 ((mpi_limb_t) 1) |
44 | 25 | ||
45 | /**************** | 26 | /**************** |
diff --git a/lib/mpi/mpi-div.c b/lib/mpi/mpi-div.c index c3087d1390ce..f68cbbb4d4a4 100644 --- a/lib/mpi/mpi-div.c +++ b/lib/mpi/mpi-div.c | |||
@@ -149,6 +149,9 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) | |||
149 | mpi_ptr_t marker[5]; | 149 | mpi_ptr_t marker[5]; |
150 | int markidx = 0; | 150 | int markidx = 0; |
151 | 151 | ||
152 | if (!dsize) | ||
153 | return -EINVAL; | ||
154 | |||
152 | memset(marker, 0, sizeof(marker)); | 155 | memset(marker, 0, sizeof(marker)); |
153 | 156 | ||
154 | /* Ensure space is enough for quotient and remainder. | 157 | /* Ensure space is enough for quotient and remainder. |
@@ -207,6 +210,8 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) | |||
207 | * numerator would be gradually overwritten by the quotient limbs. */ | 210 | * numerator would be gradually overwritten by the quotient limbs. */ |
208 | if (qp == np) { /* Copy NP object to temporary space. */ | 211 | if (qp == np) { /* Copy NP object to temporary space. */ |
209 | np = marker[markidx++] = mpi_alloc_limb_space(nsize); | 212 | np = marker[markidx++] = mpi_alloc_limb_space(nsize); |
213 | if (!np) | ||
214 | goto nomem; | ||
210 | MPN_COPY(np, qp, nsize); | 215 | MPN_COPY(np, qp, nsize); |
211 | } | 216 | } |
212 | } else /* Put quotient at top of remainder. */ | 217 | } else /* Put quotient at top of remainder. */ |
diff --git a/lib/mpi/mpi-pow.c b/lib/mpi/mpi-pow.c index b04a3cf80080..67f3e79af914 100644 --- a/lib/mpi/mpi-pow.c +++ b/lib/mpi/mpi-pow.c | |||
@@ -59,7 +59,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) | |||
59 | ep = exp->d; | 59 | ep = exp->d; |
60 | 60 | ||
61 | if (!msize) | 61 | if (!msize) |
62 | msize = 1 / msize; /* provoke a signal */ | 62 | return -EINVAL; |
63 | 63 | ||
64 | if (!esize) { | 64 | if (!esize) { |
65 | /* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0 | 65 | /* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0 |
diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c index 716802b774ea..f26b41fcb48c 100644 --- a/lib/mpi/mpicoder.c +++ b/lib/mpi/mpicoder.c | |||
@@ -20,78 +20,15 @@ | |||
20 | 20 | ||
21 | #include "mpi-internal.h" | 21 | #include "mpi-internal.h" |
22 | 22 | ||
23 | #define DIM(v) (sizeof(v)/sizeof((v)[0])) | ||
24 | #define MAX_EXTERN_MPI_BITS 16384 | 23 | #define MAX_EXTERN_MPI_BITS 16384 |
25 | 24 | ||
26 | static uint8_t asn[15] = /* Object ID is 1.3.14.3.2.26 */ | ||
27 | { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, | ||
28 | 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14 | ||
29 | }; | ||
30 | |||
31 | MPI do_encode_md(const void *sha_buffer, unsigned nbits) | ||
32 | { | ||
33 | int nframe = (nbits + 7) / 8; | ||
34 | uint8_t *frame, *fr_pt; | ||
35 | int i = 0, n; | ||
36 | size_t asnlen = DIM(asn); | ||
37 | MPI a = MPI_NULL; | ||
38 | |||
39 | if (SHA1_DIGEST_LENGTH + asnlen + 4 > nframe) | ||
40 | pr_info("MPI: can't encode a %d bit MD into a %d bits frame\n", | ||
41 | (int)(SHA1_DIGEST_LENGTH * 8), (int)nbits); | ||
42 | |||
43 | /* We encode the MD in this way: | ||
44 | * | ||
45 | * 0 A PAD(n bytes) 0 ASN(asnlen bytes) MD(len bytes) | ||
46 | * | ||
47 | * PAD consists of FF bytes. | ||
48 | */ | ||
49 | frame = kmalloc(nframe, GFP_KERNEL); | ||
50 | if (!frame) | ||
51 | return MPI_NULL; | ||
52 | n = 0; | ||
53 | frame[n++] = 0; | ||
54 | frame[n++] = 1; /* block type */ | ||
55 | i = nframe - SHA1_DIGEST_LENGTH - asnlen - 3; | ||
56 | |||
57 | if (i <= 1) { | ||
58 | pr_info("MPI: message digest encoding failed\n"); | ||
59 | kfree(frame); | ||
60 | return a; | ||
61 | } | ||
62 | |||
63 | memset(frame + n, 0xff, i); | ||
64 | n += i; | ||
65 | frame[n++] = 0; | ||
66 | memcpy(frame + n, &asn, asnlen); | ||
67 | n += asnlen; | ||
68 | memcpy(frame + n, sha_buffer, SHA1_DIGEST_LENGTH); | ||
69 | n += SHA1_DIGEST_LENGTH; | ||
70 | |||
71 | i = nframe; | ||
72 | fr_pt = frame; | ||
73 | |||
74 | if (n != nframe) { | ||
75 | printk | ||
76 | ("MPI: message digest encoding failed, frame length is wrong\n"); | ||
77 | kfree(frame); | ||
78 | return a; | ||
79 | } | ||
80 | |||
81 | a = mpi_alloc((nframe + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB); | ||
82 | mpi_set_buffer(a, frame, nframe, 0); | ||
83 | kfree(frame); | ||
84 | |||
85 | return a; | ||
86 | } | ||
87 | |||
88 | MPI mpi_read_from_buffer(const void *xbuffer, unsigned *ret_nread) | 25 | MPI mpi_read_from_buffer(const void *xbuffer, unsigned *ret_nread) |
89 | { | 26 | { |
90 | const uint8_t *buffer = xbuffer; | 27 | const uint8_t *buffer = xbuffer; |
91 | int i, j; | 28 | int i, j; |
92 | unsigned nbits, nbytes, nlimbs, nread = 0; | 29 | unsigned nbits, nbytes, nlimbs, nread = 0; |
93 | mpi_limb_t a; | 30 | mpi_limb_t a; |
94 | MPI val = MPI_NULL; | 31 | MPI val = NULL; |
95 | 32 | ||
96 | if (*ret_nread < 2) | 33 | if (*ret_nread < 2) |
97 | goto leave; | 34 | goto leave; |
@@ -108,7 +45,7 @@ MPI mpi_read_from_buffer(const void *xbuffer, unsigned *ret_nread) | |||
108 | nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB; | 45 | nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB; |
109 | val = mpi_alloc(nlimbs); | 46 | val = mpi_alloc(nlimbs); |
110 | if (!val) | 47 | if (!val) |
111 | return MPI_NULL; | 48 | return NULL; |
112 | i = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB; | 49 | i = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB; |
113 | i %= BYTES_PER_MPI_LIMB; | 50 | i %= BYTES_PER_MPI_LIMB; |
114 | val->nbits = nbits; | 51 | val->nbits = nbits; |
@@ -212,30 +149,6 @@ int mpi_fromstr(MPI val, const char *str) | |||
212 | EXPORT_SYMBOL_GPL(mpi_fromstr); | 149 | EXPORT_SYMBOL_GPL(mpi_fromstr); |
213 | 150 | ||
214 | /**************** | 151 | /**************** |
215 | * Special function to get the low 8 bytes from an mpi. | ||
216 | * This can be used as a keyid; KEYID is an 2 element array. | ||
217 | * Return the low 4 bytes. | ||
218 | */ | ||
219 | u32 mpi_get_keyid(const MPI a, u32 *keyid) | ||
220 | { | ||
221 | #if BYTES_PER_MPI_LIMB == 4 | ||
222 | if (keyid) { | ||
223 | keyid[0] = a->nlimbs >= 2 ? a->d[1] : 0; | ||
224 | keyid[1] = a->nlimbs >= 1 ? a->d[0] : 0; | ||
225 | } | ||
226 | return a->nlimbs >= 1 ? a->d[0] : 0; | ||
227 | #elif BYTES_PER_MPI_LIMB == 8 | ||
228 | if (keyid) { | ||
229 | keyid[0] = a->nlimbs ? (u32) (a->d[0] >> 32) : 0; | ||
230 | keyid[1] = a->nlimbs ? (u32) (a->d[0] & 0xffffffff) : 0; | ||
231 | } | ||
232 | return a->nlimbs ? (u32) (a->d[0] & 0xffffffff) : 0; | ||
233 | #else | ||
234 | #error Make this function work with other LIMB sizes | ||
235 | #endif | ||
236 | } | ||
237 | |||
238 | /**************** | ||
239 | * Return an allocated buffer with the MPI (msb first). | 152 | * Return an allocated buffer with the MPI (msb first). |
240 | * NBYTES receives the length of this buffer. Caller must free the | 153 | * NBYTES receives the length of this buffer. Caller must free the |
241 | * return string (This function does return a 0 byte buffer with NBYTES | 154 | * return string (This function does return a 0 byte buffer with NBYTES |
diff --git a/lib/mpi/mpih-div.c b/lib/mpi/mpih-div.c index 87ede162dfab..cde1aaec18da 100644 --- a/lib/mpi/mpih-div.c +++ b/lib/mpi/mpih-div.c | |||
@@ -217,6 +217,10 @@ mpihelp_divrem(mpi_ptr_t qp, mpi_size_t qextra_limbs, | |||
217 | case 0: | 217 | case 0: |
218 | /* We are asked to divide by zero, so go ahead and do it! (To make | 218 | /* We are asked to divide by zero, so go ahead and do it! (To make |
219 | the compiler not remove this statement, return the value.) */ | 219 | the compiler not remove this statement, return the value.) */ |
220 | /* | ||
221 | * existing clients of this function have been modified | ||
222 | * not to call it with dsize == 0, so this should not happen | ||
223 | */ | ||
220 | return 1 / dsize; | 224 | return 1 / dsize; |
221 | 225 | ||
222 | case 1: | 226 | case 1: |
diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c index eefc55d6b7f5..26e4ed31e256 100644 --- a/lib/mpi/mpiutil.c +++ b/lib/mpi/mpiutil.c | |||
@@ -58,6 +58,9 @@ mpi_ptr_t mpi_alloc_limb_space(unsigned nlimbs) | |||
58 | { | 58 | { |
59 | size_t len = nlimbs * sizeof(mpi_limb_t); | 59 | size_t len = nlimbs * sizeof(mpi_limb_t); |
60 | 60 | ||
61 | if (!len) | ||
62 | return NULL; | ||
63 | |||
61 | return kmalloc(len, GFP_KERNEL); | 64 | return kmalloc(len, GFP_KERNEL); |
62 | } | 65 | } |
63 | 66 | ||
@@ -135,7 +138,7 @@ int mpi_copy(MPI *copied, const MPI a) | |||
135 | size_t i; | 138 | size_t i; |
136 | MPI b; | 139 | MPI b; |
137 | 140 | ||
138 | *copied = MPI_NULL; | 141 | *copied = NULL; |
139 | 142 | ||
140 | if (a) { | 143 | if (a) { |
141 | b = mpi_alloc(a->nlimbs); | 144 | b = mpi_alloc(a->nlimbs); |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index ac86d67b636e..7c12650165ae 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -104,7 +104,7 @@ endif | |||
104 | 104 | ||
105 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) | 105 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) |
106 | EXTLIBS = -lpthread -lrt -lelf -lm | 106 | EXTLIBS = -lpthread -lrt -lelf -lm |
107 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 | 107 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
108 | ALL_LDFLAGS = $(LDFLAGS) | 108 | ALL_LDFLAGS = $(LDFLAGS) |
109 | STRIP ?= strip | 109 | STRIP ?= strip |
110 | 110 | ||
@@ -168,10 +168,7 @@ endif | |||
168 | 168 | ||
169 | ### --- END CONFIGURATION SECTION --- | 169 | ### --- END CONFIGURATION SECTION --- |
170 | 170 | ||
171 | # Those must not be GNU-specific; they are shared with perl/ which may | 171 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
172 | # be built by a different compiler. (Note that this is an artifact now | ||
173 | # but it still might be nice to keep that distinction.) | ||
174 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include | ||
175 | BASIC_LDFLAGS = | 172 | BASIC_LDFLAGS = |
176 | 173 | ||
177 | # Guard against environment variables | 174 | # Guard against environment variables |
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 59d43abfbfec..fb8566181f27 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | #define _GNU_SOURCE | ||
24 | #include <sys/utsname.h> | 23 | #include <sys/utsname.h> |
25 | #include <sys/types.h> | 24 | #include <sys/types.h> |
26 | #include <sys/stat.h> | 25 | #include <sys/stat.h> |
@@ -31,7 +30,6 @@ | |||
31 | #include <stdlib.h> | 30 | #include <stdlib.h> |
32 | #include <string.h> | 31 | #include <string.h> |
33 | 32 | ||
34 | #undef _GNU_SOURCE | ||
35 | #include "perf.h" | 33 | #include "perf.h" |
36 | #include "builtin.h" | 34 | #include "builtin.h" |
37 | #include "util/util.h" | 35 | #include "util/util.h" |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 8f80df896038..dd162aa24baa 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -89,8 +89,6 @@ void get_term_dimensions(struct winsize *ws) | |||
89 | 89 | ||
90 | static void perf_top__update_print_entries(struct perf_top *top) | 90 | static void perf_top__update_print_entries(struct perf_top *top) |
91 | { | 91 | { |
92 | top->print_entries = top->winsize.ws_row; | ||
93 | |||
94 | if (top->print_entries > 9) | 92 | if (top->print_entries > 9) |
95 | top->print_entries -= 9; | 93 | top->print_entries -= 9; |
96 | } | 94 | } |
@@ -100,6 +98,13 @@ static void perf_top__sig_winch(int sig __used, siginfo_t *info __used, void *ar | |||
100 | struct perf_top *top = arg; | 98 | struct perf_top *top = arg; |
101 | 99 | ||
102 | get_term_dimensions(&top->winsize); | 100 | get_term_dimensions(&top->winsize); |
101 | if (!top->print_entries | ||
102 | || (top->print_entries+4) > top->winsize.ws_row) { | ||
103 | top->print_entries = top->winsize.ws_row; | ||
104 | } else { | ||
105 | top->print_entries += 4; | ||
106 | top->winsize.ws_row = top->print_entries; | ||
107 | } | ||
103 | perf_top__update_print_entries(top); | 108 | perf_top__update_print_entries(top); |
104 | } | 109 | } |
105 | 110 | ||
@@ -453,8 +458,10 @@ static void perf_top__handle_keypress(struct perf_top *top, int c) | |||
453 | }; | 458 | }; |
454 | perf_top__sig_winch(SIGWINCH, NULL, top); | 459 | perf_top__sig_winch(SIGWINCH, NULL, top); |
455 | sigaction(SIGWINCH, &act, NULL); | 460 | sigaction(SIGWINCH, &act, NULL); |
456 | } else | 461 | } else { |
462 | perf_top__sig_winch(SIGWINCH, NULL, top); | ||
457 | signal(SIGWINCH, SIG_DFL); | 463 | signal(SIGWINCH, SIG_DFL); |
464 | } | ||
458 | break; | 465 | break; |
459 | case 'E': | 466 | case 'E': |
460 | if (top->evlist->nr_entries > 1) { | 467 | if (top->evlist->nr_entries > 1) { |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 3e7e0b09c12c..ecd7f4dd7eea 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -2105,7 +2105,7 @@ int perf_event__synthesize_event_type(struct perf_tool *tool, | |||
2105 | strncpy(ev.event_type.event_type.name, name, MAX_EVENT_NAME - 1); | 2105 | strncpy(ev.event_type.event_type.name, name, MAX_EVENT_NAME - 1); |
2106 | 2106 | ||
2107 | ev.event_type.header.type = PERF_RECORD_HEADER_EVENT_TYPE; | 2107 | ev.event_type.header.type = PERF_RECORD_HEADER_EVENT_TYPE; |
2108 | size = strlen(name); | 2108 | size = strlen(ev.event_type.event_type.name); |
2109 | size = ALIGN(size, sizeof(u64)); | 2109 | size = ALIGN(size, sizeof(u64)); |
2110 | ev.event_type.header.size = sizeof(ev.event_type) - | 2110 | ev.event_type.header.size = sizeof(ev.event_type) - |
2111 | (sizeof(ev.event_type.event_type.name) - size); | 2111 | (sizeof(ev.event_type.event_type.name) - size); |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index eb25900e2211..29cb65459811 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -19,7 +19,6 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define _GNU_SOURCE | ||
23 | #include <sys/utsname.h> | 22 | #include <sys/utsname.h> |
24 | #include <sys/types.h> | 23 | #include <sys/types.h> |
25 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
@@ -33,7 +32,6 @@ | |||
33 | #include <limits.h> | 32 | #include <limits.h> |
34 | #include <elf.h> | 33 | #include <elf.h> |
35 | 34 | ||
36 | #undef _GNU_SOURCE | ||
37 | #include "util.h" | 35 | #include "util.h" |
38 | #include "event.h" | 36 | #include "event.h" |
39 | #include "string.h" | 37 | #include "string.h" |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 215d50f2042e..0975438c3e72 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1,4 +1,3 @@ | |||
1 | #define _GNU_SOURCE | ||
2 | #include <ctype.h> | 1 | #include <ctype.h> |
3 | #include <dirent.h> | 2 | #include <dirent.h> |
4 | #include <errno.h> | 3 | #include <errno.h> |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 6c164dc9ee95..1a8d4dc4f386 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -21,14 +21,13 @@ | |||
21 | * The parts for function graph printing was taken and modified from the | 21 | * The parts for function graph printing was taken and modified from the |
22 | * Linux Kernel that were written by Frederic Weisbecker. | 22 | * Linux Kernel that were written by Frederic Weisbecker. |
23 | */ | 23 | */ |
24 | #define _GNU_SOURCE | 24 | |
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include <string.h> | 27 | #include <string.h> |
28 | #include <ctype.h> | 28 | #include <ctype.h> |
29 | #include <errno.h> | 29 | #include <errno.h> |
30 | 30 | ||
31 | #undef _GNU_SOURCE | ||
32 | #include "../perf.h" | 31 | #include "../perf.h" |
33 | #include "util.h" | 32 | #include "util.h" |
34 | #include "trace-event.h" | 33 | #include "trace-event.h" |
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index 1212a386a033..e81aef1f2569 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -1,6 +1,4 @@ | |||
1 | #define _GNU_SOURCE | ||
2 | #include <stdio.h> | 1 | #include <stdio.h> |
3 | #undef _GNU_SOURCE | ||
4 | #include "../libslang.h" | 2 | #include "../libslang.h" |
5 | #include <stdlib.h> | 3 | #include <stdlib.h> |
6 | #include <string.h> | 4 | #include <string.h> |
diff --git a/tools/perf/util/ui/helpline.c b/tools/perf/util/ui/helpline.c index 6ef3c5691762..4f48f5901b30 100644 --- a/tools/perf/util/ui/helpline.c +++ b/tools/perf/util/ui/helpline.c | |||
@@ -1,4 +1,3 @@ | |||
1 | #define _GNU_SOURCE | ||
2 | #include <stdio.h> | 1 | #include <stdio.h> |
3 | #include <stdlib.h> | 2 | #include <stdlib.h> |
4 | #include <string.h> | 3 | #include <string.h> |
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index b9c530cce79a..ecf9898169c8 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
@@ -40,7 +40,6 @@ | |||
40 | #define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1) | 40 | #define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1) |
41 | 41 | ||
42 | #define _ALL_SOURCE 1 | 42 | #define _ALL_SOURCE 1 |
43 | #define _GNU_SOURCE 1 | ||
44 | #define _BSD_SOURCE 1 | 43 | #define _BSD_SOURCE 1 |
45 | #define HAS_BOOL | 44 | #define HAS_BOOL |
46 | 45 | ||