diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-20 21:53:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-20 21:53:04 -0400 |
commit | 17eea0df5f7068fc04959e655ef8f0a0ed097e19 (patch) | |
tree | d44b5cceb813dddfd1e62fe9f92556cf113d62fd | |
parent | 9b905fe68433378032b851c4d81a59187689fa52 (diff) | |
parent | 76e10d158efb6d4516018846f60c2ab5501900bc (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
60 files changed, 514 insertions, 260 deletions
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 4 | 2 | PATCHLEVEL = 4 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc7 | 4 | EXTRAVERSION = |
5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -442,7 +442,7 @@ asm-generic: | |||
442 | 442 | ||
443 | no-dot-config-targets := clean mrproper distclean \ | 443 | no-dot-config-targets := clean mrproper distclean \ |
444 | cscope gtags TAGS tags help %docs check% coccicheck \ | 444 | cscope gtags TAGS tags help %docs check% coccicheck \ |
445 | include/linux/version.h headers_% archheaders \ | 445 | include/linux/version.h headers_% archheaders archscripts \ |
446 | kernelversion %src-pkg | 446 | kernelversion %src-pkg |
447 | 447 | ||
448 | config-targets := 0 | 448 | config-targets := 0 |
@@ -979,7 +979,7 @@ prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ | |||
979 | include/config/auto.conf | 979 | include/config/auto.conf |
980 | $(cmd_crmodverdir) | 980 | $(cmd_crmodverdir) |
981 | 981 | ||
982 | archprepare: archheaders prepare1 scripts_basic | 982 | archprepare: archheaders archscripts prepare1 scripts_basic |
983 | 983 | ||
984 | prepare0: archprepare FORCE | 984 | prepare0: archprepare FORCE |
985 | $(Q)$(MAKE) $(build)=. | 985 | $(Q)$(MAKE) $(build)=. |
@@ -1049,8 +1049,11 @@ hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) | |||
1049 | PHONY += archheaders | 1049 | PHONY += archheaders |
1050 | archheaders: | 1050 | archheaders: |
1051 | 1051 | ||
1052 | PHONY += archscripts | ||
1053 | archscripts: | ||
1054 | |||
1052 | PHONY += __headers | 1055 | PHONY += __headers |
1053 | __headers: include/linux/version.h scripts_basic asm-generic archheaders FORCE | 1056 | __headers: include/linux/version.h scripts_basic asm-generic archheaders archscripts FORCE |
1054 | $(Q)$(MAKE) $(build)=scripts build_unifdef | 1057 | $(Q)$(MAKE) $(build)=scripts build_unifdef |
1055 | 1058 | ||
1056 | PHONY += headers_install_all | 1059 | PHONY += headers_install_all |
diff --git a/arch/arm/mach-prima2/irq.c b/arch/arm/mach-prima2/irq.c index 37c2de9b6f26..a7b9415d30f8 100644 --- a/arch/arm/mach-prima2/irq.c +++ b/arch/arm/mach-prima2/irq.c | |||
@@ -42,7 +42,8 @@ sirfsoc_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num) | |||
42 | static __init void sirfsoc_irq_init(void) | 42 | static __init void sirfsoc_irq_init(void) |
43 | { | 43 | { |
44 | sirfsoc_alloc_gc(sirfsoc_intc_base, 0, 32); | 44 | sirfsoc_alloc_gc(sirfsoc_intc_base, 0, 32); |
45 | sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32, SIRFSOC_INTENAL_IRQ_END - 32); | 45 | sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32, |
46 | SIRFSOC_INTENAL_IRQ_END + 1 - 32); | ||
46 | 47 | ||
47 | writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0); | 48 | writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0); |
48 | writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1); | 49 | writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1); |
@@ -68,7 +69,8 @@ void __init sirfsoc_of_irq_init(void) | |||
68 | if (!sirfsoc_intc_base) | 69 | if (!sirfsoc_intc_base) |
69 | panic("unable to map intc cpu registers\n"); | 70 | panic("unable to map intc cpu registers\n"); |
70 | 71 | ||
71 | irq_domain_add_legacy(np, 32, 0, 0, &irq_domain_simple_ops, NULL); | 72 | irq_domain_add_legacy(np, SIRFSOC_INTENAL_IRQ_END + 1, 0, 0, |
73 | &irq_domain_simple_ops, NULL); | ||
72 | 74 | ||
73 | of_node_put(np); | 75 | of_node_put(np); |
74 | 76 | ||
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c index fef66a7486ed..f07488e0bd32 100644 --- a/arch/arm/mach-tegra/flowctrl.c +++ b/arch/arm/mach-tegra/flowctrl.c | |||
@@ -53,10 +53,10 @@ static void flowctrl_update(u8 offset, u32 value) | |||
53 | 53 | ||
54 | void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) | 54 | void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) |
55 | { | 55 | { |
56 | return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value); | 56 | return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value); |
57 | } | 57 | } |
58 | 58 | ||
59 | void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) | 59 | void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) |
60 | { | 60 | { |
61 | return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value); | 61 | return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value); |
62 | } | 62 | } |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index f07467533365..5bb48356d217 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
@@ -247,7 +247,9 @@ good_area: | |||
247 | return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags); | 247 | return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags); |
248 | 248 | ||
249 | check_stack: | 249 | check_stack: |
250 | if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr)) | 250 | /* Don't allow expansion below FIRST_USER_ADDRESS */ |
251 | if (vma->vm_flags & VM_GROWSDOWN && | ||
252 | addr >= FIRST_USER_ADDRESS && !expand_stack(vma, addr)) | ||
251 | goto good_area; | 253 | goto good_area; |
252 | out: | 254 | out: |
253 | return fault; | 255 | return fault; |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 2c7cf2f9c837..aa78de8bfdd3 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -489,7 +489,8 @@ static void __init build_mem_type_table(void) | |||
489 | */ | 489 | */ |
490 | for (i = 0; i < ARRAY_SIZE(mem_types); i++) { | 490 | for (i = 0; i < ARRAY_SIZE(mem_types); i++) { |
491 | mem_types[i].prot_pte |= PTE_EXT_AF; | 491 | mem_types[i].prot_pte |= PTE_EXT_AF; |
492 | mem_types[i].prot_sect |= PMD_SECT_AF; | 492 | if (mem_types[i].prot_sect) |
493 | mem_types[i].prot_sect |= PMD_SECT_AF; | ||
493 | } | 494 | } |
494 | kern_pgprot |= PTE_EXT_AF; | 495 | kern_pgprot |= PTE_EXT_AF; |
495 | vecs_pgprot |= PTE_EXT_AF; | 496 | vecs_pgprot |= PTE_EXT_AF; |
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index bc683b8219b5..b0197b2c857d 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/cpu.h> | 12 | #include <linux/cpu.h> |
13 | #include <linux/cpu_pm.h> | 13 | #include <linux/cpu_pm.h> |
14 | #include <linux/hardirq.h> | ||
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
15 | #include <linux/notifier.h> | 16 | #include <linux/notifier.h> |
16 | #include <linux/signal.h> | 17 | #include <linux/signal.h> |
@@ -432,7 +433,10 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs) | |||
432 | 433 | ||
433 | static void vfp_enable(void *unused) | 434 | static void vfp_enable(void *unused) |
434 | { | 435 | { |
435 | u32 access = get_copro_access(); | 436 | u32 access; |
437 | |||
438 | BUG_ON(preemptible()); | ||
439 | access = get_copro_access(); | ||
436 | 440 | ||
437 | /* | 441 | /* |
438 | * Enable full access to VFP (cp10 and cp11) | 442 | * Enable full access to VFP (cp10 and cp11) |
@@ -573,12 +577,6 @@ int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp, | |||
573 | * entry. | 577 | * entry. |
574 | */ | 578 | */ |
575 | hwstate->fpscr &= ~(FPSCR_LENGTH_MASK | FPSCR_STRIDE_MASK); | 579 | hwstate->fpscr &= ~(FPSCR_LENGTH_MASK | FPSCR_STRIDE_MASK); |
576 | |||
577 | /* | ||
578 | * Disable VFP in the hwstate so that we can detect if it gets | ||
579 | * used. | ||
580 | */ | ||
581 | hwstate->fpexc &= ~FPEXC_EN; | ||
582 | return 0; | 580 | return 0; |
583 | } | 581 | } |
584 | 582 | ||
@@ -591,12 +589,8 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp, | |||
591 | unsigned long fpexc; | 589 | unsigned long fpexc; |
592 | int err = 0; | 590 | int err = 0; |
593 | 591 | ||
594 | /* | 592 | /* Disable VFP to avoid corrupting the new thread state. */ |
595 | * If VFP has been used, then disable it to avoid corrupting | 593 | vfp_flush_hwstate(thread); |
596 | * the new thread state. | ||
597 | */ | ||
598 | if (hwstate->fpexc & FPEXC_EN) | ||
599 | vfp_flush_hwstate(thread); | ||
600 | 594 | ||
601 | /* | 595 | /* |
602 | * Copy the floating point registers. There can be unused | 596 | * Copy the floating point registers. There can be unused |
@@ -657,7 +651,7 @@ static int __init vfp_init(void) | |||
657 | unsigned int cpu_arch = cpu_architecture(); | 651 | unsigned int cpu_arch = cpu_architecture(); |
658 | 652 | ||
659 | if (cpu_arch >= CPU_ARCH_ARMv6) | 653 | if (cpu_arch >= CPU_ARCH_ARMv6) |
660 | vfp_enable(NULL); | 654 | on_each_cpu(vfp_enable, NULL, 1); |
661 | 655 | ||
662 | /* | 656 | /* |
663 | * First check that there is a VFP that we can use. | 657 | * First check that there is a VFP that we can use. |
@@ -678,8 +672,6 @@ static int __init vfp_init(void) | |||
678 | } else { | 672 | } else { |
679 | hotcpu_notifier(vfp_hotplug, 0); | 673 | hotcpu_notifier(vfp_hotplug, 0); |
680 | 674 | ||
681 | smp_call_function(vfp_enable, NULL, 1); | ||
682 | |||
683 | VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; /* Extract the architecture version */ | 675 | VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; /* Extract the architecture version */ |
684 | printk("implementor %02x architecture %d part %02x variant %x rev %x\n", | 676 | printk("implementor %02x architecture %d part %02x variant %x rev %x\n", |
685 | (vfpsid & FPSID_IMPLEMENTER_MASK) >> FPSID_IMPLEMENTER_BIT, | 677 | (vfpsid & FPSID_IMPLEMENTER_MASK) >> FPSID_IMPLEMENTER_BIT, |
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h index 81c2e271d620..9b1a92b73f60 100644 --- a/arch/frv/include/asm/processor.h +++ b/arch/frv/include/asm/processor.h | |||
@@ -135,10 +135,6 @@ unsigned long get_wchan(struct task_struct *p); | |||
135 | #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) | 135 | #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) |
136 | #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) | 136 | #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) |
137 | 137 | ||
138 | /* Allocation and freeing of basic task resources. */ | ||
139 | extern struct task_struct *alloc_task_struct_node(int node); | ||
140 | extern void free_task_struct(struct task_struct *p); | ||
141 | |||
142 | #define cpu_relax() barrier() | 138 | #define cpu_relax() barrier() |
143 | 139 | ||
144 | /* data cache prefetch */ | 140 | /* data cache prefetch */ |
diff --git a/arch/parisc/include/asm/prefetch.h b/arch/parisc/include/asm/prefetch.h index c5edc60c059f..1ee7c82672c1 100644 --- a/arch/parisc/include/asm/prefetch.h +++ b/arch/parisc/include/asm/prefetch.h | |||
@@ -21,7 +21,12 @@ | |||
21 | #define ARCH_HAS_PREFETCH | 21 | #define ARCH_HAS_PREFETCH |
22 | static inline void prefetch(const void *addr) | 22 | static inline void prefetch(const void *addr) |
23 | { | 23 | { |
24 | __asm__("ldw 0(%0), %%r0" : : "r" (addr)); | 24 | __asm__( |
25 | #ifndef CONFIG_PA20 | ||
26 | /* Need to avoid prefetch of NULL on PA7300LC */ | ||
27 | " extrw,u,= %0,31,32,%%r0\n" | ||
28 | #endif | ||
29 | " ldw 0(%0), %%r0" : : "r" (addr)); | ||
25 | } | 30 | } |
26 | 31 | ||
27 | /* LDD is a PA2.0 addition. */ | 32 | /* LDD is a PA2.0 addition. */ |
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S index 6f0594439143..535034217021 100644 --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S | |||
@@ -581,7 +581,11 @@ | |||
581 | */ | 581 | */ |
582 | cmpiclr,= 0x01,\tmp,%r0 | 582 | cmpiclr,= 0x01,\tmp,%r0 |
583 | ldi (_PAGE_DIRTY|_PAGE_READ|_PAGE_WRITE),\prot | 583 | ldi (_PAGE_DIRTY|_PAGE_READ|_PAGE_WRITE),\prot |
584 | #ifdef CONFIG_64BIT | ||
584 | depd,z \prot,8,7,\prot | 585 | depd,z \prot,8,7,\prot |
586 | #else | ||
587 | depw,z \prot,8,7,\prot | ||
588 | #endif | ||
585 | /* | 589 | /* |
586 | * OK, it is in the temp alias region, check whether "from" or "to". | 590 | * OK, it is in the temp alias region, check whether "from" or "to". |
587 | * Check "subtle" note in pacache.S re: r23/r26. | 591 | * Check "subtle" note in pacache.S re: r23/r26. |
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S index 93ff3d90edd1..5d7218ad885c 100644 --- a/arch/parisc/kernel/pacache.S +++ b/arch/parisc/kernel/pacache.S | |||
@@ -692,7 +692,7 @@ ENTRY(flush_icache_page_asm) | |||
692 | 692 | ||
693 | /* Purge any old translation */ | 693 | /* Purge any old translation */ |
694 | 694 | ||
695 | pitlb (%sr0,%r28) | 695 | pitlb (%sr4,%r28) |
696 | 696 | ||
697 | ldil L%icache_stride, %r1 | 697 | ldil L%icache_stride, %r1 |
698 | ldw R%icache_stride(%r1), %r1 | 698 | ldw R%icache_stride(%r1), %r1 |
@@ -706,27 +706,29 @@ ENTRY(flush_icache_page_asm) | |||
706 | sub %r25, %r1, %r25 | 706 | sub %r25, %r1, %r25 |
707 | 707 | ||
708 | 708 | ||
709 | 1: fic,m %r1(%r28) | 709 | /* fic only has the type 26 form on PA1.1, requiring an |
710 | fic,m %r1(%r28) | 710 | * explicit space specification, so use %sr4 */ |
711 | fic,m %r1(%r28) | 711 | 1: fic,m %r1(%sr4,%r28) |
712 | fic,m %r1(%r28) | 712 | fic,m %r1(%sr4,%r28) |
713 | fic,m %r1(%r28) | 713 | fic,m %r1(%sr4,%r28) |
714 | fic,m %r1(%r28) | 714 | fic,m %r1(%sr4,%r28) |
715 | fic,m %r1(%r28) | 715 | fic,m %r1(%sr4,%r28) |
716 | fic,m %r1(%r28) | 716 | fic,m %r1(%sr4,%r28) |
717 | fic,m %r1(%r28) | 717 | fic,m %r1(%sr4,%r28) |
718 | fic,m %r1(%r28) | 718 | fic,m %r1(%sr4,%r28) |
719 | fic,m %r1(%r28) | 719 | fic,m %r1(%sr4,%r28) |
720 | fic,m %r1(%r28) | 720 | fic,m %r1(%sr4,%r28) |
721 | fic,m %r1(%r28) | 721 | fic,m %r1(%sr4,%r28) |
722 | fic,m %r1(%r28) | 722 | fic,m %r1(%sr4,%r28) |
723 | fic,m %r1(%r28) | 723 | fic,m %r1(%sr4,%r28) |
724 | fic,m %r1(%sr4,%r28) | ||
725 | fic,m %r1(%sr4,%r28) | ||
724 | cmpb,COND(<<) %r28, %r25,1b | 726 | cmpb,COND(<<) %r28, %r25,1b |
725 | fic,m %r1(%r28) | 727 | fic,m %r1(%sr4,%r28) |
726 | 728 | ||
727 | sync | 729 | sync |
728 | bv %r0(%r2) | 730 | bv %r0(%r2) |
729 | pitlb (%sr0,%r25) | 731 | pitlb (%sr4,%r25) |
730 | .exit | 732 | .exit |
731 | 733 | ||
732 | .procend | 734 | .procend |
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index 96033e2d6845..74239dd77e06 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
@@ -11,6 +11,7 @@ config TILE | |||
11 | select GENERIC_IRQ_PROBE | 11 | select GENERIC_IRQ_PROBE |
12 | select GENERIC_PENDING_IRQ if SMP | 12 | select GENERIC_PENDING_IRQ if SMP |
13 | select GENERIC_IRQ_SHOW | 13 | select GENERIC_IRQ_SHOW |
14 | select HAVE_SYSCALL_WRAPPERS if TILEGX | ||
14 | select SYS_HYPERVISOR | 15 | select SYS_HYPERVISOR |
15 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 16 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
16 | 17 | ||
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 41a7237606a3..94e91e401da9 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -134,6 +134,9 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,) | |||
134 | KBUILD_CFLAGS += $(mflags-y) | 134 | KBUILD_CFLAGS += $(mflags-y) |
135 | KBUILD_AFLAGS += $(mflags-y) | 135 | KBUILD_AFLAGS += $(mflags-y) |
136 | 136 | ||
137 | archscripts: | ||
138 | $(Q)$(MAKE) $(build)=arch/x86/tools relocs | ||
139 | |||
137 | ### | 140 | ### |
138 | # Syscall table generation | 141 | # Syscall table generation |
139 | 142 | ||
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index fd55a2ff3ad8..e398bb5d63bb 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -40,13 +40,12 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S | |||
40 | $(obj)/vmlinux.bin: vmlinux FORCE | 40 | $(obj)/vmlinux.bin: vmlinux FORCE |
41 | $(call if_changed,objcopy) | 41 | $(call if_changed,objcopy) |
42 | 42 | ||
43 | targets += vmlinux.bin.all vmlinux.relocs | ||
43 | 44 | ||
44 | targets += vmlinux.bin.all vmlinux.relocs relocs | 45 | CMD_RELOCS = arch/x86/tools/relocs |
45 | hostprogs-$(CONFIG_X86_NEED_RELOCS) += relocs | ||
46 | |||
47 | quiet_cmd_relocs = RELOCS $@ | 46 | quiet_cmd_relocs = RELOCS $@ |
48 | cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $< | 47 | cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $< |
49 | $(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE | 48 | $(obj)/vmlinux.relocs: vmlinux FORCE |
50 | $(call if_changed,relocs) | 49 | $(call if_changed,relocs) |
51 | 50 | ||
52 | vmlinux.bin.all-y := $(obj)/vmlinux.bin | 51 | vmlinux.bin.all-y := $(obj)/vmlinux.bin |
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h index 734c3767cfac..183922e13de1 100644 --- a/arch/x86/include/asm/kvm_para.h +++ b/arch/x86/include/asm/kvm_para.h | |||
@@ -170,6 +170,9 @@ static inline int kvm_para_available(void) | |||
170 | unsigned int eax, ebx, ecx, edx; | 170 | unsigned int eax, ebx, ecx, edx; |
171 | char signature[13]; | 171 | char signature[13]; |
172 | 172 | ||
173 | if (boot_cpu_data.cpuid_level < 0) | ||
174 | return 0; /* So we don't blow up on old processors */ | ||
175 | |||
173 | cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx); | 176 | cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx); |
174 | memcpy(signature + 0, &ebx, 4); | 177 | memcpy(signature + 0, &ebx, 4); |
175 | memcpy(signature + 4, &ecx, 4); | 178 | memcpy(signature + 4, &ecx, 4); |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index a415b1f44365..7c439fe4941b 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -593,7 +593,7 @@ void __init acpi_set_irq_model_ioapic(void) | |||
593 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | 593 | #ifdef CONFIG_ACPI_HOTPLUG_CPU |
594 | #include <acpi/processor.h> | 594 | #include <acpi/processor.h> |
595 | 595 | ||
596 | static void __cpuinitdata acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) | 596 | static void __cpuinit acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) |
597 | { | 597 | { |
598 | #ifdef CONFIG_ACPI_NUMA | 598 | #ifdef CONFIG_ACPI_NUMA |
599 | int nid; | 599 | int nid; |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index d086a09c087d..11c9166c3337 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -945,9 +945,10 @@ struct mce_info { | |||
945 | atomic_t inuse; | 945 | atomic_t inuse; |
946 | struct task_struct *t; | 946 | struct task_struct *t; |
947 | __u64 paddr; | 947 | __u64 paddr; |
948 | int restartable; | ||
948 | } mce_info[MCE_INFO_MAX]; | 949 | } mce_info[MCE_INFO_MAX]; |
949 | 950 | ||
950 | static void mce_save_info(__u64 addr) | 951 | static void mce_save_info(__u64 addr, int c) |
951 | { | 952 | { |
952 | struct mce_info *mi; | 953 | struct mce_info *mi; |
953 | 954 | ||
@@ -955,6 +956,7 @@ static void mce_save_info(__u64 addr) | |||
955 | if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) { | 956 | if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) { |
956 | mi->t = current; | 957 | mi->t = current; |
957 | mi->paddr = addr; | 958 | mi->paddr = addr; |
959 | mi->restartable = c; | ||
958 | return; | 960 | return; |
959 | } | 961 | } |
960 | } | 962 | } |
@@ -1130,7 +1132,7 @@ void do_machine_check(struct pt_regs *regs, long error_code) | |||
1130 | mce_panic("Fatal machine check on current CPU", &m, msg); | 1132 | mce_panic("Fatal machine check on current CPU", &m, msg); |
1131 | if (worst == MCE_AR_SEVERITY) { | 1133 | if (worst == MCE_AR_SEVERITY) { |
1132 | /* schedule action before return to userland */ | 1134 | /* schedule action before return to userland */ |
1133 | mce_save_info(m.addr); | 1135 | mce_save_info(m.addr, m.mcgstatus & MCG_STATUS_RIPV); |
1134 | set_thread_flag(TIF_MCE_NOTIFY); | 1136 | set_thread_flag(TIF_MCE_NOTIFY); |
1135 | } else if (kill_it) { | 1137 | } else if (kill_it) { |
1136 | force_sig(SIGBUS, current); | 1138 | force_sig(SIGBUS, current); |
@@ -1179,7 +1181,13 @@ void mce_notify_process(void) | |||
1179 | 1181 | ||
1180 | pr_err("Uncorrected hardware memory error in user-access at %llx", | 1182 | pr_err("Uncorrected hardware memory error in user-access at %llx", |
1181 | mi->paddr); | 1183 | mi->paddr); |
1182 | if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0) { | 1184 | /* |
1185 | * We must call memory_failure() here even if the current process is | ||
1186 | * doomed. We still need to mark the page as poisoned and alert any | ||
1187 | * other users of the page. | ||
1188 | */ | ||
1189 | if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0 || | ||
1190 | mi->restartable == 0) { | ||
1183 | pr_err("Memory error not recovered"); | 1191 | pr_err("Memory error not recovered"); |
1184 | force_sig(SIGBUS, current); | 1192 | force_sig(SIGBUS, current); |
1185 | } | 1193 | } |
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c index 3ca42d0e43a2..0327e2b3c408 100644 --- a/arch/x86/kernel/microcode_intel.c +++ b/arch/x86/kernel/microcode_intel.c | |||
@@ -147,12 +147,6 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig) | |||
147 | 147 | ||
148 | memset(csig, 0, sizeof(*csig)); | 148 | memset(csig, 0, sizeof(*csig)); |
149 | 149 | ||
150 | if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || | ||
151 | cpu_has(c, X86_FEATURE_IA64)) { | ||
152 | pr_err("CPU%d not a capable Intel processor\n", cpu_num); | ||
153 | return -1; | ||
154 | } | ||
155 | |||
156 | csig->sig = cpuid_eax(0x00000001); | 150 | csig->sig = cpuid_eax(0x00000001); |
157 | 151 | ||
158 | if ((c->x86_model >= 5) || (c->x86 > 6)) { | 152 | if ((c->x86_model >= 5) || (c->x86 > 6)) { |
@@ -463,6 +457,14 @@ static struct microcode_ops microcode_intel_ops = { | |||
463 | 457 | ||
464 | struct microcode_ops * __init init_intel_microcode(void) | 458 | struct microcode_ops * __init init_intel_microcode(void) |
465 | { | 459 | { |
460 | struct cpuinfo_x86 *c = &cpu_data(0); | ||
461 | |||
462 | if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || | ||
463 | cpu_has(c, X86_FEATURE_IA64)) { | ||
464 | pr_err("Intel CPU family 0x%x not supported\n", c->x86); | ||
465 | return NULL; | ||
466 | } | ||
467 | |||
466 | return µcode_intel_ops; | 468 | return µcode_intel_ops; |
467 | } | 469 | } |
468 | 470 | ||
diff --git a/arch/x86/tools/.gitignore b/arch/x86/tools/.gitignore new file mode 100644 index 000000000000..be0ed065249b --- /dev/null +++ b/arch/x86/tools/.gitignore | |||
@@ -0,0 +1 @@ | |||
relocs | |||
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile index d511aa97533a..733057b435b0 100644 --- a/arch/x86/tools/Makefile +++ b/arch/x86/tools/Makefile | |||
@@ -36,3 +36,7 @@ HOSTCFLAGS_insn_sanity.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x | |||
36 | $(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c | 36 | $(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c |
37 | 37 | ||
38 | $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c | 38 | $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c |
39 | |||
40 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include | ||
41 | hostprogs-y += relocs | ||
42 | relocs: $(obj)/relocs | ||
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/tools/relocs.c index fb7117a4ade1..b43cfcd9bf40 100644 --- a/arch/x86/boot/compressed/relocs.c +++ b/arch/x86/tools/relocs.c | |||
@@ -18,6 +18,8 @@ static void die(char *fmt, ...); | |||
18 | static Elf32_Ehdr ehdr; | 18 | static Elf32_Ehdr ehdr; |
19 | static unsigned long reloc_count, reloc_idx; | 19 | static unsigned long reloc_count, reloc_idx; |
20 | static unsigned long *relocs; | 20 | static unsigned long *relocs; |
21 | static unsigned long reloc16_count, reloc16_idx; | ||
22 | static unsigned long *relocs16; | ||
21 | 23 | ||
22 | struct section { | 24 | struct section { |
23 | Elf32_Shdr shdr; | 25 | Elf32_Shdr shdr; |
@@ -28,52 +30,86 @@ struct section { | |||
28 | }; | 30 | }; |
29 | static struct section *secs; | 31 | static struct section *secs; |
30 | 32 | ||
33 | enum symtype { | ||
34 | S_ABS, | ||
35 | S_REL, | ||
36 | S_SEG, | ||
37 | S_LIN, | ||
38 | S_NSYMTYPES | ||
39 | }; | ||
40 | |||
41 | static const char * const sym_regex_kernel[S_NSYMTYPES] = { | ||
31 | /* | 42 | /* |
32 | * Following symbols have been audited. There values are constant and do | 43 | * Following symbols have been audited. There values are constant and do |
33 | * not change if bzImage is loaded at a different physical address than | 44 | * not change if bzImage is loaded at a different physical address than |
34 | * the address for which it has been compiled. Don't warn user about | 45 | * the address for which it has been compiled. Don't warn user about |
35 | * absolute relocations present w.r.t these symbols. | 46 | * absolute relocations present w.r.t these symbols. |
36 | */ | 47 | */ |
37 | static const char abs_sym_regex[] = | 48 | [S_ABS] = |
38 | "^(xen_irq_disable_direct_reloc$|" | 49 | "^(xen_irq_disable_direct_reloc$|" |
39 | "xen_save_fl_direct_reloc$|" | 50 | "xen_save_fl_direct_reloc$|" |
40 | "VDSO|" | 51 | "VDSO|" |
41 | "__crc_)"; | 52 | "__crc_)", |
42 | static regex_t abs_sym_regex_c; | ||
43 | static int is_abs_reloc(const char *sym_name) | ||
44 | { | ||
45 | return !regexec(&abs_sym_regex_c, sym_name, 0, NULL, 0); | ||
46 | } | ||
47 | 53 | ||
48 | /* | 54 | /* |
49 | * These symbols are known to be relative, even if the linker marks them | 55 | * These symbols are known to be relative, even if the linker marks them |
50 | * as absolute (typically defined outside any section in the linker script.) | 56 | * as absolute (typically defined outside any section in the linker script.) |
51 | */ | 57 | */ |
52 | static const char rel_sym_regex[] = | 58 | [S_REL] = |
53 | "^_end$"; | 59 | "^(__init_(begin|end)|" |
54 | static regex_t rel_sym_regex_c; | 60 | "__x86_cpu_dev_(start|end)|" |
55 | static int is_rel_reloc(const char *sym_name) | 61 | "(__parainstructions|__alt_instructions)(|_end)|" |
62 | "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|" | ||
63 | "_end)$" | ||
64 | }; | ||
65 | |||
66 | |||
67 | static const char * const sym_regex_realmode[S_NSYMTYPES] = { | ||
68 | /* | ||
69 | * These are 16-bit segment symbols when compiling 16-bit code. | ||
70 | */ | ||
71 | [S_SEG] = | ||
72 | "^real_mode_seg$", | ||
73 | |||
74 | /* | ||
75 | * These are offsets belonging to segments, as opposed to linear addresses, | ||
76 | * when compiling 16-bit code. | ||
77 | */ | ||
78 | [S_LIN] = | ||
79 | "^pa_", | ||
80 | }; | ||
81 | |||
82 | static const char * const *sym_regex; | ||
83 | |||
84 | static regex_t sym_regex_c[S_NSYMTYPES]; | ||
85 | static int is_reloc(enum symtype type, const char *sym_name) | ||
56 | { | 86 | { |
57 | return !regexec(&rel_sym_regex_c, sym_name, 0, NULL, 0); | 87 | return sym_regex[type] && |
88 | !regexec(&sym_regex_c[type], sym_name, 0, NULL, 0); | ||
58 | } | 89 | } |
59 | 90 | ||
60 | static void regex_init(void) | 91 | static void regex_init(int use_real_mode) |
61 | { | 92 | { |
62 | char errbuf[128]; | 93 | char errbuf[128]; |
63 | int err; | 94 | int err; |
64 | 95 | int i; | |
65 | err = regcomp(&abs_sym_regex_c, abs_sym_regex, | 96 | |
66 | REG_EXTENDED|REG_NOSUB); | 97 | if (use_real_mode) |
67 | if (err) { | 98 | sym_regex = sym_regex_realmode; |
68 | regerror(err, &abs_sym_regex_c, errbuf, sizeof errbuf); | 99 | else |
69 | die("%s", errbuf); | 100 | sym_regex = sym_regex_kernel; |
70 | } | ||
71 | 101 | ||
72 | err = regcomp(&rel_sym_regex_c, rel_sym_regex, | 102 | for (i = 0; i < S_NSYMTYPES; i++) { |
73 | REG_EXTENDED|REG_NOSUB); | 103 | if (!sym_regex[i]) |
74 | if (err) { | 104 | continue; |
75 | regerror(err, &rel_sym_regex_c, errbuf, sizeof errbuf); | 105 | |
76 | die("%s", errbuf); | 106 | err = regcomp(&sym_regex_c[i], sym_regex[i], |
107 | REG_EXTENDED|REG_NOSUB); | ||
108 | |||
109 | if (err) { | ||
110 | regerror(err, &sym_regex_c[i], errbuf, sizeof errbuf); | ||
111 | die("%s", errbuf); | ||
112 | } | ||
77 | } | 113 | } |
78 | } | 114 | } |
79 | 115 | ||
@@ -154,6 +190,10 @@ static const char *rel_type(unsigned type) | |||
154 | REL_TYPE(R_386_RELATIVE), | 190 | REL_TYPE(R_386_RELATIVE), |
155 | REL_TYPE(R_386_GOTOFF), | 191 | REL_TYPE(R_386_GOTOFF), |
156 | REL_TYPE(R_386_GOTPC), | 192 | REL_TYPE(R_386_GOTPC), |
193 | REL_TYPE(R_386_8), | ||
194 | REL_TYPE(R_386_PC8), | ||
195 | REL_TYPE(R_386_16), | ||
196 | REL_TYPE(R_386_PC16), | ||
157 | #undef REL_TYPE | 197 | #undef REL_TYPE |
158 | }; | 198 | }; |
159 | const char *name = "unknown type rel type name"; | 199 | const char *name = "unknown type rel type name"; |
@@ -189,7 +229,7 @@ static const char *sym_name(const char *sym_strtab, Elf32_Sym *sym) | |||
189 | name = sym_strtab + sym->st_name; | 229 | name = sym_strtab + sym->st_name; |
190 | } | 230 | } |
191 | else { | 231 | else { |
192 | name = sec_name(secs[sym->st_shndx].shdr.sh_name); | 232 | name = sec_name(sym->st_shndx); |
193 | } | 233 | } |
194 | return name; | 234 | return name; |
195 | } | 235 | } |
@@ -472,7 +512,7 @@ static void print_absolute_relocs(void) | |||
472 | * Before warning check if this absolute symbol | 512 | * Before warning check if this absolute symbol |
473 | * relocation is harmless. | 513 | * relocation is harmless. |
474 | */ | 514 | */ |
475 | if (is_abs_reloc(name) || is_rel_reloc(name)) | 515 | if (is_reloc(S_ABS, name) || is_reloc(S_REL, name)) |
476 | continue; | 516 | continue; |
477 | 517 | ||
478 | if (!printed) { | 518 | if (!printed) { |
@@ -496,7 +536,8 @@ static void print_absolute_relocs(void) | |||
496 | printf("\n"); | 536 | printf("\n"); |
497 | } | 537 | } |
498 | 538 | ||
499 | static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym)) | 539 | static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym), |
540 | int use_real_mode) | ||
500 | { | 541 | { |
501 | int i; | 542 | int i; |
502 | /* Walk through the relocations */ | 543 | /* Walk through the relocations */ |
@@ -521,30 +562,67 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym)) | |||
521 | Elf32_Rel *rel; | 562 | Elf32_Rel *rel; |
522 | Elf32_Sym *sym; | 563 | Elf32_Sym *sym; |
523 | unsigned r_type; | 564 | unsigned r_type; |
565 | const char *symname; | ||
566 | int shn_abs; | ||
567 | |||
524 | rel = &sec->reltab[j]; | 568 | rel = &sec->reltab[j]; |
525 | sym = &sh_symtab[ELF32_R_SYM(rel->r_info)]; | 569 | sym = &sh_symtab[ELF32_R_SYM(rel->r_info)]; |
526 | r_type = ELF32_R_TYPE(rel->r_info); | 570 | r_type = ELF32_R_TYPE(rel->r_info); |
527 | /* Don't visit relocations to absolute symbols */ | 571 | |
528 | if (sym->st_shndx == SHN_ABS && | 572 | shn_abs = sym->st_shndx == SHN_ABS; |
529 | !is_rel_reloc(sym_name(sym_strtab, sym))) { | 573 | |
530 | continue; | ||
531 | } | ||
532 | switch (r_type) { | 574 | switch (r_type) { |
533 | case R_386_NONE: | 575 | case R_386_NONE: |
534 | case R_386_PC32: | 576 | case R_386_PC32: |
577 | case R_386_PC16: | ||
578 | case R_386_PC8: | ||
535 | /* | 579 | /* |
536 | * NONE can be ignored and and PC relative | 580 | * NONE can be ignored and and PC relative |
537 | * relocations don't need to be adjusted. | 581 | * relocations don't need to be adjusted. |
538 | */ | 582 | */ |
539 | break; | 583 | break; |
584 | |||
585 | case R_386_16: | ||
586 | symname = sym_name(sym_strtab, sym); | ||
587 | if (!use_real_mode) | ||
588 | goto bad; | ||
589 | if (shn_abs) { | ||
590 | if (is_reloc(S_ABS, symname)) | ||
591 | break; | ||
592 | else if (!is_reloc(S_SEG, symname)) | ||
593 | goto bad; | ||
594 | } else { | ||
595 | if (is_reloc(S_LIN, symname)) | ||
596 | goto bad; | ||
597 | else | ||
598 | break; | ||
599 | } | ||
600 | visit(rel, sym); | ||
601 | break; | ||
602 | |||
540 | case R_386_32: | 603 | case R_386_32: |
541 | /* Visit relocations that need to be adjusted */ | 604 | symname = sym_name(sym_strtab, sym); |
605 | if (shn_abs) { | ||
606 | if (is_reloc(S_ABS, symname)) | ||
607 | break; | ||
608 | else if (!is_reloc(S_REL, symname)) | ||
609 | goto bad; | ||
610 | } else { | ||
611 | if (use_real_mode && | ||
612 | !is_reloc(S_LIN, symname)) | ||
613 | break; | ||
614 | } | ||
542 | visit(rel, sym); | 615 | visit(rel, sym); |
543 | break; | 616 | break; |
544 | default: | 617 | default: |
545 | die("Unsupported relocation type: %s (%d)\n", | 618 | die("Unsupported relocation type: %s (%d)\n", |
546 | rel_type(r_type), r_type); | 619 | rel_type(r_type), r_type); |
547 | break; | 620 | break; |
621 | bad: | ||
622 | symname = sym_name(sym_strtab, sym); | ||
623 | die("Invalid %s %s relocation: %s\n", | ||
624 | shn_abs ? "absolute" : "relative", | ||
625 | rel_type(r_type), symname); | ||
548 | } | 626 | } |
549 | } | 627 | } |
550 | } | 628 | } |
@@ -552,13 +630,19 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym)) | |||
552 | 630 | ||
553 | static void count_reloc(Elf32_Rel *rel, Elf32_Sym *sym) | 631 | static void count_reloc(Elf32_Rel *rel, Elf32_Sym *sym) |
554 | { | 632 | { |
555 | reloc_count += 1; | 633 | if (ELF32_R_TYPE(rel->r_info) == R_386_16) |
634 | reloc16_count++; | ||
635 | else | ||
636 | reloc_count++; | ||
556 | } | 637 | } |
557 | 638 | ||
558 | static void collect_reloc(Elf32_Rel *rel, Elf32_Sym *sym) | 639 | static void collect_reloc(Elf32_Rel *rel, Elf32_Sym *sym) |
559 | { | 640 | { |
560 | /* Remember the address that needs to be adjusted. */ | 641 | /* Remember the address that needs to be adjusted. */ |
561 | relocs[reloc_idx++] = rel->r_offset; | 642 | if (ELF32_R_TYPE(rel->r_info) == R_386_16) |
643 | relocs16[reloc16_idx++] = rel->r_offset; | ||
644 | else | ||
645 | relocs[reloc_idx++] = rel->r_offset; | ||
562 | } | 646 | } |
563 | 647 | ||
564 | static int cmp_relocs(const void *va, const void *vb) | 648 | static int cmp_relocs(const void *va, const void *vb) |
@@ -568,23 +652,41 @@ static int cmp_relocs(const void *va, const void *vb) | |||
568 | return (*a == *b)? 0 : (*a > *b)? 1 : -1; | 652 | return (*a == *b)? 0 : (*a > *b)? 1 : -1; |
569 | } | 653 | } |
570 | 654 | ||
571 | static void emit_relocs(int as_text) | 655 | static int write32(unsigned int v, FILE *f) |
656 | { | ||
657 | unsigned char buf[4]; | ||
658 | |||
659 | put_unaligned_le32(v, buf); | ||
660 | return fwrite(buf, 1, 4, f) == 4 ? 0 : -1; | ||
661 | } | ||
662 | |||
663 | static void emit_relocs(int as_text, int use_real_mode) | ||
572 | { | 664 | { |
573 | int i; | 665 | int i; |
574 | /* Count how many relocations I have and allocate space for them. */ | 666 | /* Count how many relocations I have and allocate space for them. */ |
575 | reloc_count = 0; | 667 | reloc_count = 0; |
576 | walk_relocs(count_reloc); | 668 | walk_relocs(count_reloc, use_real_mode); |
577 | relocs = malloc(reloc_count * sizeof(relocs[0])); | 669 | relocs = malloc(reloc_count * sizeof(relocs[0])); |
578 | if (!relocs) { | 670 | if (!relocs) { |
579 | die("malloc of %d entries for relocs failed\n", | 671 | die("malloc of %d entries for relocs failed\n", |
580 | reloc_count); | 672 | reloc_count); |
581 | } | 673 | } |
674 | |||
675 | relocs16 = malloc(reloc16_count * sizeof(relocs[0])); | ||
676 | if (!relocs16) { | ||
677 | die("malloc of %d entries for relocs16 failed\n", | ||
678 | reloc16_count); | ||
679 | } | ||
582 | /* Collect up the relocations */ | 680 | /* Collect up the relocations */ |
583 | reloc_idx = 0; | 681 | reloc_idx = 0; |
584 | walk_relocs(collect_reloc); | 682 | walk_relocs(collect_reloc, use_real_mode); |
683 | |||
684 | if (reloc16_count && !use_real_mode) | ||
685 | die("Segment relocations found but --realmode not specified\n"); | ||
585 | 686 | ||
586 | /* Order the relocations for more efficient processing */ | 687 | /* Order the relocations for more efficient processing */ |
587 | qsort(relocs, reloc_count, sizeof(relocs[0]), cmp_relocs); | 688 | qsort(relocs, reloc_count, sizeof(relocs[0]), cmp_relocs); |
689 | qsort(relocs16, reloc16_count, sizeof(relocs16[0]), cmp_relocs); | ||
588 | 690 | ||
589 | /* Print the relocations */ | 691 | /* Print the relocations */ |
590 | if (as_text) { | 692 | if (as_text) { |
@@ -593,58 +695,83 @@ static void emit_relocs(int as_text) | |||
593 | */ | 695 | */ |
594 | printf(".section \".data.reloc\",\"a\"\n"); | 696 | printf(".section \".data.reloc\",\"a\"\n"); |
595 | printf(".balign 4\n"); | 697 | printf(".balign 4\n"); |
596 | for (i = 0; i < reloc_count; i++) { | 698 | if (use_real_mode) { |
597 | printf("\t .long 0x%08lx\n", relocs[i]); | 699 | printf("\t.long %lu\n", reloc16_count); |
700 | for (i = 0; i < reloc16_count; i++) | ||
701 | printf("\t.long 0x%08lx\n", relocs16[i]); | ||
702 | printf("\t.long %lu\n", reloc_count); | ||
703 | for (i = 0; i < reloc_count; i++) { | ||
704 | printf("\t.long 0x%08lx\n", relocs[i]); | ||
705 | } | ||
706 | } else { | ||
707 | /* Print a stop */ | ||
708 | printf("\t.long 0x%08lx\n", (unsigned long)0); | ||
709 | for (i = 0; i < reloc_count; i++) { | ||
710 | printf("\t.long 0x%08lx\n", relocs[i]); | ||
711 | } | ||
598 | } | 712 | } |
713 | |||
599 | printf("\n"); | 714 | printf("\n"); |
600 | } | 715 | } |
601 | else { | 716 | else { |
602 | unsigned char buf[4]; | 717 | if (use_real_mode) { |
603 | /* Print a stop */ | 718 | write32(reloc16_count, stdout); |
604 | fwrite("\0\0\0\0", 4, 1, stdout); | 719 | for (i = 0; i < reloc16_count; i++) |
605 | /* Now print each relocation */ | 720 | write32(relocs16[i], stdout); |
606 | for (i = 0; i < reloc_count; i++) { | 721 | write32(reloc_count, stdout); |
607 | put_unaligned_le32(relocs[i], buf); | 722 | |
608 | fwrite(buf, 4, 1, stdout); | 723 | /* Now print each relocation */ |
724 | for (i = 0; i < reloc_count; i++) | ||
725 | write32(relocs[i], stdout); | ||
726 | } else { | ||
727 | /* Print a stop */ | ||
728 | write32(0, stdout); | ||
729 | |||
730 | /* Now print each relocation */ | ||
731 | for (i = 0; i < reloc_count; i++) { | ||
732 | write32(relocs[i], stdout); | ||
733 | } | ||
609 | } | 734 | } |
610 | } | 735 | } |
611 | } | 736 | } |
612 | 737 | ||
613 | static void usage(void) | 738 | static void usage(void) |
614 | { | 739 | { |
615 | die("relocs [--abs-syms |--abs-relocs | --text] vmlinux\n"); | 740 | die("relocs [--abs-syms|--abs-relocs|--text|--realmode] vmlinux\n"); |
616 | } | 741 | } |
617 | 742 | ||
618 | int main(int argc, char **argv) | 743 | int main(int argc, char **argv) |
619 | { | 744 | { |
620 | int show_absolute_syms, show_absolute_relocs; | 745 | int show_absolute_syms, show_absolute_relocs; |
621 | int as_text; | 746 | int as_text, use_real_mode; |
622 | const char *fname; | 747 | const char *fname; |
623 | FILE *fp; | 748 | FILE *fp; |
624 | int i; | 749 | int i; |
625 | 750 | ||
626 | regex_init(); | ||
627 | |||
628 | show_absolute_syms = 0; | 751 | show_absolute_syms = 0; |
629 | show_absolute_relocs = 0; | 752 | show_absolute_relocs = 0; |
630 | as_text = 0; | 753 | as_text = 0; |
754 | use_real_mode = 0; | ||
631 | fname = NULL; | 755 | fname = NULL; |
632 | for (i = 1; i < argc; i++) { | 756 | for (i = 1; i < argc; i++) { |
633 | char *arg = argv[i]; | 757 | char *arg = argv[i]; |
634 | if (*arg == '-') { | 758 | if (*arg == '-') { |
635 | if (strcmp(argv[1], "--abs-syms") == 0) { | 759 | if (strcmp(arg, "--abs-syms") == 0) { |
636 | show_absolute_syms = 1; | 760 | show_absolute_syms = 1; |
637 | continue; | 761 | continue; |
638 | } | 762 | } |
639 | 763 | if (strcmp(arg, "--abs-relocs") == 0) { | |
640 | if (strcmp(argv[1], "--abs-relocs") == 0) { | ||
641 | show_absolute_relocs = 1; | 764 | show_absolute_relocs = 1; |
642 | continue; | 765 | continue; |
643 | } | 766 | } |
644 | else if (strcmp(argv[1], "--text") == 0) { | 767 | if (strcmp(arg, "--text") == 0) { |
645 | as_text = 1; | 768 | as_text = 1; |
646 | continue; | 769 | continue; |
647 | } | 770 | } |
771 | if (strcmp(arg, "--realmode") == 0) { | ||
772 | use_real_mode = 1; | ||
773 | continue; | ||
774 | } | ||
648 | } | 775 | } |
649 | else if (!fname) { | 776 | else if (!fname) { |
650 | fname = arg; | 777 | fname = arg; |
@@ -655,6 +782,7 @@ int main(int argc, char **argv) | |||
655 | if (!fname) { | 782 | if (!fname) { |
656 | usage(); | 783 | usage(); |
657 | } | 784 | } |
785 | regex_init(use_real_mode); | ||
658 | fp = fopen(fname, "r"); | 786 | fp = fopen(fname, "r"); |
659 | if (!fp) { | 787 | if (!fp) { |
660 | die("Cannot open %s: %s\n", | 788 | die("Cannot open %s: %s\n", |
@@ -673,6 +801,6 @@ int main(int argc, char **argv) | |||
673 | print_absolute_relocs(); | 801 | print_absolute_relocs(); |
674 | return 0; | 802 | return 0; |
675 | } | 803 | } |
676 | emit_relocs(as_text); | 804 | emit_relocs(as_text, use_real_mode); |
677 | return 0; | 805 | return 0; |
678 | } | 806 | } |
diff --git a/block/genhd.c b/block/genhd.c index df9816ede75b..9cf5583c90ff 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -743,7 +743,7 @@ void __init printk_all_partitions(void) | |||
743 | struct hd_struct *part; | 743 | struct hd_struct *part; |
744 | char name_buf[BDEVNAME_SIZE]; | 744 | char name_buf[BDEVNAME_SIZE]; |
745 | char devt_buf[BDEVT_SIZE]; | 745 | char devt_buf[BDEVT_SIZE]; |
746 | u8 uuid[PARTITION_META_INFO_UUIDLTH * 2 + 1]; | 746 | char uuid_buf[PARTITION_META_INFO_UUIDLTH * 2 + 5]; |
747 | 747 | ||
748 | /* | 748 | /* |
749 | * Don't show empty devices or things that have been | 749 | * Don't show empty devices or things that have been |
@@ -762,14 +762,16 @@ void __init printk_all_partitions(void) | |||
762 | while ((part = disk_part_iter_next(&piter))) { | 762 | while ((part = disk_part_iter_next(&piter))) { |
763 | bool is_part0 = part == &disk->part0; | 763 | bool is_part0 = part == &disk->part0; |
764 | 764 | ||
765 | uuid[0] = 0; | 765 | uuid_buf[0] = '\0'; |
766 | if (part->info) | 766 | if (part->info) |
767 | part_unpack_uuid(part->info->uuid, uuid); | 767 | snprintf(uuid_buf, sizeof(uuid_buf), "%pU", |
768 | part->info->uuid); | ||
768 | 769 | ||
769 | printk("%s%s %10llu %s %s", is_part0 ? "" : " ", | 770 | printk("%s%s %10llu %s %s", is_part0 ? "" : " ", |
770 | bdevt_str(part_devt(part), devt_buf), | 771 | bdevt_str(part_devt(part), devt_buf), |
771 | (unsigned long long)part->nr_sects >> 1, | 772 | (unsigned long long)part->nr_sects >> 1, |
772 | disk_name(disk, part->partno, name_buf), uuid); | 773 | disk_name(disk, part->partno, name_buf), |
774 | uuid_buf); | ||
773 | if (is_part0) { | 775 | if (is_part0) { |
774 | if (disk->driverfs_dev != NULL && | 776 | if (disk->driverfs_dev != NULL && |
775 | disk->driverfs_dev->driver != NULL) | 777 | disk->driverfs_dev->driver != NULL) |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 3263b68cdfa3..3188da3df8da 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -250,6 +250,10 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state) | |||
250 | return -ENODEV; | 250 | return -ENODEV; |
251 | } | 251 | } |
252 | 252 | ||
253 | /* For D3cold we should execute _PS3, not _PS4. */ | ||
254 | if (state == ACPI_STATE_D3_COLD) | ||
255 | object_name[3] = '3'; | ||
256 | |||
253 | /* | 257 | /* |
254 | * Transition Power | 258 | * Transition Power |
255 | * ---------------- | 259 | * ---------------- |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 330bb4d75852..0500f719f63e 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -660,7 +660,7 @@ int acpi_power_on_resources(struct acpi_device *device, int state) | |||
660 | 660 | ||
661 | int acpi_power_transition(struct acpi_device *device, int state) | 661 | int acpi_power_transition(struct acpi_device *device, int state) |
662 | { | 662 | { |
663 | int result; | 663 | int result = 0; |
664 | 664 | ||
665 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) | 665 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) |
666 | return -EINVAL; | 666 | return -EINVAL; |
@@ -679,8 +679,11 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
679 | * (e.g. so the device doesn't lose power while transitioning). Then, | 679 | * (e.g. so the device doesn't lose power while transitioning). Then, |
680 | * we dereference all power resources used in the current list. | 680 | * we dereference all power resources used in the current list. |
681 | */ | 681 | */ |
682 | result = acpi_power_on_list(&device->power.states[state].resources); | 682 | if (state < ACPI_STATE_D3_COLD) |
683 | if (!result) | 683 | result = acpi_power_on_list( |
684 | &device->power.states[state].resources); | ||
685 | |||
686 | if (!result && device->power.state < ACPI_STATE_D3_COLD) | ||
684 | acpi_power_off_list( | 687 | acpi_power_off_list( |
685 | &device->power.states[device->power.state].resources); | 688 | &device->power.states[device->power.state].resources); |
686 | 689 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 7417267e88fa..85cbfdccc97c 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -908,6 +908,10 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
908 | device->power.states[ACPI_STATE_D3].flags.valid = 1; | 908 | device->power.states[ACPI_STATE_D3].flags.valid = 1; |
909 | device->power.states[ACPI_STATE_D3].power = 0; | 909 | device->power.states[ACPI_STATE_D3].power = 0; |
910 | 910 | ||
911 | /* Set D3cold's explicit_set flag if _PS3 exists. */ | ||
912 | if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set) | ||
913 | device->power.states[ACPI_STATE_D3_COLD].flags.explicit_set = 1; | ||
914 | |||
911 | acpi_bus_init_power(device); | 915 | acpi_bus_init_power(device); |
912 | 916 | ||
913 | return 0; | 917 | return 0; |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 8db9089127c5..9a13e889837e 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -6580,24 +6580,21 @@ static const struct file_operations dac960_user_command_proc_fops = { | |||
6580 | 6580 | ||
6581 | static void DAC960_CreateProcEntries(DAC960_Controller_T *Controller) | 6581 | static void DAC960_CreateProcEntries(DAC960_Controller_T *Controller) |
6582 | { | 6582 | { |
6583 | struct proc_dir_entry *StatusProcEntry; | ||
6584 | struct proc_dir_entry *ControllerProcEntry; | 6583 | struct proc_dir_entry *ControllerProcEntry; |
6585 | struct proc_dir_entry *UserCommandProcEntry; | ||
6586 | 6584 | ||
6587 | if (DAC960_ProcDirectoryEntry == NULL) { | 6585 | if (DAC960_ProcDirectoryEntry == NULL) { |
6588 | DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL); | 6586 | DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL); |
6589 | StatusProcEntry = proc_create("status", 0, | 6587 | proc_create("status", 0, DAC960_ProcDirectoryEntry, |
6590 | DAC960_ProcDirectoryEntry, | 6588 | &dac960_proc_fops); |
6591 | &dac960_proc_fops); | ||
6592 | } | 6589 | } |
6593 | 6590 | ||
6594 | sprintf(Controller->ControllerName, "c%d", Controller->ControllerNumber); | 6591 | sprintf(Controller->ControllerName, "c%d", Controller->ControllerNumber); |
6595 | ControllerProcEntry = proc_mkdir(Controller->ControllerName, | 6592 | ControllerProcEntry = proc_mkdir(Controller->ControllerName, |
6596 | DAC960_ProcDirectoryEntry); | 6593 | DAC960_ProcDirectoryEntry); |
6597 | proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller); | 6594 | proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller); |
6598 | proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller); | 6595 | proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller); |
6599 | UserCommandProcEntry = proc_create_data("user_command", S_IWUSR | S_IRUSR, ControllerProcEntry, &dac960_user_command_proc_fops, Controller); | 6596 | proc_create_data("user_command", S_IWUSR | S_IRUSR, ControllerProcEntry, &dac960_user_command_proc_fops, Controller); |
6600 | Controller->ControllerProcEntry = ControllerProcEntry; | 6597 | Controller->ControllerProcEntry = ControllerProcEntry; |
6601 | } | 6598 | } |
6602 | 6599 | ||
6603 | 6600 | ||
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 00f9fc992090..304000c3d433 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -2510,8 +2510,10 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd, | |||
2510 | up(&dd->port->cmd_slot); | 2510 | up(&dd->port->cmd_slot); |
2511 | return NULL; | 2511 | return NULL; |
2512 | } | 2512 | } |
2513 | if (unlikely(*tag < 0)) | 2513 | if (unlikely(*tag < 0)) { |
2514 | up(&dd->port->cmd_slot); | ||
2514 | return NULL; | 2515 | return NULL; |
2516 | } | ||
2515 | 2517 | ||
2516 | return dd->port->commands[*tag].sg; | 2518 | return dd->port->commands[*tag].sg; |
2517 | } | 2519 | } |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index ddf86b6500b7..cdf2f5451c76 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1895,6 +1895,13 @@ static int virtcons_restore(struct virtio_device *vdev) | |||
1895 | 1895 | ||
1896 | /* Get port open/close status on the host */ | 1896 | /* Get port open/close status on the host */ |
1897 | send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1); | 1897 | send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1); |
1898 | |||
1899 | /* | ||
1900 | * If a port was open at the time of suspending, we | ||
1901 | * have to let the host know that it's still open. | ||
1902 | */ | ||
1903 | if (port->guest_connected) | ||
1904 | send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 1); | ||
1898 | } | 1905 | } |
1899 | return 0; | 1906 | return 0; |
1900 | } | 1907 | } |
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index ab9abb46d01a..dd414d9350ef 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig | |||
@@ -164,6 +164,7 @@ config CRYPTO_DEV_MV_CESA | |||
164 | select CRYPTO_ALGAPI | 164 | select CRYPTO_ALGAPI |
165 | select CRYPTO_AES | 165 | select CRYPTO_AES |
166 | select CRYPTO_BLKCIPHER2 | 166 | select CRYPTO_BLKCIPHER2 |
167 | select CRYPTO_HASH | ||
167 | help | 168 | help |
168 | This driver allows you to utilize the Cryptographic Engines and | 169 | This driver allows you to utilize the Cryptographic Engines and |
169 | Security Accelerator (CESA) which can be found on the Marvell Orion | 170 | Security Accelerator (CESA) which can be found on the Marvell Orion |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 445fdf811695..bf0d7e4e345b 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
@@ -245,7 +245,9 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc) | |||
245 | dev_vdbg(chan2dev(&atchan->chan_common), | 245 | dev_vdbg(chan2dev(&atchan->chan_common), |
246 | "descriptor %u complete\n", txd->cookie); | 246 | "descriptor %u complete\n", txd->cookie); |
247 | 247 | ||
248 | dma_cookie_complete(txd); | 248 | /* mark the descriptor as complete for non cyclic cases only */ |
249 | if (!atc_chan_is_cyclic(atchan)) | ||
250 | dma_cookie_complete(txd); | ||
249 | 251 | ||
250 | /* move children to free_list */ | 252 | /* move children to free_list */ |
251 | list_splice_init(&desc->tx_list, &atchan->free_list); | 253 | list_splice_init(&desc->tx_list, &atchan->free_list); |
diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index e6f133b78dc2..f6e9b572b998 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c | |||
@@ -703,7 +703,9 @@ static void ep93xx_dma_tasklet(unsigned long data) | |||
703 | desc = ep93xx_dma_get_active(edmac); | 703 | desc = ep93xx_dma_get_active(edmac); |
704 | if (desc) { | 704 | if (desc) { |
705 | if (desc->complete) { | 705 | if (desc->complete) { |
706 | dma_cookie_complete(&desc->txd); | 706 | /* mark descriptor complete for non cyclic case only */ |
707 | if (!test_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags)) | ||
708 | dma_cookie_complete(&desc->txd); | ||
707 | list_splice_init(&edmac->active, &list); | 709 | list_splice_init(&edmac->active, &list); |
708 | } | 710 | } |
709 | callback = desc->txd.callback; | 711 | callback = desc->txd.callback; |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 2ee6e23930ad..fa3fb21e60be 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -2322,7 +2322,8 @@ static void pl330_tasklet(unsigned long data) | |||
2322 | /* Pick up ripe tomatoes */ | 2322 | /* Pick up ripe tomatoes */ |
2323 | list_for_each_entry_safe(desc, _dt, &pch->work_list, node) | 2323 | list_for_each_entry_safe(desc, _dt, &pch->work_list, node) |
2324 | if (desc->status == DONE) { | 2324 | if (desc->status == DONE) { |
2325 | dma_cookie_complete(&desc->txd); | 2325 | if (pch->cyclic) |
2326 | dma_cookie_complete(&desc->txd); | ||
2326 | list_move_tail(&desc->node, &list); | 2327 | list_move_tail(&desc->node, &list); |
2327 | } | 2328 | } |
2328 | 2329 | ||
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 2fd87b544a93..eb3d138ff55a 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -1632,6 +1632,21 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti) | |||
1632 | pool->low_water_blocks = pt->low_water_blocks; | 1632 | pool->low_water_blocks = pt->low_water_blocks; |
1633 | pool->pf = pt->pf; | 1633 | pool->pf = pt->pf; |
1634 | 1634 | ||
1635 | /* | ||
1636 | * If discard_passdown was enabled verify that the data device | ||
1637 | * supports discards. Disable discard_passdown if not; otherwise | ||
1638 | * -EOPNOTSUPP will be returned. | ||
1639 | */ | ||
1640 | if (pt->pf.discard_passdown) { | ||
1641 | struct request_queue *q = bdev_get_queue(pt->data_dev->bdev); | ||
1642 | if (!q || !blk_queue_discard(q)) { | ||
1643 | char buf[BDEVNAME_SIZE]; | ||
1644 | DMWARN("Discard unsupported by data device (%s): Disabling discard passdown.", | ||
1645 | bdevname(pt->data_dev->bdev, buf)); | ||
1646 | pool->pf.discard_passdown = 0; | ||
1647 | } | ||
1648 | } | ||
1649 | |||
1635 | return 0; | 1650 | return 0; |
1636 | } | 1651 | } |
1637 | 1652 | ||
@@ -1988,19 +2003,6 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
1988 | goto out_flags_changed; | 2003 | goto out_flags_changed; |
1989 | } | 2004 | } |
1990 | 2005 | ||
1991 | /* | ||
1992 | * If discard_passdown was enabled verify that the data device | ||
1993 | * supports discards. Disable discard_passdown if not; otherwise | ||
1994 | * -EOPNOTSUPP will be returned. | ||
1995 | */ | ||
1996 | if (pf.discard_passdown) { | ||
1997 | struct request_queue *q = bdev_get_queue(data_dev->bdev); | ||
1998 | if (!q || !blk_queue_discard(q)) { | ||
1999 | DMWARN("Discard unsupported by data device: Disabling discard passdown."); | ||
2000 | pf.discard_passdown = 0; | ||
2001 | } | ||
2002 | } | ||
2003 | |||
2004 | pt->pool = pool; | 2006 | pt->pool = pool; |
2005 | pt->ti = ti; | 2007 | pt->ti = ti; |
2006 | pt->metadata_dev = metadata_dev; | 2008 | pt->metadata_dev = metadata_dev; |
@@ -2385,7 +2387,7 @@ static int pool_status(struct dm_target *ti, status_type_t type, | |||
2385 | (unsigned long long)pt->low_water_blocks); | 2387 | (unsigned long long)pt->low_water_blocks); |
2386 | 2388 | ||
2387 | count = !pool->pf.zero_new_blocks + !pool->pf.discard_enabled + | 2389 | count = !pool->pf.zero_new_blocks + !pool->pf.discard_enabled + |
2388 | !pool->pf.discard_passdown; | 2390 | !pt->pf.discard_passdown; |
2389 | DMEMIT("%u ", count); | 2391 | DMEMIT("%u ", count); |
2390 | 2392 | ||
2391 | if (!pool->pf.zero_new_blocks) | 2393 | if (!pool->pf.zero_new_blocks) |
@@ -2394,7 +2396,7 @@ static int pool_status(struct dm_target *ti, status_type_t type, | |||
2394 | if (!pool->pf.discard_enabled) | 2396 | if (!pool->pf.discard_enabled) |
2395 | DMEMIT("ignore_discard "); | 2397 | DMEMIT("ignore_discard "); |
2396 | 2398 | ||
2397 | if (!pool->pf.discard_passdown) | 2399 | if (!pt->pf.discard_passdown) |
2398 | DMEMIT("no_discard_passdown "); | 2400 | DMEMIT("no_discard_passdown "); |
2399 | 2401 | ||
2400 | break; | 2402 | break; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 477eb2e180c0..01233d855eb2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -391,6 +391,8 @@ void mddev_suspend(struct mddev *mddev) | |||
391 | synchronize_rcu(); | 391 | synchronize_rcu(); |
392 | wait_event(mddev->sb_wait, atomic_read(&mddev->active_io) == 0); | 392 | wait_event(mddev->sb_wait, atomic_read(&mddev->active_io) == 0); |
393 | mddev->pers->quiesce(mddev, 1); | 393 | mddev->pers->quiesce(mddev, 1); |
394 | |||
395 | del_timer_sync(&mddev->safemode_timer); | ||
394 | } | 396 | } |
395 | EXPORT_SYMBOL_GPL(mddev_suspend); | 397 | EXPORT_SYMBOL_GPL(mddev_suspend); |
396 | 398 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index c8dbb84d5357..3f91c2e1dfe7 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -3164,12 +3164,40 @@ raid10_size(struct mddev *mddev, sector_t sectors, int raid_disks) | |||
3164 | return size << conf->chunk_shift; | 3164 | return size << conf->chunk_shift; |
3165 | } | 3165 | } |
3166 | 3166 | ||
3167 | static void calc_sectors(struct r10conf *conf, sector_t size) | ||
3168 | { | ||
3169 | /* Calculate the number of sectors-per-device that will | ||
3170 | * actually be used, and set conf->dev_sectors and | ||
3171 | * conf->stride | ||
3172 | */ | ||
3173 | |||
3174 | size = size >> conf->chunk_shift; | ||
3175 | sector_div(size, conf->far_copies); | ||
3176 | size = size * conf->raid_disks; | ||
3177 | sector_div(size, conf->near_copies); | ||
3178 | /* 'size' is now the number of chunks in the array */ | ||
3179 | /* calculate "used chunks per device" */ | ||
3180 | size = size * conf->copies; | ||
3181 | |||
3182 | /* We need to round up when dividing by raid_disks to | ||
3183 | * get the stride size. | ||
3184 | */ | ||
3185 | size = DIV_ROUND_UP_SECTOR_T(size, conf->raid_disks); | ||
3186 | |||
3187 | conf->dev_sectors = size << conf->chunk_shift; | ||
3188 | |||
3189 | if (conf->far_offset) | ||
3190 | conf->stride = 1 << conf->chunk_shift; | ||
3191 | else { | ||
3192 | sector_div(size, conf->far_copies); | ||
3193 | conf->stride = size << conf->chunk_shift; | ||
3194 | } | ||
3195 | } | ||
3167 | 3196 | ||
3168 | static struct r10conf *setup_conf(struct mddev *mddev) | 3197 | static struct r10conf *setup_conf(struct mddev *mddev) |
3169 | { | 3198 | { |
3170 | struct r10conf *conf = NULL; | 3199 | struct r10conf *conf = NULL; |
3171 | int nc, fc, fo; | 3200 | int nc, fc, fo; |
3172 | sector_t stride, size; | ||
3173 | int err = -EINVAL; | 3201 | int err = -EINVAL; |
3174 | 3202 | ||
3175 | if (mddev->new_chunk_sectors < (PAGE_SIZE >> 9) || | 3203 | if (mddev->new_chunk_sectors < (PAGE_SIZE >> 9) || |
@@ -3219,28 +3247,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) | |||
3219 | if (!conf->r10bio_pool) | 3247 | if (!conf->r10bio_pool) |
3220 | goto out; | 3248 | goto out; |
3221 | 3249 | ||
3222 | size = mddev->dev_sectors >> conf->chunk_shift; | 3250 | calc_sectors(conf, mddev->dev_sectors); |
3223 | sector_div(size, fc); | ||
3224 | size = size * conf->raid_disks; | ||
3225 | sector_div(size, nc); | ||
3226 | /* 'size' is now the number of chunks in the array */ | ||
3227 | /* calculate "used chunks per device" in 'stride' */ | ||
3228 | stride = size * conf->copies; | ||
3229 | |||
3230 | /* We need to round up when dividing by raid_disks to | ||
3231 | * get the stride size. | ||
3232 | */ | ||
3233 | stride += conf->raid_disks - 1; | ||
3234 | sector_div(stride, conf->raid_disks); | ||
3235 | |||
3236 | conf->dev_sectors = stride << conf->chunk_shift; | ||
3237 | |||
3238 | if (fo) | ||
3239 | stride = 1; | ||
3240 | else | ||
3241 | sector_div(stride, fc); | ||
3242 | conf->stride = stride << conf->chunk_shift; | ||
3243 | |||
3244 | 3251 | ||
3245 | spin_lock_init(&conf->device_lock); | 3252 | spin_lock_init(&conf->device_lock); |
3246 | INIT_LIST_HEAD(&conf->retry_list); | 3253 | INIT_LIST_HEAD(&conf->retry_list); |
@@ -3468,7 +3475,8 @@ static int raid10_resize(struct mddev *mddev, sector_t sectors) | |||
3468 | mddev->recovery_cp = oldsize; | 3475 | mddev->recovery_cp = oldsize; |
3469 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 3476 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
3470 | } | 3477 | } |
3471 | mddev->dev_sectors = sectors; | 3478 | calc_sectors(conf, sectors); |
3479 | mddev->dev_sectors = conf->dev_sectors; | ||
3472 | mddev->resync_max_sectors = size; | 3480 | mddev->resync_max_sectors = size; |
3473 | return 0; | 3481 | return 0; |
3474 | } | 3482 | } |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 37b7d1c90723..95731c841044 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -493,7 +493,11 @@ out: | |||
493 | static void e1000_down_and_stop(struct e1000_adapter *adapter) | 493 | static void e1000_down_and_stop(struct e1000_adapter *adapter) |
494 | { | 494 | { |
495 | set_bit(__E1000_DOWN, &adapter->flags); | 495 | set_bit(__E1000_DOWN, &adapter->flags); |
496 | cancel_work_sync(&adapter->reset_task); | 496 | |
497 | /* Only kill reset task if adapter is not resetting */ | ||
498 | if (!test_bit(__E1000_RESETTING, &adapter->flags)) | ||
499 | cancel_work_sync(&adapter->reset_task); | ||
500 | |||
497 | cancel_delayed_work_sync(&adapter->watchdog_task); | 501 | cancel_delayed_work_sync(&adapter->watchdog_task); |
498 | cancel_delayed_work_sync(&adapter->phy_info_task); | 502 | cancel_delayed_work_sync(&adapter->phy_info_task); |
499 | cancel_delayed_work_sync(&adapter->fifo_stall_task); | 503 | cancel_delayed_work_sync(&adapter->fifo_stall_task); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index fa58c7869954..9ce6995e8d08 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -501,7 +501,9 @@ static void virtnet_napi_enable(struct virtnet_info *vi) | |||
501 | * We synchronize against interrupts via NAPI_STATE_SCHED */ | 501 | * We synchronize against interrupts via NAPI_STATE_SCHED */ |
502 | if (napi_schedule_prep(&vi->napi)) { | 502 | if (napi_schedule_prep(&vi->napi)) { |
503 | virtqueue_disable_cb(vi->rvq); | 503 | virtqueue_disable_cb(vi->rvq); |
504 | local_bh_disable(); | ||
504 | __napi_schedule(&vi->napi); | 505 | __napi_schedule(&vi->napi); |
506 | local_bh_enable(); | ||
505 | } | 507 | } |
506 | } | 508 | } |
507 | 509 | ||
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 1929c0c63b75..61e2fefeedab 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -223,7 +223,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
223 | [PCI_D0] = ACPI_STATE_D0, | 223 | [PCI_D0] = ACPI_STATE_D0, |
224 | [PCI_D1] = ACPI_STATE_D1, | 224 | [PCI_D1] = ACPI_STATE_D1, |
225 | [PCI_D2] = ACPI_STATE_D2, | 225 | [PCI_D2] = ACPI_STATE_D2, |
226 | [PCI_D3hot] = ACPI_STATE_D3_HOT, | 226 | [PCI_D3hot] = ACPI_STATE_D3, |
227 | [PCI_D3cold] = ACPI_STATE_D3 | 227 | [PCI_D3cold] = ACPI_STATE_D3 |
228 | }; | 228 | }; |
229 | int error = -EINVAL; | 229 | int error = -EINVAL; |
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 684ef4bbfce4..f027c063fb20 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
@@ -312,6 +312,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
312 | int ret; | 312 | int ret; |
313 | struct pl031_local *ldata; | 313 | struct pl031_local *ldata; |
314 | struct rtc_class_ops *ops = id->data; | 314 | struct rtc_class_ops *ops = id->data; |
315 | unsigned long time; | ||
315 | 316 | ||
316 | ret = amba_request_regions(adev, NULL); | 317 | ret = amba_request_regions(adev, NULL); |
317 | if (ret) | 318 | if (ret) |
@@ -343,6 +344,23 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
343 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, | 344 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, |
344 | ldata->base + RTC_CR); | 345 | ldata->base + RTC_CR); |
345 | 346 | ||
347 | /* | ||
348 | * On ST PL031 variants, the RTC reset value does not provide correct | ||
349 | * weekday for 2000-01-01. Correct the erroneous sunday to saturday. | ||
350 | */ | ||
351 | if (ldata->hw_designer == AMBA_VENDOR_ST) { | ||
352 | if (readl(ldata->base + RTC_YDR) == 0x2000) { | ||
353 | time = readl(ldata->base + RTC_DR); | ||
354 | if ((time & | ||
355 | (RTC_MON_MASK | RTC_MDAY_MASK | RTC_WDAY_MASK)) | ||
356 | == 0x02120000) { | ||
357 | time = time | (0x7 << RTC_WDAY_SHIFT); | ||
358 | writel(0x2000, ldata->base + RTC_YLR); | ||
359 | writel(time, ldata->base + RTC_LR); | ||
360 | } | ||
361 | } | ||
362 | } | ||
363 | |||
346 | ldata->rtc = rtc_device_register("pl031", &adev->dev, ops, | 364 | ldata->rtc = rtc_device_register("pl031", &adev->dev, ops, |
347 | THIS_MODULE); | 365 | THIS_MODULE); |
348 | if (IS_ERR(ldata->rtc)) { | 366 | if (IS_ERR(ldata->rtc)) { |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 7ed58e2df791..f286955331a2 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -169,6 +169,7 @@ static struct se_device *fd_create_virtdevice( | |||
169 | inode = file->f_mapping->host; | 169 | inode = file->f_mapping->host; |
170 | if (S_ISBLK(inode->i_mode)) { | 170 | if (S_ISBLK(inode->i_mode)) { |
171 | struct request_queue *q; | 171 | struct request_queue *q; |
172 | unsigned long long dev_size; | ||
172 | /* | 173 | /* |
173 | * Setup the local scope queue_limits from struct request_queue->limits | 174 | * Setup the local scope queue_limits from struct request_queue->limits |
174 | * to pass into transport_add_device_to_core_hba() as struct se_dev_limits. | 175 | * to pass into transport_add_device_to_core_hba() as struct se_dev_limits. |
@@ -183,13 +184,12 @@ static struct se_device *fd_create_virtdevice( | |||
183 | * one (1) logical sector from underlying struct block_device | 184 | * one (1) logical sector from underlying struct block_device |
184 | */ | 185 | */ |
185 | fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev); | 186 | fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev); |
186 | fd_dev->fd_dev_size = (i_size_read(file->f_mapping->host) - | 187 | dev_size = (i_size_read(file->f_mapping->host) - |
187 | fd_dev->fd_block_size); | 188 | fd_dev->fd_block_size); |
188 | 189 | ||
189 | pr_debug("FILEIO: Using size: %llu bytes from struct" | 190 | pr_debug("FILEIO: Using size: %llu bytes from struct" |
190 | " block_device blocks: %llu logical_block_size: %d\n", | 191 | " block_device blocks: %llu logical_block_size: %d\n", |
191 | fd_dev->fd_dev_size, | 192 | dev_size, div_u64(dev_size, fd_dev->fd_block_size), |
192 | div_u64(fd_dev->fd_dev_size, fd_dev->fd_block_size), | ||
193 | fd_dev->fd_block_size); | 193 | fd_dev->fd_block_size); |
194 | } else { | 194 | } else { |
195 | if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) { | 195 | if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) { |
@@ -605,10 +605,20 @@ static u32 fd_get_device_type(struct se_device *dev) | |||
605 | static sector_t fd_get_blocks(struct se_device *dev) | 605 | static sector_t fd_get_blocks(struct se_device *dev) |
606 | { | 606 | { |
607 | struct fd_dev *fd_dev = dev->dev_ptr; | 607 | struct fd_dev *fd_dev = dev->dev_ptr; |
608 | unsigned long long blocks_long = div_u64(fd_dev->fd_dev_size, | 608 | struct file *f = fd_dev->fd_file; |
609 | dev->se_sub_dev->se_dev_attrib.block_size); | 609 | struct inode *i = f->f_mapping->host; |
610 | unsigned long long dev_size; | ||
611 | /* | ||
612 | * When using a file that references an underlying struct block_device, | ||
613 | * ensure dev_size is always based on the current inode size in order | ||
614 | * to handle underlying block_device resize operations. | ||
615 | */ | ||
616 | if (S_ISBLK(i->i_mode)) | ||
617 | dev_size = (i_size_read(i) - fd_dev->fd_block_size); | ||
618 | else | ||
619 | dev_size = fd_dev->fd_dev_size; | ||
610 | 620 | ||
611 | return blocks_long; | 621 | return div_u64(dev_size, dev->se_sub_dev->se_dev_attrib.block_size); |
612 | } | 622 | } |
613 | 623 | ||
614 | static struct se_subsystem_api fileio_template = { | 624 | static struct se_subsystem_api fileio_template = { |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 86f0c3b5d500..c3148b10b4b3 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -220,6 +220,9 @@ int target_scsi2_reservation_release(struct se_task *task) | |||
220 | if (dev->dev_reserved_node_acl != sess->se_node_acl) | 220 | if (dev->dev_reserved_node_acl != sess->se_node_acl) |
221 | goto out_unlock; | 221 | goto out_unlock; |
222 | 222 | ||
223 | if (dev->dev_res_bin_isid != sess->sess_bin_isid) | ||
224 | goto out_unlock; | ||
225 | |||
223 | dev->dev_reserved_node_acl = NULL; | 226 | dev->dev_reserved_node_acl = NULL; |
224 | dev->dev_flags &= ~DF_SPC2_RESERVATIONS; | 227 | dev->dev_flags &= ~DF_SPC2_RESERVATIONS; |
225 | if (dev->dev_flags & DF_SPC2_RESERVATIONS_WITH_ISID) { | 228 | if (dev->dev_flags & DF_SPC2_RESERVATIONS_WITH_ISID) { |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index c2d05a8279fd..8807fe501d20 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -390,6 +390,7 @@ static void __devexit virtballoon_remove(struct virtio_device *vdev) | |||
390 | /* There might be pages left in the balloon: free them. */ | 390 | /* There might be pages left in the balloon: free them. */ |
391 | while (vb->num_pages) | 391 | while (vb->num_pages) |
392 | leak_balloon(vb, vb->num_pages); | 392 | leak_balloon(vb, vb->num_pages); |
393 | update_balloon_size(vb); | ||
393 | 394 | ||
394 | /* Now we reset the device so we can clean up the queues. */ | 395 | /* Now we reset the device so we can clean up the queues. */ |
395 | vdev->config->reset(vdev); | 396 | vdev->config->reset(vdev); |
@@ -505,9 +505,14 @@ EXPORT_SYMBOL(bio_clone); | |||
505 | int bio_get_nr_vecs(struct block_device *bdev) | 505 | int bio_get_nr_vecs(struct block_device *bdev) |
506 | { | 506 | { |
507 | struct request_queue *q = bdev_get_queue(bdev); | 507 | struct request_queue *q = bdev_get_queue(bdev); |
508 | return min_t(unsigned, | 508 | int nr_pages; |
509 | |||
510 | nr_pages = min_t(unsigned, | ||
509 | queue_max_segments(q), | 511 | queue_max_segments(q), |
510 | queue_max_sectors(q) / (PAGE_SIZE >> 9) + 1); | 512 | queue_max_sectors(q) / (PAGE_SIZE >> 9) + 1); |
513 | |||
514 | return min_t(unsigned, nr_pages, BIO_MAX_PAGES); | ||
515 | |||
511 | } | 516 | } |
512 | EXPORT_SYMBOL(bio_get_nr_vecs); | 517 | EXPORT_SYMBOL(bio_get_nr_vecs); |
513 | 518 | ||
diff --git a/fs/block_dev.c b/fs/block_dev.c index e08f6a20a5bb..ba11c30f302d 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -70,7 +70,7 @@ static void bdev_inode_switch_bdi(struct inode *inode, | |||
70 | spin_unlock(&dst->wb.list_lock); | 70 | spin_unlock(&dst->wb.list_lock); |
71 | } | 71 | } |
72 | 72 | ||
73 | static sector_t max_block(struct block_device *bdev) | 73 | sector_t blkdev_max_block(struct block_device *bdev) |
74 | { | 74 | { |
75 | sector_t retval = ~((sector_t)0); | 75 | sector_t retval = ~((sector_t)0); |
76 | loff_t sz = i_size_read(bdev->bd_inode); | 76 | loff_t sz = i_size_read(bdev->bd_inode); |
@@ -163,7 +163,7 @@ static int | |||
163 | blkdev_get_block(struct inode *inode, sector_t iblock, | 163 | blkdev_get_block(struct inode *inode, sector_t iblock, |
164 | struct buffer_head *bh, int create) | 164 | struct buffer_head *bh, int create) |
165 | { | 165 | { |
166 | if (iblock >= max_block(I_BDEV(inode))) { | 166 | if (iblock >= blkdev_max_block(I_BDEV(inode))) { |
167 | if (create) | 167 | if (create) |
168 | return -EIO; | 168 | return -EIO; |
169 | 169 | ||
@@ -185,7 +185,7 @@ static int | |||
185 | blkdev_get_blocks(struct inode *inode, sector_t iblock, | 185 | blkdev_get_blocks(struct inode *inode, sector_t iblock, |
186 | struct buffer_head *bh, int create) | 186 | struct buffer_head *bh, int create) |
187 | { | 187 | { |
188 | sector_t end_block = max_block(I_BDEV(inode)); | 188 | sector_t end_block = blkdev_max_block(I_BDEV(inode)); |
189 | unsigned long max_blocks = bh->b_size >> inode->i_blkbits; | 189 | unsigned long max_blocks = bh->b_size >> inode->i_blkbits; |
190 | 190 | ||
191 | if ((iblock + max_blocks) > end_block) { | 191 | if ((iblock + max_blocks) > end_block) { |
diff --git a/fs/buffer.c b/fs/buffer.c index 351e18ea2e53..ad5938ca357c 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -921,6 +921,7 @@ init_page_buffers(struct page *page, struct block_device *bdev, | |||
921 | struct buffer_head *head = page_buffers(page); | 921 | struct buffer_head *head = page_buffers(page); |
922 | struct buffer_head *bh = head; | 922 | struct buffer_head *bh = head; |
923 | int uptodate = PageUptodate(page); | 923 | int uptodate = PageUptodate(page); |
924 | sector_t end_block = blkdev_max_block(I_BDEV(bdev->bd_inode)); | ||
924 | 925 | ||
925 | do { | 926 | do { |
926 | if (!buffer_mapped(bh)) { | 927 | if (!buffer_mapped(bh)) { |
@@ -929,7 +930,8 @@ init_page_buffers(struct page *page, struct block_device *bdev, | |||
929 | bh->b_blocknr = block; | 930 | bh->b_blocknr = block; |
930 | if (uptodate) | 931 | if (uptodate) |
931 | set_buffer_uptodate(bh); | 932 | set_buffer_uptodate(bh); |
932 | set_buffer_mapped(bh); | 933 | if (block < end_block) |
934 | set_buffer_mapped(bh); | ||
933 | } | 935 | } |
934 | block++; | 936 | block++; |
935 | bh = bh->b_this_page; | 937 | bh = bh->b_this_page; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 1c8b280146d7..57b8159f26f3 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1799,10 +1799,15 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
1799 | if (task) { | 1799 | if (task) { |
1800 | files = get_files_struct(task); | 1800 | files = get_files_struct(task); |
1801 | if (files) { | 1801 | if (files) { |
1802 | struct file *file; | ||
1802 | rcu_read_lock(); | 1803 | rcu_read_lock(); |
1803 | if (fcheck_files(files, fd)) { | 1804 | file = fcheck_files(files, fd); |
1805 | if (file) { | ||
1806 | unsigned i_mode, f_mode = file->f_mode; | ||
1807 | |||
1804 | rcu_read_unlock(); | 1808 | rcu_read_unlock(); |
1805 | put_files_struct(files); | 1809 | put_files_struct(files); |
1810 | |||
1806 | if (task_dumpable(task)) { | 1811 | if (task_dumpable(task)) { |
1807 | rcu_read_lock(); | 1812 | rcu_read_lock(); |
1808 | cred = __task_cred(task); | 1813 | cred = __task_cred(task); |
@@ -1813,7 +1818,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
1813 | inode->i_uid = 0; | 1818 | inode->i_uid = 0; |
1814 | inode->i_gid = 0; | 1819 | inode->i_gid = 0; |
1815 | } | 1820 | } |
1816 | inode->i_mode &= ~(S_ISUID | S_ISGID); | 1821 | |
1822 | i_mode = S_IFLNK; | ||
1823 | if (f_mode & FMODE_READ) | ||
1824 | i_mode |= S_IRUSR | S_IXUSR; | ||
1825 | if (f_mode & FMODE_WRITE) | ||
1826 | i_mode |= S_IWUSR | S_IXUSR; | ||
1827 | inode->i_mode = i_mode; | ||
1828 | |||
1817 | security_task_to_inode(task, inode); | 1829 | security_task_to_inode(task, inode); |
1818 | put_task_struct(task); | 1830 | put_task_struct(task); |
1819 | return 1; | 1831 | return 1; |
@@ -1837,8 +1849,6 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, | |||
1837 | struct dentry *dentry, struct task_struct *task, const void *ptr) | 1849 | struct dentry *dentry, struct task_struct *task, const void *ptr) |
1838 | { | 1850 | { |
1839 | unsigned fd = *(const unsigned *)ptr; | 1851 | unsigned fd = *(const unsigned *)ptr; |
1840 | struct file *file; | ||
1841 | struct files_struct *files; | ||
1842 | struct inode *inode; | 1852 | struct inode *inode; |
1843 | struct proc_inode *ei; | 1853 | struct proc_inode *ei; |
1844 | struct dentry *error = ERR_PTR(-ENOENT); | 1854 | struct dentry *error = ERR_PTR(-ENOENT); |
@@ -1848,25 +1858,6 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, | |||
1848 | goto out; | 1858 | goto out; |
1849 | ei = PROC_I(inode); | 1859 | ei = PROC_I(inode); |
1850 | ei->fd = fd; | 1860 | ei->fd = fd; |
1851 | files = get_files_struct(task); | ||
1852 | if (!files) | ||
1853 | goto out_iput; | ||
1854 | inode->i_mode = S_IFLNK; | ||
1855 | |||
1856 | /* | ||
1857 | * We are not taking a ref to the file structure, so we must | ||
1858 | * hold ->file_lock. | ||
1859 | */ | ||
1860 | spin_lock(&files->file_lock); | ||
1861 | file = fcheck_files(files, fd); | ||
1862 | if (!file) | ||
1863 | goto out_unlock; | ||
1864 | if (file->f_mode & FMODE_READ) | ||
1865 | inode->i_mode |= S_IRUSR | S_IXUSR; | ||
1866 | if (file->f_mode & FMODE_WRITE) | ||
1867 | inode->i_mode |= S_IWUSR | S_IXUSR; | ||
1868 | spin_unlock(&files->file_lock); | ||
1869 | put_files_struct(files); | ||
1870 | 1861 | ||
1871 | inode->i_op = &proc_pid_link_inode_operations; | 1862 | inode->i_op = &proc_pid_link_inode_operations; |
1872 | inode->i_size = 64; | 1863 | inode->i_size = 64; |
@@ -1879,12 +1870,6 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, | |||
1879 | 1870 | ||
1880 | out: | 1871 | out: |
1881 | return error; | 1872 | return error; |
1882 | out_unlock: | ||
1883 | spin_unlock(&files->file_lock); | ||
1884 | put_files_struct(files); | ||
1885 | out_iput: | ||
1886 | iput(inode); | ||
1887 | goto out; | ||
1888 | } | 1873 | } |
1889 | 1874 | ||
1890 | static struct dentry *proc_lookupfd_common(struct inode *dir, | 1875 | static struct dentry *proc_lookupfd_common(struct inode *dir, |
@@ -2177,16 +2162,16 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, | |||
2177 | goto out; | 2162 | goto out; |
2178 | 2163 | ||
2179 | result = ERR_PTR(-EACCES); | 2164 | result = ERR_PTR(-EACCES); |
2180 | if (lock_trace(task)) | 2165 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
2181 | goto out_put_task; | 2166 | goto out_put_task; |
2182 | 2167 | ||
2183 | result = ERR_PTR(-ENOENT); | 2168 | result = ERR_PTR(-ENOENT); |
2184 | if (dname_to_vma_addr(dentry, &vm_start, &vm_end)) | 2169 | if (dname_to_vma_addr(dentry, &vm_start, &vm_end)) |
2185 | goto out_unlock; | 2170 | goto out_put_task; |
2186 | 2171 | ||
2187 | mm = get_task_mm(task); | 2172 | mm = get_task_mm(task); |
2188 | if (!mm) | 2173 | if (!mm) |
2189 | goto out_unlock; | 2174 | goto out_put_task; |
2190 | 2175 | ||
2191 | down_read(&mm->mmap_sem); | 2176 | down_read(&mm->mmap_sem); |
2192 | vma = find_exact_vma(mm, vm_start, vm_end); | 2177 | vma = find_exact_vma(mm, vm_start, vm_end); |
@@ -2198,8 +2183,6 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, | |||
2198 | out_no_vma: | 2183 | out_no_vma: |
2199 | up_read(&mm->mmap_sem); | 2184 | up_read(&mm->mmap_sem); |
2200 | mmput(mm); | 2185 | mmput(mm); |
2201 | out_unlock: | ||
2202 | unlock_trace(task); | ||
2203 | out_put_task: | 2186 | out_put_task: |
2204 | put_task_struct(task); | 2187 | put_task_struct(task); |
2205 | out: | 2188 | out: |
@@ -2233,7 +2216,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
2233 | goto out; | 2216 | goto out; |
2234 | 2217 | ||
2235 | ret = -EACCES; | 2218 | ret = -EACCES; |
2236 | if (lock_trace(task)) | 2219 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
2237 | goto out_put_task; | 2220 | goto out_put_task; |
2238 | 2221 | ||
2239 | ret = 0; | 2222 | ret = 0; |
@@ -2241,12 +2224,12 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
2241 | case 0: | 2224 | case 0: |
2242 | ino = inode->i_ino; | 2225 | ino = inode->i_ino; |
2243 | if (filldir(dirent, ".", 1, 0, ino, DT_DIR) < 0) | 2226 | if (filldir(dirent, ".", 1, 0, ino, DT_DIR) < 0) |
2244 | goto out_unlock; | 2227 | goto out_put_task; |
2245 | filp->f_pos++; | 2228 | filp->f_pos++; |
2246 | case 1: | 2229 | case 1: |
2247 | ino = parent_ino(dentry); | 2230 | ino = parent_ino(dentry); |
2248 | if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0) | 2231 | if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0) |
2249 | goto out_unlock; | 2232 | goto out_put_task; |
2250 | filp->f_pos++; | 2233 | filp->f_pos++; |
2251 | default: | 2234 | default: |
2252 | { | 2235 | { |
@@ -2257,7 +2240,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
2257 | 2240 | ||
2258 | mm = get_task_mm(task); | 2241 | mm = get_task_mm(task); |
2259 | if (!mm) | 2242 | if (!mm) |
2260 | goto out_unlock; | 2243 | goto out_put_task; |
2261 | down_read(&mm->mmap_sem); | 2244 | down_read(&mm->mmap_sem); |
2262 | 2245 | ||
2263 | nr_files = 0; | 2246 | nr_files = 0; |
@@ -2287,7 +2270,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
2287 | flex_array_free(fa); | 2270 | flex_array_free(fa); |
2288 | up_read(&mm->mmap_sem); | 2271 | up_read(&mm->mmap_sem); |
2289 | mmput(mm); | 2272 | mmput(mm); |
2290 | goto out_unlock; | 2273 | goto out_put_task; |
2291 | } | 2274 | } |
2292 | for (i = 0, vma = mm->mmap, pos = 2; vma; | 2275 | for (i = 0, vma = mm->mmap, pos = 2; vma; |
2293 | vma = vma->vm_next) { | 2276 | vma = vma->vm_next) { |
@@ -2332,8 +2315,6 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
2332 | } | 2315 | } |
2333 | } | 2316 | } |
2334 | 2317 | ||
2335 | out_unlock: | ||
2336 | unlock_trace(task); | ||
2337 | out_put_task: | 2318 | out_put_task: |
2338 | put_task_struct(task); | 2319 | put_task_struct(task); |
2339 | out: | 2320 | out: |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2aa24664a5b5..4d4ac24a263e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1,9 +1,10 @@ | |||
1 | #ifndef _LINUX_BLKDEV_H | 1 | #ifndef _LINUX_BLKDEV_H |
2 | #define _LINUX_BLKDEV_H | 2 | #define _LINUX_BLKDEV_H |
3 | 3 | ||
4 | #include <linux/sched.h> | ||
5 | |||
4 | #ifdef CONFIG_BLOCK | 6 | #ifdef CONFIG_BLOCK |
5 | 7 | ||
6 | #include <linux/sched.h> | ||
7 | #include <linux/major.h> | 8 | #include <linux/major.h> |
8 | #include <linux/genhd.h> | 9 | #include <linux/genhd.h> |
9 | #include <linux/list.h> | 10 | #include <linux/list.h> |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 8de675523e46..25c40b9f848a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2051,6 +2051,7 @@ extern void unregister_blkdev(unsigned int, const char *); | |||
2051 | extern struct block_device *bdget(dev_t); | 2051 | extern struct block_device *bdget(dev_t); |
2052 | extern struct block_device *bdgrab(struct block_device *bdev); | 2052 | extern struct block_device *bdgrab(struct block_device *bdev); |
2053 | extern void bd_set_size(struct block_device *, loff_t size); | 2053 | extern void bd_set_size(struct block_device *, loff_t size); |
2054 | extern sector_t blkdev_max_block(struct block_device *bdev); | ||
2054 | extern void bd_forget(struct inode *inode); | 2055 | extern void bd_forget(struct inode *inode); |
2055 | extern void bdput(struct block_device *); | 2056 | extern void bdput(struct block_device *); |
2056 | extern void invalidate_bdev(struct block_device *); | 2057 | extern void invalidate_bdev(struct block_device *); |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 5f3f3be5af09..176a939d1547 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -179,6 +179,7 @@ enum { | |||
179 | TRACE_EVENT_FL_RECORDED_CMD_BIT, | 179 | TRACE_EVENT_FL_RECORDED_CMD_BIT, |
180 | TRACE_EVENT_FL_CAP_ANY_BIT, | 180 | TRACE_EVENT_FL_CAP_ANY_BIT, |
181 | TRACE_EVENT_FL_NO_SET_FILTER_BIT, | 181 | TRACE_EVENT_FL_NO_SET_FILTER_BIT, |
182 | TRACE_EVENT_FL_IGNORE_ENABLE_BIT, | ||
182 | }; | 183 | }; |
183 | 184 | ||
184 | enum { | 185 | enum { |
@@ -187,6 +188,7 @@ enum { | |||
187 | TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), | 188 | TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), |
188 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), | 189 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), |
189 | TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), | 190 | TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), |
191 | TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), | ||
190 | }; | 192 | }; |
191 | 193 | ||
192 | struct ftrace_event_call { | 194 | struct ftrace_event_call { |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index e61d3192448e..017a7fb5a1fc 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -222,12 +222,6 @@ static inline void part_pack_uuid(const u8 *uuid_str, u8 *to) | |||
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | static inline char *part_unpack_uuid(const u8 *uuid, char *out) | ||
226 | { | ||
227 | sprintf(out, "%pU", uuid); | ||
228 | return out; | ||
229 | } | ||
230 | |||
231 | static inline int disk_max_parts(struct gendisk *disk) | 225 | static inline int disk_max_parts(struct gendisk *disk) |
232 | { | 226 | { |
233 | if (disk->flags & GENHD_FL_EXT_DEVT) | 227 | if (disk->flags & GENHD_FL_EXT_DEVT) |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0533a688ce22..e5212ae294f6 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -6382,6 +6382,8 @@ static int __sdt_alloc(const struct cpumask *cpu_map) | |||
6382 | if (!sg) | 6382 | if (!sg) |
6383 | return -ENOMEM; | 6383 | return -ENOMEM; |
6384 | 6384 | ||
6385 | sg->next = sg; | ||
6386 | |||
6385 | *per_cpu_ptr(sdd->sg, j) = sg; | 6387 | *per_cpu_ptr(sdd->sg, j) = sg; |
6386 | 6388 | ||
6387 | sgp = kzalloc_node(sizeof(struct sched_group_power), | 6389 | sgp = kzalloc_node(sizeof(struct sched_group_power), |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 079a93ae8a9d..29111da1d100 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -294,6 +294,9 @@ static int __ftrace_set_clr_event(const char *match, const char *sub, | |||
294 | if (!call->name || !call->class || !call->class->reg) | 294 | if (!call->name || !call->class || !call->class->reg) |
295 | continue; | 295 | continue; |
296 | 296 | ||
297 | if (call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) | ||
298 | continue; | ||
299 | |||
297 | if (match && | 300 | if (match && |
298 | strcmp(match, call->name) != 0 && | 301 | strcmp(match, call->name) != 0 && |
299 | strcmp(match, call->class->system) != 0) | 302 | strcmp(match, call->class->system) != 0) |
@@ -1164,7 +1167,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events, | |||
1164 | return -1; | 1167 | return -1; |
1165 | } | 1168 | } |
1166 | 1169 | ||
1167 | if (call->class->reg) | 1170 | if (call->class->reg && !(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)) |
1168 | trace_create_file("enable", 0644, call->dir, call, | 1171 | trace_create_file("enable", 0644, call->dir, call, |
1169 | enable); | 1172 | enable); |
1170 | 1173 | ||
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 3dd15e8bc856..e039906b037d 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -180,6 +180,7 @@ struct ftrace_event_call __used event_##call = { \ | |||
180 | .event.type = etype, \ | 180 | .event.type = etype, \ |
181 | .class = &event_class_ftrace_##call, \ | 181 | .class = &event_class_ftrace_##call, \ |
182 | .print_fmt = print, \ | 182 | .print_fmt = print, \ |
183 | .flags = TRACE_EVENT_FL_IGNORE_ENABLE, \ | ||
183 | }; \ | 184 | }; \ |
184 | struct ftrace_event_call __used \ | 185 | struct ftrace_event_call __used \ |
185 | __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; | 186 | __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index b659260c56ad..7685d4a0b3ce 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -5481,7 +5481,7 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd, | |||
5481 | * part of thp split is not executed yet. | 5481 | * part of thp split is not executed yet. |
5482 | */ | 5482 | */ |
5483 | if (pmd_trans_huge_lock(pmd, vma) == 1) { | 5483 | if (pmd_trans_huge_lock(pmd, vma) == 1) { |
5484 | if (!mc.precharge) { | 5484 | if (mc.precharge < HPAGE_PMD_NR) { |
5485 | spin_unlock(&vma->vm_mm->page_table_lock); | 5485 | spin_unlock(&vma->vm_mm->page_table_lock); |
5486 | return 0; | 5486 | return 0; |
5487 | } | 5487 | } |
@@ -2040,7 +2040,7 @@ static bool has_cpu_slab(int cpu, void *info) | |||
2040 | struct kmem_cache *s = info; | 2040 | struct kmem_cache *s = info; |
2041 | struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu); | 2041 | struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu); |
2042 | 2042 | ||
2043 | return !!(c->page); | 2043 | return c->page || c->partial; |
2044 | } | 2044 | } |
2045 | 2045 | ||
2046 | static void flush_all(struct kmem_cache *s) | 2046 | static void flush_all(struct kmem_cache *s) |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 30eb768cd677..cce9e53528b1 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -3749,13 +3749,13 @@ static void __exit pg_cleanup(void) | |||
3749 | { | 3749 | { |
3750 | struct pktgen_thread *t; | 3750 | struct pktgen_thread *t; |
3751 | struct list_head *q, *n; | 3751 | struct list_head *q, *n; |
3752 | struct list_head list; | 3752 | LIST_HEAD(list); |
3753 | 3753 | ||
3754 | /* Stop all interfaces & threads */ | 3754 | /* Stop all interfaces & threads */ |
3755 | pktgen_exiting = true; | 3755 | pktgen_exiting = true; |
3756 | 3756 | ||
3757 | mutex_lock(&pktgen_thread_lock); | 3757 | mutex_lock(&pktgen_thread_lock); |
3758 | list_splice(&list, &pktgen_threads); | 3758 | list_splice_init(&pktgen_threads, &list); |
3759 | mutex_unlock(&pktgen_thread_lock); | 3759 | mutex_unlock(&pktgen_thread_lock); |
3760 | 3760 | ||
3761 | list_for_each_safe(q, n, &list) { | 3761 | list_for_each_safe(q, n, &list) { |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index e13546ca9923..bb485fcb077e 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -917,8 +917,7 @@ new_segment: | |||
917 | wait_for_sndbuf: | 917 | wait_for_sndbuf: |
918 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | 918 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); |
919 | wait_for_memory: | 919 | wait_for_memory: |
920 | if (copied) | 920 | tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH); |
921 | tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH); | ||
922 | 921 | ||
923 | if ((err = sk_stream_wait_memory(sk, &timeo)) != 0) | 922 | if ((err = sk_stream_wait_memory(sk, &timeo)) != 0) |
924 | goto do_error; | 923 | goto do_error; |
diff --git a/scripts/Makefile b/scripts/Makefile index df7678febf27..36266665dbcb 100644 --- a/scripts/Makefile +++ b/scripts/Makefile | |||
@@ -8,6 +8,8 @@ | |||
8 | # conmakehash: Create arrays for initializing the kernel console tables | 8 | # conmakehash: Create arrays for initializing the kernel console tables |
9 | # docproc: Used in Documentation/DocBook | 9 | # docproc: Used in Documentation/DocBook |
10 | 10 | ||
11 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include | ||
12 | |||
11 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms | 13 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms |
12 | hostprogs-$(CONFIG_LOGO) += pnmtologo | 14 | hostprogs-$(CONFIG_LOGO) += pnmtologo |
13 | hostprogs-$(CONFIG_VT) += conmakehash | 15 | hostprogs-$(CONFIG_VT) += conmakehash |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 9bf3fc759344..92271d32bc30 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -774,10 +774,10 @@ $(OUTPUT)perf.o perf.spec \ | |||
774 | # over the general rule for .o | 774 | # over the general rule for .o |
775 | 775 | ||
776 | $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS | 776 | $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS |
777 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | 777 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -w $< |
778 | 778 | ||
779 | $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS | 779 | $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS |
780 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | 780 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -w $< |
781 | 781 | ||
782 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS | 782 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS |
783 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< | 783 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index c941bb640f49..1e5e9b270f5e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -283,6 +283,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel, | |||
283 | { | 283 | { |
284 | struct perf_event_attr *attr = &evsel->attr; | 284 | struct perf_event_attr *attr = &evsel->attr; |
285 | struct xyarray *group_fd = NULL; | 285 | struct xyarray *group_fd = NULL; |
286 | bool exclude_guest_missing = false; | ||
287 | int ret; | ||
286 | 288 | ||
287 | if (group && evsel != first) | 289 | if (group && evsel != first) |
288 | group_fd = first->fd; | 290 | group_fd = first->fd; |
@@ -293,16 +295,39 @@ static int create_perf_stat_counter(struct perf_evsel *evsel, | |||
293 | 295 | ||
294 | attr->inherit = !no_inherit; | 296 | attr->inherit = !no_inherit; |
295 | 297 | ||
296 | if (system_wide) | 298 | retry: |
297 | return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, | 299 | if (exclude_guest_missing) |
300 | evsel->attr.exclude_guest = evsel->attr.exclude_host = 0; | ||
301 | |||
302 | if (system_wide) { | ||
303 | ret = perf_evsel__open_per_cpu(evsel, evsel_list->cpus, | ||
298 | group, group_fd); | 304 | group, group_fd); |
305 | if (ret) | ||
306 | goto check_ret; | ||
307 | return 0; | ||
308 | } | ||
309 | |||
299 | if (!target_pid && !target_tid && (!group || evsel == first)) { | 310 | if (!target_pid && !target_tid && (!group || evsel == first)) { |
300 | attr->disabled = 1; | 311 | attr->disabled = 1; |
301 | attr->enable_on_exec = 1; | 312 | attr->enable_on_exec = 1; |
302 | } | 313 | } |
303 | 314 | ||
304 | return perf_evsel__open_per_thread(evsel, evsel_list->threads, | 315 | ret = perf_evsel__open_per_thread(evsel, evsel_list->threads, |
305 | group, group_fd); | 316 | group, group_fd); |
317 | if (!ret) | ||
318 | return 0; | ||
319 | /* fall through */ | ||
320 | check_ret: | ||
321 | if (ret && errno == EINVAL) { | ||
322 | if (!exclude_guest_missing && | ||
323 | (evsel->attr.exclude_guest || evsel->attr.exclude_host)) { | ||
324 | pr_debug("Old kernel, cannot exclude " | ||
325 | "guest or host samples.\n"); | ||
326 | exclude_guest_missing = true; | ||
327 | goto retry; | ||
328 | } | ||
329 | } | ||
330 | return ret; | ||
306 | } | 331 | } |
307 | 332 | ||
308 | /* | 333 | /* |
@@ -463,8 +488,13 @@ static int run_perf_stat(int argc __used, const char **argv) | |||
463 | 488 | ||
464 | list_for_each_entry(counter, &evsel_list->entries, node) { | 489 | list_for_each_entry(counter, &evsel_list->entries, node) { |
465 | if (create_perf_stat_counter(counter, first) < 0) { | 490 | if (create_perf_stat_counter(counter, first) < 0) { |
491 | /* | ||
492 | * PPC returns ENXIO for HW counters until 2.6.37 | ||
493 | * (behavior changed with commit b0a873e). | ||
494 | */ | ||
466 | if (errno == EINVAL || errno == ENOSYS || | 495 | if (errno == EINVAL || errno == ENOSYS || |
467 | errno == ENOENT || errno == EOPNOTSUPP) { | 496 | errno == ENOENT || errno == EOPNOTSUPP || |
497 | errno == ENXIO) { | ||
468 | if (verbose) | 498 | if (verbose) |
469 | ui__warning("%s event is not supported by the kernel.\n", | 499 | ui__warning("%s event is not supported by the kernel.\n", |
470 | event_name(counter)); | 500 | event_name(counter)); |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 4c7c2d73251f..c0b70c697a36 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -296,7 +296,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
296 | if (mkdir_p(filename, 0755)) | 296 | if (mkdir_p(filename, 0755)) |
297 | goto out_free; | 297 | goto out_free; |
298 | 298 | ||
299 | snprintf(filename + len, sizeof(filename) - len, "/%s", sbuild_id); | 299 | snprintf(filename + len, size - len, "/%s", sbuild_id); |
300 | 300 | ||
301 | if (access(filename, F_OK)) { | 301 | if (access(filename, F_OK)) { |
302 | if (is_kallsyms) { | 302 | if (is_kallsyms) { |