commit c7c167032e0a7bacaf4b9e53d4e0d8e71dfe0d29
Author: Jacek Konieczny <[email protected]>
Date:   Sun Jan 22 18:13:15 2017 +0100

    rt patch updated

 kernel-rt.patch | 4488 ++++++++++++++++++-------------------------------------
 kernel.spec     |    2 +-
 2 files changed, 1432 insertions(+), 3058 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 66e6fdd..11da50d 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -213,7 +213,7 @@ Patch146:   kernel-aufs4+vserver.patch
 Patch250:      kernel-fix_256colors_menuconfig.patch
 
 # https://rt.wiki.kernel.org/
-# 
https://www.kernel.org/pub/linux/kernel/projects/rt/4.8/patch-4.8.6-rt5.patch.xz
+# 
https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/patch-4.9.4-rt2.patch.xz
 Patch500:      kernel-rt.patch
 
 Patch2000:     kernel-small_fixes.patch
diff --git a/kernel-rt.patch b/kernel-rt.patch
index b19eb6e..ffc64be 100644
--- a/kernel-rt.patch
+++ b/kernel-rt.patch
@@ -1,73 +1,3 @@
-diff --git a/Documentation/hwlat_detector.txt 
b/Documentation/hwlat_detector.txt
-new file mode 100644
-index 000000000000..cb61516483d3
---- /dev/null
-+++ b/Documentation/hwlat_detector.txt
-@@ -0,0 +1,64 @@
-+Introduction:
-+-------------
-+
-+The module hwlat_detector is a special purpose kernel module that is used to
-+detect large system latencies induced by the behavior of certain underlying
-+hardware or firmware, independent of Linux itself. The code was developed
-+originally to detect SMIs (System Management Interrupts) on x86 systems,
-+however there is nothing x86 specific about this patchset. It was
-+originally written for use by the "RT" patch since the Real Time
-+kernel is highly latency sensitive.
-+
-+SMIs are usually not serviced by the Linux kernel, which typically does not
-+even know that they are occuring. SMIs are instead are set up by BIOS code
-+and are serviced by BIOS code, usually for "critical" events such as
-+management of thermal sensors and fans. Sometimes though, SMIs are used for
-+other tasks and those tasks can spend an inordinate amount of time in the
-+handler (sometimes measured in milliseconds). Obviously this is a problem if
-+you are trying to keep event service latencies down in the microsecond range.
-+
-+The hardware latency detector works by hogging all of the cpus for 
configurable
-+amounts of time (by calling stop_machine()), polling the CPU Time Stamp 
Counter
-+for some period, then looking for gaps in the TSC data. Any gap indicates a
-+time when the polling was interrupted and since the machine is stopped and
-+interrupts turned off the only thing that could do that would be an SMI.
-+
-+Note that the SMI detector should *NEVER* be used in a production environment.
-+It is intended to be run manually to determine if the hardware platform has a
-+problem with long system firmware service routines.
-+
-+Usage:
-+------
-+
-+Loading the module hwlat_detector passing the parameter "enabled=1" (or by
-+setting the "enable" entry in "hwlat_detector" debugfs toggled on) is the only
-+step required to start the hwlat_detector. It is possible to redefine the
-+threshold in microseconds (us) above which latency spikes will be taken
-+into account (parameter "threshold=").
-+
-+Example:
-+
-+      # modprobe hwlat_detector enabled=1 threshold=100
-+
-+After the module is loaded, it creates a directory named "hwlat_detector" 
under
-+the debugfs mountpoint, "/debug/hwlat_detector" for this text. It is necessary
-+to have debugfs mounted, which might be on /sys/debug on your system.
-+
-+The /debug/hwlat_detector interface contains the following files:
-+
-+count                 - number of latency spikes observed since last reset
-+enable                        - a global enable/disable toggle (0/1), resets 
count
-+max                   - maximum hardware latency actually observed (usecs)
-+sample                        - a pipe from which to read current raw sample 
data
-+                        in the format <timestamp> <latency observed usecs>
-+                        (can be opened O_NONBLOCK for a single sample)
-+threshold             - minimum latency value to be considered (usecs)
-+width                 - time period to sample with CPUs held (usecs)
-+                        must be less than the total window size (enforced)
-+window                        - total period of sampling, width being inside 
(usecs)
-+
-+By default we will set width to 500,000 and window to 1,000,000, meaning that
-+we will sample every 1,000,000 usecs (1s) for 500,000 usecs (0.5s). If we
-+observe any latencies that exceed the threshold (initially 100 usecs),
-+then we write to a global sample ring buffer of 8K samples, which is
-+consumed by reading from the "sample" (pipe) debugfs file interface.
 diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
 index 3a3b30ac2a75..9e0745cafbd8 100644
 --- a/Documentation/sysrq.txt
@@ -284,27 +214,8 @@ index 000000000000..6f2aeabf7faa
 +is provided.
 +
 +These data are also reset when the wakeup histogram is reset.
-diff --git a/Makefile b/Makefile
-index b249529204cd..5d699d055995 100644
---- a/Makefile
-+++ b/Makefile
-@@ -398,12 +398,12 @@ KBUILD_CPPFLAGS := -D__KERNEL__
- KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-                  -fno-strict-aliasing -fno-common \
-                  -Werror-implicit-function-declaration \
--                 -Wno-format-security \
-+                 -Wno-format-security -fno-PIE \
-                  -std=gnu89
- 
- KBUILD_AFLAGS_KERNEL :=
- KBUILD_CFLAGS_KERNEL :=
--KBUILD_AFLAGS   := -D__ASSEMBLY__
-+KBUILD_AFLAGS   := -D__ASSEMBLY__ -fno-PIE
- KBUILD_AFLAGS_MODULE  := -DMODULE
- KBUILD_CFLAGS_MODULE  := -DMODULE
- KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
 diff --git a/arch/Kconfig b/arch/Kconfig
-index fd6e9712af81..085134ee13e9 100644
+index 659bdd079277..099fc0f5155e 100644
 --- a/arch/Kconfig
 +++ b/arch/Kconfig
 @@ -9,6 +9,7 @@ config OPROFILE
@@ -324,7 +235,7 @@ index fd6e9712af81..085134ee13e9 100644
           This option enables a transparent branch optimization that
         makes certain almost-always-true or almost-always-false branch
 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
-index a9c4e48bb7ec..6eefe4f32302 100644
+index b5d529fdffab..5715844e83e3 100644
 --- a/arch/arm/Kconfig
 +++ b/arch/arm/Kconfig
 @@ -36,7 +36,7 @@ config ARM
@@ -344,6 +255,19 @@ index a9c4e48bb7ec..6eefe4f32302 100644
        select HAVE_RCU_TABLE_FREE if (SMP && ARM_LPAE)
        select HAVE_REGS_AND_STACK_ACCESS_API
        select HAVE_SYSCALL_TRACEPOINTS
+diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
+index e53638c8ed8a..6095a1649865 100644
+--- a/arch/arm/include/asm/irq.h
++++ b/arch/arm/include/asm/irq.h
+@@ -22,6 +22,8 @@
+ #endif
+ 
+ #ifndef __ASSEMBLY__
++#include <linux/cpumask.h>
++
+ struct irqaction;
+ struct pt_regs;
+ extern void migrate_irqs(void);
 diff --git a/arch/arm/include/asm/switch_to.h 
b/arch/arm/include/asm/switch_to.h
 index 12ebfcc1d539..c962084605bc 100644
 --- a/arch/arm/include/asm/switch_to.h
@@ -491,11 +415,42 @@ index 10c3283d6c19..8872937862cc 100644
   UNWIND(.fnend                )
  ENDPROC(ret_fast_syscall)
  
+diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c
+index 69bda1a5707e..1f665acaa6a9 100644
+--- a/arch/arm/kernel/patch.c
++++ b/arch/arm/kernel/patch.c
+@@ -15,7 +15,7 @@ struct patch {
+       unsigned int insn;
+ };
+ 
+-static DEFINE_SPINLOCK(patch_lock);
++static DEFINE_RAW_SPINLOCK(patch_lock);
+ 
+ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
+       __acquires(&patch_lock)
+@@ -32,7 +32,7 @@ static void __kprobes *patch_map(void *addr, int fixmap, 
unsigned long *flags)
+               return addr;
+ 
+       if (flags)
+-              spin_lock_irqsave(&patch_lock, *flags);
++              raw_spin_lock_irqsave(&patch_lock, *flags);
+       else
+               __acquire(&patch_lock);
+ 
+@@ -47,7 +47,7 @@ static void __kprobes patch_unmap(int fixmap, unsigned long 
*flags)
+       clear_fixmap(fixmap);
+ 
+       if (flags)
+-              spin_unlock_irqrestore(&patch_lock, *flags);
++              raw_spin_unlock_irqrestore(&patch_lock, *flags);
+       else
+               __release(&patch_lock);
+ }
 diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
-index 612eb530f33f..cd3006dc1fd3 100644
+index 91d2d5b01414..750550098b59 100644
 --- a/arch/arm/kernel/process.c
 +++ b/arch/arm/kernel/process.c
-@@ -323,6 +323,30 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
+@@ -322,6 +322,30 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
  }
  
  #ifdef CONFIG_MMU
@@ -541,7 +496,7 @@ index 7b8f2141427b..96541e00b74a 100644
                } else {
                        if (unlikely(!user_mode(regs)))
 diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
-index 861521606c6d..e5ca865d321b 100644
+index 7dd14e8395e6..4cd7e3d98035 100644
 --- a/arch/arm/kernel/smp.c
 +++ b/arch/arm/kernel/smp.c
 @@ -234,8 +234,6 @@ int __cpu_disable(void)
@@ -619,10 +574,10 @@ index 0bee233fef9a..314cfb232a63 100644
        kfree(tab);
  }
 diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
-index c94b90d43772..244dde72018a 100644
+index 19b5f5c1c0ff..82aa639e6737 100644
 --- a/arch/arm/kvm/arm.c
 +++ b/arch/arm/kvm/arm.c
-@@ -584,7 +584,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct 
kvm_run *run)
+@@ -619,7 +619,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct 
kvm_run *run)
                 * involves poking the GIC, which must be done in a
                 * non-preemptible context.
                 */
@@ -631,7 +586,7 @@ index c94b90d43772..244dde72018a 100644
                kvm_pmu_flush_hwstate(vcpu);
                kvm_timer_flush_hwstate(vcpu);
                kvm_vgic_flush_hwstate(vcpu);
-@@ -605,7 +605,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct 
kvm_run *run)
+@@ -640,7 +640,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct 
kvm_run *run)
                        kvm_pmu_sync_hwstate(vcpu);
                        kvm_timer_sync_hwstate(vcpu);
                        kvm_vgic_sync_hwstate(vcpu);
@@ -640,7 +595,7 @@ index c94b90d43772..244dde72018a 100644
                        continue;
                }
  
-@@ -661,7 +661,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct 
kvm_run *run)
+@@ -696,7 +696,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct 
kvm_run *run)
  
                kvm_vgic_sync_hwstate(vcpu);
  
@@ -1200,10 +1155,10 @@ index c2366510187a..6b60f582b738 100644
        return pen_release != -1 ? -ENOSYS : 0;
  }
 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
-index bc3f00f586f1..0f3df6d5154a 100644
+index 969ef880d234..1182fe883771 100644
 --- a/arch/arm64/Kconfig
 +++ b/arch/arm64/Kconfig
-@@ -90,6 +90,7 @@ config ARM64
+@@ -91,6 +91,7 @@ config ARM64
        select HAVE_PERF_EVENTS
        select HAVE_PERF_REGS
        select HAVE_PERF_USER_STACK_DUMP
@@ -1211,7 +1166,7 @@ index bc3f00f586f1..0f3df6d5154a 100644
        select HAVE_REGS_AND_STACK_ACCESS_API
        select HAVE_RCU_TABLE_FREE
        select HAVE_SYSCALL_TRACEPOINTS
-@@ -689,7 +690,7 @@ config XEN_DOM0
+@@ -694,7 +695,7 @@ config XEN_DOM0
  
  config XEN
        bool "Xen guest support on ARM64"
@@ -1221,7 +1176,7 @@ index bc3f00f586f1..0f3df6d5154a 100644
        select PARAVIRT
        help
 diff --git a/arch/arm64/include/asm/thread_info.h 
b/arch/arm64/include/asm/thread_info.h
-index abd64bd1f6d9..9170788ffa37 100644
+index e9ea5a6bd449..6c500ad63c6a 100644
 --- a/arch/arm64/include/asm/thread_info.h
 +++ b/arch/arm64/include/asm/thread_info.h
 @@ -49,6 +49,7 @@ struct thread_info {
@@ -1232,7 +1187,7 @@ index abd64bd1f6d9..9170788ffa37 100644
        int                     cpu;            /* cpu */
  };
  
-@@ -109,6 +110,7 @@ static inline struct thread_info *current_thread_info(void)
+@@ -112,6 +113,7 @@ static inline struct thread_info *current_thread_info(void)
  #define TIF_NEED_RESCHED      1
  #define TIF_NOTIFY_RESUME     2       /* callback before returning to user */
  #define TIF_FOREIGN_FPSTATE   3       /* CPU's FP state is not current's */
@@ -1240,7 +1195,7 @@ index abd64bd1f6d9..9170788ffa37 100644
  #define TIF_NOHZ              7
  #define TIF_SYSCALL_TRACE     8
  #define TIF_SYSCALL_AUDIT     9
-@@ -124,6 +126,7 @@ static inline struct thread_info *current_thread_info(void)
+@@ -127,6 +129,7 @@ static inline struct thread_info *current_thread_info(void)
  #define _TIF_NEED_RESCHED     (1 << TIF_NEED_RESCHED)
  #define _TIF_NOTIFY_RESUME    (1 << TIF_NOTIFY_RESUME)
  #define _TIF_FOREIGN_FPSTATE  (1 << TIF_FOREIGN_FPSTATE)
@@ -1248,21 +1203,22 @@ index abd64bd1f6d9..9170788ffa37 100644
  #define _TIF_NOHZ             (1 << TIF_NOHZ)
  #define _TIF_SYSCALL_TRACE    (1 << TIF_SYSCALL_TRACE)
  #define _TIF_SYSCALL_AUDIT    (1 << TIF_SYSCALL_AUDIT)
-@@ -132,7 +135,8 @@ static inline struct thread_info *current_thread_info(void)
+@@ -135,7 +138,9 @@ static inline struct thread_info *current_thread_info(void)
  #define _TIF_32BIT            (1 << TIF_32BIT)
  
  #define _TIF_WORK_MASK                (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
 -                               _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE)
 +                               _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \
 +                               _TIF_NEED_RESCHED_LAZY)
++#define _TIF_NEED_RESCHED_MASK        (_TIF_NEED_RESCHED | 
_TIF_NEED_RESCHED_LAZY)
  
  #define _TIF_SYSCALL_WORK     (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
                                 _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
 diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
-index 05070b72fc28..acfeddb1283a 100644
+index 4a2f0f0fef32..6bf2bc17c400 100644
 --- a/arch/arm64/kernel/asm-offsets.c
 +++ b/arch/arm64/kernel/asm-offsets.c
-@@ -37,6 +37,7 @@ int main(void)
+@@ -38,6 +38,7 @@ int main(void)
    BLANK();
    DEFINE(TI_FLAGS,            offsetof(struct thread_info, flags));
    DEFINE(TI_PREEMPT,          offsetof(struct thread_info, preempt_count));
@@ -1271,10 +1227,10 @@ index 05070b72fc28..acfeddb1283a 100644
    DEFINE(TI_TASK,             offsetof(struct thread_info, task));
    DEFINE(TI_CPU,              offsetof(struct thread_info, cpu));
 diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
-index 441420ca7d08..404792bdca99 100644
+index 223d54a4d66b..266c0e2141ca 100644
 --- a/arch/arm64/kernel/entry.S
 +++ b/arch/arm64/kernel/entry.S
