diff options
Diffstat (limited to 'arch')
49 files changed, 419 insertions, 354 deletions
diff --git a/arch/Kconfig b/arch/Kconfig index d82875820a15..9d055b4f0585 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -135,9 +135,7 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES | |||
135 | 135 | ||
136 | config HAVE_HW_BREAKPOINT | 136 | config HAVE_HW_BREAKPOINT |
137 | bool | 137 | bool |
138 | depends on HAVE_PERF_EVENTS | 138 | depends on PERF_EVENTS |
139 | select ANON_INODES | ||
140 | select PERF_EVENTS | ||
141 | 139 | ||
142 | config HAVE_USER_RETURN_NOTIFIER | 140 | config HAVE_USER_RETURN_NOTIFIER |
143 | bool | 141 | bool |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 443448154f32..bd7261ea8f94 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -9,6 +9,7 @@ config ALPHA | |||
9 | select HAVE_IDE | 9 | select HAVE_IDE |
10 | select HAVE_OPROFILE | 10 | select HAVE_OPROFILE |
11 | select HAVE_SYSCALL_WRAPPERS | 11 | select HAVE_SYSCALL_WRAPPERS |
12 | select HAVE_PERF_EVENTS | ||
12 | help | 13 | help |
13 | The Alpha is a 64-bit general-purpose processor designed and | 14 | The Alpha is a 64-bit general-purpose processor designed and |
14 | marketed by the Digital Equipment Corporation of blessed memory, | 15 | marketed by the Digital Equipment Corporation of blessed memory, |
diff --git a/arch/alpha/include/asm/bug.h b/arch/alpha/include/asm/bug.h index 1720c8ad86fe..f091682e3cc8 100644 --- a/arch/alpha/include/asm/bug.h +++ b/arch/alpha/include/asm/bug.h | |||
@@ -13,7 +13,8 @@ | |||
13 | "call_pal %0 # bugchk\n\t" \ | 13 | "call_pal %0 # bugchk\n\t" \ |
14 | ".long %1\n\t.8byte %2" \ | 14 | ".long %1\n\t.8byte %2" \ |
15 | : : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__)); \ | 15 | : : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__)); \ |
16 | for ( ; ; ); } while (0) | 16 | unreachable(); \ |
17 | } while (0) | ||
17 | 18 | ||
18 | #define HAVE_ARCH_BUG | 19 | #define HAVE_ARCH_BUG |
19 | #endif | 20 | #endif |
diff --git a/arch/alpha/include/asm/perf_event.h b/arch/alpha/include/asm/perf_event.h new file mode 100644 index 000000000000..3bef8522017c --- /dev/null +++ b/arch/alpha/include/asm/perf_event.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef __ASM_ALPHA_PERF_EVENT_H | ||
2 | #define __ASM_ALPHA_PERF_EVENT_H | ||
3 | |||
4 | /* Alpha only supports software events through this interface. */ | ||
5 | static inline void set_perf_event_pending(void) { } | ||
6 | |||
7 | #define PERF_EVENT_INDEX_OFFSET 0 | ||
8 | |||
9 | #endif /* __ASM_ALPHA_PERF_EVENT_H */ | ||
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h index 7f23665122df..804e5311c841 100644 --- a/arch/alpha/include/asm/unistd.h +++ b/arch/alpha/include/asm/unistd.h | |||
@@ -247,6 +247,7 @@ | |||
247 | #define __IGNORE_pause | 247 | #define __IGNORE_pause |
248 | #define __IGNORE_time | 248 | #define __IGNORE_time |
249 | #define __IGNORE_utime | 249 | #define __IGNORE_utime |
250 | #define __IGNORE_umount2 | ||
250 | 251 | ||
251 | /* | 252 | /* |
252 | * Linux-specific system calls begin at 300 | 253 | * Linux-specific system calls begin at 300 |
@@ -434,10 +435,24 @@ | |||
434 | #define __NR_timerfd 477 | 435 | #define __NR_timerfd 477 |
435 | #define __NR_eventfd 478 | 436 | #define __NR_eventfd 478 |
436 | #define __NR_recvmmsg 479 | 437 | #define __NR_recvmmsg 479 |
438 | #define __NR_fallocate 480 | ||
439 | #define __NR_timerfd_create 481 | ||
440 | #define __NR_timerfd_settime 482 | ||
441 | #define __NR_timerfd_gettime 483 | ||
442 | #define __NR_signalfd4 484 | ||
443 | #define __NR_eventfd2 485 | ||
444 | #define __NR_epoll_create1 486 | ||
445 | #define __NR_dup3 487 | ||
446 | #define __NR_pipe2 488 | ||
447 | #define __NR_inotify_init1 489 | ||
448 | #define __NR_preadv 490 | ||
449 | #define __NR_pwritev 491 | ||
450 | #define __NR_rt_tgsigqueueinfo 492 | ||
451 | #define __NR_perf_event_open 493 | ||
437 | 452 | ||
438 | #ifdef __KERNEL__ | 453 | #ifdef __KERNEL__ |
439 | 454 | ||
440 | #define NR_SYSCALLS 480 | 455 | #define NR_SYSCALLS 494 |
441 | 456 | ||
442 | #define __ARCH_WANT_IPC_PARSE_VERSION | 457 | #define __ARCH_WANT_IPC_PARSE_VERSION |
443 | #define __ARCH_WANT_OLD_READDIR | 458 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index cda6b8b3d573..09acb786e72b 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S | |||
@@ -495,9 +495,23 @@ sys_call_table: | |||
495 | .quad sys_epoll_pwait | 495 | .quad sys_epoll_pwait |
496 | .quad sys_utimensat /* 475 */ | 496 | .quad sys_utimensat /* 475 */ |
497 | .quad sys_signalfd | 497 | .quad sys_signalfd |
498 | .quad sys_ni_syscall | 498 | .quad sys_ni_syscall /* sys_timerfd */ |
499 | .quad sys_eventfd | 499 | .quad sys_eventfd |
500 | .quad sys_recvmmsg | 500 | .quad sys_recvmmsg |
501 | .quad sys_fallocate /* 480 */ | ||
502 | .quad sys_timerfd_create | ||
503 | .quad sys_timerfd_settime | ||
504 | .quad sys_timerfd_gettime | ||
505 | .quad sys_signalfd4 | ||
506 | .quad sys_eventfd2 /* 485 */ | ||
507 | .quad sys_epoll_create1 | ||
508 | .quad sys_dup3 | ||
509 | .quad sys_pipe2 | ||
510 | .quad sys_inotify_init1 | ||
511 | .quad sys_preadv /* 490 */ | ||
512 | .quad sys_pwritev | ||
513 | .quad sys_rt_tgsigqueueinfo | ||
514 | .quad sys_perf_event_open | ||
501 | 515 | ||
502 | .size sys_call_table, . - sys_call_table | 516 | .size sys_call_table, . - sys_call_table |
503 | .type sys_call_table, @object | 517 | .type sys_call_table, @object |
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index 6118890c946d..6be4503201ac 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c | |||
@@ -174,7 +174,7 @@ static int fallback_init_cip(struct crypto_tfm *tfm) | |||
174 | if (IS_ERR(sctx->fallback.cip)) { | 174 | if (IS_ERR(sctx->fallback.cip)) { |
175 | pr_err("Allocating AES fallback algorithm %s failed\n", | 175 | pr_err("Allocating AES fallback algorithm %s failed\n", |
176 | name); | 176 | name); |
177 | return PTR_ERR(sctx->fallback.blk); | 177 | return PTR_ERR(sctx->fallback.cip); |
178 | } | 178 | } |
179 | 179 | ||
180 | return 0; | 180 | return 0; |
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c index 77df726180ba..2b92d501425f 100644 --- a/arch/s390/hypfs/hypfs_diag.c +++ b/arch/s390/hypfs/hypfs_diag.c | |||
@@ -164,7 +164,7 @@ static inline void part_hdr__part_name(enum diag204_format type, void *hdr, | |||
164 | LPAR_NAME_LEN); | 164 | LPAR_NAME_LEN); |
165 | EBCASC(name, LPAR_NAME_LEN); | 165 | EBCASC(name, LPAR_NAME_LEN); |
166 | name[LPAR_NAME_LEN] = 0; | 166 | name[LPAR_NAME_LEN] = 0; |
167 | strstrip(name); | 167 | strim(name); |
168 | } | 168 | } |
169 | 169 | ||
170 | struct cpu_info { | 170 | struct cpu_info { |
@@ -523,7 +523,7 @@ static int diag224_idx2name(int index, char *name) | |||
523 | memcpy(name, diag224_cpu_names + ((index + 1) * CPU_NAME_LEN), | 523 | memcpy(name, diag224_cpu_names + ((index + 1) * CPU_NAME_LEN), |
524 | CPU_NAME_LEN); | 524 | CPU_NAME_LEN); |
525 | name[CPU_NAME_LEN] = 0; | 525 | name[CPU_NAME_LEN] = 0; |
526 | strstrip(name); | 526 | strim(name); |
527 | return 0; | 527 | return 0; |
528 | } | 528 | } |
529 | 529 | ||
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c index d01fc8f799f0..f0b0d31f0b48 100644 --- a/arch/s390/hypfs/hypfs_vm.c +++ b/arch/s390/hypfs/hypfs_vm.c | |||
@@ -124,7 +124,7 @@ static int hpyfs_vm_create_guest(struct super_block *sb, | |||
124 | /* guest dir */ | 124 | /* guest dir */ |
125 | memcpy(guest_name, data->guest_name, NAME_LEN); | 125 | memcpy(guest_name, data->guest_name, NAME_LEN); |
126 | EBCASC(guest_name, NAME_LEN); | 126 | EBCASC(guest_name, NAME_LEN); |
127 | strstrip(guest_name); | 127 | strim(guest_name); |
128 | guest_dir = hypfs_mkdir(sb, systems_dir, guest_name); | 128 | guest_dir = hypfs_mkdir(sb, systems_dir, guest_name); |
129 | if (IS_ERR(guest_dir)) | 129 | if (IS_ERR(guest_dir)) |
130 | return PTR_ERR(guest_dir); | 130 | return PTR_ERR(guest_dir); |
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h index cb5232df151e..192a7203a14f 100644 --- a/arch/s390/include/asm/unistd.h +++ b/arch/s390/include/asm/unistd.h | |||
@@ -269,7 +269,8 @@ | |||
269 | #define __NR_pwritev 329 | 269 | #define __NR_pwritev 329 |
270 | #define __NR_rt_tgsigqueueinfo 330 | 270 | #define __NR_rt_tgsigqueueinfo 330 |
271 | #define __NR_perf_event_open 331 | 271 | #define __NR_perf_event_open 331 |
272 | #define NR_syscalls 332 | 272 | #define __NR_recvmmsg 332 |
273 | #define NR_syscalls 333 | ||
273 | 274 | ||
274 | /* | 275 | /* |
275 | * There are some system calls that are not present on 64 bit, some | 276 | * There are some system calls that are not present on 64 bit, some |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 30de2d0e52bb..faeaccc7d7d9 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1853,3 +1853,12 @@ sys32_execve_wrapper: | |||
1853 | llgtr %r3,%r3 # compat_uptr_t * | 1853 | llgtr %r3,%r3 # compat_uptr_t * |
1854 | llgtr %r4,%r4 # compat_uptr_t * | 1854 | llgtr %r4,%r4 # compat_uptr_t * |
1855 | jg sys32_execve # branch to system call | 1855 | jg sys32_execve # branch to system call |
1856 | |||
1857 | .globl compat_sys_recvmmsg_wrapper | ||
1858 | compat_sys_recvmmsg_wrapper: | ||
1859 | lgfr %r2,%r2 # int | ||
1860 | llgtr %r3,%r3 # struct compat_mmsghdr * | ||
1861 | llgfr %r4,%r4 # unsigned int | ||
1862 | llgfr %r5,%r5 # unsigned int | ||
1863 | llgtr %r6,%r6 # struct compat_timespec * | ||
1864 | jg compat_sys_recvmmsg | ||
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 4890ac6d7faa..4d73296fed74 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -221,7 +221,7 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \ | |||
221 | const char *buf, size_t len) \ | 221 | const char *buf, size_t len) \ |
222 | { \ | 222 | { \ |
223 | strncpy(_value, buf, sizeof(_value) - 1); \ | 223 | strncpy(_value, buf, sizeof(_value) - 1); \ |
224 | strstrip(_value); \ | 224 | strim(_value); \ |
225 | return len; \ | 225 | return len; \ |
226 | } \ | 226 | } \ |
227 | static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ | 227 | static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ |
@@ -472,7 +472,7 @@ static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, | |||
472 | return sprintf(page, "#unknown#\n"); | 472 | return sprintf(page, "#unknown#\n"); |
473 | memcpy(loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN); | 473 | memcpy(loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN); |
474 | EBCASC(loadparm, LOADPARM_LEN); | 474 | EBCASC(loadparm, LOADPARM_LEN); |
475 | strstrip(loadparm); | 475 | strim(loadparm); |
476 | return sprintf(page, "%s\n", loadparm); | 476 | return sprintf(page, "%s\n", loadparm); |
477 | } | 477 | } |
478 | 478 | ||
@@ -776,7 +776,7 @@ static void reipl_get_ascii_loadparm(char *loadparm, | |||
776 | memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN); | 776 | memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN); |
777 | EBCASC(loadparm, LOADPARM_LEN); | 777 | EBCASC(loadparm, LOADPARM_LEN); |
778 | loadparm[LOADPARM_LEN] = 0; | 778 | loadparm[LOADPARM_LEN] = 0; |
779 | strstrip(loadparm); | 779 | strim(loadparm); |
780 | } | 780 | } |
781 | 781 | ||
782 | static ssize_t reipl_generic_loadparm_show(struct ipl_parameter_block *ipb, | 782 | static ssize_t reipl_generic_loadparm_show(struct ipl_parameter_block *ipb, |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 653c6a178740..13815d39f7dd 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -959,7 +959,7 @@ static const struct user_regset s390_compat_regsets[] = { | |||
959 | .set = s390_fpregs_set, | 959 | .set = s390_fpregs_set, |
960 | }, | 960 | }, |
961 | [REGSET_GENERAL_EXTENDED] = { | 961 | [REGSET_GENERAL_EXTENDED] = { |
962 | .core_note_type = NT_PRXSTATUS, | 962 | .core_note_type = NT_S390_HIGH_GPRS, |
963 | .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t), | 963 | .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t), |
964 | .size = sizeof(compat_long_t), | 964 | .size = sizeof(compat_long_t), |
965 | .align = sizeof(compat_long_t), | 965 | .align = sizeof(compat_long_t), |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 30eca070d426..4f292c936872 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -340,3 +340,4 @@ SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper) | |||
340 | SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) | 340 | SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) |
341 | SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ | 341 | SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ |
342 | SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) | 342 | SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) |
343 | SYSCALL(sys_recvmmsg,sys_recvmmsg,compat_sys_recvmmsg_wrapper) | ||
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index c2e42cc65ce7..6e7ad63854c0 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/string.h> | 19 | #include <linux/string.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/ptrace.h> | 21 | #include <linux/tracehook.h> |
22 | #include <linux/timer.h> | 22 | #include <linux/timer.h> |
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/smp.h> | 24 | #include <linux/smp.h> |
@@ -382,7 +382,7 @@ void __kprobes do_single_step(struct pt_regs *regs) | |||
382 | SIGTRAP) == NOTIFY_STOP){ | 382 | SIGTRAP) == NOTIFY_STOP){ |
383 | return; | 383 | return; |
384 | } | 384 | } |
385 | if ((current->ptrace & PT_PTRACED) != 0) | 385 | if (tracehook_consider_fatal_signal(current, SIGTRAP)) |
386 | force_sig(SIGTRAP, current); | 386 | force_sig(SIGTRAP, current); |
387 | } | 387 | } |
388 | 388 | ||
@@ -483,7 +483,7 @@ static void illegal_op(struct pt_regs * regs, long interruption_code) | |||
483 | if (get_user(*((__u16 *) opcode), (__u16 __user *) location)) | 483 | if (get_user(*((__u16 *) opcode), (__u16 __user *) location)) |
484 | return; | 484 | return; |
485 | if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { | 485 | if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { |
486 | if (current->ptrace & PT_PTRACED) | 486 | if (tracehook_consider_fatal_signal(current, SIGTRAP)) |
487 | force_sig(SIGTRAP, current); | 487 | force_sig(SIGTRAP, current); |
488 | else | 488 | else |
489 | signal = SIGILL; | 489 | signal = SIGILL; |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 3b2a5aca4edb..55298e891571 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -50,6 +50,8 @@ config X86 | |||
50 | select HAVE_KERNEL_BZIP2 | 50 | select HAVE_KERNEL_BZIP2 |
51 | select HAVE_KERNEL_LZMA | 51 | select HAVE_KERNEL_LZMA |
52 | select HAVE_HW_BREAKPOINT | 52 | select HAVE_HW_BREAKPOINT |
53 | select PERF_EVENTS | ||
54 | select ANON_INODES | ||
53 | select HAVE_ARCH_KMEMCHECK | 55 | select HAVE_ARCH_KMEMCHECK |
54 | select HAVE_USER_RETURN_NOTIFIER | 56 | select HAVE_USER_RETURN_NOTIFIER |
55 | 57 | ||
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 613700f27a4a..637e1ec963c3 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -153,6 +153,7 @@ | |||
153 | #define X86_FEATURE_SSE5 (6*32+11) /* SSE-5 */ | 153 | #define X86_FEATURE_SSE5 (6*32+11) /* SSE-5 */ |
154 | #define X86_FEATURE_SKINIT (6*32+12) /* SKINIT/STGI instructions */ | 154 | #define X86_FEATURE_SKINIT (6*32+12) /* SKINIT/STGI instructions */ |
155 | #define X86_FEATURE_WDT (6*32+13) /* Watchdog timer */ | 155 | #define X86_FEATURE_WDT (6*32+13) /* Watchdog timer */ |
156 | #define X86_FEATURE_NODEID_MSR (6*32+19) /* NodeId MSR */ | ||
156 | 157 | ||
157 | /* | 158 | /* |
158 | * Auxiliary flags: Linux defined - For features scattered in various | 159 | * Auxiliary flags: Linux defined - For features scattered in various |
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index 08c48a81841f..eeac829a0f44 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h | |||
@@ -103,7 +103,8 @@ extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *); | |||
103 | extern void send_cleanup_vector(struct irq_cfg *); | 103 | extern void send_cleanup_vector(struct irq_cfg *); |
104 | 104 | ||
105 | struct irq_desc; | 105 | struct irq_desc; |
106 | extern unsigned int set_desc_affinity(struct irq_desc *, const struct cpumask *); | 106 | extern unsigned int set_desc_affinity(struct irq_desc *, const struct cpumask *, |
107 | unsigned int *dest_id); | ||
107 | extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin, struct io_apic_irq_attr *irq_attr); | 108 | extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin, struct io_apic_irq_attr *irq_attr); |
108 | extern void setup_ioapic_dest(void); | 109 | extern void setup_ioapic_dest(void); |
109 | 110 | ||
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 4ffe09b2ad75..1cd58cdbc03f 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define MSR_FS_BASE 0xc0000100 /* 64bit FS base */ | 12 | #define MSR_FS_BASE 0xc0000100 /* 64bit FS base */ |
13 | #define MSR_GS_BASE 0xc0000101 /* 64bit GS base */ | 13 | #define MSR_GS_BASE 0xc0000101 /* 64bit GS base */ |
14 | #define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow */ | 14 | #define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow */ |
15 | #define MSR_TSC_AUX 0xc0000103 /* Auxiliary TSC */ | ||
15 | 16 | ||
16 | /* EFER bits: */ | 17 | /* EFER bits: */ |
17 | #define _EFER_SCE 0 /* SYSCALL/SYSRET */ | 18 | #define _EFER_SCE 0 /* SYSCALL/SYSRET */ |
@@ -123,6 +124,7 @@ | |||
123 | #define FAM10H_MMIO_CONF_BUSRANGE_SHIFT 2 | 124 | #define FAM10H_MMIO_CONF_BUSRANGE_SHIFT 2 |
124 | #define FAM10H_MMIO_CONF_BASE_MASK 0xfffffff | 125 | #define FAM10H_MMIO_CONF_BASE_MASK 0xfffffff |
125 | #define FAM10H_MMIO_CONF_BASE_SHIFT 20 | 126 | #define FAM10H_MMIO_CONF_BASE_SHIFT 20 |
127 | #define MSR_FAM10H_NODE_ID 0xc001100c | ||
126 | 128 | ||
127 | /* K8 MSRs */ | 129 | /* K8 MSRs */ |
128 | #define MSR_K8_TOP_MEM1 0xc001001a | 130 | #define MSR_K8_TOP_MEM1 0xc001001a |
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 2d228fc9b4b7..c5bc4c2d33f5 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h | |||
@@ -27,6 +27,18 @@ struct msr { | |||
27 | }; | 27 | }; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | struct msr_info { | ||
31 | u32 msr_no; | ||
32 | struct msr reg; | ||
33 | struct msr *msrs; | ||
34 | int err; | ||
35 | }; | ||
36 | |||
37 | struct msr_regs_info { | ||
38 | u32 *regs; | ||
39 | int err; | ||
40 | }; | ||
41 | |||
30 | static inline unsigned long long native_read_tscp(unsigned int *aux) | 42 | static inline unsigned long long native_read_tscp(unsigned int *aux) |
31 | { | 43 | { |
32 | unsigned long low, high; | 44 | unsigned long low, high; |
@@ -240,9 +252,9 @@ do { \ | |||
240 | #define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val), \ | 252 | #define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val), \ |
241 | (u32)((val) >> 32)) | 253 | (u32)((val) >> 32)) |
242 | 254 | ||
243 | #define write_tsc(val1, val2) wrmsr(0x10, (val1), (val2)) | 255 | #define write_tsc(val1, val2) wrmsr(MSR_IA32_TSC, (val1), (val2)) |
244 | 256 | ||
245 | #define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0) | 257 | #define write_rdtscp_aux(val) wrmsr(MSR_TSC_AUX, (val), 0) |
246 | 258 | ||
247 | struct msr *msrs_alloc(void); | 259 | struct msr *msrs_alloc(void); |
248 | void msrs_free(struct msr *msrs); | 260 | void msrs_free(struct msr *msrs); |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 6f8ec1c37e0a..fc801bab1b3b 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -181,7 +181,7 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, | |||
181 | unsigned int *ecx, unsigned int *edx) | 181 | unsigned int *ecx, unsigned int *edx) |
182 | { | 182 | { |
183 | /* ecx is often an input as well as an output. */ | 183 | /* ecx is often an input as well as an output. */ |
184 | asm("cpuid" | 184 | asm volatile("cpuid" |
185 | : "=a" (*eax), | 185 | : "=a" (*eax), |
186 | "=b" (*ebx), | 186 | "=b" (*ebx), |
187 | "=c" (*ecx), | 187 | "=c" (*ecx), |
diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h index cf86a5e73815..35e89122a42f 100644 --- a/arch/x86/include/asm/stacktrace.h +++ b/arch/x86/include/asm/stacktrace.h | |||
@@ -5,6 +5,29 @@ extern int kstack_depth_to_print; | |||
5 | 5 | ||
6 | int x86_is_stack_id(int id, char *name); | 6 | int x86_is_stack_id(int id, char *name); |
7 | 7 | ||
8 | struct thread_info; | ||
9 | struct stacktrace_ops; | ||
10 | |||
11 | typedef unsigned long (*walk_stack_t)(struct thread_info *tinfo, | ||
12 | unsigned long *stack, | ||
13 | unsigned long bp, | ||
14 | const struct stacktrace_ops *ops, | ||
15 | void *data, | ||
16 | unsigned long *end, | ||
17 | int *graph); | ||
18 | |||
19 | extern unsigned long | ||
20 | print_context_stack(struct thread_info *tinfo, | ||
21 | unsigned long *stack, unsigned long bp, | ||
22 | const struct stacktrace_ops *ops, void *data, | ||
23 | unsigned long *end, int *graph); | ||
24 | |||
25 | extern unsigned long | ||
26 | print_context_stack_bp(struct thread_info *tinfo, | ||
27 | unsigned long *stack, unsigned long bp, | ||
28 | const struct stacktrace_ops *ops, void *data, | ||
29 | unsigned long *end, int *graph); | ||
30 | |||
8 | /* Generic stack tracer with callbacks */ | 31 | /* Generic stack tracer with callbacks */ |
9 | 32 | ||
10 | struct stacktrace_ops { | 33 | struct stacktrace_ops { |
@@ -14,6 +37,7 @@ struct stacktrace_ops { | |||
14 | void (*address)(void *data, unsigned long address, int reliable); | 37 | void (*address)(void *data, unsigned long address, int reliable); |
15 | /* On negative return stop dumping */ | 38 | /* On negative return stop dumping */ |
16 | int (*stack)(void *data, char *name); | 39 | int (*stack)(void *data, char *name); |
40 | walk_stack_t walk_stack; | ||
17 | }; | 41 | }; |
18 | 42 | ||
19 | void dump_trace(struct task_struct *tsk, struct pt_regs *regs, | 43 | void dump_trace(struct task_struct *tsk, struct pt_regs *regs, |
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c index d0c99abc26c3..eacbd2b31d27 100644 --- a/arch/x86/kernel/apic/apic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c | |||
@@ -306,10 +306,7 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
306 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 306 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
307 | break; | 307 | break; |
308 | } | 308 | } |
309 | if (cpu < nr_cpu_ids) | 309 | return per_cpu(x86_cpu_to_apicid, cpu); |
310 | return per_cpu(x86_cpu_to_apicid, cpu); | ||
311 | |||
312 | return BAD_APICID; | ||
313 | } | 310 | } |
314 | 311 | ||
315 | struct apic apic_physflat = { | 312 | struct apic apic_physflat = { |
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c index 38dcecfa5818..cb804c5091b9 100644 --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c | |||
@@ -131,10 +131,7 @@ static unsigned int bigsmp_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
131 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 131 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
132 | break; | 132 | break; |
133 | } | 133 | } |
134 | if (cpu < nr_cpu_ids) | 134 | return bigsmp_cpu_to_logical_apicid(cpu); |
135 | return bigsmp_cpu_to_logical_apicid(cpu); | ||
136 | |||
137 | return BAD_APICID; | ||
138 | } | 135 | } |
139 | 136 | ||
140 | static int bigsmp_phys_pkg_id(int cpuid_apic, int index_msb) | 137 | static int bigsmp_phys_pkg_id(int cpuid_apic, int index_msb) |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 11a5851f1f50..de00c4619a55 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -2276,26 +2276,28 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, struct irq | |||
2276 | 2276 | ||
2277 | /* | 2277 | /* |
2278 | * Either sets desc->affinity to a valid value, and returns | 2278 | * Either sets desc->affinity to a valid value, and returns |
2279 | * ->cpu_mask_to_apicid of that, or returns BAD_APICID and | 2279 | * ->cpu_mask_to_apicid of that in dest_id, or returns -1 and |
2280 | * leaves desc->affinity untouched. | 2280 | * leaves desc->affinity untouched. |
2281 | */ | 2281 | */ |
2282 | unsigned int | 2282 | unsigned int |
2283 | set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask) | 2283 | set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask, |
2284 | unsigned int *dest_id) | ||
2284 | { | 2285 | { |
2285 | struct irq_cfg *cfg; | 2286 | struct irq_cfg *cfg; |
2286 | unsigned int irq; | 2287 | unsigned int irq; |
2287 | 2288 | ||
2288 | if (!cpumask_intersects(mask, cpu_online_mask)) | 2289 | if (!cpumask_intersects(mask, cpu_online_mask)) |
2289 | return BAD_APICID; | 2290 | return -1; |
2290 | 2291 | ||
2291 | irq = desc->irq; | 2292 | irq = desc->irq; |
2292 | cfg = desc->chip_data; | 2293 | cfg = desc->chip_data; |
2293 | if (assign_irq_vector(irq, cfg, mask)) | 2294 | if (assign_irq_vector(irq, cfg, mask)) |
2294 | return BAD_APICID; | 2295 | return -1; |
2295 | 2296 | ||
2296 | cpumask_copy(desc->affinity, mask); | 2297 | cpumask_copy(desc->affinity, mask); |
2297 | 2298 | ||
2298 | return apic->cpu_mask_to_apicid_and(desc->affinity, cfg->domain); | 2299 | *dest_id = apic->cpu_mask_to_apicid_and(desc->affinity, cfg->domain); |
2300 | return 0; | ||
2299 | } | 2301 | } |
2300 | 2302 | ||
2301 | static int | 2303 | static int |
@@ -2311,12 +2313,11 @@ set_ioapic_affinity_irq_desc(struct irq_desc *desc, const struct cpumask *mask) | |||
2311 | cfg = desc->chip_data; | 2313 | cfg = desc->chip_data; |
2312 | 2314 | ||
2313 | spin_lock_irqsave(&ioapic_lock, flags); | 2315 | spin_lock_irqsave(&ioapic_lock, flags); |
2314 | dest = set_desc_affinity(desc, mask); | 2316 | ret = set_desc_affinity(desc, mask, &dest); |
2315 | if (dest != BAD_APICID) { | 2317 | if (!ret) { |
2316 | /* Only the high 8 bits are valid. */ | 2318 | /* Only the high 8 bits are valid. */ |
2317 | dest = SET_APIC_LOGICAL_ID(dest); | 2319 | dest = SET_APIC_LOGICAL_ID(dest); |
2318 | __target_IO_APIC_irq(irq, dest, cfg); | 2320 | __target_IO_APIC_irq(irq, dest, cfg); |
2319 | ret = 0; | ||
2320 | } | 2321 | } |
2321 | spin_unlock_irqrestore(&ioapic_lock, flags); | 2322 | spin_unlock_irqrestore(&ioapic_lock, flags); |
2322 | 2323 | ||
@@ -3351,8 +3352,7 @@ static int set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask) | |||
3351 | struct msi_msg msg; | 3352 | struct msi_msg msg; |
3352 | unsigned int dest; | 3353 | unsigned int dest; |
3353 | 3354 | ||
3354 | dest = set_desc_affinity(desc, mask); | 3355 | if (set_desc_affinity(desc, mask, &dest)) |
3355 | if (dest == BAD_APICID) | ||
3356 | return -1; | 3356 | return -1; |
3357 | 3357 | ||
3358 | cfg = desc->chip_data; | 3358 | cfg = desc->chip_data; |
@@ -3384,8 +3384,7 @@ ir_set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask) | |||
3384 | if (get_irte(irq, &irte)) | 3384 | if (get_irte(irq, &irte)) |
3385 | return -1; | 3385 | return -1; |
3386 | 3386 | ||
3387 | dest = set_desc_affinity(desc, mask); | 3387 | if (set_desc_affinity(desc, mask, &dest)) |
3388 | if (dest == BAD_APICID) | ||
3389 | return -1; | 3388 | return -1; |
3390 | 3389 | ||
3391 | irte.vector = cfg->vector; | 3390 | irte.vector = cfg->vector; |
@@ -3567,8 +3566,7 @@ static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) | |||
3567 | struct msi_msg msg; | 3566 | struct msi_msg msg; |
3568 | unsigned int dest; | 3567 | unsigned int dest; |
3569 | 3568 | ||
3570 | dest = set_desc_affinity(desc, mask); | 3569 | if (set_desc_affinity(desc, mask, &dest)) |
3571 | if (dest == BAD_APICID) | ||
3572 | return -1; | 3570 | return -1; |
3573 | 3571 | ||
3574 | cfg = desc->chip_data; | 3572 | cfg = desc->chip_data; |
@@ -3623,8 +3621,7 @@ static int hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask) | |||
3623 | struct msi_msg msg; | 3621 | struct msi_msg msg; |
3624 | unsigned int dest; | 3622 | unsigned int dest; |
3625 | 3623 | ||
3626 | dest = set_desc_affinity(desc, mask); | 3624 | if (set_desc_affinity(desc, mask, &dest)) |
3627 | if (dest == BAD_APICID) | ||
3628 | return -1; | 3625 | return -1; |
3629 | 3626 | ||
3630 | cfg = desc->chip_data; | 3627 | cfg = desc->chip_data; |
@@ -3730,8 +3727,7 @@ static int set_ht_irq_affinity(unsigned int irq, const struct cpumask *mask) | |||
3730 | struct irq_cfg *cfg; | 3727 | struct irq_cfg *cfg; |
3731 | unsigned int dest; | 3728 | unsigned int dest; |
3732 | 3729 | ||
3733 | dest = set_desc_affinity(desc, mask); | 3730 | if (set_desc_affinity(desc, mask, &dest)) |
3734 | if (dest == BAD_APICID) | ||
3735 | return -1; | 3731 | return -1; |
3736 | 3732 | ||
3737 | cfg = desc->chip_data; | 3733 | cfg = desc->chip_data; |
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index a5371ec36776..cf69c59f4910 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c | |||
@@ -148,10 +148,7 @@ x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
148 | break; | 148 | break; |
149 | } | 149 | } |
150 | 150 | ||
151 | if (cpu < nr_cpu_ids) | 151 | return per_cpu(x86_cpu_to_logical_apicid, cpu); |
152 | return per_cpu(x86_cpu_to_logical_apicid, cpu); | ||
153 | |||
154 | return BAD_APICID; | ||
155 | } | 152 | } |
156 | 153 | ||
157 | static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x) | 154 | static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x) |
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index a8989aadc99a..8972f38c5ced 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c | |||
@@ -146,10 +146,7 @@ x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
146 | break; | 146 | break; |
147 | } | 147 | } |
148 | 148 | ||
149 | if (cpu < nr_cpu_ids) | 149 | return per_cpu(x86_cpu_to_apicid, cpu); |
150 | return per_cpu(x86_cpu_to_apicid, cpu); | ||
151 | |||
152 | return BAD_APICID; | ||
153 | } | 150 | } |
154 | 151 | ||
155 | static unsigned int x2apic_phys_get_apic_id(unsigned long x) | 152 | static unsigned int x2apic_phys_get_apic_id(unsigned long x) |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index b684bb303cbf..d56b0efb2057 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -225,10 +225,7 @@ uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
225 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 225 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
226 | break; | 226 | break; |
227 | } | 227 | } |
228 | if (cpu < nr_cpu_ids) | 228 | return per_cpu(x86_cpu_to_apicid, cpu); |
229 | return per_cpu(x86_cpu_to_apicid, cpu); | ||
230 | |||
231 | return BAD_APICID; | ||
232 | } | 229 | } |
233 | 230 | ||
234 | static unsigned int x2apic_get_apic_id(unsigned long x) | 231 | static unsigned int x2apic_get_apic_id(unsigned long x) |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 8dc3ea145c97..e485825130d2 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -254,59 +254,36 @@ static int __cpuinit nearby_node(int apicid) | |||
254 | 254 | ||
255 | /* | 255 | /* |
256 | * Fixup core topology information for AMD multi-node processors. | 256 | * Fixup core topology information for AMD multi-node processors. |
257 | * Assumption 1: Number of cores in each internal node is the same. | 257 | * Assumption: Number of cores in each internal node is the same. |
258 | * Assumption 2: Mixed systems with both single-node and dual-node | ||
259 | * processors are not supported. | ||
260 | */ | 258 | */ |
261 | #ifdef CONFIG_X86_HT | 259 | #ifdef CONFIG_X86_HT |
262 | static void __cpuinit amd_fixup_dcm(struct cpuinfo_x86 *c) | 260 | static void __cpuinit amd_fixup_dcm(struct cpuinfo_x86 *c) |
263 | { | 261 | { |
264 | #ifdef CONFIG_PCI | 262 | unsigned long long value; |
265 | u32 t, cpn; | 263 | u32 nodes, cores_per_node; |
266 | u8 n, n_id; | ||
267 | int cpu = smp_processor_id(); | 264 | int cpu = smp_processor_id(); |
268 | 265 | ||
266 | if (!cpu_has(c, X86_FEATURE_NODEID_MSR)) | ||
267 | return; | ||
268 | |||
269 | /* fixup topology information only once for a core */ | 269 | /* fixup topology information only once for a core */ |
270 | if (cpu_has(c, X86_FEATURE_AMD_DCM)) | 270 | if (cpu_has(c, X86_FEATURE_AMD_DCM)) |
271 | return; | 271 | return; |
272 | 272 | ||
273 | /* check for multi-node processor on boot cpu */ | 273 | rdmsrl(MSR_FAM10H_NODE_ID, value); |
274 | t = read_pci_config(0, 24, 3, 0xe8); | 274 | |
275 | if (!(t & (1 << 29))) | 275 | nodes = ((value >> 3) & 7) + 1; |
276 | if (nodes == 1) | ||
276 | return; | 277 | return; |
277 | 278 | ||
278 | set_cpu_cap(c, X86_FEATURE_AMD_DCM); | 279 | set_cpu_cap(c, X86_FEATURE_AMD_DCM); |
280 | cores_per_node = c->x86_max_cores / nodes; | ||
279 | 281 | ||
280 | /* cores per node: each internal node has half the number of cores */ | 282 | /* store NodeID, use llc_shared_map to store sibling info */ |
281 | cpn = c->x86_max_cores >> 1; | 283 | per_cpu(cpu_llc_id, cpu) = value & 7; |
282 | 284 | ||
283 | /* even-numbered NB_id of this dual-node processor */ | 285 | /* fixup core id to be in range from 0 to (cores_per_node - 1) */ |
284 | n = c->phys_proc_id << 1; | 286 | c->cpu_core_id = c->cpu_core_id % cores_per_node; |
285 | |||
286 | /* | ||
287 | * determine internal node id and assign cores fifty-fifty to | ||
288 | * each node of the dual-node processor | ||
289 | */ | ||
290 | t = read_pci_config(0, 24 + n, 3, 0xe8); | ||
291 | n = (t>>30) & 0x3; | ||
292 | if (n == 0) { | ||
293 | if (c->cpu_core_id < cpn) | ||
294 | n_id = 0; | ||
295 | else | ||
296 | n_id = 1; | ||
297 | } else { | ||
298 | if (c->cpu_core_id < cpn) | ||
299 | n_id = 1; | ||
300 | else | ||
301 | n_id = 0; | ||
302 | } | ||
303 | |||
304 | /* compute entire NodeID, use llc_shared_map to store sibling info */ | ||
305 | per_cpu(cpu_llc_id, cpu) = (c->phys_proc_id << 1) + n_id; | ||
306 | |||
307 | /* fixup core id to be in range from 0 to cpn */ | ||
308 | c->cpu_core_id = c->cpu_core_id % cpn; | ||
309 | #endif | ||
310 | } | 287 | } |
311 | #endif | 288 | #endif |
312 | 289 | ||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 9c31e8b09d2c..879666f4d871 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -70,7 +70,6 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) | |||
70 | if (c->x86_power & (1 << 8)) { | 70 | if (c->x86_power & (1 << 8)) { |
71 | set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); | 71 | set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); |
72 | set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); | 72 | set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); |
73 | set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE); | ||
74 | sched_clock_stable = 1; | 73 | sched_clock_stable = 1; |
75 | } | 74 | } |
76 | 75 | ||
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 45506d5dd8df..c223b7e895d9 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -2336,6 +2336,7 @@ static const struct stacktrace_ops backtrace_ops = { | |||
2336 | .warning_symbol = backtrace_warning_symbol, | 2336 | .warning_symbol = backtrace_warning_symbol, |
2337 | .stack = backtrace_stack, | 2337 | .stack = backtrace_stack, |
2338 | .address = backtrace_address, | 2338 | .address = backtrace_address, |
2339 | .walk_stack = print_context_stack_bp, | ||
2339 | }; | 2340 | }; |
2340 | 2341 | ||
2341 | #include "../dumpstack.h" | 2342 | #include "../dumpstack.h" |
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 7ef24a796992..cb27fd6136c9 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
@@ -187,7 +187,8 @@ static int __init cpuid_init(void) | |||
187 | int i, err = 0; | 187 | int i, err = 0; |
188 | i = 0; | 188 | i = 0; |
189 | 189 | ||
190 | if (register_chrdev(CPUID_MAJOR, "cpu/cpuid", &cpuid_fops)) { | 190 | if (__register_chrdev(CPUID_MAJOR, 0, NR_CPUS, |
191 | "cpu/cpuid", &cpuid_fops)) { | ||
191 | printk(KERN_ERR "cpuid: unable to get major %d for cpuid\n", | 192 | printk(KERN_ERR "cpuid: unable to get major %d for cpuid\n", |
192 | CPUID_MAJOR); | 193 | CPUID_MAJOR); |
193 | err = -EBUSY; | 194 | err = -EBUSY; |
@@ -216,7 +217,7 @@ out_class: | |||
216 | } | 217 | } |
217 | class_destroy(cpuid_class); | 218 | class_destroy(cpuid_class); |
218 | out_chrdev: | 219 | out_chrdev: |
219 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); | 220 | __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid"); |
220 | out: | 221 | out: |
221 | return err; | 222 | return err; |
222 | } | 223 | } |
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 0a0aa1cec8f1..c56bc2873030 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c | |||
@@ -109,6 +109,30 @@ print_context_stack(struct thread_info *tinfo, | |||
109 | } | 109 | } |
110 | return bp; | 110 | return bp; |
111 | } | 111 | } |
112 | EXPORT_SYMBOL_GPL(print_context_stack); | ||
113 | |||
114 | unsigned long | ||
115 | print_context_stack_bp(struct thread_info *tinfo, | ||
116 | unsigned long *stack, unsigned long bp, | ||
117 | const struct stacktrace_ops *ops, void *data, | ||
118 | unsigned long *end, int *graph) | ||
119 | { | ||
120 | struct stack_frame *frame = (struct stack_frame *)bp; | ||
121 | unsigned long *ret_addr = &frame->return_address; | ||
122 | |||
123 | while (valid_stack_ptr(tinfo, ret_addr, sizeof(*ret_addr), end)) { | ||
124 | unsigned long addr = *ret_addr; | ||
125 | |||
126 | if (__kernel_text_address(addr)) { | ||
127 | ops->address(data, addr, 1); | ||
128 | frame = frame->next_frame; | ||
129 | ret_addr = &frame->return_address; | ||
130 | print_ftrace_graph_addr(addr, data, ops, tinfo, graph); | ||
131 | } | ||
132 | } | ||
133 | return (unsigned long)frame; | ||
134 | } | ||
135 | EXPORT_SYMBOL_GPL(print_context_stack_bp); | ||
112 | 136 | ||
113 | 137 | ||
114 | static void | 138 | static void |
@@ -141,10 +165,11 @@ static void print_trace_address(void *data, unsigned long addr, int reliable) | |||
141 | } | 165 | } |
142 | 166 | ||
143 | static const struct stacktrace_ops print_trace_ops = { | 167 | static const struct stacktrace_ops print_trace_ops = { |
144 | .warning = print_trace_warning, | 168 | .warning = print_trace_warning, |
145 | .warning_symbol = print_trace_warning_symbol, | 169 | .warning_symbol = print_trace_warning_symbol, |
146 | .stack = print_trace_stack, | 170 | .stack = print_trace_stack, |
147 | .address = print_trace_address, | 171 | .address = print_trace_address, |
172 | .walk_stack = print_context_stack, | ||
148 | }; | 173 | }; |
149 | 174 | ||
150 | void | 175 | void |
diff --git a/arch/x86/kernel/dumpstack.h b/arch/x86/kernel/dumpstack.h index 81086c227ab7..4fd1420faffa 100644 --- a/arch/x86/kernel/dumpstack.h +++ b/arch/x86/kernel/dumpstack.h | |||
@@ -14,12 +14,6 @@ | |||
14 | #define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :) | 14 | #define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :) |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | extern unsigned long | ||
18 | print_context_stack(struct thread_info *tinfo, | ||
19 | unsigned long *stack, unsigned long bp, | ||
20 | const struct stacktrace_ops *ops, void *data, | ||
21 | unsigned long *end, int *graph); | ||
22 | |||
23 | extern void | 17 | extern void |
24 | show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, | 18 | show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, |
25 | unsigned long *stack, unsigned long bp, char *log_lvl); | 19 | unsigned long *stack, unsigned long bp, char *log_lvl); |
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c index e0ed4c7abb62..ae775ca47b25 100644 --- a/arch/x86/kernel/dumpstack_32.c +++ b/arch/x86/kernel/dumpstack_32.c | |||
@@ -58,7 +58,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, | |||
58 | 58 | ||
59 | context = (struct thread_info *) | 59 | context = (struct thread_info *) |
60 | ((unsigned long)stack & (~(THREAD_SIZE - 1))); | 60 | ((unsigned long)stack & (~(THREAD_SIZE - 1))); |
61 | bp = print_context_stack(context, stack, bp, ops, data, NULL, &graph); | 61 | bp = ops->walk_stack(context, stack, bp, ops, data, NULL, &graph); |
62 | 62 | ||
63 | stack = (unsigned long *)context->previous_esp; | 63 | stack = (unsigned long *)context->previous_esp; |
64 | if (!stack) | 64 | if (!stack) |
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index b13af53883aa..0ad9597073f5 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
@@ -188,8 +188,8 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, | |||
188 | if (ops->stack(data, id) < 0) | 188 | if (ops->stack(data, id) < 0) |
189 | break; | 189 | break; |
190 | 190 | ||
191 | bp = print_context_stack(tinfo, stack, bp, ops, | 191 | bp = ops->walk_stack(tinfo, stack, bp, ops, |
192 | data, estack_end, &graph); | 192 | data, estack_end, &graph); |
193 | ops->stack(data, "<EOE>"); | 193 | ops->stack(data, "<EOE>"); |
194 | /* | 194 | /* |
195 | * We link to the next stack via the | 195 | * We link to the next stack via the |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index f50447d961c0..05ed7ab2ca48 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -724,7 +724,7 @@ core_initcall(e820_mark_nvs_memory); | |||
724 | /* | 724 | /* |
725 | * Early reserved memory areas. | 725 | * Early reserved memory areas. |
726 | */ | 726 | */ |
727 | #define MAX_EARLY_RES 20 | 727 | #define MAX_EARLY_RES 32 |
728 | 728 | ||
729 | struct early_res { | 729 | struct early_res { |
730 | u64 start, end; | 730 | u64 start, end; |
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 572b07eee3f4..4bd93c9b2b27 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -246,7 +246,7 @@ static int __init msr_init(void) | |||
246 | int i, err = 0; | 246 | int i, err = 0; |
247 | i = 0; | 247 | i = 0; |
248 | 248 | ||
249 | if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) { | 249 | if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr", &msr_fops)) { |
250 | printk(KERN_ERR "msr: unable to get major %d for msr\n", | 250 | printk(KERN_ERR "msr: unable to get major %d for msr\n", |
251 | MSR_MAJOR); | 251 | MSR_MAJOR); |
252 | err = -EBUSY; | 252 | err = -EBUSY; |
@@ -274,7 +274,7 @@ out_class: | |||
274 | msr_device_destroy(i); | 274 | msr_device_destroy(i); |
275 | class_destroy(msr_class); | 275 | class_destroy(msr_class); |
276 | out_chrdev: | 276 | out_chrdev: |
277 | unregister_chrdev(MSR_MAJOR, "cpu/msr"); | 277 | __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr"); |
278 | out: | 278 | out: |
279 | return err; | 279 | return err; |
280 | } | 280 | } |
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index c3eb207181fe..922eefbb3f6c 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c | |||
@@ -53,17 +53,19 @@ save_stack_address_nosched(void *data, unsigned long addr, int reliable) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | static const struct stacktrace_ops save_stack_ops = { | 55 | static const struct stacktrace_ops save_stack_ops = { |
56 | .warning = save_stack_warning, | 56 | .warning = save_stack_warning, |
57 | .warning_symbol = save_stack_warning_symbol, | 57 | .warning_symbol = save_stack_warning_symbol, |
58 | .stack = save_stack_stack, | 58 | .stack = save_stack_stack, |
59 | .address = save_stack_address, | 59 | .address = save_stack_address, |
60 | .walk_stack = print_context_stack, | ||
60 | }; | 61 | }; |
61 | 62 | ||
62 | static const struct stacktrace_ops save_stack_ops_nosched = { | 63 | static const struct stacktrace_ops save_stack_ops_nosched = { |
63 | .warning = save_stack_warning, | 64 | .warning = save_stack_warning, |
64 | .warning_symbol = save_stack_warning_symbol, | 65 | .warning_symbol = save_stack_warning_symbol, |
65 | .stack = save_stack_stack, | 66 | .stack = save_stack_stack, |
66 | .address = save_stack_address_nosched, | 67 | .address = save_stack_address_nosched, |
68 | .walk_stack = print_context_stack, | ||
67 | }; | 69 | }; |
68 | 70 | ||
69 | /* | 71 | /* |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index cd982f48e23e..597683aa5ba0 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -763,6 +763,7 @@ void mark_tsc_unstable(char *reason) | |||
763 | { | 763 | { |
764 | if (!tsc_unstable) { | 764 | if (!tsc_unstable) { |
765 | tsc_unstable = 1; | 765 | tsc_unstable = 1; |
766 | sched_clock_stable = 0; | ||
766 | printk(KERN_INFO "Marking TSC unstable due to %s\n", reason); | 767 | printk(KERN_INFO "Marking TSC unstable due to %s\n", reason); |
767 | /* Change only the rating, when not registered */ | 768 | /* Change only the rating, when not registered */ |
768 | if (clocksource_tsc.mult) | 769 | if (clocksource_tsc.mult) |
diff --git a/arch/x86/kernel/uv_irq.c b/arch/x86/kernel/uv_irq.c index 61d805df4c91..ece73d8e3240 100644 --- a/arch/x86/kernel/uv_irq.c +++ b/arch/x86/kernel/uv_irq.c | |||
@@ -215,8 +215,7 @@ static int uv_set_irq_affinity(unsigned int irq, const struct cpumask *mask) | |||
215 | unsigned long mmr_offset; | 215 | unsigned long mmr_offset; |
216 | unsigned mmr_pnode; | 216 | unsigned mmr_pnode; |
217 | 217 | ||
218 | dest = set_desc_affinity(desc, mask); | 218 | if (set_desc_affinity(desc, mask, &dest)) |
219 | if (dest == BAD_APICID) | ||
220 | return -1; | 219 | return -1; |
221 | 220 | ||
222 | mmr_value = 0; | 221 | mmr_value = 0; |
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 45b20e486c2f..cffd754f3039 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile | |||
@@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c | |||
14 | 14 | ||
15 | clean-files := inat-tables.c | 15 | clean-files := inat-tables.c |
16 | 16 | ||
17 | obj-$(CONFIG_SMP) := msr.o | 17 | obj-$(CONFIG_SMP) += msr-smp.o |
18 | 18 | ||
19 | lib-y := delay.o | 19 | lib-y := delay.o |
20 | lib-y += thunk_$(BITS).o | 20 | lib-y += thunk_$(BITS).o |
@@ -22,7 +22,7 @@ lib-y += usercopy_$(BITS).o getuser.o putuser.o | |||
22 | lib-y += memcpy_$(BITS).o | 22 | lib-y += memcpy_$(BITS).o |
23 | lib-$(CONFIG_KPROBES) += insn.o inat.o | 23 | lib-$(CONFIG_KPROBES) += insn.o inat.o |
24 | 24 | ||
25 | obj-y += msr-reg.o msr-reg-export.o | 25 | obj-y += msr.o msr-reg.o msr-reg-export.o |
26 | 26 | ||
27 | ifeq ($(CONFIG_X86_32),y) | 27 | ifeq ($(CONFIG_X86_32),y) |
28 | obj-y += atomic64_32.o | 28 | obj-y += atomic64_32.o |
diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c new file mode 100644 index 000000000000..a6b1b86d2253 --- /dev/null +++ b/arch/x86/lib/msr-smp.c | |||
@@ -0,0 +1,204 @@ | |||
1 | #include <linux/module.h> | ||
2 | #include <linux/preempt.h> | ||
3 | #include <linux/smp.h> | ||
4 | #include <asm/msr.h> | ||
5 | |||
6 | static void __rdmsr_on_cpu(void *info) | ||
7 | { | ||
8 | struct msr_info *rv = info; | ||
9 | struct msr *reg; | ||
10 | int this_cpu = raw_smp_processor_id(); | ||
11 | |||
12 | if (rv->msrs) | ||
13 | reg = per_cpu_ptr(rv->msrs, this_cpu); | ||
14 | else | ||
15 | reg = &rv->reg; | ||
16 | |||
17 | rdmsr(rv->msr_no, reg->l, reg->h); | ||
18 | } | ||
19 | |||
20 | static void __wrmsr_on_cpu(void *info) | ||
21 | { | ||
22 | struct msr_info *rv = info; | ||
23 | struct msr *reg; | ||
24 | int this_cpu = raw_smp_processor_id(); | ||
25 | |||
26 | if (rv->msrs) | ||
27 | reg = per_cpu_ptr(rv->msrs, this_cpu); | ||
28 | else | ||
29 | reg = &rv->reg; | ||
30 | |||
31 | wrmsr(rv->msr_no, reg->l, reg->h); | ||
32 | } | ||
33 | |||
34 | int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | ||
35 | { | ||
36 | int err; | ||
37 | struct msr_info rv; | ||
38 | |||
39 | memset(&rv, 0, sizeof(rv)); | ||
40 | |||
41 | rv.msr_no = msr_no; | ||
42 | err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); | ||
43 | *l = rv.reg.l; | ||
44 | *h = rv.reg.h; | ||
45 | |||
46 | return err; | ||
47 | } | ||
48 | EXPORT_SYMBOL(rdmsr_on_cpu); | ||
49 | |||
50 | int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | ||
51 | { | ||
52 | int err; | ||
53 | struct msr_info rv; | ||
54 | |||
55 | memset(&rv, 0, sizeof(rv)); | ||
56 | |||
57 | rv.msr_no = msr_no; | ||
58 | rv.reg.l = l; | ||
59 | rv.reg.h = h; | ||
60 | err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); | ||
61 | |||
62 | return err; | ||
63 | } | ||
64 | EXPORT_SYMBOL(wrmsr_on_cpu); | ||
65 | |||
66 | static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no, | ||
67 | struct msr *msrs, | ||
68 | void (*msr_func) (void *info)) | ||
69 | { | ||
70 | struct msr_info rv; | ||
71 | int this_cpu; | ||
72 | |||
73 | memset(&rv, 0, sizeof(rv)); | ||
74 | |||
75 | rv.msrs = msrs; | ||
76 | rv.msr_no = msr_no; | ||
77 | |||
78 | this_cpu = get_cpu(); | ||
79 | |||
80 | if (cpumask_test_cpu(this_cpu, mask)) | ||
81 | msr_func(&rv); | ||
82 | |||
83 | smp_call_function_many(mask, msr_func, &rv, 1); | ||
84 | put_cpu(); | ||
85 | } | ||
86 | |||
87 | /* rdmsr on a bunch of CPUs | ||
88 | * | ||
89 | * @mask: which CPUs | ||
90 | * @msr_no: which MSR | ||
91 | * @msrs: array of MSR values | ||
92 | * | ||
93 | */ | ||
94 | void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) | ||
95 | { | ||
96 | __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu); | ||
97 | } | ||
98 | EXPORT_SYMBOL(rdmsr_on_cpus); | ||
99 | |||
100 | /* | ||
101 | * wrmsr on a bunch of CPUs | ||
102 | * | ||
103 | * @mask: which CPUs | ||
104 | * @msr_no: which MSR | ||
105 | * @msrs: array of MSR values | ||
106 | * | ||
107 | */ | ||
108 | void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) | ||
109 | { | ||
110 | __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu); | ||
111 | } | ||
112 | EXPORT_SYMBOL(wrmsr_on_cpus); | ||
113 | |||
114 | /* These "safe" variants are slower and should be used when the target MSR | ||
115 | may not actually exist. */ | ||
116 | static void __rdmsr_safe_on_cpu(void *info) | ||
117 | { | ||
118 | struct msr_info *rv = info; | ||
119 | |||
120 | rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h); | ||
121 | } | ||
122 | |||
123 | static void __wrmsr_safe_on_cpu(void *info) | ||
124 | { | ||
125 | struct msr_info *rv = info; | ||
126 | |||
127 | rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h); | ||
128 | } | ||
129 | |||
130 | int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | ||
131 | { | ||
132 | int err; | ||
133 | struct msr_info rv; | ||
134 | |||
135 | memset(&rv, 0, sizeof(rv)); | ||
136 | |||
137 | rv.msr_no = msr_no; | ||
138 | err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1); | ||
139 | *l = rv.reg.l; | ||
140 | *h = rv.reg.h; | ||
141 | |||
142 | return err ? err : rv.err; | ||
143 | } | ||
144 | EXPORT_SYMBOL(rdmsr_safe_on_cpu); | ||
145 | |||
146 | int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | ||
147 | { | ||
148 | int err; | ||
149 | struct msr_info rv; | ||
150 | |||
151 | memset(&rv, 0, sizeof(rv)); | ||
152 | |||
153 | rv.msr_no = msr_no; | ||
154 | rv.reg.l = l; | ||
155 | rv.reg.h = h; | ||
156 | err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1); | ||
157 | |||
158 | return err ? err : rv.err; | ||
159 | } | ||
160 | EXPORT_SYMBOL(wrmsr_safe_on_cpu); | ||
161 | |||
162 | /* | ||
163 | * These variants are significantly slower, but allows control over | ||
164 | * the entire 32-bit GPR set. | ||
165 | */ | ||
166 | static void __rdmsr_safe_regs_on_cpu(void *info) | ||
167 | { | ||
168 | struct msr_regs_info *rv = info; | ||
169 | |||
170 | rv->err = rdmsr_safe_regs(rv->regs); | ||
171 | } | ||
172 | |||
173 | static void __wrmsr_safe_regs_on_cpu(void *info) | ||
174 | { | ||
175 | struct msr_regs_info *rv = info; | ||
176 | |||
177 | rv->err = wrmsr_safe_regs(rv->regs); | ||
178 | } | ||
179 | |||
180 | int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs) | ||
181 | { | ||
182 | int err; | ||
183 | struct msr_regs_info rv; | ||
184 | |||
185 | rv.regs = regs; | ||
186 | rv.err = -EIO; | ||
187 | err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1); | ||
188 | |||
189 | return err ? err : rv.err; | ||
190 | } | ||
191 | EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu); | ||
192 | |||
193 | int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs) | ||
194 | { | ||
195 | int err; | ||
196 | struct msr_regs_info rv; | ||
197 | |||
198 | rv.regs = regs; | ||
199 | rv.err = -EIO; | ||
200 | err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1); | ||
201 | |||
202 | return err ? err : rv.err; | ||
203 | } | ||
204 | EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu); | ||
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c index 872834177937..8f8eebdca7d4 100644 --- a/arch/x86/lib/msr.c +++ b/arch/x86/lib/msr.c | |||
@@ -1,123 +1,7 @@ | |||
1 | #include <linux/module.h> | 1 | #include <linux/module.h> |
2 | #include <linux/preempt.h> | 2 | #include <linux/preempt.h> |
3 | #include <linux/smp.h> | ||
4 | #include <asm/msr.h> | 3 | #include <asm/msr.h> |
5 | 4 | ||
6 | struct msr_info { | ||
7 | u32 msr_no; | ||
8 | struct msr reg; | ||
9 | struct msr *msrs; | ||
10 | int err; | ||
11 | }; | ||
12 | |||
13 | static void __rdmsr_on_cpu(void *info) | ||
14 | { | ||
15 | struct msr_info *rv = info; | ||
16 | struct msr *reg; | ||
17 | int this_cpu = raw_smp_processor_id(); | ||
18 | |||
19 | if (rv->msrs) | ||
20 | reg = per_cpu_ptr(rv->msrs, this_cpu); | ||
21 | else | ||
22 | reg = &rv->reg; | ||
23 | |||
24 | rdmsr(rv->msr_no, reg->l, reg->h); | ||
25 | } | ||
26 | |||
27 | static void __wrmsr_on_cpu(void *info) | ||
28 | { | ||
29 | struct msr_info *rv = info; | ||
30 | struct msr *reg; | ||
31 | int this_cpu = raw_smp_processor_id(); | ||
32 | |||
33 | if (rv->msrs) | ||
34 | reg = per_cpu_ptr(rv->msrs, this_cpu); | ||
35 | else | ||
36 | reg = &rv->reg; | ||
37 | |||
38 | wrmsr(rv->msr_no, reg->l, reg->h); | ||
39 | } | ||
40 | |||
41 | int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | ||
42 | { | ||
43 | int err; | ||
44 | struct msr_info rv; | ||
45 | |||
46 | memset(&rv, 0, sizeof(rv)); | ||
47 | |||
48 | rv.msr_no = msr_no; | ||
49 | err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); | ||
50 | *l = rv.reg.l; | ||
51 | *h = rv.reg.h; | ||
52 | |||
53 | return err; | ||
54 | } | ||
55 | EXPORT_SYMBOL(rdmsr_on_cpu); | ||
56 | |||
57 | int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | ||
58 | { | ||
59 | int err; | ||
60 | struct msr_info rv; | ||
61 | |||
62 | memset(&rv, 0, sizeof(rv)); | ||
63 | |||
64 | rv.msr_no = msr_no; | ||
65 | rv.reg.l = l; | ||
66 | rv.reg.h = h; | ||
67 | err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); | ||
68 | |||
69 | return err; | ||
70 | } | ||
71 | EXPORT_SYMBOL(wrmsr_on_cpu); | ||
72 | |||
73 | static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no, | ||
74 | struct msr *msrs, | ||
75 | void (*msr_func) (void *info)) | ||
76 | { | ||
77 | struct msr_info rv; | ||
78 | int this_cpu; | ||
79 | |||
80 | memset(&rv, 0, sizeof(rv)); | ||
81 | |||
82 | rv.msrs = msrs; | ||
83 | rv.msr_no = msr_no; | ||
84 | |||
85 | this_cpu = get_cpu(); | ||
86 | |||
87 | if (cpumask_test_cpu(this_cpu, mask)) | ||
88 | msr_func(&rv); | ||
89 | |||
90 | smp_call_function_many(mask, msr_func, &rv, 1); | ||
91 | put_cpu(); | ||
92 | } | ||
93 | |||
94 | /* rdmsr on a bunch of CPUs | ||
95 | * | ||
96 | * @mask: which CPUs | ||
97 | * @msr_no: which MSR | ||
98 | * @msrs: array of MSR values | ||
99 | * | ||
100 | */ | ||
101 | void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) | ||
102 | { | ||
103 | __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu); | ||
104 | } | ||
105 | EXPORT_SYMBOL(rdmsr_on_cpus); | ||
106 | |||
107 | /* | ||
108 | * wrmsr on a bunch of CPUs | ||
109 | * | ||
110 | * @mask: which CPUs | ||
111 | * @msr_no: which MSR | ||
112 | * @msrs: array of MSR values | ||
113 | * | ||
114 | */ | ||
115 | void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) | ||
116 | { | ||
117 | __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu); | ||
118 | } | ||
119 | EXPORT_SYMBOL(wrmsr_on_cpus); | ||
120 | |||
121 | struct msr *msrs_alloc(void) | 5 | struct msr *msrs_alloc(void) |
122 | { | 6 | { |
123 | struct msr *msrs = NULL; | 7 | struct msr *msrs = NULL; |
@@ -137,100 +21,3 @@ void msrs_free(struct msr *msrs) | |||
137 | free_percpu(msrs); | 21 | free_percpu(msrs); |
138 | } | 22 | } |
139 | EXPORT_SYMBOL(msrs_free); | 23 | EXPORT_SYMBOL(msrs_free); |
140 | |||
141 | /* These "safe" variants are slower and should be used when the target MSR | ||
142 | may not actually exist. */ | ||
143 | static void __rdmsr_safe_on_cpu(void *info) | ||
144 | { | ||
145 | struct msr_info *rv = info; | ||
146 | |||
147 | rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h); | ||
148 | } | ||
149 | |||
150 | static void __wrmsr_safe_on_cpu(void *info) | ||
151 | { | ||
152 | struct msr_info *rv = info; | ||
153 | |||
154 | rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h); | ||
155 | } | ||
156 | |||
157 | int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | ||
158 | { | ||
159 | int err; | ||
160 | struct msr_info rv; | ||
161 | |||
162 | memset(&rv, 0, sizeof(rv)); | ||
163 | |||
164 | rv.msr_no = msr_no; | ||
165 | err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1); | ||
166 | *l = rv.reg.l; | ||
167 | *h = rv.reg.h; | ||
168 | |||
169 | return err ? err : rv.err; | ||
170 | } | ||
171 | EXPORT_SYMBOL(rdmsr_safe_on_cpu); | ||
172 | |||
173 | int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | ||
174 | { | ||
175 | int err; | ||
176 | struct msr_info rv; | ||
177 | |||
178 | memset(&rv, 0, sizeof(rv)); | ||
179 | |||
180 | rv.msr_no = msr_no; | ||
181 | rv.reg.l = l; | ||
182 | rv.reg.h = h; | ||
183 | err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1); | ||
184 | |||
185 | return err ? err : rv.err; | ||
186 | } | ||
187 | EXPORT_SYMBOL(wrmsr_safe_on_cpu); | ||
188 | |||
189 | /* | ||
190 | * These variants are significantly slower, but allows control over | ||
191 | * the entire 32-bit GPR set. | ||
192 | */ | ||
193 | struct msr_regs_info { | ||
194 | u32 *regs; | ||
195 | int err; | ||
196 | }; | ||
197 | |||
198 | static void __rdmsr_safe_regs_on_cpu(void *info) | ||
199 | { | ||
200 | struct msr_regs_info *rv = info; | ||
201 | |||
202 | rv->err = rdmsr_safe_regs(rv->regs); | ||
203 | } | ||
204 | |||
205 | static void __wrmsr_safe_regs_on_cpu(void *info) | ||
206 | { | ||
207 | struct msr_regs_info *rv = info; | ||
208 | |||
209 | rv->err = wrmsr_safe_regs(rv->regs); | ||
210 | } | ||
211 | |||
212 | int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs) | ||
213 | { | ||
214 | int err; | ||
215 | struct msr_regs_info rv; | ||
216 | |||
217 | rv.regs = regs; | ||
218 | rv.err = -EIO; | ||
219 | err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1); | ||
220 | |||
221 | return err ? err : rv.err; | ||
222 | } | ||
223 | EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu); | ||
224 | |||
225 | int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs) | ||
226 | { | ||
227 | int err; | ||
228 | struct msr_regs_info rv; | ||
229 | |||
230 | rv.regs = regs; | ||
231 | rv.err = -EIO; | ||
232 | err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1); | ||
233 | |||
234 | return err ? err : rv.err; | ||
235 | } | ||
236 | EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu); | ||
diff --git a/arch/x86/mm/srat_32.c b/arch/x86/mm/srat_32.c index 6f8aa33031c7..9324f13492d5 100644 --- a/arch/x86/mm/srat_32.c +++ b/arch/x86/mm/srat_32.c | |||
@@ -267,6 +267,8 @@ int __init get_memcfg_from_srat(void) | |||
267 | e820_register_active_regions(chunk->nid, chunk->start_pfn, | 267 | e820_register_active_regions(chunk->nid, chunk->start_pfn, |
268 | min(chunk->end_pfn, max_pfn)); | 268 | min(chunk->end_pfn, max_pfn)); |
269 | } | 269 | } |
270 | /* for out of order entries in SRAT */ | ||
271 | sort_node_map(); | ||
270 | 272 | ||
271 | for_each_online_node(nid) { | 273 | for_each_online_node(nid) { |
272 | unsigned long start = node_start_pfn[nid]; | 274 | unsigned long start = node_start_pfn[nid]; |
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c index d89075489664..a27124185fc1 100644 --- a/arch/x86/mm/srat_64.c +++ b/arch/x86/mm/srat_64.c | |||
@@ -317,7 +317,7 @@ static int __init nodes_cover_memory(const struct bootnode *nodes) | |||
317 | unsigned long s = nodes[i].start >> PAGE_SHIFT; | 317 | unsigned long s = nodes[i].start >> PAGE_SHIFT; |
318 | unsigned long e = nodes[i].end >> PAGE_SHIFT; | 318 | unsigned long e = nodes[i].end >> PAGE_SHIFT; |
319 | pxmram += e - s; | 319 | pxmram += e - s; |
320 | pxmram -= absent_pages_in_range(s, e); | 320 | pxmram -= __absent_pages_in_range(i, s, e); |
321 | if ((long)pxmram < 0) | 321 | if ((long)pxmram < 0) |
322 | pxmram = 0; | 322 | pxmram = 0; |
323 | } | 323 | } |
@@ -373,6 +373,8 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
373 | for_each_node_mask(i, nodes_parsed) | 373 | for_each_node_mask(i, nodes_parsed) |
374 | e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, | 374 | e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, |
375 | nodes[i].end >> PAGE_SHIFT); | 375 | nodes[i].end >> PAGE_SHIFT); |
376 | /* for out of order entries in SRAT */ | ||
377 | sort_node_map(); | ||
376 | if (!nodes_cover_memory(nodes)) { | 378 | if (!nodes_cover_memory(nodes)) { |
377 | bad_srat(); | 379 | bad_srat(); |
378 | return -1; | 380 | return -1; |
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c index 044897be021f..3855096c59b8 100644 --- a/arch/x86/oprofile/backtrace.c +++ b/arch/x86/oprofile/backtrace.c | |||
@@ -41,10 +41,11 @@ static void backtrace_address(void *data, unsigned long addr, int reliable) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | static struct stacktrace_ops backtrace_ops = { | 43 | static struct stacktrace_ops backtrace_ops = { |
44 | .warning = backtrace_warning, | 44 | .warning = backtrace_warning, |
45 | .warning_symbol = backtrace_warning_symbol, | 45 | .warning_symbol = backtrace_warning_symbol, |
46 | .stack = backtrace_stack, | 46 | .stack = backtrace_stack, |
47 | .address = backtrace_address, | 47 | .address = backtrace_address, |
48 | .walk_stack = print_context_stack, | ||
48 | }; | 49 | }; |
49 | 50 | ||
50 | struct frame_head { | 51 | struct frame_head { |
diff --git a/arch/x86/tools/chkobjdump.awk b/arch/x86/tools/chkobjdump.awk index 0d13cd9fdcff..5bbb5a33f220 100644 --- a/arch/x86/tools/chkobjdump.awk +++ b/arch/x86/tools/chkobjdump.awk | |||
@@ -9,7 +9,7 @@ BEGIN { | |||
9 | } | 9 | } |
10 | 10 | ||
11 | /^GNU/ { | 11 | /^GNU/ { |
12 | split($4, ver, "."); | 12 | split($3, ver, "."); |
13 | if (ver[1] > od_ver || | 13 | if (ver[1] > od_ver || |
14 | (ver[1] == od_ver && ver[2] >= od_sver)) { | 14 | (ver[1] == od_ver && ver[2] >= od_sver)) { |
15 | exit 1; | 15 | exit 1; |
diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk index 7a6850683c34..eaf11f52fc0b 100644 --- a/arch/x86/tools/gen-insn-attr-x86.awk +++ b/arch/x86/tools/gen-insn-attr-x86.awk | |||
@@ -6,8 +6,6 @@ | |||
6 | 6 | ||
7 | # Awk implementation sanity check | 7 | # Awk implementation sanity check |
8 | function check_awk_implement() { | 8 | function check_awk_implement() { |
9 | if (!match("abc", "[[:lower:]]+")) | ||
10 | return "Your awk doesn't support charactor-class." | ||
11 | if (sprintf("%x", 0) != "0") | 9 | if (sprintf("%x", 0) != "0") |
12 | return "Your awk has a printf-format problem." | 10 | return "Your awk has a printf-format problem." |
13 | return "" | 11 | return "" |
@@ -44,12 +42,12 @@ BEGIN { | |||
44 | delete gtable | 42 | delete gtable |
45 | delete atable | 43 | delete atable |
46 | 44 | ||
47 | opnd_expr = "^[[:alpha:]/]" | 45 | opnd_expr = "^[A-Za-z/]" |
48 | ext_expr = "^\\(" | 46 | ext_expr = "^\\(" |
49 | sep_expr = "^\\|$" | 47 | sep_expr = "^\\|$" |
50 | group_expr = "^Grp[[:alnum:]]+" | 48 | group_expr = "^Grp[0-9A-Za-z]+" |
51 | 49 | ||
52 | imm_expr = "^[IJAO][[:lower:]]" | 50 | imm_expr = "^[IJAO][a-z]" |
53 | imm_flag["Ib"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)" | 51 | imm_flag["Ib"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)" |
54 | imm_flag["Jb"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)" | 52 | imm_flag["Jb"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)" |
55 | imm_flag["Iw"] = "INAT_MAKE_IMM(INAT_IMM_WORD)" | 53 | imm_flag["Iw"] = "INAT_MAKE_IMM(INAT_IMM_WORD)" |
@@ -62,7 +60,7 @@ BEGIN { | |||
62 | imm_flag["Ob"] = "INAT_MOFFSET" | 60 | imm_flag["Ob"] = "INAT_MOFFSET" |
63 | imm_flag["Ov"] = "INAT_MOFFSET" | 61 | imm_flag["Ov"] = "INAT_MOFFSET" |
64 | 62 | ||
65 | modrm_expr = "^([CDEGMNPQRSUVW/][[:lower:]]+|NTA|T[012])" | 63 | modrm_expr = "^([CDEGMNPQRSUVW/][a-z]+|NTA|T[012])" |
66 | force64_expr = "\\([df]64\\)" | 64 | force64_expr = "\\([df]64\\)" |
67 | rex_expr = "^REX(\\.[XRWB]+)*" | 65 | rex_expr = "^REX(\\.[XRWB]+)*" |
68 | fpu_expr = "^ESC" # TODO | 66 | fpu_expr = "^ESC" # TODO |