diff options
51 files changed, 356 insertions, 172 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 7945b0bd35e2..e2a4b5287361 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
@@ -1100,6 +1100,15 @@ emulate them efficiently. The fields in each entry are defined as follows: | |||
1100 | eax, ebx, ecx, edx: the values returned by the cpuid instruction for | 1100 | eax, ebx, ecx, edx: the values returned by the cpuid instruction for |
1101 | this function/index combination | 1101 | this function/index combination |
1102 | 1102 | ||
1103 | The TSC deadline timer feature (CPUID leaf 1, ecx[24]) is always returned | ||
1104 | as false, since the feature depends on KVM_CREATE_IRQCHIP for local APIC | ||
1105 | support. Instead it is reported via | ||
1106 | |||
1107 | ioctl(KVM_CHECK_EXTENSION, KVM_CAP_TSC_DEADLINE_TIMER) | ||
1108 | |||
1109 | if that returns true and you use KVM_CREATE_IRQCHIP, or if you emulate the | ||
1110 | feature in userspace, then you can enable the feature for KVM_SET_CPUID2. | ||
1111 | |||
1103 | 4.47 KVM_PPC_GET_PVINFO | 1112 | 4.47 KVM_PPC_GET_PVINFO |
1104 | 1113 | ||
1105 | Capability: KVM_CAP_PPC_GET_PVINFO | 1114 | Capability: KVM_CAP_PPC_GET_PVINFO |
@@ -1151,6 +1160,13 @@ following flags are specified: | |||
1151 | /* Depends on KVM_CAP_IOMMU */ | 1160 | /* Depends on KVM_CAP_IOMMU */ |
1152 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) | 1161 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) |
1153 | 1162 | ||
1163 | The KVM_DEV_ASSIGN_ENABLE_IOMMU flag is a mandatory option to ensure | ||
1164 | isolation of the device. Usages not specifying this flag are deprecated. | ||
1165 | |||
1166 | Only PCI header type 0 devices with PCI BAR resources are supported by | ||
1167 | device assignment. The user requesting this ioctl must have read/write | ||
1168 | access to the PCI sysfs resource files associated with the device. | ||
1169 | |||
1154 | 4.49 KVM_DEASSIGN_PCI_DEVICE | 1170 | 4.49 KVM_DEASSIGN_PCI_DEVICE |
1155 | 1171 | ||
1156 | Capability: KVM_CAP_DEVICE_DEASSIGNMENT | 1172 | Capability: KVM_CAP_DEVICE_DEASSIGNMENT |
diff --git a/MAINTAINERS b/MAINTAINERS index aace41763860..dbf3d94b1ded 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2700,7 +2700,7 @@ FIREWIRE SUBSYSTEM | |||
2700 | M: Stefan Richter <stefanr@s5r6.in-berlin.de> | 2700 | M: Stefan Richter <stefanr@s5r6.in-berlin.de> |
2701 | L: linux1394-devel@lists.sourceforge.net | 2701 | L: linux1394-devel@lists.sourceforge.net |
2702 | W: http://ieee1394.wiki.kernel.org/ | 2702 | W: http://ieee1394.wiki.kernel.org/ |
2703 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git | 2703 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394.git |
2704 | S: Maintained | 2704 | S: Maintained |
2705 | F: drivers/firewire/ | 2705 | F: drivers/firewire/ |
2706 | F: include/linux/firewire*.h | 2706 | F: include/linux/firewire*.h |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 2 | 2 | PATCHLEVEL = 2 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc6 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c index c074e66ad224..4e0a371630b3 100644 --- a/arch/arm/oprofile/common.c +++ b/arch/arm/oprofile/common.c | |||
@@ -116,7 +116,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
116 | return oprofile_perf_init(ops); | 116 | return oprofile_perf_init(ops); |
117 | } | 117 | } |
118 | 118 | ||
119 | void __exit oprofile_arch_exit(void) | 119 | void oprofile_arch_exit(void) |
120 | { | 120 | { |
121 | oprofile_perf_exit(); | 121 | oprofile_perf_exit(); |
122 | } | 122 | } |
diff --git a/arch/ia64/include/asm/cputime.h b/arch/ia64/include/asm/cputime.h index 6073b187528a..5a274af31b2b 100644 --- a/arch/ia64/include/asm/cputime.h +++ b/arch/ia64/include/asm/cputime.h | |||
@@ -60,6 +60,7 @@ typedef u64 cputime64_t; | |||
60 | */ | 60 | */ |
61 | #define cputime_to_usecs(__ct) ((__ct) / NSEC_PER_USEC) | 61 | #define cputime_to_usecs(__ct) ((__ct) / NSEC_PER_USEC) |
62 | #define usecs_to_cputime(__usecs) ((__usecs) * NSEC_PER_USEC) | 62 | #define usecs_to_cputime(__usecs) ((__usecs) * NSEC_PER_USEC) |
63 | #define usecs_to_cputime64(__usecs) usecs_to_cputime(__usecs) | ||
63 | 64 | ||
64 | /* | 65 | /* |
65 | * Convert cputime <-> seconds | 66 | * Convert cputime <-> seconds |
diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h index 1cf20bdfbeca..98b7c4b49c9d 100644 --- a/arch/powerpc/include/asm/cputime.h +++ b/arch/powerpc/include/asm/cputime.h | |||
@@ -150,6 +150,8 @@ static inline cputime_t usecs_to_cputime(const unsigned long us) | |||
150 | return ct; | 150 | return ct; |
151 | } | 151 | } |
152 | 152 | ||
153 | #define usecs_to_cputime64(us) usecs_to_cputime(us) | ||
154 | |||
153 | /* | 155 | /* |
154 | * Convert cputime <-> seconds | 156 | * Convert cputime <-> seconds |
155 | */ | 157 | */ |
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index d4df013ad779..69c7377d2071 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
@@ -381,39 +381,6 @@ static inline bool kvmppc_critical_section(struct kvm_vcpu *vcpu) | |||
381 | } | 381 | } |
382 | #endif | 382 | #endif |
383 | 383 | ||
384 | static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r, | ||
385 | unsigned long pte_index) | ||
386 | { | ||
387 | unsigned long rb, va_low; | ||
388 | |||
389 | rb = (v & ~0x7fUL) << 16; /* AVA field */ | ||
390 | va_low = pte_index >> 3; | ||
391 | if (v & HPTE_V_SECONDARY) | ||
392 | va_low = ~va_low; | ||
393 | /* xor vsid from AVA */ | ||
394 | if (!(v & HPTE_V_1TB_SEG)) | ||
395 | va_low ^= v >> 12; | ||
396 | else | ||
397 | va_low ^= v >> 24; | ||
398 | va_low &= 0x7ff; | ||
399 | if (v & HPTE_V_LARGE) { | ||
400 | rb |= 1; /* L field */ | ||
401 | if (cpu_has_feature(CPU_FTR_ARCH_206) && | ||
402 | (r & 0xff000)) { | ||
403 | /* non-16MB large page, must be 64k */ | ||
404 | /* (masks depend on page size) */ | ||
405 | rb |= 0x1000; /* page encoding in LP field */ | ||
406 | rb |= (va_low & 0x7f) << 16; /* 7b of VA in AVA/LP field */ | ||
407 | rb |= (va_low & 0xfe); /* AVAL field (P7 doesn't seem to care) */ | ||
408 | } | ||
409 | } else { | ||
410 | /* 4kB page */ | ||
411 | rb |= (va_low & 0x7ff) << 12; /* remaining 11b of VA */ | ||
412 | } | ||
413 | rb |= (v >> 54) & 0x300; /* B field */ | ||
414 | return rb; | ||
415 | } | ||
416 | |||
417 | /* Magic register values loaded into r3 and r4 before the 'sc' assembly | 384 | /* Magic register values loaded into r3 and r4 before the 'sc' assembly |
418 | * instruction for the OSI hypercalls */ | 385 | * instruction for the OSI hypercalls */ |
419 | #define OSI_SC_MAGIC_R3 0x113724FA | 386 | #define OSI_SC_MAGIC_R3 0x113724FA |
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index e43fe42b9875..d0ac94f98f9e 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h | |||
@@ -29,4 +29,37 @@ static inline struct kvmppc_book3s_shadow_vcpu *to_svcpu(struct kvm_vcpu *vcpu) | |||
29 | 29 | ||
30 | #define SPAPR_TCE_SHIFT 12 | 30 | #define SPAPR_TCE_SHIFT 12 |
31 | 31 | ||
32 | static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r, | ||
33 | unsigned long pte_index) | ||
34 | { | ||
35 | unsigned long rb, va_low; | ||
36 | |||
37 | rb = (v & ~0x7fUL) << 16; /* AVA field */ | ||
38 | va_low = pte_index >> 3; | ||
39 | if (v & HPTE_V_SECONDARY) | ||
40 | va_low = ~va_low; | ||
41 | /* xor vsid from AVA */ | ||
42 | if (!(v & HPTE_V_1TB_SEG)) | ||
43 | va_low ^= v >> 12; | ||
44 | else | ||
45 | va_low ^= v >> 24; | ||
46 | va_low &= 0x7ff; | ||
47 | if (v & HPTE_V_LARGE) { | ||
48 | rb |= 1; /* L field */ | ||
49 | if (cpu_has_feature(CPU_FTR_ARCH_206) && | ||
50 | (r & 0xff000)) { | ||
51 | /* non-16MB large page, must be 64k */ | ||
52 | /* (masks depend on page size) */ | ||
53 | rb |= 0x1000; /* page encoding in LP field */ | ||
54 | rb |= (va_low & 0x7f) << 16; /* 7b of VA in AVA/LP field */ | ||
55 | rb |= (va_low & 0xfe); /* AVAL field (P7 doesn't seem to care) */ | ||
56 | } | ||
57 | } else { | ||
58 | /* 4kB page */ | ||
59 | rb |= (va_low & 0x7ff) << 12; /* remaining 11b of VA */ | ||
60 | } | ||
61 | rb |= (v >> 54) & 0x300; /* B field */ | ||
62 | return rb; | ||
63 | } | ||
64 | |||
32 | #endif /* __ASM_KVM_BOOK3S_64_H__ */ | 65 | #endif /* __ASM_KVM_BOOK3S_64_H__ */ |
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 0cb137a9b038..336983da9e72 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -538,7 +538,7 @@ static void kvmppc_start_thread(struct kvm_vcpu *vcpu) | |||
538 | tpaca->kvm_hstate.napping = 0; | 538 | tpaca->kvm_hstate.napping = 0; |
539 | vcpu->cpu = vc->pcpu; | 539 | vcpu->cpu = vc->pcpu; |
540 | smp_wmb(); | 540 | smp_wmb(); |
541 | #ifdef CONFIG_PPC_ICP_NATIVE | 541 | #if defined(CONFIG_PPC_ICP_NATIVE) && defined(CONFIG_SMP) |
542 | if (vcpu->arch.ptid) { | 542 | if (vcpu->arch.ptid) { |
543 | tpaca->cpu_start = 0x80; | 543 | tpaca->cpu_start = 0x80; |
544 | wmb(); | 544 | wmb(); |
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 3c791e1eb675..e2cfb9e1e20e 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c | |||
@@ -658,10 +658,12 @@ program_interrupt: | |||
658 | ulong cmd = kvmppc_get_gpr(vcpu, 3); | 658 | ulong cmd = kvmppc_get_gpr(vcpu, 3); |
659 | int i; | 659 | int i; |
660 | 660 | ||
661 | #ifdef CONFIG_KVM_BOOK3S_64_PR | ||
661 | if (kvmppc_h_pr(vcpu, cmd) == EMULATE_DONE) { | 662 | if (kvmppc_h_pr(vcpu, cmd) == EMULATE_DONE) { |
662 | r = RESUME_GUEST; | 663 | r = RESUME_GUEST; |
663 | break; | 664 | break; |
664 | } | 665 | } |
666 | #endif | ||
665 | 667 | ||
666 | run->papr_hcall.nr = cmd; | 668 | run->papr_hcall.nr = cmd; |
667 | for (i = 0; i < 9; ++i) { | 669 | for (i = 0; i < 9; ++i) { |
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c index 26d20903f2bc..8c0d45a6faf7 100644 --- a/arch/powerpc/kvm/e500.c +++ b/arch/powerpc/kvm/e500.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/kvm_host.h> | 15 | #include <linux/kvm_host.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/export.h> | ||
18 | 19 | ||
19 | #include <asm/reg.h> | 20 | #include <asm/reg.h> |
20 | #include <asm/cputable.h> | 21 | #include <asm/cputable.h> |
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h index 081434878296..b9acaaa175d8 100644 --- a/arch/s390/include/asm/cputime.h +++ b/arch/s390/include/asm/cputime.h | |||
@@ -87,6 +87,8 @@ usecs_to_cputime(const unsigned int m) | |||
87 | return (cputime_t) m * 4096; | 87 | return (cputime_t) m * 4096; |
88 | } | 88 | } |
89 | 89 | ||
90 | #define usecs_to_cputime64(m) usecs_to_cputime(m) | ||
91 | |||
90 | /* | 92 | /* |
91 | * Convert cputime to milliseconds and back. | 93 | * Convert cputime to milliseconds and back. |
92 | */ | 94 | */ |
diff --git a/arch/sh/oprofile/common.c b/arch/sh/oprofile/common.c index b4c2d2b946dd..e4dd5d5a1115 100644 --- a/arch/sh/oprofile/common.c +++ b/arch/sh/oprofile/common.c | |||
@@ -49,7 +49,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
49 | return oprofile_perf_init(ops); | 49 | return oprofile_perf_init(ops); |
50 | } | 50 | } |
51 | 51 | ||
52 | void __exit oprofile_arch_exit(void) | 52 | void oprofile_arch_exit(void) |
53 | { | 53 | { |
54 | oprofile_perf_exit(); | 54 | oprofile_perf_exit(); |
55 | kfree(sh_pmu_op_name); | 55 | kfree(sh_pmu_op_name); |
@@ -60,5 +60,5 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
60 | ops->backtrace = sh_backtrace; | 60 | ops->backtrace = sh_backtrace; |
61 | return -ENODEV; | 61 | return -ENODEV; |
62 | } | 62 | } |
63 | void __exit oprofile_arch_exit(void) {} | 63 | void oprofile_arch_exit(void) {} |
64 | #endif /* CONFIG_HW_PERF_EVENTS */ | 64 | #endif /* CONFIG_HW_PERF_EVENTS */ |
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c index b272cda35a01..af5755d20fbe 100644 --- a/arch/sparc/kernel/pci_sun4v.c +++ b/arch/sparc/kernel/pci_sun4v.c | |||
@@ -849,10 +849,10 @@ static int pci_sun4v_msiq_build_irq(struct pci_pbm_info *pbm, | |||
849 | if (!irq) | 849 | if (!irq) |
850 | return -ENOMEM; | 850 | return -ENOMEM; |
851 | 851 | ||
852 | if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE)) | ||
853 | return -EINVAL; | ||
854 | if (pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_VALID)) | 852 | if (pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_VALID)) |
855 | return -EINVAL; | 853 | return -EINVAL; |
854 | if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE)) | ||
855 | return -EINVAL; | ||
856 | 856 | ||
857 | return irq; | 857 | return irq; |
858 | } | 858 | } |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 8d601b18bf9f..121f1be4da19 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -1169,7 +1169,7 @@ again: | |||
1169 | */ | 1169 | */ |
1170 | c = &unconstrained; | 1170 | c = &unconstrained; |
1171 | } else if (intel_try_alt_er(event, orig_idx)) { | 1171 | } else if (intel_try_alt_er(event, orig_idx)) { |
1172 | raw_spin_unlock(&era->lock); | 1172 | raw_spin_unlock_irqrestore(&era->lock, flags); |
1173 | goto again; | 1173 | goto again; |
1174 | } | 1174 | } |
1175 | raw_spin_unlock_irqrestore(&era->lock, flags); | 1175 | raw_spin_unlock_irqrestore(&era->lock, flags); |
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 76e3f1cd0369..405f2620392f 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -338,11 +338,15 @@ static enum hrtimer_restart pit_timer_fn(struct hrtimer *data) | |||
338 | return HRTIMER_NORESTART; | 338 | return HRTIMER_NORESTART; |
339 | } | 339 | } |
340 | 340 | ||
341 | static void create_pit_timer(struct kvm_kpit_state *ps, u32 val, int is_period) | 341 | static void create_pit_timer(struct kvm *kvm, u32 val, int is_period) |
342 | { | 342 | { |
343 | struct kvm_kpit_state *ps = &kvm->arch.vpit->pit_state; | ||
343 | struct kvm_timer *pt = &ps->pit_timer; | 344 | struct kvm_timer *pt = &ps->pit_timer; |
344 | s64 interval; | 345 | s64 interval; |
345 | 346 | ||
347 | if (!irqchip_in_kernel(kvm)) | ||
348 | return; | ||
349 | |||
346 | interval = muldiv64(val, NSEC_PER_SEC, KVM_PIT_FREQ); | 350 | interval = muldiv64(val, NSEC_PER_SEC, KVM_PIT_FREQ); |
347 | 351 | ||
348 | pr_debug("create pit timer, interval is %llu nsec\n", interval); | 352 | pr_debug("create pit timer, interval is %llu nsec\n", interval); |
@@ -394,13 +398,13 @@ static void pit_load_count(struct kvm *kvm, int channel, u32 val) | |||
394 | /* FIXME: enhance mode 4 precision */ | 398 | /* FIXME: enhance mode 4 precision */ |
395 | case 4: | 399 | case 4: |
396 | if (!(ps->flags & KVM_PIT_FLAGS_HPET_LEGACY)) { | 400 | if (!(ps->flags & KVM_PIT_FLAGS_HPET_LEGACY)) { |
397 | create_pit_timer(ps, val, 0); | 401 | create_pit_timer(kvm, val, 0); |
398 | } | 402 | } |
399 | break; | 403 | break; |
400 | case 2: | 404 | case 2: |
401 | case 3: | 405 | case 3: |
402 | if (!(ps->flags & KVM_PIT_FLAGS_HPET_LEGACY)){ | 406 | if (!(ps->flags & KVM_PIT_FLAGS_HPET_LEGACY)){ |
403 | create_pit_timer(ps, val, 1); | 407 | create_pit_timer(kvm, val, 1); |
404 | } | 408 | } |
405 | break; | 409 | break; |
406 | default: | 410 | default: |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c38efd7b792e..4c938da2ba00 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -602,7 +602,6 @@ static void update_cpuid(struct kvm_vcpu *vcpu) | |||
602 | { | 602 | { |
603 | struct kvm_cpuid_entry2 *best; | 603 | struct kvm_cpuid_entry2 *best; |
604 | struct kvm_lapic *apic = vcpu->arch.apic; | 604 | struct kvm_lapic *apic = vcpu->arch.apic; |
605 | u32 timer_mode_mask; | ||
606 | 605 | ||
607 | best = kvm_find_cpuid_entry(vcpu, 1, 0); | 606 | best = kvm_find_cpuid_entry(vcpu, 1, 0); |
608 | if (!best) | 607 | if (!best) |
@@ -615,15 +614,12 @@ static void update_cpuid(struct kvm_vcpu *vcpu) | |||
615 | best->ecx |= bit(X86_FEATURE_OSXSAVE); | 614 | best->ecx |= bit(X86_FEATURE_OSXSAVE); |
616 | } | 615 | } |
617 | 616 | ||
618 | if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && | 617 | if (apic) { |
619 | best->function == 0x1) { | 618 | if (best->ecx & bit(X86_FEATURE_TSC_DEADLINE_TIMER)) |
620 | best->ecx |= bit(X86_FEATURE_TSC_DEADLINE_TIMER); | 619 | apic->lapic_timer.timer_mode_mask = 3 << 17; |
621 | timer_mode_mask = 3 << 17; | 620 | else |
622 | } else | 621 | apic->lapic_timer.timer_mode_mask = 1 << 17; |
623 | timer_mode_mask = 1 << 17; | 622 | } |
624 | |||
625 | if (apic) | ||
626 | apic->lapic_timer.timer_mode_mask = timer_mode_mask; | ||
627 | } | 623 | } |
628 | 624 | ||
629 | int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | 625 | int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |
@@ -2135,6 +2131,9 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
2135 | case KVM_CAP_TSC_CONTROL: | 2131 | case KVM_CAP_TSC_CONTROL: |
2136 | r = kvm_has_tsc_control; | 2132 | r = kvm_has_tsc_control; |
2137 | break; | 2133 | break; |
2134 | case KVM_CAP_TSC_DEADLINE_TIMER: | ||
2135 | r = boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER); | ||
2136 | break; | ||
2138 | default: | 2137 | default: |
2139 | r = 0; | 2138 | r = 0; |
2140 | break; | 2139 | break; |
diff --git a/block/blk-map.c b/block/blk-map.c index 164cd0059706..623e1cd4cffe 100644 --- a/block/blk-map.c +++ b/block/blk-map.c | |||
@@ -311,7 +311,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf, | |||
311 | if (IS_ERR(bio)) | 311 | if (IS_ERR(bio)) |
312 | return PTR_ERR(bio); | 312 | return PTR_ERR(bio); |
313 | 313 | ||
314 | if (rq_data_dir(rq) == WRITE) | 314 | if (!reading) |
315 | bio->bi_rw |= REQ_WRITE; | 315 | bio->bi_rw |= REQ_WRITE; |
316 | 316 | ||
317 | if (do_copy) | 317 | if (do_copy) |
diff --git a/block/blk-tag.c b/block/blk-tag.c index e74d6d13838f..4af6f5cc1167 100644 --- a/block/blk-tag.c +++ b/block/blk-tag.c | |||
@@ -282,18 +282,9 @@ EXPORT_SYMBOL(blk_queue_resize_tags); | |||
282 | void blk_queue_end_tag(struct request_queue *q, struct request *rq) | 282 | void blk_queue_end_tag(struct request_queue *q, struct request *rq) |
283 | { | 283 | { |
284 | struct blk_queue_tag *bqt = q->queue_tags; | 284 | struct blk_queue_tag *bqt = q->queue_tags; |
285 | int tag = rq->tag; | 285 | unsigned tag = rq->tag; /* negative tags invalid */ |
286 | 286 | ||
287 | BUG_ON(tag == -1); | 287 | BUG_ON(tag >= bqt->real_max_depth); |
288 | |||
289 | if (unlikely(tag >= bqt->max_depth)) { | ||
290 | /* | ||
291 | * This can happen after tag depth has been reduced. | ||
292 | * But tag shouldn't be larger than real_max_depth. | ||
293 | */ | ||
294 | WARN_ON(tag >= bqt->real_max_depth); | ||
295 | return; | ||
296 | } | ||
297 | 288 | ||
298 | list_del_init(&rq->queuelist); | 289 | list_del_init(&rq->queuelist); |
299 | rq->cmd_flags &= ~REQ_QUEUED; | 290 | rq->cmd_flags &= ~REQ_QUEUED; |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 4c12869fcf77..3548705b04e4 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1655,6 +1655,8 @@ cfq_merged_requests(struct request_queue *q, struct request *rq, | |||
1655 | struct request *next) | 1655 | struct request *next) |
1656 | { | 1656 | { |
1657 | struct cfq_queue *cfqq = RQ_CFQQ(rq); | 1657 | struct cfq_queue *cfqq = RQ_CFQQ(rq); |
1658 | struct cfq_data *cfqd = q->elevator->elevator_data; | ||
1659 | |||
1658 | /* | 1660 | /* |
1659 | * reposition in fifo if next is older than rq | 1661 | * reposition in fifo if next is older than rq |
1660 | */ | 1662 | */ |
@@ -1669,6 +1671,16 @@ cfq_merged_requests(struct request_queue *q, struct request *rq, | |||
1669 | cfq_remove_request(next); | 1671 | cfq_remove_request(next); |
1670 | cfq_blkiocg_update_io_merged_stats(&(RQ_CFQG(rq))->blkg, | 1672 | cfq_blkiocg_update_io_merged_stats(&(RQ_CFQG(rq))->blkg, |
1671 | rq_data_dir(next), rq_is_sync(next)); | 1673 | rq_data_dir(next), rq_is_sync(next)); |
1674 | |||
1675 | cfqq = RQ_CFQQ(next); | ||
1676 | /* | ||
1677 | * all requests of this queue are merged to other queues, delete it | ||
1678 | * from the service tree. If it's the active_queue, | ||
1679 | * cfq_dispatch_requests() will choose to expire it or do idle | ||
1680 | */ | ||
1681 | if (cfq_cfqq_on_rr(cfqq) && RB_EMPTY_ROOT(&cfqq->sort_list) && | ||
1682 | cfqq != cfqd->active_queue) | ||
1683 | cfq_del_cfqq_rr(cfqd, cfqq); | ||
1672 | } | 1684 | } |
1673 | 1685 | ||
1674 | static int cfq_allow_merge(struct request_queue *q, struct request *rq, | 1686 | static int cfq_allow_merge(struct request_queue *q, struct request *rq, |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index c681dc149d2a..b9da8900ae4e 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -756,9 +756,9 @@ intel_enable_semaphores(struct drm_device *dev) | |||
756 | if (i915_semaphores >= 0) | 756 | if (i915_semaphores >= 0) |
757 | return i915_semaphores; | 757 | return i915_semaphores; |
758 | 758 | ||
759 | /* Enable semaphores on SNB when IO remapping is off */ | 759 | /* Disable semaphores on SNB */ |
760 | if (INTEL_INFO(dev)->gen == 6) | 760 | if (INTEL_INFO(dev)->gen == 6) |
761 | return !intel_iommu_enabled; | 761 | return 0; |
762 | 762 | ||
763 | return 1; | 763 | return 1; |
764 | } | 764 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d809b038ca88..daa5743ccbd6 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -7922,13 +7922,11 @@ static bool intel_enable_rc6(struct drm_device *dev) | |||
7922 | return 0; | 7922 | return 0; |
7923 | 7923 | ||
7924 | /* | 7924 | /* |
7925 | * Enable rc6 on Sandybridge if DMA remapping is disabled | 7925 | * Disable rc6 on Sandybridge |
7926 | */ | 7926 | */ |
7927 | if (INTEL_INFO(dev)->gen == 6) { | 7927 | if (INTEL_INFO(dev)->gen == 6) { |
7928 | DRM_DEBUG_DRIVER("Sandybridge: intel_iommu_enabled %s -- RC6 %sabled\n", | 7928 | DRM_DEBUG_DRIVER("Sandybridge: RC6 disabled\n"); |
7929 | intel_iommu_enabled ? "true" : "false", | 7929 | return 0; |
7930 | !intel_iommu_enabled ? "en" : "dis"); | ||
7931 | return !intel_iommu_enabled; | ||
7932 | } | 7930 | } |
7933 | DRM_DEBUG_DRIVER("RC6 enabled\n"); | 7931 | DRM_DEBUG_DRIVER("RC6 enabled\n"); |
7934 | return 1; | 7932 | return 1; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 5e00d1670aa9..92c9628c572d 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -3276,6 +3276,18 @@ int evergreen_init(struct radeon_device *rdev) | |||
3276 | rdev->accel_working = false; | 3276 | rdev->accel_working = false; |
3277 | } | 3277 | } |
3278 | } | 3278 | } |
3279 | |||
3280 | /* Don't start up if the MC ucode is missing on BTC parts. | ||
3281 | * The default clocks and voltages before the MC ucode | ||
3282 | * is loaded are not suffient for advanced operations. | ||
3283 | */ | ||
3284 | if (ASIC_IS_DCE5(rdev)) { | ||
3285 | if (!rdev->mc_fw && !(rdev->flags & RADEON_IS_IGP)) { | ||
3286 | DRM_ERROR("radeon: MC ucode required for NI+.\n"); | ||
3287 | return -EINVAL; | ||
3288 | } | ||
3289 | } | ||
3290 | |||
3279 | return 0; | 3291 | return 0; |
3280 | } | 3292 | } |
3281 | 3293 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 8aa1dbb45c67..f94b33ae2215 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -1093,7 +1093,6 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, | |||
1093 | struct vmw_surface *surface = NULL; | 1093 | struct vmw_surface *surface = NULL; |
1094 | struct vmw_dma_buffer *bo = NULL; | 1094 | struct vmw_dma_buffer *bo = NULL; |
1095 | struct ttm_base_object *user_obj; | 1095 | struct ttm_base_object *user_obj; |
1096 | u64 required_size; | ||
1097 | int ret; | 1096 | int ret; |
1098 | 1097 | ||
1099 | /** | 1098 | /** |
@@ -1102,8 +1101,9 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, | |||
1102 | * requested framebuffer. | 1101 | * requested framebuffer. |
1103 | */ | 1102 | */ |
1104 | 1103 | ||
1105 | required_size = mode_cmd->pitch * mode_cmd->height; | 1104 | if (!vmw_kms_validate_mode_vram(dev_priv, |
1106 | if (unlikely(required_size > (u64) dev_priv->vram_size)) { | 1105 | mode_cmd->pitch, |
1106 | mode_cmd->height)) { | ||
1107 | DRM_ERROR("VRAM size is too small for requested mode.\n"); | 1107 | DRM_ERROR("VRAM size is too small for requested mode.\n"); |
1108 | return ERR_PTR(-ENOMEM); | 1108 | return ERR_PTR(-ENOMEM); |
1109 | } | 1109 | } |
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 2fb2963df553..5b5fa5cdaa31 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -90,7 +90,7 @@ struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) | |||
90 | if (bus == NULL || bus->iommu_ops == NULL) | 90 | if (bus == NULL || bus->iommu_ops == NULL) |
91 | return NULL; | 91 | return NULL; |
92 | 92 | ||
93 | domain = kmalloc(sizeof(*domain), GFP_KERNEL); | 93 | domain = kzalloc(sizeof(*domain), GFP_KERNEL); |
94 | if (!domain) | 94 | if (!domain) |
95 | return NULL; | 95 | return NULL; |
96 | 96 | ||
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index b6907118283a..6d03774b176e 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1393,9 +1393,6 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto | |||
1393 | atomic_read(&bitmap->behind_writes), | 1393 | atomic_read(&bitmap->behind_writes), |
1394 | bitmap->mddev->bitmap_info.max_write_behind); | 1394 | bitmap->mddev->bitmap_info.max_write_behind); |
1395 | } | 1395 | } |
1396 | if (bitmap->mddev->degraded) | ||
1397 | /* Never clear bits or update events_cleared when degraded */ | ||
1398 | success = 0; | ||
1399 | 1396 | ||
1400 | while (sectors) { | 1397 | while (sectors) { |
1401 | sector_t blocks; | 1398 | sector_t blocks; |
@@ -1409,7 +1406,7 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto | |||
1409 | return; | 1406 | return; |
1410 | } | 1407 | } |
1411 | 1408 | ||
1412 | if (success && | 1409 | if (success && !bitmap->mddev->degraded && |
1413 | bitmap->events_cleared < bitmap->mddev->events) { | 1410 | bitmap->events_cleared < bitmap->mddev->events) { |
1414 | bitmap->events_cleared = bitmap->mddev->events; | 1411 | bitmap->events_cleared = bitmap->mddev->events; |
1415 | bitmap->need_sync = 1; | 1412 | bitmap->need_sync = 1; |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index c3273efd08cb..627456542fb3 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -230,6 +230,7 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev) | |||
230 | return -EINVAL; | 230 | return -EINVAL; |
231 | 231 | ||
232 | rdev->raid_disk = rdev->saved_raid_disk; | 232 | rdev->raid_disk = rdev->saved_raid_disk; |
233 | rdev->saved_raid_disk = -1; | ||
233 | 234 | ||
234 | newconf = linear_conf(mddev,mddev->raid_disks+1); | 235 | newconf = linear_conf(mddev,mddev->raid_disks+1); |
235 | 236 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index ee981737edfc..f47f1f8ac44b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7360,8 +7360,7 @@ static int remove_and_add_spares(struct mddev *mddev) | |||
7360 | spares++; | 7360 | spares++; |
7361 | md_new_event(mddev); | 7361 | md_new_event(mddev); |
7362 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 7362 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
7363 | } else | 7363 | } |
7364 | break; | ||
7365 | } | 7364 | } |
7366 | } | 7365 | } |
7367 | } | 7366 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 31670f8d6b65..858fdbb7eb07 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3065,11 +3065,17 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
3065 | } | 3065 | } |
3066 | } else if (test_bit(In_sync, &rdev->flags)) | 3066 | } else if (test_bit(In_sync, &rdev->flags)) |
3067 | set_bit(R5_Insync, &dev->flags); | 3067 | set_bit(R5_Insync, &dev->flags); |
3068 | else { | 3068 | else if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) |
3069 | /* in sync if before recovery_offset */ | 3069 | /* in sync if before recovery_offset */ |
3070 | if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) | 3070 | set_bit(R5_Insync, &dev->flags); |
3071 | set_bit(R5_Insync, &dev->flags); | 3071 | else if (test_bit(R5_UPTODATE, &dev->flags) && |
3072 | } | 3072 | test_bit(R5_Expanded, &dev->flags)) |
3073 | /* If we've reshaped into here, we assume it is Insync. | ||
3074 | * We will shortly update recovery_offset to make | ||
3075 | * it official. | ||
3076 | */ | ||
3077 | set_bit(R5_Insync, &dev->flags); | ||
3078 | |||
3073 | if (rdev && test_bit(R5_WriteError, &dev->flags)) { | 3079 | if (rdev && test_bit(R5_WriteError, &dev->flags)) { |
3074 | clear_bit(R5_Insync, &dev->flags); | 3080 | clear_bit(R5_Insync, &dev->flags); |
3075 | if (!test_bit(Faulty, &rdev->flags)) { | 3081 | if (!test_bit(Faulty, &rdev->flags)) { |
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 881e04c7ffe6..512f32ff446a 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -838,13 +838,13 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev) | |||
838 | gspca_dev->usb_err = 0; | 838 | gspca_dev->usb_err = 0; |
839 | 839 | ||
840 | /* do the specific subdriver stuff before endpoint selection */ | 840 | /* do the specific subdriver stuff before endpoint selection */ |
841 | gspca_dev->alt = 0; | 841 | intf = usb_ifnum_to_if(gspca_dev->dev, gspca_dev->iface); |
842 | gspca_dev->alt = gspca_dev->cam.bulk ? intf->num_altsetting : 0; | ||
842 | if (gspca_dev->sd_desc->isoc_init) { | 843 | if (gspca_dev->sd_desc->isoc_init) { |
843 | ret = gspca_dev->sd_desc->isoc_init(gspca_dev); | 844 | ret = gspca_dev->sd_desc->isoc_init(gspca_dev); |
844 | if (ret < 0) | 845 | if (ret < 0) |
845 | goto unlock; | 846 | goto unlock; |
846 | } | 847 | } |
847 | intf = usb_ifnum_to_if(gspca_dev->dev, gspca_dev->iface); | ||
848 | xfer = gspca_dev->cam.bulk ? USB_ENDPOINT_XFER_BULK | 848 | xfer = gspca_dev->cam.bulk ? USB_ENDPOINT_XFER_BULK |
849 | : USB_ENDPOINT_XFER_ISOC; | 849 | : USB_ENDPOINT_XFER_ISOC; |
850 | 850 | ||
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index b0b0fa5a3572..54a4a3f22e2e 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c | |||
@@ -1408,7 +1408,7 @@ static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc) | |||
1408 | { | 1408 | { |
1409 | struct isp_pipeline *pipe = | 1409 | struct isp_pipeline *pipe = |
1410 | to_isp_pipeline(&ccdc->video_out.video.entity); | 1410 | to_isp_pipeline(&ccdc->video_out.video.entity); |
1411 | struct video_device *vdev = &ccdc->subdev.devnode; | 1411 | struct video_device *vdev = ccdc->subdev.devnode; |
1412 | struct v4l2_event event; | 1412 | struct v4l2_event event; |
1413 | 1413 | ||
1414 | memset(&event, 0, sizeof(event)); | 1414 | memset(&event, 0, sizeof(event)); |
diff --git a/drivers/media/video/omap3isp/ispstat.c b/drivers/media/video/omap3isp/ispstat.c index 68d539456c55..bc0b2c7349b9 100644 --- a/drivers/media/video/omap3isp/ispstat.c +++ b/drivers/media/video/omap3isp/ispstat.c | |||
@@ -496,7 +496,7 @@ static int isp_stat_bufs_alloc(struct ispstat *stat, u32 size) | |||
496 | 496 | ||
497 | static void isp_stat_queue_event(struct ispstat *stat, int err) | 497 | static void isp_stat_queue_event(struct ispstat *stat, int err) |
498 | { | 498 | { |
499 | struct video_device *vdev = &stat->subdev.devnode; | 499 | struct video_device *vdev = stat->subdev.devnode; |
500 | struct v4l2_event event; | 500 | struct v4l2_event event; |
501 | struct omap3isp_stat_event_status *status = (void *)event.u.data; | 501 | struct omap3isp_stat_event_status *status = (void *)event.u.data; |
502 | 502 | ||
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index cb97174e2366..0b394580d860 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c | |||
@@ -563,8 +563,8 @@ static struct btrfs_worker_thread *find_worker(struct btrfs_workers *workers) | |||
563 | struct list_head *fallback; | 563 | struct list_head *fallback; |
564 | int ret; | 564 | int ret; |
565 | 565 | ||
566 | again: | ||
567 | spin_lock_irqsave(&workers->lock, flags); | 566 | spin_lock_irqsave(&workers->lock, flags); |
567 | again: | ||
568 | worker = next_worker(workers); | 568 | worker = next_worker(workers); |
569 | 569 | ||
570 | if (!worker) { | 570 | if (!worker) { |
@@ -579,6 +579,7 @@ again: | |||
579 | spin_unlock_irqrestore(&workers->lock, flags); | 579 | spin_unlock_irqrestore(&workers->lock, flags); |
580 | /* we're below the limit, start another worker */ | 580 | /* we're below the limit, start another worker */ |
581 | ret = __btrfs_start_workers(workers); | 581 | ret = __btrfs_start_workers(workers); |
582 | spin_lock_irqsave(&workers->lock, flags); | ||
582 | if (ret) | 583 | if (ret) |
583 | goto fallback; | 584 | goto fallback; |
584 | goto again; | 585 | goto again; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0a6b928813a4..fd1a06df5bc6 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4590,10 +4590,6 @@ static int btrfs_add_nondir(struct btrfs_trans_handle *trans, | |||
4590 | int err = btrfs_add_link(trans, dir, inode, | 4590 | int err = btrfs_add_link(trans, dir, inode, |
4591 | dentry->d_name.name, dentry->d_name.len, | 4591 | dentry->d_name.name, dentry->d_name.len, |
4592 | backref, index); | 4592 | backref, index); |
4593 | if (!err) { | ||
4594 | d_instantiate(dentry, inode); | ||
4595 | return 0; | ||
4596 | } | ||
4597 | if (err > 0) | 4593 | if (err > 0) |
4598 | err = -EEXIST; | 4594 | err = -EEXIST; |
4599 | return err; | 4595 | return err; |
@@ -4655,6 +4651,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
4655 | else { | 4651 | else { |
4656 | init_special_inode(inode, inode->i_mode, rdev); | 4652 | init_special_inode(inode, inode->i_mode, rdev); |
4657 | btrfs_update_inode(trans, root, inode); | 4653 | btrfs_update_inode(trans, root, inode); |
4654 | d_instantiate(dentry, inode); | ||
4658 | } | 4655 | } |
4659 | out_unlock: | 4656 | out_unlock: |
4660 | nr = trans->blocks_used; | 4657 | nr = trans->blocks_used; |
@@ -4722,6 +4719,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
4722 | inode->i_mapping->a_ops = &btrfs_aops; | 4719 | inode->i_mapping->a_ops = &btrfs_aops; |
4723 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | 4720 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; |
4724 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 4721 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
4722 | d_instantiate(dentry, inode); | ||
4725 | } | 4723 | } |
4726 | out_unlock: | 4724 | out_unlock: |
4727 | nr = trans->blocks_used; | 4725 | nr = trans->blocks_used; |
@@ -4779,6 +4777,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
4779 | struct dentry *parent = dentry->d_parent; | 4777 | struct dentry *parent = dentry->d_parent; |
4780 | err = btrfs_update_inode(trans, root, inode); | 4778 | err = btrfs_update_inode(trans, root, inode); |
4781 | BUG_ON(err); | 4779 | BUG_ON(err); |
4780 | d_instantiate(dentry, inode); | ||
4782 | btrfs_log_new_name(trans, inode, NULL, parent); | 4781 | btrfs_log_new_name(trans, inode, NULL, parent); |
4783 | } | 4782 | } |
4784 | 4783 | ||
@@ -7245,6 +7244,8 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
7245 | drop_inode = 1; | 7244 | drop_inode = 1; |
7246 | 7245 | ||
7247 | out_unlock: | 7246 | out_unlock: |
7247 | if (!err) | ||
7248 | d_instantiate(dentry, inode); | ||
7248 | nr = trans->blocks_used; | 7249 | nr = trans->blocks_used; |
7249 | btrfs_end_transaction_throttle(trans, root); | 7250 | btrfs_end_transaction_throttle(trans, root); |
7250 | if (drop_inode) { | 7251 | if (drop_inode) { |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index ac86f8b3e3cb..517f211a3bd4 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -47,17 +47,6 @@ struct wb_writeback_work { | |||
47 | struct completion *done; /* set if the caller waits */ | 47 | struct completion *done; /* set if the caller waits */ |
48 | }; | 48 | }; |
49 | 49 | ||
50 | const char *wb_reason_name[] = { | ||
51 | [WB_REASON_BACKGROUND] = "background", | ||
52 | [WB_REASON_TRY_TO_FREE_PAGES] = "try_to_free_pages", | ||
53 | [WB_REASON_SYNC] = "sync", | ||
54 | [WB_REASON_PERIODIC] = "periodic", | ||
55 | [WB_REASON_LAPTOP_TIMER] = "laptop_timer", | ||
56 | [WB_REASON_FREE_MORE_MEM] = "free_more_memory", | ||
57 | [WB_REASON_FS_FREE_SPACE] = "fs_free_space", | ||
58 | [WB_REASON_FORKER_THREAD] = "forker_thread" | ||
59 | }; | ||
60 | |||
61 | /* | 50 | /* |
62 | * Include the creation of the trace points after defining the | 51 | * Include the creation of the trace points after defining the |
63 | * wb_writeback_work structure so that the definition remains local to this | 52 | * wb_writeback_work structure so that the definition remains local to this |
diff --git a/fs/locks.c b/fs/locks.c index 3b0d05dcd7c1..637694bf3a03 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1205,6 +1205,8 @@ int __break_lease(struct inode *inode, unsigned int mode) | |||
1205 | int want_write = (mode & O_ACCMODE) != O_RDONLY; | 1205 | int want_write = (mode & O_ACCMODE) != O_RDONLY; |
1206 | 1206 | ||
1207 | new_fl = lease_alloc(NULL, want_write ? F_WRLCK : F_RDLCK); | 1207 | new_fl = lease_alloc(NULL, want_write ? F_WRLCK : F_RDLCK); |
1208 | if (IS_ERR(new_fl)) | ||
1209 | return PTR_ERR(new_fl); | ||
1208 | 1210 | ||
1209 | lock_flocks(); | 1211 | lock_flocks(); |
1210 | 1212 | ||
@@ -1221,12 +1223,6 @@ int __break_lease(struct inode *inode, unsigned int mode) | |||
1221 | if (fl->fl_owner == current->files) | 1223 | if (fl->fl_owner == current->files) |
1222 | i_have_this_lease = 1; | 1224 | i_have_this_lease = 1; |
1223 | 1225 | ||
1224 | if (IS_ERR(new_fl) && !i_have_this_lease | ||
1225 | && ((mode & O_NONBLOCK) == 0)) { | ||
1226 | error = PTR_ERR(new_fl); | ||
1227 | goto out; | ||
1228 | } | ||
1229 | |||
1230 | break_time = 0; | 1226 | break_time = 0; |
1231 | if (lease_break_time > 0) { | 1227 | if (lease_break_time > 0) { |
1232 | break_time = jiffies + lease_break_time * HZ; | 1228 | break_time = jiffies + lease_break_time * HZ; |
@@ -1284,8 +1280,7 @@ restart: | |||
1284 | 1280 | ||
1285 | out: | 1281 | out: |
1286 | unlock_flocks(); | 1282 | unlock_flocks(); |
1287 | if (!IS_ERR(new_fl)) | 1283 | locks_free_lock(new_fl); |
1288 | locks_free_lock(new_fl); | ||
1289 | return error; | 1284 | return error; |
1290 | } | 1285 | } |
1291 | 1286 | ||
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 2a30d67dd6b8..0855e6f20391 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -32,7 +32,7 @@ static cputime64_t get_idle_time(int cpu) | |||
32 | idle = kstat_cpu(cpu).cpustat.idle; | 32 | idle = kstat_cpu(cpu).cpustat.idle; |
33 | idle = cputime64_add(idle, arch_idle_time(cpu)); | 33 | idle = cputime64_add(idle, arch_idle_time(cpu)); |
34 | } else | 34 | } else |
35 | idle = nsecs_to_jiffies64(1000 * idle_time); | 35 | idle = usecs_to_cputime64(idle_time); |
36 | 36 | ||
37 | return idle; | 37 | return idle; |
38 | } | 38 | } |
@@ -46,7 +46,7 @@ static cputime64_t get_iowait_time(int cpu) | |||
46 | /* !NO_HZ so we can rely on cpustat.iowait */ | 46 | /* !NO_HZ so we can rely on cpustat.iowait */ |
47 | iowait = kstat_cpu(cpu).cpustat.iowait; | 47 | iowait = kstat_cpu(cpu).cpustat.iowait; |
48 | else | 48 | else |
49 | iowait = nsecs_to_jiffies64(1000 * iowait_time); | 49 | iowait = usecs_to_cputime64(iowait_time); |
50 | 50 | ||
51 | return iowait; | 51 | return iowait; |
52 | } | 52 | } |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 3eca58f51ae9..8a899496fd5f 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -869,27 +869,6 @@ xfs_fs_dirty_inode( | |||
869 | } | 869 | } |
870 | 870 | ||
871 | STATIC int | 871 | STATIC int |
872 | xfs_log_inode( | ||
873 | struct xfs_inode *ip) | ||
874 | { | ||
875 | struct xfs_mount *mp = ip->i_mount; | ||
876 | struct xfs_trans *tp; | ||
877 | int error; | ||
878 | |||
879 | tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS); | ||
880 | error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0); | ||
881 | if (error) { | ||
882 | xfs_trans_cancel(tp, 0); | ||
883 | return error; | ||
884 | } | ||
885 | |||
886 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
887 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | ||
888 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
889 | return xfs_trans_commit(tp, 0); | ||
890 | } | ||
891 | |||
892 | STATIC int | ||
893 | xfs_fs_write_inode( | 872 | xfs_fs_write_inode( |
894 | struct inode *inode, | 873 | struct inode *inode, |
895 | struct writeback_control *wbc) | 874 | struct writeback_control *wbc) |
@@ -902,10 +881,8 @@ xfs_fs_write_inode( | |||
902 | 881 | ||
903 | if (XFS_FORCED_SHUTDOWN(mp)) | 882 | if (XFS_FORCED_SHUTDOWN(mp)) |
904 | return -XFS_ERROR(EIO); | 883 | return -XFS_ERROR(EIO); |
905 | if (!ip->i_update_core) | ||
906 | return 0; | ||
907 | 884 | ||
908 | if (wbc->sync_mode == WB_SYNC_ALL) { | 885 | if (wbc->sync_mode == WB_SYNC_ALL || wbc->for_kupdate) { |
909 | /* | 886 | /* |
910 | * Make sure the inode has made it it into the log. Instead | 887 | * Make sure the inode has made it it into the log. Instead |
911 | * of forcing it all the way to stable storage using a | 888 | * of forcing it all the way to stable storage using a |
@@ -913,11 +890,14 @@ xfs_fs_write_inode( | |||
913 | * ->sync_fs call do that for thus, which reduces the number | 890 | * ->sync_fs call do that for thus, which reduces the number |
914 | * of synchronous log forces dramatically. | 891 | * of synchronous log forces dramatically. |
915 | */ | 892 | */ |
916 | error = xfs_log_inode(ip); | 893 | error = xfs_log_dirty_inode(ip, NULL, 0); |
917 | if (error) | 894 | if (error) |
918 | goto out; | 895 | goto out; |
919 | return 0; | 896 | return 0; |
920 | } else { | 897 | } else { |
898 | if (!ip->i_update_core) | ||
899 | return 0; | ||
900 | |||
921 | /* | 901 | /* |
922 | * We make this non-blocking if the inode is contended, return | 902 | * We make this non-blocking if the inode is contended, return |
923 | * EAGAIN to indicate to the caller that they did not succeed. | 903 | * EAGAIN to indicate to the caller that they did not succeed. |
diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c index be5c51d8f757..f0994aedcd15 100644 --- a/fs/xfs/xfs_sync.c +++ b/fs/xfs/xfs_sync.c | |||
@@ -336,6 +336,32 @@ xfs_sync_fsdata( | |||
336 | return error; | 336 | return error; |
337 | } | 337 | } |
338 | 338 | ||
339 | int | ||
340 | xfs_log_dirty_inode( | ||
341 | struct xfs_inode *ip, | ||
342 | struct xfs_perag *pag, | ||
343 | int flags) | ||
344 | { | ||
345 | struct xfs_mount *mp = ip->i_mount; | ||
346 | struct xfs_trans *tp; | ||
347 | int error; | ||
348 | |||
349 | if (!ip->i_update_core) | ||
350 | return 0; | ||
351 | |||
352 | tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS); | ||
353 | error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0); | ||
354 | if (error) { | ||
355 | xfs_trans_cancel(tp, 0); | ||
356 | return error; | ||
357 | } | ||
358 | |||
359 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
360 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | ||
361 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
362 | return xfs_trans_commit(tp, 0); | ||
363 | } | ||
364 | |||
339 | /* | 365 | /* |
340 | * When remounting a filesystem read-only or freezing the filesystem, we have | 366 | * When remounting a filesystem read-only or freezing the filesystem, we have |
341 | * two phases to execute. This first phase is syncing the data before we | 367 | * two phases to execute. This first phase is syncing the data before we |
@@ -359,6 +385,16 @@ xfs_quiesce_data( | |||
359 | { | 385 | { |
360 | int error, error2 = 0; | 386 | int error, error2 = 0; |
361 | 387 | ||
388 | /* | ||
389 | * Log all pending size and timestamp updates. The vfs writeback | ||
390 | * code is supposed to do this, but due to its overagressive | ||
391 | * livelock detection it will skip inodes where appending writes | ||
392 | * were written out in the first non-blocking sync phase if their | ||
393 | * completion took long enough that it happened after taking the | ||
394 | * timestamp for the cut-off in the blocking phase. | ||
395 | */ | ||
396 | xfs_inode_ag_iterator(mp, xfs_log_dirty_inode, 0); | ||
397 | |||
362 | xfs_qm_sync(mp, SYNC_TRYLOCK); | 398 | xfs_qm_sync(mp, SYNC_TRYLOCK); |
363 | xfs_qm_sync(mp, SYNC_WAIT); | 399 | xfs_qm_sync(mp, SYNC_WAIT); |
364 | 400 | ||
diff --git a/fs/xfs/xfs_sync.h b/fs/xfs/xfs_sync.h index 941202e7ac6e..fa965479d788 100644 --- a/fs/xfs/xfs_sync.h +++ b/fs/xfs/xfs_sync.h | |||
@@ -34,6 +34,8 @@ void xfs_quiesce_attr(struct xfs_mount *mp); | |||
34 | 34 | ||
35 | void xfs_flush_inodes(struct xfs_inode *ip); | 35 | void xfs_flush_inodes(struct xfs_inode *ip); |
36 | 36 | ||
37 | int xfs_log_dirty_inode(struct xfs_inode *ip, struct xfs_perag *pag, int flags); | ||
38 | |||
37 | int xfs_reclaim_inodes(struct xfs_mount *mp, int mode); | 39 | int xfs_reclaim_inodes(struct xfs_mount *mp, int mode); |
38 | int xfs_reclaim_inodes_count(struct xfs_mount *mp); | 40 | int xfs_reclaim_inodes_count(struct xfs_mount *mp); |
39 | void xfs_reclaim_inodes_nr(struct xfs_mount *mp, int nr_to_scan); | 41 | void xfs_reclaim_inodes_nr(struct xfs_mount *mp, int nr_to_scan); |
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h index 62ce6823c0f2..12a1764f612b 100644 --- a/include/asm-generic/cputime.h +++ b/include/asm-generic/cputime.h | |||
@@ -40,6 +40,7 @@ typedef u64 cputime64_t; | |||
40 | */ | 40 | */ |
41 | #define cputime_to_usecs(__ct) jiffies_to_usecs(__ct) | 41 | #define cputime_to_usecs(__ct) jiffies_to_usecs(__ct) |
42 | #define usecs_to_cputime(__msecs) usecs_to_jiffies(__msecs) | 42 | #define usecs_to_cputime(__msecs) usecs_to_jiffies(__msecs) |
43 | #define usecs_to_cputime64(__msecs) nsecs_to_jiffies64((__msecs) * 1000) | ||
43 | 44 | ||
44 | /* | 45 | /* |
45 | * Convert cputime to seconds and back. | 46 | * Convert cputime to seconds and back. |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index c3892fc1d538..68e67e50d028 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -557,6 +557,7 @@ struct kvm_ppc_pvinfo { | |||
557 | #define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ | 557 | #define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ |
558 | #define KVM_CAP_PPC_PAPR 68 | 558 | #define KVM_CAP_PPC_PAPR 68 |
559 | #define KVM_CAP_S390_GMAP 71 | 559 | #define KVM_CAP_S390_GMAP 71 |
560 | #define KVM_CAP_TSC_DEADLINE_TIMER 72 | ||
560 | 561 | ||
561 | #ifdef KVM_CAP_IRQ_ROUTING | 562 | #ifdef KVM_CAP_IRQ_ROUTING |
562 | 563 | ||
diff --git a/include/linux/lglock.h b/include/linux/lglock.h index f549056fb20b..87f402ccec55 100644 --- a/include/linux/lglock.h +++ b/include/linux/lglock.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
23 | #include <linux/lockdep.h> | 23 | #include <linux/lockdep.h> |
24 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
25 | #include <linux/cpu.h> | ||
25 | 26 | ||
26 | /* can make br locks by using local lock for read side, global lock for write */ | 27 | /* can make br locks by using local lock for read side, global lock for write */ |
27 | #define br_lock_init(name) name##_lock_init() | 28 | #define br_lock_init(name) name##_lock_init() |
@@ -72,9 +73,31 @@ | |||
72 | 73 | ||
73 | #define DEFINE_LGLOCK(name) \ | 74 | #define DEFINE_LGLOCK(name) \ |
74 | \ | 75 | \ |
76 | DEFINE_SPINLOCK(name##_cpu_lock); \ | ||
77 | cpumask_t name##_cpus __read_mostly; \ | ||
75 | DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \ | 78 | DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \ |
76 | DEFINE_LGLOCK_LOCKDEP(name); \ | 79 | DEFINE_LGLOCK_LOCKDEP(name); \ |
77 | \ | 80 | \ |
81 | static int \ | ||
82 | name##_lg_cpu_callback(struct notifier_block *nb, \ | ||
83 | unsigned long action, void *hcpu) \ | ||
84 | { \ | ||
85 | switch (action & ~CPU_TASKS_FROZEN) { \ | ||
86 | case CPU_UP_PREPARE: \ | ||
87 | spin_lock(&name##_cpu_lock); \ | ||
88 | cpu_set((unsigned long)hcpu, name##_cpus); \ | ||
89 | spin_unlock(&name##_cpu_lock); \ | ||
90 | break; \ | ||
91 | case CPU_UP_CANCELED: case CPU_DEAD: \ | ||
92 | spin_lock(&name##_cpu_lock); \ | ||
93 | cpu_clear((unsigned long)hcpu, name##_cpus); \ | ||
94 | spin_unlock(&name##_cpu_lock); \ | ||
95 | } \ | ||
96 | return NOTIFY_OK; \ | ||
97 | } \ | ||
98 | static struct notifier_block name##_lg_cpu_notifier = { \ | ||
99 | .notifier_call = name##_lg_cpu_callback, \ | ||
100 | }; \ | ||
78 | void name##_lock_init(void) { \ | 101 | void name##_lock_init(void) { \ |
79 | int i; \ | 102 | int i; \ |
80 | LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \ | 103 | LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \ |
@@ -83,6 +106,11 @@ | |||
83 | lock = &per_cpu(name##_lock, i); \ | 106 | lock = &per_cpu(name##_lock, i); \ |
84 | *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \ | 107 | *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \ |
85 | } \ | 108 | } \ |
109 | register_hotcpu_notifier(&name##_lg_cpu_notifier); \ | ||
110 | get_online_cpus(); \ | ||
111 | for_each_online_cpu(i) \ | ||
112 | cpu_set(i, name##_cpus); \ | ||
113 | put_online_cpus(); \ | ||
86 | } \ | 114 | } \ |
87 | EXPORT_SYMBOL(name##_lock_init); \ | 115 | EXPORT_SYMBOL(name##_lock_init); \ |
88 | \ | 116 | \ |
@@ -124,9 +152,9 @@ | |||
124 | \ | 152 | \ |
125 | void name##_global_lock_online(void) { \ | 153 | void name##_global_lock_online(void) { \ |
126 | int i; \ | 154 | int i; \ |
127 | preempt_disable(); \ | 155 | spin_lock(&name##_cpu_lock); \ |
128 | rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ | 156 | rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ |
129 | for_each_online_cpu(i) { \ | 157 | for_each_cpu(i, &name##_cpus) { \ |
130 | arch_spinlock_t *lock; \ | 158 | arch_spinlock_t *lock; \ |
131 | lock = &per_cpu(name##_lock, i); \ | 159 | lock = &per_cpu(name##_lock, i); \ |
132 | arch_spin_lock(lock); \ | 160 | arch_spin_lock(lock); \ |
@@ -137,12 +165,12 @@ | |||
137 | void name##_global_unlock_online(void) { \ | 165 | void name##_global_unlock_online(void) { \ |
138 | int i; \ | 166 | int i; \ |
139 | rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ | 167 | rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ |
140 | for_each_online_cpu(i) { \ | 168 | for_each_cpu(i, &name##_cpus) { \ |
141 | arch_spinlock_t *lock; \ | 169 | arch_spinlock_t *lock; \ |
142 | lock = &per_cpu(name##_lock, i); \ | 170 | lock = &per_cpu(name##_lock, i); \ |
143 | arch_spin_unlock(lock); \ | 171 | arch_spin_unlock(lock); \ |
144 | } \ | 172 | } \ |
145 | preempt_enable(); \ | 173 | spin_unlock(&name##_cpu_lock); \ |
146 | } \ | 174 | } \ |
147 | EXPORT_SYMBOL(name##_global_unlock_online); \ | 175 | EXPORT_SYMBOL(name##_global_unlock_online); \ |
148 | \ | 176 | \ |
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index b99caa8b780c..99d1d0decf88 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
@@ -21,6 +21,16 @@ | |||
21 | {I_REFERENCED, "I_REFERENCED"} \ | 21 | {I_REFERENCED, "I_REFERENCED"} \ |
22 | ) | 22 | ) |
23 | 23 | ||
24 | #define WB_WORK_REASON \ | ||
25 | {WB_REASON_BACKGROUND, "background"}, \ | ||
26 | {WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages"}, \ | ||
27 | {WB_REASON_SYNC, "sync"}, \ | ||
28 | {WB_REASON_PERIODIC, "periodic"}, \ | ||
29 | {WB_REASON_LAPTOP_TIMER, "laptop_timer"}, \ | ||
30 | {WB_REASON_FREE_MORE_MEM, "free_more_memory"}, \ | ||
31 | {WB_REASON_FS_FREE_SPACE, "fs_free_space"}, \ | ||
32 | {WB_REASON_FORKER_THREAD, "forker_thread"} | ||
33 | |||
24 | struct wb_writeback_work; | 34 | struct wb_writeback_work; |
25 | 35 | ||
26 | DECLARE_EVENT_CLASS(writeback_work_class, | 36 | DECLARE_EVENT_CLASS(writeback_work_class, |
@@ -55,7 +65,7 @@ DECLARE_EVENT_CLASS(writeback_work_class, | |||
55 | __entry->for_kupdate, | 65 | __entry->for_kupdate, |
56 | __entry->range_cyclic, | 66 | __entry->range_cyclic, |
57 | __entry->for_background, | 67 | __entry->for_background, |
58 | wb_reason_name[__entry->reason] | 68 | __print_symbolic(__entry->reason, WB_WORK_REASON) |
59 | ) | 69 | ) |
60 | ); | 70 | ); |
61 | #define DEFINE_WRITEBACK_WORK_EVENT(name) \ | 71 | #define DEFINE_WRITEBACK_WORK_EVENT(name) \ |
@@ -184,7 +194,8 @@ TRACE_EVENT(writeback_queue_io, | |||
184 | __entry->older, /* older_than_this in jiffies */ | 194 | __entry->older, /* older_than_this in jiffies */ |
185 | __entry->age, /* older_than_this in relative milliseconds */ | 195 | __entry->age, /* older_than_this in relative milliseconds */ |
186 | __entry->moved, | 196 | __entry->moved, |
187 | wb_reason_name[__entry->reason]) | 197 | __print_symbolic(__entry->reason, WB_WORK_REASON) |
198 | ) | ||
188 | ); | 199 | ); |
189 | 200 | ||
190 | TRACE_EVENT(global_dirty_state, | 201 | TRACE_EVENT(global_dirty_state, |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 73f17c0293c0..2316840b337a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -901,7 +901,6 @@ retry: | |||
901 | h->resv_huge_pages += delta; | 901 | h->resv_huge_pages += delta; |
902 | ret = 0; | 902 | ret = 0; |
903 | 903 | ||
904 | spin_unlock(&hugetlb_lock); | ||
905 | /* Free the needed pages to the hugetlb pool */ | 904 | /* Free the needed pages to the hugetlb pool */ |
906 | list_for_each_entry_safe(page, tmp, &surplus_list, lru) { | 905 | list_for_each_entry_safe(page, tmp, &surplus_list, lru) { |
907 | if ((--needed) < 0) | 906 | if ((--needed) < 0) |
@@ -915,6 +914,7 @@ retry: | |||
915 | VM_BUG_ON(page_count(page)); | 914 | VM_BUG_ON(page_count(page)); |
916 | enqueue_huge_page(h, page); | 915 | enqueue_huge_page(h, page); |
917 | } | 916 | } |
917 | spin_unlock(&hugetlb_lock); | ||
918 | 918 | ||
919 | /* Free unnecessary surplus pages to the buddy allocator */ | 919 | /* Free unnecessary surplus pages to the buddy allocator */ |
920 | free: | 920 | free: |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index adc395481813..c3fdbcb17658 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -636,6 +636,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
636 | struct vm_area_struct *prev; | 636 | struct vm_area_struct *prev; |
637 | struct vm_area_struct *vma; | 637 | struct vm_area_struct *vma; |
638 | int err = 0; | 638 | int err = 0; |
639 | pgoff_t pgoff; | ||
639 | unsigned long vmstart; | 640 | unsigned long vmstart; |
640 | unsigned long vmend; | 641 | unsigned long vmend; |
641 | 642 | ||
@@ -643,13 +644,21 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
643 | if (!vma || vma->vm_start > start) | 644 | if (!vma || vma->vm_start > start) |
644 | return -EFAULT; | 645 | return -EFAULT; |
645 | 646 | ||
647 | if (start > vma->vm_start) | ||
648 | prev = vma; | ||
649 | |||
646 | for (; vma && vma->vm_start < end; prev = vma, vma = next) { | 650 | for (; vma && vma->vm_start < end; prev = vma, vma = next) { |
647 | next = vma->vm_next; | 651 | next = vma->vm_next; |
648 | vmstart = max(start, vma->vm_start); | 652 | vmstart = max(start, vma->vm_start); |
649 | vmend = min(end, vma->vm_end); | 653 | vmend = min(end, vma->vm_end); |
650 | 654 | ||
655 | if (mpol_equal(vma_policy(vma), new_pol)) | ||
656 | continue; | ||
657 | |||
658 | pgoff = vma->vm_pgoff + | ||
659 | ((vmstart - vma->vm_start) >> PAGE_SHIFT); | ||
651 | prev = vma_merge(mm, prev, vmstart, vmend, vma->vm_flags, | 660 | prev = vma_merge(mm, prev, vmstart, vmend, vma->vm_flags, |
652 | vma->anon_vma, vma->vm_file, vma->vm_pgoff, | 661 | vma->anon_vma, vma->vm_file, pgoff, |
653 | new_pol); | 662 | new_pol); |
654 | if (prev) { | 663 | if (prev) { |
655 | vma = prev; | 664 | vma = prev; |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 85033344aed2..bb10c077a01a 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -1367,12 +1367,15 @@ ctnetlink_create_conntrack(struct net *net, u16 zone, | |||
1367 | nf_ct_protonum(ct)); | 1367 | nf_ct_protonum(ct)); |
1368 | if (helper == NULL) { | 1368 | if (helper == NULL) { |
1369 | rcu_read_unlock(); | 1369 | rcu_read_unlock(); |
1370 | spin_unlock_bh(&nf_conntrack_lock); | ||
1370 | #ifdef CONFIG_MODULES | 1371 | #ifdef CONFIG_MODULES |
1371 | if (request_module("nfct-helper-%s", helpname) < 0) { | 1372 | if (request_module("nfct-helper-%s", helpname) < 0) { |
1373 | spin_lock_bh(&nf_conntrack_lock); | ||
1372 | err = -EOPNOTSUPP; | 1374 | err = -EOPNOTSUPP; |
1373 | goto err1; | 1375 | goto err1; |
1374 | } | 1376 | } |
1375 | 1377 | ||
1378 | spin_lock_bh(&nf_conntrack_lock); | ||
1376 | rcu_read_lock(); | 1379 | rcu_read_lock(); |
1377 | helper = __nf_conntrack_helper_find(helpname, | 1380 | helper = __nf_conntrack_helper_find(helpname, |
1378 | nf_ct_l3num(ct), | 1381 | nf_ct_l3num(ct), |
@@ -1880,25 +1883,30 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, | |||
1880 | 1883 | ||
1881 | err = -ENOMEM; | 1884 | err = -ENOMEM; |
1882 | skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 1885 | skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
1883 | if (skb2 == NULL) | 1886 | if (skb2 == NULL) { |
1887 | nf_ct_expect_put(exp); | ||
1884 | goto out; | 1888 | goto out; |
1889 | } | ||
1885 | 1890 | ||
1886 | rcu_read_lock(); | 1891 | rcu_read_lock(); |
1887 | err = ctnetlink_exp_fill_info(skb2, NETLINK_CB(skb).pid, | 1892 | err = ctnetlink_exp_fill_info(skb2, NETLINK_CB(skb).pid, |
1888 | nlh->nlmsg_seq, IPCTNL_MSG_EXP_NEW, exp); | 1893 | nlh->nlmsg_seq, IPCTNL_MSG_EXP_NEW, exp); |
1889 | rcu_read_unlock(); | 1894 | rcu_read_unlock(); |
1895 | nf_ct_expect_put(exp); | ||
1890 | if (err <= 0) | 1896 | if (err <= 0) |
1891 | goto free; | 1897 | goto free; |
1892 | 1898 | ||
1893 | nf_ct_expect_put(exp); | 1899 | err = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).pid, MSG_DONTWAIT); |
1900 | if (err < 0) | ||
1901 | goto out; | ||
1894 | 1902 | ||
1895 | return netlink_unicast(ctnl, skb2, NETLINK_CB(skb).pid, MSG_DONTWAIT); | 1903 | return 0; |
1896 | 1904 | ||
1897 | free: | 1905 | free: |
1898 | kfree_skb(skb2); | 1906 | kfree_skb(skb2); |
1899 | out: | 1907 | out: |
1900 | nf_ct_expect_put(exp); | 1908 | /* this avoids a loop in nfnetlink. */ |
1901 | return err; | 1909 | return err == -EAGAIN ? -ENOBUFS : err; |
1902 | } | 1910 | } |
1903 | 1911 | ||
1904 | static int | 1912 | static int |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index e56ca75e3f43..2dbb32b988c4 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -2453,8 +2453,12 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc | |||
2453 | { | 2453 | { |
2454 | struct packet_sock *po = pkt_sk(sk); | 2454 | struct packet_sock *po = pkt_sk(sk); |
2455 | 2455 | ||
2456 | if (po->fanout) | 2456 | if (po->fanout) { |
2457 | if (dev) | ||
2458 | dev_put(dev); | ||
2459 | |||
2457 | return -EINVAL; | 2460 | return -EINVAL; |
2461 | } | ||
2458 | 2462 | ||
2459 | lock_sock(sk); | 2463 | lock_sock(sk); |
2460 | 2464 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index ffcaa5975947..a92c1b3dab83 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -532,7 +532,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | |||
532 | return -EINVAL; | 532 | return -EINVAL; |
533 | 533 | ||
534 | s = sizeof(struct disttable) + n * sizeof(s16); | 534 | s = sizeof(struct disttable) + n * sizeof(s16); |
535 | d = kmalloc(s, GFP_KERNEL); | 535 | d = kmalloc(s, GFP_KERNEL | __GFP_NOWARN); |
536 | if (!d) | 536 | if (!d) |
537 | d = vmalloc(s); | 537 | d = vmalloc(s); |
538 | if (!d) | 538 | if (!d) |
@@ -545,9 +545,10 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | |||
545 | root_lock = qdisc_root_sleeping_lock(sch); | 545 | root_lock = qdisc_root_sleeping_lock(sch); |
546 | 546 | ||
547 | spin_lock_bh(root_lock); | 547 | spin_lock_bh(root_lock); |
548 | dist_free(q->delay_dist); | 548 | swap(q->delay_dist, d); |
549 | q->delay_dist = d; | ||
550 | spin_unlock_bh(root_lock); | 549 | spin_unlock_bh(root_lock); |
550 | |||
551 | dist_free(d); | ||
551 | return 0; | 552 | return 0; |
552 | } | 553 | } |
553 | 554 | ||
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index ba573fe7c74d..914833d99b06 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -60,8 +60,8 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h | |||
60 | --directory=$(srctree) --directory=$(objtree) \ | 60 | --directory=$(srctree) --directory=$(objtree) \ |
61 | --output $(obj)/config.pot | 61 | --output $(obj)/config.pot |
62 | $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot | 62 | $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot |
63 | $(Q)ln -fs Kconfig.x86 arch/um/Kconfig | 63 | $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ |
64 | $(Q)(for i in `ls $(srctree)/arch/*/Kconfig`; \ | 64 | $(srctree)/arch/*/um/Kconfig`; \ |
65 | do \ | 65 | do \ |
66 | echo " GEN $$i"; \ | 66 | echo " GEN $$i"; \ |
67 | $(obj)/kxgettext $$i \ | 67 | $(obj)/kxgettext $$i \ |
@@ -69,7 +69,6 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h | |||
69 | done ) | 69 | done ) |
70 | $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ | 70 | $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ |
71 | --output $(obj)/linux.pot | 71 | --output $(obj)/linux.pot |
72 | $(Q)rm -f $(srctree)/arch/um/Kconfig | ||
73 | $(Q)rm -f $(obj)/config.pot | 72 | $(Q)rm -f $(obj)/config.pot |
74 | 73 | ||
75 | PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig | 74 | PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig |
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 3ad0925d23a9..758e3b36d4cf 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/namei.h> | ||
21 | #include <linux/fs.h> | ||
20 | #include "irq.h" | 22 | #include "irq.h" |
21 | 23 | ||
22 | static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(struct list_head *head, | 24 | static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(struct list_head *head, |
@@ -480,12 +482,76 @@ out: | |||
480 | return r; | 482 | return r; |
481 | } | 483 | } |
482 | 484 | ||
485 | /* | ||
486 | * We want to test whether the caller has been granted permissions to | ||
487 | * use this device. To be able to configure and control the device, | ||
488 | * the user needs access to PCI configuration space and BAR resources. | ||
489 | * These are accessed through PCI sysfs. PCI config space is often | ||
490 | * passed to the process calling this ioctl via file descriptor, so we | ||
491 | * can't rely on access to that file. We can check for permissions | ||
492 | * on each of the BAR resource files, which is a pretty clear | ||
493 | * indicator that the user has been granted access to the device. | ||
494 | */ | ||
495 | static int probe_sysfs_permissions(struct pci_dev *dev) | ||
496 | { | ||
497 | #ifdef CONFIG_SYSFS | ||
498 | int i; | ||
499 | bool bar_found = false; | ||
500 | |||
501 | for (i = PCI_STD_RESOURCES; i <= PCI_STD_RESOURCE_END; i++) { | ||
502 | char *kpath, *syspath; | ||
503 | struct path path; | ||
504 | struct inode *inode; | ||
505 | int r; | ||
506 | |||
507 | if (!pci_resource_len(dev, i)) | ||
508 | continue; | ||
509 | |||
510 | kpath = kobject_get_path(&dev->dev.kobj, GFP_KERNEL); | ||
511 | if (!kpath) | ||
512 | return -ENOMEM; | ||
513 | |||
514 | /* Per sysfs-rules, sysfs is always at /sys */ | ||
515 | syspath = kasprintf(GFP_KERNEL, "/sys%s/resource%d", kpath, i); | ||
516 | kfree(kpath); | ||
517 | if (!syspath) | ||
518 | return -ENOMEM; | ||
519 | |||
520 | r = kern_path(syspath, LOOKUP_FOLLOW, &path); | ||
521 | kfree(syspath); | ||
522 | if (r) | ||
523 | return r; | ||
524 | |||
525 | inode = path.dentry->d_inode; | ||
526 | |||
527 | r = inode_permission(inode, MAY_READ | MAY_WRITE | MAY_ACCESS); | ||
528 | path_put(&path); | ||
529 | if (r) | ||
530 | return r; | ||
531 | |||
532 | bar_found = true; | ||
533 | } | ||
534 | |||
535 | /* If no resources, probably something special */ | ||
536 | if (!bar_found) | ||
537 | return -EPERM; | ||
538 | |||
539 | return 0; | ||
540 | #else | ||
541 | return -EINVAL; /* No way to control the device without sysfs */ | ||
542 | #endif | ||
543 | } | ||
544 | |||
483 | static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | 545 | static int kvm_vm_ioctl_assign_device(struct kvm *kvm, |
484 | struct kvm_assigned_pci_dev *assigned_dev) | 546 | struct kvm_assigned_pci_dev *assigned_dev) |
485 | { | 547 | { |
486 | int r = 0, idx; | 548 | int r = 0, idx; |
487 | struct kvm_assigned_dev_kernel *match; | 549 | struct kvm_assigned_dev_kernel *match; |
488 | struct pci_dev *dev; | 550 | struct pci_dev *dev; |
551 | u8 header_type; | ||
552 | |||
553 | if (!(assigned_dev->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU)) | ||
554 | return -EINVAL; | ||
489 | 555 | ||
490 | mutex_lock(&kvm->lock); | 556 | mutex_lock(&kvm->lock); |
491 | idx = srcu_read_lock(&kvm->srcu); | 557 | idx = srcu_read_lock(&kvm->srcu); |
@@ -513,6 +579,18 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
513 | r = -EINVAL; | 579 | r = -EINVAL; |
514 | goto out_free; | 580 | goto out_free; |
515 | } | 581 | } |
582 | |||
583 | /* Don't allow bridges to be assigned */ | ||
584 | pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type); | ||
585 | if ((header_type & PCI_HEADER_TYPE) != PCI_HEADER_TYPE_NORMAL) { | ||
586 | r = -EPERM; | ||
587 | goto out_put; | ||
588 | } | ||
589 | |||
590 | r = probe_sysfs_permissions(dev); | ||
591 | if (r) | ||
592 | goto out_put; | ||
593 | |||
516 | if (pci_enable_device(dev)) { | 594 | if (pci_enable_device(dev)) { |
517 | printk(KERN_INFO "%s: Could not enable PCI device\n", __func__); | 595 | printk(KERN_INFO "%s: Could not enable PCI device\n", __func__); |
518 | r = -EBUSY; | 596 | r = -EBUSY; |
@@ -544,16 +622,14 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
544 | 622 | ||
545 | list_add(&match->list, &kvm->arch.assigned_dev_head); | 623 | list_add(&match->list, &kvm->arch.assigned_dev_head); |
546 | 624 | ||
547 | if (assigned_dev->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU) { | 625 | if (!kvm->arch.iommu_domain) { |
548 | if (!kvm->arch.iommu_domain) { | 626 | r = kvm_iommu_map_guest(kvm); |
549 | r = kvm_iommu_map_guest(kvm); | ||
550 | if (r) | ||
551 | goto out_list_del; | ||
552 | } | ||
553 | r = kvm_assign_device(kvm, match); | ||
554 | if (r) | 627 | if (r) |
555 | goto out_list_del; | 628 | goto out_list_del; |
556 | } | 629 | } |
630 | r = kvm_assign_device(kvm, match); | ||
631 | if (r) | ||
632 | goto out_list_del; | ||
557 | 633 | ||
558 | out: | 634 | out: |
559 | srcu_read_unlock(&kvm->srcu, idx); | 635 | srcu_read_unlock(&kvm->srcu, idx); |
@@ -593,8 +669,7 @@ static int kvm_vm_ioctl_deassign_device(struct kvm *kvm, | |||
593 | goto out; | 669 | goto out; |
594 | } | 670 | } |
595 | 671 | ||
596 | if (match->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU) | 672 | kvm_deassign_device(kvm, match); |
597 | kvm_deassign_device(kvm, match); | ||
598 | 673 | ||
599 | kvm_free_assigned_device(kvm, match); | 674 | kvm_free_assigned_device(kvm, match); |
600 | 675 | ||