-@@ -434,11 +434,16 @@ ENDPROC(el1_sync)
+@@ -428,11 +428,16 @@ ENDPROC(el1_sync)
  
  #ifdef CONFIG_PREEMPT
        ldr     w24, [tsk, #TI_PREEMPT]         // get preempt count
@@ -1294,7 +1250,7 @@ index 441420ca7d08..404792bdca99 100644
  #endif
  #ifdef CONFIG_TRACE_IRQFLAGS
        bl      trace_hardirqs_on
-@@ -452,6 +457,7 @@ ENDPROC(el1_irq)
+@@ -446,6 +451,7 @@ ENDPROC(el1_irq)
  1:    bl      preempt_schedule_irq            // irq en/disable is done inside
        ldr     x0, [tsk, #TI_FLAGS]            // get new tasks TI_FLAGS
        tbnz    x0, #TIF_NEED_RESCHED, 1b       // needs rescheduling?
@@ -1302,19 +1258,24 @@ index 441420ca7d08..404792bdca99 100644
        ret     x24
  #endif
  
-@@ -708,6 +714,7 @@ ENDPROC(cpu_switch_to)
-  */
- work_pending:
-       tbnz    x1, #TIF_NEED_RESCHED, work_resched
-+      tbnz    x1, #TIF_NEED_RESCHED_LAZY, work_resched
-       /* TIF_SIGPENDING, TIF_NOTIFY_RESUME or TIF_FOREIGN_FPSTATE case */
-       mov     x0, sp                          // 'regs'
-       enable_irq                              // enable interrupts for 
do_notify_resume()
+diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
+index 404dd67080b9..639dc6d12e72 100644
+--- a/arch/arm64/kernel/signal.c
++++ b/arch/arm64/kernel/signal.c
+@@ -409,7 +409,7 @@ asmlinkage void do_notify_resume(struct pt_regs *regs,
+        */
+       trace_hardirqs_off();
+       do {
+-              if (thread_flags & _TIF_NEED_RESCHED) {
++              if (thread_flags & _TIF_NEED_RESCHED_MASK) {
+                       schedule();
+               } else {
+                       local_irq_enable();
 diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
-index 212ff92920d2..71ad38d3d76b 100644
+index b3c5bde43d34..8122bf058de0 100644
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
-@@ -2480,7 +2480,7 @@ config MIPS_ASID_BITS_VARIABLE
+@@ -2514,7 +2514,7 @@ config MIPS_ASID_BITS_VARIABLE
  #
  config HIGHMEM
        bool "High Memory Support"
@@ -1324,10 +1285,10 @@ index 212ff92920d2..71ad38d3d76b 100644
  config CPU_SUPPORTS_HIGHMEM
        bool
 diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
-index 792cb1768c8f..ddf5a0fdb25a 100644
+index 65fba4c34cd7..4b5ba68910e0 100644
 --- a/arch/powerpc/Kconfig
 +++ b/arch/powerpc/Kconfig
-@@ -57,10 +57,11 @@ config LOCKDEP_SUPPORT
+@@ -52,10 +52,11 @@ config LOCKDEP_SUPPORT
  
  config RWSEM_GENERIC_SPINLOCK
        bool
@@ -1340,7 +1301,7 @@ index 792cb1768c8f..ddf5a0fdb25a 100644
  
  config GENERIC_LOCKBREAK
        bool
-@@ -140,6 +141,7 @@ config PPC
+@@ -134,6 +135,7 @@ config PPC
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
@@ -1348,7 +1309,7 @@ index 792cb1768c8f..ddf5a0fdb25a 100644
        select HAVE_MOD_ARCH_SPECIFIC
        select MODULES_USE_ELF_RELA
        select CLONE_BACKWARDS
-@@ -326,7 +328,7 @@ menu "Kernel options"
+@@ -321,7 +323,7 @@ menu "Kernel options"
  
  config HIGHMEM
        bool "High memory support"
@@ -1408,7 +1369,7 @@ index 87e4b2d8dcd4..981e501a4359 100644
  /* Bits in local_flags */
  /* Don't move TLF_NAPPING without adjusting the code in entry_32.S */
 diff --git a/arch/powerpc/kernel/asm-offsets.c 
b/arch/powerpc/kernel/asm-offsets.c
-index b89d14c0352c..81ae8f4c88f6 100644
+index c833d88c423d..96e9fbc3f684 100644
 --- a/arch/powerpc/kernel/asm-offsets.c
 +++ b/arch/powerpc/kernel/asm-offsets.c
 @@ -156,6 +156,7 @@ int main(void)
@@ -1420,7 +1381,7 @@ index b89d14c0352c..81ae8f4c88f6 100644
        DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
  
 diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
-index 9899032230b4..f95b93f46c47 100644
+index 3841d749a430..6dbaeff192b9 100644
 --- a/arch/powerpc/kernel/entry_32.S
 +++ b/arch/powerpc/kernel/entry_32.S
 @@ -835,7 +835,14 @@ user_exc_return:          /* r10 contains MSR_KERNEL here 
*/
@@ -1472,10 +1433,10 @@ index 9899032230b4..f95b93f46c47 100644
        andi.   r0,r9,_TIF_USER_WORK_MASK
        beq     restore_user
 diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
-index 5afd03e5e8b8..f5d4c2a033ef 100644
+index 6432d4bf08c8..5509a26f1070 100644
 --- a/arch/powerpc/kernel/entry_64.S
 +++ b/arch/powerpc/kernel/entry_64.S
-@@ -657,7 +657,7 @@ _GLOBAL(ret_from_except_lite)
+@@ -656,7 +656,7 @@ _GLOBAL(ret_from_except_lite)
        bl      restore_math
        b       restore
  #endif
@@ -1484,7 +1445,7 @@ index 5afd03e5e8b8..f5d4c2a033ef 100644
        beq     2f
        bl      restore_interrupts
        SCHEDULE_USER
-@@ -719,10 +719,18 @@ _GLOBAL(ret_from_except_lite)
+@@ -718,10 +718,18 @@ _GLOBAL(ret_from_except_lite)
  
  #ifdef CONFIG_PREEMPT
        /* Check if we need to preempt */
@@ -1506,7 +1467,7 @@ index 5afd03e5e8b8..f5d4c2a033ef 100644
        cmpwi   cr1,r8,0
        ld      r0,SOFTE(r1)
        cmpdi   r0,0
-@@ -739,7 +747,7 @@ _GLOBAL(ret_from_except_lite)
+@@ -738,7 +746,7 @@ _GLOBAL(ret_from_except_lite)
        /* Re-test flags and eventually loop */
        CURRENT_THREAD_INFO(r9, r1)
        ld      r4,TI_FLAGS(r9)
@@ -1516,10 +1477,10 @@ index 5afd03e5e8b8..f5d4c2a033ef 100644
  
        /*
 diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
-index 08887cf2b20e..f1770ea2d094 100644
+index 3c05c311e35e..f83f6ac1274d 100644
 --- a/arch/powerpc/kernel/irq.c
 +++ b/arch/powerpc/kernel/irq.c
-@@ -633,6 +633,7 @@ void irq_ctx_init(void)
+@@ -638,6 +638,7 @@ void irq_ctx_init(void)
        }
  }
  
@@ -1527,7 +1488,7 @@ index 08887cf2b20e..f1770ea2d094 100644
  void do_softirq_own_stack(void)
  {
        struct thread_info *curtp, *irqtp;
-@@ -650,6 +651,7 @@ void do_softirq_own_stack(void)
+@@ -655,6 +656,7 @@ void do_softirq_own_stack(void)
        if (irqtp->flags)
                set_bits(irqtp->flags, &curtp->flags);
  }
@@ -1536,10 +1497,10 @@ index 08887cf2b20e..f1770ea2d094 100644
  irq_hw_number_t virq_to_hw(unsigned int virq)
  {
 diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
-index d9c912b6e632..7b2e997a5083 100644
+index 030d72df5dd5..b471a709e100 100644
 --- a/arch/powerpc/kernel/misc_32.S
 +++ b/arch/powerpc/kernel/misc_32.S
-@@ -40,6 +40,7 @@
+@@ -41,6 +41,7 @@
   * We store the saved ksp_limit in the unused part
   * of the STACK_FRAME_OVERHEAD
   */
@@ -1547,7 +1508,7 @@ index d9c912b6e632..7b2e997a5083 100644
  _GLOBAL(call_do_softirq)
        mflr    r0
        stw     r0,4(r1)
-@@ -56,6 +57,7 @@ _GLOBAL(call_do_softirq)
+@@ -57,6 +58,7 @@ _GLOBAL(call_do_softirq)
        stw     r10,THREAD+KSP_LIMIT(r2)
        mtlr    r0
        blr
@@ -1556,10 +1517,10 @@ index d9c912b6e632..7b2e997a5083 100644
  /*
   * void call_do_irq(struct pt_regs *regs, struct thread_info *irqtp);
 diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
-index cb195157b318..c919a2bfd0ca 100644
+index 4f178671f230..39e7d84a3492 100644
 --- a/arch/powerpc/kernel/misc_64.S
 +++ b/arch/powerpc/kernel/misc_64.S
-@@ -30,6 +30,7 @@
+@@ -31,6 +31,7 @@
  
        .text
  
@@ -1567,7 +1528,7 @@ index cb195157b318..c919a2bfd0ca 100644
  _GLOBAL(call_do_softirq)
        mflr    r0
        std     r0,16(r1)
-@@ -40,6 +41,7 @@ _GLOBAL(call_do_softirq)
+@@ -41,6 +42,7 @@ _GLOBAL(call_do_softirq)
        ld      r0,16(r1)
        mtlr    r0
        blr
@@ -1576,10 +1537,10 @@ index cb195157b318..c919a2bfd0ca 100644
  _GLOBAL(call_do_irq)
        mflr    r0
 diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
-index c2024ac9d4e8..2303788da7e1 100644
+index 029be26b5a17..9528089ea142 100644
 --- a/arch/powerpc/kvm/Kconfig
 +++ b/arch/powerpc/kvm/Kconfig
-@@ -172,6 +172,7 @@ config KVM_E500MC
+@@ -175,6 +175,7 @@ config KVM_E500MC
  config KVM_MPIC
        bool "KVM in-kernel MPIC emulation"
        depends on KVM && E500
@@ -1588,7 +1549,7 @@ index c2024ac9d4e8..2303788da7e1 100644
        select HAVE_KVM_IRQFD
        select HAVE_KVM_IRQ_ROUTING
 diff --git a/arch/powerpc/platforms/ps3/device-init.c 
b/arch/powerpc/platforms/ps3/device-init.c
-index 57caaf11a83f..030c9bfe52e3 100644
+index e48462447ff0..2670cee66064 100644
 --- a/arch/powerpc/platforms/ps3/device-init.c
 +++ b/arch/powerpc/platforms/ps3/device-init.c
 @@ -752,7 +752,7 @@ static int ps3_notification_read_write(struct 
ps3_notification_device *dev,
@@ -1621,10 +1582,10 @@ index 6c0378c0b8b5..abd58b4dff97 100644
  static inline void handle_one_irq(unsigned int irq)
  {
 diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
-index 59b09600dd32..1b073eb3dc2a 100644
+index 165ecdd24d22..b68a464a22be 100644
 --- a/arch/sparc/Kconfig
 +++ b/arch/sparc/Kconfig
-@@ -187,12 +187,10 @@ config NR_CPUS
+@@ -194,12 +194,10 @@ config NR_CPUS
  source kernel/Kconfig.hz
  
  config RWSEM_GENERIC_SPINLOCK
@@ -1660,7 +1621,7 @@ index 34a7930b76ef..773740521008 100644
  #ifdef CONFIG_HOTPLUG_CPU
  void fixup_irqs(void)
 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
-index 2a1f0ce7c59a..bd4ab87efb31 100644
+index bada636d1065..f8a995c90c01 100644
 --- a/arch/x86/Kconfig
 +++ b/arch/x86/Kconfig
 @@ -17,6 +17,7 @@ config X86_64
@@ -1671,7 +1632,7 @@ index 2a1f0ce7c59a..bd4ab87efb31 100644
        select ACPI_LEGACY_TABLES_LOOKUP        if ACPI
        select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
        select ANON_INODES
-@@ -231,8 +232,11 @@ config ARCH_MAY_HAVE_PC_FDC
+@@ -232,8 +233,11 @@ config ARCH_MAY_HAVE_PC_FDC
        def_bool y
        depends on ISA_DMA_API
  
@@ -1684,7 +1645,7 @@ index 2a1f0ce7c59a..bd4ab87efb31 100644
  
  config GENERIC_CALIBRATE_DELAY
        def_bool y
-@@ -885,7 +889,7 @@ config IOMMU_HELPER
+@@ -897,7 +901,7 @@ config IOMMU_HELPER
  config MAXSMP
        bool "Enable Maximum number of SMP Processors and NUMA Nodes"
        depends on X86_64 && SMP && DEBUG_KERNEL
@@ -1694,7 +1655,7 @@ index 2a1f0ce7c59a..bd4ab87efb31 100644
          Enable maximum number of CPUS and NUMA Nodes for this architecture.
          If unsure, say N.
 diff --git a/arch/x86/crypto/aesni-intel_glue.c 
b/arch/x86/crypto/aesni-intel_glue.c
-index 0ab5ee1c26af..fff8f6f1f90c 100644
+index aa8b0672f87a..2429414bfc71 100644
 --- a/arch/x86/crypto/aesni-intel_glue.c
 +++ b/arch/x86/crypto/aesni-intel_glue.c
 @@ -372,14 +372,14 @@ static int ecb_encrypt(struct blkcipher_desc *desc,
@@ -1992,10 +1953,10 @@ index 6a85598931b5..3a506ce7ed93 100644
  }
  EXPORT_SYMBOL_GPL(glue_xts_crypt_128bit);
 diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
-index 1433f6b4607d..f963fde8e4fa 100644
+index bdd9cc59d20f..56d01a339ba4 100644
 --- a/arch/x86/entry/common.c
 +++ b/arch/x86/entry/common.c
-@@ -136,7 +136,7 @@ static long syscall_trace_enter(struct pt_regs *regs)
+@@ -129,7 +129,7 @@ static long syscall_trace_enter(struct pt_regs *regs)
  
  #define EXIT_TO_USERMODE_LOOP_FLAGS                           \
        (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |   \
@@ -2004,7 +1965,7 @@ index 1433f6b4607d..f963fde8e4fa 100644
  
  static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags)
  {
-@@ -152,9 +152,16 @@ static void exit_to_usermode_loop(struct pt_regs *regs, 
u32 cached_flags)
+@@ -145,9 +145,16 @@ static void exit_to_usermode_loop(struct pt_regs *regs, 
u32 cached_flags)
                /* We have work to do. */
                local_irq_enable();
  
@@ -2023,10 +1984,10 @@ index 1433f6b4607d..f963fde8e4fa 100644
                        uprobe_notify_resume(regs);
  
 diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
-index 0b56666e6039..1d8ee026c9c5 100644
+index edba8606b99a..4a3389535fc6 100644
 --- a/arch/x86/entry/entry_32.S
 +++ b/arch/x86/entry/entry_32.S
-@@ -271,8 +271,25 @@ END(ret_from_exception)
+@@ -308,8 +308,25 @@ END(ret_from_exception)
  ENTRY(resume_kernel)
        DISABLE_INTERRUPTS(CLBR_ANY)
  need_resched:
@@ -2041,11 +2002,11 @@ index 0b56666e6039..1d8ee026c9c5 100644
 +      cmpl $_PREEMPT_ENABLED,PER_CPU_VAR(__preempt_count)
 +      jne restore_all
 +
-+      GET_THREAD_INFO(%ebp)
-+      cmpl $0,TI_preempt_lazy_count(%ebp)     # non-zero preempt_lazy_count ?
++      movl    PER_CPU_VAR(current_task), %ebp
++      cmpl $0,TASK_TI_preempt_lazy_count(%ebp)        # non-zero 
preempt_lazy_count ?
 +      jnz restore_all
 +
-+      testl $_TIF_NEED_RESCHED_LAZY, TI_flags(%ebp)
++      testl $_TIF_NEED_RESCHED_LAZY, TASK_TI_flags(%ebp)
 +      jz restore_all
 +test_int_off:
 +#endif
@@ -2053,10 +2014,10 @@ index 0b56666e6039..1d8ee026c9c5 100644
        jz      restore_all
        call    preempt_schedule_irq
 diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
-index 02fff3ebfb87..81ec3d016df0 100644
+index ef766a358b37..28401f826ab1 100644
 --- a/arch/x86/entry/entry_64.S
 +++ b/arch/x86/entry/entry_64.S
-@@ -512,7 +512,23 @@ GLOBAL(retint_user)
+@@ -546,7 +546,23 @@ GLOBAL(retint_user)
        bt      $9, EFLAGS(%rsp)                /* were interrupts off? */
        jnc     1f
  0:    cmpl    $0, PER_CPU_VAR(__preempt_count)
@@ -2069,18 +2030,18 @@ index 02fff3ebfb87..81ec3d016df0 100644
 +      cmpl $_PREEMPT_ENABLED,PER_CPU_VAR(__preempt_count)
 +      jnz     1f
 +
-+      GET_THREAD_INFO(%rcx)
-+      cmpl    $0, TI_preempt_lazy_count(%rcx)
++      movq    PER_CPU_VAR(current_task), %rcx
++      cmpl    $0, TASK_TI_preempt_lazy_count(%rcx)
 +      jnz     1f
 +
-+      bt      $TIF_NEED_RESCHED_LAZY,TI_flags(%rcx)
++      bt      $TIF_NEED_RESCHED_LAZY,TASK_TI_flags(%rcx)
 +      jnc     1f
 +do_preempt_schedule_irq:
 +#endif
        call    preempt_schedule_irq
        jmp     0b
  1:
-@@ -817,6 +833,7 @@ END(native_load_gs_index)
+@@ -894,6 +910,7 @@ EXPORT_SYMBOL(native_load_gs_index)
        jmp     2b
        .previous
  
@@ -2088,7 +2049,7 @@ index 02fff3ebfb87..81ec3d016df0 100644
  /* Call softirq on interrupt stack. Interrupts are off. */
  ENTRY(do_softirq_own_stack)
        pushq   %rbp
-@@ -829,6 +846,7 @@ ENTRY(do_softirq_own_stack)
+@@ -906,6 +923,7 @@ ENTRY(do_softirq_own_stack)
        decl    PER_CPU_VAR(irq_count)
        ret
  END(do_softirq_own_stack)
@@ -2149,12 +2110,12 @@ index 17f218645701..11bd1b7ee6eb 100644
  
  #ifdef CONFIG_PREEMPT
 diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
-index dd1e7d6387ab..d59bedb28bab 100644
+index 8af22be0fe61..d1328789b759 100644
 --- a/arch/x86/include/asm/signal.h
 +++ b/arch/x86/include/asm/signal.h
-@@ -23,6 +23,19 @@ typedef struct {
-       unsigned long sig[_NSIG_WORDS];
- } sigset_t;
+@@ -27,6 +27,19 @@ typedef struct {
+ #define SA_IA32_ABI   0x02000000u
+ #define SA_X32_ABI    0x01000000u
  
 +/*
 + * Because some traps use the IST stack, we must keep preemption
@@ -2202,19 +2163,25 @@ index 58505f01962f..02fa39652cd6 100644
        canary += tsc + (tsc << 32UL);
  
 diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
-index 8b7c8d8e0852..631059ef61da 100644
+index ad6f5eb07a95..5ceb3a1c2b1a 100644
 --- a/arch/x86/include/asm/thread_info.h
 +++ b/arch/x86/include/asm/thread_info.h
-@@ -57,6 +57,8 @@ struct thread_info {
-       __u32                   flags;          /* low level flags */
-       __u32                   status;         /* thread synchronous flags */
-       __u32                   cpu;            /* current CPU */
-+      int                     preempt_lazy_count;     /* 0 => lazy preemptable
+@@ -54,11 +54,14 @@ struct task_struct;
+ 
+ struct thread_info {
+       unsigned long           flags;          /* low level flags */
++      int                     preempt_lazy_count;     /* 0 => lazy preemptable
 +                                                         <0 => BUG */
  };
  
  #define INIT_THREAD_INFO(tsk)                 \
-@@ -73,6 +75,10 @@ struct thread_info {
+ {                                             \
+       .flags          = 0,                    \
++      .preempt_lazy_count = 0,                \
+ }
+ 
+ #define init_stack            (init_thread_union.stack)
+@@ -67,6 +70,10 @@ struct thread_info {
  
  #include <asm/asm-offsets.h>
  
@@ -2225,7 +2192,7 @@ index 8b7c8d8e0852..631059ef61da 100644
  #endif
  
  /*
-@@ -91,6 +97,7 @@ struct thread_info {
+@@ -85,6 +92,7 @@ struct thread_info {
  #define TIF_SYSCALL_EMU               6       /* syscall emulation active */
  #define TIF_SYSCALL_AUDIT     7       /* syscall auditing active */
  #define TIF_SECCOMP           8       /* secure computing */
@@ -2233,7 +2200,7 @@ index 8b7c8d8e0852..631059ef61da 100644
  #define TIF_USER_RETURN_NOTIFY        11      /* notify kernel of userspace 
return */
  #define TIF_UPROBE            12      /* breakpointed or singlestepping */
  #define TIF_NOTSC             16      /* TSC is not accessible in userland */
-@@ -115,6 +122,7 @@ struct thread_info {
+@@ -108,6 +116,7 @@ struct thread_info {
  #define _TIF_SYSCALL_EMU      (1 << TIF_SYSCALL_EMU)
  #define _TIF_SYSCALL_AUDIT    (1 << TIF_SYSCALL_AUDIT)
  #define _TIF_SECCOMP          (1 << TIF_SECCOMP)
@@ -2241,7 +2208,7 @@ index 8b7c8d8e0852..631059ef61da 100644
  #define _TIF_USER_RETURN_NOTIFY       (1 << TIF_USER_RETURN_NOTIFY)
  #define _TIF_UPROBE           (1 << TIF_UPROBE)
  #define _TIF_NOTSC            (1 << TIF_NOTSC)
-@@ -151,6 +159,8 @@ struct thread_info {
+@@ -143,6 +152,8 @@ struct thread_info {
  #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)
  #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW)
  
@@ -2251,10 +2218,10 @@ index 8b7c8d8e0852..631059ef61da 100644
  
  /*
 diff --git a/arch/x86/include/asm/uv/uv_bau.h 
b/arch/x86/include/asm/uv/uv_bau.h
-index cc44d926c17e..df278aa0f638 100644
+index 57ab86d94d64..35d25e27180f 100644
 --- a/arch/x86/include/asm/uv/uv_bau.h
 +++ b/arch/x86/include/asm/uv/uv_bau.h
-@@ -615,9 +615,9 @@ struct bau_control {
+@@ -624,9 +624,9 @@ struct bau_control {
        cycles_t                send_message;
        cycles_t                period_end;
        cycles_t                period_time;
@@ -2267,7 +2234,7 @@ index cc44d926c17e..df278aa0f638 100644
        /* tunables */
        int                     max_concurr;
        int                     max_concurr_const;
-@@ -776,15 +776,15 @@ static inline int atom_asr(short i, struct atomic_short 
*v)
+@@ -815,15 +815,15 @@ static inline int atom_asr(short i, struct atomic_short 
*v)
   * to be lowered below the current 'v'.  atomic_add_unless can only stop
   * on equal.
   */
@@ -2288,7 +2255,7 @@ index cc44d926c17e..df278aa0f638 100644
  }
  
 diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
-index fbd19444403f..e78f477a4ae3 100644
+index 931ced8ca345..167975ac8af7 100644
 --- a/arch/x86/kernel/acpi/boot.c
 +++ b/arch/x86/kernel/acpi/boot.c
 @@ -87,7 +87,9 @@ static u64 acpi_lapic_addr __initdata = 
APIC_DEFAULT_PHYS_BASE;
@@ -2316,25 +2283,25 @@ index 48e6d84f173e..0b5a8b994f65 100644
                return true;
        }
 diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c
-index 2bd5c6ff7ee7..a2c317f5839b 100644
+index c62e015b126c..0cc71257fca6 100644
 --- a/arch/x86/kernel/asm-offsets.c
 +++ b/arch/x86/kernel/asm-offsets.c
-@@ -31,6 +31,7 @@ void common(void) {
-       BLANK();
-       OFFSET(TI_flags, thread_info, flags);
-       OFFSET(TI_status, thread_info, status);
-+      OFFSET(TI_preempt_lazy_count, thread_info, preempt_lazy_count);
+@@ -36,6 +36,7 @@ void common(void) {
  
        BLANK();
+       OFFSET(TASK_TI_flags, task_struct, thread_info.flags);
++      OFFSET(TASK_TI_preempt_lazy_count, task_struct, 
thread_info.preempt_lazy_count);
        OFFSET(TASK_addr_limit, task_struct, thread.addr_limit);
-@@ -88,4 +89,5 @@ void common(void) {
+ 
+       BLANK();
+@@ -91,4 +92,5 @@ void common(void) {
  
        BLANK();
        DEFINE(PTREGS_SIZE, sizeof(struct pt_regs));
 +      DEFINE(_PREEMPT_ENABLED, PREEMPT_ENABLED);
  }
 diff --git a/arch/x86/kernel/cpu/mcheck/mce.c 
b/arch/x86/kernel/cpu/mcheck/mce.c
-index 79d8ec849468..accbf0e806d0 100644
+index a7fdf453d895..e3a0e969a66e 100644
 --- a/arch/x86/kernel/cpu/mcheck/mce.c
 +++ b/arch/x86/kernel/cpu/mcheck/mce.c
 @@ -41,6 +41,8 @@
@@ -2343,10 +2310,10 @@ index 79d8ec849468..accbf0e806d0 100644
  #include <linux/export.h>
 +#include <linux/jiffies.h>
 +#include <linux/swork.h>
+ #include <linux/jump_label.h>
  
  #include <asm/processor.h>
- #include <asm/traps.h>
-@@ -1291,7 +1293,7 @@ void mce_log_therm_throt_event(__u64 status)
+@@ -1317,7 +1319,7 @@ void mce_log_therm_throt_event(__u64 status)
  static unsigned long check_interval = INITIAL_CHECK_INTERVAL;
  
  static DEFINE_PER_CPU(unsigned long, mce_next_interval); /* in jiffies */
@@ -2355,7 +2322,7 @@ index 79d8ec849468..accbf0e806d0 100644
  
  static unsigned long mce_adjust_timer_default(unsigned long interval)
  {
-@@ -1300,32 +1302,18 @@ static unsigned long mce_adjust_timer_default(unsigned 
long interval)
+@@ -1326,32 +1328,18 @@ static unsigned long mce_adjust_timer_default(unsigned 
long interval)
  
  static unsigned long (*mce_adjust_timer)(unsigned long interval) = 
mce_adjust_timer_default;
  
@@ -2394,7 +2361,7 @@ index 79d8ec849468..accbf0e806d0 100644
        iv = __this_cpu_read(mce_next_interval);
  
        if (mce_available(this_cpu_ptr(&cpu_info))) {
-@@ -1348,7 +1336,7 @@ static void mce_timer_fn(unsigned long data)
+@@ -1374,7 +1362,7 @@ static void mce_timer_fn(unsigned long data)
  
  done:
        __this_cpu_write(mce_next_interval, iv);
@@ -2403,7 +2370,7 @@ index 79d8ec849468..accbf0e806d0 100644
  }
  
  /*
-@@ -1356,7 +1344,7 @@ static void mce_timer_fn(unsigned long data)
+@@ -1382,7 +1370,7 @@ static void mce_timer_fn(unsigned long data)
   */
  void mce_timer_kick(unsigned long interval)
  {
@@ -2412,7 +2379,7 @@ index 79d8ec849468..accbf0e806d0 100644
        unsigned long iv = __this_cpu_read(mce_next_interval);
  
        __restart_timer(t, interval);
-@@ -1371,7 +1359,7 @@ static void mce_timer_delete_all(void)
+@@ -1397,7 +1385,7 @@ static void mce_timer_delete_all(void)
        int cpu;
  
        for_each_online_cpu(cpu)
@@ -2421,7 +2388,7 @@ index 79d8ec849468..accbf0e806d0 100644
  }
  
  static void mce_do_trigger(struct work_struct *work)
-@@ -1381,6 +1369,56 @@ static void mce_do_trigger(struct work_struct *work)
+@@ -1407,6 +1395,56 @@ static void mce_do_trigger(struct work_struct *work)
  
  static DECLARE_WORK(mce_trigger_work, mce_do_trigger);
  
@@ -2478,7 +2445,7 @@ index 79d8ec849468..accbf0e806d0 100644
  /*
   * Notify the user(s) about new machine check events.
   * Can be called from interrupt context, but not from machine check/NMI
-@@ -1388,19 +1426,8 @@ static DECLARE_WORK(mce_trigger_work, mce_do_trigger);
+@@ -1414,19 +1452,8 @@ static DECLARE_WORK(mce_trigger_work, mce_do_trigger);
   */
  int mce_notify_irq(void)
  {
@@ -2499,7 +2466,7 @@ index 79d8ec849468..accbf0e806d0 100644
                return 1;
        }
        return 0;
-@@ -1717,7 +1744,7 @@ static void __mcheck_cpu_clear_vendor(struct cpuinfo_x86 
*c)
+@@ -1732,7 +1759,7 @@ static void __mcheck_cpu_clear_vendor(struct cpuinfo_x86 
*c)
        }
  }
  
@@ -2508,7 +2475,7 @@ index 79d8ec849468..accbf0e806d0 100644
  {
        unsigned long iv = check_interval * HZ;
  
-@@ -1726,16 +1753,17 @@ static void mce_start_timer(unsigned int cpu, struct 
timer_list *t)
+@@ -1741,16 +1768,17 @@ static void mce_start_timer(unsigned int cpu, struct 
timer_list *t)
  
        per_cpu(mce_next_interval, cpu) = iv;
  
@@ -2530,7 +2497,7 @@ index 79d8ec849468..accbf0e806d0 100644
        mce_start_timer(cpu, t);
  }
  
-@@ -2459,6 +2487,8 @@ static void mce_disable_cpu(void *h)
+@@ -2475,6 +2503,8 @@ static void mce_disable_cpu(void *h)
        if (!mce_available(raw_cpu_ptr(&cpu_info)))
                return;
  
@@ -2539,7 +2506,7 @@ index 79d8ec849468..accbf0e806d0 100644
        if (!(action & CPU_TASKS_FROZEN))
                cmci_clear();
  
-@@ -2481,6 +2511,7 @@ static void mce_reenable_cpu(void *h)
+@@ -2497,6 +2527,7 @@ static void mce_reenable_cpu(void *h)
                if (b->init)
                        wrmsrl(msr_ops.ctl(i), b->ctl);
        }
@@ -2547,7 +2514,7 @@ index 79d8ec849468..accbf0e806d0 100644
  }
  
  /* Get notified when a cpu comes on/off. Be hotplug friendly. */
-@@ -2488,7 +2519,6 @@ static int
+@@ -2504,7 +2535,6 @@ static int
  mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
  {
        unsigned int cpu = (unsigned long)hcpu;
@@ -2555,7 +2522,7 @@ index 79d8ec849468..accbf0e806d0 100644
  
        switch (action & ~CPU_TASKS_FROZEN) {
        case CPU_ONLINE:
-@@ -2508,11 +2538,9 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned 
long action, void *hcpu)
+@@ -2524,11 +2554,9 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned 
long action, void *hcpu)
                break;
        case CPU_DOWN_PREPARE:
                smp_call_function_single(cpu, mce_disable_cpu, &action, 1);
@@ -2567,7 +2534,7 @@ index 79d8ec849468..accbf0e806d0 100644
                break;
        }
  
-@@ -2551,6 +2579,10 @@ static __init int mcheck_init_device(void)
+@@ -2567,6 +2595,10 @@ static __init int mcheck_init_device(void)
                goto err_out;
        }
  
@@ -2578,68 +2545,6 @@ index 79d8ec849468..accbf0e806d0 100644
        if (!zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL)) {
                err = -ENOMEM;
                goto err_out;
-diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
-index 09675712eba8..eea7557b355d 100644
---- a/arch/x86/kernel/dumpstack_32.c
-+++ b/arch/x86/kernel/dumpstack_32.c
-@@ -42,7 +42,7 @@ void dump_trace(struct task_struct *task, struct pt_regs 
*regs,
-               unsigned long *stack, unsigned long bp,
-               const struct stacktrace_ops *ops, void *data)
- {
--      const unsigned cpu = get_cpu();
-+      const unsigned cpu = get_cpu_light();
-       int graph = 0;
-       u32 *prev_esp;
- 
-@@ -84,7 +84,7 @@ void dump_trace(struct task_struct *task, struct pt_regs 
*regs,
-                       break;
-               touch_nmi_watchdog();
-       }
--      put_cpu();
-+      put_cpu_light();
- }
- EXPORT_SYMBOL(dump_trace);
- 
-diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
-index 9ee4520ce83c..2cd610b68868 100644
---- a/arch/x86/kernel/dumpstack_64.c
-+++ b/arch/x86/kernel/dumpstack_64.c
-@@ -152,7 +152,7 @@ void dump_trace(struct task_struct *task, struct pt_regs 
*regs,
-               unsigned long *stack, unsigned long bp,
-               const struct stacktrace_ops *ops, void *data)
- {
--      const unsigned cpu = get_cpu();
-+      const unsigned cpu = get_cpu_light();
-       unsigned long *irq_stack = (unsigned long *)per_cpu(irq_stack_ptr, cpu);
-       unsigned long dummy;
-       unsigned used = 0;
-@@ -239,7 +239,7 @@ void dump_trace(struct task_struct *task, struct pt_regs 
*regs,
-        * This handles the process stack:
-        */
-       bp = ops->walk_stack(task, stack, bp, ops, data, NULL, &graph);
--      put_cpu();
-+      put_cpu_light();
- }
- EXPORT_SYMBOL(dump_trace);
- 
-@@ -253,7 +253,7 @@ show_stack_log_lvl(struct task_struct *task, struct 
pt_regs *regs,
-       int cpu;
-       int i;
- 
--      preempt_disable();
-+      migrate_disable();
-       cpu = smp_processor_id();
- 
-       irq_stack_end   = (unsigned long *)(per_cpu(irq_stack_ptr, cpu));
-@@ -299,7 +299,7 @@ show_stack_log_lvl(struct task_struct *task, struct 
pt_regs *regs,
-               stack++;
-               touch_nmi_watchdog();
-       }
--      preempt_enable();
-+      migrate_enable();
- 
-       pr_cont("\n");
-       show_trace_log_lvl(task, regs, sp, bp, log_lvl);
 diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
 index 1f38d9a4d9de..053bf3b2ef39 100644
 --- a/arch/x86/kernel/irq_32.c
@@ -2661,7 +2566,7 @@ index 1f38d9a4d9de..053bf3b2ef39 100644
  bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
  {
 diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
-index d86be29c38c7..b0e29d1a0571 100644
+index bd7be8efdc4c..b3b0a7f7b1ca 100644
 --- a/arch/x86/kernel/process_32.c
 +++ b/arch/x86/kernel/process_32.c
 @@ -35,6 +35,7 @@
@@ -2672,7 +2577,7 @@ index d86be29c38c7..b0e29d1a0571 100644
  
  #include <asm/pgtable.h>
  #include <asm/ldt.h>
-@@ -210,6 +211,35 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, 
unsigned long new_sp)
+@@ -195,6 +196,35 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, 
unsigned long new_sp)
  }
  EXPORT_SYMBOL_GPL(start_thread);
  
@@ -2708,7 +2613,7 @@ index d86be29c38c7..b0e29d1a0571 100644
  
  /*
   *    switch_to(x,y) should switch tasks from x to y.
-@@ -286,6 +316,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct 
*next_p)
+@@ -271,6 +301,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct 
*next_p)
                     task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT))
                __switch_to_xtra(prev_p, next_p, tss);
  
@@ -2718,10 +2623,10 @@ index d86be29c38c7..b0e29d1a0571 100644
         * Leave lazy mode, flushing any hypercalls made here.
         * This must be done before restoring TLS segments so
 diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
-index b62c85229711..d907b281a9d6 100644
+index 6f69340f9fa3..d47f204a0fbe 100644
 --- a/arch/x86/kvm/lapic.c
 +++ b/arch/x86/kvm/lapic.c
-@@ -1938,6 +1938,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
+@@ -1939,6 +1939,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
        hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC,
                     HRTIMER_MODE_ABS_PINNED);
        apic->lapic_timer.timer.function = apic_timer_fn;
@@ -2730,10 +2635,10 @@ index b62c85229711..d907b281a9d6 100644
        /*
         * APIC is created enabled. This will prevent kvm_lapic_set_base from
 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
-index 699f8726539a..24f30c86510c 100644
+index f3648c978d2f..d0d0901d1c56 100644
 --- a/arch/x86/kvm/x86.c
 +++ b/arch/x86/kvm/x86.c
-@@ -5865,6 +5865,13 @@ int kvm_arch_init(void *opaque)
+@@ -5930,6 +5930,13 @@ int kvm_arch_init(void *opaque)
                goto out;
        }
  
@@ -2832,10 +2737,10 @@ index ada98b39b8ad..585f6829653b 100644
                kmap_atomic_idx_pop();
        }
 diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
-index fdb4d42b4ce5..8ab90fbecff0 100644
+index 9e42842e924a..5398f97172f9 100644
 --- a/arch/x86/platform/uv/tlb_uv.c
 +++ b/arch/x86/platform/uv/tlb_uv.c
-@@ -729,9 +729,9 @@ static void destination_plugged(struct bau_desc *bau_desc,
+@@ -748,9 +748,9 @@ static void destination_plugged(struct bau_desc *bau_desc,
  
                quiesce_local_uvhub(hmaster);
  
@@ -2847,7 +2752,7 @@ index fdb4d42b4ce5..8ab90fbecff0 100644
  
                end_uvhub_quiesce(hmaster);
  
-@@ -751,9 +751,9 @@ static void destination_timeout(struct bau_desc *bau_desc,
+@@ -770,9 +770,9 @@ static void destination_timeout(struct bau_desc *bau_desc,
  
                quiesce_local_uvhub(hmaster);
  
@@ -2859,7 +2764,7 @@ index fdb4d42b4ce5..8ab90fbecff0 100644
  
                end_uvhub_quiesce(hmaster);
  
-@@ -774,7 +774,7 @@ static void disable_for_period(struct bau_control *bcp, 
struct ptc_stats *stat)
+@@ -793,7 +793,7 @@ static void disable_for_period(struct bau_control *bcp, 
struct ptc_stats *stat)
        cycles_t tm1;
  
        hmaster = bcp->uvhub_master;
@@ -2868,7 +2773,7 @@ index fdb4d42b4ce5..8ab90fbecff0 100644
        if (!bcp->baudisabled) {
                stat->s_bau_disabled++;
                tm1 = get_cycles();
-@@ -787,7 +787,7 @@ static void disable_for_period(struct bau_control *bcp, 
struct ptc_stats *stat)
+@@ -806,7 +806,7 @@ static void disable_for_period(struct bau_control *bcp, 
struct ptc_stats *stat)
                        }
                }
        }
@@ -2877,7 +2782,7 @@ index fdb4d42b4ce5..8ab90fbecff0 100644
  }
  
  static void count_max_concurr(int stat, struct bau_control *bcp,
-@@ -850,7 +850,7 @@ static void record_send_stats(cycles_t time1, cycles_t 
time2,
+@@ -869,7 +869,7 @@ static void record_send_stats(cycles_t time1, cycles_t 
time2,
   */
  static void uv1_throttle(struct bau_control *hmaster, struct ptc_stats *stat)
  {
@@ -2886,7 +2791,7 @@ index fdb4d42b4ce5..8ab90fbecff0 100644
        atomic_t *v;
  
        v = &hmaster->active_descriptor_count;
-@@ -983,7 +983,7 @@ static int check_enable(struct bau_control *bcp, struct 
ptc_stats *stat)
+@@ -1002,7 +1002,7 @@ static int check_enable(struct bau_control *bcp, struct 
ptc_stats *stat)
        struct bau_control *hmaster;
  
        hmaster = bcp->uvhub_master;
@@ -2895,7 +2800,7 @@ index fdb4d42b4ce5..8ab90fbecff0 100644
        if (bcp->baudisabled && (get_cycles() >= bcp->set_bau_on_time)) {
                stat->s_bau_reenabled++;
                for_each_present_cpu(tcpu) {
-@@ -995,10 +995,10 @@ static int check_enable(struct bau_control *bcp, struct 
ptc_stats *stat)
+@@ -1014,10 +1014,10 @@ static int check_enable(struct bau_control *bcp, 
struct ptc_stats *stat)
                                tbcp->period_giveups = 0;
                        }
                }
@@ -2908,10 +2813,10 @@ index fdb4d42b4ce5..8ab90fbecff0 100644
        return -1;
  }
  
-@@ -1916,9 +1916,9 @@ static void __init init_per_cpu_tunables(void)
+@@ -1940,9 +1940,9 @@ static void __init init_per_cpu_tunables(void)
                bcp->cong_reps                  = congested_reps;
-               bcp->disabled_period =          sec_2_cycles(disabled_period);
-               bcp->giveup_limit =             giveup_limit;
+               bcp->disabled_period            = sec_2_cycles(disabled_period);
+               bcp->giveup_limit               = giveup_limit;
 -              spin_lock_init(&bcp->queue_lock);
 -              spin_lock_init(&bcp->uvhub_lock);
 -              spin_lock_init(&bcp->disable_lock);
@@ -3006,7 +2911,7 @@ index b333fc45f9ec..8b85916e6986 100644
  
  /*
 diff --git a/block/blk-core.c b/block/blk-core.c
-index 36c7ac328d8c..caa5fc1be2a2 100644
+index 14d7c0740dc0..dfd905bea77c 100644
 --- a/block/blk-core.c
 +++ b/block/blk-core.c
 @@ -125,6 +125,9 @@ void blk_rq_init(struct request_queue *q, struct request 
*rq)
@@ -3055,7 +2960,7 @@ index 36c7ac328d8c..caa5fc1be2a2 100644
  
        /*
         * Init percpu_ref in atomic mode so that it's faster to shutdown.
-@@ -3171,7 +3174,7 @@ static void queue_unplugged(struct request_queue *q, 
unsigned int depth,
+@@ -3177,7 +3180,7 @@ static void queue_unplugged(struct request_queue *q, 
unsigned int depth,
                blk_run_queue_async(q);
        else
                __blk_run_queue(q);
@@ -3064,7 +2969,7 @@ index 36c7ac328d8c..caa5fc1be2a2 100644
  }
  
  static void flush_plug_callbacks(struct blk_plug *plug, bool from_schedule)
-@@ -3219,7 +3222,6 @@ EXPORT_SYMBOL(blk_check_plugged);
+@@ -3225,7 +3228,6 @@ EXPORT_SYMBOL(blk_check_plugged);
  void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
  {
        struct request_queue *q;
@@ -3072,7 +2977,7 @@ index 36c7ac328d8c..caa5fc1be2a2 100644
        struct request *rq;
        LIST_HEAD(list);
        unsigned int depth;
-@@ -3239,11 +3241,6 @@ void blk_flush_plug_list(struct blk_plug *plug, bool 
from_schedule)
+@@ -3245,11 +3247,6 @@ void blk_flush_plug_list(struct blk_plug *plug, bool 
from_schedule)
        q = NULL;
        depth = 0;
  
@@ -3084,7 +2989,7 @@ index 36c7ac328d8c..caa5fc1be2a2 100644
        while (!list_empty(&list)) {
                rq = list_entry_rq(list.next);
                list_del_init(&rq->queuelist);
-@@ -3256,7 +3253,7 @@ void blk_flush_plug_list(struct blk_plug *plug, bool 
from_schedule)
+@@ -3262,7 +3259,7 @@ void blk_flush_plug_list(struct blk_plug *plug, bool 
from_schedule)
                                queue_unplugged(q, depth, from_schedule);
                        q = rq->q;
                        depth = 0;
@@ -3093,7 +2998,7 @@ index 36c7ac328d8c..caa5fc1be2a2 100644
                }
  
                /*
-@@ -3283,8 +3280,6 @@ void blk_flush_plug_list(struct blk_plug *plug, bool 
from_schedule)
+@@ -3289,8 +3286,6 @@ void blk_flush_plug_list(struct blk_plug *plug, bool 
from_schedule)
         */
        if (q)
                queue_unplugged(q, depth, from_schedule);
@@ -3132,66 +3037,11 @@ index 381cb50a673c..dc8785233d94 100644
                        goto retry;
                }
        }
-diff --git a/block/blk-mq-cpu.c b/block/blk-mq-cpu.c
-index bb3ed488f7b5..628c6c13c482 100644
---- a/block/blk-mq-cpu.c
-+++ b/block/blk-mq-cpu.c
-@@ -16,7 +16,7 @@
- #include "blk-mq.h"
- 
- static LIST_HEAD(blk_mq_cpu_notify_list);
--static DEFINE_RAW_SPINLOCK(blk_mq_cpu_notify_lock);
-+static DEFINE_SPINLOCK(blk_mq_cpu_notify_lock);
- 
- static int blk_mq_main_cpu_notify(struct notifier_block *self,
-                                 unsigned long action, void *hcpu)
-@@ -25,7 +25,10 @@ static int blk_mq_main_cpu_notify(struct notifier_block 
*self,
-       struct blk_mq_cpu_notifier *notify;
-       int ret = NOTIFY_OK;
- 
--      raw_spin_lock(&blk_mq_cpu_notify_lock);
-+      if (action != CPU_POST_DEAD)
-+              return NOTIFY_OK;
-+
-+      spin_lock(&blk_mq_cpu_notify_lock);
- 
-       list_for_each_entry(notify, &blk_mq_cpu_notify_list, list) {
-               ret = notify->notify(notify->data, action, cpu);
-@@ -33,7 +36,7 @@ static int blk_mq_main_cpu_notify(struct notifier_block 
*self,
-                       break;
-       }
- 
--      raw_spin_unlock(&blk_mq_cpu_notify_lock);
-+      spin_unlock(&blk_mq_cpu_notify_lock);
-       return ret;
- }
- 
-@@ -41,16 +44,16 @@ void blk_mq_register_cpu_notifier(struct 
blk_mq_cpu_notifier *notifier)
- {
-       BUG_ON(!notifier->notify);
- 
--      raw_spin_lock(&blk_mq_cpu_notify_lock);
-+      spin_lock(&blk_mq_cpu_notify_lock);
-       list_add_tail(&notifier->list, &blk_mq_cpu_notify_list);
--      raw_spin_unlock(&blk_mq_cpu_notify_lock);
-+      spin_unlock(&blk_mq_cpu_notify_lock);
- }
- 
- void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier)
- {
--      raw_spin_lock(&blk_mq_cpu_notify_lock);
-+      spin_lock(&blk_mq_cpu_notify_lock);
-       list_del(&notifier->list);
--      raw_spin_unlock(&blk_mq_cpu_notify_lock);
-+      spin_unlock(&blk_mq_cpu_notify_lock);
- }
- 
- void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier,
 diff --git a/block/blk-mq.c b/block/blk-mq.c
-index c207fa9870eb..ac71b0455e9f 100644
+index ad459e4e8071..1bfacb205bfa 100644
 --- a/block/blk-mq.c
 +++ b/block/blk-mq.c
-@@ -92,7 +92,7 @@ EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_start);
+@@ -72,7 +72,7 @@ EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_start);
  
  static void blk_mq_freeze_queue_wait(struct request_queue *q)
  {
@@ -3200,7 +3050,7 @@ index c207fa9870eb..ac71b0455e9f 100644
  }
  
  /*
-@@ -130,7 +130,7 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
+@@ -110,7 +110,7 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
        WARN_ON_ONCE(freeze_depth < 0);
        if (!freeze_depth) {
                percpu_ref_reinit(&q->q_usage_counter);
@@ -3209,7 +3059,7 @@ index c207fa9870eb..ac71b0455e9f 100644
        }
  }
  EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
-@@ -149,7 +149,7 @@ void blk_mq_wake_waiters(struct request_queue *q)
+@@ -129,7 +129,7 @@ void blk_mq_wake_waiters(struct request_queue *q)
         * dying, we need to ensure that processes currently waiting on
         * the queue are notified as well.
         */
@@ -3218,7 +3068,7 @@ index c207fa9870eb..ac71b0455e9f 100644
  }
  
  bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx)
-@@ -197,6 +197,9 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, 
struct blk_mq_ctx *ctx,
+@@ -177,6 +177,9 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, 
struct blk_mq_ctx *ctx,
        rq->resid_len = 0;
        rq->sense = NULL;
  
@@ -3228,7 +3078,7 @@ index c207fa9870eb..ac71b0455e9f 100644
        INIT_LIST_HEAD(&rq->timeout_list);
        rq->timeout = 0;
  
-@@ -379,6 +382,17 @@ void blk_mq_end_request(struct request *rq, int error)
+@@ -345,6 +348,17 @@ void blk_mq_end_request(struct request *rq, int error)
  }
  EXPORT_SYMBOL(blk_mq_end_request);
  
@@ -3246,7 +3096,7 @@ index c207fa9870eb..ac71b0455e9f 100644
  static void __blk_mq_complete_request_remote(void *data)
  {
        struct request *rq = data;
-@@ -386,6 +400,8 @@ static void __blk_mq_complete_request_remote(void *data)
+@@ -352,6 +366,8 @@ static void __blk_mq_complete_request_remote(void *data)
        rq->q->softirq_done_fn(rq);
  }
  
@@ -3255,7 +3105,7 @@ index c207fa9870eb..ac71b0455e9f 100644
  static void blk_mq_ipi_complete_request(struct request *rq)
  {
        struct blk_mq_ctx *ctx = rq->mq_ctx;
-@@ -397,19 +413,23 @@ static void blk_mq_ipi_complete_request(struct request 
*rq)
+@@ -363,19 +379,23 @@ static void blk_mq_ipi_complete_request(struct request 
*rq)
                return;
        }
  
@@ -3281,10 +3131,10 @@ index c207fa9870eb..ac71b0455e9f 100644
  }
  
  static void __blk_mq_complete_request(struct request *rq)
