From db6e6a11e601ed79a78110bf0fb9a3ac7b58e4e5 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sat, 27 Aug 2016 13:11:40 +0200 Subject: add support for Qemu ARM noMMU Greg Ungerer made me aware of this possibility. Rather hackish implementation, we need to deduplicate later. Update Linux Kernel to 4.4.19 while there. Only non-Devicetree system supported right now. --- target/linux/config/Config.in.bus | 1 + target/linux/config/Config.in.ethernet | 2 + target/linux/config/Config.in.kernel | 3 +- target/linux/config/Config.in.serial | 2 + .../linux/patches/4.4.17/coldfire-sighandler.patch | 100 - target/linux/patches/4.4.17/crisv32.patch | 33 - .../patches/4.4.17/initramfs-nosizelimit.patch | 57 - target/linux/patches/4.4.17/ld-or1k.patch | 12 - target/linux/patches/4.4.17/macsonic.patch | 11 - target/linux/patches/4.4.17/mips-xz.patch | 12 - target/linux/patches/4.4.17/patch-realtime | 30649 ------------------- target/linux/patches/4.4.17/revert-sparc.patch | 319 - target/linux/patches/4.4.17/startup.patch | 34 - .../linux/patches/4.4.17/use-libgcc-for-sh.patch | 29 - .../linux/patches/4.4.19/coldfire-sighandler.patch | 100 + target/linux/patches/4.4.19/crisv32.patch | 33 + .../patches/4.4.19/initramfs-nosizelimit.patch | 57 + target/linux/patches/4.4.19/ld-or1k.patch | 12 + target/linux/patches/4.4.19/macsonic.patch | 11 + target/linux/patches/4.4.19/mips-xz.patch | 12 + target/linux/patches/4.4.19/patch-realtime | 30649 +++++++++++++++++++ target/linux/patches/4.4.19/revert-sparc.patch | 319 + target/linux/patches/4.4.19/startup.patch | 34 + .../linux/patches/4.4.19/use-libgcc-for-sh.patch | 29 + target/linux/patches/4.4.19/versatile-nommu.patch | 16 + 25 files changed, 31278 insertions(+), 31258 deletions(-) delete mode 100644 target/linux/patches/4.4.17/coldfire-sighandler.patch delete mode 100644 target/linux/patches/4.4.17/crisv32.patch delete mode 100644 target/linux/patches/4.4.17/initramfs-nosizelimit.patch delete mode 100644 target/linux/patches/4.4.17/ld-or1k.patch delete mode 100644 target/linux/patches/4.4.17/macsonic.patch delete mode 100644 target/linux/patches/4.4.17/mips-xz.patch delete mode 100644 target/linux/patches/4.4.17/patch-realtime delete mode 100644 target/linux/patches/4.4.17/revert-sparc.patch delete mode 100644 target/linux/patches/4.4.17/startup.patch delete mode 100644 target/linux/patches/4.4.17/use-libgcc-for-sh.patch create mode 100644 target/linux/patches/4.4.19/coldfire-sighandler.patch create mode 100644 target/linux/patches/4.4.19/crisv32.patch create mode 100644 target/linux/patches/4.4.19/initramfs-nosizelimit.patch create mode 100644 target/linux/patches/4.4.19/ld-or1k.patch create mode 100644 target/linux/patches/4.4.19/macsonic.patch create mode 100644 target/linux/patches/4.4.19/mips-xz.patch create mode 100644 target/linux/patches/4.4.19/patch-realtime create mode 100644 target/linux/patches/4.4.19/revert-sparc.patch create mode 100644 target/linux/patches/4.4.19/startup.patch create mode 100644 target/linux/patches/4.4.19/use-libgcc-for-sh.patch create mode 100644 target/linux/patches/4.4.19/versatile-nommu.patch (limited to 'target/linux') diff --git a/target/linux/config/Config.in.bus b/target/linux/config/Config.in.bus index 9921f5795..351b09f41 100644 --- a/target/linux/config/Config.in.bus +++ b/target/linux/config/Config.in.bus @@ -7,6 +7,7 @@ config ADK_KERNEL_PCI depends on ADK_TARGET_WITH_PCI \ || ADK_TARGET_QEMU \ || ADK_TARGET_VBOX + default n if ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB_NOMMU default y config ADK_KERNEL_PCI_QUIRKS diff --git a/target/linux/config/Config.in.ethernet b/target/linux/config/Config.in.ethernet index 8742b40c6..8f7bbc4b2 100644 --- a/target/linux/config/Config.in.ethernet +++ b/target/linux/config/Config.in.ethernet @@ -192,8 +192,10 @@ config ADK_KERNEL_SMC91X select ADK_KERNEL_GPIOLIB depends on ADK_TARGET_SYSTEM_ARM_FM || \ ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB || \ + ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB_NOMMU || \ ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE default y if ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB + default y if ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB_NOMMU default y if ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE default y if ADK_TARGET_SYSTEM_ARM_FM default n diff --git a/target/linux/config/Config.in.kernel b/target/linux/config/Config.in.kernel index 7761ced3c..843929376 100644 --- a/target/linux/config/Config.in.kernel +++ b/target/linux/config/Config.in.kernel @@ -88,8 +88,7 @@ config ADK_KERNEL_BINFMT_ELF_FDPIC config ADK_KERNEL_BINFMT_FLAT bool - default y if ADK_TARGET_BINFMT_FLAT_ONE - default y if ADK_TARGET_BINFMT_FLAT_SEP_DATA + default y if ADK_TARGET_BINFMT_FLAT config ADK_KERNEL_BINFMT_SHARED_FLAT bool diff --git a/target/linux/config/Config.in.serial b/target/linux/config/Config.in.serial index 82d745271..af8fed395 100644 --- a/target/linux/config/Config.in.serial +++ b/target/linux/config/Config.in.serial @@ -199,10 +199,12 @@ config ADK_KERNEL_SERIAL_AMBA_PL011 depends on ADK_TARGET_BOARD_BCM28XX \ || ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE \ || ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB \ + || ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB_NOMMU \ || ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9 default y if ADK_TARGET_BOARD_BCM28XX default y if ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE default y if ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB + default y if ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB_NOMMU default y if ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9 default n help diff --git a/target/linux/patches/4.4.17/coldfire-sighandler.patch b/target/linux/patches/4.4.17/coldfire-sighandler.patch deleted file mode 100644 index c52a4e228..000000000 --- a/target/linux/patches/4.4.17/coldfire-sighandler.patch +++ /dev/null @@ -1,100 +0,0 @@ -From a95517992a37488c0bc8b629c47c570e580e407d Mon Sep 17 00:00:00 2001 -From: Greg Ungerer -Date: Mon, 15 Feb 2016 16:36:29 +1000 -Subject: m68k: Use conventional function parameters for do_sigreturn - -Create conventional stack parameters for the calls to do_sigreturn and -do_rt_sigreturn. The current C code for do_sigreturn and do_rt_sigreturn -dig into the stack to create local pointers to the saved switch stack -and the pt_regs structs. - -The motivation for this change is a problem with non-MMU targets that -have broken signal return paths on newer versions of gcc. It appears as -though gcc has determined that the pointers into the saved stack structs, -and the saved structs themselves, are function parameters and updates to -them will be lost on function return, so they are optimized away. This -results in large parts of restore_sigcontext() and mangle_kernel_stack() -functions being removed. Of course this results in non-functional code -causing kernel oops. This problem has been observed with gcc version -5.2 and 5.3, and probably exists in earlier versions as well. - -Using conventional stack parameter pointers passed to these functions has -the advantage of the code here not needing to know the exact details of -how the underlying entry handler layed these structs out on the stack. -So the rather ugly pointer setup casting and arg referencing can be -removed. - -The resulting code after this change is a few bytes larger (due to the -overhead of creating the stack args and their tear down). Not being hot -paths I don't think this is too much of a problem here. - -An alternative solution is to put a barrier() in the do_sigreturn() code, -but this doesn't feel quite as clean as this solution. - -This change has been compile tested on all defconfigs, and run tested on -Atari (through aranym), ColdFire with MMU (M5407EVB) and ColdFire with -no-MMU (QEMU and M5208EVB). - -Signed-off-by: Greg Ungerer -Acked-by: Andreas Schwab -Signed-off-by: Geert Uytterhoeven ---- - arch/m68k/kernel/entry.S | 6 ++++++ - arch/m68k/kernel/signal.c | 8 ++------ - 2 files changed, 8 insertions(+), 6 deletions(-) - -diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S -index b54ac7a..97cd3ea 100644 ---- a/arch/m68k/kernel/entry.S -+++ b/arch/m68k/kernel/entry.S -@@ -71,13 +71,19 @@ ENTRY(__sys_vfork) - - ENTRY(sys_sigreturn) - SAVE_SWITCH_STACK -+ movel %sp,%sp@- | switch_stack pointer -+ pea %sp@(SWITCH_STACK_SIZE+4) | pt_regs pointer - jbsr do_sigreturn -+ addql #8,%sp - RESTORE_SWITCH_STACK - rts - - ENTRY(sys_rt_sigreturn) - SAVE_SWITCH_STACK -+ movel %sp,%sp@- | switch_stack pointer -+ pea %sp@(SWITCH_STACK_SIZE+4) | pt_regs pointer - jbsr do_rt_sigreturn -+ addql #8,%sp - RESTORE_SWITCH_STACK - rts - -diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c -index af1c4f3..2dcee3a 100644 ---- a/arch/m68k/kernel/signal.c -+++ b/arch/m68k/kernel/signal.c -@@ -737,10 +737,8 @@ badframe: - return 1; - } - --asmlinkage int do_sigreturn(unsigned long __unused) -+asmlinkage int do_sigreturn(struct pt_regs *regs, struct switch_stack *sw) - { -- struct switch_stack *sw = (struct switch_stack *) &__unused; -- struct pt_regs *regs = (struct pt_regs *) (sw + 1); - unsigned long usp = rdusp(); - struct sigframe __user *frame = (struct sigframe __user *)(usp - 4); - sigset_t set; -@@ -764,10 +762,8 @@ badframe: - return 0; - } - --asmlinkage int do_rt_sigreturn(unsigned long __unused) -+asmlinkage int do_rt_sigreturn(struct pt_regs *regs, struct switch_stack *sw) - { -- struct switch_stack *sw = (struct switch_stack *) &__unused; -- struct pt_regs *regs = (struct pt_regs *) (sw + 1); - unsigned long usp = rdusp(); - struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4); - sigset_t set; --- -cgit v0.12 - diff --git a/target/linux/patches/4.4.17/crisv32.patch b/target/linux/patches/4.4.17/crisv32.patch deleted file mode 100644 index cb9b0d028..000000000 --- a/target/linux/patches/4.4.17/crisv32.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -Nur linux-4.4.13.orig/arch/cris/arch-v32/mm/intmem.c linux-4.4.13/arch/cris/arch-v32/mm/intmem.c ---- linux-4.4.13.orig/arch/cris/arch-v32/mm/intmem.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/cris/arch-v32/mm/intmem.c 2016-06-21 20:40:18.919361891 +0200 -@@ -113,14 +113,14 @@ - - allocation->status = STATUS_FREE; - /* Join with prev and/or next if also free */ -- if ((prev != &intmem_allocations) && -+ if ((&prev->entry != &intmem_allocations) && - (prev->status == STATUS_FREE)) { - prev->size += allocation->size; - list_del(&allocation->entry); - kfree(allocation); - allocation = prev; - } -- if ((next != &intmem_allocations) && -+ if ((&next->entry != &intmem_allocations) && - (next->status == STATUS_FREE)) { - allocation->size += next->size; - list_del(&next->entry); -@@ -145,5 +145,11 @@ - (unsigned long)intmem_virtual + MEM_INTMEM_START + - RESERVED_SIZE); - } --device_initcall(crisv32_intmem_init); - -+static int __init crisv32_intmem_setup(void) -+{ -+ crisv32_intmem_init(); -+ -+ return 0; -+} -+device_initcall(crisv32_intmem_setup); diff --git a/target/linux/patches/4.4.17/initramfs-nosizelimit.patch b/target/linux/patches/4.4.17/initramfs-nosizelimit.patch deleted file mode 100644 index 40d2f6bd8..000000000 --- a/target/linux/patches/4.4.17/initramfs-nosizelimit.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 9a18df7a71bfa620b1278777d64783a359d7eb4e Mon Sep 17 00:00:00 2001 -From: Thorsten Glaser -Date: Sun, 4 May 2014 01:37:54 +0200 -Subject: [PATCH] mount tmpfs-as-rootfs (initramfs) with -o - nr_blocks=0,nr_inodes=0 - -I would have preferred to write this patch to be able to pass -rootflags=nr_blocks=0,nr_inodes=0 on the kernel command line, -and then hand these rootflags over to the initramfs (tmpfs) -mount in the same way the kernel hands them over to the block -device rootfs mount. But at least the Debian/m68k initrd also -parses $rootflags from the environment and adds it to the call -to the user-space mount for the eventual root device, which -would make the kernel command line rootflags option be used in -both places (tmpfs and e.g. ext4) which is guaranteed to error -out in at least one of them. - -This change is intended to aid people in a setup where the -initrd is the final root filesystem, i.e. not mounted over. -This is especially useful in automated tests running on qemu -for boards with constrained memory (e.g. 64 MiB on sh4). - -Considering that the initramfs is normally emptied out then -overmounted, this change is probably safe for setups where -initramfs just hosts early userspace, too, since the tmpfs -backing it is not accessible any more later on, AFAICT. - -Signed-off-by: Thorsten Glaser ---- - init/do_mounts.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/init/do_mounts.c b/init/do_mounts.c -index 82f2288..55a4cfe 100644 ---- a/init/do_mounts.c -+++ b/init/do_mounts.c -@@ -594,6 +594,7 @@ out: - } - - static bool is_tmpfs; -+static char tmpfs_rootflags[] = "nr_blocks=0,nr_inodes=0"; - static struct dentry *rootfs_mount(struct file_system_type *fs_type, - int flags, const char *dev_name, void *data) - { -@@ -606,6 +607,9 @@ static struct dentry *rootfs_mount(struct file_system_type *fs_type, - if (IS_ENABLED(CONFIG_TMPFS) && is_tmpfs) - fill = shmem_fill_super; - -+ if (is_tmpfs) -+ data = tmpfs_rootflags; -+ - return mount_nodev(fs_type, flags, data, fill); - } - --- -2.0.0.rc0 - diff --git a/target/linux/patches/4.4.17/ld-or1k.patch b/target/linux/patches/4.4.17/ld-or1k.patch deleted file mode 100644 index 264f9166f..000000000 --- a/target/linux/patches/4.4.17/ld-or1k.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Nur linux-4.4.5.orig/arch/openrisc/kernel/vmlinux.lds.S linux-4.4.5/arch/openrisc/kernel/vmlinux.lds.S ---- linux-4.4.5.orig/arch/openrisc/kernel/vmlinux.lds.S 2016-03-10 00:35:58.000000000 +0100 -+++ linux-4.4.5/arch/openrisc/kernel/vmlinux.lds.S 2016-03-16 09:21:07.933535532 +0100 -@@ -30,7 +30,7 @@ - #include - #include - --OUTPUT_FORMAT("elf32-or32", "elf32-or32", "elf32-or32") -+OUTPUT_FORMAT("elf32-or1k", "elf32-or1k", "elf32-or1k") - jiffies = jiffies_64 + 4; - - SECTIONS diff --git a/target/linux/patches/4.4.17/macsonic.patch b/target/linux/patches/4.4.17/macsonic.patch deleted file mode 100644 index 75a6fcad2..000000000 --- a/target/linux/patches/4.4.17/macsonic.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Nur linux-4.4.6.orig/drivers/net/ethernet/natsemi/Kconfig linux-4.4.6/drivers/net/ethernet/natsemi/Kconfig ---- linux-4.4.6.orig/drivers/net/ethernet/natsemi/Kconfig 2016-03-16 16:43:17.000000000 +0100 -+++ linux-4.4.6/drivers/net/ethernet/natsemi/Kconfig 2016-03-18 10:43:34.000000000 +0100 -@@ -18,6 +18,7 @@ - config MACSONIC - tristate "Macintosh SONIC based ethernet (onboard, NuBus, LC, CS)" - depends on MAC -+ select BITREVERSE - ---help--- - Support for NatSemi SONIC based Ethernet devices. This includes - the onboard Ethernet in many Quadras as well as some LC-PDS, diff --git a/target/linux/patches/4.4.17/mips-xz.patch b/target/linux/patches/4.4.17/mips-xz.patch deleted file mode 100644 index 5cfac6254..000000000 --- a/target/linux/patches/4.4.17/mips-xz.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Nur linux-4.4.5.orig/arch/mips/boot/compressed/Makefile linux-4.4.5/arch/mips/boot/compressed/Makefile ---- linux-4.4.5.orig/arch/mips/boot/compressed/Makefile 2016-03-10 00:35:58.000000000 +0100 -+++ linux-4.4.5/arch/mips/boot/compressed/Makefile 2016-03-15 11:35:31.951795457 +0100 -@@ -41,7 +41,7 @@ - endif - - ifdef CONFIG_KERNEL_XZ --vmlinuzobjs-y += $(obj)/../../lib/ashldi3.o -+vmlinuzobjs-y += $(obj)/../../lib/ashldi3.o $(obj)/../../lib/bswapsi.o - endif - - targets += vmlinux.bin diff --git a/target/linux/patches/4.4.17/patch-realtime b/target/linux/patches/4.4.17/patch-realtime deleted file mode 100644 index c677e4098..000000000 --- a/target/linux/patches/4.4.17/patch-realtime +++ /dev/null @@ -1,30649 +0,0 @@ -diff -Nur linux-4.4.13.orig/arch/arm/include/asm/switch_to.h linux-4.4.13/arch/arm/include/asm/switch_to.h ---- linux-4.4.13.orig/arch/arm/include/asm/switch_to.h 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/include/asm/switch_to.h 2016-06-22 21:55:07.966523867 +0200 -@@ -3,6 +3,13 @@ - - #include - -+#if defined CONFIG_PREEMPT_RT_FULL && defined CONFIG_HIGHMEM -+void switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p); -+#else -+static inline void -+switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p) { } -+#endif -+ - /* - * For v7 SMP cores running a preemptible kernel we may be pre-empted - * during a TLB maintenance operation, so execute an inner-shareable dsb -@@ -25,6 +32,7 @@ - #define switch_to(prev,next,last) \ - do { \ - __complete_pending_tlbi(); \ -+ switch_kmaps(prev, next); \ - last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \ - } while (0) - -diff -Nur linux-4.4.13.orig/arch/arm/include/asm/thread_info.h linux-4.4.13/arch/arm/include/asm/thread_info.h ---- linux-4.4.13.orig/arch/arm/include/asm/thread_info.h 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/include/asm/thread_info.h 2016-06-22 21:55:07.966523867 +0200 -@@ -49,6 +49,7 @@ - struct thread_info { - unsigned long flags; /* low level flags */ - int preempt_count; /* 0 => preemptable, <0 => bug */ -+ int preempt_lazy_count; /* 0 => preemptable, <0 => bug */ - mm_segment_t addr_limit; /* address limit */ - struct task_struct *task; /* main task structure */ - __u32 cpu; /* cpu */ -@@ -142,7 +143,8 @@ - #define TIF_SYSCALL_TRACE 4 /* syscall trace active */ - #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ - #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ --#define TIF_SECCOMP 7 /* seccomp syscall filtering active */ -+#define TIF_SECCOMP 8 /* seccomp syscall filtering active */ -+#define TIF_NEED_RESCHED_LAZY 7 - - #define TIF_NOHZ 12 /* in adaptive nohz mode */ - #define TIF_USING_IWMMXT 17 -@@ -152,6 +154,7 @@ - #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) - #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) - #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) -+#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) - #define _TIF_UPROBE (1 << TIF_UPROBE) - #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) - #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) -@@ -167,7 +170,8 @@ - * Change these and you break ASM code in entry-common.S - */ - #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ -- _TIF_NOTIFY_RESUME | _TIF_UPROBE) -+ _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ -+ _TIF_NEED_RESCHED_LAZY) - - #endif /* __KERNEL__ */ - #endif /* __ASM_ARM_THREAD_INFO_H */ -diff -Nur linux-4.4.13.orig/arch/arm/Kconfig linux-4.4.13/arch/arm/Kconfig ---- linux-4.4.13.orig/arch/arm/Kconfig 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/Kconfig 2016-06-22 21:55:07.966523867 +0200 -@@ -33,7 +33,7 @@ - select HARDIRQS_SW_RESEND - select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT) - select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6 -- select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 -+ select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !PREEMPT_RT_BASE - select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 - select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT) - select HAVE_ARCH_TRACEHOOK -@@ -68,6 +68,7 @@ - select HAVE_PERF_EVENTS - select HAVE_PERF_REGS - select HAVE_PERF_USER_STACK_DUMP -+ select HAVE_PREEMPT_LAZY - select HAVE_RCU_TABLE_FREE if (SMP && ARM_LPAE) - select HAVE_REGS_AND_STACK_ACCESS_API - select HAVE_SYSCALL_TRACEPOINTS -diff -Nur linux-4.4.13.orig/arch/arm/kernel/asm-offsets.c linux-4.4.13/arch/arm/kernel/asm-offsets.c ---- linux-4.4.13.orig/arch/arm/kernel/asm-offsets.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/kernel/asm-offsets.c 2016-06-22 21:55:07.970523867 +0200 -@@ -65,6 +65,7 @@ - BLANK(); - DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); - DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); -+ DEFINE(TI_PREEMPT_LAZY, offsetof(struct thread_info, preempt_lazy_count)); - DEFINE(TI_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); - DEFINE(TI_TASK, offsetof(struct thread_info, task)); - DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); -diff -Nur linux-4.4.13.orig/arch/arm/kernel/entry-armv.S linux-4.4.13/arch/arm/kernel/entry-armv.S ---- linux-4.4.13.orig/arch/arm/kernel/entry-armv.S 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/kernel/entry-armv.S 2016-06-22 21:55:07.970523867 +0200 -@@ -215,11 +215,18 @@ - #ifdef CONFIG_PREEMPT - get_thread_info tsk - ldr r8, [tsk, #TI_PREEMPT] @ get preempt count -- ldr r0, [tsk, #TI_FLAGS] @ get flags - teq r8, #0 @ if preempt count != 0 -+ bne 1f @ return from exeption -+ ldr r0, [tsk, #TI_FLAGS] @ get flags -+ tst r0, #_TIF_NEED_RESCHED @ if NEED_RESCHED is set -+ blne svc_preempt @ preempt! -+ -+ ldr r8, [tsk, #TI_PREEMPT_LAZY] @ get preempt lazy count -+ teq r8, #0 @ if preempt lazy count != 0 - movne r0, #0 @ force flags to 0 -- tst r0, #_TIF_NEED_RESCHED -+ tst r0, #_TIF_NEED_RESCHED_LAZY - blne svc_preempt -+1: - #endif - - svc_exit r5, irq = 1 @ return from exception -@@ -234,8 +241,14 @@ - 1: bl preempt_schedule_irq @ irq en/disable is done inside - ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS - tst r0, #_TIF_NEED_RESCHED -+ bne 1b -+ tst r0, #_TIF_NEED_RESCHED_LAZY - reteq r8 @ go again -- b 1b -+ ldr r0, [tsk, #TI_PREEMPT_LAZY] @ get preempt lazy count -+ teq r0, #0 @ if preempt lazy count != 0 -+ beq 1b -+ ret r8 @ go again -+ - #endif - - __und_fault: -diff -Nur linux-4.4.13.orig/arch/arm/kernel/entry-common.S linux-4.4.13/arch/arm/kernel/entry-common.S ---- linux-4.4.13.orig/arch/arm/kernel/entry-common.S 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/kernel/entry-common.S 2016-06-22 21:55:07.970523867 +0200 -@@ -36,7 +36,9 @@ - UNWIND(.cantunwind ) - disable_irq_notrace @ disable interrupts - ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing -- tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK -+ tst r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP) -+ bne fast_work_pending -+ tst r1, #_TIF_SECCOMP - bne fast_work_pending - - /* perform architecture specific actions before user return */ -@@ -62,8 +64,11 @@ - str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 - disable_irq_notrace @ disable interrupts - ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing -- tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK -+ tst r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP) -+ bne do_slower_path -+ tst r1, #_TIF_SECCOMP - beq no_work_pending -+do_slower_path: - UNWIND(.fnend ) - ENDPROC(ret_fast_syscall) - -diff -Nur linux-4.4.13.orig/arch/arm/kernel/process.c linux-4.4.13/arch/arm/kernel/process.c ---- linux-4.4.13.orig/arch/arm/kernel/process.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/kernel/process.c 2016-06-22 21:55:07.970523867 +0200 -@@ -319,6 +319,30 @@ - } - - #ifdef CONFIG_MMU -+/* -+ * CONFIG_SPLIT_PTLOCK_CPUS results in a page->ptl lock. If the lock is not -+ * initialized by pgtable_page_ctor() then a coredump of the vector page will -+ * fail. -+ */ -+static int __init vectors_user_mapping_init_page(void) -+{ -+ struct page *page; -+ unsigned long addr = 0xffff0000; -+ pgd_t *pgd; -+ pud_t *pud; -+ pmd_t *pmd; -+ -+ pgd = pgd_offset_k(addr); -+ pud = pud_offset(pgd, addr); -+ pmd = pmd_offset(pud, addr); -+ page = pmd_page(*(pmd)); -+ -+ pgtable_page_ctor(page); -+ -+ return 0; -+} -+late_initcall(vectors_user_mapping_init_page); -+ - #ifdef CONFIG_KUSER_HELPERS - /* - * The vectors page is always readable from user space for the -diff -Nur linux-4.4.13.orig/arch/arm/kernel/signal.c linux-4.4.13/arch/arm/kernel/signal.c ---- linux-4.4.13.orig/arch/arm/kernel/signal.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/kernel/signal.c 2016-06-22 21:55:07.970523867 +0200 -@@ -572,7 +572,8 @@ - */ - trace_hardirqs_off(); - do { -- if (likely(thread_flags & _TIF_NEED_RESCHED)) { -+ if (likely(thread_flags & (_TIF_NEED_RESCHED | -+ _TIF_NEED_RESCHED_LAZY))) { - schedule(); - } else { - if (unlikely(!user_mode(regs))) -diff -Nur linux-4.4.13.orig/arch/arm/kernel/smp.c linux-4.4.13/arch/arm/kernel/smp.c ---- linux-4.4.13.orig/arch/arm/kernel/smp.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/kernel/smp.c 2016-06-22 21:55:07.974523867 +0200 -@@ -230,8 +230,6 @@ - flush_cache_louis(); - local_flush_tlb_all(); - -- clear_tasks_mm_cpumask(cpu); -- - return 0; - } - -@@ -247,6 +245,9 @@ - pr_err("CPU%u: cpu didn't die\n", cpu); - return; - } -+ -+ clear_tasks_mm_cpumask(cpu); -+ - pr_notice("CPU%u: shutdown\n", cpu); - - /* -diff -Nur linux-4.4.13.orig/arch/arm/kernel/unwind.c linux-4.4.13/arch/arm/kernel/unwind.c ---- linux-4.4.13.orig/arch/arm/kernel/unwind.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/kernel/unwind.c 2016-06-22 21:55:07.974523867 +0200 -@@ -93,7 +93,7 @@ - static const struct unwind_idx *__origin_unwind_idx; - extern const struct unwind_idx __stop_unwind_idx[]; - --static DEFINE_SPINLOCK(unwind_lock); -+static DEFINE_RAW_SPINLOCK(unwind_lock); - static LIST_HEAD(unwind_tables); - - /* Convert a prel31 symbol to an absolute address */ -@@ -201,7 +201,7 @@ - /* module unwind tables */ - struct unwind_table *table; - -- spin_lock_irqsave(&unwind_lock, flags); -+ raw_spin_lock_irqsave(&unwind_lock, flags); - list_for_each_entry(table, &unwind_tables, list) { - if (addr >= table->begin_addr && - addr < table->end_addr) { -@@ -213,7 +213,7 @@ - break; - } - } -- spin_unlock_irqrestore(&unwind_lock, flags); -+ raw_spin_unlock_irqrestore(&unwind_lock, flags); - } - - pr_debug("%s: idx = %p\n", __func__, idx); -@@ -529,9 +529,9 @@ - tab->begin_addr = text_addr; - tab->end_addr = text_addr + text_size; - -- spin_lock_irqsave(&unwind_lock, flags); -+ raw_spin_lock_irqsave(&unwind_lock, flags); - list_add_tail(&tab->list, &unwind_tables); -- spin_unlock_irqrestore(&unwind_lock, flags); -+ raw_spin_unlock_irqrestore(&unwind_lock, flags); - - return tab; - } -@@ -543,9 +543,9 @@ - if (!tab) - return; - -- spin_lock_irqsave(&unwind_lock, flags); -+ raw_spin_lock_irqsave(&unwind_lock, flags); - list_del(&tab->list); -- spin_unlock_irqrestore(&unwind_lock, flags); -+ raw_spin_unlock_irqrestore(&unwind_lock, flags); - - kfree(tab); - } -diff -Nur linux-4.4.13.orig/arch/arm/kvm/arm.c linux-4.4.13/arch/arm/kvm/arm.c ---- linux-4.4.13.orig/arch/arm/kvm/arm.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/kvm/arm.c 2016-06-22 21:55:07.974523867 +0200 -@@ -498,18 +498,18 @@ - struct kvm_vcpu *vcpu; - - kvm_for_each_vcpu(i, vcpu, kvm) { -- wait_queue_head_t *wq = kvm_arch_vcpu_wq(vcpu); -+ struct swait_queue_head *wq = kvm_arch_vcpu_wq(vcpu); - - vcpu->arch.pause = false; -- wake_up_interruptible(wq); -+ swake_up(wq); - } - } - - static void vcpu_sleep(struct kvm_vcpu *vcpu) - { -- wait_queue_head_t *wq = kvm_arch_vcpu_wq(vcpu); -+ struct swait_queue_head *wq = kvm_arch_vcpu_wq(vcpu); - -- wait_event_interruptible(*wq, ((!vcpu->arch.power_off) && -+ swait_event_interruptible(*wq, ((!vcpu->arch.power_off) && - (!vcpu->arch.pause))); - } - -@@ -568,7 +568,7 @@ - * involves poking the GIC, which must be done in a - * non-preemptible context. - */ -- preempt_disable(); -+ migrate_disable(); - kvm_timer_flush_hwstate(vcpu); - kvm_vgic_flush_hwstate(vcpu); - -@@ -587,7 +587,7 @@ - local_irq_enable(); - kvm_timer_sync_hwstate(vcpu); - kvm_vgic_sync_hwstate(vcpu); -- preempt_enable(); -+ migrate_enable(); - continue; - } - -@@ -641,7 +641,7 @@ - - kvm_vgic_sync_hwstate(vcpu); - -- preempt_enable(); -+ migrate_enable(); - - ret = handle_exit(vcpu, run, ret); - } -diff -Nur linux-4.4.13.orig/arch/arm/kvm/psci.c linux-4.4.13/arch/arm/kvm/psci.c ---- linux-4.4.13.orig/arch/arm/kvm/psci.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/kvm/psci.c 2016-06-22 21:55:07.974523867 +0200 -@@ -70,7 +70,7 @@ - { - struct kvm *kvm = source_vcpu->kvm; - struct kvm_vcpu *vcpu = NULL; -- wait_queue_head_t *wq; -+ struct swait_queue_head *wq; - unsigned long cpu_id; - unsigned long context_id; - phys_addr_t target_pc; -@@ -119,7 +119,7 @@ - smp_mb(); /* Make sure the above is visible */ - - wq = kvm_arch_vcpu_wq(vcpu); -- wake_up_interruptible(wq); -+ swake_up(wq); - - return PSCI_RET_SUCCESS; - } -diff -Nur linux-4.4.13.orig/arch/arm/mach-at91/at91rm9200.c linux-4.4.13/arch/arm/mach-at91/at91rm9200.c ---- linux-4.4.13.orig/arch/arm/mach-at91/at91rm9200.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-at91/at91rm9200.c 2016-06-22 21:55:07.974523867 +0200 -@@ -12,7 +12,6 @@ - #include - - #include --#include - - #include "generic.h" - #include "soc.h" -@@ -33,7 +32,6 @@ - - of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); - -- arm_pm_idle = at91rm9200_idle; - at91rm9200_pm_init(); - } - -diff -Nur linux-4.4.13.orig/arch/arm/mach-at91/at91sam9.c linux-4.4.13/arch/arm/mach-at91/at91sam9.c ---- linux-4.4.13.orig/arch/arm/mach-at91/at91sam9.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-at91/at91sam9.c 2016-06-22 21:55:07.974523867 +0200 -@@ -62,8 +62,6 @@ - soc_dev = soc_device_to_device(soc); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); -- -- arm_pm_idle = at91sam9_idle; - } - - static void __init at91sam9_dt_device_init(void) -diff -Nur linux-4.4.13.orig/arch/arm/mach-at91/generic.h linux-4.4.13/arch/arm/mach-at91/generic.h ---- linux-4.4.13.orig/arch/arm/mach-at91/generic.h 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-at91/generic.h 2016-06-22 21:55:07.974523867 +0200 -@@ -11,27 +11,18 @@ - #ifndef _AT91_GENERIC_H - #define _AT91_GENERIC_H - --#include --#include -- -- /* Map io */ --extern void __init at91_map_io(void); --extern void __init at91_alt_map_io(void); -- --/* idle */ --extern void at91rm9200_idle(void); --extern void at91sam9_idle(void); -- - #ifdef CONFIG_PM - extern void __init at91rm9200_pm_init(void); - extern void __init at91sam9260_pm_init(void); - extern void __init at91sam9g45_pm_init(void); - extern void __init at91sam9x5_pm_init(void); -+extern void __init sama5_pm_init(void); - #else - static inline void __init at91rm9200_pm_init(void) { } - static inline void __init at91sam9260_pm_init(void) { } - static inline void __init at91sam9g45_pm_init(void) { } - static inline void __init at91sam9x5_pm_init(void) { } -+static inline void __init sama5_pm_init(void) { } - #endif - - #endif /* _AT91_GENERIC_H */ -diff -Nur linux-4.4.13.orig/arch/arm/mach-at91/Kconfig linux-4.4.13/arch/arm/mach-at91/Kconfig ---- linux-4.4.13.orig/arch/arm/mach-at91/Kconfig 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-at91/Kconfig 2016-06-22 21:55:07.974523867 +0200 -@@ -99,6 +99,7 @@ - config COMMON_CLK_AT91 - bool - select COMMON_CLK -+ select MFD_SYSCON - - config HAVE_AT91_SMD - bool -diff -Nur linux-4.4.13.orig/arch/arm/mach-at91/pm.c linux-4.4.13/arch/arm/mach-at91/pm.c ---- linux-4.4.13.orig/arch/arm/mach-at91/pm.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-at91/pm.c 2016-06-22 21:55:07.974523867 +0200 -@@ -31,10 +31,13 @@ - #include - #include - #include -+#include - - #include "generic.h" - #include "pm.h" - -+static void __iomem *pmc; -+ - /* - * FIXME: this is needed to communicate between the pinctrl driver and - * the PM implementation in the machine. Possibly part of the PM -@@ -87,7 +90,7 @@ - unsigned long scsr; - int i; - -- scsr = at91_pmc_read(AT91_PMC_SCSR); -+ scsr = readl(pmc + AT91_PMC_SCSR); - - /* USB must not be using PLLB */ - if ((scsr & at91_pm_data.uhp_udp_mask) != 0) { -@@ -101,8 +104,7 @@ - - if ((scsr & (AT91_PMC_PCK0 << i)) == 0) - continue; -- -- css = at91_pmc_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS; -+ css = readl(pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS; - if (css != AT91_PMC_CSS_SLOW) { - pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); - return 0; -@@ -145,8 +147,8 @@ - flush_cache_all(); - outer_disable(); - -- at91_suspend_sram_fn(at91_pmc_base, at91_ramc_base[0], -- at91_ramc_base[1], pm_data); -+ at91_suspend_sram_fn(pmc, at91_ramc_base[0], -+ at91_ramc_base[1], pm_data); - - outer_resume(); - } -@@ -353,6 +355,21 @@ - at91_pm_set_standby(standby); - } - -+void at91rm9200_idle(void) -+{ -+ /* -+ * Disable the processor clock. The processor will be automatically -+ * re-enabled by an interrupt or by a reset. -+ */ -+ writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR); -+} -+ -+void at91sam9_idle(void) -+{ -+ writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR); -+ cpu_do_idle(); -+} -+ - static void __init at91_pm_sram_init(void) - { - struct gen_pool *sram_pool; -@@ -399,13 +416,36 @@ - &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); - } - --static void __init at91_pm_init(void) -+static const struct of_device_id atmel_pmc_ids[] __initconst = { -+ { .compatible = "atmel,at91rm9200-pmc" }, -+ { .compatible = "atmel,at91sam9260-pmc" }, -+ { .compatible = "atmel,at91sam9g45-pmc" }, -+ { .compatible = "atmel,at91sam9n12-pmc" }, -+ { .compatible = "atmel,at91sam9x5-pmc" }, -+ { .compatible = "atmel,sama5d3-pmc" }, -+ { .compatible = "atmel,sama5d2-pmc" }, -+ { /* sentinel */ }, -+}; -+ -+static void __init at91_pm_init(void (*pm_idle)(void)) - { -- at91_pm_sram_init(); -+ struct device_node *pmc_np; - - if (at91_cpuidle_device.dev.platform_data) - platform_device_register(&at91_cpuidle_device); - -+ pmc_np = of_find_matching_node(NULL, atmel_pmc_ids); -+ pmc = of_iomap(pmc_np, 0); -+ if (!pmc) { -+ pr_err("AT91: PM not supported, PMC not found\n"); -+ return; -+ } -+ -+ if (pm_idle) -+ arm_pm_idle = pm_idle; -+ -+ at91_pm_sram_init(); -+ - if (at91_suspend_sram_fn) - suspend_set_ops(&at91_pm_ops); - else -@@ -424,7 +464,7 @@ - at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP; - at91_pm_data.memctrl = AT91_MEMCTRL_MC; - -- at91_pm_init(); -+ at91_pm_init(at91rm9200_idle); - } - - void __init at91sam9260_pm_init(void) -@@ -432,7 +472,7 @@ - at91_dt_ramc(); - at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; - at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; -- return at91_pm_init(); -+ at91_pm_init(at91sam9_idle); - } - - void __init at91sam9g45_pm_init(void) -@@ -440,7 +480,7 @@ - at91_dt_ramc(); - at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP; - at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; -- return at91_pm_init(); -+ at91_pm_init(at91sam9_idle); - } - - void __init at91sam9x5_pm_init(void) -@@ -448,5 +488,13 @@ - at91_dt_ramc(); - at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; - at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; -- return at91_pm_init(); -+ at91_pm_init(at91sam9_idle); -+} -+ -+void __init sama5_pm_init(void) -+{ -+ at91_dt_ramc(); -+ at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; -+ at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; -+ at91_pm_init(NULL); - } -diff -Nur linux-4.4.13.orig/arch/arm/mach-at91/sama5.c linux-4.4.13/arch/arm/mach-at91/sama5.c ---- linux-4.4.13.orig/arch/arm/mach-at91/sama5.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-at91/sama5.c 2016-06-22 21:55:07.974523867 +0200 -@@ -51,7 +51,7 @@ - soc_dev = soc_device_to_device(soc); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); -- at91sam9x5_pm_init(); -+ sama5_pm_init(); - } - - static const char *const sama5_dt_board_compat[] __initconst = { -diff -Nur linux-4.4.13.orig/arch/arm/mach-exynos/platsmp.c linux-4.4.13/arch/arm/mach-exynos/platsmp.c ---- linux-4.4.13.orig/arch/arm/mach-exynos/platsmp.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-exynos/platsmp.c 2016-06-22 21:55:07.974523867 +0200 -@@ -230,7 +230,7 @@ - return (void __iomem *)(S5P_VA_SCU); - } - --static DEFINE_SPINLOCK(boot_lock); -+static DEFINE_RAW_SPINLOCK(boot_lock); - - static void exynos_secondary_init(unsigned int cpu) - { -@@ -243,8 +243,8 @@ - /* - * Synchronise with the boot thread. - */ -- spin_lock(&boot_lock); -- spin_unlock(&boot_lock); -+ raw_spin_lock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - } - - int exynos_set_boot_addr(u32 core_id, unsigned long boot_addr) -@@ -308,7 +308,7 @@ - * Set synchronisation state between this boot processor - * and the secondary one - */ -- spin_lock(&boot_lock); -+ raw_spin_lock(&boot_lock); - - /* - * The secondary processor is waiting to be released from -@@ -335,7 +335,7 @@ - - if (timeout == 0) { - printk(KERN_ERR "cpu1 power enable failed"); -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - return -ETIMEDOUT; - } - } -@@ -381,7 +381,7 @@ - * calibrations, then wait for it to finish - */ - fail: -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - - return pen_release != -1 ? ret : 0; - } -diff -Nur linux-4.4.13.orig/arch/arm/mach-hisi/platmcpm.c linux-4.4.13/arch/arm/mach-hisi/platmcpm.c ---- linux-4.4.13.orig/arch/arm/mach-hisi/platmcpm.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-hisi/platmcpm.c 2016-06-22 21:55:07.974523867 +0200 -@@ -61,7 +61,7 @@ - - static void __iomem *sysctrl, *fabric; - static int hip04_cpu_table[HIP04_MAX_CLUSTERS][HIP04_MAX_CPUS_PER_CLUSTER]; --static DEFINE_SPINLOCK(boot_lock); -+static DEFINE_RAW_SPINLOCK(boot_lock); - static u32 fabric_phys_addr; - /* - * [0]: bootwrapper physical address -@@ -113,7 +113,7 @@ - if (cluster >= HIP04_MAX_CLUSTERS || cpu >= HIP04_MAX_CPUS_PER_CLUSTER) - return -EINVAL; - -- spin_lock_irq(&boot_lock); -+ raw_spin_lock_irq(&boot_lock); - - if (hip04_cpu_table[cluster][cpu]) - goto out; -@@ -147,7 +147,7 @@ - - out: - hip04_cpu_table[cluster][cpu]++; -- spin_unlock_irq(&boot_lock); -+ raw_spin_unlock_irq(&boot_lock); - - return 0; - } -@@ -162,11 +162,11 @@ - cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); - cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); - -- spin_lock(&boot_lock); -+ raw_spin_lock(&boot_lock); - hip04_cpu_table[cluster][cpu]--; - if (hip04_cpu_table[cluster][cpu] == 1) { - /* A power_up request went ahead of us. */ -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - return; - } else if (hip04_cpu_table[cluster][cpu] > 1) { - pr_err("Cluster %d CPU%d boots multiple times\n", cluster, cpu); -@@ -174,7 +174,7 @@ - } - - last_man = hip04_cluster_is_down(cluster); -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - if (last_man) { - /* Since it's Cortex A15, disable L2 prefetching. */ - asm volatile( -@@ -203,7 +203,7 @@ - cpu >= HIP04_MAX_CPUS_PER_CLUSTER); - - count = TIMEOUT_MSEC / POLL_MSEC; -- spin_lock_irq(&boot_lock); -+ raw_spin_lock_irq(&boot_lock); - for (tries = 0; tries < count; tries++) { - if (hip04_cpu_table[cluster][cpu]) - goto err; -@@ -211,10 +211,10 @@ - data = readl_relaxed(sysctrl + SC_CPU_RESET_STATUS(cluster)); - if (data & CORE_WFI_STATUS(cpu)) - break; -- spin_unlock_irq(&boot_lock); -+ raw_spin_unlock_irq(&boot_lock); - /* Wait for clean L2 when the whole cluster is down. */ - msleep(POLL_MSEC); -- spin_lock_irq(&boot_lock); -+ raw_spin_lock_irq(&boot_lock); - } - if (tries >= count) - goto err; -@@ -231,10 +231,10 @@ - goto err; - if (hip04_cluster_is_down(cluster)) - hip04_set_snoop_filter(cluster, 0); -- spin_unlock_irq(&boot_lock); -+ raw_spin_unlock_irq(&boot_lock); - return 1; - err: -- spin_unlock_irq(&boot_lock); -+ raw_spin_unlock_irq(&boot_lock); - return 0; - } - #endif -diff -Nur linux-4.4.13.orig/arch/arm/mach-imx/Kconfig linux-4.4.13/arch/arm/mach-imx/Kconfig ---- linux-4.4.13.orig/arch/arm/mach-imx/Kconfig 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-imx/Kconfig 2016-06-22 21:55:07.974523867 +0200 -@@ -524,7 +524,7 @@ - bool "i.MX6 Quad/DualLite support" - select ARM_ERRATA_764369 if SMP - select HAVE_ARM_SCU if SMP -- select HAVE_ARM_TWD if SMP -+ select HAVE_ARM_TWD - select PCI_DOMAINS if PCI - select PINCTRL_IMX6Q - select SOC_IMX6 -diff -Nur linux-4.4.13.orig/arch/arm/mach-omap2/omap-smp.c linux-4.4.13/arch/arm/mach-omap2/omap-smp.c ---- linux-4.4.13.orig/arch/arm/mach-omap2/omap-smp.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-omap2/omap-smp.c 2016-06-22 21:55:07.974523867 +0200 -@@ -43,7 +43,7 @@ - /* SCU base address */ - static void __iomem *scu_base; - --static DEFINE_SPINLOCK(boot_lock); -+static DEFINE_RAW_SPINLOCK(boot_lock); - - void __iomem *omap4_get_scu_base(void) - { -@@ -74,8 +74,8 @@ - /* - * Synchronise with the boot thread. - */ -- spin_lock(&boot_lock); -- spin_unlock(&boot_lock); -+ raw_spin_lock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - } - - static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle) -@@ -89,7 +89,7 @@ - * Set synchronisation state between this boot processor - * and the secondary one - */ -- spin_lock(&boot_lock); -+ raw_spin_lock(&boot_lock); - - /* - * Update the AuxCoreBoot0 with boot state for secondary core. -@@ -166,7 +166,7 @@ - * Now the secondary core is starting up let it run its - * calibrations, then wait for it to finish - */ -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - - return 0; - } -diff -Nur linux-4.4.13.orig/arch/arm/mach-prima2/platsmp.c linux-4.4.13/arch/arm/mach-prima2/platsmp.c ---- linux-4.4.13.orig/arch/arm/mach-prima2/platsmp.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-prima2/platsmp.c 2016-06-22 21:55:07.974523867 +0200 -@@ -22,7 +22,7 @@ - - static void __iomem *clk_base; - --static DEFINE_SPINLOCK(boot_lock); -+static DEFINE_RAW_SPINLOCK(boot_lock); - - static void sirfsoc_secondary_init(unsigned int cpu) - { -@@ -36,8 +36,8 @@ - /* - * Synchronise with the boot thread. - */ -- spin_lock(&boot_lock); -- spin_unlock(&boot_lock); -+ raw_spin_lock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - } - - static const struct of_device_id clk_ids[] = { -@@ -75,7 +75,7 @@ - /* make sure write buffer is drained */ - mb(); - -- spin_lock(&boot_lock); -+ raw_spin_lock(&boot_lock); - - /* - * The secondary processor is waiting to be released from -@@ -107,7 +107,7 @@ - * now the secondary core is starting up let it run its - * calibrations, then wait for it to finish - */ -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - - return pen_release != -1 ? -ENOSYS : 0; - } -diff -Nur linux-4.4.13.orig/arch/arm/mach-qcom/platsmp.c linux-4.4.13/arch/arm/mach-qcom/platsmp.c ---- linux-4.4.13.orig/arch/arm/mach-qcom/platsmp.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-qcom/platsmp.c 2016-06-22 21:55:07.974523867 +0200 -@@ -46,7 +46,7 @@ - - extern void secondary_startup_arm(void); - --static DEFINE_SPINLOCK(boot_lock); -+static DEFINE_RAW_SPINLOCK(boot_lock); - - #ifdef CONFIG_HOTPLUG_CPU - static void qcom_cpu_die(unsigned int cpu) -@@ -60,8 +60,8 @@ - /* - * Synchronise with the boot thread. - */ -- spin_lock(&boot_lock); -- spin_unlock(&boot_lock); -+ raw_spin_lock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - } - - static int scss_release_secondary(unsigned int cpu) -@@ -284,7 +284,7 @@ - * set synchronisation state between this boot processor - * and the secondary one - */ -- spin_lock(&boot_lock); -+ raw_spin_lock(&boot_lock); - - /* - * Send the secondary CPU a soft interrupt, thereby causing -@@ -297,7 +297,7 @@ - * now the secondary core is starting up let it run its - * calibrations, then wait for it to finish - */ -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - - return ret; - } -diff -Nur linux-4.4.13.orig/arch/arm/mach-spear/platsmp.c linux-4.4.13/arch/arm/mach-spear/platsmp.c ---- linux-4.4.13.orig/arch/arm/mach-spear/platsmp.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-spear/platsmp.c 2016-06-22 21:55:07.974523867 +0200 -@@ -32,7 +32,7 @@ - sync_cache_w(&pen_release); - } - --static DEFINE_SPINLOCK(boot_lock); -+static DEFINE_RAW_SPINLOCK(boot_lock); - - static void __iomem *scu_base = IOMEM(VA_SCU_BASE); - -@@ -47,8 +47,8 @@ - /* - * Synchronise with the boot thread. - */ -- spin_lock(&boot_lock); -- spin_unlock(&boot_lock); -+ raw_spin_lock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - } - - static int spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle) -@@ -59,7 +59,7 @@ - * set synchronisation state between this boot processor - * and the secondary one - */ -- spin_lock(&boot_lock); -+ raw_spin_lock(&boot_lock); - - /* - * The secondary processor is waiting to be released from -@@ -84,7 +84,7 @@ - * now the secondary core is starting up let it run its - * calibrations, then wait for it to finish - */ -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - - return pen_release != -1 ? -ENOSYS : 0; - } -diff -Nur linux-4.4.13.orig/arch/arm/mach-sti/platsmp.c linux-4.4.13/arch/arm/mach-sti/platsmp.c ---- linux-4.4.13.orig/arch/arm/mach-sti/platsmp.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mach-sti/platsmp.c 2016-06-22 21:55:07.974523867 +0200 -@@ -35,7 +35,7 @@ - sync_cache_w(&pen_release); - } - --static DEFINE_SPINLOCK(boot_lock); -+static DEFINE_RAW_SPINLOCK(boot_lock); - - static void sti_secondary_init(unsigned int cpu) - { -@@ -48,8 +48,8 @@ - /* - * Synchronise with the boot thread. - */ -- spin_lock(&boot_lock); -- spin_unlock(&boot_lock); -+ raw_spin_lock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - } - - static int sti_boot_secondary(unsigned int cpu, struct task_struct *idle) -@@ -60,7 +60,7 @@ - * set synchronisation state between this boot processor - * and the secondary one - */ -- spin_lock(&boot_lock); -+ raw_spin_lock(&boot_lock); - - /* - * The secondary processor is waiting to be released from -@@ -91,7 +91,7 @@ - * now the secondary core is starting up let it run its - * calibrations, then wait for it to finish - */ -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - - return pen_release != -1 ? -ENOSYS : 0; - } -diff -Nur linux-4.4.13.orig/arch/arm/mm/fault.c linux-4.4.13/arch/arm/mm/fault.c ---- linux-4.4.13.orig/arch/arm/mm/fault.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mm/fault.c 2016-06-22 21:55:07.974523867 +0200 -@@ -430,6 +430,9 @@ - if (addr < TASK_SIZE) - return do_page_fault(addr, fsr, regs); - -+ if (interrupts_enabled(regs)) -+ local_irq_enable(); -+ - if (user_mode(regs)) - goto bad_area; - -@@ -497,6 +500,9 @@ - static int - do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) - { -+ if (interrupts_enabled(regs)) -+ local_irq_enable(); -+ - do_bad_area(addr, fsr, regs); - return 0; - } -diff -Nur linux-4.4.13.orig/arch/arm/mm/highmem.c linux-4.4.13/arch/arm/mm/highmem.c ---- linux-4.4.13.orig/arch/arm/mm/highmem.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/mm/highmem.c 2016-06-22 21:55:07.974523867 +0200 -@@ -34,6 +34,11 @@ - return *ptep; - } - -+static unsigned int fixmap_idx(int type) -+{ -+ return FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); -+} -+ - void *kmap(struct page *page) - { - might_sleep(); -@@ -54,12 +59,13 @@ - - void *kmap_atomic(struct page *page) - { -+ pte_t pte = mk_pte(page, kmap_prot); - unsigned int idx; - unsigned long vaddr; - void *kmap; - int type; - -- preempt_disable(); -+ preempt_disable_nort(); - pagefault_disable(); - if (!PageHighMem(page)) - return page_address(page); -@@ -79,7 +85,7 @@ - - type = kmap_atomic_idx_push(); - -- idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); -+ idx = fixmap_idx(type); - vaddr = __fix_to_virt(idx); - #ifdef CONFIG_DEBUG_HIGHMEM - /* -@@ -93,7 +99,10 @@ - * in place, so the contained TLB flush ensures the TLB is updated - * with the new mapping. - */ -- set_fixmap_pte(idx, mk_pte(page, kmap_prot)); -+#ifdef CONFIG_PREEMPT_RT_FULL -+ current->kmap_pte[type] = pte; -+#endif -+ set_fixmap_pte(idx, pte); - - return (void *)vaddr; - } -@@ -106,44 +115,75 @@ - - if (kvaddr >= (void *)FIXADDR_START) { - type = kmap_atomic_idx(); -- idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); -+ idx = fixmap_idx(type); - - if (cache_is_vivt()) - __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); -+#ifdef CONFIG_PREEMPT_RT_FULL -+ current->kmap_pte[type] = __pte(0); -+#endif - #ifdef CONFIG_DEBUG_HIGHMEM - BUG_ON(vaddr != __fix_to_virt(idx)); -- set_fixmap_pte(idx, __pte(0)); - #else - (void) idx; /* to kill a warning */ - #endif -+ set_fixmap_pte(idx, __pte(0)); - kmap_atomic_idx_pop(); - } else if (vaddr >= PKMAP_ADDR(0) && vaddr < PKMAP_ADDR(LAST_PKMAP)) { - /* this address was obtained through kmap_high_get() */ - kunmap_high(pte_page(pkmap_page_table[PKMAP_NR(vaddr)])); - } - pagefault_enable(); -- preempt_enable(); -+ preempt_enable_nort(); - } - EXPORT_SYMBOL(__kunmap_atomic); - - void *kmap_atomic_pfn(unsigned long pfn) - { -+ pte_t pte = pfn_pte(pfn, kmap_prot); - unsigned long vaddr; - int idx, type; - struct page *page = pfn_to_page(pfn); - -- preempt_disable(); -+ preempt_disable_nort(); - pagefault_disable(); - if (!PageHighMem(page)) - return page_address(page); - - type = kmap_atomic_idx_push(); -- idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); -+ idx = fixmap_idx(type); - vaddr = __fix_to_virt(idx); - #ifdef CONFIG_DEBUG_HIGHMEM - BUG_ON(!pte_none(get_fixmap_pte(vaddr))); - #endif -- set_fixmap_pte(idx, pfn_pte(pfn, kmap_prot)); -+#ifdef CONFIG_PREEMPT_RT_FULL -+ current->kmap_pte[type] = pte; -+#endif -+ set_fixmap_pte(idx, pte); - - return (void *)vaddr; - } -+#if defined CONFIG_PREEMPT_RT_FULL -+void switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p) -+{ -+ int i; -+ -+ /* -+ * Clear @prev's kmap_atomic mappings -+ */ -+ for (i = 0; i < prev_p->kmap_idx; i++) { -+ int idx = fixmap_idx(i); -+ -+ set_fixmap_pte(idx, __pte(0)); -+ } -+ /* -+ * Restore @next_p's kmap_atomic mappings -+ */ -+ for (i = 0; i < next_p->kmap_idx; i++) { -+ int idx = fixmap_idx(i); -+ -+ if (!pte_none(next_p->kmap_pte[i])) -+ set_fixmap_pte(idx, next_p->kmap_pte[i]); -+ } -+} -+#endif -diff -Nur linux-4.4.13.orig/arch/arm/plat-versatile/platsmp.c linux-4.4.13/arch/arm/plat-versatile/platsmp.c ---- linux-4.4.13.orig/arch/arm/plat-versatile/platsmp.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm/plat-versatile/platsmp.c 2016-06-22 21:55:07.974523867 +0200 -@@ -30,7 +30,7 @@ - sync_cache_w(&pen_release); - } - --static DEFINE_SPINLOCK(boot_lock); -+static DEFINE_RAW_SPINLOCK(boot_lock); - - void versatile_secondary_init(unsigned int cpu) - { -@@ -43,8 +43,8 @@ - /* - * Synchronise with the boot thread. - */ -- spin_lock(&boot_lock); -- spin_unlock(&boot_lock); -+ raw_spin_lock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - } - - int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle) -@@ -55,7 +55,7 @@ - * Set synchronisation state between this boot processor - * and the secondary one - */ -- spin_lock(&boot_lock); -+ raw_spin_lock(&boot_lock); - - /* - * This is really belt and braces; we hold unintended secondary -@@ -85,7 +85,7 @@ - * now the secondary core is starting up let it run its - * calibrations, then wait for it to finish - */ -- spin_unlock(&boot_lock); -+ raw_spin_unlock(&boot_lock); - - return pen_release != -1 ? -ENOSYS : 0; - } -diff -Nur linux-4.4.13.orig/arch/arm64/include/asm/thread_info.h linux-4.4.13/arch/arm64/include/asm/thread_info.h ---- linux-4.4.13.orig/arch/arm64/include/asm/thread_info.h 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm64/include/asm/thread_info.h 2016-06-22 21:55:07.974523867 +0200 -@@ -49,6 +49,7 @@ - mm_segment_t addr_limit; /* address limit */ - struct task_struct *task; /* main task structure */ - int preempt_count; /* 0 => preemptable, <0 => bug */ -+ int preempt_lazy_count; /* 0 => preemptable, <0 => bug */ - int cpu; /* cpu */ - }; - -@@ -103,6 +104,7 @@ - #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 */ -+#define TIF_NEED_RESCHED_LAZY 4 - #define TIF_NOHZ 7 - #define TIF_SYSCALL_TRACE 8 - #define TIF_SYSCALL_AUDIT 9 -@@ -118,6 +120,7 @@ - #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) - #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) - #define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE) -+#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) - #define _TIF_NOHZ (1 << TIF_NOHZ) - #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) - #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) -@@ -126,7 +129,8 @@ - #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_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ - _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ -diff -Nur linux-4.4.13.orig/arch/arm64/Kconfig linux-4.4.13/arch/arm64/Kconfig ---- linux-4.4.13.orig/arch/arm64/Kconfig 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm64/Kconfig 2016-06-22 21:55:07.974523867 +0200 -@@ -76,6 +76,7 @@ - select HAVE_PERF_REGS - select HAVE_PERF_USER_STACK_DUMP - select HAVE_RCU_TABLE_FREE -+ select HAVE_PREEMPT_LAZY - select HAVE_SYSCALL_TRACEPOINTS - select IOMMU_DMA if IOMMU_SUPPORT - select IRQ_DOMAIN -@@ -562,7 +563,7 @@ - - config XEN - bool "Xen guest support on ARM64" -- depends on ARM64 && OF -+ depends on ARM64 && OF && !PREEMPT_RT_FULL - select SWIOTLB_XEN - help - Say Y if you want to run Linux in a Virtual Machine on Xen on ARM64. -diff -Nur linux-4.4.13.orig/arch/arm64/kernel/asm-offsets.c linux-4.4.13/arch/arm64/kernel/asm-offsets.c ---- linux-4.4.13.orig/arch/arm64/kernel/asm-offsets.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm64/kernel/asm-offsets.c 2016-06-22 21:55:07.974523867 +0200 -@@ -35,6 +35,7 @@ - BLANK(); - DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); - DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); -+ DEFINE(TI_PREEMPT_LAZY, offsetof(struct thread_info, preempt_lazy_count)); - DEFINE(TI_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); - DEFINE(TI_TASK, offsetof(struct thread_info, task)); - DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); -diff -Nur linux-4.4.13.orig/arch/arm64/kernel/entry.S linux-4.4.13/arch/arm64/kernel/entry.S ---- linux-4.4.13.orig/arch/arm64/kernel/entry.S 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/arm64/kernel/entry.S 2016-06-22 21:55:07.978523867 +0200 -@@ -363,11 +363,16 @@ - #ifdef CONFIG_PREEMPT - get_thread_info tsk - ldr w24, [tsk, #TI_PREEMPT] // get preempt count -- cbnz w24, 1f // preempt count != 0 -+ cbnz w24, 2f // preempt count != 0 - ldr x0, [tsk, #TI_FLAGS] // get flags -- tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? -- bl el1_preempt -+ tbnz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? -+ -+ ldr w24, [tsk, #TI_PREEMPT_LAZY] // get preempt lazy count -+ cbnz w24, 2f // preempt lazy count != 0 -+ tbz x0, #TIF_NEED_RESCHED_LAZY, 2f // needs rescheduling? - 1: -+ bl el1_preempt -+2: - #endif - #ifdef CONFIG_TRACE_IRQFLAGS - bl trace_hardirqs_on -@@ -381,6 +386,7 @@ - 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? -+ tbnz x0, #TIF_NEED_RESCHED_LAZY, 1b // needs rescheduling? - ret x24 - #endif - -@@ -625,6 +631,7 @@ - */ - 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 */ - ldr x2, [sp, #S_PSTATE] - mov x0, sp // 'regs' -diff -Nur linux-4.4.13.orig/arch/Kconfig linux-4.4.13/arch/Kconfig ---- linux-4.4.13.orig/arch/Kconfig 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/Kconfig 2016-06-22 21:55:07.978523867 +0200 -@@ -9,6 +9,7 @@ - tristate "OProfile system profiling" - depends on PROFILING - depends on HAVE_OPROFILE -+ depends on !PREEMPT_RT_FULL - select RING_BUFFER - select RING_BUFFER_ALLOW_SWAP - help -@@ -52,6 +53,7 @@ - config JUMP_LABEL - bool "Optimize very unlikely/likely branches" - depends on HAVE_ARCH_JUMP_LABEL -+ depends on (!INTERRUPT_OFF_HIST && !PREEMPT_OFF_HIST && !WAKEUP_LATENCY_HIST && !MISSED_TIMER_OFFSETS_HIST) - help - This option enables a transparent branch optimization that - makes certain almost-always-true or almost-always-false branch -diff -Nur linux-4.4.13.orig/arch/mips/Kconfig linux-4.4.13/arch/mips/Kconfig ---- linux-4.4.13.orig/arch/mips/Kconfig 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/mips/Kconfig 2016-06-22 21:55:07.978523867 +0200 -@@ -2410,7 +2410,7 @@ - # - config HIGHMEM - bool "High Memory Support" -- depends on 32BIT && CPU_SUPPORTS_HIGHMEM && SYS_SUPPORTS_HIGHMEM && !CPU_MIPS32_3_5_EVA -+ depends on 32BIT && CPU_SUPPORTS_HIGHMEM && SYS_SUPPORTS_HIGHMEM && !CPU_MIPS32_3_5_EVA && !PREEMPT_RT_FULL - - config CPU_SUPPORTS_HIGHMEM - bool -diff -Nur linux-4.4.13.orig/arch/mips/kvm/mips.c linux-4.4.13/arch/mips/kvm/mips.c ---- linux-4.4.13.orig/arch/mips/kvm/mips.c 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/mips/kvm/mips.c 2016-06-22 21:55:07.978523867 +0200 -@@ -445,8 +445,8 @@ - - dvcpu->arch.wait = 0; - -- if (waitqueue_active(&dvcpu->wq)) -- wake_up_interruptible(&dvcpu->wq); -+ if (swait_active(&dvcpu->wq)) -+ swake_up(&dvcpu->wq); - - return 0; - } -@@ -1174,8 +1174,8 @@ - kvm_mips_callbacks->queue_timer_int(vcpu); - - vcpu->arch.wait = 0; -- if (waitqueue_active(&vcpu->wq)) -- wake_up_interruptible(&vcpu->wq); -+ if (swait_active(&vcpu->wq)) -+ swake_up(&vcpu->wq); - } - - /* low level hrtimer wake routine */ -diff -Nur linux-4.4.13.orig/arch/powerpc/include/asm/kvm_host.h linux-4.4.13/arch/powerpc/include/asm/kvm_host.h ---- linux-4.4.13.orig/arch/powerpc/include/asm/kvm_host.h 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/powerpc/include/asm/kvm_host.h 2016-06-22 21:55:07.978523867 +0200 -@@ -286,7 +286,7 @@ - struct list_head runnable_threads; - struct list_head preempt_list; - spinlock_t lock; -- wait_queue_head_t wq; -+ struct swait_queue_head wq; - spinlock_t stoltb_lock; /* protects stolen_tb and preempt_tb */ - u64 stolen_tb; - u64 preempt_tb; -@@ -626,7 +626,7 @@ - u8 prodded; - u32 last_inst; - -- wait_queue_head_t *wqp; -+ struct swait_queue_head *wqp; - struct kvmppc_vcore *vcore; - int ret; - int trap; -diff -Nur linux-4.4.13.orig/arch/powerpc/include/asm/thread_info.h linux-4.4.13/arch/powerpc/include/asm/thread_info.h ---- linux-4.4.13.orig/arch/powerpc/include/asm/thread_info.h 2016-06-08 03:14:51.000000000 +0200 -+++ linux-4.4.13/arch/powerpc/include/asm/thread_info.h 2016-06-22 21:55:07.978523867 +0200 -@@ -42,6 +42,8 @@ - int cpu; /* cpu we're on */ - int preempt_count; /* 0 => preemptable, - <0 => BUG */ -+ int preempt_lazy_count; /* 0 => preemptable, -+ <0 => BUG */ - unsigned long local_flags; /* private flags for thread */ - - /* low level flags - has atomic operations done on it */ -@@ -82,8 +84,7 @@ - #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ - #define TIF_SIGPENDING 1 /* signal pending */ - #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ --#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling -- TIF_NEED_RESCHED */ -+#define TIF_NEED_RESCHED_LAZY 3 /* lazy rescheduling necessary */ - #define TIF_32BIT 4 /* 32 bit binary */ - #define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */ - #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ -@@ -101,6 +102,8 @@ - #if defined(CONFIG_PPC64) - #define TIF_ELF2ABI 18 /* function descriptors must die! */ - #endif -+#define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling -+ TIF_NEED_RESCHED */ - - /* as above, but as bit values */ - #define _TIF_SYSCALL_TRACE (1<