diff options
105 files changed, 1135 insertions, 1248 deletions
| @@ -16,6 +16,13 @@ NAME = Man-Eating Seals of Antiquity | |||
| 16 | # o print "Entering directory ..."; | 16 | # o print "Entering directory ..."; |
| 17 | MAKEFLAGS += -rR --no-print-directory | 17 | MAKEFLAGS += -rR --no-print-directory |
| 18 | 18 | ||
| 19 | # Avoid funny character set dependencies | ||
| 20 | unexport LC_ALL | ||
| 21 | LC_CTYPE=C | ||
| 22 | LC_COLLATE=C | ||
| 23 | LC_NUMERIC=C | ||
| 24 | export LC_CTYPE LC_COLLATE LC_NUMERIC | ||
| 25 | |||
| 19 | # We are using a recursive build, so we need to do a little thinking | 26 | # We are using a recursive build, so we need to do a little thinking |
| 20 | # to get the ordering right. | 27 | # to get the ordering right. |
| 21 | # | 28 | # |
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/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 |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 1683ebda900b..f4ea5a8c325b 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -3022,7 +3022,7 @@ static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd) | |||
| 3022 | case WRITE_16: | 3022 | case WRITE_16: |
| 3023 | return ata_scsi_rw_xlat; | 3023 | return ata_scsi_rw_xlat; |
| 3024 | 3024 | ||
| 3025 | case 0x93 /*WRITE_SAME_16*/: | 3025 | case WRITE_SAME_16: |
| 3026 | return ata_scsi_write_same_xlat; | 3026 | return ata_scsi_write_same_xlat; |
| 3027 | 3027 | ||
| 3028 | case SYNCHRONIZE_CACHE: | 3028 | case SYNCHRONIZE_CACHE: |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index efa8773bef5a..741065c9da67 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
| @@ -2275,7 +2275,7 @@ void ata_sff_drain_fifo(struct ata_queued_cmd *qc) | |||
| 2275 | ap = qc->ap; | 2275 | ap = qc->ap; |
| 2276 | /* Drain up to 64K of data before we give up this recovery method */ | 2276 | /* Drain up to 64K of data before we give up this recovery method */ |
| 2277 | for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ) | 2277 | for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ) |
| 2278 | && count < 32768; count++) | 2278 | && count < 65536; count += 2) |
| 2279 | ioread16(ap->ioaddr.data_addr); | 2279 | ioread16(ap->ioaddr.data_addr); |
| 2280 | 2280 | ||
| 2281 | /* Can become DEBUG later */ | 2281 | /* Can become DEBUG later */ |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index 9a09a1b11ca5..dd26bc73bd9a 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> | 8 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> |
| 9 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 9 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
| 10 | * Portions Copyright (C) 2003 Red Hat Inc | 10 | * Portions Copyright (C) 2003 Red Hat Inc |
| 11 | * Portions Copyright (C) 2005-2007 MontaVista Software, Inc. | 11 | * Portions Copyright (C) 2005-2009 MontaVista Software, Inc. |
| 12 | * | 12 | * |
| 13 | * | 13 | * |
| 14 | * TODO | 14 | * TODO |
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
| 26 | 26 | ||
| 27 | #define DRV_NAME "pata_hpt3x2n" | 27 | #define DRV_NAME "pata_hpt3x2n" |
| 28 | #define DRV_VERSION "0.3.7" | 28 | #define DRV_VERSION "0.3.8" |
| 29 | 29 | ||
| 30 | enum { | 30 | enum { |
| 31 | HPT_PCI_FAST = (1 << 31), | 31 | HPT_PCI_FAST = (1 << 31), |
| @@ -264,7 +264,7 @@ static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc) | |||
| 264 | 264 | ||
| 265 | static void hpt3x2n_set_clock(struct ata_port *ap, int source) | 265 | static void hpt3x2n_set_clock(struct ata_port *ap, int source) |
| 266 | { | 266 | { |
| 267 | void __iomem *bmdma = ap->ioaddr.bmdma_addr; | 267 | void __iomem *bmdma = ap->ioaddr.bmdma_addr - ap->port_no * 8; |
| 268 | 268 | ||
| 269 | /* Tristate the bus */ | 269 | /* Tristate the bus */ |
| 270 | iowrite8(0x80, bmdma+0x73); | 270 | iowrite8(0x80, bmdma+0x73); |
| @@ -274,9 +274,9 @@ static void hpt3x2n_set_clock(struct ata_port *ap, int source) | |||
| 274 | iowrite8(source, bmdma+0x7B); | 274 | iowrite8(source, bmdma+0x7B); |
| 275 | iowrite8(0xC0, bmdma+0x79); | 275 | iowrite8(0xC0, bmdma+0x79); |
| 276 | 276 | ||
| 277 | /* Reset state machines */ | 277 | /* Reset state machines, avoid enabling the disabled channels */ |
| 278 | iowrite8(0x37, bmdma+0x70); | 278 | iowrite8(ioread8(bmdma+0x70) | 0x32, bmdma+0x70); |
| 279 | iowrite8(0x37, bmdma+0x74); | 279 | iowrite8(ioread8(bmdma+0x74) | 0x32, bmdma+0x74); |
| 280 | 280 | ||
| 281 | /* Complete reset */ | 281 | /* Complete reset */ |
| 282 | iowrite8(0x00, bmdma+0x79); | 282 | iowrite8(0x00, bmdma+0x79); |
| @@ -286,21 +286,10 @@ static void hpt3x2n_set_clock(struct ata_port *ap, int source) | |||
| 286 | iowrite8(0x00, bmdma+0x77); | 286 | iowrite8(0x00, bmdma+0x77); |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | /* Check if our partner interface is busy */ | ||
| 290 | |||
| 291 | static int hpt3x2n_pair_idle(struct ata_port *ap) | ||
| 292 | { | ||
| 293 | struct ata_host *host = ap->host; | ||
| 294 | struct ata_port *pair = host->ports[ap->port_no ^ 1]; | ||
| 295 | |||
| 296 | if (pair->hsm_task_state == HSM_ST_IDLE) | ||
| 297 | return 1; | ||
| 298 | return 0; | ||
| 299 | } | ||
| 300 | |||
| 301 | static int hpt3x2n_use_dpll(struct ata_port *ap, int writing) | 289 | static int hpt3x2n_use_dpll(struct ata_port *ap, int writing) |
| 302 | { | 290 | { |
| 303 | long flags = (long)ap->host->private_data; | 291 | long flags = (long)ap->host->private_data; |
| 292 | |||
| 304 | /* See if we should use the DPLL */ | 293 | /* See if we should use the DPLL */ |
| 305 | if (writing) | 294 | if (writing) |
| 306 | return USE_DPLL; /* Needed for write */ | 295 | return USE_DPLL; /* Needed for write */ |
| @@ -309,20 +298,35 @@ static int hpt3x2n_use_dpll(struct ata_port *ap, int writing) | |||
| 309 | return 0; | 298 | return 0; |
| 310 | } | 299 | } |
| 311 | 300 | ||
| 301 | static int hpt3x2n_qc_defer(struct ata_queued_cmd *qc) | ||
| 302 | { | ||
| 303 | struct ata_port *ap = qc->ap; | ||
| 304 | struct ata_port *alt = ap->host->ports[ap->port_no ^ 1]; | ||
| 305 | int rc, flags = (long)ap->host->private_data; | ||
| 306 | int dpll = hpt3x2n_use_dpll(ap, qc->tf.flags & ATA_TFLAG_WRITE); | ||
| 307 | |||
| 308 | /* First apply the usual rules */ | ||
| 309 | rc = ata_std_qc_defer(qc); | ||
| 310 | if (rc != 0) | ||
| 311 | return rc; | ||
| 312 | |||
| 313 | if ((flags & USE_DPLL) != dpll && alt->qc_active) | ||
| 314 | return ATA_DEFER_PORT; | ||
| 315 | return 0; | ||
| 316 | } | ||
| 317 | |||
| 312 | static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc) | 318 | static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc) |
| 313 | { | 319 | { |
| 314 | struct ata_taskfile *tf = &qc->tf; | ||
| 315 | struct ata_port *ap = qc->ap; | 320 | struct ata_port *ap = qc->ap; |
| 316 | int flags = (long)ap->host->private_data; | 321 | int flags = (long)ap->host->private_data; |
| 322 | int dpll = hpt3x2n_use_dpll(ap, qc->tf.flags & ATA_TFLAG_WRITE); | ||
| 317 | 323 | ||
| 318 | if (hpt3x2n_pair_idle(ap)) { | 324 | if ((flags & USE_DPLL) != dpll) { |
| 319 | int dpll = hpt3x2n_use_dpll(ap, (tf->flags & ATA_TFLAG_WRITE)); | 325 | flags &= ~USE_DPLL; |
| 320 | if ((flags & USE_DPLL) != dpll) { | 326 | flags |= dpll; |
| 321 | if (dpll == 1) | 327 | ap->host->private_data = (void *)(long)flags; |
| 322 | hpt3x2n_set_clock(ap, 0x21); | 328 | |
| 323 | else | 329 | hpt3x2n_set_clock(ap, dpll ? 0x21 : 0x23); |
| 324 | hpt3x2n_set_clock(ap, 0x23); | ||
| 325 | } | ||
| 326 | } | 330 | } |
| 327 | return ata_sff_qc_issue(qc); | 331 | return ata_sff_qc_issue(qc); |
| 328 | } | 332 | } |
| @@ -339,6 +343,8 @@ static struct ata_port_operations hpt3x2n_port_ops = { | |||
| 339 | .inherits = &ata_bmdma_port_ops, | 343 | .inherits = &ata_bmdma_port_ops, |
| 340 | 344 | ||
| 341 | .bmdma_stop = hpt3x2n_bmdma_stop, | 345 | .bmdma_stop = hpt3x2n_bmdma_stop, |
| 346 | |||
| 347 | .qc_defer = hpt3x2n_qc_defer, | ||
| 342 | .qc_issue = hpt3x2n_qc_issue, | 348 | .qc_issue = hpt3x2n_qc_issue, |
| 343 | 349 | ||
| 344 | .cable_detect = hpt3x2n_cable_detect, | 350 | .cable_detect = hpt3x2n_cable_detect, |
| @@ -454,7 +460,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 454 | unsigned int f_low, f_high; | 460 | unsigned int f_low, f_high; |
| 455 | int adjust; | 461 | int adjust; |
| 456 | unsigned long iobase = pci_resource_start(dev, 4); | 462 | unsigned long iobase = pci_resource_start(dev, 4); |
| 457 | void *hpriv = NULL; | 463 | void *hpriv = (void *)USE_DPLL; |
| 458 | int rc; | 464 | int rc; |
| 459 | 465 | ||
| 460 | rc = pcim_enable_device(dev); | 466 | rc = pcim_enable_device(dev); |
| @@ -539,7 +545,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 539 | /* Set our private data up. We only need a few flags so we use | 545 | /* Set our private data up. We only need a few flags so we use |
| 540 | it directly */ | 546 | it directly */ |
| 541 | if (pci_mhz > 60) { | 547 | if (pci_mhz > 60) { |
| 542 | hpriv = (void *)PCI66; | 548 | hpriv = (void *)(PCI66 | USE_DPLL); |
| 543 | /* | 549 | /* |
| 544 | * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in | 550 | * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in |
| 545 | * the MISC. register to stretch the UltraDMA Tss timing. | 551 | * the MISC. register to stretch the UltraDMA Tss timing. |
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index d6f69561dc86..37ef416c1242 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c | |||
| @@ -853,7 +853,7 @@ static int __devinit octeon_cf_probe(struct platform_device *pdev) | |||
| 853 | return -EINVAL; | 853 | return -EINVAL; |
| 854 | 854 | ||
| 855 | cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start, | 855 | cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start, |
| 856 | res_cs0->end - res_cs1->start + 1); | 856 | resource_size(res_cs1)); |
| 857 | 857 | ||
| 858 | if (!cs1) | 858 | if (!cs1) |
| 859 | return -ENOMEM; | 859 | return -ENOMEM; |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index a8a7be0d06ff..df8ee325d3ca 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #include <linux/dmapool.h> | 59 | #include <linux/dmapool.h> |
| 60 | #include <linux/dma-mapping.h> | 60 | #include <linux/dma-mapping.h> |
| 61 | #include <linux/device.h> | 61 | #include <linux/device.h> |
| 62 | #include <linux/clk.h> | ||
| 62 | #include <linux/platform_device.h> | 63 | #include <linux/platform_device.h> |
| 63 | #include <linux/ata_platform.h> | 64 | #include <linux/ata_platform.h> |
| 64 | #include <linux/mbus.h> | 65 | #include <linux/mbus.h> |
| @@ -538,6 +539,7 @@ struct mv_port_signal { | |||
| 538 | 539 | ||
| 539 | struct mv_host_priv { | 540 | struct mv_host_priv { |
| 540 | u32 hp_flags; | 541 | u32 hp_flags; |
| 542 | unsigned int board_idx; | ||
| 541 | u32 main_irq_mask; | 543 | u32 main_irq_mask; |
| 542 | struct mv_port_signal signal[8]; | 544 | struct mv_port_signal signal[8]; |
| 543 | const struct mv_hw_ops *ops; | 545 | const struct mv_hw_ops *ops; |
| @@ -548,6 +550,10 @@ struct mv_host_priv { | |||
| 548 | u32 irq_cause_offset; | 550 | u32 irq_cause_offset; |
| 549 | u32 irq_mask_offset; | 551 | u32 irq_mask_offset; |
| 550 | u32 unmask_all_irqs; | 552 | u32 unmask_all_irqs; |
| 553 | |||
| 554 | #if defined(CONFIG_HAVE_CLK) | ||
| 555 | struct clk *clk; | ||
| 556 | #endif | ||
| 551 | /* | 557 | /* |
| 552 | * These consistent DMA memory pools give us guaranteed | 558 | * These consistent DMA memory pools give us guaranteed |
| 553 | * alignment for hardware-accessed data structures, | 559 | * alignment for hardware-accessed data structures, |
| @@ -2775,7 +2781,7 @@ static void mv_port_intr(struct ata_port *ap, u32 port_cause) | |||
| 2775 | struct mv_port_priv *pp; | 2781 | struct mv_port_priv *pp; |
| 2776 | int edma_was_enabled; | 2782 | int edma_was_enabled; |
| 2777 | 2783 | ||
| 2778 | if (!ap || (ap->flags & ATA_FLAG_DISABLED)) { | 2784 | if (ap->flags & ATA_FLAG_DISABLED) { |
| 2779 | mv_unexpected_intr(ap, 0); | 2785 | mv_unexpected_intr(ap, 0); |
| 2780 | return; | 2786 | return; |
| 2781 | } | 2787 | } |
| @@ -3393,7 +3399,7 @@ static void mv_soc_reset_hc_port(struct mv_host_priv *hpriv, | |||
| 3393 | ZERO(0x024); /* respq outp */ | 3399 | ZERO(0x024); /* respq outp */ |
| 3394 | ZERO(0x020); /* respq inp */ | 3400 | ZERO(0x020); /* respq inp */ |
| 3395 | ZERO(0x02c); /* test control */ | 3401 | ZERO(0x02c); /* test control */ |
| 3396 | writel(0xbc, port_mmio + EDMA_IORDY_TMOUT); | 3402 | writel(0x800, port_mmio + EDMA_IORDY_TMOUT); |
| 3397 | } | 3403 | } |
| 3398 | 3404 | ||
| 3399 | #undef ZERO | 3405 | #undef ZERO |
| @@ -3854,7 +3860,6 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
| 3854 | /** | 3860 | /** |
| 3855 | * mv_init_host - Perform some early initialization of the host. | 3861 | * mv_init_host - Perform some early initialization of the host. |
| 3856 | * @host: ATA host to initialize | 3862 | * @host: ATA host to initialize |
| 3857 | * @board_idx: controller index | ||
| 3858 | * | 3863 | * |
| 3859 | * If possible, do an early global reset of the host. Then do | 3864 | * If possible, do an early global reset of the host. Then do |
| 3860 | * our port init and clear/unmask all/relevant host interrupts. | 3865 | * our port init and clear/unmask all/relevant host interrupts. |
| @@ -3862,13 +3867,13 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
| 3862 | * LOCKING: | 3867 | * LOCKING: |
| 3863 | * Inherited from caller. | 3868 | * Inherited from caller. |
| 3864 | */ | 3869 | */ |
| 3865 | static int mv_init_host(struct ata_host *host, unsigned int board_idx) | 3870 | static int mv_init_host(struct ata_host *host) |
| 3866 | { | 3871 | { |
| 3867 | int rc = 0, n_hc, port, hc; | 3872 | int rc = 0, n_hc, port, hc; |
| 3868 | struct mv_host_priv *hpriv = host->private_data; | 3873 | struct mv_host_priv *hpriv = host->private_data; |
| 3869 | void __iomem *mmio = hpriv->base; | 3874 | void __iomem *mmio = hpriv->base; |
| 3870 | 3875 | ||
| 3871 | rc = mv_chip_id(host, board_idx); | 3876 | rc = mv_chip_id(host, hpriv->board_idx); |
| 3872 | if (rc) | 3877 | if (rc) |
| 3873 | goto done; | 3878 | goto done; |
| 3874 | 3879 | ||
| @@ -3905,14 +3910,6 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
| 3905 | void __iomem *port_mmio = mv_port_base(mmio, port); | 3910 | void __iomem *port_mmio = mv_port_base(mmio, port); |
| 3906 | 3911 | ||
| 3907 | mv_port_init(&ap->ioaddr, port_mmio); | 3912 | mv_port_init(&ap->ioaddr, port_mmio); |
| 3908 | |||
| 3909 | #ifdef CONFIG_PCI | ||
| 3910 | if (!IS_SOC(hpriv)) { | ||
| 3911 | unsigned int offset = port_mmio - mmio; | ||
| 3912 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio"); | ||
| 3913 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port"); | ||
| 3914 | } | ||
| 3915 | #endif | ||
| 3916 | } | 3913 | } |
| 3917 | 3914 | ||
| 3918 | for (hc = 0; hc < n_hc; hc++) { | 3915 | for (hc = 0; hc < n_hc; hc++) { |
| @@ -4035,12 +4032,21 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
| 4035 | return -ENOMEM; | 4032 | return -ENOMEM; |
| 4036 | host->private_data = hpriv; | 4033 | host->private_data = hpriv; |
| 4037 | hpriv->n_ports = n_ports; | 4034 | hpriv->n_ports = n_ports; |
| 4035 | hpriv->board_idx = chip_soc; | ||
| 4038 | 4036 | ||
| 4039 | host->iomap = NULL; | 4037 | host->iomap = NULL; |
| 4040 | hpriv->base = devm_ioremap(&pdev->dev, res->start, | 4038 | hpriv->base = devm_ioremap(&pdev->dev, res->start, |
| 4041 | resource_size(res)); | 4039 | resource_size(res)); |
| 4042 | hpriv->base -= SATAHC0_REG_BASE; | 4040 | hpriv->base -= SATAHC0_REG_BASE; |
| 4043 | 4041 | ||
| 4042 | #if defined(CONFIG_HAVE_CLK) | ||
| 4043 | hpriv->clk = clk_get(&pdev->dev, NULL); | ||
| 4044 | if (IS_ERR(hpriv->clk)) | ||
| 4045 | dev_notice(&pdev->dev, "cannot get clkdev\n"); | ||
| 4046 | else | ||
| 4047 | clk_enable(hpriv->clk); | ||
| 4048 | #endif | ||
| 4049 | |||
| 4044 | /* | 4050 | /* |
| 4045 | * (Re-)program MBUS remapping windows if we are asked to. | 4051 | * (Re-)program MBUS remapping windows if we are asked to. |
| 4046 | */ | 4052 | */ |
| @@ -4049,12 +4055,12 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
| 4049 | 4055 | ||
| 4050 | rc = mv_create_dma_pools(hpriv, &pdev->dev); | 4056 | rc = mv_create_dma_pools(hpriv, &pdev->dev); |
| 4051 | if (rc) | 4057 | if (rc) |
| 4052 | return rc; | 4058 | goto err; |
| 4053 | 4059 | ||
| 4054 | /* initialize adapter */ | 4060 | /* initialize adapter */ |
| 4055 | rc = mv_init_host(host, chip_soc); | 4061 | rc = mv_init_host(host); |
| 4056 | if (rc) | 4062 | if (rc) |
| 4057 | return rc; | 4063 | goto err; |
| 4058 | 4064 | ||
| 4059 | dev_printk(KERN_INFO, &pdev->dev, | 4065 | dev_printk(KERN_INFO, &pdev->dev, |
| 4060 | "slots %u ports %d\n", (unsigned)MV_MAX_Q_DEPTH, | 4066 | "slots %u ports %d\n", (unsigned)MV_MAX_Q_DEPTH, |
| @@ -4062,6 +4068,15 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
| 4062 | 4068 | ||
| 4063 | return ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt, | 4069 | return ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt, |
| 4064 | IRQF_SHARED, &mv6_sht); | 4070 | IRQF_SHARED, &mv6_sht); |
| 4071 | err: | ||
| 4072 | #if defined(CONFIG_HAVE_CLK) | ||
| 4073 | if (!IS_ERR(hpriv->clk)) { | ||
| 4074 | clk_disable(hpriv->clk); | ||
| 4075 | clk_put(hpriv->clk); | ||
| 4076 | } | ||
| 4077 | #endif | ||
| 4078 | |||
| 4079 | return rc; | ||
| 4065 | } | 4080 | } |
| 4066 | 4081 | ||
| 4067 | /* | 4082 | /* |
| @@ -4076,14 +4091,66 @@ static int __devexit mv_platform_remove(struct platform_device *pdev) | |||
| 4076 | { | 4091 | { |
| 4077 | struct device *dev = &pdev->dev; | 4092 | struct device *dev = &pdev->dev; |
| 4078 | struct ata_host *host = dev_get_drvdata(dev); | 4093 | struct ata_host *host = dev_get_drvdata(dev); |
| 4079 | 4094 | #if defined(CONFIG_HAVE_CLK) | |
| 4095 | struct mv_host_priv *hpriv = host->private_data; | ||
| 4096 | #endif | ||
| 4080 | ata_host_detach(host); | 4097 | ata_host_detach(host); |
| 4098 | |||
| 4099 | #if defined(CONFIG_HAVE_CLK) | ||
| 4100 | if (!IS_ERR(hpriv->clk)) { | ||
| 4101 | clk_disable(hpriv->clk); | ||
| 4102 | clk_put(hpriv->clk); | ||
| 4103 | } | ||
| 4104 | #endif | ||
| 4081 | return 0; | 4105 | return 0; |
| 4082 | } | 4106 | } |
| 4083 | 4107 | ||
| 4108 | #ifdef CONFIG_PM | ||
| 4109 | static int mv_platform_suspend(struct platform_device *pdev, pm_message_t state) | ||
| 4110 | { | ||
| 4111 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
| 4112 | if (host) | ||
| 4113 | return ata_host_suspend(host, state); | ||
| 4114 | else | ||
| 4115 | return 0; | ||
| 4116 | } | ||
| 4117 | |||
| 4118 | static int mv_platform_resume(struct platform_device *pdev) | ||
| 4119 | { | ||
| 4120 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
| 4121 | int ret; | ||
| 4122 | |||
| 4123 | if (host) { | ||
| 4124 | struct mv_host_priv *hpriv = host->private_data; | ||
| 4125 | const struct mv_sata_platform_data *mv_platform_data = \ | ||
| 4126 | pdev->dev.platform_data; | ||
| 4127 | /* | ||
| 4128 | * (Re-)program MBUS remapping windows if we are asked to. | ||
| 4129 | */ | ||
| 4130 | if (mv_platform_data->dram != NULL) | ||
| 4131 | mv_conf_mbus_windows(hpriv, mv_platform_data->dram); | ||
| 4132 | |||
| 4133 | /* initialize adapter */ | ||
| 4134 | ret = mv_init_host(host); | ||
| 4135 | if (ret) { | ||
| 4136 | printk(KERN_ERR DRV_NAME ": Error during HW init\n"); | ||
| 4137 | return ret; | ||
| 4138 | } | ||
| 4139 | ata_host_resume(host); | ||
| 4140 | } | ||
| 4141 | |||
| 4142 | return 0; | ||
| 4143 | } | ||
| 4144 | #else | ||
| 4145 | #define mv_platform_suspend NULL | ||
| 4146 | #define mv_platform_resume NULL | ||
| 4147 | #endif | ||
| 4148 | |||
| 4084 | static struct platform_driver mv_platform_driver = { | 4149 | static struct platform_driver mv_platform_driver = { |
| 4085 | .probe = mv_platform_probe, | 4150 | .probe = mv_platform_probe, |
| 4086 | .remove = __devexit_p(mv_platform_remove), | 4151 | .remove = __devexit_p(mv_platform_remove), |
| 4152 | .suspend = mv_platform_suspend, | ||
| 4153 | .resume = mv_platform_resume, | ||
| 4087 | .driver = { | 4154 | .driver = { |
| 4088 | .name = DRV_NAME, | 4155 | .name = DRV_NAME, |
| 4089 | .owner = THIS_MODULE, | 4156 | .owner = THIS_MODULE, |
| @@ -4094,6 +4161,9 @@ static struct platform_driver mv_platform_driver = { | |||
| 4094 | #ifdef CONFIG_PCI | 4161 | #ifdef CONFIG_PCI |
| 4095 | static int mv_pci_init_one(struct pci_dev *pdev, | 4162 | static int mv_pci_init_one(struct pci_dev *pdev, |
| 4096 | const struct pci_device_id *ent); | 4163 | const struct pci_device_id *ent); |
| 4164 | #ifdef CONFIG_PM | ||
| 4165 | static int mv_pci_device_resume(struct pci_dev *pdev); | ||
| 4166 | #endif | ||
| 4097 | 4167 | ||
| 4098 | 4168 | ||
| 4099 | static struct pci_driver mv_pci_driver = { | 4169 | static struct pci_driver mv_pci_driver = { |
| @@ -4101,6 +4171,11 @@ static struct pci_driver mv_pci_driver = { | |||
| 4101 | .id_table = mv_pci_tbl, | 4171 | .id_table = mv_pci_tbl, |
| 4102 | .probe = mv_pci_init_one, | 4172 | .probe = mv_pci_init_one, |
| 4103 | .remove = ata_pci_remove_one, | 4173 | .remove = ata_pci_remove_one, |
| 4174 | #ifdef CONFIG_PM | ||
| 4175 | .suspend = ata_pci_device_suspend, | ||
| 4176 | .resume = mv_pci_device_resume, | ||
| 4177 | #endif | ||
| 4178 | |||
| 4104 | }; | 4179 | }; |
| 4105 | 4180 | ||
| 4106 | /* move to PCI layer or libata core? */ | 4181 | /* move to PCI layer or libata core? */ |
| @@ -4194,7 +4269,7 @@ static int mv_pci_init_one(struct pci_dev *pdev, | |||
| 4194 | const struct ata_port_info *ppi[] = { &mv_port_info[board_idx], NULL }; | 4269 | const struct ata_port_info *ppi[] = { &mv_port_info[board_idx], NULL }; |
| 4195 | struct ata_host *host; | 4270 | struct ata_host *host; |
| 4196 | struct mv_host_priv *hpriv; | 4271 | struct mv_host_priv *hpriv; |
| 4197 | int n_ports, rc; | 4272 | int n_ports, port, rc; |
| 4198 | 4273 | ||
| 4199 | if (!printed_version++) | 4274 | if (!printed_version++) |
| 4200 | dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); | 4275 | dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); |
| @@ -4208,6 +4283,7 @@ static int mv_pci_init_one(struct pci_dev *pdev, | |||
| 4208 | return -ENOMEM; | 4283 | return -ENOMEM; |
| 4209 | host->private_data = hpriv; | 4284 | host->private_data = hpriv; |
| 4210 | hpriv->n_ports = n_ports; | 4285 | hpriv->n_ports = n_ports; |
| 4286 | hpriv->board_idx = board_idx; | ||
| 4211 | 4287 | ||
| 4212 | /* acquire resources */ | 4288 | /* acquire resources */ |
| 4213 | rc = pcim_enable_device(pdev); | 4289 | rc = pcim_enable_device(pdev); |
| @@ -4230,8 +4306,17 @@ static int mv_pci_init_one(struct pci_dev *pdev, | |||
| 4230 | if (rc) | 4306 | if (rc) |
| 4231 | return rc; | 4307 | return rc; |
| 4232 | 4308 | ||
| 4309 | for (port = 0; port < host->n_ports; port++) { | ||
| 4310 | struct ata_port *ap = host->ports[port]; | ||
| 4311 | void __iomem *port_mmio = mv_port_base(hpriv->base, port); | ||
| 4312 | unsigned int offset = port_mmio - hpriv->base; | ||
| 4313 | |||
| 4314 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio"); | ||
| 4315 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port"); | ||
| 4316 | } | ||
| 4317 | |||
| 4233 | /* initialize adapter */ | 4318 | /* initialize adapter */ |
| 4234 | rc = mv_init_host(host, board_idx); | 4319 | rc = mv_init_host(host); |
| 4235 | if (rc) | 4320 | if (rc) |
| 4236 | return rc; | 4321 | return rc; |
| 4237 | 4322 | ||
| @@ -4247,6 +4332,27 @@ static int mv_pci_init_one(struct pci_dev *pdev, | |||
| 4247 | return ata_host_activate(host, pdev->irq, mv_interrupt, IRQF_SHARED, | 4332 | return ata_host_activate(host, pdev->irq, mv_interrupt, IRQF_SHARED, |
| 4248 | IS_GEN_I(hpriv) ? &mv5_sht : &mv6_sht); | 4333 | IS_GEN_I(hpriv) ? &mv5_sht : &mv6_sht); |
| 4249 | } | 4334 | } |
| 4335 | |||
| 4336 | #ifdef CONFIG_PM | ||
| 4337 | static int mv_pci_device_resume(struct pci_dev *pdev) | ||
| 4338 | { | ||
| 4339 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
| 4340 | int rc; | ||
| 4341 | |||
| 4342 | rc = ata_pci_device_do_resume(pdev); | ||
| 4343 | if (rc) | ||
| 4344 | return rc; | ||
| 4345 | |||
| 4346 | /* initialize adapter */ | ||
| 4347 | rc = mv_init_host(host); | ||
| 4348 | if (rc) | ||
| 4349 | return rc; | ||
| 4350 | |||
| 4351 | ata_host_resume(host); | ||
| 4352 | |||
| 4353 | return 0; | ||
| 4354 | } | ||
| 4355 | #endif | ||
| 4250 | #endif | 4356 | #endif |
| 4251 | 4357 | ||
| 4252 | static int mv_platform_probe(struct platform_device *pdev); | 4358 | static int mv_platform_probe(struct platform_device *pdev); |
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c index fd1231738ef4..148b1dd24070 100644 --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c | |||
| @@ -218,7 +218,7 @@ int dasd_alias_make_device_known_to_lcu(struct dasd_device *device) | |||
| 218 | spin_unlock_irqrestore(&aliastree.lock, flags); | 218 | spin_unlock_irqrestore(&aliastree.lock, flags); |
| 219 | newlcu = _allocate_lcu(uid); | 219 | newlcu = _allocate_lcu(uid); |
| 220 | if (IS_ERR(newlcu)) | 220 | if (IS_ERR(newlcu)) |
| 221 | return PTR_ERR(lcu); | 221 | return PTR_ERR(newlcu); |
| 222 | spin_lock_irqsave(&aliastree.lock, flags); | 222 | spin_lock_irqsave(&aliastree.lock, flags); |
| 223 | lcu = _find_lcu(server, uid); | 223 | lcu = _find_lcu(server, uid); |
| 224 | if (!lcu) { | 224 | if (!lcu) { |
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index f64d0db881b4..6e14863f5c70 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * | 8 | * |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #define KMSG_COMPONENT "dasd-diag" | 11 | #define KMSG_COMPONENT "dasd" |
| 12 | 12 | ||
| 13 | #include <linux/stddef.h> | 13 | #include <linux/stddef.h> |
| 14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| @@ -146,16 +146,16 @@ dasd_diag_erp(struct dasd_device *device) | |||
| 146 | rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); | 146 | rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); |
| 147 | if (rc == 4) { | 147 | if (rc == 4) { |
| 148 | if (!(device->features & DASD_FEATURE_READONLY)) { | 148 | if (!(device->features & DASD_FEATURE_READONLY)) { |
| 149 | dev_warn(&device->cdev->dev, | 149 | pr_warning("%s: The access mode of a DIAG device " |
| 150 | "The access mode of a DIAG device changed" | 150 | "changed to read-only\n", |
| 151 | " to read-only"); | 151 | dev_name(&device->cdev->dev)); |
| 152 | device->features |= DASD_FEATURE_READONLY; | 152 | device->features |= DASD_FEATURE_READONLY; |
| 153 | } | 153 | } |
| 154 | rc = 0; | 154 | rc = 0; |
| 155 | } | 155 | } |
| 156 | if (rc) | 156 | if (rc) |
| 157 | dev_warn(&device->cdev->dev, "DIAG ERP failed with " | 157 | pr_warning("%s: DIAG ERP failed with " |
| 158 | "rc=%d\n", rc); | 158 | "rc=%d\n", dev_name(&device->cdev->dev), rc); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | /* Start a given request at the device. Return zero on success, non-zero | 161 | /* Start a given request at the device. Return zero on success, non-zero |
| @@ -371,8 +371,9 @@ dasd_diag_check_device(struct dasd_device *device) | |||
| 371 | private->pt_block = 2; | 371 | private->pt_block = 2; |
| 372 | break; | 372 | break; |
| 373 | default: | 373 | default: |
| 374 | dev_warn(&device->cdev->dev, "Device type %d is not supported " | 374 | pr_warning("%s: Device type %d is not supported " |
| 375 | "in DIAG mode\n", private->rdc_data.vdev_class); | 375 | "in DIAG mode\n", dev_name(&device->cdev->dev), |
| 376 | private->rdc_data.vdev_class); | ||
| 376 | rc = -EOPNOTSUPP; | 377 | rc = -EOPNOTSUPP; |
| 377 | goto out; | 378 | goto out; |
| 378 | } | 379 | } |
| @@ -413,8 +414,8 @@ dasd_diag_check_device(struct dasd_device *device) | |||
| 413 | private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; | 414 | private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; |
| 414 | rc = dia250(&private->iob, RW_BIO); | 415 | rc = dia250(&private->iob, RW_BIO); |
| 415 | if (rc == 3) { | 416 | if (rc == 3) { |
| 416 | dev_warn(&device->cdev->dev, | 417 | pr_warning("%s: A 64-bit DIAG call failed\n", |
| 417 | "A 64-bit DIAG call failed\n"); | 418 | dev_name(&device->cdev->dev)); |
| 418 | rc = -EOPNOTSUPP; | 419 | rc = -EOPNOTSUPP; |
| 419 | goto out_label; | 420 | goto out_label; |
| 420 | } | 421 | } |
| @@ -423,8 +424,9 @@ dasd_diag_check_device(struct dasd_device *device) | |||
| 423 | break; | 424 | break; |
| 424 | } | 425 | } |
| 425 | if (bsize > PAGE_SIZE) { | 426 | if (bsize > PAGE_SIZE) { |
| 426 | dev_warn(&device->cdev->dev, "Accessing the DASD failed because" | 427 | pr_warning("%s: Accessing the DASD failed because of an " |
| 427 | " of an incorrect format (rc=%d)\n", rc); | 428 | "incorrect format (rc=%d)\n", |
| 429 | dev_name(&device->cdev->dev), rc); | ||
| 428 | rc = -EIO; | 430 | rc = -EIO; |
| 429 | goto out_label; | 431 | goto out_label; |
| 430 | } | 432 | } |
| @@ -442,18 +444,18 @@ dasd_diag_check_device(struct dasd_device *device) | |||
| 442 | block->s2b_shift++; | 444 | block->s2b_shift++; |
| 443 | rc = mdsk_init_io(device, block->bp_block, 0, NULL); | 445 | rc = mdsk_init_io(device, block->bp_block, 0, NULL); |
| 444 | if (rc && (rc != 4)) { | 446 | if (rc && (rc != 4)) { |
| 445 | dev_warn(&device->cdev->dev, "DIAG initialization " | 447 | pr_warning("%s: DIAG initialization failed with rc=%d\n", |
| 446 | "failed with rc=%d\n", rc); | 448 | dev_name(&device->cdev->dev), rc); |
| 447 | rc = -EIO; | 449 | rc = -EIO; |
| 448 | } else { | 450 | } else { |
| 449 | if (rc == 4) | 451 | if (rc == 4) |
| 450 | device->features |= DASD_FEATURE_READONLY; | 452 | device->features |= DASD_FEATURE_READONLY; |
| 451 | dev_info(&device->cdev->dev, | 453 | pr_info("%s: New DASD with %ld byte/block, total size %ld " |
| 452 | "New DASD with %ld byte/block, total size %ld KB%s\n", | 454 | "KB%s\n", dev_name(&device->cdev->dev), |
| 453 | (unsigned long) block->bp_block, | 455 | (unsigned long) block->bp_block, |
| 454 | (unsigned long) (block->blocks << | 456 | (unsigned long) (block->blocks << |
| 455 | block->s2b_shift) >> 1, | 457 | block->s2b_shift) >> 1, |
| 456 | (rc == 4) ? ", read-only device" : ""); | 458 | (rc == 4) ? ", read-only device" : ""); |
| 457 | rc = 0; | 459 | rc = 0; |
| 458 | } | 460 | } |
| 459 | out_label: | 461 | out_label: |
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 28e4649fa9e4..247b2b934728 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
| @@ -467,7 +467,7 @@ fs3270_open(struct inode *inode, struct file *filp) | |||
| 467 | if (IS_ERR(ib)) { | 467 | if (IS_ERR(ib)) { |
| 468 | raw3270_put_view(&fp->view); | 468 | raw3270_put_view(&fp->view); |
| 469 | raw3270_del_view(&fp->view); | 469 | raw3270_del_view(&fp->view); |
| 470 | rc = PTR_ERR(fp); | 470 | rc = PTR_ERR(ib); |
| 471 | goto out; | 471 | goto out; |
| 472 | } | 472 | } |
| 473 | fp->rdbuf = ib; | 473 | fp->rdbuf = ib; |
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c index 3657fe103c27..cb70fa1cf539 100644 --- a/drivers/s390/char/tape_34xx.c +++ b/drivers/s390/char/tape_34xx.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #define KMSG_COMPONENT "tape_34xx" | 11 | #define KMSG_COMPONENT "tape_34xx" |
| 12 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
| 12 | 13 | ||
| 13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c index 0c72aadb8391..9821c5886613 100644 --- a/drivers/s390/char/tape_3590.c +++ b/drivers/s390/char/tape_3590.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #define KMSG_COMPONENT "tape_3590" | 11 | #define KMSG_COMPONENT "tape_3590" |
| 12 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
| 12 | 13 | ||
| 13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| @@ -136,7 +137,7 @@ static void int_to_ext_kekl(struct tape3592_kekl *in, | |||
| 136 | out->type_on_tape = TAPE390_KEKL_TYPE_LABEL; | 137 | out->type_on_tape = TAPE390_KEKL_TYPE_LABEL; |
| 137 | memcpy(out->label, in->label, sizeof(in->label)); | 138 | memcpy(out->label, in->label, sizeof(in->label)); |
| 138 | EBCASC(out->label, sizeof(in->label)); | 139 | EBCASC(out->label, sizeof(in->label)); |
| 139 | strstrip(out->label); | 140 | strim(out->label); |
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | static void int_to_ext_kekl_pair(struct tape3592_kekl_pair *in, | 143 | static void int_to_ext_kekl_pair(struct tape3592_kekl_pair *in, |
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 4799cc2f73c3..96816149368a 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #define KMSG_COMPONENT "tape" | 13 | #define KMSG_COMPONENT "tape" |
| 14 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
| 14 | 15 | ||
| 15 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
| 16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index 23d773a0d113..2125ec7d95f0 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c | |||
| @@ -10,6 +10,9 @@ | |||
| 10 | * Martin Schwidefsky <schwidefsky@de.ibm.com> | 10 | * Martin Schwidefsky <schwidefsky@de.ibm.com> |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #define KMSG_COMPONENT "tape" | ||
| 14 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
| 15 | |||
| 13 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 14 | #include <linux/types.h> | 17 | #include <linux/types.h> |
| 15 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_fs.h> |
diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c index ddc914ccea8f..b2864e3edb6d 100644 --- a/drivers/s390/char/tape_class.c +++ b/drivers/s390/char/tape_class.c | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | * Author: Stefan Bader <shbader@de.ibm.com> | 7 | * Author: Stefan Bader <shbader@de.ibm.com> |
| 8 | * Based on simple class device code by Greg K-H | 8 | * Based on simple class device code by Greg K-H |
| 9 | */ | 9 | */ |
| 10 | |||
| 11 | #define KMSG_COMPONENT "tape" | ||
| 12 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
| 13 | |||
| 10 | #include "tape_class.h" | 14 | #include "tape_class.h" |
| 11 | 15 | ||
| 12 | MODULE_AUTHOR("Stefan Bader <shbader@de.ibm.com>"); | 16 | MODULE_AUTHOR("Stefan Bader <shbader@de.ibm.com>"); |
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index f5d6802dc5da..81b094e480e6 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c | |||
| @@ -12,6 +12,8 @@ | |||
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #define KMSG_COMPONENT "tape" | 14 | #define KMSG_COMPONENT "tape" |
| 15 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
| 16 | |||
| 15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 16 | #include <linux/init.h> // for kernel parameters | 18 | #include <linux/init.h> // for kernel parameters |
| 17 | #include <linux/kmod.h> // for requesting modules | 19 | #include <linux/kmod.h> // for requesting modules |
diff --git a/drivers/s390/char/tape_proc.c b/drivers/s390/char/tape_proc.c index ebd820ccfb24..0ceb37984f77 100644 --- a/drivers/s390/char/tape_proc.c +++ b/drivers/s390/char/tape_proc.c | |||
| @@ -11,6 +11,9 @@ | |||
| 11 | * PROCFS Functions | 11 | * PROCFS Functions |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #define KMSG_COMPONENT "tape" | ||
| 15 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
| 16 | |||
| 14 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 15 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
| 16 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c index 750354ad16e5..03f07e5dd6e9 100644 --- a/drivers/s390/char/tape_std.c +++ b/drivers/s390/char/tape_std.c | |||
| @@ -11,6 +11,9 @@ | |||
| 11 | * Stefan Bader <shbader@de.ibm.com> | 11 | * Stefan Bader <shbader@de.ibm.com> |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #define KMSG_COMPONENT "tape" | ||
| 15 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
| 16 | |||
| 14 | #include <linux/stddef.h> | 17 | #include <linux/stddef.h> |
| 15 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 16 | #include <linux/bio.h> | 19 | #include <linux/bio.h> |
diff --git a/drivers/s390/cio/ccwreq.c b/drivers/s390/cio/ccwreq.c index 9509e3860934..7a28a3029a3f 100644 --- a/drivers/s390/cio/ccwreq.c +++ b/drivers/s390/cio/ccwreq.c | |||
| @@ -49,7 +49,6 @@ static u16 ccwreq_next_path(struct ccw_device *cdev) | |||
| 49 | */ | 49 | */ |
| 50 | static void ccwreq_stop(struct ccw_device *cdev, int rc) | 50 | static void ccwreq_stop(struct ccw_device *cdev, int rc) |
| 51 | { | 51 | { |
| 52 | struct subchannel *sch = to_subchannel(cdev->dev.parent); | ||
| 53 | struct ccw_request *req = &cdev->private->req; | 52 | struct ccw_request *req = &cdev->private->req; |
| 54 | 53 | ||
| 55 | if (req->done) | 54 | if (req->done) |
| @@ -57,7 +56,6 @@ static void ccwreq_stop(struct ccw_device *cdev, int rc) | |||
| 57 | req->done = 1; | 56 | req->done = 1; |
| 58 | ccw_device_set_timeout(cdev, 0); | 57 | ccw_device_set_timeout(cdev, 0); |
| 59 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | 58 | memset(&cdev->private->irb, 0, sizeof(struct irb)); |
| 60 | sch->lpm = sch->schib.pmcw.pam; | ||
| 61 | if (rc && rc != -ENODEV && req->drc) | 59 | if (rc && rc != -ENODEV && req->drc) |
| 62 | rc = req->drc; | 60 | rc = req->drc; |
| 63 | req->callback(cdev, req->data, rc); | 61 | req->callback(cdev, req->data, rc); |
| @@ -80,7 +78,6 @@ static void ccwreq_do(struct ccw_device *cdev) | |||
| 80 | continue; | 78 | continue; |
| 81 | } | 79 | } |
| 82 | /* Perform start function. */ | 80 | /* Perform start function. */ |
| 83 | sch->lpm = 0xff; | ||
| 84 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | 81 | memset(&cdev->private->irb, 0, sizeof(struct irb)); |
| 85 | rc = cio_start(sch, cp, (u8) req->mask); | 82 | rc = cio_start(sch, cp, (u8) req->mask); |
| 86 | if (rc == 0) { | 83 | if (rc == 0) { |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 73901c9e260f..a6c7d5426fb2 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
| @@ -1519,6 +1519,7 @@ static int ccw_device_console_enable(struct ccw_device *cdev, | |||
| 1519 | sch->driver = &io_subchannel_driver; | 1519 | sch->driver = &io_subchannel_driver; |
| 1520 | /* Initialize the ccw_device structure. */ | 1520 | /* Initialize the ccw_device structure. */ |
| 1521 | cdev->dev.parent= &sch->dev; | 1521 | cdev->dev.parent= &sch->dev; |
| 1522 | sch_set_cdev(sch, cdev); | ||
| 1522 | io_subchannel_recog(cdev, sch); | 1523 | io_subchannel_recog(cdev, sch); |
| 1523 | /* Now wait for the async. recognition to come to an end. */ | 1524 | /* Now wait for the async. recognition to come to an end. */ |
| 1524 | spin_lock_irq(cdev->ccwlock); | 1525 | spin_lock_irq(cdev->ccwlock); |
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c index aad188e43b4f..6facb5499a65 100644 --- a/drivers/s390/cio/device_pgid.c +++ b/drivers/s390/cio/device_pgid.c | |||
| @@ -142,7 +142,7 @@ static void spid_do(struct ccw_device *cdev) | |||
| 142 | u8 fn; | 142 | u8 fn; |
| 143 | 143 | ||
| 144 | /* Use next available path that is not already in correct state. */ | 144 | /* Use next available path that is not already in correct state. */ |
| 145 | req->lpm = lpm_adjust(req->lpm, sch->schib.pmcw.pam & ~sch->vpm); | 145 | req->lpm = lpm_adjust(req->lpm, cdev->private->pgid_todo_mask); |
| 146 | if (!req->lpm) | 146 | if (!req->lpm) |
| 147 | goto out_nopath; | 147 | goto out_nopath; |
| 148 | /* Channel program setup. */ | 148 | /* Channel program setup. */ |
| @@ -254,15 +254,15 @@ static void pgid_analyze(struct ccw_device *cdev, struct pgid **p, | |||
| 254 | *p = first; | 254 | *p = first; |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | static u8 pgid_to_vpm(struct ccw_device *cdev) | 257 | static u8 pgid_to_donepm(struct ccw_device *cdev) |
| 258 | { | 258 | { |
| 259 | struct subchannel *sch = to_subchannel(cdev->dev.parent); | 259 | struct subchannel *sch = to_subchannel(cdev->dev.parent); |
| 260 | struct pgid *pgid; | 260 | struct pgid *pgid; |
| 261 | int i; | 261 | int i; |
| 262 | int lpm; | 262 | int lpm; |
| 263 | u8 vpm = 0; | 263 | u8 donepm = 0; |
| 264 | 264 | ||
| 265 | /* Set VPM bits for paths which are already in the target state. */ | 265 | /* Set bits for paths which are already in the target state. */ |
| 266 | for (i = 0; i < 8; i++) { | 266 | for (i = 0; i < 8; i++) { |
| 267 | lpm = 0x80 >> i; | 267 | lpm = 0x80 >> i; |
| 268 | if ((cdev->private->pgid_valid_mask & lpm) == 0) | 268 | if ((cdev->private->pgid_valid_mask & lpm) == 0) |
| @@ -282,10 +282,10 @@ static u8 pgid_to_vpm(struct ccw_device *cdev) | |||
| 282 | if (pgid->inf.ps.state3 != SNID_STATE3_SINGLE_PATH) | 282 | if (pgid->inf.ps.state3 != SNID_STATE3_SINGLE_PATH) |
| 283 | continue; | 283 | continue; |
| 284 | } | 284 | } |
| 285 | vpm |= lpm; | 285 | donepm |= lpm; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | return vpm; | 288 | return donepm; |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | static void pgid_fill(struct ccw_device *cdev, struct pgid *pgid) | 291 | static void pgid_fill(struct ccw_device *cdev, struct pgid *pgid) |
| @@ -307,6 +307,7 @@ static void snid_done(struct ccw_device *cdev, int rc) | |||
| 307 | int mismatch = 0; | 307 | int mismatch = 0; |
| 308 | int reserved = 0; | 308 | int reserved = 0; |
| 309 | int reset = 0; | 309 | int reset = 0; |
| 310 | u8 donepm; | ||
| 310 | 311 | ||
| 311 | if (rc) | 312 | if (rc) |
| 312 | goto out; | 313 | goto out; |
| @@ -316,18 +317,20 @@ static void snid_done(struct ccw_device *cdev, int rc) | |||
| 316 | else if (mismatch) | 317 | else if (mismatch) |
| 317 | rc = -EOPNOTSUPP; | 318 | rc = -EOPNOTSUPP; |
| 318 | else { | 319 | else { |
| 319 | sch->vpm = pgid_to_vpm(cdev); | 320 | donepm = pgid_to_donepm(cdev); |
| 321 | sch->vpm = donepm & sch->opm; | ||
| 322 | cdev->private->pgid_todo_mask &= ~donepm; | ||
| 320 | pgid_fill(cdev, pgid); | 323 | pgid_fill(cdev, pgid); |
| 321 | } | 324 | } |
| 322 | out: | 325 | out: |
| 323 | CIO_MSG_EVENT(2, "snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x " | 326 | CIO_MSG_EVENT(2, "snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x " |
| 324 | "mism=%d rsvd=%d reset=%d\n", id->ssid, id->devno, rc, | 327 | "todo=%02x mism=%d rsvd=%d reset=%d\n", id->ssid, |
| 325 | cdev->private->pgid_valid_mask, sch->vpm, mismatch, | 328 | id->devno, rc, cdev->private->pgid_valid_mask, sch->vpm, |
| 326 | reserved, reset); | 329 | cdev->private->pgid_todo_mask, mismatch, reserved, reset); |
| 327 | switch (rc) { | 330 | switch (rc) { |
| 328 | case 0: | 331 | case 0: |
| 329 | /* Anything left to do? */ | 332 | /* Anything left to do? */ |
| 330 | if (sch->vpm == sch->schib.pmcw.pam) { | 333 | if (cdev->private->pgid_todo_mask == 0) { |
| 331 | verify_done(cdev, sch->vpm == 0 ? -EACCES : 0); | 334 | verify_done(cdev, sch->vpm == 0 ? -EACCES : 0); |
| 332 | return; | 335 | return; |
| 333 | } | 336 | } |
| @@ -411,6 +414,7 @@ static void verify_start(struct ccw_device *cdev) | |||
| 411 | struct ccw_dev_id *devid = &cdev->private->dev_id; | 414 | struct ccw_dev_id *devid = &cdev->private->dev_id; |
| 412 | 415 | ||
| 413 | sch->vpm = 0; | 416 | sch->vpm = 0; |
| 417 | sch->lpm = sch->schib.pmcw.pam; | ||
| 414 | /* Initialize request data. */ | 418 | /* Initialize request data. */ |
| 415 | memset(req, 0, sizeof(*req)); | 419 | memset(req, 0, sizeof(*req)); |
| 416 | req->timeout = PGID_TIMEOUT; | 420 | req->timeout = PGID_TIMEOUT; |
| @@ -442,11 +446,14 @@ static void verify_start(struct ccw_device *cdev) | |||
| 442 | */ | 446 | */ |
| 443 | void ccw_device_verify_start(struct ccw_device *cdev) | 447 | void ccw_device_verify_start(struct ccw_device *cdev) |
| 444 | { | 448 | { |
| 449 | struct subchannel *sch = to_subchannel(cdev->dev.parent); | ||
| 450 | |||
| 445 | CIO_TRACE_EVENT(4, "vrfy"); | 451 | CIO_TRACE_EVENT(4, "vrfy"); |
| 446 | CIO_HEX_EVENT(4, &cdev->private->dev_id, sizeof(cdev->private->dev_id)); | 452 | CIO_HEX_EVENT(4, &cdev->private->dev_id, sizeof(cdev->private->dev_id)); |
| 447 | /* Initialize PGID data. */ | 453 | /* Initialize PGID data. */ |
| 448 | memset(cdev->private->pgid, 0, sizeof(cdev->private->pgid)); | 454 | memset(cdev->private->pgid, 0, sizeof(cdev->private->pgid)); |
| 449 | cdev->private->pgid_valid_mask = 0; | 455 | cdev->private->pgid_valid_mask = 0; |
| 456 | cdev->private->pgid_todo_mask = sch->schib.pmcw.pam; | ||
| 450 | /* | 457 | /* |
| 451 | * Initialize pathgroup and multipath state with target values. | 458 | * Initialize pathgroup and multipath state with target values. |
| 452 | * They may change in the course of path verification. | 459 | * They may change in the course of path verification. |
diff --git a/drivers/s390/cio/fcx.c b/drivers/s390/cio/fcx.c index 61677dfbdc9b..ca5e9bb9d458 100644 --- a/drivers/s390/cio/fcx.c +++ b/drivers/s390/cio/fcx.c | |||
| @@ -163,7 +163,7 @@ void tcw_finalize(struct tcw *tcw, int num_tidaws) | |||
| 163 | /* Add tcat to tccb. */ | 163 | /* Add tcat to tccb. */ |
| 164 | tccb = tcw_get_tccb(tcw); | 164 | tccb = tcw_get_tccb(tcw); |
| 165 | tcat = (struct tccb_tcat *) &tccb->tca[tca_size(tccb)]; | 165 | tcat = (struct tccb_tcat *) &tccb->tca[tca_size(tccb)]; |
| 166 | memset(tcat, 0, sizeof(tcat)); | 166 | memset(tcat, 0, sizeof(*tcat)); |
| 167 | /* Calculate tcw input/output count and tcat transport count. */ | 167 | /* Calculate tcw input/output count and tcat transport count. */ |
| 168 | count = calc_dcw_count(tccb); | 168 | count = calc_dcw_count(tccb); |
| 169 | if (tcw->w && (tcw->flags & TCW_FLAGS_OUTPUT_TIDA)) | 169 | if (tcw->w && (tcw->flags & TCW_FLAGS_OUTPUT_TIDA)) |
| @@ -269,7 +269,7 @@ EXPORT_SYMBOL(tccb_init); | |||
| 269 | */ | 269 | */ |
| 270 | void tsb_init(struct tsb *tsb) | 270 | void tsb_init(struct tsb *tsb) |
| 271 | { | 271 | { |
| 272 | memset(tsb, 0, sizeof(tsb)); | 272 | memset(tsb, 0, sizeof(*tsb)); |
| 273 | } | 273 | } |
| 274 | EXPORT_SYMBOL(tsb_init); | 274 | EXPORT_SYMBOL(tsb_init); |
| 275 | 275 | ||
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h index d72ae4c93af9..b9ce712a7f25 100644 --- a/drivers/s390/cio/io_sch.h +++ b/drivers/s390/cio/io_sch.h | |||
| @@ -150,6 +150,7 @@ struct ccw_device_private { | |||
| 150 | struct ccw_request req; /* internal I/O request */ | 150 | struct ccw_request req; /* internal I/O request */ |
| 151 | int iretry; | 151 | int iretry; |
| 152 | u8 pgid_valid_mask; /* mask of valid PGIDs */ | 152 | u8 pgid_valid_mask; /* mask of valid PGIDs */ |
| 153 | u8 pgid_todo_mask; /* mask of PGIDs to be adjusted */ | ||
| 153 | struct { | 154 | struct { |
| 154 | unsigned int fast:1; /* post with "channel end" */ | 155 | unsigned int fast:1; /* post with "channel end" */ |
| 155 | unsigned int repall:1; /* report every interrupt status */ | 156 | unsigned int repall:1; /* report every interrupt status */ |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 4be6e84b9599..b2275c5000e7 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
| @@ -486,7 +486,8 @@ static int get_inbound_buffer_frontier(struct qdio_q *q) | |||
| 486 | case SLSB_P_INPUT_PRIMED: | 486 | case SLSB_P_INPUT_PRIMED: |
| 487 | inbound_primed(q, count); | 487 | inbound_primed(q, count); |
| 488 | q->first_to_check = add_buf(q->first_to_check, count); | 488 | q->first_to_check = add_buf(q->first_to_check, count); |
| 489 | atomic_sub(count, &q->nr_buf_used); | 489 | if (atomic_sub(count, &q->nr_buf_used) == 0) |
| 490 | qdio_perf_stat_inc(&perf_stats.inbound_queue_full); | ||
| 490 | break; | 491 | break; |
| 491 | case SLSB_P_INPUT_ERROR: | 492 | case SLSB_P_INPUT_ERROR: |
| 492 | announce_buffer_error(q, count); | 493 | announce_buffer_error(q, count); |
diff --git a/drivers/s390/cio/qdio_perf.c b/drivers/s390/cio/qdio_perf.c index 968e3c7c2632..54f7c325a3e6 100644 --- a/drivers/s390/cio/qdio_perf.c +++ b/drivers/s390/cio/qdio_perf.c | |||
| @@ -64,6 +64,8 @@ static int qdio_perf_proc_show(struct seq_file *m, void *v) | |||
| 64 | (long)atomic_long_read(&perf_stats.fast_requeue)); | 64 | (long)atomic_long_read(&perf_stats.fast_requeue)); |
| 65 | seq_printf(m, "Number of outbound target full condition\t: %li\n", | 65 | seq_printf(m, "Number of outbound target full condition\t: %li\n", |
| 66 | (long)atomic_long_read(&perf_stats.outbound_target_full)); | 66 | (long)atomic_long_read(&perf_stats.outbound_target_full)); |
| 67 | seq_printf(m, "Number of inbound queue full condition\t\t: %li\n", | ||
| 68 | (long)atomic_long_read(&perf_stats.inbound_queue_full)); | ||
| 67 | seq_printf(m, "Number of outbound tasklet mod_timer calls\t: %li\n", | 69 | seq_printf(m, "Number of outbound tasklet mod_timer calls\t: %li\n", |
| 68 | (long)atomic_long_read(&perf_stats.debug_tl_out_timer)); | 70 | (long)atomic_long_read(&perf_stats.debug_tl_out_timer)); |
| 69 | seq_printf(m, "Number of stop polling calls\t\t\t: %li\n", | 71 | seq_printf(m, "Number of stop polling calls\t\t\t: %li\n", |
diff --git a/drivers/s390/cio/qdio_perf.h b/drivers/s390/cio/qdio_perf.h index ff4504ce1e3c..12454231dc8b 100644 --- a/drivers/s390/cio/qdio_perf.h +++ b/drivers/s390/cio/qdio_perf.h | |||
| @@ -36,6 +36,7 @@ struct qdio_perf_stats { | |||
| 36 | atomic_long_t outbound_handler; | 36 | atomic_long_t outbound_handler; |
| 37 | atomic_long_t fast_requeue; | 37 | atomic_long_t fast_requeue; |
| 38 | atomic_long_t outbound_target_full; | 38 | atomic_long_t outbound_target_full; |
| 39 | atomic_long_t inbound_queue_full; | ||
| 39 | 40 | ||
| 40 | /* for debugging */ | 41 | /* for debugging */ |
| 41 | atomic_long_t debug_tl_out_timer; | 42 | atomic_long_t debug_tl_out_timer; |
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c index 18d54fc21ce9..8c2dea5fa2b4 100644 --- a/drivers/s390/cio/qdio_setup.c +++ b/drivers/s390/cio/qdio_setup.c | |||
| @@ -48,7 +48,6 @@ static void set_impl_params(struct qdio_irq *irq_ptr, | |||
| 48 | if (!irq_ptr) | 48 | if (!irq_ptr) |
| 49 | return; | 49 | return; |
| 50 | 50 | ||
| 51 | WARN_ON((unsigned long)&irq_ptr->qib & 0xff); | ||
| 52 | irq_ptr->qib.pfmt = qib_param_field_format; | 51 | irq_ptr->qib.pfmt = qib_param_field_format; |
| 53 | if (qib_param_field) | 52 | if (qib_param_field) |
| 54 | memcpy(irq_ptr->qib.parm, qib_param_field, | 53 | memcpy(irq_ptr->qib.parm, qib_param_field, |
| @@ -82,14 +81,12 @@ static int __qdio_allocate_qs(struct qdio_q **irq_ptr_qs, int nr_queues) | |||
| 82 | q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL); | 81 | q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL); |
| 83 | if (!q) | 82 | if (!q) |
| 84 | return -ENOMEM; | 83 | return -ENOMEM; |
| 85 | WARN_ON((unsigned long)q & 0xff); | ||
| 86 | 84 | ||
| 87 | q->slib = (struct slib *) __get_free_page(GFP_KERNEL); | 85 | q->slib = (struct slib *) __get_free_page(GFP_KERNEL); |
| 88 | if (!q->slib) { | 86 | if (!q->slib) { |
| 89 | kmem_cache_free(qdio_q_cache, q); | 87 | kmem_cache_free(qdio_q_cache, q); |
| 90 | return -ENOMEM; | 88 | return -ENOMEM; |
| 91 | } | 89 | } |
| 92 | WARN_ON((unsigned long)q->slib & 0x7ff); | ||
| 93 | irq_ptr_qs[i] = q; | 90 | irq_ptr_qs[i] = q; |
| 94 | } | 91 | } |
| 95 | return 0; | 92 | return 0; |
| @@ -131,7 +128,7 @@ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr, | |||
| 131 | /* fill in sbal */ | 128 | /* fill in sbal */ |
| 132 | for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) { | 129 | for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) { |
| 133 | q->sbal[j] = *sbals_array++; | 130 | q->sbal[j] = *sbals_array++; |
| 134 | WARN_ON((unsigned long)q->sbal[j] & 0xff); | 131 | BUG_ON((unsigned long)q->sbal[j] & 0xff); |
| 135 | } | 132 | } |
| 136 | 133 | ||
| 137 | /* fill in slib */ | 134 | /* fill in slib */ |
| @@ -147,11 +144,6 @@ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr, | |||
| 147 | /* fill in sl */ | 144 | /* fill in sl */ |
| 148 | for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) | 145 | for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) |
| 149 | q->sl->element[j].sbal = (unsigned long)q->sbal[j]; | 146 | q->sl->element[j].sbal = (unsigned long)q->sbal[j]; |
| 150 | |||
| 151 | DBF_EVENT("sl-slsb-sbal"); | ||
| 152 | DBF_HEX(q->sl, sizeof(void *)); | ||
| 153 | DBF_HEX(&q->slsb, sizeof(void *)); | ||
| 154 | DBF_HEX(q->sbal, sizeof(void *)); | ||
| 155 | } | 147 | } |
| 156 | 148 | ||
| 157 | static void setup_queues(struct qdio_irq *irq_ptr, | 149 | static void setup_queues(struct qdio_irq *irq_ptr, |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index da84fd03850f..088f32f29a6e 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
| @@ -368,7 +368,7 @@ config ALIM7101_WDT | |||
| 368 | 368 | ||
| 369 | config GEODE_WDT | 369 | config GEODE_WDT |
| 370 | tristate "AMD Geode CS5535/CS5536 Watchdog" | 370 | tristate "AMD Geode CS5535/CS5536 Watchdog" |
| 371 | depends on MGEODE_LX | 371 | depends on CS5535_MFGPT |
| 372 | help | 372 | help |
| 373 | This driver enables a watchdog capability built into the | 373 | This driver enables a watchdog capability built into the |
| 374 | CS5535/CS5536 companion chips for the AMD Geode GX and LX | 374 | CS5535/CS5536 companion chips for the AMD Geode GX and LX |
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 9acf0015a1e7..38252ff828ca 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* Watchdog timer for the Geode GX/LX with the CS5535/CS5536 companion chip | 1 | /* Watchdog timer for machines with the CS5535/CS5536 companion chip |
| 2 | * | 2 | * |
| 3 | * Copyright (C) 2006-2007, Advanced Micro Devices, Inc. | 3 | * Copyright (C) 2006-2007, Advanced Micro Devices, Inc. |
| 4 | * Copyright (C) 2009 Andres Salomon <dilinger@collabora.co.uk> | ||
| 4 | * | 5 | * |
| 5 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
| @@ -19,7 +20,7 @@ | |||
| 19 | #include <linux/reboot.h> | 20 | #include <linux/reboot.h> |
| 20 | #include <linux/uaccess.h> | 21 | #include <linux/uaccess.h> |
| 21 | 22 | ||
| 22 | #include <asm/geode.h> | 23 | #include <linux/cs5535.h> |
| 23 | 24 | ||
| 24 | #define GEODEWDT_HZ 500 | 25 | #define GEODEWDT_HZ 500 |
| 25 | #define GEODEWDT_SCALE 6 | 26 | #define GEODEWDT_SCALE 6 |
| @@ -46,25 +47,25 @@ MODULE_PARM_DESC(nowayout, | |||
| 46 | 47 | ||
| 47 | static struct platform_device *geodewdt_platform_device; | 48 | static struct platform_device *geodewdt_platform_device; |
| 48 | static unsigned long wdt_flags; | 49 | static unsigned long wdt_flags; |
| 49 | static int wdt_timer; | 50 | static struct cs5535_mfgpt_timer *wdt_timer; |
| 50 | static int safe_close; | 51 | static int safe_close; |
| 51 | 52 | ||
| 52 | static void geodewdt_ping(void) | 53 | static void geodewdt_ping(void) |
| 53 | { | 54 | { |
| 54 | /* Stop the counter */ | 55 | /* Stop the counter */ |
| 55 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | 56 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); |
| 56 | 57 | ||
| 57 | /* Reset the counter */ | 58 | /* Reset the counter */ |
| 58 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | 59 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); |
| 59 | 60 | ||
| 60 | /* Enable the counter */ | 61 | /* Enable the counter */ |
| 61 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | 62 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | static void geodewdt_disable(void) | 65 | static void geodewdt_disable(void) |
| 65 | { | 66 | { |
| 66 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | 67 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); |
| 67 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | 68 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); |
| 68 | } | 69 | } |
| 69 | 70 | ||
| 70 | static int geodewdt_set_heartbeat(int val) | 71 | static int geodewdt_set_heartbeat(int val) |
| @@ -72,10 +73,10 @@ static int geodewdt_set_heartbeat(int val) | |||
| 72 | if (val < 1 || val > GEODEWDT_MAX_SECONDS) | 73 | if (val < 1 || val > GEODEWDT_MAX_SECONDS) |
| 73 | return -EINVAL; | 74 | return -EINVAL; |
| 74 | 75 | ||
| 75 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | 76 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); |
| 76 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); | 77 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); |
| 77 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | 78 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); |
| 78 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | 79 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); |
| 79 | 80 | ||
| 80 | timeout = val; | 81 | timeout = val; |
| 81 | return 0; | 82 | return 0; |
| @@ -215,28 +216,25 @@ static struct miscdevice geodewdt_miscdev = { | |||
| 215 | 216 | ||
| 216 | static int __devinit geodewdt_probe(struct platform_device *dev) | 217 | static int __devinit geodewdt_probe(struct platform_device *dev) |
| 217 | { | 218 | { |
| 218 | int ret, timer; | 219 | int ret; |
| 219 | |||
| 220 | timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); | ||
| 221 | 220 | ||
| 222 | if (timer == -1) { | 221 | wdt_timer = cs5535_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); |
| 222 | if (!wdt_timer) { | ||
| 223 | printk(KERN_ERR "geodewdt: No timers were available\n"); | 223 | printk(KERN_ERR "geodewdt: No timers were available\n"); |
| 224 | return -ENODEV; | 224 | return -ENODEV; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | wdt_timer = timer; | ||
| 228 | |||
| 229 | /* Set up the timer */ | 227 | /* Set up the timer */ |
| 230 | 228 | ||
| 231 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, | 229 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, |
| 232 | GEODEWDT_SCALE | (3 << 8)); | 230 | GEODEWDT_SCALE | (3 << 8)); |
| 233 | 231 | ||
| 234 | /* Set up comparator 2 to reset when the event fires */ | 232 | /* Set up comparator 2 to reset when the event fires */ |
| 235 | geode_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); | 233 | cs5535_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); |
| 236 | 234 | ||
| 237 | /* Set up the initial timeout */ | 235 | /* Set up the initial timeout */ |
| 238 | 236 | ||
| 239 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, | 237 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, |
| 240 | timeout * GEODEWDT_HZ); | 238 | timeout * GEODEWDT_HZ); |
| 241 | 239 | ||
| 242 | ret = misc_register(&geodewdt_miscdev); | 240 | ret = misc_register(&geodewdt_miscdev); |
diff --git a/fs/proc/array.c b/fs/proc/array.c index 4badde179b18..f560325c444f 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
| @@ -134,13 +134,16 @@ static inline void task_name(struct seq_file *m, struct task_struct *p) | |||
| 134 | * simple bit tests. | 134 | * simple bit tests. |
| 135 | */ | 135 | */ |
| 136 | static const char *task_state_array[] = { | 136 | static const char *task_state_array[] = { |
| 137 | "R (running)", /* 0 */ | 137 | "R (running)", /* 0 */ |
| 138 | "S (sleeping)", /* 1 */ | 138 | "S (sleeping)", /* 1 */ |
| 139 | "D (disk sleep)", /* 2 */ | 139 | "D (disk sleep)", /* 2 */ |
| 140 | "T (stopped)", /* 4 */ | 140 | "T (stopped)", /* 4 */ |
| 141 | "T (tracing stop)", /* 8 */ | 141 | "t (tracing stop)", /* 8 */ |
| 142 | "Z (zombie)", /* 16 */ | 142 | "Z (zombie)", /* 16 */ |
| 143 | "X (dead)" /* 32 */ | 143 | "X (dead)", /* 32 */ |
| 144 | "x (dead)", /* 64 */ | ||
| 145 | "K (wakekill)", /* 128 */ | ||
| 146 | "W (waking)", /* 256 */ | ||
| 144 | }; | 147 | }; |
| 145 | 148 | ||
| 146 | static inline const char *get_task_state(struct task_struct *tsk) | 149 | static inline const char *get_task_state(struct task_struct *tsk) |
| @@ -148,6 +151,8 @@ static inline const char *get_task_state(struct task_struct *tsk) | |||
| 148 | unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; | 151 | unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; |
| 149 | const char **p = &task_state_array[0]; | 152 | const char **p = &task_state_array[0]; |
| 150 | 153 | ||
| 154 | BUILD_BUG_ON(1 + ilog2(TASK_STATE_MAX) != ARRAY_SIZE(task_state_array)); | ||
| 155 | |||
| 151 | while (state) { | 156 | while (state) { |
| 152 | p++; | 157 | p++; |
| 153 | state >>= 1; | 158 | state >>= 1; |
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h index 12ff8c3f1d05..5032b9a31ae7 100644 --- a/include/linux/decompress/mm.h +++ b/include/linux/decompress/mm.h | |||
| @@ -25,7 +25,7 @@ static void *malloc(int size) | |||
| 25 | void *p; | 25 | void *p; |
| 26 | 26 | ||
| 27 | if (size < 0) | 27 | if (size < 0) |
| 28 | error("Malloc error"); | 28 | return NULL; |
| 29 | if (!malloc_ptr) | 29 | if (!malloc_ptr) |
| 30 | malloc_ptr = free_mem_ptr; | 30 | malloc_ptr = free_mem_ptr; |
| 31 | 31 | ||
| @@ -35,7 +35,7 @@ static void *malloc(int size) | |||
| 35 | malloc_ptr += size; | 35 | malloc_ptr += size; |
| 36 | 36 | ||
| 37 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) | 37 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) |
| 38 | error("Out of memory"); | 38 | return NULL; |
| 39 | 39 | ||
| 40 | malloc_count++; | 40 | malloc_count++; |
| 41 | return p; | 41 | return p; |
diff --git a/include/linux/elf.h b/include/linux/elf.h index 90a4ed0ea0e5..0cc4d55151b7 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h | |||
| @@ -361,7 +361,7 @@ typedef struct elf64_shdr { | |||
| 361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ | 361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ |
| 362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ | 362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ |
| 363 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ | 363 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ |
| 364 | #define NT_PRXSTATUS 0x300 /* s390 upper register halves */ | 364 | #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ |
| 365 | 365 | ||
| 366 | 366 | ||
| 367 | /* Note header in a PT_NOTE section */ | 367 | /* Note header in a PT_NOTE section */ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 849b4a61bd8f..2265f28eb47a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -1037,6 +1037,9 @@ extern void add_active_range(unsigned int nid, unsigned long start_pfn, | |||
| 1037 | extern void remove_active_range(unsigned int nid, unsigned long start_pfn, | 1037 | extern void remove_active_range(unsigned int nid, unsigned long start_pfn, |
| 1038 | unsigned long end_pfn); | 1038 | unsigned long end_pfn); |
| 1039 | extern void remove_all_active_ranges(void); | 1039 | extern void remove_all_active_ranges(void); |
| 1040 | void sort_node_map(void); | ||
| 1041 | unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, | ||
| 1042 | unsigned long end_pfn); | ||
| 1040 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, | 1043 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, |
| 1041 | unsigned long end_pfn); | 1044 | unsigned long end_pfn); |
| 1042 | extern void get_pfn_range_for_nid(unsigned int nid, | 1045 | extern void get_pfn_range_for_nid(unsigned int nid, |
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h deleted file mode 100644 index e3fb25606706..000000000000 --- a/include/linux/perf_counter.h +++ /dev/null | |||
| @@ -1,444 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * NOTE: this file will be removed in a future kernel release, it is | ||
| 3 | * provided as a courtesy copy of user-space code that relies on the | ||
| 4 | * old (pre-rename) symbols and constants. | ||
| 5 | * | ||
| 6 | * Performance events: | ||
| 7 | * | ||
| 8 | * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> | ||
| 9 | * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar | ||
| 10 | * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra | ||
| 11 | * | ||
| 12 | * Data type definitions, declarations, prototypes. | ||
| 13 | * | ||
| 14 | * Started by: Thomas Gleixner and Ingo Molnar | ||
| 15 | * | ||
| 16 | * For licencing details see kernel-base/COPYING | ||
| 17 | */ | ||
| 18 | #ifndef _LINUX_PERF_COUNTER_H | ||
| 19 | #define _LINUX_PERF_COUNTER_H | ||
| 20 | |||
| 21 | #include <linux/types.h> | ||
| 22 | #include <linux/ioctl.h> | ||
| 23 | #include <asm/byteorder.h> | ||
| 24 | |||
| 25 | /* | ||
| 26 | * User-space ABI bits: | ||
| 27 | */ | ||
| 28 | |||
| 29 | /* | ||
| 30 | * attr.type | ||
| 31 | */ | ||
| 32 | enum perf_type_id { | ||
| 33 | PERF_TYPE_HARDWARE = 0, | ||
| 34 | PERF_TYPE_SOFTWARE = 1, | ||
| 35 | PERF_TYPE_TRACEPOINT = 2, | ||
| 36 | PERF_TYPE_HW_CACHE = 3, | ||
| 37 | PERF_TYPE_RAW = 4, | ||
| 38 | |||
| 39 | PERF_TYPE_MAX, /* non-ABI */ | ||
| 40 | }; | ||
| 41 | |||
| 42 | /* | ||
| 43 | * Generalized performance counter event types, used by the | ||
| 44 | * attr.event_id parameter of the sys_perf_counter_open() | ||
| 45 | * syscall: | ||
| 46 | */ | ||
| 47 | enum perf_hw_id { | ||
| 48 | /* | ||
| 49 | * Common hardware events, generalized by the kernel: | ||
| 50 | */ | ||
| 51 | PERF_COUNT_HW_CPU_CYCLES = 0, | ||
| 52 | PERF_COUNT_HW_INSTRUCTIONS = 1, | ||
| 53 | PERF_COUNT_HW_CACHE_REFERENCES = 2, | ||
| 54 | PERF_COUNT_HW_CACHE_MISSES = 3, | ||
| 55 | PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, | ||
| 56 | PERF_COUNT_HW_BRANCH_MISSES = 5, | ||
| 57 | PERF_COUNT_HW_BUS_CYCLES = 6, | ||
| 58 | |||
| 59 | PERF_COUNT_HW_MAX, /* non-ABI */ | ||
| 60 | }; | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Generalized hardware cache counters: | ||
| 64 | * | ||
| 65 | * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x | ||
| 66 | * { read, write, prefetch } x | ||
| 67 | * { accesses, misses } | ||
| 68 | */ | ||
| 69 | enum perf_hw_cache_id { | ||
| 70 | PERF_COUNT_HW_CACHE_L1D = 0, | ||
| 71 | PERF_COUNT_HW_CACHE_L1I = 1, | ||
| 72 | PERF_COUNT_HW_CACHE_LL = 2, | ||
| 73 | PERF_COUNT_HW_CACHE_DTLB = 3, | ||
| 74 | PERF_COUNT_HW_CACHE_ITLB = 4, | ||
| 75 | PERF_COUNT_HW_CACHE_BPU = 5, | ||
| 76 | |||
| 77 | PERF_COUNT_HW_CACHE_MAX, /* non-ABI */ | ||
| 78 | }; | ||
| 79 | |||
| 80 | enum perf_hw_cache_op_id { | ||
| 81 | PERF_COUNT_HW_CACHE_OP_READ = 0, | ||
| 82 | PERF_COUNT_HW_CACHE_OP_WRITE = 1, | ||
| 83 | PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, | ||
| 84 | |||
| 85 | PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */ | ||
| 86 | }; | ||
| 87 | |||
| 88 | enum perf_hw_cache_op_result_id { | ||
| 89 | PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, | ||
| 90 | PERF_COUNT_HW_CACHE_RESULT_MISS = 1, | ||
| 91 | |||
| 92 | PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */ | ||
| 93 | }; | ||
| 94 | |||
| 95 | /* | ||
| 96 | * Special "software" counters provided by the kernel, even if the hardware | ||
| 97 | * does not support performance counters. These counters measure various | ||
| 98 | * physical and sw events of the kernel (and allow the profiling of them as | ||
| 99 | * well): | ||
| 100 | */ | ||
| 101 | enum perf_sw_ids { | ||
| 102 | PERF_COUNT_SW_CPU_CLOCK = 0, | ||
| 103 | PERF_COUNT_SW_TASK_CLOCK = 1, | ||
| 104 | PERF_COUNT_SW_PAGE_FAULTS = 2, | ||
| 105 | PERF_COUNT_SW_CONTEXT_SWITCHES = 3, | ||
| 106 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, | ||
| 107 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, | ||
| 108 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, | ||
| 109 | PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, | ||
| 110 | PERF_COUNT_SW_EMULATION_FAULTS = 8, | ||
| 111 | |||
| 112 | PERF_COUNT_SW_MAX, /* non-ABI */ | ||
| 113 | }; | ||
| 114 | |||
| 115 | /* | ||
| 116 | * Bits that can be set in attr.sample_type to request information | ||
| 117 | * in the overflow packets. | ||
| 118 | */ | ||
| 119 | enum perf_counter_sample_format { | ||
| 120 | PERF_SAMPLE_IP = 1U << 0, | ||
| 121 | PERF_SAMPLE_TID = 1U << 1, | ||
| 122 | PERF_SAMPLE_TIME = 1U << 2, | ||
| 123 | PERF_SAMPLE_ADDR = 1U << 3, | ||
| 124 | PERF_SAMPLE_READ = 1U << 4, | ||
| 125 | PERF_SAMPLE_CALLCHAIN = 1U << 5, | ||
| 126 | PERF_SAMPLE_ID = 1U << 6, | ||
| 127 | PERF_SAMPLE_CPU = 1U << 7, | ||
| 128 | PERF_SAMPLE_PERIOD = 1U << 8, | ||
| 129 | PERF_SAMPLE_STREAM_ID = 1U << 9, | ||
| 130 | PERF_SAMPLE_RAW = 1U << 10, | ||
| 131 | |||
| 132 | PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ | ||
| 133 | }; | ||
| 134 | |||
| 135 | /* | ||
| 136 | * The format of the data returned by read() on a perf counter fd, | ||
| 137 | * as specified by attr.read_format: | ||
| 138 | * | ||
| 139 | * struct read_format { | ||
| 140 | * { u64 value; | ||
| 141 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
| 142 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
| 143 | * { u64 id; } && PERF_FORMAT_ID | ||
| 144 | * } && !PERF_FORMAT_GROUP | ||
| 145 | * | ||
| 146 | * { u64 nr; | ||
| 147 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
| 148 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
| 149 | * { u64 value; | ||
| 150 | * { u64 id; } && PERF_FORMAT_ID | ||
| 151 | * } cntr[nr]; | ||
| 152 | * } && PERF_FORMAT_GROUP | ||
| 153 | * }; | ||
| 154 | */ | ||
| 155 | enum perf_counter_read_format { | ||
| 156 | PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, | ||
| 157 | PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, | ||
| 158 | PERF_FORMAT_ID = 1U << 2, | ||
| 159 | PERF_FORMAT_GROUP = 1U << 3, | ||
| 160 | |||
| 161 | PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ | ||
| 162 | }; | ||
| 163 | |||
| 164 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ | ||
| 165 | |||
| 166 | /* | ||
| 167 | * Hardware event to monitor via a performance monitoring counter: | ||
| 168 | */ | ||
| 169 | struct perf_counter_attr { | ||
| 170 | |||
| 171 | /* | ||
| 172 | * Major type: hardware/software/tracepoint/etc. | ||
| 173 | */ | ||
| 174 | __u32 type; | ||
| 175 | |||
| 176 | /* | ||
| 177 | * Size of the attr structure, for fwd/bwd compat. | ||
| 178 | */ | ||
| 179 | __u32 size; | ||
| 180 | |||
| 181 | /* | ||
| 182 | * Type specific configuration information. | ||
| 183 | */ | ||
| 184 | __u64 config; | ||
| 185 | |||
| 186 | union { | ||
| 187 | __u64 sample_period; | ||
| 188 | __u64 sample_freq; | ||
| 189 | }; | ||
| 190 | |||
| 191 | __u64 sample_type; | ||
| 192 | __u64 read_format; | ||
| 193 | |||
| 194 | __u64 disabled : 1, /* off by default */ | ||
| 195 | inherit : 1, /* children inherit it */ | ||
| 196 | pinned : 1, /* must always be on PMU */ | ||
| 197 | exclusive : 1, /* only group on PMU */ | ||
| 198 | exclude_user : 1, /* don't count user */ | ||
| 199 | exclude_kernel : 1, /* ditto kernel */ | ||
| 200 | exclude_hv : 1, /* ditto hypervisor */ | ||
| 201 | exclude_idle : 1, /* don't count when idle */ | ||
| 202 | mmap : 1, /* include mmap data */ | ||
| 203 | comm : 1, /* include comm data */ | ||
| 204 | freq : 1, /* use freq, not period */ | ||
| 205 | inherit_stat : 1, /* per task counts */ | ||
| 206 | enable_on_exec : 1, /* next exec enables */ | ||
| 207 | task : 1, /* trace fork/exit */ | ||
| 208 | watermark : 1, /* wakeup_watermark */ | ||
| 209 | |||
| 210 | __reserved_1 : 49; | ||
| 211 | |||
| 212 | union { | ||
| 213 | __u32 wakeup_events; /* wakeup every n events */ | ||
| 214 | __u32 wakeup_watermark; /* bytes before wakeup */ | ||
| 215 | }; | ||
| 216 | __u32 __reserved_2; | ||
| 217 | |||
| 218 | __u64 __reserved_3; | ||
| 219 | }; | ||
| 220 | |||
| 221 | /* | ||
| 222 | * Ioctls that can be done on a perf counter fd: | ||
| 223 | */ | ||
| 224 | #define PERF_COUNTER_IOC_ENABLE _IO ('$', 0) | ||
| 225 | #define PERF_COUNTER_IOC_DISABLE _IO ('$', 1) | ||
| 226 | #define PERF_COUNTER_IOC_REFRESH _IO ('$', 2) | ||
| 227 | #define PERF_COUNTER_IOC_RESET _IO ('$', 3) | ||
| 228 | #define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64) | ||
| 229 | #define PERF_COUNTER_IOC_SET_OUTPUT _IO ('$', 5) | ||
| 230 | #define PERF_COUNTER_IOC_SET_FILTER _IOW('$', 6, char *) | ||
| 231 | |||
| 232 | enum perf_counter_ioc_flags { | ||
| 233 | PERF_IOC_FLAG_GROUP = 1U << 0, | ||
| 234 | }; | ||
| 235 | |||
| 236 | /* | ||
| 237 | * Structure of the page that can be mapped via mmap | ||
| 238 | */ | ||
| 239 | struct perf_counter_mmap_page { | ||
| 240 | __u32 version; /* version number of this structure */ | ||
| 241 | __u32 compat_version; /* lowest version this is compat with */ | ||
| 242 | |||
| 243 | /* | ||
| 244 | * Bits needed to read the hw counters in user-space. | ||
| 245 | * | ||
| 246 | * u32 seq; | ||
| 247 | * s64 count; | ||
| 248 | * | ||
| 249 | * do { | ||
| 250 | * seq = pc->lock; | ||
| 251 | * | ||
| 252 | * barrier() | ||
| 253 | * if (pc->index) { | ||
| 254 | * count = pmc_read(pc->index - 1); | ||
| 255 | * count += pc->offset; | ||
| 256 | * } else | ||
| 257 | * goto regular_read; | ||
| 258 | * | ||
| 259 | * barrier(); | ||
| 260 | * } while (pc->lock != seq); | ||
| 261 | * | ||
| 262 | * NOTE: for obvious reason this only works on self-monitoring | ||
| 263 | * processes. | ||
| 264 | */ | ||
| 265 | __u32 lock; /* seqlock for synchronization */ | ||
| 266 | __u32 index; /* hardware counter identifier */ | ||
| 267 | __s64 offset; /* add to hardware counter value */ | ||
| 268 | __u64 time_enabled; /* time counter active */ | ||
| 269 | __u64 time_running; /* time counter on cpu */ | ||
| 270 | |||
| 271 | /* | ||
| 272 | * Hole for extension of the self monitor capabilities | ||
| 273 | */ | ||
| 274 | |||
| 275 | __u64 __reserved[123]; /* align to 1k */ | ||
| 276 | |||
| 277 | /* | ||
| 278 | * Control data for the mmap() data buffer. | ||
| 279 | * | ||
| 280 | * User-space reading the @data_head value should issue an rmb(), on | ||
| 281 | * SMP capable platforms, after reading this value -- see | ||
| 282 | * perf_counter_wakeup(). | ||
| 283 | * | ||
| 284 | * When the mapping is PROT_WRITE the @data_tail value should be | ||
| 285 | * written by userspace to reflect the last read data. In this case | ||
| 286 | * the kernel will not over-write unread data. | ||
| 287 | */ | ||
| 288 | __u64 data_head; /* head in the data section */ | ||
| 289 | __u64 data_tail; /* user-space written tail */ | ||
| 290 | }; | ||
| 291 | |||
| 292 | #define PERF_EVENT_MISC_CPUMODE_MASK (3 << 0) | ||
| 293 | #define PERF_EVENT_MISC_CPUMODE_UNKNOWN (0 << 0) | ||
| 294 | #define PERF_EVENT_MISC_KERNEL (1 << 0) | ||
| 295 | #define PERF_EVENT_MISC_USER (2 << 0) | ||
| 296 | #define PERF_EVENT_MISC_HYPERVISOR (3 << 0) | ||
| 297 | |||
| 298 | struct perf_event_header { | ||
| 299 | __u32 type; | ||
| 300 | __u16 misc; | ||
| 301 | __u16 size; | ||
| 302 | }; | ||
| 303 | |||
| 304 | enum perf_event_type { | ||
| 305 | |||
| 306 | /* | ||
| 307 | * The MMAP events record the PROT_EXEC mappings so that we can | ||
| 308 | * correlate userspace IPs to code. They have the following structure: | ||
| 309 | * | ||
| 310 | * struct { | ||
| 311 | * struct perf_event_header header; | ||
| 312 | * | ||
| 313 | * u32 pid, tid; | ||
| 314 | * u64 addr; | ||
| 315 | * u64 len; | ||
| 316 | * u64 pgoff; | ||
| 317 | * char filename[]; | ||
| 318 | * }; | ||
| 319 | */ | ||
| 320 | PERF_EVENT_MMAP = 1, | ||
| 321 | |||
| 322 | /* | ||
| 323 | * struct { | ||
| 324 | * struct perf_event_header header; | ||
| 325 | * u64 id; | ||
| 326 | * u64 lost; | ||
| 327 | * }; | ||
| 328 | */ | ||
| 329 | PERF_EVENT_LOST = 2, | ||
| 330 | |||
| 331 | /* | ||
| 332 | * struct { | ||
| 333 | * struct perf_event_header header; | ||
| 334 | * | ||
| 335 | * u32 pid, tid; | ||
| 336 | * char comm[]; | ||
| 337 | * }; | ||
| 338 | */ | ||
| 339 | PERF_EVENT_COMM = 3, | ||
| 340 | |||
| 341 | /* | ||
| 342 | * struct { | ||
| 343 | * struct perf_event_header header; | ||
| 344 | * u32 pid, ppid; | ||
| 345 | * u32 tid, ptid; | ||
| 346 | * u64 time; | ||
| 347 | * }; | ||
| 348 | */ | ||
| 349 | PERF_EVENT_EXIT = 4, | ||
| 350 | |||
| 351 | /* | ||
| 352 | * struct { | ||
| 353 | * struct perf_event_header header; | ||
| 354 | * u64 time; | ||
| 355 | * u64 id; | ||
| 356 | * u64 stream_id; | ||
| 357 | * }; | ||
| 358 | */ | ||
| 359 | PERF_EVENT_THROTTLE = 5, | ||
| 360 | PERF_EVENT_UNTHROTTLE = 6, | ||
| 361 | |||
| 362 | /* | ||
| 363 | * struct { | ||
| 364 | * struct perf_event_header header; | ||
| 365 | * u32 pid, ppid; | ||
| 366 | * u32 tid, ptid; | ||
| 367 | * u64 time; | ||
| 368 | * }; | ||
| 369 | */ | ||
| 370 | PERF_EVENT_FORK = 7, | ||
| 371 | |||
| 372 | /* | ||
| 373 | * struct { | ||
| 374 | * struct perf_event_header header; | ||
| 375 | * u32 pid, tid; | ||
| 376 | * | ||
| 377 | * struct read_format values; | ||
| 378 | * }; | ||
| 379 | */ | ||
| 380 | PERF_EVENT_READ = 8, | ||
| 381 | |||
| 382 | /* | ||
| 383 | * struct { | ||
| 384 | * struct perf_event_header header; | ||
| 385 | * | ||
| 386 | * { u64 ip; } && PERF_SAMPLE_IP | ||
| 387 | * { u32 pid, tid; } && PERF_SAMPLE_TID | ||
| 388 | * { u64 time; } && PERF_SAMPLE_TIME | ||
| 389 | * { u64 addr; } && PERF_SAMPLE_ADDR | ||
| 390 | * { u64 id; } && PERF_SAMPLE_ID | ||
| 391 | * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID | ||
| 392 | * { u32 cpu, res; } && PERF_SAMPLE_CPU | ||
| 393 | * { u64 period; } && PERF_SAMPLE_PERIOD | ||
| 394 | * | ||
| 395 | * { struct read_format values; } && PERF_SAMPLE_READ | ||
| 396 | * | ||
| 397 | * { u64 nr, | ||
| 398 | * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN | ||
| 399 | * | ||
| 400 | * # | ||
| 401 | * # The RAW record below is opaque data wrt the ABI | ||
| 402 | * # | ||
| 403 | * # That is, the ABI doesn't make any promises wrt to | ||
| 404 | * # the stability of its content, it may vary depending | ||
| 405 | * # on event, hardware, kernel version and phase of | ||
| 406 | * # the moon. | ||
| 407 | * # | ||
| 408 | * # In other words, PERF_SAMPLE_RAW contents are not an ABI. | ||
| 409 | * # | ||
| 410 | * | ||
| 411 | * { u32 size; | ||
| 412 | * char data[size];}&& PERF_SAMPLE_RAW | ||
| 413 | * }; | ||
| 414 | */ | ||
| 415 | PERF_EVENT_SAMPLE = 9, | ||
| 416 | |||
| 417 | PERF_EVENT_MAX, /* non-ABI */ | ||
| 418 | }; | ||
| 419 | |||
| 420 | enum perf_callchain_context { | ||
| 421 | PERF_CONTEXT_HV = (__u64)-32, | ||
| 422 | PERF_CONTEXT_KERNEL = (__u64)-128, | ||
| 423 | PERF_CONTEXT_USER = (__u64)-512, | ||
| 424 | |||
| 425 | PERF_CONTEXT_GUEST = (__u64)-2048, | ||
| 426 | PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176, | ||
| 427 | PERF_CONTEXT_GUEST_USER = (__u64)-2560, | ||
| 428 | |||
| 429 | PERF_CONTEXT_MAX = (__u64)-4095, | ||
| 430 | }; | ||
| 431 | |||
| 432 | #define PERF_FLAG_FD_NO_GROUP (1U << 0) | ||
| 433 | #define PERF_FLAG_FD_OUTPUT (1U << 1) | ||
| 434 | |||
| 435 | /* | ||
| 436 | * In case some app still references the old symbols: | ||
| 437 | */ | ||
| 438 | |||
| 439 | #define __NR_perf_counter_open __NR_perf_event_open | ||
| 440 | |||
| 441 | #define PR_TASK_PERF_COUNTERS_DISABLE PR_TASK_PERF_EVENTS_DISABLE | ||
| 442 | #define PR_TASK_PERF_COUNTERS_ENABLE PR_TASK_PERF_EVENTS_ENABLE | ||
| 443 | |||
| 444 | #endif /* _LINUX_PERF_COUNTER_H */ | ||
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index c4ba9a78721e..96cc307ed9f4 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
| @@ -101,4 +101,9 @@ static inline void exit_rcu(void) | |||
| 101 | { | 101 | { |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | static inline int rcu_preempt_depth(void) | ||
| 105 | { | ||
| 106 | return 0; | ||
| 107 | } | ||
| 108 | |||
| 104 | #endif /* __LINUX_RCUTINY_H */ | 109 | #endif /* __LINUX_RCUTINY_H */ |
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index c93eee5911b0..8044b1b94333 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
| @@ -45,6 +45,12 @@ extern void __rcu_read_unlock(void); | |||
| 45 | extern void synchronize_rcu(void); | 45 | extern void synchronize_rcu(void); |
| 46 | extern void exit_rcu(void); | 46 | extern void exit_rcu(void); |
| 47 | 47 | ||
| 48 | /* | ||
| 49 | * Defined as macro as it is a very low level header | ||
| 50 | * included from areas that don't even know about current | ||
| 51 | */ | ||
| 52 | #define rcu_preempt_depth() (current->rcu_read_lock_nesting) | ||
| 53 | |||
| 48 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | 54 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 49 | 55 | ||
| 50 | static inline void __rcu_read_lock(void) | 56 | static inline void __rcu_read_lock(void) |
| @@ -63,6 +69,11 @@ static inline void exit_rcu(void) | |||
| 63 | { | 69 | { |
| 64 | } | 70 | } |
| 65 | 71 | ||
| 72 | static inline int rcu_preempt_depth(void) | ||
| 73 | { | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 66 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ | 77 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 67 | 78 | ||
| 68 | static inline void __rcu_read_lock_bh(void) | 79 | static inline void __rcu_read_lock_bh(void) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index e89857812be6..f2f842db03ce 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -192,6 +192,12 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
| 192 | #define TASK_DEAD 64 | 192 | #define TASK_DEAD 64 |
| 193 | #define TASK_WAKEKILL 128 | 193 | #define TASK_WAKEKILL 128 |
| 194 | #define TASK_WAKING 256 | 194 | #define TASK_WAKING 256 |
| 195 | #define TASK_STATE_MAX 512 | ||
| 196 | |||
| 197 | #define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" | ||
| 198 | |||
| 199 | extern char ___assert_task_state[1 - 2*!!( | ||
| 200 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; | ||
| 195 | 201 | ||
| 196 | /* Convenience macros for the sake of set_task_state */ | 202 | /* Convenience macros for the sake of set_task_state */ |
| 197 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) | 203 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) |
| @@ -1091,7 +1097,8 @@ struct sched_class { | |||
| 1091 | enum cpu_idle_type idle); | 1097 | enum cpu_idle_type idle); |
| 1092 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | 1098 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); |
| 1093 | void (*post_schedule) (struct rq *this_rq); | 1099 | void (*post_schedule) (struct rq *this_rq); |
| 1094 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 1100 | void (*task_waking) (struct rq *this_rq, struct task_struct *task); |
| 1101 | void (*task_woken) (struct rq *this_rq, struct task_struct *task); | ||
| 1095 | 1102 | ||
| 1096 | void (*set_cpus_allowed)(struct task_struct *p, | 1103 | void (*set_cpus_allowed)(struct task_struct *p, |
| 1097 | const struct cpumask *newmask); | 1104 | const struct cpumask *newmask); |
| @@ -1115,7 +1122,7 @@ struct sched_class { | |||
| 1115 | struct task_struct *task); | 1122 | struct task_struct *task); |
| 1116 | 1123 | ||
| 1117 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1124 | #ifdef CONFIG_FAIR_GROUP_SCHED |
| 1118 | void (*moved_group) (struct task_struct *p); | 1125 | void (*moved_group) (struct task_struct *p, int on_rq); |
| 1119 | #endif | 1126 | #endif |
| 1120 | }; | 1127 | }; |
| 1121 | 1128 | ||
| @@ -2594,8 +2601,6 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | |||
| 2594 | } | 2601 | } |
| 2595 | #endif /* CONFIG_MM_OWNER */ | 2602 | #endif /* CONFIG_MM_OWNER */ |
| 2596 | 2603 | ||
| 2597 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" | ||
| 2598 | |||
| 2599 | #endif /* __KERNEL__ */ | 2604 | #endif /* __KERNEL__ */ |
| 2600 | 2605 | ||
| 2601 | #endif | 2606 | #endif |
diff --git a/init/initramfs.c b/init/initramfs.c index 4c00edc59689..b37d34beb90b 100644 --- a/init/initramfs.c +++ b/init/initramfs.c | |||
| @@ -413,7 +413,7 @@ static unsigned my_inptr; /* index of next byte to be processed in inbuf */ | |||
| 413 | 413 | ||
| 414 | static char * __init unpack_to_rootfs(char *buf, unsigned len) | 414 | static char * __init unpack_to_rootfs(char *buf, unsigned len) |
| 415 | { | 415 | { |
| 416 | int written; | 416 | int written, res; |
| 417 | decompress_fn decompress; | 417 | decompress_fn decompress; |
| 418 | const char *compress_name; | 418 | const char *compress_name; |
| 419 | static __initdata char msg_buf[64]; | 419 | static __initdata char msg_buf[64]; |
| @@ -445,10 +445,12 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len) | |||
| 445 | } | 445 | } |
| 446 | this_header = 0; | 446 | this_header = 0; |
| 447 | decompress = decompress_method(buf, len, &compress_name); | 447 | decompress = decompress_method(buf, len, &compress_name); |
| 448 | if (decompress) | 448 | if (decompress) { |
| 449 | decompress(buf, len, NULL, flush_buffer, NULL, | 449 | res = decompress(buf, len, NULL, flush_buffer, NULL, |
| 450 | &my_inptr, error); | 450 | &my_inptr, error); |
| 451 | else if (compress_name) { | 451 | if (res) |
| 452 | error("decompressor failed"); | ||
| 453 | } else if (compress_name) { | ||
| 452 | if (!message) { | 454 | if (!message) { |
| 453 | snprintf(msg_buf, sizeof msg_buf, | 455 | snprintf(msg_buf, sizeof msg_buf, |
| 454 | "compression method %s not configured", | 456 | "compression method %s not configured", |
diff --git a/init/main.c b/init/main.c index c3db4a98b369..dac44a9356a5 100644 --- a/init/main.c +++ b/init/main.c | |||
| @@ -369,12 +369,6 @@ static void __init smp_init(void) | |||
| 369 | { | 369 | { |
| 370 | unsigned int cpu; | 370 | unsigned int cpu; |
| 371 | 371 | ||
| 372 | /* | ||
| 373 | * Set up the current CPU as possible to migrate to. | ||
| 374 | * The other ones will be done by cpu_up/cpu_down() | ||
| 375 | */ | ||
| 376 | set_cpu_active(smp_processor_id(), true); | ||
| 377 | |||
| 378 | /* FIXME: This should be done in userspace --RR */ | 372 | /* FIXME: This should be done in userspace --RR */ |
| 379 | for_each_present_cpu(cpu) { | 373 | for_each_present_cpu(cpu) { |
| 380 | if (num_online_cpus() >= setup_max_cpus) | 374 | if (num_online_cpus() >= setup_max_cpus) |
| @@ -486,6 +480,7 @@ static void __init boot_cpu_init(void) | |||
| 486 | int cpu = smp_processor_id(); | 480 | int cpu = smp_processor_id(); |
| 487 | /* Mark the boot cpu "present", "online" etc for SMP and UP case */ | 481 | /* Mark the boot cpu "present", "online" etc for SMP and UP case */ |
| 488 | set_cpu_online(cpu, true); | 482 | set_cpu_online(cpu, true); |
| 483 | set_cpu_active(cpu, true); | ||
| 489 | set_cpu_present(cpu, true); | 484 | set_cpu_present(cpu, true); |
| 490 | set_cpu_possible(cpu, true); | 485 | set_cpu_possible(cpu, true); |
| 491 | } | 486 | } |
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index 2451dc6f3282..4b05bd9479db 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
| @@ -277,7 +277,7 @@ static void untag_chunk(struct node *p) | |||
| 277 | owner->root = NULL; | 277 | owner->root = NULL; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | for (i = j = 0; i < size; i++, j++) { | 280 | for (i = j = 0; j <= size; i++, j++) { |
| 281 | struct audit_tree *s; | 281 | struct audit_tree *s; |
| 282 | if (&chunk->owners[j] == p) { | 282 | if (&chunk->owners[j] == p) { |
| 283 | list_del_init(&p->list); | 283 | list_del_init(&p->list); |
| @@ -290,7 +290,7 @@ static void untag_chunk(struct node *p) | |||
| 290 | if (!s) /* result of earlier fallback */ | 290 | if (!s) /* result of earlier fallback */ |
| 291 | continue; | 291 | continue; |
| 292 | get_tree(s); | 292 | get_tree(s); |
| 293 | list_replace_init(&chunk->owners[i].list, &new->owners[j].list); | 293 | list_replace_init(&chunk->owners[j].list, &new->owners[i].list); |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | list_replace_rcu(&chunk->hash, &new->hash); | 296 | list_replace_rcu(&chunk->hash, &new->hash); |
| @@ -373,15 +373,17 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
| 373 | for (n = 0; n < old->count; n++) { | 373 | for (n = 0; n < old->count; n++) { |
| 374 | if (old->owners[n].owner == tree) { | 374 | if (old->owners[n].owner == tree) { |
| 375 | spin_unlock(&hash_lock); | 375 | spin_unlock(&hash_lock); |
| 376 | put_inotify_watch(watch); | 376 | put_inotify_watch(&old->watch); |
| 377 | return 0; | 377 | return 0; |
| 378 | } | 378 | } |
| 379 | } | 379 | } |
| 380 | spin_unlock(&hash_lock); | 380 | spin_unlock(&hash_lock); |
| 381 | 381 | ||
| 382 | chunk = alloc_chunk(old->count + 1); | 382 | chunk = alloc_chunk(old->count + 1); |
| 383 | if (!chunk) | 383 | if (!chunk) { |
| 384 | put_inotify_watch(&old->watch); | ||
| 384 | return -ENOMEM; | 385 | return -ENOMEM; |
| 386 | } | ||
| 385 | 387 | ||
| 386 | mutex_lock(&inode->inotify_mutex); | 388 | mutex_lock(&inode->inotify_mutex); |
| 387 | if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) { | 389 | if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) { |
| @@ -425,7 +427,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
| 425 | spin_unlock(&hash_lock); | 427 | spin_unlock(&hash_lock); |
| 426 | inotify_evict_watch(&old->watch); | 428 | inotify_evict_watch(&old->watch); |
| 427 | mutex_unlock(&inode->inotify_mutex); | 429 | mutex_unlock(&inode->inotify_mutex); |
| 428 | put_inotify_watch(&old->watch); | 430 | put_inotify_watch(&old->watch); /* pair to inotify_find_watch */ |
| 431 | put_inotify_watch(&old->watch); /* and kill it */ | ||
| 429 | return 0; | 432 | return 0; |
| 430 | } | 433 | } |
| 431 | 434 | ||
diff --git a/kernel/cpu.c b/kernel/cpu.c index 291ac586f37f..1c8ddd6ee940 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
| @@ -209,6 +209,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) | |||
| 209 | return -ENOMEM; | 209 | return -ENOMEM; |
| 210 | 210 | ||
| 211 | cpu_hotplug_begin(); | 211 | cpu_hotplug_begin(); |
| 212 | set_cpu_active(cpu, false); | ||
| 212 | err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod, | 213 | err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod, |
| 213 | hcpu, -1, &nr_calls); | 214 | hcpu, -1, &nr_calls); |
| 214 | if (err == NOTIFY_BAD) { | 215 | if (err == NOTIFY_BAD) { |
| @@ -280,18 +281,6 @@ int __ref cpu_down(unsigned int cpu) | |||
| 280 | goto out; | 281 | goto out; |
| 281 | } | 282 | } |
| 282 | 283 | ||
| 283 | set_cpu_active(cpu, false); | ||
| 284 | |||
| 285 | /* | ||
| 286 | * Make sure the all cpus did the reschedule and are not | ||
| 287 | * using stale version of the cpu_active_mask. | ||
| 288 | * This is not strictly necessary becuase stop_machine() | ||
| 289 | * that we run down the line already provides the required | ||
| 290 | * synchronization. But it's really a side effect and we do not | ||
| 291 | * want to depend on the innards of the stop_machine here. | ||
| 292 | */ | ||
| 293 | synchronize_sched(); | ||
| 294 | |||
| 295 | err = _cpu_down(cpu, 0); | 284 | err = _cpu_down(cpu, 0); |
| 296 | 285 | ||
| 297 | out: | 286 | out: |
| @@ -382,19 +371,12 @@ int disable_nonboot_cpus(void) | |||
| 382 | return error; | 371 | return error; |
| 383 | cpu_maps_update_begin(); | 372 | cpu_maps_update_begin(); |
| 384 | first_cpu = cpumask_first(cpu_online_mask); | 373 | first_cpu = cpumask_first(cpu_online_mask); |
| 385 | /* We take down all of the non-boot CPUs in one shot to avoid races | 374 | /* |
| 375 | * We take down all of the non-boot CPUs in one shot to avoid races | ||
| 386 | * with the userspace trying to use the CPU hotplug at the same time | 376 | * with the userspace trying to use the CPU hotplug at the same time |
| 387 | */ | 377 | */ |
| 388 | cpumask_clear(frozen_cpus); | 378 | cpumask_clear(frozen_cpus); |
| 389 | 379 | ||
| 390 | for_each_online_cpu(cpu) { | ||
| 391 | if (cpu == first_cpu) | ||
| 392 | continue; | ||
| 393 | set_cpu_active(cpu, false); | ||
| 394 | } | ||
| 395 | |||
| 396 | synchronize_sched(); | ||
| 397 | |||
| 398 | printk("Disabling non-boot CPUs ...\n"); | 380 | printk("Disabling non-boot CPUs ...\n"); |
| 399 | for_each_online_cpu(cpu) { | 381 | for_each_online_cpu(cpu) { |
| 400 | if (cpu == first_cpu) | 382 | if (cpu == first_cpu) |
diff --git a/kernel/kthread.c b/kernel/kthread.c index ab7ae57773e1..fbb6222fe7e0 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
| @@ -150,6 +150,29 @@ struct task_struct *kthread_create(int (*threadfn)(void *data), | |||
| 150 | EXPORT_SYMBOL(kthread_create); | 150 | EXPORT_SYMBOL(kthread_create); |
| 151 | 151 | ||
| 152 | /** | 152 | /** |
| 153 | * kthread_bind - bind a just-created kthread to a cpu. | ||
| 154 | * @p: thread created by kthread_create(). | ||
| 155 | * @cpu: cpu (might not be online, must be possible) for @k to run on. | ||
| 156 | * | ||
| 157 | * Description: This function is equivalent to set_cpus_allowed(), | ||
| 158 | * except that @cpu doesn't need to be online, and the thread must be | ||
| 159 | * stopped (i.e., just returned from kthread_create()). | ||
| 160 | */ | ||
| 161 | void kthread_bind(struct task_struct *p, unsigned int cpu) | ||
| 162 | { | ||
| 163 | /* Must have done schedule() in kthread() before we set_task_cpu */ | ||
| 164 | if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE)) { | ||
| 165 | WARN_ON(1); | ||
| 166 | return; | ||
| 167 | } | ||
| 168 | |||
| 169 | p->cpus_allowed = cpumask_of_cpu(cpu); | ||
| 170 | p->rt.nr_cpus_allowed = 1; | ||
| 171 | p->flags |= PF_THREAD_BOUND; | ||
| 172 | } | ||
| 173 | EXPORT_SYMBOL(kthread_bind); | ||
| 174 | |||
| 175 | /** | ||
| 153 | * kthread_stop - stop a thread created by kthread_create(). | 176 | * kthread_stop - stop a thread created by kthread_create(). |
| 154 | * @k: thread created by kthread_create(). | 177 | * @k: thread created by kthread_create(). |
| 155 | * | 178 | * |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 97d1a3dd7a59..e0eb4a2fe183 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
| @@ -1381,6 +1381,9 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx) | |||
| 1381 | if (event->state != PERF_EVENT_STATE_ACTIVE) | 1381 | if (event->state != PERF_EVENT_STATE_ACTIVE) |
| 1382 | continue; | 1382 | continue; |
| 1383 | 1383 | ||
| 1384 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | ||
| 1385 | continue; | ||
| 1386 | |||
| 1384 | hwc = &event->hw; | 1387 | hwc = &event->hw; |
| 1385 | 1388 | ||
| 1386 | interrupts = hwc->interrupts; | 1389 | interrupts = hwc->interrupts; |
| @@ -3265,6 +3268,9 @@ static void perf_event_task_output(struct perf_event *event, | |||
| 3265 | 3268 | ||
| 3266 | static int perf_event_task_match(struct perf_event *event) | 3269 | static int perf_event_task_match(struct perf_event *event) |
| 3267 | { | 3270 | { |
| 3271 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | ||
| 3272 | return 0; | ||
| 3273 | |||
| 3268 | if (event->attr.comm || event->attr.mmap || event->attr.task) | 3274 | if (event->attr.comm || event->attr.mmap || event->attr.task) |
| 3269 | return 1; | 3275 | return 1; |
| 3270 | 3276 | ||
| @@ -3290,12 +3296,11 @@ static void perf_event_task_event(struct perf_task_event *task_event) | |||
| 3290 | rcu_read_lock(); | 3296 | rcu_read_lock(); |
| 3291 | cpuctx = &get_cpu_var(perf_cpu_context); | 3297 | cpuctx = &get_cpu_var(perf_cpu_context); |
| 3292 | perf_event_task_ctx(&cpuctx->ctx, task_event); | 3298 | perf_event_task_ctx(&cpuctx->ctx, task_event); |
| 3293 | put_cpu_var(perf_cpu_context); | ||
| 3294 | |||
| 3295 | if (!ctx) | 3299 | if (!ctx) |
| 3296 | ctx = rcu_dereference(task_event->task->perf_event_ctxp); | 3300 | ctx = rcu_dereference(task_event->task->perf_event_ctxp); |
| 3297 | if (ctx) | 3301 | if (ctx) |
| 3298 | perf_event_task_ctx(ctx, task_event); | 3302 | perf_event_task_ctx(ctx, task_event); |
| 3303 | put_cpu_var(perf_cpu_context); | ||
| 3299 | rcu_read_unlock(); | 3304 | rcu_read_unlock(); |
| 3300 | } | 3305 | } |
| 3301 | 3306 | ||
| @@ -3372,6 +3377,9 @@ static void perf_event_comm_output(struct perf_event *event, | |||
| 3372 | 3377 | ||
| 3373 | static int perf_event_comm_match(struct perf_event *event) | 3378 | static int perf_event_comm_match(struct perf_event *event) |
| 3374 | { | 3379 | { |
| 3380 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | ||
| 3381 | return 0; | ||
| 3382 | |||
| 3375 | if (event->attr.comm) | 3383 | if (event->attr.comm) |
| 3376 | return 1; | 3384 | return 1; |
| 3377 | 3385 | ||
| @@ -3408,15 +3416,10 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event) | |||
| 3408 | rcu_read_lock(); | 3416 | rcu_read_lock(); |
| 3409 | cpuctx = &get_cpu_var(perf_cpu_context); | 3417 | cpuctx = &get_cpu_var(perf_cpu_context); |
| 3410 | perf_event_comm_ctx(&cpuctx->ctx, comm_event); | 3418 | perf_event_comm_ctx(&cpuctx->ctx, comm_event); |
| 3411 | put_cpu_var(perf_cpu_context); | ||
| 3412 | |||
| 3413 | /* | ||
| 3414 | * doesn't really matter which of the child contexts the | ||
| 3415 | * events ends up in. | ||
| 3416 | */ | ||
| 3417 | ctx = rcu_dereference(current->perf_event_ctxp); | 3419 | ctx = rcu_dereference(current->perf_event_ctxp); |
| 3418 | if (ctx) | 3420 | if (ctx) |
| 3419 | perf_event_comm_ctx(ctx, comm_event); | 3421 | perf_event_comm_ctx(ctx, comm_event); |
| 3422 | put_cpu_var(perf_cpu_context); | ||
| 3420 | rcu_read_unlock(); | 3423 | rcu_read_unlock(); |
| 3421 | } | 3424 | } |
| 3422 | 3425 | ||
| @@ -3491,6 +3494,9 @@ static void perf_event_mmap_output(struct perf_event *event, | |||
| 3491 | static int perf_event_mmap_match(struct perf_event *event, | 3494 | static int perf_event_mmap_match(struct perf_event *event, |
| 3492 | struct perf_mmap_event *mmap_event) | 3495 | struct perf_mmap_event *mmap_event) |
| 3493 | { | 3496 | { |
| 3497 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | ||
| 3498 | return 0; | ||
| 3499 | |||
| 3494 | if (event->attr.mmap) | 3500 | if (event->attr.mmap) |
| 3495 | return 1; | 3501 | return 1; |
| 3496 | 3502 | ||
| @@ -3564,15 +3570,10 @@ got_name: | |||
| 3564 | rcu_read_lock(); | 3570 | rcu_read_lock(); |
| 3565 | cpuctx = &get_cpu_var(perf_cpu_context); | 3571 | cpuctx = &get_cpu_var(perf_cpu_context); |
| 3566 | perf_event_mmap_ctx(&cpuctx->ctx, mmap_event); | 3572 | perf_event_mmap_ctx(&cpuctx->ctx, mmap_event); |
| 3567 | put_cpu_var(perf_cpu_context); | ||
| 3568 | |||
| 3569 | /* | ||
| 3570 | * doesn't really matter which of the child contexts the | ||
| 3571 | * events ends up in. | ||
| 3572 | */ | ||
| 3573 | ctx = rcu_dereference(current->perf_event_ctxp); | 3573 | ctx = rcu_dereference(current->perf_event_ctxp); |
| 3574 | if (ctx) | 3574 | if (ctx) |
| 3575 | perf_event_mmap_ctx(ctx, mmap_event); | 3575 | perf_event_mmap_ctx(ctx, mmap_event); |
| 3576 | put_cpu_var(perf_cpu_context); | ||
| 3576 | rcu_read_unlock(); | 3577 | rcu_read_unlock(); |
| 3577 | 3578 | ||
| 3578 | kfree(buf); | 3579 | kfree(buf); |
| @@ -3863,6 +3864,9 @@ static int perf_swevent_match(struct perf_event *event, | |||
| 3863 | struct perf_sample_data *data, | 3864 | struct perf_sample_data *data, |
| 3864 | struct pt_regs *regs) | 3865 | struct pt_regs *regs) |
| 3865 | { | 3866 | { |
| 3867 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | ||
| 3868 | return 0; | ||
| 3869 | |||
| 3866 | if (!perf_swevent_is_counting(event)) | 3870 | if (!perf_swevent_is_counting(event)) |
| 3867 | return 0; | 3871 | return 0; |
| 3868 | 3872 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index 18cceeecce35..720df108a2d6 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -26,6 +26,8 @@ | |||
| 26 | * Thomas Gleixner, Mike Kravetz | 26 | * Thomas Gleixner, Mike Kravetz |
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 30 | |||
| 29 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
| 30 | #include <linux/module.h> | 32 | #include <linux/module.h> |
| 31 | #include <linux/nmi.h> | 33 | #include <linux/nmi.h> |
| @@ -2002,39 +2004,6 @@ static inline void check_class_changed(struct rq *rq, struct task_struct *p, | |||
| 2002 | p->sched_class->prio_changed(rq, p, oldprio, running); | 2004 | p->sched_class->prio_changed(rq, p, oldprio, running); |
| 2003 | } | 2005 | } |
| 2004 | 2006 | ||
| 2005 | /** | ||
| 2006 | * kthread_bind - bind a just-created kthread to a cpu. | ||
| 2007 | * @p: thread created by kthread_create(). | ||
| 2008 | * @cpu: cpu (might not be online, must be possible) for @k to run on. | ||
| 2009 | * | ||
| 2010 | * Description: This function is equivalent to set_cpus_allowed(), | ||
| 2011 | * except that @cpu doesn't need to be online, and the thread must be | ||
| 2012 | * stopped (i.e., just returned from kthread_create()). | ||
| 2013 | * | ||
| 2014 | * Function lives here instead of kthread.c because it messes with | ||
| 2015 | * scheduler internals which require locking. | ||
| 2016 | */ | ||
| 2017 | void kthread_bind(struct task_struct *p, unsigned int cpu) | ||
| 2018 | { | ||
| 2019 | struct rq *rq = cpu_rq(cpu); | ||
| 2020 | unsigned long flags; | ||
| 2021 | |||
| 2022 | /* Must have done schedule() in kthread() before we set_task_cpu */ | ||
| 2023 | if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE)) { | ||
| 2024 | WARN_ON(1); | ||
| 2025 | return; | ||
| 2026 | } | ||
| 2027 | |||
| 2028 | raw_spin_lock_irqsave(&rq->lock, flags); | ||
| 2029 | update_rq_clock(rq); | ||
| 2030 | set_task_cpu(p, cpu); | ||
| 2031 | p->cpus_allowed = cpumask_of_cpu(cpu); | ||
| 2032 | p->rt.nr_cpus_allowed = 1; | ||
| 2033 | p->flags |= PF_THREAD_BOUND; | ||
| 2034 | raw_spin_unlock_irqrestore(&rq->lock, flags); | ||
| 2035 | } | ||
| 2036 | EXPORT_SYMBOL(kthread_bind); | ||
| 2037 | |||
| 2038 | #ifdef CONFIG_SMP | 2007 | #ifdef CONFIG_SMP |
| 2039 | /* | 2008 | /* |
| 2040 | * Is this task likely cache-hot: | 2009 | * Is this task likely cache-hot: |
| @@ -2044,6 +2013,9 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd) | |||
| 2044 | { | 2013 | { |
| 2045 | s64 delta; | 2014 | s64 delta; |
| 2046 | 2015 | ||
| 2016 | if (p->sched_class != &fair_sched_class) | ||
| 2017 | return 0; | ||
| 2018 | |||
| 2047 | /* | 2019 | /* |
| 2048 | * Buddy candidates are cache hot: | 2020 | * Buddy candidates are cache hot: |
| 2049 | */ | 2021 | */ |
| @@ -2052,9 +2024,6 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd) | |||
| 2052 | &p->se == cfs_rq_of(&p->se)->last)) | 2024 | &p->se == cfs_rq_of(&p->se)->last)) |
| 2053 | return 1; | 2025 | return 1; |
| 2054 | 2026 | ||
| 2055 | if (p->sched_class != &fair_sched_class) | ||
| 2056 | return 0; | ||
| 2057 | |||
| 2058 | if (sysctl_sched_migration_cost == -1) | 2027 | if (sysctl_sched_migration_cost == -1) |
| 2059 | return 1; | 2028 | return 1; |
| 2060 | if (sysctl_sched_migration_cost == 0) | 2029 | if (sysctl_sched_migration_cost == 0) |
| @@ -2065,22 +2034,24 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd) | |||
| 2065 | return delta < (s64)sysctl_sched_migration_cost; | 2034 | return delta < (s64)sysctl_sched_migration_cost; |
| 2066 | } | 2035 | } |
| 2067 | 2036 | ||
| 2068 | |||
| 2069 | void set_task_cpu(struct task_struct *p, unsigned int new_cpu) | 2037 | void set_task_cpu(struct task_struct *p, unsigned int new_cpu) |
| 2070 | { | 2038 | { |
| 2071 | int old_cpu = task_cpu(p); | 2039 | #ifdef CONFIG_SCHED_DEBUG |
| 2072 | struct cfs_rq *old_cfsrq = task_cfs_rq(p), | 2040 | /* |
| 2073 | *new_cfsrq = cpu_cfs_rq(old_cfsrq, new_cpu); | 2041 | * We should never call set_task_cpu() on a blocked task, |
| 2042 | * ttwu() will sort out the placement. | ||
| 2043 | */ | ||
| 2044 | WARN_ON_ONCE(p->state != TASK_RUNNING && p->state != TASK_WAKING && | ||
| 2045 | !(task_thread_info(p)->preempt_count & PREEMPT_ACTIVE)); | ||
| 2046 | #endif | ||
| 2074 | 2047 | ||
| 2075 | trace_sched_migrate_task(p, new_cpu); | 2048 | trace_sched_migrate_task(p, new_cpu); |
| 2076 | 2049 | ||
| 2077 | if (old_cpu != new_cpu) { | 2050 | if (task_cpu(p) == new_cpu) |
| 2078 | p->se.nr_migrations++; | 2051 | return; |
| 2079 | perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, | 2052 | |
| 2080 | 1, 1, NULL, 0); | 2053 | p->se.nr_migrations++; |
| 2081 | } | 2054 | perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0); |
| 2082 | p->se.vruntime -= old_cfsrq->min_vruntime - | ||
| 2083 | new_cfsrq->min_vruntime; | ||
| 2084 | 2055 | ||
| 2085 | __set_task_cpu(p, new_cpu); | 2056 | __set_task_cpu(p, new_cpu); |
| 2086 | } | 2057 | } |
| @@ -2105,13 +2076,10 @@ migrate_task(struct task_struct *p, int dest_cpu, struct migration_req *req) | |||
| 2105 | 2076 | ||
| 2106 | /* | 2077 | /* |
| 2107 | * If the task is not on a runqueue (and not running), then | 2078 | * If the task is not on a runqueue (and not running), then |
| 2108 | * it is sufficient to simply update the task's cpu field. | 2079 | * the next wake-up will properly place the task. |
| 2109 | */ | 2080 | */ |
| 2110 | if (!p->se.on_rq && !task_running(rq, p)) { | 2081 | if (!p->se.on_rq && !task_running(rq, p)) |
| 2111 | update_rq_clock(rq); | ||
| 2112 | set_task_cpu(p, dest_cpu); | ||
| 2113 | return 0; | 2082 | return 0; |
| 2114 | } | ||
| 2115 | 2083 | ||
| 2116 | init_completion(&req->done); | 2084 | init_completion(&req->done); |
| 2117 | req->task = p; | 2085 | req->task = p; |
| @@ -2317,10 +2285,73 @@ void task_oncpu_function_call(struct task_struct *p, | |||
| 2317 | } | 2285 | } |
| 2318 | 2286 | ||
| 2319 | #ifdef CONFIG_SMP | 2287 | #ifdef CONFIG_SMP |
| 2288 | static int select_fallback_rq(int cpu, struct task_struct *p) | ||
| 2289 | { | ||
| 2290 | int dest_cpu; | ||
| 2291 | const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(cpu)); | ||
| 2292 | |||
| 2293 | /* Look for allowed, online CPU in same node. */ | ||
| 2294 | for_each_cpu_and(dest_cpu, nodemask, cpu_active_mask) | ||
| 2295 | if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed)) | ||
| 2296 | return dest_cpu; | ||
| 2297 | |||
| 2298 | /* Any allowed, online CPU? */ | ||
| 2299 | dest_cpu = cpumask_any_and(&p->cpus_allowed, cpu_active_mask); | ||
| 2300 | if (dest_cpu < nr_cpu_ids) | ||
| 2301 | return dest_cpu; | ||
| 2302 | |||
| 2303 | /* No more Mr. Nice Guy. */ | ||
| 2304 | if (dest_cpu >= nr_cpu_ids) { | ||
| 2305 | rcu_read_lock(); | ||
| 2306 | cpuset_cpus_allowed_locked(p, &p->cpus_allowed); | ||
| 2307 | rcu_read_unlock(); | ||
| 2308 | dest_cpu = cpumask_any_and(cpu_active_mask, &p->cpus_allowed); | ||
| 2309 | |||
| 2310 | /* | ||
| 2311 | * Don't tell them about moving exiting tasks or | ||
| 2312 | * kernel threads (both mm NULL), since they never | ||
| 2313 | * leave kernel. | ||
| 2314 | */ | ||
| 2315 | if (p->mm && printk_ratelimit()) { | ||
| 2316 | printk(KERN_INFO "process %d (%s) no " | ||
| 2317 | "longer affine to cpu%d\n", | ||
| 2318 | task_pid_nr(p), p->comm, cpu); | ||
| 2319 | } | ||
| 2320 | } | ||
| 2321 | |||
| 2322 | return dest_cpu; | ||
| 2323 | } | ||
| 2324 | |||
| 2325 | /* | ||
| 2326 | * Called from: | ||
| 2327 | * | ||
| 2328 | * - fork, @p is stable because it isn't on the tasklist yet | ||
| 2329 | * | ||
| 2330 | * - exec, @p is unstable, retry loop | ||
| 2331 | * | ||
| 2332 | * - wake-up, we serialize ->cpus_allowed against TASK_WAKING so | ||
| 2333 | * we should be good. | ||
| 2334 | */ | ||
| 2320 | static inline | 2335 | static inline |
| 2321 | int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags) | 2336 | int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags) |
| 2322 | { | 2337 | { |
| 2323 | return p->sched_class->select_task_rq(p, sd_flags, wake_flags); | 2338 | int cpu = p->sched_class->select_task_rq(p, sd_flags, wake_flags); |
| 2339 | |||
| 2340 | /* | ||
| 2341 | * In order not to call set_task_cpu() on a blocking task we need | ||
| 2342 | * to rely on ttwu() to place the task on a valid ->cpus_allowed | ||
| 2343 | * cpu. | ||
| 2344 | * | ||
| 2345 | * Since this is common to all placement strategies, this lives here. | ||
| 2346 | * | ||
| 2347 | * [ this allows ->select_task() to simply return task_cpu(p) and | ||
| 2348 | * not worry about this generic constraint ] | ||
| 2349 | */ | ||
| 2350 | if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) || | ||
| 2351 | !cpu_active(cpu))) | ||
| 2352 | cpu = select_fallback_rq(task_cpu(p), p); | ||
| 2353 | |||
| 2354 | return cpu; | ||
| 2324 | } | 2355 | } |
| 2325 | #endif | 2356 | #endif |
| 2326 | 2357 | ||
| @@ -2375,6 +2406,10 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, | |||
| 2375 | if (task_contributes_to_load(p)) | 2406 | if (task_contributes_to_load(p)) |
| 2376 | rq->nr_uninterruptible--; | 2407 | rq->nr_uninterruptible--; |
| 2377 | p->state = TASK_WAKING; | 2408 | p->state = TASK_WAKING; |
| 2409 | |||
| 2410 | if (p->sched_class->task_waking) | ||
| 2411 | p->sched_class->task_waking(rq, p); | ||
| 2412 | |||
| 2378 | __task_rq_unlock(rq); | 2413 | __task_rq_unlock(rq); |
| 2379 | 2414 | ||
| 2380 | cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags); | 2415 | cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags); |
| @@ -2438,8 +2473,8 @@ out_running: | |||
| 2438 | 2473 | ||
| 2439 | p->state = TASK_RUNNING; | 2474 | p->state = TASK_RUNNING; |
| 2440 | #ifdef CONFIG_SMP | 2475 | #ifdef CONFIG_SMP |
| 2441 | if (p->sched_class->task_wake_up) | 2476 | if (p->sched_class->task_woken) |
| 2442 | p->sched_class->task_wake_up(rq, p); | 2477 | p->sched_class->task_woken(rq, p); |
| 2443 | 2478 | ||
| 2444 | if (unlikely(rq->idle_stamp)) { | 2479 | if (unlikely(rq->idle_stamp)) { |
| 2445 | u64 delta = rq->clock - rq->idle_stamp; | 2480 | u64 delta = rq->clock - rq->idle_stamp; |
| @@ -2538,14 +2573,6 @@ static void __sched_fork(struct task_struct *p) | |||
| 2538 | #ifdef CONFIG_PREEMPT_NOTIFIERS | 2573 | #ifdef CONFIG_PREEMPT_NOTIFIERS |
| 2539 | INIT_HLIST_HEAD(&p->preempt_notifiers); | 2574 | INIT_HLIST_HEAD(&p->preempt_notifiers); |
| 2540 | #endif | 2575 | #endif |
| 2541 | |||
| 2542 | /* | ||
| 2543 | * We mark the process as running here, but have not actually | ||
| 2544 | * inserted it onto the runqueue yet. This guarantees that | ||
| 2545 | * nobody will actually run it, and a signal or other external | ||
| 2546 | * event cannot wake it up and insert it on the runqueue either. | ||
| 2547 | */ | ||
| 2548 | p->state = TASK_RUNNING; | ||
| 2549 | } | 2576 | } |
| 2550 | 2577 | ||
| 2551 | /* | 2578 | /* |
| @@ -2556,6 +2583,12 @@ void sched_fork(struct task_struct *p, int clone_flags) | |||
| 2556 | int cpu = get_cpu(); | 2583 | int cpu = get_cpu(); |
| 2557 | 2584 | ||
| 2558 | __sched_fork(p); | 2585 | __sched_fork(p); |
| 2586 | /* | ||
| 2587 | * We mark the process as waking here. This guarantees that | ||
| 2588 | * nobody will actually run it, and a signal or other external | ||
| 2589 | * event cannot wake it up and insert it on the runqueue either. | ||
| 2590 | */ | ||
| 2591 | p->state = TASK_WAKING; | ||
| 2559 | 2592 | ||
| 2560 | /* | 2593 | /* |
| 2561 | * Revert to default priority/policy on fork if requested. | 2594 | * Revert to default priority/policy on fork if requested. |
| @@ -2624,14 +2657,15 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags) | |||
| 2624 | struct rq *rq; | 2657 | struct rq *rq; |
| 2625 | 2658 | ||
| 2626 | rq = task_rq_lock(p, &flags); | 2659 | rq = task_rq_lock(p, &flags); |
| 2627 | BUG_ON(p->state != TASK_RUNNING); | 2660 | BUG_ON(p->state != TASK_WAKING); |
| 2661 | p->state = TASK_RUNNING; | ||
| 2628 | update_rq_clock(rq); | 2662 | update_rq_clock(rq); |
| 2629 | activate_task(rq, p, 0); | 2663 | activate_task(rq, p, 0); |
| 2630 | trace_sched_wakeup_new(rq, p, 1); | 2664 | trace_sched_wakeup_new(rq, p, 1); |
| 2631 | check_preempt_curr(rq, p, WF_FORK); | 2665 | check_preempt_curr(rq, p, WF_FORK); |
| 2632 | #ifdef CONFIG_SMP | 2666 | #ifdef CONFIG_SMP |
| 2633 | if (p->sched_class->task_wake_up) | 2667 | if (p->sched_class->task_woken) |
| 2634 | p->sched_class->task_wake_up(rq, p); | 2668 | p->sched_class->task_woken(rq, p); |
| 2635 | #endif | 2669 | #endif |
| 2636 | task_rq_unlock(rq, &flags); | 2670 | task_rq_unlock(rq, &flags); |
| 2637 | } | 2671 | } |
| @@ -3101,21 +3135,36 @@ static void double_rq_unlock(struct rq *rq1, struct rq *rq2) | |||
| 3101 | } | 3135 | } |
| 3102 | 3136 | ||
| 3103 | /* | 3137 | /* |
| 3104 | * If dest_cpu is allowed for this process, migrate the task to it. | 3138 | * sched_exec - execve() is a valuable balancing opportunity, because at |
| 3105 | * This is accomplished by forcing the cpu_allowed mask to only | 3139 | * this point the task has the smallest effective memory and cache footprint. |
| 3106 | * allow dest_cpu, which will force the cpu onto dest_cpu. Then | ||
| 3107 | * the cpu_allowed mask is restored. | ||
| 3108 | */ | 3140 | */ |
| 3109 | static void sched_migrate_task(struct task_struct *p, int dest_cpu) | 3141 | void sched_exec(void) |
| 3110 | { | 3142 | { |
| 3143 | struct task_struct *p = current; | ||
| 3111 | struct migration_req req; | 3144 | struct migration_req req; |
| 3145 | int dest_cpu, this_cpu; | ||
| 3112 | unsigned long flags; | 3146 | unsigned long flags; |
| 3113 | struct rq *rq; | 3147 | struct rq *rq; |
| 3114 | 3148 | ||
| 3149 | again: | ||
| 3150 | this_cpu = get_cpu(); | ||
| 3151 | dest_cpu = select_task_rq(p, SD_BALANCE_EXEC, 0); | ||
| 3152 | if (dest_cpu == this_cpu) { | ||
| 3153 | put_cpu(); | ||
| 3154 | return; | ||
| 3155 | } | ||
| 3156 | |||
| 3115 | rq = task_rq_lock(p, &flags); | 3157 | rq = task_rq_lock(p, &flags); |
| 3158 | put_cpu(); | ||
| 3159 | |||
| 3160 | /* | ||
| 3161 | * select_task_rq() can race against ->cpus_allowed | ||
| 3162 | */ | ||
| 3116 | if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed) | 3163 | if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed) |
| 3117 | || unlikely(!cpu_active(dest_cpu))) | 3164 | || unlikely(!cpu_active(dest_cpu))) { |
| 3118 | goto out; | 3165 | task_rq_unlock(rq, &flags); |
| 3166 | goto again; | ||
| 3167 | } | ||
| 3119 | 3168 | ||
| 3120 | /* force the process onto the specified CPU */ | 3169 | /* force the process onto the specified CPU */ |
| 3121 | if (migrate_task(p, dest_cpu, &req)) { | 3170 | if (migrate_task(p, dest_cpu, &req)) { |
| @@ -3130,24 +3179,10 @@ static void sched_migrate_task(struct task_struct *p, int dest_cpu) | |||
| 3130 | 3179 | ||
| 3131 | return; | 3180 | return; |
| 3132 | } | 3181 | } |
| 3133 | out: | ||
| 3134 | task_rq_unlock(rq, &flags); | 3182 | task_rq_unlock(rq, &flags); |
| 3135 | } | 3183 | } |
| 3136 | 3184 | ||
| 3137 | /* | 3185 | /* |
| 3138 | * sched_exec - execve() is a valuable balancing opportunity, because at | ||
| 3139 | * this point the task has the smallest effective memory and cache footprint. | ||
| 3140 | */ | ||
| 3141 | void sched_exec(void) | ||
| 3142 | { | ||
| 3143 | int new_cpu, this_cpu = get_cpu(); | ||
| 3144 | new_cpu = select_task_rq(current, SD_BALANCE_EXEC, 0); | ||
| 3145 | put_cpu(); | ||
| 3146 | if (new_cpu != this_cpu) | ||
| 3147 | sched_migrate_task(current, new_cpu); | ||
| 3148 | } | ||
| 3149 | |||
| 3150 | /* | ||
| 3151 | * pull_task - move a task from a remote runqueue to the local runqueue. | 3186 | * pull_task - move a task from a remote runqueue to the local runqueue. |
| 3152 | * Both runqueues must be locked. | 3187 | * Both runqueues must be locked. |
| 3153 | */ | 3188 | */ |
| @@ -5340,8 +5375,8 @@ static noinline void __schedule_bug(struct task_struct *prev) | |||
| 5340 | { | 5375 | { |
| 5341 | struct pt_regs *regs = get_irq_regs(); | 5376 | struct pt_regs *regs = get_irq_regs(); |
| 5342 | 5377 | ||
| 5343 | printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n", | 5378 | pr_err("BUG: scheduling while atomic: %s/%d/0x%08x\n", |
| 5344 | prev->comm, prev->pid, preempt_count()); | 5379 | prev->comm, prev->pid, preempt_count()); |
| 5345 | 5380 | ||
| 5346 | debug_show_held_locks(prev); | 5381 | debug_show_held_locks(prev); |
| 5347 | print_modules(); | 5382 | print_modules(); |
| @@ -5911,14 +5946,15 @@ EXPORT_SYMBOL(wait_for_completion_killable); | |||
| 5911 | */ | 5946 | */ |
| 5912 | bool try_wait_for_completion(struct completion *x) | 5947 | bool try_wait_for_completion(struct completion *x) |
| 5913 | { | 5948 | { |
| 5949 | unsigned long flags; | ||
| 5914 | int ret = 1; | 5950 | int ret = 1; |
| 5915 | 5951 | ||
| 5916 | spin_lock_irq(&x->wait.lock); | 5952 | spin_lock_irqsave(&x->wait.lock, flags); |
| 5917 | if (!x->done) | 5953 | if (!x->done) |
| 5918 | ret = 0; | 5954 | ret = 0; |
| 5919 | else | 5955 | else |
| 5920 | x->done--; | 5956 | x->done--; |
| 5921 | spin_unlock_irq(&x->wait.lock); | 5957 | spin_unlock_irqrestore(&x->wait.lock, flags); |
| 5922 | return ret; | 5958 | return ret; |
| 5923 | } | 5959 | } |
| 5924 | EXPORT_SYMBOL(try_wait_for_completion); | 5960 | EXPORT_SYMBOL(try_wait_for_completion); |
| @@ -5933,12 +5969,13 @@ EXPORT_SYMBOL(try_wait_for_completion); | |||
| 5933 | */ | 5969 | */ |
| 5934 | bool completion_done(struct completion *x) | 5970 | bool completion_done(struct completion *x) |
| 5935 | { | 5971 | { |
| 5972 | unsigned long flags; | ||
| 5936 | int ret = 1; | 5973 | int ret = 1; |
| 5937 | 5974 | ||
| 5938 | spin_lock_irq(&x->wait.lock); | 5975 | spin_lock_irqsave(&x->wait.lock, flags); |
| 5939 | if (!x->done) | 5976 | if (!x->done) |
| 5940 | ret = 0; | 5977 | ret = 0; |
| 5941 | spin_unlock_irq(&x->wait.lock); | 5978 | spin_unlock_irqrestore(&x->wait.lock, flags); |
| 5942 | return ret; | 5979 | return ret; |
| 5943 | } | 5980 | } |
| 5944 | EXPORT_SYMBOL(completion_done); | 5981 | EXPORT_SYMBOL(completion_done); |
| @@ -6457,7 +6494,7 @@ SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid) | |||
| 6457 | return -EINVAL; | 6494 | return -EINVAL; |
| 6458 | 6495 | ||
| 6459 | retval = -ESRCH; | 6496 | retval = -ESRCH; |
| 6460 | read_lock(&tasklist_lock); | 6497 | rcu_read_lock(); |
| 6461 | p = find_process_by_pid(pid); | 6498 | p = find_process_by_pid(pid); |
| 6462 | if (p) { | 6499 | if (p) { |
| 6463 | retval = security_task_getscheduler(p); | 6500 | retval = security_task_getscheduler(p); |
| @@ -6465,7 +6502,7 @@ SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid) | |||
| 6465 | retval = p->policy | 6502 | retval = p->policy |
| 6466 | | (p->sched_reset_on_fork ? SCHED_RESET_ON_FORK : 0); | 6503 | | (p->sched_reset_on_fork ? SCHED_RESET_ON_FORK : 0); |
| 6467 | } | 6504 | } |
| 6468 | read_unlock(&tasklist_lock); | 6505 | rcu_read_unlock(); |
| 6469 | return retval; | 6506 | return retval; |
| 6470 | } | 6507 | } |
| 6471 | 6508 | ||
| @@ -6483,7 +6520,7 @@ SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param) | |||
| 6483 | if (!param || pid < 0) | 6520 | if (!param || pid < 0) |
| 6484 | return -EINVAL; | 6521 | return -EINVAL; |
| 6485 | 6522 | ||
| 6486 | read_lock(&tasklist_lock); | 6523 | rcu_read_lock(); |
| 6487 | p = find_process_by_pid(pid); | 6524 | p = find_process_by_pid(pid); |
| 6488 | retval = -ESRCH; | 6525 | retval = -ESRCH; |
| 6489 | if (!p) | 6526 | if (!p) |
| @@ -6494,7 +6531,7 @@ SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param) | |||
| 6494 | goto out_unlock; | 6531 | goto out_unlock; |
| 6495 | 6532 | ||
| 6496 | lp.sched_priority = p->rt_priority; | 6533 | lp.sched_priority = p->rt_priority; |
| 6497 | read_unlock(&tasklist_lock); | 6534 | rcu_read_unlock(); |
| 6498 | 6535 | ||
| 6499 | /* | 6536 | /* |
| 6500 | * This one might sleep, we cannot do it with a spinlock held ... | 6537 | * This one might sleep, we cannot do it with a spinlock held ... |
| @@ -6504,7 +6541,7 @@ SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param) | |||
| 6504 | return retval; | 6541 | return retval; |
| 6505 | 6542 | ||
| 6506 | out_unlock: | 6543 | out_unlock: |
| 6507 | read_unlock(&tasklist_lock); | 6544 | rcu_read_unlock(); |
| 6508 | return retval; | 6545 | return retval; |
| 6509 | } | 6546 | } |
| 6510 | 6547 | ||
| @@ -6515,22 +6552,18 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask) | |||
| 6515 | int retval; | 6552 | int retval; |
| 6516 | 6553 | ||
| 6517 | get_online_cpus(); | 6554 | get_online_cpus(); |
| 6518 | read_lock(&tasklist_lock); | 6555 | rcu_read_lock(); |
| 6519 | 6556 | ||
| 6520 | p = find_process_by_pid(pid); | 6557 | p = find_process_by_pid(pid); |
| 6521 | if (!p) { | 6558 | if (!p) { |
| 6522 | read_unlock(&tasklist_lock); | 6559 | rcu_read_unlock(); |
| 6523 | put_online_cpus(); | 6560 | put_online_cpus(); |
| 6524 | return -ESRCH; | 6561 | return -ESRCH; |
| 6525 | } | 6562 | } |
| 6526 | 6563 | ||
| 6527 | /* | 6564 | /* Prevent p going away */ |
| 6528 | * It is not safe to call set_cpus_allowed with the | ||
| 6529 | * tasklist_lock held. We will bump the task_struct's | ||
| 6530 | * usage count and then drop tasklist_lock. | ||
| 6531 | */ | ||
| 6532 | get_task_struct(p); | 6565 | get_task_struct(p); |
| 6533 | read_unlock(&tasklist_lock); | 6566 | rcu_read_unlock(); |
| 6534 | 6567 | ||
| 6535 | if (!alloc_cpumask_var(&cpus_allowed, GFP_KERNEL)) { | 6568 | if (!alloc_cpumask_var(&cpus_allowed, GFP_KERNEL)) { |
| 6536 | retval = -ENOMEM; | 6569 | retval = -ENOMEM; |
| @@ -6616,7 +6649,7 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask) | |||
| 6616 | int retval; | 6649 | int retval; |
| 6617 | 6650 | ||
| 6618 | get_online_cpus(); | 6651 | get_online_cpus(); |
| 6619 | read_lock(&tasklist_lock); | 6652 | rcu_read_lock(); |
| 6620 | 6653 | ||
| 6621 | retval = -ESRCH; | 6654 | retval = -ESRCH; |
| 6622 | p = find_process_by_pid(pid); | 6655 | p = find_process_by_pid(pid); |
| @@ -6632,7 +6665,7 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask) | |||
| 6632 | task_rq_unlock(rq, &flags); | 6665 | task_rq_unlock(rq, &flags); |
| 6633 | 6666 | ||
| 6634 | out_unlock: | 6667 | out_unlock: |
| 6635 | read_unlock(&tasklist_lock); | 6668 | rcu_read_unlock(); |
| 6636 | put_online_cpus(); | 6669 | put_online_cpus(); |
| 6637 | 6670 | ||
| 6638 | return retval; | 6671 | return retval; |
| @@ -6876,7 +6909,7 @@ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, | |||
| 6876 | return -EINVAL; | 6909 | return -EINVAL; |
| 6877 | 6910 | ||
| 6878 | retval = -ESRCH; | 6911 | retval = -ESRCH; |
| 6879 | read_lock(&tasklist_lock); | 6912 | rcu_read_lock(); |
| 6880 | p = find_process_by_pid(pid); | 6913 | p = find_process_by_pid(pid); |
| 6881 | if (!p) | 6914 | if (!p) |
| 6882 | goto out_unlock; | 6915 | goto out_unlock; |
| @@ -6889,13 +6922,13 @@ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, | |||
| 6889 | time_slice = p->sched_class->get_rr_interval(rq, p); | 6922 | time_slice = p->sched_class->get_rr_interval(rq, p); |
| 6890 | task_rq_unlock(rq, &flags); | 6923 | task_rq_unlock(rq, &flags); |
| 6891 | 6924 | ||
| 6892 | read_unlock(&tasklist_lock); | 6925 | rcu_read_unlock(); |
| 6893 | jiffies_to_timespec(time_slice, &t); | 6926 | jiffies_to_timespec(time_slice, &t); |
| 6894 | retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0; | 6927 | retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0; |
| 6895 | return retval; | 6928 | return retval; |
| 6896 | 6929 | ||
| 6897 | out_unlock: | 6930 | out_unlock: |
| 6898 | read_unlock(&tasklist_lock); | 6931 | rcu_read_unlock(); |
| 6899 | return retval; | 6932 | return retval; |
| 6900 | } | 6933 | } |
| 6901 | 6934 | ||
| @@ -6907,23 +6940,23 @@ void sched_show_task(struct task_struct *p) | |||
| 6907 | unsigned state; | 6940 | unsigned state; |
| 6908 | 6941 | ||
| 6909 | state = p->state ? __ffs(p->state) + 1 : 0; | 6942 | state = p->state ? __ffs(p->state) + 1 : 0; |
| 6910 | printk(KERN_INFO "%-13.13s %c", p->comm, | 6943 | pr_info("%-13.13s %c", p->comm, |
| 6911 | state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?'); | 6944 | state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?'); |
| 6912 | #if BITS_PER_LONG == 32 | 6945 | #if BITS_PER_LONG == 32 |
| 6913 | if (state == TASK_RUNNING) | 6946 | if (state == TASK_RUNNING) |
| 6914 | printk(KERN_CONT " running "); | 6947 | pr_cont(" running "); |
| 6915 | else | 6948 | else |
| 6916 | printk(KERN_CONT " %08lx ", thread_saved_pc(p)); | 6949 | pr_cont(" %08lx ", thread_saved_pc(p)); |
| 6917 | #else | 6950 | #else |
| 6918 | if (state == TASK_RUNNING) | 6951 | if (state == TASK_RUNNING) |
| 6919 | printk(KERN_CONT " running task "); | 6952 | pr_cont(" running task "); |
| 6920 | else | 6953 | else |
| 6921 | printk(KERN_CONT " %016lx ", thread_saved_pc(p)); | 6954 | pr_cont(" %016lx ", thread_saved_pc(p)); |
| 6922 | #endif | 6955 | #endif |
| 6923 | #ifdef CONFIG_DEBUG_STACK_USAGE | 6956 | #ifdef CONFIG_DEBUG_STACK_USAGE |
| 6924 | free = stack_not_used(p); | 6957 | free = stack_not_used(p); |
| 6925 | #endif | 6958 | #endif |
| 6926 | printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free, | 6959 | pr_cont("%5lu %5d %6d 0x%08lx\n", free, |
| 6927 | task_pid_nr(p), task_pid_nr(p->real_parent), | 6960 | task_pid_nr(p), task_pid_nr(p->real_parent), |
| 6928 | (unsigned long)task_thread_info(p)->flags); | 6961 | (unsigned long)task_thread_info(p)->flags); |
| 6929 | 6962 | ||
| @@ -6935,11 +6968,9 @@ void show_state_filter(unsigned long state_filter) | |||
| 6935 | struct task_struct *g, *p; | 6968 | struct task_struct *g, *p; |
| 6936 | 6969 | ||
| 6937 | #if BITS_PER_LONG == 32 | 6970 | #if BITS_PER_LONG == 32 |
| 6938 | printk(KERN_INFO | 6971 | pr_info(" task PC stack pid father\n"); |
| 6939 | " task PC stack pid father\n"); | ||
| 6940 | #else | 6972 | #else |
| 6941 | printk(KERN_INFO | 6973 | pr_info(" task PC stack pid father\n"); |
| 6942 | " task PC stack pid father\n"); | ||
| 6943 | #endif | 6974 | #endif |
| 6944 | read_lock(&tasklist_lock); | 6975 | read_lock(&tasklist_lock); |
| 6945 | do_each_thread(g, p) { | 6976 | do_each_thread(g, p) { |
| @@ -6986,6 +7017,7 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) | |||
| 6986 | raw_spin_lock_irqsave(&rq->lock, flags); | 7017 | raw_spin_lock_irqsave(&rq->lock, flags); |
| 6987 | 7018 | ||
| 6988 | __sched_fork(idle); | 7019 | __sched_fork(idle); |
| 7020 | idle->state = TASK_RUNNING; | ||
| 6989 | idle->se.exec_start = sched_clock(); | 7021 | idle->se.exec_start = sched_clock(); |
| 6990 | 7022 | ||
| 6991 | cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu)); | 7023 | cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu)); |
| @@ -7100,7 +7132,23 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask) | |||
| 7100 | struct rq *rq; | 7132 | struct rq *rq; |
| 7101 | int ret = 0; | 7133 | int ret = 0; |
| 7102 | 7134 | ||
| 7135 | /* | ||
| 7136 | * Since we rely on wake-ups to migrate sleeping tasks, don't change | ||
| 7137 | * the ->cpus_allowed mask from under waking tasks, which would be | ||
| 7138 | * possible when we change rq->lock in ttwu(), so synchronize against | ||
| 7139 | * TASK_WAKING to avoid that. | ||
| 7140 | */ | ||
| 7141 | again: | ||
| 7142 | while (p->state == TASK_WAKING) | ||
| 7143 | cpu_relax(); | ||
| 7144 | |||
| 7103 | rq = task_rq_lock(p, &flags); | 7145 | rq = task_rq_lock(p, &flags); |
| 7146 | |||
| 7147 | if (p->state == TASK_WAKING) { | ||
| 7148 | task_rq_unlock(rq, &flags); | ||
| 7149 | goto again; | ||
| 7150 | } | ||
| 7151 | |||
| 7104 | if (!cpumask_intersects(new_mask, cpu_active_mask)) { | 7152 | if (!cpumask_intersects(new_mask, cpu_active_mask)) { |
| 7105 | ret = -EINVAL; | 7153 | ret = -EINVAL; |
| 7106 | goto out; | 7154 | goto out; |
| @@ -7156,7 +7204,7 @@ EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr); | |||
| 7156 | static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu) | 7204 | static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu) |
| 7157 | { | 7205 | { |
| 7158 | struct rq *rq_dest, *rq_src; | 7206 | struct rq *rq_dest, *rq_src; |
| 7159 | int ret = 0, on_rq; | 7207 | int ret = 0; |
| 7160 | 7208 | ||
| 7161 | if (unlikely(!cpu_active(dest_cpu))) | 7209 | if (unlikely(!cpu_active(dest_cpu))) |
| 7162 | return ret; | 7210 | return ret; |
| @@ -7172,12 +7220,13 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu) | |||
| 7172 | if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed)) | 7220 | if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed)) |
| 7173 | goto fail; | 7221 | goto fail; |
| 7174 | 7222 | ||
| 7175 | on_rq = p->se.on_rq; | 7223 | /* |
| 7176 | if (on_rq) | 7224 | * If we're not on a rq, the next wake-up will ensure we're |
| 7225 | * placed properly. | ||
| 7226 | */ | ||
| 7227 | if (p->se.on_rq) { | ||
| 7177 | deactivate_task(rq_src, p, 0); | 7228 | deactivate_task(rq_src, p, 0); |
| 7178 | 7229 | set_task_cpu(p, dest_cpu); | |
| 7179 | set_task_cpu(p, dest_cpu); | ||
| 7180 | if (on_rq) { | ||
| 7181 | activate_task(rq_dest, p, 0); | 7230 | activate_task(rq_dest, p, 0); |
| 7182 | check_preempt_curr(rq_dest, p, 0); | 7231 | check_preempt_curr(rq_dest, p, 0); |
| 7183 | } | 7232 | } |
| @@ -7273,37 +7322,10 @@ static int __migrate_task_irq(struct task_struct *p, int src_cpu, int dest_cpu) | |||
| 7273 | static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p) | 7322 | static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p) |
| 7274 | { | 7323 | { |
| 7275 | int dest_cpu; | 7324 | int dest_cpu; |
| 7276 | const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(dead_cpu)); | ||
| 7277 | 7325 | ||
| 7278 | again: | 7326 | again: |
| 7279 | /* Look for allowed, online CPU in same node. */ | 7327 | dest_cpu = select_fallback_rq(dead_cpu, p); |
| 7280 | for_each_cpu_and(dest_cpu, nodemask, cpu_active_mask) | ||
| 7281 | if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed)) | ||
| 7282 | goto move; | ||
| 7283 | |||
| 7284 | /* Any allowed, online CPU? */ | ||
| 7285 | dest_cpu = cpumask_any_and(&p->cpus_allowed, cpu_active_mask); | ||
| 7286 | if (dest_cpu < nr_cpu_ids) | ||
| 7287 | goto move; | ||
| 7288 | |||
| 7289 | /* No more Mr. Nice Guy. */ | ||
| 7290 | if (dest_cpu >= nr_cpu_ids) { | ||
| 7291 | cpuset_cpus_allowed_locked(p, &p->cpus_allowed); | ||
| 7292 | dest_cpu = cpumask_any_and(cpu_active_mask, &p->cpus_allowed); | ||
| 7293 | |||
| 7294 | /* | ||
| 7295 | * Don't tell them about moving exiting tasks or | ||
| 7296 | * kernel threads (both mm NULL), since they never | ||
| 7297 | * leave kernel. | ||
| 7298 | */ | ||
| 7299 | if (p->mm && printk_ratelimit()) { | ||
| 7300 | printk(KERN_INFO "process %d (%s) no " | ||
| 7301 | "longer affine to cpu%d\n", | ||
| 7302 | task_pid_nr(p), p->comm, dead_cpu); | ||
| 7303 | } | ||
| 7304 | } | ||
| 7305 | 7328 | ||
| 7306 | move: | ||
| 7307 | /* It can have affinity changed while we were choosing. */ | 7329 | /* It can have affinity changed while we were choosing. */ |
| 7308 | if (unlikely(!__migrate_task_irq(p, dead_cpu, dest_cpu))) | 7330 | if (unlikely(!__migrate_task_irq(p, dead_cpu, dest_cpu))) |
| 7309 | goto again; | 7331 | goto again; |
| @@ -7806,48 +7828,44 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, | |||
| 7806 | printk(KERN_DEBUG "%*s domain %d: ", level, "", level); | 7828 | printk(KERN_DEBUG "%*s domain %d: ", level, "", level); |
| 7807 | 7829 | ||
| 7808 | if (!(sd->flags & SD_LOAD_BALANCE)) { | 7830 | if (!(sd->flags & SD_LOAD_BALANCE)) { |
| 7809 | printk("does not load-balance\n"); | 7831 | pr_cont("does not load-balance\n"); |
| 7810 | if (sd->parent) | 7832 | if (sd->parent) |
| 7811 | printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain" | 7833 | pr_err("ERROR: !SD_LOAD_BALANCE domain has parent\n"); |
| 7812 | " has parent"); | ||
| 7813 | return -1; | 7834 | return -1; |
| 7814 | } | 7835 | } |
| 7815 | 7836 | ||
| 7816 | printk(KERN_CONT "span %s level %s\n", str, sd->name); | 7837 | pr_cont("span %s level %s\n", str, sd->name); |
| 7817 | 7838 | ||
| 7818 | if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) { | 7839 | if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) { |
| 7819 | printk(KERN_ERR "ERROR: domain->span does not contain " | 7840 | pr_err("ERROR: domain->span does not contain CPU%d\n", cpu); |
| 7820 | "CPU%d\n", cpu); | ||
| 7821 | } | 7841 | } |
| 7822 | if (!cpumask_test_cpu(cpu, sched_group_cpus(group))) { | 7842 | if (!cpumask_test_cpu(cpu, sched_group_cpus(group))) { |
| 7823 | printk(KERN_ERR "ERROR: domain->groups does not contain" | 7843 | pr_err("ERROR: domain->groups does not contain CPU%d\n", cpu); |
| 7824 | " CPU%d\n", cpu); | ||
| 7825 | } | 7844 | } |
| 7826 | 7845 | ||
| 7827 | printk(KERN_DEBUG "%*s groups:", level + 1, ""); | 7846 | printk(KERN_DEBUG "%*s groups:", level + 1, ""); |
| 7828 | do { | 7847 | do { |
| 7829 | if (!group) { | 7848 | if (!group) { |
| 7830 | printk("\n"); | 7849 | pr_cont("\n"); |
| 7831 | printk(KERN_ERR "ERROR: group is NULL\n"); | 7850 | pr_err("ERROR: group is NULL\n"); |
| 7832 | break; | 7851 | break; |
| 7833 | } | 7852 | } |
| 7834 | 7853 | ||
| 7835 | if (!group->cpu_power) { | 7854 | if (!group->cpu_power) { |
| 7836 | printk(KERN_CONT "\n"); | 7855 | pr_cont("\n"); |
| 7837 | printk(KERN_ERR "ERROR: domain->cpu_power not " | 7856 | pr_err("ERROR: domain->cpu_power not set\n"); |
| 7838 | "set\n"); | ||
| 7839 | break; | 7857 | break; |
| 7840 | } | 7858 | } |
| 7841 | 7859 | ||
| 7842 | if (!cpumask_weight(sched_group_cpus(group))) { | 7860 | if (!cpumask_weight(sched_group_cpus(group))) { |
| 7843 | printk(KERN_CONT "\n"); | 7861 | pr_cont("\n"); |
| 7844 | printk(KERN_ERR "ERROR: empty group\n"); | 7862 | pr_err("ERROR: empty group\n"); |
| 7845 | break; | 7863 | break; |
| 7846 | } | 7864 | } |
| 7847 | 7865 | ||
| 7848 | if (cpumask_intersects(groupmask, sched_group_cpus(group))) { | 7866 | if (cpumask_intersects(groupmask, sched_group_cpus(group))) { |
| 7849 | printk(KERN_CONT "\n"); | 7867 | pr_cont("\n"); |
| 7850 | printk(KERN_ERR "ERROR: repeated CPUs\n"); | 7868 | pr_err("ERROR: repeated CPUs\n"); |
| 7851 | break; | 7869 | break; |
| 7852 | } | 7870 | } |
| 7853 | 7871 | ||
| @@ -7855,23 +7873,21 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, | |||
| 7855 | 7873 | ||
| 7856 | cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group)); | 7874 | cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group)); |
| 7857 | 7875 | ||
| 7858 | printk(KERN_CONT " %s", str); | 7876 | pr_cont(" %s", str); |
| 7859 | if (group->cpu_power != SCHED_LOAD_SCALE) { | 7877 | if (group->cpu_power != SCHED_LOAD_SCALE) { |
| 7860 | printk(KERN_CONT " (cpu_power = %d)", | 7878 | pr_cont(" (cpu_power = %d)", group->cpu_power); |
| 7861 | group->cpu_power); | ||
| 7862 | } | 7879 | } |
| 7863 | 7880 | ||
| 7864 | group = group->next; | 7881 | group = group->next; |
| 7865 | } while (group != sd->groups); | 7882 | } while (group != sd->groups); |
| 7866 | printk(KERN_CONT "\n"); | 7883 | pr_cont("\n"); |
| 7867 | 7884 | ||
| 7868 | if (!cpumask_equal(sched_domain_span(sd), groupmask)) | 7885 | if (!cpumask_equal(sched_domain_span(sd), groupmask)) |
| 7869 | printk(KERN_ERR "ERROR: groups don't span domain->span\n"); | 7886 | pr_err("ERROR: groups don't span domain->span\n"); |
| 7870 | 7887 | ||
| 7871 | if (sd->parent && | 7888 | if (sd->parent && |
| 7872 | !cpumask_subset(groupmask, sched_domain_span(sd->parent))) | 7889 | !cpumask_subset(groupmask, sched_domain_span(sd->parent))) |
| 7873 | printk(KERN_ERR "ERROR: parent span is not a superset " | 7890 | pr_err("ERROR: parent span is not a superset of domain->span\n"); |
| 7874 | "of domain->span\n"); | ||
| 7875 | return 0; | 7891 | return 0; |
| 7876 | } | 7892 | } |
| 7877 | 7893 | ||
| @@ -8427,8 +8443,7 @@ static int build_numa_sched_groups(struct s_data *d, | |||
| 8427 | sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(), | 8443 | sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(), |
| 8428 | GFP_KERNEL, num); | 8444 | GFP_KERNEL, num); |
| 8429 | if (!sg) { | 8445 | if (!sg) { |
| 8430 | printk(KERN_WARNING "Can not alloc domain group for node %d\n", | 8446 | pr_warning("Can not alloc domain group for node %d\n", num); |
| 8431 | num); | ||
| 8432 | return -ENOMEM; | 8447 | return -ENOMEM; |
| 8433 | } | 8448 | } |
| 8434 | d->sched_group_nodes[num] = sg; | 8449 | d->sched_group_nodes[num] = sg; |
| @@ -8457,8 +8472,8 @@ static int build_numa_sched_groups(struct s_data *d, | |||
| 8457 | sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(), | 8472 | sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(), |
| 8458 | GFP_KERNEL, num); | 8473 | GFP_KERNEL, num); |
| 8459 | if (!sg) { | 8474 | if (!sg) { |
| 8460 | printk(KERN_WARNING | 8475 | pr_warning("Can not alloc domain group for node %d\n", |
| 8461 | "Can not alloc domain group for node %d\n", j); | 8476 | j); |
| 8462 | return -ENOMEM; | 8477 | return -ENOMEM; |
| 8463 | } | 8478 | } |
| 8464 | sg->cpu_power = 0; | 8479 | sg->cpu_power = 0; |
| @@ -8686,7 +8701,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d, | |||
| 8686 | d->sched_group_nodes = kcalloc(nr_node_ids, | 8701 | d->sched_group_nodes = kcalloc(nr_node_ids, |
| 8687 | sizeof(struct sched_group *), GFP_KERNEL); | 8702 | sizeof(struct sched_group *), GFP_KERNEL); |
| 8688 | if (!d->sched_group_nodes) { | 8703 | if (!d->sched_group_nodes) { |
| 8689 | printk(KERN_WARNING "Can not alloc sched group node list\n"); | 8704 | pr_warning("Can not alloc sched group node list\n"); |
| 8690 | return sa_notcovered; | 8705 | return sa_notcovered; |
| 8691 | } | 8706 | } |
| 8692 | sched_group_nodes_bycpu[cpumask_first(cpu_map)] = d->sched_group_nodes; | 8707 | sched_group_nodes_bycpu[cpumask_first(cpu_map)] = d->sched_group_nodes; |
| @@ -8703,7 +8718,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d, | |||
| 8703 | return sa_send_covered; | 8718 | return sa_send_covered; |
| 8704 | d->rd = alloc_rootdomain(); | 8719 | d->rd = alloc_rootdomain(); |
| 8705 | if (!d->rd) { | 8720 | if (!d->rd) { |
| 8706 | printk(KERN_WARNING "Cannot alloc root domain\n"); | 8721 | pr_warning("Cannot alloc root domain\n"); |
| 8707 | return sa_tmpmask; | 8722 | return sa_tmpmask; |
| 8708 | } | 8723 | } |
| 8709 | return sa_rootdomain; | 8724 | return sa_rootdomain; |
| @@ -9668,7 +9683,7 @@ void __init sched_init(void) | |||
| 9668 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 9683 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
| 9669 | static inline int preempt_count_equals(int preempt_offset) | 9684 | static inline int preempt_count_equals(int preempt_offset) |
| 9670 | { | 9685 | { |
| 9671 | int nested = preempt_count() & ~PREEMPT_ACTIVE; | 9686 | int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth(); |
| 9672 | 9687 | ||
| 9673 | return (nested == PREEMPT_INATOMIC_BASE + preempt_offset); | 9688 | return (nested == PREEMPT_INATOMIC_BASE + preempt_offset); |
| 9674 | } | 9689 | } |
| @@ -9685,13 +9700,11 @@ void __might_sleep(char *file, int line, int preempt_offset) | |||
| 9685 | return; | 9700 | return; |
| 9686 | prev_jiffy = jiffies; | 9701 | prev_jiffy = jiffies; |
| 9687 | 9702 | ||
| 9688 | printk(KERN_ERR | 9703 | pr_err("BUG: sleeping function called from invalid context at %s:%d\n", |
| 9689 | "BUG: sleeping function called from invalid context at %s:%d\n", | 9704 | file, line); |
| 9690 | file, line); | 9705 | pr_err("in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n", |
| 9691 | printk(KERN_ERR | 9706 | in_atomic(), irqs_disabled(), |
| 9692 | "in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n", | 9707 | current->pid, current->comm); |
| 9693 | in_atomic(), irqs_disabled(), | ||
| 9694 | current->pid, current->comm); | ||
| 9695 | 9708 | ||
| 9696 | debug_show_held_locks(current); | 9709 | debug_show_held_locks(current); |
| 9697 | if (irqs_disabled()) | 9710 | if (irqs_disabled()) |
| @@ -10083,7 +10096,7 @@ void sched_move_task(struct task_struct *tsk) | |||
| 10083 | 10096 | ||
| 10084 | #ifdef CONFIG_FAIR_GROUP_SCHED | 10097 | #ifdef CONFIG_FAIR_GROUP_SCHED |
| 10085 | if (tsk->sched_class->moved_group) | 10098 | if (tsk->sched_class->moved_group) |
| 10086 | tsk->sched_class->moved_group(tsk); | 10099 | tsk->sched_class->moved_group(tsk, on_rq); |
| 10087 | #endif | 10100 | #endif |
| 10088 | 10101 | ||
| 10089 | if (unlikely(running)) | 10102 | if (unlikely(running)) |
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c index 479ce5682d7c..5b496132c28a 100644 --- a/kernel/sched_clock.c +++ b/kernel/sched_clock.c | |||
| @@ -236,6 +236,18 @@ void sched_clock_idle_wakeup_event(u64 delta_ns) | |||
| 236 | } | 236 | } |
| 237 | EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event); | 237 | EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event); |
| 238 | 238 | ||
| 239 | unsigned long long cpu_clock(int cpu) | ||
| 240 | { | ||
| 241 | unsigned long long clock; | ||
| 242 | unsigned long flags; | ||
| 243 | |||
| 244 | local_irq_save(flags); | ||
| 245 | clock = sched_clock_cpu(cpu); | ||
| 246 | local_irq_restore(flags); | ||
| 247 | |||
| 248 | return clock; | ||
| 249 | } | ||
| 250 | |||
| 239 | #else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */ | 251 | #else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */ |
| 240 | 252 | ||
| 241 | void sched_clock_init(void) | 253 | void sched_clock_init(void) |
| @@ -251,17 +263,12 @@ u64 sched_clock_cpu(int cpu) | |||
| 251 | return sched_clock(); | 263 | return sched_clock(); |
| 252 | } | 264 | } |
| 253 | 265 | ||
| 254 | #endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */ | ||
| 255 | 266 | ||
| 256 | unsigned long long cpu_clock(int cpu) | 267 | unsigned long long cpu_clock(int cpu) |
| 257 | { | 268 | { |
| 258 | unsigned long long clock; | 269 | return sched_clock_cpu(cpu); |
| 259 | unsigned long flags; | 270 | } |
| 260 | 271 | ||
| 261 | local_irq_save(flags); | 272 | #endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */ |
| 262 | clock = sched_clock_cpu(cpu); | ||
| 263 | local_irq_restore(flags); | ||
| 264 | 273 | ||
| 265 | return clock; | ||
| 266 | } | ||
| 267 | EXPORT_SYMBOL_GPL(cpu_clock); | 274 | EXPORT_SYMBOL_GPL(cpu_clock); |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 5bedf6e3ebf3..42ac3c9f66f6 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
| @@ -510,6 +510,7 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr, | |||
| 510 | curr->sum_exec_runtime += delta_exec; | 510 | curr->sum_exec_runtime += delta_exec; |
| 511 | schedstat_add(cfs_rq, exec_clock, delta_exec); | 511 | schedstat_add(cfs_rq, exec_clock, delta_exec); |
| 512 | delta_exec_weighted = calc_delta_fair(delta_exec, curr); | 512 | delta_exec_weighted = calc_delta_fair(delta_exec, curr); |
| 513 | |||
| 513 | curr->vruntime += delta_exec_weighted; | 514 | curr->vruntime += delta_exec_weighted; |
| 514 | update_min_vruntime(cfs_rq); | 515 | update_min_vruntime(cfs_rq); |
| 515 | } | 516 | } |
| @@ -765,16 +766,26 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial) | |||
| 765 | se->vruntime = vruntime; | 766 | se->vruntime = vruntime; |
| 766 | } | 767 | } |
| 767 | 768 | ||
| 769 | #define ENQUEUE_WAKEUP 1 | ||
| 770 | #define ENQUEUE_MIGRATE 2 | ||
| 771 | |||
| 768 | static void | 772 | static void |
| 769 | enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup) | 773 | enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) |
| 770 | { | 774 | { |
| 771 | /* | 775 | /* |
| 776 | * Update the normalized vruntime before updating min_vruntime | ||
| 777 | * through callig update_curr(). | ||
| 778 | */ | ||
| 779 | if (!(flags & ENQUEUE_WAKEUP) || (flags & ENQUEUE_MIGRATE)) | ||
| 780 | se->vruntime += cfs_rq->min_vruntime; | ||
| 781 | |||
| 782 | /* | ||
| 772 | * Update run-time statistics of the 'current'. | 783 | * Update run-time statistics of the 'current'. |
| 773 | */ | 784 | */ |
| 774 | update_curr(cfs_rq); | 785 | update_curr(cfs_rq); |
| 775 | account_entity_enqueue(cfs_rq, se); | 786 | account_entity_enqueue(cfs_rq, se); |
| 776 | 787 | ||
| 777 | if (wakeup) { | 788 | if (flags & ENQUEUE_WAKEUP) { |
| 778 | place_entity(cfs_rq, se, 0); | 789 | place_entity(cfs_rq, se, 0); |
| 779 | enqueue_sleeper(cfs_rq, se); | 790 | enqueue_sleeper(cfs_rq, se); |
| 780 | } | 791 | } |
| @@ -828,6 +839,14 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep) | |||
| 828 | __dequeue_entity(cfs_rq, se); | 839 | __dequeue_entity(cfs_rq, se); |
| 829 | account_entity_dequeue(cfs_rq, se); | 840 | account_entity_dequeue(cfs_rq, se); |
| 830 | update_min_vruntime(cfs_rq); | 841 | update_min_vruntime(cfs_rq); |
| 842 | |||
| 843 | /* | ||
| 844 | * Normalize the entity after updating the min_vruntime because the | ||
| 845 | * update can refer to the ->curr item and we need to reflect this | ||
| 846 | * movement in our normalized position. | ||
| 847 | */ | ||
| 848 | if (!sleep) | ||
| 849 | se->vruntime -= cfs_rq->min_vruntime; | ||
| 831 | } | 850 | } |
| 832 | 851 | ||
| 833 | /* | 852 | /* |
| @@ -1038,13 +1057,19 @@ static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup) | |||
| 1038 | { | 1057 | { |
| 1039 | struct cfs_rq *cfs_rq; | 1058 | struct cfs_rq *cfs_rq; |
| 1040 | struct sched_entity *se = &p->se; | 1059 | struct sched_entity *se = &p->se; |
| 1060 | int flags = 0; | ||
| 1061 | |||
| 1062 | if (wakeup) | ||
| 1063 | flags |= ENQUEUE_WAKEUP; | ||
| 1064 | if (p->state == TASK_WAKING) | ||
| 1065 | flags |= ENQUEUE_MIGRATE; | ||
| 1041 | 1066 | ||
| 1042 | for_each_sched_entity(se) { | 1067 | for_each_sched_entity(se) { |
| 1043 | if (se->on_rq) | 1068 | if (se->on_rq) |
| 1044 | break; | 1069 | break; |
| 1045 | cfs_rq = cfs_rq_of(se); | 1070 | cfs_rq = cfs_rq_of(se); |
| 1046 | enqueue_entity(cfs_rq, se, wakeup); | 1071 | enqueue_entity(cfs_rq, se, flags); |
| 1047 | wakeup = 1; | 1072 | flags = ENQUEUE_WAKEUP; |
| 1048 | } | 1073 | } |
| 1049 | 1074 | ||
| 1050 | hrtick_update(rq); | 1075 | hrtick_update(rq); |
| @@ -1120,6 +1145,14 @@ static void yield_task_fair(struct rq *rq) | |||
| 1120 | 1145 | ||
| 1121 | #ifdef CONFIG_SMP | 1146 | #ifdef CONFIG_SMP |
| 1122 | 1147 | ||
| 1148 | static void task_waking_fair(struct rq *rq, struct task_struct *p) | ||
| 1149 | { | ||
| 1150 | struct sched_entity *se = &p->se; | ||
| 1151 | struct cfs_rq *cfs_rq = cfs_rq_of(se); | ||
| 1152 | |||
| 1153 | se->vruntime -= cfs_rq->min_vruntime; | ||
| 1154 | } | ||
| 1155 | |||
| 1123 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1156 | #ifdef CONFIG_FAIR_GROUP_SCHED |
| 1124 | /* | 1157 | /* |
| 1125 | * effective_load() calculates the load change as seen from the root_task_group | 1158 | * effective_load() calculates the load change as seen from the root_task_group |
| @@ -1429,6 +1462,9 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag | |||
| 1429 | } | 1462 | } |
| 1430 | 1463 | ||
| 1431 | for_each_domain(cpu, tmp) { | 1464 | for_each_domain(cpu, tmp) { |
| 1465 | if (!(tmp->flags & SD_LOAD_BALANCE)) | ||
| 1466 | continue; | ||
| 1467 | |||
| 1432 | /* | 1468 | /* |
| 1433 | * If power savings logic is enabled for a domain, see if we | 1469 | * If power savings logic is enabled for a domain, see if we |
| 1434 | * are not overloaded, if so, don't balance wider. | 1470 | * are not overloaded, if so, don't balance wider. |
| @@ -1975,6 +2011,8 @@ static void task_fork_fair(struct task_struct *p) | |||
| 1975 | resched_task(rq->curr); | 2011 | resched_task(rq->curr); |
| 1976 | } | 2012 | } |
| 1977 | 2013 | ||
| 2014 | se->vruntime -= cfs_rq->min_vruntime; | ||
| 2015 | |||
| 1978 | raw_spin_unlock_irqrestore(&rq->lock, flags); | 2016 | raw_spin_unlock_irqrestore(&rq->lock, flags); |
| 1979 | } | 2017 | } |
| 1980 | 2018 | ||
| @@ -2028,12 +2066,13 @@ static void set_curr_task_fair(struct rq *rq) | |||
| 2028 | } | 2066 | } |
| 2029 | 2067 | ||
| 2030 | #ifdef CONFIG_FAIR_GROUP_SCHED | 2068 | #ifdef CONFIG_FAIR_GROUP_SCHED |
| 2031 | static void moved_group_fair(struct task_struct *p) | 2069 | static void moved_group_fair(struct task_struct *p, int on_rq) |
| 2032 | { | 2070 | { |
| 2033 | struct cfs_rq *cfs_rq = task_cfs_rq(p); | 2071 | struct cfs_rq *cfs_rq = task_cfs_rq(p); |
| 2034 | 2072 | ||
| 2035 | update_curr(cfs_rq); | 2073 | update_curr(cfs_rq); |
| 2036 | place_entity(cfs_rq, &p->se, 1); | 2074 | if (!on_rq) |
| 2075 | place_entity(cfs_rq, &p->se, 1); | ||
| 2037 | } | 2076 | } |
| 2038 | #endif | 2077 | #endif |
| 2039 | 2078 | ||
| @@ -2073,6 +2112,8 @@ static const struct sched_class fair_sched_class = { | |||
| 2073 | .move_one_task = move_one_task_fair, | 2112 | .move_one_task = move_one_task_fair, |
| 2074 | .rq_online = rq_online_fair, | 2113 | .rq_online = rq_online_fair, |
| 2075 | .rq_offline = rq_offline_fair, | 2114 | .rq_offline = rq_offline_fair, |
| 2115 | |||
| 2116 | .task_waking = task_waking_fair, | ||
| 2076 | #endif | 2117 | #endif |
| 2077 | 2118 | ||
| 2078 | .set_curr_task = set_curr_task_fair, | 2119 | .set_curr_task = set_curr_task_fair, |
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c index 5f93b570d383..21b969a28725 100644 --- a/kernel/sched_idletask.c +++ b/kernel/sched_idletask.c | |||
| @@ -35,7 +35,7 @@ static void | |||
| 35 | dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep) | 35 | dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep) |
| 36 | { | 36 | { |
| 37 | raw_spin_unlock_irq(&rq->lock); | 37 | raw_spin_unlock_irq(&rq->lock); |
| 38 | printk(KERN_ERR "bad: scheduling from the idle thread!\n"); | 38 | pr_err("bad: scheduling from the idle thread!\n"); |
| 39 | dump_stack(); | 39 | dump_stack(); |
| 40 | raw_spin_lock_irq(&rq->lock); | 40 | raw_spin_lock_irq(&rq->lock); |
| 41 | } | 41 | } |
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index d2ea2828164e..f48328ac216f 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
| @@ -1472,7 +1472,7 @@ static void post_schedule_rt(struct rq *rq) | |||
| 1472 | * If we are not running and we are not going to reschedule soon, we should | 1472 | * If we are not running and we are not going to reschedule soon, we should |
| 1473 | * try to push tasks away now | 1473 | * try to push tasks away now |
| 1474 | */ | 1474 | */ |
| 1475 | static void task_wake_up_rt(struct rq *rq, struct task_struct *p) | 1475 | static void task_woken_rt(struct rq *rq, struct task_struct *p) |
| 1476 | { | 1476 | { |
| 1477 | if (!task_running(rq, p) && | 1477 | if (!task_running(rq, p) && |
| 1478 | !test_tsk_need_resched(rq->curr) && | 1478 | !test_tsk_need_resched(rq->curr) && |
| @@ -1753,7 +1753,7 @@ static const struct sched_class rt_sched_class = { | |||
| 1753 | .rq_offline = rq_offline_rt, | 1753 | .rq_offline = rq_offline_rt, |
| 1754 | .pre_schedule = pre_schedule_rt, | 1754 | .pre_schedule = pre_schedule_rt, |
| 1755 | .post_schedule = post_schedule_rt, | 1755 | .post_schedule = post_schedule_rt, |
| 1756 | .task_wake_up = task_wake_up_rt, | 1756 | .task_woken = task_woken_rt, |
| 1757 | .switched_from = switched_from_rt, | 1757 | .switched_from = switched_from_rt, |
| 1758 | #endif | 1758 | #endif |
| 1759 | 1759 | ||
diff --git a/kernel/signal.c b/kernel/signal.c index 1814e68e4de3..d09692b40376 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
| @@ -218,13 +218,13 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi | |||
| 218 | struct user_struct *user; | 218 | struct user_struct *user; |
| 219 | 219 | ||
| 220 | /* | 220 | /* |
| 221 | * We won't get problems with the target's UID changing under us | 221 | * Protect access to @t credentials. This can go away when all |
| 222 | * because changing it requires RCU be used, and if t != current, the | 222 | * callers hold rcu read lock. |
| 223 | * caller must be holding the RCU readlock (by way of a spinlock) and | ||
| 224 | * we use RCU protection here | ||
| 225 | */ | 223 | */ |
| 224 | rcu_read_lock(); | ||
| 226 | user = get_uid(__task_cred(t)->user); | 225 | user = get_uid(__task_cred(t)->user); |
| 227 | atomic_inc(&user->sigpending); | 226 | atomic_inc(&user->sigpending); |
| 227 | rcu_read_unlock(); | ||
| 228 | 228 | ||
| 229 | if (override_rlimit || | 229 | if (override_rlimit || |
| 230 | atomic_read(&user->sigpending) <= | 230 | atomic_read(&user->sigpending) <= |
| @@ -1179,11 +1179,12 @@ int kill_pid_info_as_uid(int sig, struct siginfo *info, struct pid *pid, | |||
| 1179 | int ret = -EINVAL; | 1179 | int ret = -EINVAL; |
| 1180 | struct task_struct *p; | 1180 | struct task_struct *p; |
| 1181 | const struct cred *pcred; | 1181 | const struct cred *pcred; |
| 1182 | unsigned long flags; | ||
| 1182 | 1183 | ||
| 1183 | if (!valid_signal(sig)) | 1184 | if (!valid_signal(sig)) |
| 1184 | return ret; | 1185 | return ret; |
| 1185 | 1186 | ||
| 1186 | read_lock(&tasklist_lock); | 1187 | rcu_read_lock(); |
| 1187 | p = pid_task(pid, PIDTYPE_PID); | 1188 | p = pid_task(pid, PIDTYPE_PID); |
| 1188 | if (!p) { | 1189 | if (!p) { |
| 1189 | ret = -ESRCH; | 1190 | ret = -ESRCH; |
| @@ -1199,14 +1200,16 @@ int kill_pid_info_as_uid(int sig, struct siginfo *info, struct pid *pid, | |||
| 1199 | ret = security_task_kill(p, info, sig, secid); | 1200 | ret = security_task_kill(p, info, sig, secid); |
| 1200 | if (ret) | 1201 | if (ret) |
| 1201 | goto out_unlock; | 1202 | goto out_unlock; |
| 1202 | if (sig && p->sighand) { | 1203 | |
| 1203 | unsigned long flags; | 1204 | if (sig) { |
| 1204 | spin_lock_irqsave(&p->sighand->siglock, flags); | 1205 | if (lock_task_sighand(p, &flags)) { |
| 1205 | ret = __send_signal(sig, info, p, 1, 0); | 1206 | ret = __send_signal(sig, info, p, 1, 0); |
| 1206 | spin_unlock_irqrestore(&p->sighand->siglock, flags); | 1207 | unlock_task_sighand(p, &flags); |
| 1208 | } else | ||
| 1209 | ret = -ESRCH; | ||
| 1207 | } | 1210 | } |
| 1208 | out_unlock: | 1211 | out_unlock: |
| 1209 | read_unlock(&tasklist_lock); | 1212 | rcu_read_unlock(); |
| 1210 | return ret; | 1213 | return ret; |
| 1211 | } | 1214 | } |
| 1212 | EXPORT_SYMBOL_GPL(kill_pid_info_as_uid); | 1215 | EXPORT_SYMBOL_GPL(kill_pid_info_as_uid); |
diff --git a/kernel/sys.c b/kernel/sys.c index 20ccfb5da6af..26a6b73a6b85 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -162,6 +162,7 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval) | |||
| 162 | if (niceval > 19) | 162 | if (niceval > 19) |
| 163 | niceval = 19; | 163 | niceval = 19; |
| 164 | 164 | ||
| 165 | rcu_read_lock(); | ||
| 165 | read_lock(&tasklist_lock); | 166 | read_lock(&tasklist_lock); |
| 166 | switch (which) { | 167 | switch (which) { |
| 167 | case PRIO_PROCESS: | 168 | case PRIO_PROCESS: |
| @@ -199,6 +200,7 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval) | |||
| 199 | } | 200 | } |
| 200 | out_unlock: | 201 | out_unlock: |
| 201 | read_unlock(&tasklist_lock); | 202 | read_unlock(&tasklist_lock); |
| 203 | rcu_read_unlock(); | ||
| 202 | out: | 204 | out: |
| 203 | return error; | 205 | return error; |
| 204 | } | 206 | } |
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 3d5fc0fd1cca..6f740d9f0948 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
| @@ -238,8 +238,9 @@ void clockevents_exchange_device(struct clock_event_device *old, | |||
| 238 | */ | 238 | */ |
| 239 | void clockevents_notify(unsigned long reason, void *arg) | 239 | void clockevents_notify(unsigned long reason, void *arg) |
| 240 | { | 240 | { |
| 241 | struct list_head *node, *tmp; | 241 | struct clock_event_device *dev, *tmp; |
| 242 | unsigned long flags; | 242 | unsigned long flags; |
| 243 | int cpu; | ||
| 243 | 244 | ||
| 244 | raw_spin_lock_irqsave(&clockevents_lock, flags); | 245 | raw_spin_lock_irqsave(&clockevents_lock, flags); |
| 245 | clockevents_do_notify(reason, arg); | 246 | clockevents_do_notify(reason, arg); |
| @@ -250,8 +251,19 @@ void clockevents_notify(unsigned long reason, void *arg) | |||
| 250 | * Unregister the clock event devices which were | 251 | * Unregister the clock event devices which were |
| 251 | * released from the users in the notify chain. | 252 | * released from the users in the notify chain. |
| 252 | */ | 253 | */ |
| 253 | list_for_each_safe(node, tmp, &clockevents_released) | 254 | list_for_each_entry_safe(dev, tmp, &clockevents_released, list) |
| 254 | list_del(node); | 255 | list_del(&dev->list); |
| 256 | /* | ||
| 257 | * Now check whether the CPU has left unused per cpu devices | ||
| 258 | */ | ||
| 259 | cpu = *((int *)arg); | ||
| 260 | list_for_each_entry_safe(dev, tmp, &clockevent_devices, list) { | ||
| 261 | if (cpumask_test_cpu(cpu, dev->cpumask) && | ||
| 262 | cpumask_weight(dev->cpumask) == 1) { | ||
| 263 | BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED); | ||
| 264 | list_del(&dev->list); | ||
| 265 | } | ||
| 266 | } | ||
| 255 | break; | 267 | break; |
| 256 | default: | 268 | default: |
| 257 | break; | 269 | break; |
diff --git a/kernel/timer.c b/kernel/timer.c index 5db5a8d26811..15533b792397 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
| @@ -656,8 +656,6 @@ __mod_timer(struct timer_list *timer, unsigned long expires, | |||
| 656 | 656 | ||
| 657 | debug_activate(timer, expires); | 657 | debug_activate(timer, expires); |
| 658 | 658 | ||
| 659 | new_base = __get_cpu_var(tvec_bases); | ||
| 660 | |||
| 661 | cpu = smp_processor_id(); | 659 | cpu = smp_processor_id(); |
| 662 | 660 | ||
| 663 | #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) | 661 | #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) |
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 7ecab06547a5..375f81a568dc 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
| @@ -282,6 +282,18 @@ static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs); | |||
| 282 | static int kretprobe_dispatcher(struct kretprobe_instance *ri, | 282 | static int kretprobe_dispatcher(struct kretprobe_instance *ri, |
| 283 | struct pt_regs *regs); | 283 | struct pt_regs *regs); |
| 284 | 284 | ||
| 285 | /* Check the name is good for event/group */ | ||
| 286 | static int check_event_name(const char *name) | ||
| 287 | { | ||
| 288 | if (!isalpha(*name) && *name != '_') | ||
| 289 | return 0; | ||
| 290 | while (*++name != '\0') { | ||
| 291 | if (!isalpha(*name) && !isdigit(*name) && *name != '_') | ||
| 292 | return 0; | ||
| 293 | } | ||
| 294 | return 1; | ||
| 295 | } | ||
| 296 | |||
| 285 | /* | 297 | /* |
| 286 | * Allocate new trace_probe and initialize it (including kprobes). | 298 | * Allocate new trace_probe and initialize it (including kprobes). |
| 287 | */ | 299 | */ |
| @@ -293,10 +305,11 @@ static struct trace_probe *alloc_trace_probe(const char *group, | |||
| 293 | int nargs, int is_return) | 305 | int nargs, int is_return) |
| 294 | { | 306 | { |
| 295 | struct trace_probe *tp; | 307 | struct trace_probe *tp; |
| 308 | int ret = -ENOMEM; | ||
| 296 | 309 | ||
| 297 | tp = kzalloc(SIZEOF_TRACE_PROBE(nargs), GFP_KERNEL); | 310 | tp = kzalloc(SIZEOF_TRACE_PROBE(nargs), GFP_KERNEL); |
| 298 | if (!tp) | 311 | if (!tp) |
| 299 | return ERR_PTR(-ENOMEM); | 312 | return ERR_PTR(ret); |
| 300 | 313 | ||
| 301 | if (symbol) { | 314 | if (symbol) { |
| 302 | tp->symbol = kstrdup(symbol, GFP_KERNEL); | 315 | tp->symbol = kstrdup(symbol, GFP_KERNEL); |
| @@ -312,14 +325,20 @@ static struct trace_probe *alloc_trace_probe(const char *group, | |||
| 312 | else | 325 | else |
| 313 | tp->rp.kp.pre_handler = kprobe_dispatcher; | 326 | tp->rp.kp.pre_handler = kprobe_dispatcher; |
| 314 | 327 | ||
| 315 | if (!event) | 328 | if (!event || !check_event_name(event)) { |
| 329 | ret = -EINVAL; | ||
| 316 | goto error; | 330 | goto error; |
| 331 | } | ||
| 332 | |||
| 317 | tp->call.name = kstrdup(event, GFP_KERNEL); | 333 | tp->call.name = kstrdup(event, GFP_KERNEL); |
| 318 | if (!tp->call.name) | 334 | if (!tp->call.name) |
| 319 | goto error; | 335 | goto error; |
| 320 | 336 | ||
| 321 | if (!group) | 337 | if (!group || !check_event_name(group)) { |
| 338 | ret = -EINVAL; | ||
| 322 | goto error; | 339 | goto error; |
| 340 | } | ||
| 341 | |||
| 323 | tp->call.system = kstrdup(group, GFP_KERNEL); | 342 | tp->call.system = kstrdup(group, GFP_KERNEL); |
| 324 | if (!tp->call.system) | 343 | if (!tp->call.system) |
| 325 | goto error; | 344 | goto error; |
| @@ -330,7 +349,7 @@ error: | |||
| 330 | kfree(tp->call.name); | 349 | kfree(tp->call.name); |
| 331 | kfree(tp->symbol); | 350 | kfree(tp->symbol); |
| 332 | kfree(tp); | 351 | kfree(tp); |
| 333 | return ERR_PTR(-ENOMEM); | 352 | return ERR_PTR(ret); |
| 334 | } | 353 | } |
| 335 | 354 | ||
| 336 | static void free_probe_arg(struct probe_arg *arg) | 355 | static void free_probe_arg(struct probe_arg *arg) |
| @@ -695,10 +714,10 @@ static int create_trace_probe(int argc, char **argv) | |||
| 695 | if (!event) { | 714 | if (!event) { |
| 696 | /* Make a new event name */ | 715 | /* Make a new event name */ |
| 697 | if (symbol) | 716 | if (symbol) |
| 698 | snprintf(buf, MAX_EVENT_NAME_LEN, "%c@%s%+ld", | 717 | snprintf(buf, MAX_EVENT_NAME_LEN, "%c_%s_%ld", |
| 699 | is_return ? 'r' : 'p', symbol, offset); | 718 | is_return ? 'r' : 'p', symbol, offset); |
| 700 | else | 719 | else |
| 701 | snprintf(buf, MAX_EVENT_NAME_LEN, "%c@0x%p", | 720 | snprintf(buf, MAX_EVENT_NAME_LEN, "%c_0x%p", |
| 702 | is_return ? 'r' : 'p', addr); | 721 | is_return ? 'r' : 'p', addr); |
| 703 | event = buf; | 722 | event = buf; |
| 704 | } | 723 | } |
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c index f6693969287d..a7974a552ca9 100644 --- a/kernel/trace/trace_sysprof.c +++ b/kernel/trace/trace_sysprof.c | |||
| @@ -93,6 +93,7 @@ static const struct stacktrace_ops backtrace_ops = { | |||
| 93 | .warning_symbol = backtrace_warning_symbol, | 93 | .warning_symbol = backtrace_warning_symbol, |
| 94 | .stack = backtrace_stack, | 94 | .stack = backtrace_stack, |
| 95 | .address = backtrace_address, | 95 | .address = backtrace_address, |
| 96 | .walk_stack = print_context_stack, | ||
| 96 | }; | 97 | }; |
| 97 | 98 | ||
| 98 | static int | 99 | static int |
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c index 76074209f9a2..a4e971dee102 100644 --- a/lib/decompress_bunzip2.c +++ b/lib/decompress_bunzip2.c | |||
| @@ -637,6 +637,8 @@ static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len, | |||
| 637 | 637 | ||
| 638 | /* Allocate bunzip_data. Most fields initialize to zero. */ | 638 | /* Allocate bunzip_data. Most fields initialize to zero. */ |
| 639 | bd = *bdp = malloc(i); | 639 | bd = *bdp = malloc(i); |
| 640 | if (!bd) | ||
| 641 | return RETVAL_OUT_OF_MEMORY; | ||
| 640 | memset(bd, 0, sizeof(struct bunzip_data)); | 642 | memset(bd, 0, sizeof(struct bunzip_data)); |
| 641 | /* Setup input buffer */ | 643 | /* Setup input buffer */ |
| 642 | bd->inbuf = inbuf; | 644 | bd->inbuf = inbuf; |
| @@ -664,6 +666,8 @@ static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len, | |||
| 664 | bd->dbufSize = 100000*(i-BZh0); | 666 | bd->dbufSize = 100000*(i-BZh0); |
| 665 | 667 | ||
| 666 | bd->dbuf = large_malloc(bd->dbufSize * sizeof(int)); | 668 | bd->dbuf = large_malloc(bd->dbufSize * sizeof(int)); |
| 669 | if (!bd->dbuf) | ||
| 670 | return RETVAL_OUT_OF_MEMORY; | ||
| 667 | return RETVAL_OK; | 671 | return RETVAL_OK; |
| 668 | } | 672 | } |
| 669 | 673 | ||
| @@ -686,7 +690,7 @@ STATIC int INIT bunzip2(unsigned char *buf, int len, | |||
| 686 | 690 | ||
| 687 | if (!outbuf) { | 691 | if (!outbuf) { |
| 688 | error("Could not allocate output bufer"); | 692 | error("Could not allocate output bufer"); |
| 689 | return -1; | 693 | return RETVAL_OUT_OF_MEMORY; |
| 690 | } | 694 | } |
| 691 | if (buf) | 695 | if (buf) |
| 692 | inbuf = buf; | 696 | inbuf = buf; |
| @@ -694,6 +698,7 @@ STATIC int INIT bunzip2(unsigned char *buf, int len, | |||
| 694 | inbuf = malloc(BZIP2_IOBUF_SIZE); | 698 | inbuf = malloc(BZIP2_IOBUF_SIZE); |
| 695 | if (!inbuf) { | 699 | if (!inbuf) { |
| 696 | error("Could not allocate input bufer"); | 700 | error("Could not allocate input bufer"); |
| 701 | i = RETVAL_OUT_OF_MEMORY; | ||
| 697 | goto exit_0; | 702 | goto exit_0; |
| 698 | } | 703 | } |
| 699 | i = start_bunzip(&bd, inbuf, len, fill); | 704 | i = start_bunzip(&bd, inbuf, len, fill); |
| @@ -720,11 +725,14 @@ STATIC int INIT bunzip2(unsigned char *buf, int len, | |||
| 720 | } else if (i == RETVAL_UNEXPECTED_OUTPUT_EOF) { | 725 | } else if (i == RETVAL_UNEXPECTED_OUTPUT_EOF) { |
| 721 | error("Compressed file ends unexpectedly"); | 726 | error("Compressed file ends unexpectedly"); |
| 722 | } | 727 | } |
| 728 | if (!bd) | ||
| 729 | goto exit_1; | ||
| 723 | if (bd->dbuf) | 730 | if (bd->dbuf) |
| 724 | large_free(bd->dbuf); | 731 | large_free(bd->dbuf); |
| 725 | if (pos) | 732 | if (pos) |
| 726 | *pos = bd->inbufPos; | 733 | *pos = bd->inbufPos; |
| 727 | free(bd); | 734 | free(bd); |
| 735 | exit_1: | ||
| 728 | if (!buf) | 736 | if (!buf) |
| 729 | free(inbuf); | 737 | free(inbuf); |
| 730 | exit_0: | 738 | exit_0: |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 74af449b1f1d..4e869657cb51 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
| @@ -3579,7 +3579,7 @@ static unsigned long __meminit zone_spanned_pages_in_node(int nid, | |||
| 3579 | * Return the number of holes in a range on a node. If nid is MAX_NUMNODES, | 3579 | * Return the number of holes in a range on a node. If nid is MAX_NUMNODES, |
| 3580 | * then all holes in the requested range will be accounted for. | 3580 | * then all holes in the requested range will be accounted for. |
| 3581 | */ | 3581 | */ |
| 3582 | static unsigned long __meminit __absent_pages_in_range(int nid, | 3582 | unsigned long __meminit __absent_pages_in_range(int nid, |
| 3583 | unsigned long range_start_pfn, | 3583 | unsigned long range_start_pfn, |
| 3584 | unsigned long range_end_pfn) | 3584 | unsigned long range_end_pfn) |
| 3585 | { | 3585 | { |
| @@ -4108,7 +4108,7 @@ static int __init cmp_node_active_region(const void *a, const void *b) | |||
| 4108 | } | 4108 | } |
| 4109 | 4109 | ||
| 4110 | /* sort the node_map by start_pfn */ | 4110 | /* sort the node_map by start_pfn */ |
| 4111 | static void __init sort_node_map(void) | 4111 | void __init sort_node_map(void) |
| 4112 | { | 4112 | { |
| 4113 | sort(early_node_map, (size_t)nr_nodemap_entries, | 4113 | sort(early_node_map, (size_t)nr_nodemap_entries, |
| 4114 | sizeof(struct node_active_region), | 4114 | sizeof(struct node_active_region), |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 7814dbbd401d..4390d225686d 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -487,10 +487,11 @@ else | |||
| 487 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); | 487 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); |
| 488 | endif | 488 | endif |
| 489 | 489 | ||
| 490 | ifneq ($(shell sh -c "(echo '\#include <libdwarf/dwarf.h>'; echo '\#include <libdwarf/libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 490 | ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
| 491 | msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231); | 491 | msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231); |
| 492 | BASIC_CFLAGS += -DNO_LIBDWARF | 492 | BASIC_CFLAGS += -DNO_LIBDWARF |
| 493 | else | 493 | else |
| 494 | BASIC_CFLAGS += -I/usr/include/libdwarf | ||
| 494 | EXTLIBS += -lelf -ldwarf | 495 | EXTLIBS += -lelf -ldwarf |
| 495 | LIB_OBJS += util/probe-finder.o | 496 | LIB_OBJS += util/probe-finder.o |
| 496 | endif | 497 | endif |
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 7e741f54d798..c1e6774fd3ed 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include "util/strlist.h" | 38 | #include "util/strlist.h" |
| 39 | #include "util/event.h" | 39 | #include "util/event.h" |
| 40 | #include "util/debug.h" | 40 | #include "util/debug.h" |
| 41 | #include "util/debugfs.h" | ||
| 41 | #include "util/symbol.h" | 42 | #include "util/symbol.h" |
| 42 | #include "util/thread.h" | 43 | #include "util/thread.h" |
| 43 | #include "util/session.h" | 44 | #include "util/session.h" |
| @@ -205,6 +206,9 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
| 205 | if ((!session.nr_probe && !session.dellist && !session.list_events)) | 206 | if ((!session.nr_probe && !session.dellist && !session.list_events)) |
| 206 | usage_with_options(probe_usage, options); | 207 | usage_with_options(probe_usage, options); |
| 207 | 208 | ||
| 209 | if (debugfs_valid_mountpoint(debugfs_path) < 0) | ||
| 210 | die("Failed to find debugfs path."); | ||
| 211 | |||
| 208 | if (session.list_events) { | 212 | if (session.list_events) { |
| 209 | if (session.nr_probe != 0 || session.dellist) { | 213 | if (session.nr_probe != 0 || session.dellist) { |
| 210 | pr_warning(" Error: Don't use --list with" | 214 | pr_warning(" Error: Don't use --list with" |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index e50a6b10ee6f..5c2ab5357ec6 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -224,7 +224,7 @@ static int __cmd_report(void) | |||
| 224 | 224 | ||
| 225 | perf_session__collapse_resort(session); | 225 | perf_session__collapse_resort(session); |
| 226 | perf_session__output_resort(session, session->events_stats.total); | 226 | perf_session__output_resort(session, session->events_stats.total); |
| 227 | fprintf(stdout, "# Samples: %ld\n#\n", session->events_stats.total); | 227 | fprintf(stdout, "# Samples: %Ld\n#\n", session->events_stats.total); |
| 228 | perf_session__fprintf_hists(session, NULL, false, stdout); | 228 | perf_session__fprintf_hists(session, NULL, false, stdout); |
| 229 | if (sort_order == default_sort_order && | 229 | if (sort_order == default_sort_order && |
| 230 | parent_pattern == default_parent_pattern) | 230 | parent_pattern == default_parent_pattern) |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 8027309b0422..690a96d0467c 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
| @@ -95,8 +95,8 @@ typedef union event_union { | |||
| 95 | } event_t; | 95 | } event_t; |
| 96 | 96 | ||
| 97 | struct events_stats { | 97 | struct events_stats { |
| 98 | unsigned long total; | 98 | u64 total; |
| 99 | unsigned long lost; | 99 | u64 lost; |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | void event__print_totals(void); | 102 | void event__print_totals(void); |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 2ca62154f79b..29465d440043 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
| @@ -62,6 +62,18 @@ static int e_snprintf(char *str, size_t size, const char *format, ...) | |||
| 62 | return ret; | 62 | return ret; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | /* Check the name is good for event/group */ | ||
| 66 | static bool check_event_name(const char *name) | ||
| 67 | { | ||
| 68 | if (!isalpha(*name) && *name != '_') | ||
| 69 | return false; | ||
| 70 | while (*++name != '\0') { | ||
| 71 | if (!isalpha(*name) && !isdigit(*name) && *name != '_') | ||
| 72 | return false; | ||
| 73 | } | ||
| 74 | return true; | ||
| 75 | } | ||
| 76 | |||
| 65 | /* Parse probepoint definition. */ | 77 | /* Parse probepoint definition. */ |
| 66 | static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) | 78 | static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) |
| 67 | { | 79 | { |
| @@ -82,6 +94,9 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) | |||
| 82 | ptr = strchr(arg, ':'); | 94 | ptr = strchr(arg, ':'); |
| 83 | if (ptr) /* Group name is not supported yet. */ | 95 | if (ptr) /* Group name is not supported yet. */ |
| 84 | semantic_error("Group name is not supported yet."); | 96 | semantic_error("Group name is not supported yet."); |
| 97 | if (!check_event_name(arg)) | ||
| 98 | semantic_error("%s is bad for event name -it must " | ||
| 99 | "follow C symbol-naming rule.", arg); | ||
| 85 | pp->event = strdup(arg); | 100 | pp->event = strdup(arg); |
| 86 | arg = tmp; | 101 | arg = tmp; |
| 87 | } | 102 | } |
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index 5e4050ce2963..a4086aaddb73 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | #ifndef _PROBE_FINDER_H | 1 | #ifndef _PROBE_FINDER_H |
| 2 | #define _PROBE_FINDER_H | 2 | #define _PROBE_FINDER_H |
| 3 | 3 | ||
| 4 | #define MAX_PATH_LEN 256 | 4 | #define MAX_PATH_LEN 256 |
| 5 | #define MAX_PROBE_BUFFER 1024 | 5 | #define MAX_PROBE_BUFFER 1024 |
| 6 | #define MAX_PROBES 128 | 6 | #define MAX_PROBES 128 |
| 7 | 7 | ||
| 8 | static inline int is_c_varname(const char *name) | 8 | static inline int is_c_varname(const char *name) |
| 9 | { | 9 | { |
| @@ -12,48 +12,53 @@ static inline int is_c_varname(const char *name) | |||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | struct probe_point { | 14 | struct probe_point { |
| 15 | char *event; /* Event name */ | 15 | char *event; /* Event name */ |
| 16 | char *group; /* Event group */ | 16 | char *group; /* Event group */ |
| 17 | 17 | ||
| 18 | /* Inputs */ | 18 | /* Inputs */ |
| 19 | char *file; /* File name */ | 19 | char *file; /* File name */ |
| 20 | int line; /* Line number */ | 20 | int line; /* Line number */ |
| 21 | 21 | ||
| 22 | char *function; /* Function name */ | 22 | char *function; /* Function name */ |
| 23 | int offset; /* Offset bytes */ | 23 | int offset; /* Offset bytes */ |
| 24 | 24 | ||
| 25 | int nr_args; /* Number of arguments */ | 25 | int nr_args; /* Number of arguments */ |
| 26 | char **args; /* Arguments */ | 26 | char **args; /* Arguments */ |
| 27 | 27 | ||
| 28 | int retprobe; /* Return probe */ | 28 | int retprobe; /* Return probe */ |
| 29 | 29 | ||
| 30 | /* Output */ | 30 | /* Output */ |
| 31 | int found; /* Number of found probe points */ | 31 | int found; /* Number of found probe points */ |
| 32 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ | 32 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | #ifndef NO_LIBDWARF | 35 | #ifndef NO_LIBDWARF |
| 36 | extern int find_probepoint(int fd, struct probe_point *pp); | 36 | extern int find_probepoint(int fd, struct probe_point *pp); |
| 37 | 37 | ||
| 38 | #include <libdwarf/dwarf.h> | 38 | /* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */ |
| 39 | #include <libdwarf/libdwarf.h> | 39 | #ifndef _MIPS_SZLONG |
| 40 | # define _MIPS_SZLONG 0 | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #include <dwarf.h> | ||
| 44 | #include <libdwarf.h> | ||
| 40 | 45 | ||
| 41 | struct probe_finder { | 46 | struct probe_finder { |
| 42 | struct probe_point *pp; /* Target probe point */ | 47 | struct probe_point *pp; /* Target probe point */ |
| 43 | 48 | ||
| 44 | /* For function searching */ | 49 | /* For function searching */ |
| 45 | Dwarf_Addr addr; /* Address */ | 50 | Dwarf_Addr addr; /* Address */ |
| 46 | Dwarf_Unsigned fno; /* File number */ | 51 | Dwarf_Unsigned fno; /* File number */ |
| 47 | Dwarf_Unsigned lno; /* Line number */ | 52 | Dwarf_Unsigned lno; /* Line number */ |
| 48 | Dwarf_Off inl_offs; /* Inline offset */ | 53 | Dwarf_Off inl_offs; /* Inline offset */ |
| 49 | Dwarf_Die cu_die; /* Current CU */ | 54 | Dwarf_Die cu_die; /* Current CU */ |
| 50 | 55 | ||
| 51 | /* For variable searching */ | 56 | /* For variable searching */ |
| 52 | Dwarf_Addr cu_base; /* Current CU base address */ | 57 | Dwarf_Addr cu_base; /* Current CU base address */ |
| 53 | Dwarf_Locdesc fbloc; /* Location of Current Frame Base */ | 58 | Dwarf_Locdesc fbloc; /* Location of Current Frame Base */ |
| 54 | const char *var; /* Current variable name */ | 59 | const char *var; /* Current variable name */ |
| 55 | char *buf; /* Current output buffer */ | 60 | char *buf; /* Current output buffer */ |
| 56 | int len; /* Length of output buffer */ | 61 | int len; /* Length of output buffer */ |
| 57 | }; | 62 | }; |
| 58 | #endif /* NO_LIBDWARF */ | 63 | #endif /* NO_LIBDWARF */ |
| 59 | 64 | ||