-@@ -938,14 +958,14 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, 
bool async)
+@@ -917,14 +937,14 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, 
bool async)
                return;
  
-       if (!async) {
+       if (!async && !(hctx->flags & BLK_MQ_F_BLOCKING)) {
 -              int cpu = get_cpu();
 +              int cpu = get_cpu_light();
                if (cpumask_test_cpu(cpu, hctx->cpumask)) {
@@ -3298,21 +3148,12 @@ index c207fa9870eb..ac71b0455e9f 100644
 +              put_cpu_light();
        }
  
-       kblockd_schedule_delayed_work_on(blk_mq_hctx_next_cpu(hctx),
-@@ -1667,7 +1687,7 @@ static int blk_mq_hctx_notify(void *data, unsigned long 
action,
- {
-       struct blk_mq_hw_ctx *hctx = data;
- 
--      if (action == CPU_DEAD || action == CPU_DEAD_FROZEN)
-+      if (action == CPU_POST_DEAD)
-               return blk_mq_hctx_cpu_offline(hctx, cpu);
- 
-       /*
+       kblockd_schedule_work_on(blk_mq_hctx_next_cpu(hctx), &hctx->run_work);
 diff --git a/block/blk-mq.h b/block/blk-mq.h
-index 9087b11037b7..0401d76e827c 100644
+index e5d25249028c..1e846b842eab 100644
 --- a/block/blk-mq.h
 +++ b/block/blk-mq.h
-@@ -86,12 +86,12 @@ static inline struct blk_mq_ctx *__blk_mq_get_ctx(struct 
request_queue *q,
+@@ -72,12 +72,12 @@ static inline struct blk_mq_ctx *__blk_mq_get_ctx(struct 
request_queue *q,
   */
  static inline struct blk_mq_ctx *blk_mq_get_ctx(struct request_queue *q)
  {
@@ -3328,7 +3169,7 @@ index 9087b11037b7..0401d76e827c 100644
  
  struct blk_mq_alloc_data {
 diff --git a/block/blk-softirq.c b/block/blk-softirq.c
-index 53b1737e978d..81c3c0a62edf 100644
+index 06cf9807f49a..c40342643ca0 100644
 --- a/block/blk-softirq.c
 +++ b/block/blk-softirq.c
 @@ -51,6 +51,7 @@ static void trigger_softirq(void *data)
@@ -3339,15 +3180,15 @@ index 53b1737e978d..81c3c0a62edf 100644
  }
  
  /*
-@@ -93,6 +94,7 @@ static int blk_cpu_notify(struct notifier_block *self, 
unsigned long action,
-                                this_cpu_ptr(&blk_cpu_done));
-               raise_softirq_irqoff(BLOCK_SOFTIRQ);
-               local_irq_enable();
-+              preempt_check_resched_rt();
-       }
+@@ -89,6 +90,7 @@ static int blk_softirq_cpu_dead(unsigned int cpu)
+                        this_cpu_ptr(&blk_cpu_done));
+       raise_softirq_irqoff(BLOCK_SOFTIRQ);
+       local_irq_enable();
++      preempt_check_resched_rt();
  
-       return NOTIFY_OK;
-@@ -150,6 +152,7 @@ void __blk_complete_request(struct request *req)
+       return 0;
+ }
+@@ -141,6 +143,7 @@ void __blk_complete_request(struct request *req)
                goto do_local;
  
        local_irq_restore(flags);
@@ -3442,7 +3283,7 @@ index 7eefcdb00227..0ecc7f5a2f40 100644
  
  #endif        /* _CRYPTO_INTERNAL_H */
 diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
-index fded776236e2..bda523219d50 100644
+index 750fa824d42c..441edf51484a 100644
 --- a/drivers/acpi/acpica/acglobal.h
 +++ b/drivers/acpi/acpica/acglobal.h
 @@ -116,7 +116,7 @@ ACPI_GLOBAL(u8, acpi_gbl_global_lock_pending);
@@ -3618,7 +3459,7 @@ index 478cac2ed465..f7a6efdc3285 100644
  
  /* dynamic per-device compression frontend */
 diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
-index 04365b17ee67..b4a0577a4dbc 100644
+index 5497f7fc44d0..3826072a23c5 100644
 --- a/drivers/block/zram/zram_drv.c
 +++ b/drivers/block/zram/zram_drv.c
 @@ -519,6 +519,8 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, 
u64 disksize)
@@ -3793,7 +3634,7 @@ index 74fcf10da374..fd4020c99b9e 100644
 +
  #endif
 diff --git a/drivers/char/random.c b/drivers/char/random.c
-index 3efb3bf0ab83..c894d2e266f3 100644
+index d6876d506220..0c60b1e54579 100644
 --- a/drivers/char/random.c
 +++ b/drivers/char/random.c
 @@ -1028,8 +1028,6 @@ static void add_timer_randomness(struct timer_rand_state 
*state, unsigned num)
@@ -4009,7 +3850,7 @@ index 4da2af9694a2..5b6f57f500b8 100644
                goto err_unregister_clksrc;
  
 diff --git a/drivers/clocksource/timer-atmel-pit.c 
b/drivers/clocksource/timer-atmel-pit.c
-index 7f0f5b26d8c5..1553f19e73e7 100644
+index 6555821bbdae..93288849b2bd 100644
 --- a/drivers/clocksource/timer-atmel-pit.c
 +++ b/drivers/clocksource/timer-atmel-pit.c
 @@ -46,6 +46,7 @@ struct pit_data {
@@ -4050,7 +3891,7 @@ index 7f0f5b26d8c5..1553f19e73e7 100644
  
        /* update clocksource counter */
        data->cnt += data->cycle * PIT_PICNT(pit_read(data->base, 
AT91_PIT_PIVR));
-@@ -211,15 +226,6 @@ static int __init at91sam926x_pit_common_init(struct 
pit_data *data)
+@@ -230,15 +245,6 @@ static int __init at91sam926x_pit_dt_init(struct 
device_node *node)
                return ret;
        }
  
@@ -4198,10 +4039,10 @@ index adbd1de1cea5..1fac5074f2cf 100644
          This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors.
          Support for K10 and newer processors is now in acpi-cpufreq.
 diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
-index b35e5b6475b2..ce60807fb1d4 100644
+index a218c2e395e7..5273d8f1d5dd 100644
 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
 +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
-@@ -1302,7 +1302,9 @@ i915_gem_ringbuffer_submission(struct 
i915_execbuffer_params *params,
+@@ -1537,7 +1537,9 @@ execbuf_submit(struct i915_execbuffer_params *params,
        if (ret)
                return ret;
  
@@ -4212,7 +4053,7 @@ index b35e5b6475b2..ce60807fb1d4 100644
        i915_gem_execbuffer_move_to_active(vmas, params->request);
  
 diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c 
b/drivers/gpu/drm/i915/i915_gem_shrinker.c
-index 6f10b421487b..dd3a9a6ace11 100644
+index 1c237d02f30b..9e9b4404c0d7 100644
 --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
 +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
 @@ -40,7 +40,7 @@ static bool mutex_is_locked_by(struct mutex *mutex, struct 
task_struct *task)
@@ -4225,7 +4066,7 @@ index 6f10b421487b..dd3a9a6ace11 100644
  #else
        /* Since UP may be pre-empted, we cannot assume that we own the lock */
 diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
-index 1c2aec392412..1d85c0c791f1 100644
+index 3fc286cd1157..252a1117b103 100644
 --- a/drivers/gpu/drm/i915/i915_irq.c
 +++ b/drivers/gpu/drm/i915/i915_irq.c
 @@ -812,6 +812,7 @@ static int i915_get_crtc_scanoutpos(struct drm_device 
*dev, unsigned int pipe,
@@ -4245,10 +4086,10 @@ index 1c2aec392412..1d85c0c791f1 100644
        spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
  
 diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
-index e9a64fba6333..2aac27b13d86 100644
+index c9e83f39ec0a..6b0caae38076 100644
 --- a/drivers/gpu/drm/i915/intel_display.c
 +++ b/drivers/gpu/drm/i915/intel_display.c
-@@ -11647,7 +11647,7 @@ void intel_check_page_flip(struct drm_i915_private 
*dev_priv, int pipe)
+@@ -12131,7 +12131,7 @@ void intel_check_page_flip(struct drm_i915_private 
*dev_priv, int pipe)
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        struct intel_flip_work *work;
  
@@ -4258,18 +4099,18 @@ index e9a64fba6333..2aac27b13d86 100644
        if (crtc == NULL)
                return;
 diff --git a/drivers/gpu/drm/i915/intel_sprite.c 
b/drivers/gpu/drm/i915/intel_sprite.c
-index 4178849631ad..0eb939c92544 100644
+index dbed12c484c9..5c540b78e8b5 100644
 --- a/drivers/gpu/drm/i915/intel_sprite.c
 +++ b/drivers/gpu/drm/i915/intel_sprite.c
-@@ -38,6 +38,7 @@
+@@ -35,6 +35,7 @@
+ #include <drm/drm_rect.h>
+ #include <drm/drm_atomic.h>
+ #include <drm/drm_plane_helper.h>
++#include <linux/locallock.h>
  #include "intel_drv.h"
+ #include "intel_frontbuffer.h"
  #include <drm/i915_drm.h>
- #include "i915_drv.h"
-+#include <linux/locallock.h>
- 
- static bool
- format_is_yuv(uint32_t format)
-@@ -64,6 +65,8 @@ int intel_usecs_to_scanlines(const struct drm_display_mode 
*adjusted_mode,
+@@ -65,6 +66,8 @@ int intel_usecs_to_scanlines(const struct drm_display_mode 
*adjusted_mode,
                            1000 * adjusted_mode->crtc_htotal);
  }
  
@@ -4278,7 +4119,7 @@ index 4178849631ad..0eb939c92544 100644
  /**
   * intel_pipe_update_start() - start update of a set of display registers
   * @crtc: the crtc of which the registers are going to be updated
-@@ -94,7 +97,7 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
+@@ -95,7 +98,7 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
        min = vblank_start - intel_usecs_to_scanlines(adjusted_mode, 100);
        max = vblank_start - 1;
  
@@ -4287,7 +4128,7 @@ index 4178849631ad..0eb939c92544 100644
  
        if (min <= 0 || max <= 0)
                return;
-@@ -124,11 +127,11 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
+@@ -125,11 +128,11 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
                        break;
                }
  
@@ -4301,7 +4142,7 @@ index 4178849631ad..0eb939c92544 100644
        }
  
        finish_wait(wq, &wait);
-@@ -180,7 +183,7 @@ void intel_pipe_update_end(struct intel_crtc *crtc, struct 
intel_flip_work *work
+@@ -181,7 +184,7 @@ void intel_pipe_update_end(struct intel_crtc *crtc, struct 
intel_flip_work *work
                crtc->base.state->event = NULL;
        }
  
@@ -4311,7 +4152,7 @@ index 4178849631ad..0eb939c92544 100644
        if (crtc->debug.start_vbl_count &&
            crtc->debug.start_vbl_count != end_vbl_count) {
 diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c 
b/drivers/gpu/drm/msm/msm_gem_shrinker.c
-index 283d2841ba58..d01f6ed1977e 100644
+index 192b2d3a79cb..d5372a207326 100644
 --- a/drivers/gpu/drm/msm/msm_gem_shrinker.c
 +++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c
 @@ -23,7 +23,7 @@ static bool mutex_is_locked_by(struct mutex *mutex, struct 
task_struct *task)
@@ -4324,10 +4165,10 @@ index 283d2841ba58..d01f6ed1977e 100644
  #else
        /* Since UP may be pre-empted, we cannot assume that we own the lock */
 diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
-index c3206fb8f4cf..6e2423186e2a 100644
+index cdb8cb568c15..b6d7fd964cbc 100644
 --- a/drivers/gpu/drm/radeon/radeon_display.c
 +++ b/drivers/gpu/drm/radeon/radeon_display.c
-@@ -1869,6 +1869,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, 
unsigned int pipe,
+@@ -1845,6 +1845,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, 
unsigned int pipe,
        struct radeon_device *rdev = dev->dev_private;
  
        /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */
@@ -4335,7 +4176,7 @@ index c3206fb8f4cf..6e2423186e2a 100644
  
        /* Get optional system timestamp before query. */
        if (stime)
-@@ -1961,6 +1962,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, 
unsigned int pipe,
+@@ -1937,6 +1938,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, 
unsigned int pipe,
                *etime = ktime_get();
  
        /* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */
@@ -4344,7 +4185,7 @@ index c3206fb8f4cf..6e2423186e2a 100644
        /* Decode into vertical and horizontal scanout position. */
        *vpos = position & 0x1fff;
 diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
-index e82f7e1c217c..b57d917b6ab7 100644
+index 0276d2ef06ee..8868045eabde 100644
 --- a/drivers/hv/vmbus_drv.c
 +++ b/drivers/hv/vmbus_drv.c
 @@ -761,6 +761,8 @@ static void vmbus_isr(void)
@@ -4530,10 +4371,10 @@ index a716693417a3..be0568c722d6 100644
        ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE);
  
 diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c 
b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
-index d3394b6add24..506bfba6ec9f 100644
+index fddff403d5d2..cca1bb4fbfe3 100644
 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
 +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
-@@ -897,7 +897,7 @@ void ipoib_mcast_restart_task(struct work_struct *work)
+@@ -902,7 +902,7 @@ void ipoib_mcast_restart_task(struct work_struct *work)
  
        ipoib_dbg_mcast(priv, "restarting multicast task\n");
  
@@ -4542,7 +4383,7 @@ index d3394b6add24..506bfba6ec9f 100644
        netif_addr_lock(dev);
        spin_lock(&priv->lock);
  
-@@ -979,7 +979,7 @@ void ipoib_mcast_restart_task(struct work_struct *work)
+@@ -984,7 +984,7 @@ void ipoib_mcast_restart_task(struct work_struct *work)
  
        spin_unlock(&priv->lock);
        netif_addr_unlock(dev);
@@ -4601,10 +4442,10 @@ index 4a2a9e370be7..e970d9afd179 100644
                if (t2 - t1 < tx) tx = t2 - t1;
        }
 diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
-index 96de97a46079..a6ec875d941b 100644
+index 11a13b5be73a..baaed0ac274b 100644
 --- a/drivers/iommu/amd_iommu.c
 +++ b/drivers/iommu/amd_iommu.c
-@@ -1832,10 +1832,10 @@ static int __attach_device(struct iommu_dev_data 
*dev_data,
+@@ -1923,10 +1923,10 @@ static int __attach_device(struct iommu_dev_data 
*dev_data,
        int ret;
  
        /*
@@ -4618,7 +4459,7 @@ index 96de97a46079..a6ec875d941b 100644
  
        /* lock domain */
        spin_lock(&domain->lock);
-@@ -2003,10 +2003,10 @@ static void __detach_device(struct iommu_dev_data 
*dev_data)
+@@ -2094,10 +2094,10 @@ static void __detach_device(struct iommu_dev_data 
*dev_data)
        struct protection_domain *domain;
  
        /*
@@ -4633,7 +4474,7 @@ index 96de97a46079..a6ec875d941b 100644
        if (WARN_ON(!dev_data->domain))
                return;
 diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
-index ebb5bf3ddbd9..598f5df45f6b 100644
+index d82637ab09fd..ebe41d30c093 100644
 --- a/drivers/iommu/intel-iommu.c
 +++ b/drivers/iommu/intel-iommu.c
 @@ -479,7 +479,7 @@ struct deferred_flush_data {
@@ -4645,7 +4486,7 @@ index ebb5bf3ddbd9..598f5df45f6b 100644
  
  /* bitmap for indexing intel_iommus */
  static int g_num_of_iommus;
-@@ -3626,10 +3626,8 @@ static void add_unmap(struct dmar_domain *dom, unsigned 
long iova_pfn,
+@@ -3715,10 +3715,8 @@ static void add_unmap(struct dmar_domain *dom, unsigned 
long iova_pfn,
        struct intel_iommu *iommu;
        struct deferred_flush_entry *entry;
        struct deferred_flush_data *flush_data;
@@ -4657,7 +4498,7 @@ index ebb5bf3ddbd9..598f5df45f6b 100644
  
        /* Flush all CPUs' entries to avoid deferring too much.  If
         * this becomes a bottleneck, can just flush us, and rely on
-@@ -3662,8 +3660,6 @@ static void add_unmap(struct dmar_domain *dom, unsigned 
long iova_pfn,
+@@ -3751,8 +3749,6 @@ static void add_unmap(struct dmar_domain *dom, unsigned 
long iova_pfn,
        }
        flush_data->size++;
        spin_unlock_irqrestore(&flush_data->lock, flags);
@@ -4749,20 +4590,20 @@ index 4d200883c505..98b64ed5cb81 100644
        Allows a block device to be used as cache for other devices; uses
        a btree for indexing and the layout is optimized for SSDs.
 diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c
-index 5da86c8b6545..2aa092f2977e 100644
+index 31a89c8832c0..c3a7e8a9f761 100644
 --- a/drivers/md/dm-rq.c
 +++ b/drivers/md/dm-rq.c
-@@ -811,7 +811,7 @@ static void dm_old_request_fn(struct request_queue *q)
+@@ -838,7 +838,7 @@ static void dm_old_request_fn(struct request_queue *q)
                /* Establish tio->ti before queuing work (map_tio_request) */
                tio->ti = ti;
-               queue_kthread_work(&md->kworker, &tio->work);
+               kthread_queue_work(&md->kworker, &tio->work);
 -              BUG_ON(!irqs_disabled());
 +              BUG_ON_NONRT(!irqs_disabled());
        }
  }
  
 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
-index ee7fc3701700..ae59c9e13911 100644
+index cce6057b9aca..fa2c4de32a64 100644
 --- a/drivers/md/raid5.c
 +++ b/drivers/md/raid5.c
 @@ -1928,8 +1928,9 @@ static void raid_run_ops(struct stripe_head *sh, 
unsigned long ops_request)
@@ -4786,1358 +4627,72 @@ index ee7fc3701700..ae59c9e13911 100644
  }
  
  static struct stripe_head *alloc_stripe(struct kmem_cache *sc, gfp_t gfp,
-@@ -6438,6 +6440,7 @@ static int raid5_alloc_percpu(struct r5conf *conf)
-                              __func__, cpu);
-                       break;
-               }
-+              spin_lock_init(&per_cpu_ptr(conf->percpu, cpu)->lock);
+@@ -6391,6 +6393,7 @@ static int raid456_cpu_up_prepare(unsigned int cpu, 
struct hlist_node *node)
+                      __func__, cpu);
+               return -ENOMEM;
        }
-       put_online_cpus();
++      spin_lock_init(&per_cpu_ptr(conf->percpu, cpu)->lock);
+       return 0;
+ }
  
+@@ -6401,7 +6404,6 @@ static int raid5_alloc_percpu(struct r5conf *conf)
+       conf->percpu = alloc_percpu(struct raid5_percpu);
+       if (!conf->percpu)
+               return -ENOMEM;
+-
+       err = cpuhp_state_add_instance(CPUHP_MD_RAID5_PREPARE, &conf->node);
+       if (!err) {
+               conf->scribble_disks = max(conf->raid_disks,
 diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
-index 517d4b68a1be..efe91887ecd7 100644
+index 57ec49f0839e..0739604990b7 100644
 --- a/drivers/md/raid5.h
 +++ b/drivers/md/raid5.h
 @@ -504,6 +504,7 @@ struct r5conf {
        int                     recovery_disabled;
        /* per cpu variables */
        struct raid5_percpu {
-+              spinlock_t      lock;           /* Protection for -RT */
-               struct page     *spare_page; /* Used when checking P/Q in raid6 
*/
-               struct flex_array *scribble;   /* space for constructing buffer
-                                             * lists and performing address
-diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
-index d00252828966..9faab404faac 100644
---- a/drivers/misc/Kconfig
-+++ b/drivers/misc/Kconfig
-@@ -54,6 +54,7 @@ config AD525X_DPOT_SPI
- config ATMEL_TCLIB
-       bool "Atmel AT32/AT91 Timer/Counter Library"
-       depends on (AVR32 || ARCH_AT91)
-+      default y if PREEMPT_RT_FULL
-       help
-         Select this if you want a library to allocate the Timer/Counter
-         blocks found on many Atmel processors.  This facilitates using
-@@ -69,8 +70,7 @@ config ATMEL_TCB_CLKSRC
-         are combined to make a single 32-bit timer.
- 
-         When GENERIC_CLOCKEVENTS is defined, the third timer channel
--        may be used as a clock event device supporting oneshot mode
--        (delays of up to two seconds) based on the 32 KiHz clock.
-+        may be used as a clock event device supporting oneshot mode.
- 
- config ATMEL_TCB_CLKSRC_BLOCK
-       int
-@@ -84,6 +84,15 @@ config ATMEL_TCB_CLKSRC_BLOCK
-         TC can be used for other purposes, such as PWM generation and
-         interval timing.
- 
-+config ATMEL_TCB_CLKSRC_USE_SLOW_CLOCK
-+      bool "TC Block use 32 KiHz clock"
-+      depends on ATMEL_TCB_CLKSRC
-+      default y if !PREEMPT_RT_FULL
-+      help
-+        Select this to use 32 KiHz base clock rate as TC block clock
-+        source for clock events.
-+
-+
- config DUMMY_IRQ
-       tristate "Dummy IRQ handler"
-       default n
-@@ -114,6 +123,35 @@ config IBM_ASM
-         for information on the specific driver level and support statement
-         for your IBM server.
- 
-+config HWLAT_DETECTOR
-+      tristate "Testing module to detect hardware-induced latencies"
-+      depends on DEBUG_FS
-+      depends on RING_BUFFER
-+      default m
-+      ---help---
-+        A simple hardware latency detector. Use this module to detect
-+        large latencies introduced by the behavior of the underlying
-+        system firmware external to Linux. We do this using periodic
-+        use of stop_machine to grab all available CPUs and measure
-+        for unexplainable gaps in the CPU timestamp counter(s). By
-+        default, the module is not enabled until the "enable" file
-+        within the "hwlat_detector" debugfs directory is toggled.
-+
-+        This module is often used to detect SMI (System Management
-+        Interrupts) on x86 systems, though is not x86 specific. To
-+        this end, we default to using a sample window of 1 second,
-+        during which we will sample for 0.5 seconds. If an SMI or
-+        similar event occurs during that time, it is recorded
-+        into an 8K samples global ring buffer until retreived.
-+
-+        WARNING: This software should never be enabled (it can be built
-+        but should not be turned on after it is loaded) in a production
-+        environment where high latencies are a concern since the
-+        sampling mechanism actually introduces latencies for
-+        regular tasks while the CPU(s) are being held.
-+
-+        If unsure, say N
-+
- config PHANTOM
-       tristate "Sensable PHANToM (PCI)"
-       depends on PCI
-diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
-index fb32516ddfe2..8643df9af3c4 100644
---- a/drivers/misc/Makefile
-+++ b/drivers/misc/Makefile
-@@ -38,6 +38,7 @@ obj-$(CONFIG_C2PORT)         += c2port/
- obj-$(CONFIG_HMC6352)         += hmc6352.o
- obj-y                         += eeprom/
- obj-y                         += cb710/
-+obj-$(CONFIG_HWLAT_DETECTOR)  += hwlat_detector.o
- obj-$(CONFIG_SPEAR13XX_PCIE_GADGET)   += spear13xx_pcie_gadget.o
- obj-$(CONFIG_VMWARE_BALLOON)  += vmw_balloon.o
- obj-$(CONFIG_ARM_CHARLCD)     += arm-charlcd.o
-diff --git a/drivers/misc/hwlat_detector.c b/drivers/misc/hwlat_detector.c
-new file mode 100644
-index 000000000000..52f5ad5fd9c0
---- /dev/null
-+++ b/drivers/misc/hwlat_detector.c
-@@ -0,0 +1,1240 @@
-+/*
-+ * hwlat_detector.c - A simple Hardware Latency detector.
-+ *
-+ * Use this module to detect large system latencies induced by the behavior of
-+ * certain underlying system hardware or firmware, independent of Linux 
itself.
-+ * The code was developed originally to detect the presence of SMIs on Intel
-+ * and AMD systems, although there is no dependency upon x86 herein.
-+ *
-+ * The classical example usage of this module is in detecting the presence of
-+ * SMIs or System Management Interrupts on Intel and AMD systems. An SMI is a
-+ * somewhat special form of hardware interrupt spawned from earlier CPU debug
-+ * modes in which the (BIOS/EFI/etc.) firmware arranges for the South Bridge
-+ * LPC (or other device) to generate a special interrupt under certain
-+ * circumstances, for example, upon expiration of a special SMI timer device,
-+ * due to certain external thermal readings, on certain I/O address accesses,
-+ * and other situations. An SMI hits a special CPU pin, triggers a special
-+ * SMI mode (complete with special memory map), and the OS is unaware.
-+ *
-+ * Although certain hardware-inducing latencies are necessary (for example,
-+ * a modern system often requires an SMI handler for correct thermal control
-+ * and remote management) they can wreak havoc upon any OS-level performance
-+ * guarantees toward low-latency, especially when the OS is not even made
-+ * aware of the presence of these interrupts. For this reason, we need a
-+ * somewhat brute force mechanism to detect these interrupts. In this case,
-+ * we do it by hogging all of the CPU(s) for configurable timer intervals,
-+ * sampling the built-in CPU timer, looking for discontiguous readings.
-+ *
-+ * WARNING: This implementation necessarily introduces latencies. Therefore,
-+ *          you should NEVER use this module in a production environment
-+ *          requiring any kind of low-latency performance guarantee(s).
-+ *
-+ * Copyright (C) 2008-2009 Jon Masters, Red Hat, Inc. <[email protected]>
-+ *
-+ * Includes useful feedback from Clark Williams <[email protected]>
-+ *
-+ * This file is licensed under the terms of the GNU General Public
-+ * License version 2. This program is licensed "as is" without any
-+ * warranty of any kind, whether express or implied.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/ring_buffer.h>
-+#include <linux/time.h>
-+#include <linux/hrtimer.h>
-+#include <linux/kthread.h>
-+#include <linux/debugfs.h>
-+#include <linux/seq_file.h>
-+#include <linux/uaccess.h>
-+#include <linux/version.h>
-+#include <linux/delay.h>
-+#include <linux/slab.h>
-+#include <linux/trace_clock.h>
-+
-+#define BUF_SIZE_DEFAULT      262144UL                /* 8K*(sizeof(entry)) */
-+#define BUF_FLAGS             (RB_FL_OVERWRITE)       /* no block on full */
-+#define U64STR_SIZE           22                      /* 20 digits max */
-+
-+#define VERSION                       "1.0.0"
-+#define BANNER                        "hwlat_detector: "
-+#define DRVNAME                       "hwlat_detector"
-+#define DEFAULT_SAMPLE_WINDOW 1000000                 /* 1s */
-+#define DEFAULT_SAMPLE_WIDTH  500000                  /* 0.5s */
-+#define DEFAULT_LAT_THRESHOLD 10                      /* 10us */
-+
-+/* Module metadata */
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Jon Masters <[email protected]>");
-+MODULE_DESCRIPTION("A simple hardware latency detector");
-+MODULE_VERSION(VERSION);
-+
-+/* Module parameters */
-+
-+static int debug;
-+static int enabled;
-+static int threshold;
-+
-+module_param(debug, int, 0);                  /* enable debug */
-+module_param(enabled, int, 0);                        /* enable detector */
-+module_param(threshold, int, 0);              /* latency threshold */
-+
-+/* Buffering and sampling */
-+
-+static struct ring_buffer *ring_buffer;               /* sample buffer */
-+static DEFINE_MUTEX(ring_buffer_mutex);               /* lock changes */
-+static unsigned long buf_size = BUF_SIZE_DEFAULT;
-+static struct task_struct *kthread;           /* sampling thread */
-+
-+/* DebugFS filesystem entries */
-+
-+static struct dentry *debug_dir;              /* debugfs directory */
-+static struct dentry *debug_max;              /* maximum TSC delta */
-+static struct dentry *debug_count;            /* total detect count */
-+static struct dentry *debug_sample_width;     /* sample width us */
-+static struct dentry *debug_sample_window;    /* sample window us */
-+static struct dentry *debug_sample;           /* raw samples us */
-+static struct dentry *debug_threshold;                /* threshold us */
-+static struct dentry *debug_enable;           /* enable/disable */
-+
-+/* Individual samples and global state */
-+
-+struct sample;                                        /* latency sample */
-+struct data;                                  /* Global state */
-+
-+/* Sampling functions */
-+static int __buffer_add_sample(struct sample *sample);
-+static struct sample *buffer_get_sample(struct sample *sample);
-+
-+/* Threading and state */
-+static int kthread_fn(void *unused);
-+static int start_kthread(void);
-+static int stop_kthread(void);
-+static void __reset_stats(void);
-+static int init_stats(void);
-+
-+/* Debugfs interface */
-+static ssize_t simple_data_read(struct file *filp, char __user *ubuf,
-+                              size_t cnt, loff_t *ppos, const u64 *entry);
-+static ssize_t simple_data_write(struct file *filp, const char __user *ubuf,
-+                               size_t cnt, loff_t *ppos, u64 *entry);
-+static int debug_sample_fopen(struct inode *inode, struct file *filp);
-+static ssize_t debug_sample_fread(struct file *filp, char __user *ubuf,
-+                                size_t cnt, loff_t *ppos);
-+static int debug_sample_release(struct inode *inode, struct file *filp);
-+static int debug_enable_fopen(struct inode *inode, struct file *filp);
-+static ssize_t debug_enable_fread(struct file *filp, char __user *ubuf,
-+                                size_t cnt, loff_t *ppos);
-+static ssize_t debug_enable_fwrite(struct file *file,
-+                                 const char __user *user_buffer,
-+                                 size_t user_size, loff_t *offset);
-+
-+/* Initialization functions */
-+static int init_debugfs(void);
-+static void free_debugfs(void);
-+static int detector_init(void);
-+static void detector_exit(void);
-+
-+/* Individual latency samples are stored here when detected and packed into
-+ * the ring_buffer circular buffer, where they are overwritten when
-+ * more than buf_size/sizeof(sample) samples are received. */
-+struct sample {
-+      u64             seqnum;         /* unique sequence */
-+      u64             duration;       /* ktime delta */
-+      u64             outer_duration; /* ktime delta (outer loop) */
-+      struct timespec timestamp;      /* wall time */
-+      unsigned long   lost;
-+};
-+
-+/* keep the global state somewhere. */
-+static struct data {
-+
-+      struct mutex lock;              /* protect changes */
-+
-+      u64     count;                  /* total since reset */
-+      u64     max_sample;             /* max hardware latency */
-+      u64     threshold;              /* sample threshold level */
-+
-+      u64     sample_window;          /* total sampling window (on+off) */
-+      u64     sample_width;           /* active sampling portion of window */
-+
-+      atomic_t sample_open;           /* whether the sample file is open */
-+
-+      wait_queue_head_t wq;           /* waitqeue for new sample values */
-+
-+} data;
-+
-+/**
-+ * __buffer_add_sample - add a new latency sample recording to the ring buffer
-+ * @sample: The new latency sample value
-+ *
-+ * This receives a new latency sample and records it in a global ring buffer.
-+ * No additional locking is used in this case.
-+ */
-+static int __buffer_add_sample(struct sample *sample)
-+{
-+      return ring_buffer_write(ring_buffer,
-+                               sizeof(struct sample), sample);
-+}
-+
-+/**
-+ * buffer_get_sample - remove a hardware latency sample from the ring buffer
-+ * @sample: Pre-allocated storage for the sample
-+ *
-+ * This retrieves a hardware latency sample from the global circular buffer
-+ */
-+static struct sample *buffer_get_sample(struct sample *sample)
-+{
-+      struct ring_buffer_event *e = NULL;
-+      struct sample *s = NULL;
-+      unsigned int cpu = 0;
-+
-+      if (!sample)
-+              return NULL;
-+
-+      mutex_lock(&ring_buffer_mutex);
-+      for_each_online_cpu(cpu) {
-+              e = ring_buffer_consume(ring_buffer, cpu, NULL, &sample->lost);
-+              if (e)
-+                      break;
-+      }
-+
-+      if (e) {
-+              s = ring_buffer_event_data(e);
-+              memcpy(sample, s, sizeof(struct sample));
-+      } else
-+              sample = NULL;
-+      mutex_unlock(&ring_buffer_mutex);
-+
-+      return sample;
-+}
-+
-+#ifndef CONFIG_TRACING
-+#define time_type     ktime_t
-+#define time_get()    ktime_get()
-+#define time_to_us(x) ktime_to_us(x)
-+#define time_sub(a, b)        ktime_sub(a, b)
-+#define init_time(a, b)       (a).tv64 = b
-+#define time_u64(a)   ((a).tv64)
-+#else
-+#define time_type     u64
-+#define time_get()    trace_clock_local()
-+#define time_to_us(x) div_u64(x, 1000)
-+#define time_sub(a, b)        ((a) - (b))
-+#define init_time(a, b)       (a = b)
-+#define time_u64(a)   a
-+#endif
-+/**
-+ * get_sample - sample the CPU TSC and look for likely hardware latencies
-+ *
-+ * Used to repeatedly capture the CPU TSC (or similar), looking for potential
-+ * hardware-induced latency. Called with interrupts disabled and with
-+ * data.lock held.
-+ */
-+static int get_sample(void)
-+{
-+      time_type start, t1, t2, last_t2;
-+      s64 diff, total = 0;
-+      u64 sample = 0;
-+      u64 outer_sample = 0;
-+      int ret = -1;
-+
-+      init_time(last_t2, 0);
-+      start = time_get(); /* start timestamp */
-+
-+      do {
-+
-+              t1 = time_get();        /* we'll look for a discontinuity */
-+              t2 = time_get();
-+
-+              if (time_u64(last_t2)) {
-+                      /* Check the delta from outer loop (t2 to next t1) */
-+                      diff = time_to_us(time_sub(t1, last_t2));
-+                      /* This shouldn't happen */
-+                      if (diff < 0) {
-+                              pr_err(BANNER "time running backwards\n");
-+                              goto out;
-+                      }
-+                      if (diff > outer_sample)
-+                              outer_sample = diff;
-+              }
-+              last_t2 = t2;
-+
-+              total = time_to_us(time_sub(t2, start)); /* sample width */
-+
-+              /* This checks the inner loop (t1 to t2) */
-+              diff = time_to_us(time_sub(t2, t1));     /* current diff */
-+
-+              /* This shouldn't happen */
-+              if (diff < 0) {
-+                      pr_err(BANNER "time running backwards\n");
-+                      goto out;
-+              }
-+
-+              if (diff > sample)
-+                      sample = diff; /* only want highest value */
-+
-+      } while (total <= data.sample_width);
-+
-+      ret = 0;
-+
-+      /* If we exceed the threshold value, we have found a hardware latency */
-+      if (sample > data.threshold || outer_sample > data.threshold) {
-+              struct sample s;
-+
-+              ret = 1;
-+
-+              data.count++;
-+              s.seqnum = data.count;
-+              s.duration = sample;
-+              s.outer_duration = outer_sample;
-+              s.timestamp = CURRENT_TIME;
-+              __buffer_add_sample(&s);
-+
-+              /* Keep a running maximum ever recorded hardware latency */
-+              if (sample > data.max_sample)
-+                      data.max_sample = sample;
-+      }
-+
-+out:
-+      return ret;
-+}
-+
-+/*
-+ * kthread_fn - The CPU time sampling/hardware latency detection kernel thread
-+ * @unused: A required part of the kthread API.
-+ *
-+ * Used to periodically sample the CPU TSC via a call to get_sample. We
-+ * disable interrupts, which does (intentionally) introduce latency since we
-+ * need to ensure nothing else might be running (and thus pre-empting).
-+ * Obviously this should never be used in production environments.
-+ *
-+ * Currently this runs on which ever CPU it was scheduled on, but most
-+ * real-worald hardware latency situations occur across several CPUs,
-+ * but we might later generalize this if we find there are any actualy
-+ * systems with alternate SMI delivery or other hardware latencies.
-+ */
-+static int kthread_fn(void *unused)
-+{
-+      int ret;
-+      u64 interval;
-+
-+      while (!kthread_should_stop()) {
-+
-+              mutex_lock(&data.lock);
-+
-+              local_irq_disable();
-+              ret = get_sample();
-+              local_irq_enable();
-+
-+              if (ret > 0)
-+                      wake_up(&data.wq); /* wake up reader(s) */
-+
-+              interval = data.sample_window - data.sample_width;
-+              do_div(interval, USEC_PER_MSEC); /* modifies interval value */
-+
-+              mutex_unlock(&data.lock);
-+
-+              if (msleep_interruptible(interval))
-+                      break;
-+      }
-+
-+      return 0;
-+}
-+
-+/**
-+ * start_kthread - Kick off the hardware latency sampling/detector kthread
-+ *
-+ * This starts a kernel thread that will sit and sample the CPU timestamp
-+ * counter (TSC or similar) and look for potential hardware latencies.
-+ */
-+static int start_kthread(void)
-+{
-+      kthread = kthread_run(kthread_fn, NULL,
-+                                      DRVNAME);
-+      if (IS_ERR(kthread)) {
-+              pr_err(BANNER "could not start sampling thread\n");
-+              enabled = 0;
-+              return -ENOMEM;
-+      }
-+
-+      return 0;
-+}
-+
-+/**
-+ * stop_kthread - Inform the hardware latency samping/detector kthread to stop
-+ *
-+ * This kicks the running hardware latency sampling/detector kernel thread and
-+ * tells it to stop sampling now. Use this on unload and at system shutdown.
-+ */
-+static int stop_kthread(void)
-+{
-+      int ret;
-+
-+      ret = kthread_stop(kthread);
-+
-+      return ret;
-+}
-+
-+/**
-+ * __reset_stats - Reset statistics for the hardware latency detector
-+ *
-+ * We use data to store various statistics and global state. We call this
-+ * function in order to reset those when "enable" is toggled on or off, and
-+ * also at initialization. Should be called with data.lock held.
-+ */
-+static void __reset_stats(void)
-+{
-+      data.count = 0;
-+      data.max_sample = 0;
-+      ring_buffer_reset(ring_buffer); /* flush out old sample entries */
-+}
-+
-+/**
-+ * init_stats - Setup global state statistics for the hardware latency 
detector
-+ *
-+ * We use data to store various statistics and global state. We also use
-+ * a global ring buffer (ring_buffer) to keep raw samples of detected hardware
-+ * induced system latencies. This function initializes these structures and
-+ * allocates the global ring buffer also.
-+ */
-+static int init_stats(void)
-+{
-+      int ret = -ENOMEM;
-+
-+      mutex_init(&data.lock);
-+      init_waitqueue_head(&data.wq);
-+      atomic_set(&data.sample_open, 0);
-+
-+      ring_buffer = ring_buffer_alloc(buf_size, BUF_FLAGS);
-+
-+      if (WARN(!ring_buffer, KERN_ERR BANNER
-+                             "failed to allocate ring buffer!\n"))
-+              goto out;
-+
-+      __reset_stats();
-+      data.threshold = threshold ?: DEFAULT_LAT_THRESHOLD; /* threshold us */
-+      data.sample_window = DEFAULT_SAMPLE_WINDOW; /* window us */
-+      data.sample_width = DEFAULT_SAMPLE_WIDTH;   /* width us */
-+
-+      ret = 0;
-+
-+out:
-+      return ret;
-+
-+}
-+
-+/*
-+ * simple_data_read - Wrapper read function for global state debugfs entries
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The userspace provided buffer to read value into
-+ * @cnt: The maximum number of bytes to read
-+ * @ppos: The current "file" position
-+ * @entry: The entry to read from
-+ *
-+ * This function provides a generic read implementation for the global state
-+ * "data" structure debugfs filesystem entries. It would be nice to use
-+ * simple_attr_read directly, but we need to make sure that the data.lock
-+ * is held during the actual read.
-+ */
-+static ssize_t simple_data_read(struct file *filp, char __user *ubuf,
-+                              size_t cnt, loff_t *ppos, const u64 *entry)
-+{
-+      char buf[U64STR_SIZE];
-+      u64 val = 0;
-+      int len = 0;
-+
-+      memset(buf, 0, sizeof(buf));
-+
-+      if (!entry)
-+              return -EFAULT;
-+
-+      mutex_lock(&data.lock);
-+      val = *entry;
-+      mutex_unlock(&data.lock);
-+
-+      len = snprintf(buf, sizeof(buf), "%llu\n", (unsigned long long)val);
-+
-+      return simple_read_from_buffer(ubuf, cnt, ppos, buf, len);
-+
-+}
-+
-+/*
-+ * simple_data_write - Wrapper write function for global state debugfs entries
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The userspace provided buffer to write value from
-+ * @cnt: The maximum number of bytes to write
-+ * @ppos: The current "file" position
-+ * @entry: The entry to write to
-+ *
-+ * This function provides a generic write implementation for the global state
-+ * "data" structure debugfs filesystem entries. It would be nice to use
-+ * simple_attr_write directly, but we need to make sure that the data.lock
-+ * is held during the actual write.
-+ */
-+static ssize_t simple_data_write(struct file *filp, const char __user *ubuf,
-+                               size_t cnt, loff_t *ppos, u64 *entry)
-+{
-+      char buf[U64STR_SIZE];
-+      int csize = min(cnt, sizeof(buf));
-+      u64 val = 0;
-+      int err = 0;
-+
-+      memset(buf, '\0', sizeof(buf));
-+      if (copy_from_user(buf, ubuf, csize))
-+              return -EFAULT;
-+
-+      buf[U64STR_SIZE-1] = '\0';                      /* just in case */
-+      err = kstrtoull(buf, 10, &val);
-+      if (err)
-+              return -EINVAL;
-+
-+      mutex_lock(&data.lock);
-+      *entry = val;
-+      mutex_unlock(&data.lock);
-+
-+      return csize;
-+}
-+
-+/**
-+ * debug_count_fopen - Open function for "count" debugfs entry
-+ * @inode: The in-kernel inode representation of the debugfs "file"
-+ * @filp: The active open file structure for the debugfs "file"
-+ *
-+ * This function provides an open implementation for the "count" debugfs
-+ * interface to the hardware latency detector.
-+ */
-+static int debug_count_fopen(struct inode *inode, struct file *filp)
-+{
-+      return 0;
-+}
-+
-+/**
-+ * debug_count_fread - Read function for "count" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The userspace provided buffer to read value into
-+ * @cnt: The maximum number of bytes to read
-+ * @ppos: The current "file" position
-+ *
-+ * This function provides a read implementation for the "count" debugfs
-+ * interface to the hardware latency detector. Can be used to read the
-+ * number of latency readings exceeding the configured threshold since
-+ * the detector was last reset (e.g. by writing a zero into "count").
-+ */
-+static ssize_t debug_count_fread(struct file *filp, char __user *ubuf,
-+                                   size_t cnt, loff_t *ppos)
-+{
-+      return simple_data_read(filp, ubuf, cnt, ppos, &data.count);
-+}
-+
-+/**
-+ * debug_count_fwrite - Write function for "count" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The user buffer that contains the value to write
-+ * @cnt: The maximum number of bytes to write to "file"
-+ * @ppos: The current position in the debugfs "file"
-+ *
-+ * This function provides a write implementation for the "count" debugfs
-+ * interface to the hardware latency detector. Can be used to write a
-+ * desired value, especially to zero the total count.
-+ */
-+static ssize_t  debug_count_fwrite(struct file *filp,
-+                                     const char __user *ubuf,
-+                                     size_t cnt,
-+                                     loff_t *ppos)
-+{
-+      return simple_data_write(filp, ubuf, cnt, ppos, &data.count);
-+}
-+
-+/**
-+ * debug_enable_fopen - Dummy open function for "enable" debugfs interface
-+ * @inode: The in-kernel inode representation of the debugfs "file"
-+ * @filp: The active open file structure for the debugfs "file"
-+ *
-+ * This function provides an open implementation for the "enable" debugfs
-+ * interface to the hardware latency detector.
-+ */
-+static int debug_enable_fopen(struct inode *inode, struct file *filp)
-+{
-+      return 0;
-+}
-+
-+/**
-+ * debug_enable_fread - Read function for "enable" debugfs interface
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The userspace provided buffer to read value into
-+ * @cnt: The maximum number of bytes to read
-+ * @ppos: The current "file" position
-+ *
-+ * This function provides a read implementation for the "enable" debugfs
-+ * interface to the hardware latency detector. Can be used to determine
-+ * whether the detector is currently enabled ("0\n" or "1\n" returned).
-+ */
-+static ssize_t debug_enable_fread(struct file *filp, char __user *ubuf,
-+                                    size_t cnt, loff_t *ppos)
-+{
-+      char buf[4];
-+
-+      if ((cnt < sizeof(buf)) || (*ppos))
-+              return 0;
-+
-+      buf[0] = enabled ? '1' : '0';
-+      buf[1] = '\n';
-+      buf[2] = '\0';
-+      if (copy_to_user(ubuf, buf, strlen(buf)))
-+              return -EFAULT;
-+      return *ppos = strlen(buf);
-+}
-+
-+/**
-+ * debug_enable_fwrite - Write function for "enable" debugfs interface
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The user buffer that contains the value to write
-+ * @cnt: The maximum number of bytes to write to "file"
-+ * @ppos: The current position in the debugfs "file"
-+ *
-+ * This function provides a write implementation for the "enable" debugfs
-+ * interface to the hardware latency detector. Can be used to enable or
-+ * disable the detector, which will have the side-effect of possibly
-+ * also resetting the global stats and kicking off the measuring
-+ * kthread (on an enable) or the converse (upon a disable).
-+ */
-+static ssize_t  debug_enable_fwrite(struct file *filp,
-+                                      const char __user *ubuf,
-+                                      size_t cnt,
-+                                      loff_t *ppos)
-+{
-+      char buf[4];
-+      int csize = min(cnt, sizeof(buf));
-+      long val = 0;
-+      int err = 0;
-+
-+      memset(buf, '\0', sizeof(buf));
-+      if (copy_from_user(buf, ubuf, csize))
-+              return -EFAULT;
-+
-+      buf[sizeof(buf)-1] = '\0';                      /* just in case */
-+      err = kstrtoul(buf, 10, &val);
-+      if (err)
-+              return -EINVAL;
-+
-+      if (val) {
-+              if (enabled)
-+                      goto unlock;
-+              enabled = 1;
-+              __reset_stats();
-+              if (start_kthread())
-+                      return -EFAULT;
-+      } else {
-+              if (!enabled)
-+                      goto unlock;
-+              enabled = 0;
-+              err = stop_kthread();
-+              if (err) {
-+                      pr_err(BANNER "cannot stop kthread\n");
-+                      return -EFAULT;
-+              }
-+              wake_up(&data.wq);              /* reader(s) should return */
-+      }
-+unlock:
-+      return csize;
-+}
-+
-+/**
-+ * debug_max_fopen - Open function for "max" debugfs entry
-+ * @inode: The in-kernel inode representation of the debugfs "file"
-+ * @filp: The active open file structure for the debugfs "file"
-+ *
-+ * This function provides an open implementation for the "max" debugfs
-+ * interface to the hardware latency detector.
-+ */
-+static int debug_max_fopen(struct inode *inode, struct file *filp)
-+{
-+      return 0;
-+}
-+
-+/**
-+ * debug_max_fread - Read function for "max" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The userspace provided buffer to read value into
-+ * @cnt: The maximum number of bytes to read
-+ * @ppos: The current "file" position
-+ *
-+ * This function provides a read implementation for the "max" debugfs
-+ * interface to the hardware latency detector. Can be used to determine
-+ * the maximum latency value observed since it was last reset.
-+ */
-+static ssize_t debug_max_fread(struct file *filp, char __user *ubuf,
-+                                 size_t cnt, loff_t *ppos)
-+{
-+      return simple_data_read(filp, ubuf, cnt, ppos, &data.max_sample);
-+}
-+
-+/**
-+ * debug_max_fwrite - Write function for "max" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The user buffer that contains the value to write
-+ * @cnt: The maximum number of bytes to write to "file"
-+ * @ppos: The current position in the debugfs "file"
-+ *
-+ * This function provides a write implementation for the "max" debugfs
-+ * interface to the hardware latency detector. Can be used to reset the
-+ * maximum or set it to some other desired value - if, then, subsequent
-+ * measurements exceed this value, the maximum will be updated.
-+ */
-+static ssize_t  debug_max_fwrite(struct file *filp,
-+                                   const char __user *ubuf,
-+                                   size_t cnt,
-+                                   loff_t *ppos)
-+{
-+      return simple_data_write(filp, ubuf, cnt, ppos, &data.max_sample);
-+}
-+
-+
-+/**
-+ * debug_sample_fopen - An open function for "sample" debugfs interface
-+ * @inode: The in-kernel inode representation of this debugfs "file"
-+ * @filp: The active open file structure for the debugfs "file"
-+ *
-+ * This function handles opening the "sample" file within the hardware
-+ * latency detector debugfs directory interface. This file is used to read
-+ * raw samples from the global ring_buffer and allows the user to see a
-+ * running latency history. Can be opened blocking or non-blocking,
-+ * affecting whether it behaves as a buffer read pipe, or does not.
-+ * Implements simple locking to prevent multiple simultaneous use.
-+ */
-+static int debug_sample_fopen(struct inode *inode, struct file *filp)
-+{
-+      if (!atomic_add_unless(&data.sample_open, 1, 1))
-+              return -EBUSY;
-+      else
-+              return 0;
-+}
-+
-+/**
-+ * debug_sample_fread - A read function for "sample" debugfs interface
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The user buffer that will contain the samples read
-+ * @cnt: The maximum bytes to read from the debugfs "file"
-+ * @ppos: The current position in the debugfs "file"
-+ *
-+ * This function handles reading from the "sample" file within the hardware
-+ * latency detector debugfs directory interface. This file is used to read
-+ * raw samples from the global ring_buffer and allows the user to see a
-+ * running latency history. By default this will block pending a new
-+ * value written into the sample buffer, unless there are already a
-+ * number of value(s) waiting in the buffer, or the sample file was
-+ * previously opened in a non-blocking mode of operation.
-+ */
-+static ssize_t debug_sample_fread(struct file *filp, char __user *ubuf,
-+                                      size_t cnt, loff_t *ppos)
-+{
-+      int len = 0;
-+      char buf[64];
-+      struct sample *sample = NULL;
-+
-+      if (!enabled)
-+              return 0;
-+
-+      sample = kzalloc(sizeof(struct sample), GFP_KERNEL);
-+      if (!sample)
-+              return -ENOMEM;
-+
-+      while (!buffer_get_sample(sample)) {
-+
-+              DEFINE_WAIT(wait);
-+
-+              if (filp->f_flags & O_NONBLOCK) {
-+                      len = -EAGAIN;
-+                      goto out;
-+              }
-+
-+              prepare_to_wait(&data.wq, &wait, TASK_INTERRUPTIBLE);
-+              schedule();
-+              finish_wait(&data.wq, &wait);
-+
-+              if (signal_pending(current)) {
-+                      len = -EINTR;
-+                      goto out;
-+              }
-+
-+              if (!enabled) {                 /* enable was toggled */
-+                      len = 0;
-+                      goto out;
-+              }
-+      }
-+
-+      len = snprintf(buf, sizeof(buf), "%010lu.%010lu\t%llu\t%llu\n",
-+                     sample->timestamp.tv_sec,
-+                     sample->timestamp.tv_nsec,
-+                     sample->duration,
-+                     sample->outer_duration);
-+
-+
-+      /* handling partial reads is more trouble than it's worth */
-+      if (len > cnt)
-+              goto out;
-+
-+      if (copy_to_user(ubuf, buf, len))
-+              len = -EFAULT;
-+
-+out:
-+      kfree(sample);
-+      return len;
-+}
-+
-+/**
-+ * debug_sample_release - Release function for "sample" debugfs interface
-+ * @inode: The in-kernel inode represenation of the debugfs "file"
-+ * @filp: The active open file structure for the debugfs "file"
-+ *
-+ * This function completes the close of the debugfs interface "sample" file.
-+ * Frees the sample_open "lock" so that other users may open the interface.
-+ */
-+static int debug_sample_release(struct inode *inode, struct file *filp)
-+{
-+      atomic_dec(&data.sample_open);
-+
-+      return 0;
-+}
-+
-+/**
-+ * debug_threshold_fopen - Open function for "threshold" debugfs entry
-+ * @inode: The in-kernel inode representation of the debugfs "file"
-+ * @filp: The active open file structure for the debugfs "file"
-+ *
-+ * This function provides an open implementation for the "threshold" debugfs
-+ * interface to the hardware latency detector.
-+ */
-+static int debug_threshold_fopen(struct inode *inode, struct file *filp)
-+{
-+      return 0;
-+}
-+
-+/**
-+ * debug_threshold_fread - Read function for "threshold" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The userspace provided buffer to read value into
-+ * @cnt: The maximum number of bytes to read
-+ * @ppos: The current "file" position
-+ *
-+ * This function provides a read implementation for the "threshold" debugfs
-+ * interface to the hardware latency detector. It can be used to determine
-+ * the current threshold level at which a latency will be recorded in the
-+ * global ring buffer, typically on the order of 10us.
-+ */
-+static ssize_t debug_threshold_fread(struct file *filp, char __user *ubuf,
-+                                       size_t cnt, loff_t *ppos)
-+{
-+      return simple_data_read(filp, ubuf, cnt, ppos, &data.threshold);
-+}
-+
-+/**
-+ * debug_threshold_fwrite - Write function for "threshold" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The user buffer that contains the value to write
-+ * @cnt: The maximum number of bytes to write to "file"
-+ * @ppos: The current position in the debugfs "file"
-+ *
-+ * This function provides a write implementation for the "threshold" debugfs
-+ * interface to the hardware latency detector. It can be used to configure
-+ * the threshold level at which any subsequently detected latencies will
-+ * be recorded into the global ring buffer.
-+ */
-+static ssize_t  debug_threshold_fwrite(struct file *filp,
-+                                      const char __user *ubuf,
-+                                      size_t cnt,
-+                                      loff_t *ppos)
-+{
-+      int ret;
-+
-+      ret = simple_data_write(filp, ubuf, cnt, ppos, &data.threshold);
-+
-+      if (enabled)
-+              wake_up_process(kthread);
-+
-+      return ret;
-+}
-+
-+/**
-+ * debug_width_fopen - Open function for "width" debugfs entry
-+ * @inode: The in-kernel inode representation of the debugfs "file"
-+ * @filp: The active open file structure for the debugfs "file"
-+ *
-+ * This function provides an open implementation for the "width" debugfs
-+ * interface to the hardware latency detector.
-+ */
-+static int debug_width_fopen(struct inode *inode, struct file *filp)
-+{
-+      return 0;
-+}
-+
-+/**
-+ * debug_width_fread - Read function for "width" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The userspace provided buffer to read value into
-+ * @cnt: The maximum number of bytes to read
-+ * @ppos: The current "file" position
-+ *
-+ * This function provides a read implementation for the "width" debugfs
-+ * interface to the hardware latency detector. It can be used to determine
-+ * for how many us of the total window us we will actively sample for any
-+ * hardware-induced latecy periods. Obviously, it is not possible to
-+ * sample constantly and have the system respond to a sample reader, or,
-+ * worse, without having the system appear to have gone out to lunch.
-+ */
-+static ssize_t debug_width_fread(struct file *filp, char __user *ubuf,
-+                                   size_t cnt, loff_t *ppos)
-+{
-+      return simple_data_read(filp, ubuf, cnt, ppos, &data.sample_width);
-+}
-+
-+/**
-+ * debug_width_fwrite - Write function for "width" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The user buffer that contains the value to write
-+ * @cnt: The maximum number of bytes to write to "file"
-+ * @ppos: The current position in the debugfs "file"
-+ *
-+ * This function provides a write implementation for the "width" debugfs
-+ * interface to the hardware latency detector. It can be used to configure
-+ * for how many us of the total window us we will actively sample for any
-+ * hardware-induced latency periods. Obviously, it is not possible to
-+ * sample constantly and have the system respond to a sample reader, or,
-+ * worse, without having the system appear to have gone out to lunch. It
-+ * is enforced that width is less that the total window size.
-+ */
-+static ssize_t  debug_width_fwrite(struct file *filp,
-+                                     const char __user *ubuf,
-+                                     size_t cnt,
-+                                     loff_t *ppos)
-+{
-+      char buf[U64STR_SIZE];
-+      int csize = min(cnt, sizeof(buf));
-+      u64 val = 0;
-+      int err = 0;
-+
-+      memset(buf, '\0', sizeof(buf));
-+      if (copy_from_user(buf, ubuf, csize))
-+              return -EFAULT;
-+
-+      buf[U64STR_SIZE-1] = '\0';                      /* just in case */
-+      err = kstrtoull(buf, 10, &val);
-+      if (err)
-+              return -EINVAL;
-+
-+      mutex_lock(&data.lock);
-+      if (val < data.sample_window)
-+              data.sample_width = val;
-+      else {
-+              mutex_unlock(&data.lock);
-+              return -EINVAL;
-+      }
-+      mutex_unlock(&data.lock);
-+
-+      if (enabled)
-+              wake_up_process(kthread);
-+
-+      return csize;
-+}
-+
-+/**
-+ * debug_window_fopen - Open function for "window" debugfs entry
-+ * @inode: The in-kernel inode representation of the debugfs "file"
-+ * @filp: The active open file structure for the debugfs "file"
-+ *
-+ * This function provides an open implementation for the "window" debugfs
-+ * interface to the hardware latency detector. The window is the total time
-+ * in us that will be considered one sample period. Conceptually, windows
-+ * occur back-to-back and contain a sample width period during which
-+ * actual sampling occurs.
-+ */
-+static int debug_window_fopen(struct inode *inode, struct file *filp)
-+{
-+      return 0;
-+}
-+
-+/**
-+ * debug_window_fread - Read function for "window" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The userspace provided buffer to read value into
-+ * @cnt: The maximum number of bytes to read
-+ * @ppos: The current "file" position
-+ *
-+ * This function provides a read implementation for the "window" debugfs
-+ * interface to the hardware latency detector. The window is the total time
-+ * in us that will be considered one sample period. Conceptually, windows
-+ * occur back-to-back and contain a sample width period during which
-+ * actual sampling occurs. Can be used to read the total window size.
-+ */
-+static ssize_t debug_window_fread(struct file *filp, char __user *ubuf,
-+                                    size_t cnt, loff_t *ppos)
-+{
-+      return simple_data_read(filp, ubuf, cnt, ppos, &data.sample_window);
-+}
-+
-+/**
-+ * debug_window_fwrite - Write function for "window" debugfs entry
-+ * @filp: The active open file structure for the debugfs "file"
-+ * @ubuf: The user buffer that contains the value to write
-+ * @cnt: The maximum number of bytes to write to "file"
-+ * @ppos: The current position in the debugfs "file"
-+ *
-+ * This function provides a write implementation for the "window" debufds
-+ * interface to the hardware latency detetector. The window is the total time
-+ * in us that will be considered one sample period. Conceptually, windows
-+ * occur back-to-back and contain a sample width period during which
-+ * actual sampling occurs. Can be used to write a new total window size. It
-+ * is enfoced that any value written must be greater than the sample width
-+ * size, or an error results.
-+ */
-+static ssize_t  debug_window_fwrite(struct file *filp,
-+                                      const char __user *ubuf,
-+                                      size_t cnt,
-+                                      loff_t *ppos)
-+{
-+      char buf[U64STR_SIZE];
-+      int csize = min(cnt, sizeof(buf));
-+      u64 val = 0;
-+      int err = 0;
-+
-+      memset(buf, '\0', sizeof(buf));
-+      if (copy_from_user(buf, ubuf, csize))
-+              return -EFAULT;
-+
-+      buf[U64STR_SIZE-1] = '\0';                      /* just in case */
-+      err = kstrtoull(buf, 10, &val);
-+      if (err)
-+              return -EINVAL;
-+
-+      mutex_lock(&data.lock);
-+      if (data.sample_width < val)
-+              data.sample_window = val;
-+      else {
-+              mutex_unlock(&data.lock);
-+              return -EINVAL;
-+      }
-+      mutex_unlock(&data.lock);
-+
-+      return csize;
-+}
-+
-+/*
-+ * Function pointers for the "count" debugfs file operations
-+ */
-+static const struct file_operations count_fops = {
-+      .open           = debug_count_fopen,
-+      .read           = debug_count_fread,
-+      .write          = debug_count_fwrite,
-+      .owner          = THIS_MODULE,
-+};
-+
-+/*
-+ * Function pointers for the "enable" debugfs file operations
-+ */
-+static const struct file_operations enable_fops = {
-+      .open           = debug_enable_fopen,
-+      .read           = debug_enable_fread,
-+      .write          = debug_enable_fwrite,
-+      .owner          = THIS_MODULE,
-+};
-+
-+/*
-+ * Function pointers for the "max" debugfs file operations
-+ */
-+static const struct file_operations max_fops = {
-+      .open           = debug_max_fopen,
-+      .read           = debug_max_fread,
-+      .write          = debug_max_fwrite,
-+      .owner          = THIS_MODULE,
-+};
-+
-+/*
-+ * Function pointers for the "sample" debugfs file operations
-+ */
-+static const struct file_operations sample_fops = {
-+      .open           = debug_sample_fopen,
-+      .read           = debug_sample_fread,
-+      .release        = debug_sample_release,
-+      .owner          = THIS_MODULE,
-+};
-+
-+/*
-+ * Function pointers for the "threshold" debugfs file operations
-+ */
-+static const struct file_operations threshold_fops = {
-+      .open           = debug_threshold_fopen,
-+      .read           = debug_threshold_fread,
-+      .write          = debug_threshold_fwrite,
-+      .owner          = THIS_MODULE,
-+};
-+
-+/*
-+ * Function pointers for the "width" debugfs file operations
-+ */
-+static const struct file_operations width_fops = {
-+      .open           = debug_width_fopen,
-+      .read           = debug_width_fread,
-+      .write          = debug_width_fwrite,
-+      .owner          = THIS_MODULE,
-+};
-+
-+/*
-+ * Function pointers for the "window" debugfs file operations
-+ */
-+static const struct file_operations window_fops = {
-+      .open           = debug_window_fopen,
-+      .read           = debug_window_fread,
-+      .write          = debug_window_fwrite,
-+      .owner          = THIS_MODULE,
-+};
-+
-+/**
-+ * init_debugfs - A function to initialize the debugfs interface files
-+ *
-+ * This function creates entries in debugfs for "hwlat_detector", including
-+ * files to read values from the detector, current samples, and the
-+ * maximum sample that has been captured since the hardware latency
-+ * dectector was started.
-+ */
-+static int init_debugfs(void)
-+{
-+      int ret = -ENOMEM;
-+
-+      debug_dir = debugfs_create_dir(DRVNAME, NULL);
-+      if (!debug_dir)
-+              goto err_debug_dir;
-+
-+      debug_sample = debugfs_create_file("sample", 0444,
-+                                             debug_dir, NULL,
-+                                             &sample_fops);
-+      if (!debug_sample)
-+              goto err_sample;
-+
-+      debug_count = debugfs_create_file("count", 0444,
-+                                            debug_dir, NULL,
-+                                            &count_fops);
-+      if (!debug_count)
-+              goto err_count;
-+
-+      debug_max = debugfs_create_file("max", 0444,
-+                                          debug_dir, NULL,
-+                                          &max_fops);
-+      if (!debug_max)
-+              goto err_max;
-+
-+      debug_sample_window = debugfs_create_file("window", 0644,
-+                                                    debug_dir, NULL,
-+                                                    &window_fops);
-+      if (!debug_sample_window)
-+              goto err_window;
-+
-+      debug_sample_width = debugfs_create_file("width", 0644,
-+                                                   debug_dir, NULL,
-+                                                   &width_fops);
-+      if (!debug_sample_width)
-+              goto err_width;
-+
-+      debug_threshold = debugfs_create_file("threshold", 0644,
-+                                                debug_dir, NULL,
-+                                                &threshold_fops);
-+      if (!debug_threshold)
-+              goto err_threshold;
-+
-+      debug_enable = debugfs_create_file("enable", 0644,
-+                                             debug_dir, &enabled,
-+                                             &enable_fops);
-+      if (!debug_enable)
-+              goto err_enable;
-+
-+      else {
-+              ret = 0;
-+              goto out;
-+      }
-+
-+err_enable:
-+      debugfs_remove(debug_threshold);
-+err_threshold:
-+      debugfs_remove(debug_sample_width);
-+err_width:
-+      debugfs_remove(debug_sample_window);
-+err_window:
-+      debugfs_remove(debug_max);
-+err_max:
-+      debugfs_remove(debug_count);
-+err_count:
-+      debugfs_remove(debug_sample);
-+err_sample:
-+      debugfs_remove(debug_dir);
-+err_debug_dir:
-+out:
-+      return ret;
-+}
-+
-+/**
-+ * free_debugfs - A function to cleanup the debugfs file interface
-+ */
-+static void free_debugfs(void)
-+{
-+      /* could also use a debugfs_remove_recursive */
-+      debugfs_remove(debug_enable);
-+      debugfs_remove(debug_threshold);
-+      debugfs_remove(debug_sample_width);
-+      debugfs_remove(debug_sample_window);
-+      debugfs_remove(debug_max);
-+      debugfs_remove(debug_count);
-+      debugfs_remove(debug_sample);
-+      debugfs_remove(debug_dir);
-+}
-+
-+/**
-+ * detector_init - Standard module initialization code
-+ */
-+static int detector_init(void)
-+{
-+      int ret = -ENOMEM;
-+
-+      pr_info(BANNER "version %s\n", VERSION);
-+
-+      ret = init_stats();
-+      if (ret)
-+              goto out;
-+
-+      ret = init_debugfs();
-+      if (ret)
-+              goto err_stats;
-+
-+      if (enabled)
-+              ret = start_kthread();
-+
-+      goto out;
-+
-+err_stats:
-+      ring_buffer_free(ring_buffer);
-+out:
-+      return ret;
-+
-+}
-+
-+/**
-+ * detector_exit - Standard module cleanup code
-+ */
-+static void detector_exit(void)
-+{
-+      int err;
-+
-+      if (enabled) {
-+              enabled = 0;
-+              err = stop_kthread();
-+              if (err)
-+                      pr_err(BANNER "cannot stop kthread\n");
-+      }
-+
-+      free_debugfs();
-+      ring_buffer_free(ring_buffer);  /* free up the ring buffer */
++              spinlock_t      lock;           /* Protection for -RT */
+               struct page     *spare_page; /* Used when checking P/Q in raid6 
*/
+               struct flex_array *scribble;   /* space for constructing buffer
+                                             * lists and performing address
+diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
+index 64971baf11fa..215e91e36198 100644
+--- a/drivers/misc/Kconfig
++++ b/drivers/misc/Kconfig
+@@ -54,6 +54,7 @@ config AD525X_DPOT_SPI
+ config ATMEL_TCLIB
+       bool "Atmel AT32/AT91 Timer/Counter Library"
+       depends on (AVR32 || ARCH_AT91)
++      default y if PREEMPT_RT_FULL
+       help
+         Select this if you want a library to allocate the Timer/Counter
+         blocks found on many Atmel processors.  This facilitates using
+@@ -69,8 +70,7 @@ config ATMEL_TCB_CLKSRC
+         are combined to make a single 32-bit timer.
+ 
+         When GENERIC_CLOCKEVENTS is defined, the third timer channel
+-        may be used as a clock event device supporting oneshot mode
+-        (delays of up to two seconds) based on the 32 KiHz clock.
++        may be used as a clock event device supporting oneshot mode.
+ 
+ config ATMEL_TCB_CLKSRC_BLOCK
+       int
+@@ -84,6 +84,15 @@ config ATMEL_TCB_CLKSRC_BLOCK
+         TC can be used for other purposes, such as PWM generation and
+         interval timing.
+ 
++config ATMEL_TCB_CLKSRC_USE_SLOW_CLOCK
++      bool "TC Block use 32 KiHz clock"
++      depends on ATMEL_TCB_CLKSRC
++      default y if !PREEMPT_RT_FULL
++      help
++        Select this to use 32 KiHz base clock rate as TC block clock
++        source for clock events.
 +
-+}
 +
-+module_init(detector_init);
-+module_exit(detector_exit);
+ config DUMMY_IRQ
+       tristate "Dummy IRQ handler"
+       default n
 diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
 index df990bb8c873..1a162709a85e 100644
 --- a/drivers/mmc/host/mmci.c
@@ -6168,7 +4723,7 @@ index df990bb8c873..1a162709a85e 100644
         * If we have less than the fifo 'half-full' threshold to transfer,
         * trigger a PIO interrupt as soon as any data is available.
 diff --git a/drivers/net/ethernet/3com/3c59x.c 
b/drivers/net/ethernet/3com/3c59x.c
-index 25c55ab05c7d..5a1d117a8744 100644
+index 9133e7926da5..63afb921ed40 100644
 --- a/drivers/net/ethernet/3com/3c59x.c
 +++ b/drivers/net/ethernet/3com/3c59x.c
 @@ -842,9 +842,9 @@ static void poll_vortex(struct net_device *dev)
@@ -6212,7 +4767,7 @@ index da4c2d8a4173..1420dfb56bac 100644
        enable_irq(irq);
  }
 diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c 
b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
-index 56f109bc8394..02afc796bc71 100644
+index bca6935a94db..d7a35ee34d03 100644
 --- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
 +++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
 @@ -697,7 +697,7 @@ static void ezusb_req_ctx_wait(struct ezusb_priv *upriv,
@@ -6318,7 +4873,7 @@ index dcf36537a767..1a1f2e46452c 100644
        list_for_each_entry_safe(fcf, next, &del_list, list) {
                /* Removes fcf from current list */
 diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
-index e72673b0a8fb..da598a6caa22 100644
+index 16ca31ad5ec0..c3987347e762 100644
 --- a/drivers/scsi/libfc/fc_exch.c
 +++ b/drivers/scsi/libfc/fc_exch.c
 @@ -814,10 +814,10 @@ static struct fc_exch *fc_exch_em_alloc(struct fc_lport 
*lport,
@@ -6376,7 +4931,7 @@ index edc48f3b8230..ee5c6f9dfb6f 100644
  
  static inline uint8_t *
 diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
-index 987f1c729e9c..18391e07d70f 100644
+index 068c4e47fac9..a2090f640397 100644
 --- a/drivers/scsi/qla2xxx/qla_isr.c
 +++ b/drivers/scsi/qla2xxx/qla_isr.c
 @@ -3125,7 +3125,11 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
rsp_que *rsp)
@@ -6392,7 +4947,7 @@ index 987f1c729e9c..18391e07d70f 100644
  
        /*
 diff --git a/drivers/thermal/x86_pkg_temp_thermal.c 
b/drivers/thermal/x86_pkg_temp_thermal.c
-index 97f0a2bd93ed..a4f45aaa9ad4 100644
+index 95f4c1bcdb4c..0be934799bff 100644
 --- a/drivers/thermal/x86_pkg_temp_thermal.c
 +++ b/drivers/thermal/x86_pkg_temp_thermal.c
 @@ -29,6 +29,7 @@
@@ -6403,7 +4958,7 @@ index 97f0a2bd93ed..a4f45aaa9ad4 100644
  #include <asm/cpu_device_id.h>
  #include <asm/mce.h>
  
-@@ -352,7 +353,7 @@ static void pkg_temp_thermal_threshold_work_fn(struct 
work_struct *work)
+@@ -353,7 +354,7 @@ static void pkg_temp_thermal_threshold_work_fn(struct 
work_struct *work)
        }
  }
  
@@ -6412,7 +4967,7 @@ index 97f0a2bd93ed..a4f45aaa9ad4 100644
  {
        unsigned long flags;
        int cpu = smp_processor_id();
-@@ -369,7 +370,7 @@ static int pkg_temp_thermal_platform_thermal_notify(__u64 
msr_val)
+@@ -370,7 +371,7 @@ static int pkg_temp_thermal_platform_thermal_notify(__u64 
msr_val)
                        pkg_work_scheduled[phy_id]) {
                disable_pkg_thres_interrupt();
                spin_unlock_irqrestore(&pkg_work_lock, flags);
@@ -6421,7 +4976,7 @@ index 97f0a2bd93ed..a4f45aaa9ad4 100644
        }
        pkg_work_scheduled[phy_id] = 1;
        spin_unlock_irqrestore(&pkg_work_lock, flags);
-@@ -378,9 +379,48 @@ static int pkg_temp_thermal_platform_thermal_notify(__u64 
msr_val)
+@@ -379,9 +380,48 @@ static int pkg_temp_thermal_platform_thermal_notify(__u64 
msr_val)
        schedule_delayed_work_on(cpu,
                                &per_cpu(pkg_temp_thermal_threshold_work, cpu),
                                msecs_to_jiffies(notify_delay_ms));
@@ -6470,7 +5025,7 @@ index 97f0a2bd93ed..a4f45aaa9ad4 100644
  static int find_siblings_cpu(int cpu)
  {
        int i;
-@@ -584,6 +624,9 @@ static int __init pkg_temp_thermal_init(void)
+@@ -585,6 +625,9 @@ static int __init pkg_temp_thermal_init(void)
        if (!x86_match_cpu(pkg_temp_thermal_ids))
                return -ENODEV;
  
@@ -6480,7 +5035,7 @@ index 97f0a2bd93ed..a4f45aaa9ad4 100644
        spin_lock_init(&pkg_work_lock);
        platform_thermal_package_notify =
                        pkg_temp_thermal_platform_thermal_notify;
-@@ -608,7 +651,7 @@ static int __init pkg_temp_thermal_init(void)
+@@ -609,7 +652,7 @@ static int __init pkg_temp_thermal_init(void)
        kfree(pkg_work_scheduled);
        platform_thermal_package_notify = NULL;
        platform_thermal_package_rate_control = NULL;
@@ -6489,7 +5044,7 @@ index 97f0a2bd93ed..a4f45aaa9ad4 100644
        return -ENODEV;
  }
  
-@@ -633,6 +676,7 @@ static void __exit pkg_temp_thermal_exit(void)
+@@ -634,6 +677,7 @@ static void __exit pkg_temp_thermal_exit(void)
        mutex_unlock(&phy_dev_list_mutex);
        platform_thermal_package_notify = NULL;
        platform_thermal_package_rate_control = NULL;
@@ -6498,7 +5053,7 @@ index 97f0a2bd93ed..a4f45aaa9ad4 100644
                cancel_delayed_work_sync(
                        &per_cpu(pkg_temp_thermal_threshold_work, i));
 diff --git a/drivers/tty/serial/8250/8250_core.c 
b/drivers/tty/serial/8250/8250_core.c
-index dcf43f66404f..a9ae57122841 100644
+index 240a361b674f..55e249267144 100644
 --- a/drivers/tty/serial/8250/8250_core.c
 +++ b/drivers/tty/serial/8250/8250_core.c
 @@ -58,7 +58,16 @@ static struct uart_driver serial8250_reg;
@@ -6520,7 +5075,7 @@ index dcf43f66404f..a9ae57122841 100644
  #include <asm/serial.h>
  /*
 diff --git a/drivers/tty/serial/8250/8250_port.c 
b/drivers/tty/serial/8250/8250_port.c
-index 858a54633664..fc44fb59aef6 100644
+index 1731b98d2471..5cc62301e840 100644
 --- a/drivers/tty/serial/8250/8250_port.c
 +++ b/drivers/tty/serial/8250/8250_port.c
 @@ -35,6 +35,7 @@
@@ -6531,7 +5086,7 @@ index 858a54633664..fc44fb59aef6 100644
  #include <linux/uaccess.h>
  #include <linux/pm_runtime.h>
  #include <linux/timer.h>
-@@ -3109,9 +3110,9 @@ void serial8250_console_write(struct uart_8250_port *up, 
const char *s,
+@@ -3144,9 +3145,9 @@ void serial8250_console_write(struct uart_8250_port *up, 
const char *s,
  
        serial8250_rpm_get(up);
  
@@ -6544,10 +5099,10 @@ index 858a54633664..fc44fb59aef6 100644
        else
                spin_lock_irqsave(&port->lock, flags);
 diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
-index 8a9e213387a7..dd1f9a426b74 100644
+index e2c33b9528d8..53af53c43e8c 100644
 --- a/drivers/tty/serial/amba-pl011.c
 +++ b/drivers/tty/serial/amba-pl011.c
-@@ -2167,13 +2167,19 @@ pl011_console_write(struct console *co, const char *s, 
unsigned int count)
+@@ -2194,13 +2194,19 @@ pl011_console_write(struct console *co, const char *s, 
unsigned int count)
  
        clk_enable(uap->clk);
  
@@ -6570,7 +5125,7 @@ index 8a9e213387a7..dd1f9a426b74 100644
  
        /*
         *      First save the CR then disable the interrupts
-@@ -2197,8 +2203,7 @@ pl011_console_write(struct console *co, const char *s, 
unsigned int count)
+@@ -2224,8 +2230,7 @@ pl011_console_write(struct console *co, const char *s, 
unsigned int count)
                pl011_write(old_cr, uap, REG_CR);
  
        if (locked)
@@ -6611,24 +5166,11 @@ index a2a529994ba5..0ee7c4c518df 100644
  }
  
  static int __init
-diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
-index f36e6df2fa90..e086ea4d2997 100644
---- a/drivers/tty/serial/sc16is7xx.c
-+++ b/drivers/tty/serial/sc16is7xx.c
-@@ -1240,7 +1240,7 @@ static int sc16is7xx_probe(struct device *dev,
- 
-       /* Setup interrupt */
-       ret = devm_request_irq(dev, irq, sc16is7xx_irq,
--                             IRQF_ONESHOT | flags, dev_name(dev), s);
-+                             flags, dev_name(dev), s);
-       if (!ret)
-               return 0;
- 
 diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
-index d2e3f655c26f..fdd027a9bbd7 100644
+index 479e223f9cff..3418a54b4131 100644
 --- a/drivers/usb/core/hcd.c
 +++ b/drivers/usb/core/hcd.c
-@@ -1760,9 +1760,9 @@ static void __usb_hcd_giveback_urb(struct urb *urb)
+@@ -1761,9 +1761,9 @@ static void __usb_hcd_giveback_urb(struct urb *urb)
         * and no one may trigger the above deadlock situation when
         * running complete() in tasklet.
         */
@@ -6641,10 +5183,10 @@ index d2e3f655c26f..fdd027a9bbd7 100644
        usb_anchor_resume_wakeups(anchor);
        atomic_dec(&urb->use_count);
 diff --git a/drivers/usb/gadget/function/f_fs.c 
b/drivers/usb/gadget/function/f_fs.c
-index 5c8429f23a89..fa835fb1a186 100644
+index 17989b72cdae..88c6574b5992 100644
 --- a/drivers/usb/gadget/function/f_fs.c
 +++ b/drivers/usb/gadget/function/f_fs.c
-@@ -1509,7 +1509,7 @@ static void ffs_data_put(struct ffs_data *ffs)
+@@ -1593,7 +1593,7 @@ static void ffs_data_put(struct ffs_data *ffs)
                pr_info("%s(): freeing\n", __func__);
                ffs_data_clear(ffs);
                BUG_ON(waitqueue_active(&ffs->ev.waitq) ||
@@ -6654,7 +5196,7 @@ index 5c8429f23a89..fa835fb1a186 100644
                kfree(ffs);
        }
 diff --git a/drivers/usb/gadget/legacy/inode.c 
b/drivers/usb/gadget/legacy/inode.c
-index 16104b5ebdcb..5c506c2b88ad 100644
+index 1468d8f085a3..6aae3ae25c18 100644
 --- a/drivers/usb/gadget/legacy/inode.c
 +++ b/drivers/usb/gadget/legacy/inode.c
 @@ -346,7 +346,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len)
@@ -6676,7 +5218,7 @@ index 16104b5ebdcb..5c506c2b88ad 100644
                                        epdata->status = -EINTR;
                        } else {
 diff --git a/fs/aio.c b/fs/aio.c
-index 4fe81d1c60f9..e68c06a4a017 100644
+index 428484f2f841..2b02e2eb2158 100644
 --- a/fs/aio.c
 +++ b/fs/aio.c
 @@ -40,6 +40,7 @@
@@ -6704,7 +5246,7 @@ index 4fe81d1c60f9..e68c06a4a017 100644
        aio_mnt = kern_mount(&aio_fs);
        if (IS_ERR(aio_mnt))
                panic("Failed to create aio fs mount.");
-@@ -578,9 +580,9 @@ static int kiocb_cancel(struct aio_kiocb *kiocb)
+@@ -581,9 +583,9 @@ static int kiocb_cancel(struct aio_kiocb *kiocb)
        return cancel(&kiocb->common);
  }
  
@@ -6716,7 +5258,7 @@ index 4fe81d1c60f9..e68c06a4a017 100644
  
        pr_debug("freeing %p\n", ctx);
  
-@@ -599,8 +601,8 @@ static void free_ioctx_reqs(struct percpu_ref *ref)
+@@ -602,8 +604,8 @@ static void free_ioctx_reqs(struct percpu_ref *ref)
        if (ctx->rq_wait && atomic_dec_and_test(&ctx->rq_wait->count))
                complete(&ctx->rq_wait->comp);
  
@@ -6727,7 +5269,7 @@ index 4fe81d1c60f9..e68c06a4a017 100644
  }
  
  /*
-@@ -608,9 +610,9 @@ static void free_ioctx_reqs(struct percpu_ref *ref)
+@@ -611,9 +613,9 @@ static void free_ioctx_reqs(struct percpu_ref *ref)
   * and ctx->users has dropped to 0, so we know no more kiocbs can be 
submitted -
   * now it's safe to cancel any that need to be.
   */
@@ -6739,7 +5281,7 @@ index 4fe81d1c60f9..e68c06a4a017 100644
        struct aio_kiocb *req;
  
        spin_lock_irq(&ctx->ctx_lock);
-@@ -629,6 +631,14 @@ static void free_ioctx_users(struct percpu_ref *ref)
+@@ -632,6 +634,14 @@ static void free_ioctx_users(struct percpu_ref *ref)
        percpu_ref_put(&ctx->reqs);
  }
  
@@ -6755,10 +5297,10 @@ index 4fe81d1c60f9..e68c06a4a017 100644
  {
        unsigned i, new_nr;
 diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
-index a439548de785..7c392647d03b 100644
+index a1fba4285277..3796769b4cd1 100644
 --- a/fs/autofs4/autofs_i.h
 +++ b/fs/autofs4/autofs_i.h
-@@ -30,6 +30,7 @@
+@@ -31,6 +31,7 @@
  #include <linux/sched.h>
  #include <linux/mount.h>
  #include <linux/namei.h>
@@ -6779,8 +5321,31 @@ index d8e6d421c27f..2e689ab1306b 100644
                                goto relock;
                        }
                        spin_unlock(&p->d_lock);
+diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
+index 63d197724519..b8e479c5ad83 100644
+--- a/fs/btrfs/async-thread.c
++++ b/fs/btrfs/async-thread.c
+@@ -306,8 +306,8 @@
+                * because the callback could free the structure.
+                */
+               wtag = work;
+-              work->ordered_free(work);
+               trace_btrfs_all_work_done(wq->fs_info, wtag);
++              work->ordered_free(work);
+       }
+       spin_unlock_irqrestore(lock, flags);
+ }
+@@ -339,8 +339,6 @@
+               set_bit(WORK_DONE_BIT, &work->flags);
+               run_ordered_work(wq);
+       }
+-      if (!need_order)
+-              trace_btrfs_all_work_done(wq->fs_info, wtag);
+ }
+ 
+ void btrfs_init_work(struct btrfs_work *work, btrfs_work_func_t uniq_func,
 diff --git a/fs/buffer.c b/fs/buffer.c
-index 9c8eb9b6db6a..d15d77f72cf7 100644
+index b205a629001d..5646afc022ba 100644
 --- a/fs/buffer.c
 +++ b/fs/buffer.c
 @@ -301,8 +301,7 @@ static void end_buffer_async_read(struct buffer_head *bh, 
int uptodate)
@@ -6842,7 +5407,7 @@ index 9c8eb9b6db6a..d15d77f72cf7 100644
  }
  EXPORT_SYMBOL(end_buffer_async_write);
  
-@@ -3384,6 +3376,7 @@ struct buffer_head *alloc_buffer_head(gfp_t gfp_flags)
+@@ -3383,6 +3375,7 @@ struct buffer_head *alloc_buffer_head(gfp_t gfp_flags)
        struct buffer_head *ret = kmem_cache_zalloc(bh_cachep, gfp_flags);
        if (ret) {
                INIT_LIST_HEAD(&ret->b_assoc_buffers);
@@ -6992,10 +5557,10 @@ index 10db91218933..42af0a06f657 100644
  
  static void ep_remove_wait_queue(struct eppoll_entry *pwq)
 diff --git a/fs/exec.c b/fs/exec.c
-index 6fcfb3f7b137..751370a71ec5 100644
+index 67e86571685a..fe14cdd84016 100644
 --- a/fs/exec.c
 +++ b/fs/exec.c
-@@ -1012,12 +1012,14 @@ static int exec_mmap(struct mm_struct *mm)
+@@ -1017,12 +1017,14 @@ static int exec_mmap(struct mm_struct *mm)
                }
        }
        task_lock(tsk);
@@ -7011,10 +5576,10 @@ index 6fcfb3f7b137..751370a71ec5 100644
        if (old_mm) {
                up_read(&old_mm->mmap_sem);
 diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
-index 4ff9251e9d3a..8fe489ec2ef1 100644
+index 096f79997f75..310e2aabbb0d 100644
 --- a/fs/fuse/dir.c
 +++ b/fs/fuse/dir.c
-@@ -1174,7 +1174,7 @@ static int fuse_direntplus_link(struct file *file,
+@@ -1191,7 +1191,7 @@ static int fuse_direntplus_link(struct file *file,
        struct inode *dir = d_inode(parent);
        struct fuse_conn *fc;
        struct inode *inode;
@@ -7036,8 +5601,152 @@ index 684996c8a3a4..6e18a06aaabe 100644
                mutex_lock(&journal->j_checkpoint_mutex);
  
                /*
+diff --git a/fs/locks.c b/fs/locks.c
+index 22c5b4aa4961..269c6a44449a 100644
+--- a/fs/locks.c
++++ b/fs/locks.c
+@@ -935,7 +935,7 @@ static int flock_lock_inode(struct inode *inode, struct 
file_lock *request)
+                       return -ENOMEM;
+       }
+ 
+-      percpu_down_read_preempt_disable(&file_rwsem);
++      percpu_down_read(&file_rwsem);
+       spin_lock(&ctx->flc_lock);
+       if (request->fl_flags & FL_ACCESS)
+               goto find_conflict;
+@@ -976,7 +976,7 @@ static int flock_lock_inode(struct inode *inode, struct 
file_lock *request)
+ 
+ out:
+       spin_unlock(&ctx->flc_lock);
+-      percpu_up_read_preempt_enable(&file_rwsem);
++      percpu_up_read(&file_rwsem);
+       if (new_fl)
+               locks_free_lock(new_fl);
+       locks_dispose_list(&dispose);
+@@ -1013,7 +1013,7 @@ static int posix_lock_inode(struct inode *inode, struct 
file_lock *request,
+               new_fl2 = locks_alloc_lock();
+       }
+ 
+-      percpu_down_read_preempt_disable(&file_rwsem);
++      percpu_down_read(&file_rwsem);
+       spin_lock(&ctx->flc_lock);
+       /*
+        * New lock request. Walk all POSIX locks and look for conflicts. If
+@@ -1185,7 +1185,7 @@ static int posix_lock_inode(struct inode *inode, struct 
file_lock *request,
+       }
+  out:
+       spin_unlock(&ctx->flc_lock);
+-      percpu_up_read_preempt_enable(&file_rwsem);
++      percpu_up_read(&file_rwsem);
+       /*
+        * Free any unused locks.
+        */
+@@ -1460,7 +1460,7 @@ int __break_lease(struct inode *inode, unsigned int 
mode, unsigned int type)
+               return error;
+       }
+ 
+-      percpu_down_read_preempt_disable(&file_rwsem);
++      percpu_down_read(&file_rwsem);
+       spin_lock(&ctx->flc_lock);
+ 
+       time_out_leases(inode, &dispose);
+@@ -1512,13 +1512,13 @@ int __break_lease(struct inode *inode, unsigned int 
mode, unsigned int type)
+       locks_insert_block(fl, new_fl);
+       trace_break_lease_block(inode, new_fl);
+       spin_unlock(&ctx->flc_lock);
+-      percpu_up_read_preempt_enable(&file_rwsem);
++      percpu_up_read(&file_rwsem);
+ 
+       locks_dispose_list(&dispose);
+       error = wait_event_interruptible_timeout(new_fl->fl_wait,
+                                               !new_fl->fl_next, break_time);
+ 
+-      percpu_down_read_preempt_disable(&file_rwsem);
++      percpu_down_read(&file_rwsem);
+       spin_lock(&ctx->flc_lock);
+       trace_break_lease_unblock(inode, new_fl);
+       locks_delete_block(new_fl);
+@@ -1535,7 +1535,7 @@ int __break_lease(struct inode *inode, unsigned int 
mode, unsigned int type)
+       }
+ out:
+       spin_unlock(&ctx->flc_lock);
+-      percpu_up_read_preempt_enable(&file_rwsem);
++      percpu_up_read(&file_rwsem);
+       locks_dispose_list(&dispose);
+       locks_free_lock(new_fl);
+       return error;
+@@ -1609,7 +1609,7 @@ int fcntl_getlease(struct file *filp)
+ 
+       ctx = smp_load_acquire(&inode->i_flctx);
+       if (ctx && !list_empty_careful(&ctx->flc_lease)) {
+-              percpu_down_read_preempt_disable(&file_rwsem);
++              percpu_down_read(&file_rwsem);
+               spin_lock(&ctx->flc_lock);
+               time_out_leases(inode, &dispose);
+               list_for_each_entry(fl, &ctx->flc_lease, fl_list) {
+@@ -1619,7 +1619,7 @@ int fcntl_getlease(struct file *filp)
+                       break;
+               }
+               spin_unlock(&ctx->flc_lock);
+-              percpu_up_read_preempt_enable(&file_rwsem);
++              percpu_up_read(&file_rwsem);
+ 
+               locks_dispose_list(&dispose);
+       }
+@@ -1694,7 +1694,7 @@ generic_add_lease(struct file *filp, long arg, struct 
file_lock **flp, void **pr
+               return -EINVAL;
+       }
+ 
+-      percpu_down_read_preempt_disable(&file_rwsem);
++      percpu_down_read(&file_rwsem);
+       spin_lock(&ctx->flc_lock);
+       time_out_leases(inode, &dispose);
+       error = check_conflicting_open(dentry, arg, lease->fl_flags);
+@@ -1765,7 +1765,7 @@ generic_add_lease(struct file *filp, long arg, struct 
file_lock **flp, void **pr
+               lease->fl_lmops->lm_setup(lease, priv);
+ out:
+       spin_unlock(&ctx->flc_lock);
+-      percpu_up_read_preempt_enable(&file_rwsem);
++      percpu_up_read(&file_rwsem);
+       locks_dispose_list(&dispose);
+       if (is_deleg)
+               inode_unlock(inode);
+@@ -1788,7 +1788,7 @@ static int generic_delete_lease(struct file *filp, void 
*owner)
+               return error;
+       }
+ 
+-      percpu_down_read_preempt_disable(&file_rwsem);
++      percpu_down_read(&file_rwsem);
+       spin_lock(&ctx->flc_lock);
+       list_for_each_entry(fl, &ctx->flc_lease, fl_list) {
+               if (fl->fl_file == filp &&
+@@ -1801,7 +1801,7 @@ static int generic_delete_lease(struct file *filp, void 
*owner)
+       if (victim)
+               error = fl->fl_lmops->lm_change(victim, F_UNLCK, &dispose);
+       spin_unlock(&ctx->flc_lock);
+-      percpu_up_read_preempt_enable(&file_rwsem);
++      percpu_up_read(&file_rwsem);
+       locks_dispose_list(&dispose);
+       return error;
+ }
+@@ -2532,13 +2532,13 @@ locks_remove_lease(struct file *filp, struct 
file_lock_context *ctx)
+       if (list_empty(&ctx->flc_lease))
+               return;
+ 
+-      percpu_down_read_preempt_disable(&file_rwsem);
++      percpu_down_read(&file_rwsem);
+       spin_lock(&ctx->flc_lock);
+       list_for_each_entry_safe(fl, tmp, &ctx->flc_lease, fl_list)
+               if (filp == fl->fl_file)
+                       lease_modify(fl, F_UNLCK, &dispose);
+       spin_unlock(&ctx->flc_lock);
+-      percpu_up_read_preempt_enable(&file_rwsem);
++      percpu_up_read(&file_rwsem);
+ 
+       locks_dispose_list(&dispose);
+ }
 diff --git a/fs/namei.c b/fs/namei.c
-index adb04146df09..a89dfaf9f209 100644
+index 5b4eed221530..9c8dd3c83a80 100644
 --- a/fs/namei.c
 +++ b/fs/namei.c
 @@ -1629,7 +1629,7 @@ static struct dentry *lookup_slow(const struct qstr 
*name,
@@ -7059,7 +5768,7 @@ index adb04146df09..a89dfaf9f209 100644
        if (unlikely(IS_DEADDIR(dir_inode)))
                return -ENOENT;
 diff --git a/fs/namespace.c b/fs/namespace.c
-index 7bb2cda3bfef..cf79b18e7b58 100644
+index e6c234b1a645..c9dbe5e56347 100644
 --- a/fs/namespace.c
 +++ b/fs/namespace.c
 @@ -14,6 +14,7 @@
@@ -7070,7 +5779,7 @@ index 7bb2cda3bfef..cf79b18e7b58 100644
  #include <linux/security.h>
  #include <linux/idr.h>
  #include <linux/init.h>               /* init_rootfs */
-@@ -353,8 +354,11 @@ int __mnt_want_write(struct vfsmount *m)
+@@ -356,8 +357,11 @@ int __mnt_want_write(struct vfsmount *m)
         * incremented count after it has set MNT_WRITE_HOLD.
         */
        smp_mb();
@@ -7085,7 +5794,7 @@ index 7bb2cda3bfef..cf79b18e7b58 100644
         * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will
         * be set to match its requirements. So we must not load that until
 diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
-index b9c65421ed81..03ffe8af8785 100644
+index dff600ae0d74..d726d2e09353 100644
 --- a/fs/nfs/delegation.c
 +++ b/fs/nfs/delegation.c
 @@ -150,11 +150,11 @@ static int nfs_delegation_claim_opens(struct inode 
*inode,
@@ -7103,7 +5812,7 @@ index b9c65421ed81..03ffe8af8785 100644
                mutex_unlock(&sp->so_delegreturn_mutex);
                put_nfs_open_context(ctx);
 diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
-index 6bc5a68e39f1..ce6488e07a13 100644
+index 5f1af4cd1a33..436c27eb9d4f 100644
 --- a/fs/nfs/dir.c
 +++ b/fs/nfs/dir.c
 @@ -485,7 +485,7 @@ static
@@ -7115,7 +5824,7 @@ index 6bc5a68e39f1..ce6488e07a13 100644
        struct dentry *dentry;
        struct dentry *alias;
        struct inode *dir = d_inode(parent);
-@@ -1490,7 +1490,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry 
*dentry,
+@@ -1498,7 +1498,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry 
*dentry,
                    struct file *file, unsigned open_flags,
                    umode_t mode, int *opened)
  {
@@ -7124,7 +5833,7 @@ index 6bc5a68e39f1..ce6488e07a13 100644
        struct nfs_open_context *ctx;
        struct dentry *res;
        struct iattr attr = { .ia_valid = ATTR_OPEN };
-@@ -1805,7 +1805,11 @@ int nfs_rmdir(struct inode *dir, struct dentry *dentry)
+@@ -1813,7 +1813,11 @@ int nfs_rmdir(struct inode *dir, struct dentry *dentry)
  
        trace_nfs_rmdir_enter(dir, dentry);
        if (d_really_is_positive(dentry)) {
@@ -7136,7 +5845,7 @@ index 6bc5a68e39f1..ce6488e07a13 100644
                error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
                /* Ensure the VFS deletes this inode */
                switch (error) {
-@@ -1815,7 +1819,11 @@ int nfs_rmdir(struct inode *dir, struct dentry *dentry)
+@@ -1823,7 +1827,11 @@ int nfs_rmdir(struct inode *dir, struct dentry *dentry)
                case -ENOENT:
                        nfs_dentry_handle_enoent(dentry);
                }
@@ -7165,10 +5874,10 @@ index bf4ec5ecc97e..36cd5fc9192c 100644
  }
  
 diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
-index 9bf64eacba5b..041da5cb80f5 100644
+index 1452177c822d..f43b01d54c59 100644
 --- a/fs/nfs/nfs4_fs.h
 +++ b/fs/nfs/nfs4_fs.h
-@@ -107,7 +107,7 @@ struct nfs4_state_owner {
+@@ -111,7 +111,7 @@ struct nfs4_state_owner {
        unsigned long        so_flags;
        struct list_head     so_states;
        struct nfs_seqid_counter so_seqid;
@@ -7178,10 +5887,10 @@ index 9bf64eacba5b..041da5cb80f5 100644
  };
  
 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
-index a9dec32ba9ba..49b64dfb307c 100644
+index 241da19b7da4..8f9636cc298f 100644
 --- a/fs/nfs/nfs4proc.c
 +++ b/fs/nfs/nfs4proc.c
-@@ -2525,7 +2525,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata 
*opendata,
+@@ -2697,7 +2697,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata 
*opendata,
        unsigned int seq;
        int ret;
  
@@ -7190,7 +5899,7 @@ index a9dec32ba9ba..49b64dfb307c 100644
  
        ret = _nfs4_proc_open(opendata);
        if (ret != 0)
-@@ -2561,7 +2561,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata 
*opendata,
+@@ -2735,7 +2735,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata 
*opendata,
        ctx->state = state;
        if (d_inode(dentry) == state->inode) {
                nfs_inode_attach_open_context(ctx);
@@ -7200,7 +5909,7 @@ index a9dec32ba9ba..49b64dfb307c 100644
        }
  out:
 diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
-index 8353f33f0466..657e13ed4b5d 100644
+index 0959c9661662..dabd834d7686 100644
 --- a/fs/nfs/nfs4state.c
 +++ b/fs/nfs/nfs4state.c
 @@ -488,7 +488,7 @@ nfs4_alloc_state_owner(struct nfs_server *server,
@@ -7212,7 +5921,7 @@ index 8353f33f0466..657e13ed4b5d 100644
        mutex_init(&sp->so_delegreturn_mutex);
        return sp;
  }
-@@ -1459,8 +1459,12 @@ static int nfs4_reclaim_open_state(struct 
nfs4_state_owner *sp, const struct nfs
+@@ -1497,8 +1497,12 @@ static int nfs4_reclaim_open_state(struct 
nfs4_state_owner *sp, const struct nfs
         * recovering after a network partition or a reboot from a
         * server that doesn't support a grace period.
         */
@@ -7226,7 +5935,7 @@ index 8353f33f0466..657e13ed4b5d 100644
  restart:
        list_for_each_entry(state, &sp->so_states, open_states) {
                if (!test_and_clear_bit(ops->state_flag_bit, &state->flags))
-@@ -1528,14 +1532,20 @@ static int nfs4_reclaim_open_state(struct 
nfs4_state_owner *sp, const struct nfs
+@@ -1567,14 +1571,20 @@ static int nfs4_reclaim_open_state(struct 
nfs4_state_owner *sp, const struct nfs
                spin_lock(&sp->so_lock);
                goto restart;
        }
@@ -7402,10 +6111,10 @@ index fe251f187ff8..e89da4fb14c2 100644
  
  /**
 diff --git a/fs/proc/base.c b/fs/proc/base.c
-index ac0df4dde823..ad1a4723ffdd 100644
+index ca651ac00660..41d9dc789285 100644
 --- a/fs/proc/base.c
 +++ b/fs/proc/base.c
-@@ -1819,7 +1819,7 @@ bool proc_fill_cache(struct file *file, struct 
dir_context *ctx,
+@@ -1834,7 +1834,7 @@ bool proc_fill_cache(struct file *file, struct 
dir_context *ctx,
  
        child = d_hash_and_lookup(dir, &qname);
        if (!child) {
@@ -7415,10 +6124,10 @@ index ac0df4dde823..ad1a4723ffdd 100644
                if (IS_ERR(child))
                        goto end_instantiate;
 diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
-index 1b93650dda2f..c553bf3ea541 100644
+index 55313d994895..bdfc493721e9 100644
 --- a/fs/proc/proc_sysctl.c
 +++ b/fs/proc/proc_sysctl.c
-@@ -627,7 +627,7 @@ static bool proc_sys_fill_cache(struct file *file,
+@@ -632,7 +632,7 @@ static bool proc_sys_fill_cache(struct file *file,
  
        child = d_lookup(dir, &qname);
        if (!child) {
@@ -7444,10 +6153,10 @@ index 9ae4abb4110b..8644b67c48fd 100644
  
        /*
 diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
-index 93b61b1f2beb..58270adb46ce 100644
+index e861a24f06f2..b5c97d3059c7 100644
 --- a/include/acpi/platform/aclinux.h
 +++ b/include/acpi/platform/aclinux.h
-@@ -131,6 +131,7 @@
+@@ -133,6 +133,7 @@
  
  #define acpi_cache_t                        struct kmem_cache
  #define acpi_spinlock                       spinlock_t *
@@ -7455,7 +6164,7 @@ index 93b61b1f2beb..58270adb46ce 100644
  #define acpi_cpu_flags                      unsigned long
  
  /* Use native linux version of acpi_os_allocate_zeroed */
-@@ -149,6 +150,20 @@
+@@ -151,6 +152,20 @@
  #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
  #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
  
@@ -7502,19 +6211,20 @@ index 6f96247226a4..fa53a21263c2 100644
  
  #endif
 diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
-index e43bbffb5b7a..c23892264109 100644
+index 535ab2e13d2e..cfc246899473 100644
 --- a/include/linux/blk-mq.h
 +++ b/include/linux/blk-mq.h
-@@ -222,6 +222,7 @@ static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag)
+@@ -209,7 +209,7 @@ static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag)
+       return unique_tag & BLK_MQ_UNIQUE_TAG_MASK;
+ }
  
- struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int 
ctx_index);
- struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, 
unsigned int, int);
+-
 +void __blk_mq_complete_request_remote_work(struct work_struct *work);
- 
  int blk_mq_request_started(struct request *rq);
  void blk_mq_start_request(struct request *rq);
+ void blk_mq_end_request(struct request *rq, int error);
 diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index e79055c8b577..8583c1af14ad 100644
+index c47c358ba052..a99c23735725 100644
 --- a/include/linux/blkdev.h
 +++ b/include/linux/blkdev.h
 @@ -89,6 +89,7 @@ struct request {
@@ -7698,10 +6408,10 @@ index 5d5aaae3af43..3bca1590e29f 100644
  
  /**
 diff --git a/include/linux/cpu.h b/include/linux/cpu.h
-index 797d9c8e9a1b..6eabd9e8a98b 100644
+index e571128ad99a..5e52d28c20c1 100644
 --- a/include/linux/cpu.h
 +++ b/include/linux/cpu.h
-@@ -201,6 +201,8 @@ extern void get_online_cpus(void);
+@@ -182,6 +182,8 @@ extern void get_online_cpus(void);
  extern void put_online_cpus(void);
  extern void cpu_hotplug_disable(void);
  extern void cpu_hotplug_enable(void);
@@ -7710,7 +6420,7 @@ index 797d9c8e9a1b..6eabd9e8a98b 100644
  #define hotcpu_notifier(fn, pri)      cpu_notifier(fn, pri)
  #define __hotcpu_notifier(fn, pri)    __cpu_notifier(fn, pri)
  #define register_hotcpu_notifier(nb)  register_cpu_notifier(nb)
-@@ -218,6 +220,8 @@ static inline void cpu_hotplug_done(void) {}
+@@ -199,6 +201,8 @@ static inline void cpu_hotplug_done(void) {}
  #define put_online_cpus()     do { } while (0)
  #define cpu_hotplug_disable() do { } while (0)
  #define cpu_hotplug_enable()  do { } while (0)
@@ -7720,7 +6430,7 @@ index 797d9c8e9a1b..6eabd9e8a98b 100644
  #define __hotcpu_notifier(fn, pri)    do { (void)(fn); } while (0)
  /* These aren't inline functions due to a GCC bug. */
 diff --git a/include/linux/dcache.h b/include/linux/dcache.h
-index 5ff3e9a4fe5f..ed0431599fd7 100644
+index 5beed7b30561..61cab7ef458e 100644
 --- a/include/linux/dcache.h
 +++ b/include/linux/dcache.h
 @@ -11,6 +11,7 @@
@@ -7764,26 +6474,6 @@ index a6ecb34cf547..37caab306336 100644
 +#endif
 +
  #endif /* defined(_LINUX_DELAY_H) */
-diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
-index 7d565afe35d2..8e31b4d245d2 100644
---- a/include/linux/ftrace.h
-+++ b/include/linux/ftrace.h
-@@ -714,6 +714,7 @@ static inline void __ftrace_enabled_restore(int enabled)
- #define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5))
- #define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6))
- 
-+#ifdef CONFIG_USING_GET_LOCK_PARENT_IP
- static inline unsigned long get_lock_parent_ip(void)
- {
-       unsigned long addr = CALLER_ADDR0;
-@@ -725,6 +726,7 @@ static inline unsigned long get_lock_parent_ip(void)
-               return addr;
-       return CALLER_ADDR2;
- }
-+#endif
- 
- #ifdef CONFIG_IRQSOFF_TRACER
-   extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
 diff --git a/include/linux/highmem.h b/include/linux/highmem.h
 index bb3f3297062a..a117a33ef72c 100644
 --- a/include/linux/highmem.h
@@ -7985,10 +6675,10 @@ index 083d61e92706..5899796f50cb 100644
  /**
   * idr_find - return pointer for given id
 diff --git a/include/linux/init_task.h b/include/linux/init_task.h
-index f8834f820ec2..a688d5e19578 100644
+index 325f649d77ff..8af70bcc799b 100644
 --- a/include/linux/init_task.h
 +++ b/include/linux/init_task.h
-@@ -148,6 +148,12 @@ extern struct task_group root_task_group;
+@@ -150,6 +150,12 @@ extern struct task_group root_task_group;
  # define INIT_PERF_EVENTS(tsk)
  #endif
  
@@ -8001,7 +6691,7 @@ index f8834f820ec2..a688d5e19578 100644
  #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
  # define INIT_VTIME(tsk)                                              \
        .vtime_seqcount = SEQCNT_ZERO(tsk.vtime_seqcount),      \
-@@ -239,6 +245,7 @@ extern struct task_group root_task_group;
+@@ -250,6 +256,7 @@ extern struct task_group root_task_group;
        .cpu_timers     = INIT_CPU_TIMERS(tsk.cpu_timers),              \
        .pi_lock        = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock),        \
        .timer_slack_ns = 50000, /* 50 usec default slack */            \
@@ -8010,7 +6700,7 @@ index f8834f820ec2..a688d5e19578 100644
                [PIDTYPE_PID]  = INIT_PID_LINK(PIDTYPE_PID),            \
                [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID),           \
 diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
-index b6683f0ffc9f..c0a351daf736 100644
+index 72f0721f75e7..480972ae47d3 100644
 --- a/include/linux/interrupt.h
 +++ b/include/linux/interrupt.h
 @@ -14,6 +14,7 @@
@@ -8066,7 +6756,7 @@ index b6683f0ffc9f..c0a351daf736 100644
        void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
        void (*release)(struct kref *ref);
  };
-@@ -398,9 +406,13 @@ extern int irq_set_irqchip_state(unsigned int irq, enum 
irqchip_irq_state which,
+@@ -406,9 +414,13 @@ extern int irq_set_irqchip_state(unsigned int irq, enum 
irqchip_irq_state which,
                                 bool state);
  
  #ifdef CONFIG_IRQ_FORCED_THREADING
@@ -8081,7 +6771,7 @@ index b6683f0ffc9f..c0a351daf736 100644
  #endif
  
  #ifndef __ARCH_SET_SOFTIRQ_PENDING
-@@ -457,9 +469,10 @@ struct softirq_action
+@@ -465,9 +477,10 @@ struct softirq_action
        void    (*action)(struct softirq_action *);
  };
  
@@ -8093,7 +6783,7 @@ index b6683f0ffc9f..c0a351daf736 100644
  #ifdef __ARCH_HAS_DO_SOFTIRQ
  void do_softirq_own_stack(void);
  #else
-@@ -468,13 +481,25 @@ static inline void do_softirq_own_stack(void)
+@@ -476,13 +489,25 @@ static inline void do_softirq_own_stack(void)
        __do_softirq();
  }
  #endif
@@ -8119,7 +6809,7 @@ index b6683f0ffc9f..c0a351daf736 100644
  
  DECLARE_PER_CPU(struct task_struct *, ksoftirqd);
  
-@@ -496,8 +521,9 @@ static inline struct task_struct *this_cpu_ksoftirqd(void)
+@@ -504,8 +529,9 @@ static inline struct task_struct *this_cpu_ksoftirqd(void)
       to be executed on some cpu at least once after this.
     * If the tasklet is already scheduled, but its execution is still not
       started, it will be executed only once.
@@ -8131,7 +6821,7 @@ index b6683f0ffc9f..c0a351daf736 100644
     * Tasklet is strictly serialized wrt itself, but not
       wrt another tasklets. If client needs some intertask synchronization,
       he makes it with spinlocks.
-@@ -522,27 +548,36 @@ struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), 
func, data }
+@@ -530,27 +556,36 @@ struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), 
func, data }
  enum
  {
        TASKLET_STATE_SCHED,    /* Tasklet is scheduled for execution */
@@ -8174,7 +6864,7 @@ index b6683f0ffc9f..c0a351daf736 100644
  #define tasklet_unlock_wait(t) do { } while (0)
  #define tasklet_unlock(t) do { } while (0)
  #endif
-@@ -591,12 +626,7 @@ static inline void tasklet_disable(struct tasklet_struct 
*t)
+@@ -599,12 +634,7 @@ static inline void tasklet_disable(struct tasklet_struct 
*t)
        smp_mb();
  }
  
@@ -8188,7 +6878,7 @@ index b6683f0ffc9f..c0a351daf736 100644
  extern void tasklet_kill(struct tasklet_struct *t);
  extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int 
cpu);
  extern void tasklet_init(struct tasklet_struct *t,
-@@ -627,6 +657,12 @@ void tasklet_hrtimer_cancel(struct tasklet_hrtimer 
*ttimer)
+@@ -635,6 +665,12 @@ void tasklet_hrtimer_cancel(struct tasklet_hrtimer 
*ttimer)
        tasklet_kill(&ttimer->tasklet);
  }
  
@@ -8202,7 +6892,7 @@ index b6683f0ffc9f..c0a351daf736 100644
   * Autoprobing for irqs:
   *
 diff --git a/include/linux/irq.h b/include/linux/irq.h
-index 0ac26c892fe2..ede85f106aef 100644
+index e79875574b39..177cee0c3305 100644
 --- a/include/linux/irq.h
 +++ b/include/linux/irq.h
 @@ -72,6 +72,7 @@ enum irqchip_irq_state;
@@ -8253,10 +6943,10 @@ index 47b9ebd4a74f..2543aab05daa 100644
 +
  #endif /* _LINUX_IRQ_WORK_H */
 diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
-index b51beebf9804..219d9824f762 100644
+index c9be57931b58..eeeb540971ae 100644
 --- a/include/linux/irqdesc.h
 +++ b/include/linux/irqdesc.h
-@@ -64,6 +64,7 @@ struct irq_desc {
+@@ -66,6 +66,7 @@ struct irq_desc {
        unsigned int            irqs_unhandled;
        atomic_t                threads_handled;
        int                     threads_handled_last;
@@ -8400,7 +7090,7 @@ index 410decacff8f..0861bebfc188 100644
  static inline int kdb_register(char *cmd, kdb_func_t func, char *usage,
                               char *help, short minlen) { return 0; }
 diff --git a/include/linux/kernel.h b/include/linux/kernel.h
-index d96a6118d26a..37de2ce2d290 100644
+index bc6ed52a39b9..7894d55e4998 100644
 --- a/include/linux/kernel.h
 +++ b/include/linux/kernel.h
 @@ -194,6 +194,9 @@ extern int _cond_resched(void);
@@ -8421,7 +7111,7 @@ index d96a6118d26a..37de2ce2d290 100644
  # define sched_annotate_sleep() do { } while (0)
  #endif
  
-@@ -491,6 +495,7 @@ extern enum system_states {
+@@ -488,6 +492,7 @@ extern enum system_states {
        SYSTEM_HALT,
        SYSTEM_POWER_OFF,
        SYSTEM_RESTART,
@@ -8429,62 +7119,6 @@ index d96a6118d26a..37de2ce2d290 100644
  } system_state;
  
  #define TAINT_PROPRIETARY_MODULE      0
-diff --git a/include/linux/lglock.h b/include/linux/lglock.h
-index c92ebd100d9b..6f035f635d0e 100644
---- a/include/linux/lglock.h
-+++ b/include/linux/lglock.h
-@@ -34,13 +34,30 @@
- #endif
- 
- struct lglock {
<Skipped 5383 lines>
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kernel.git/commitdiff/c7c167032e0a7bacaf4b9e53d4e0d8e71dfe0d29

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to