From 21a6e6df534b1921f486c4eac3cb8d01e96743a7 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 1 Nov 2016 21:49:14 +0100 Subject: linux: update realtime patch, reported by Oliver --- target/linux/patches/4.4.28/patch-realtime | 8329 ++++++++++++++-------------- 1 file changed, 4080 insertions(+), 4249 deletions(-) (limited to 'target/linux') diff --git a/target/linux/patches/4.4.28/patch-realtime b/target/linux/patches/4.4.28/patch-realtime index f4cb92ae5..9dd3be37b 100644 --- a/target/linux/patches/4.4.28/patch-realtime +++ b/target/linux/patches/4.4.28/patch-realtime @@ -1,609 +1,256 @@ - From: - https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/ - -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="). +diff -Nur linux-4.4.28.orig/arch/arm/include/asm/switch_to.h linux-4.4.28/arch/arm/include/asm/switch_to.h +--- linux-4.4.28.orig/arch/arm/include/asm/switch_to.h 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/include/asm/switch_to.h 2016-11-01 21:26:56.728210258 +0100 +@@ -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 + -+Example: + /* + * 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.28.orig/arch/arm/include/asm/thread_info.h linux-4.4.28/arch/arm/include/asm/thread_info.h +--- linux-4.4.28.orig/arch/arm/include/asm/thread_info.h 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/include/asm/thread_info.h 2016-11-01 21:26:56.748211548 +0100 +@@ -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.28.orig/arch/arm/Kconfig linux-4.4.28/arch/arm/Kconfig +--- linux-4.4.28.orig/arch/arm/Kconfig 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/Kconfig 2016-11-01 21:26:56.696208202 +0100 +@@ -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.28.orig/arch/arm/kernel/asm-offsets.c linux-4.4.28/arch/arm/kernel/asm-offsets.c +--- linux-4.4.28.orig/arch/arm/kernel/asm-offsets.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/kernel/asm-offsets.c 2016-11-01 21:26:56.760212322 +0100 +@@ -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.28.orig/arch/arm/kernel/entry-armv.S linux-4.4.28/arch/arm/kernel/entry-armv.S +--- linux-4.4.28.orig/arch/arm/kernel/entry-armv.S 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/kernel/entry-armv.S 2016-11-01 21:26:56.764212578 +0100 +@@ -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! + -+ # modprobe hwlat_detector enabled=1 threshold=100 ++ 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 + -+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. + #endif + + __und_fault: +diff -Nur linux-4.4.28.orig/arch/arm/kernel/entry-common.S linux-4.4.28/arch/arm/kernel/entry-common.S +--- linux-4.4.28.orig/arch/arm/kernel/entry-common.S 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/kernel/entry-common.S 2016-11-01 21:26:56.764212578 +0100 +@@ -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.28.orig/arch/arm/kernel/process.c linux-4.4.28/arch/arm/kernel/process.c +--- linux-4.4.28.orig/arch/arm/kernel/process.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/kernel/process.c 2016-11-01 21:26:56.772213095 +0100 +@@ -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; + -+The /debug/hwlat_detector interface contains the following files: ++ pgd = pgd_offset_k(addr); ++ pud = pud_offset(pgd, addr); ++ pmd = pmd_offset(pud, addr); ++ page = pmd_page(*(pmd)); + -+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 -+ (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) ++ pgtable_page_ctor(page); + -+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/kernel-parameters.txt b/Documentation/kernel-parameters.txt -index 0e4102ae1a61..26b5f39d57a8 100644 ---- a/Documentation/kernel-parameters.txt -+++ b/Documentation/kernel-parameters.txt -@@ -1629,6 +1629,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted. - ip= [IP_PNP] - See Documentation/filesystems/nfs/nfsroot.txt. - -+ irqaffinity= [SMP] Set the default irq affinity mask -+ Format: -+ ,..., -+ or -+ - -+ (must be a positive range in ascending order) -+ or a mixture -+ ,...,- ++ return 0; ++} ++late_initcall(vectors_user_mapping_init_page); + - irqfixup [HW] - When an interrupt is not handled search all handlers - for it. Intended to get systems with badly broken -diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt -index 13f5619b2203..f64d075ba647 100644 ---- a/Documentation/sysrq.txt -+++ b/Documentation/sysrq.txt -@@ -59,10 +59,17 @@ On PowerPC - Press 'ALT - Print Screen (or F13) - , - On other - If you know of the key combos for other architectures, please - let me know so I can add them to this section. + #ifdef CONFIG_KUSER_HELPERS + /* + * The vectors page is always readable from user space for the +diff -Nur linux-4.4.28.orig/arch/arm/kernel/signal.c linux-4.4.28/arch/arm/kernel/signal.c +--- linux-4.4.28.orig/arch/arm/kernel/signal.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/kernel/signal.c 2016-11-01 21:26:56.772213095 +0100 +@@ -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.28.orig/arch/arm/kernel/smp.c linux-4.4.28/arch/arm/kernel/smp.c +--- linux-4.4.28.orig/arch/arm/kernel/smp.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/kernel/smp.c 2016-11-01 21:26:56.772213095 +0100 +@@ -230,8 +230,6 @@ + flush_cache_louis(); + local_flush_tlb_all(); --On all - write a character to /proc/sysrq-trigger. e.g.: +- clear_tasks_mm_cpumask(cpu); - -+On all - write a character to /proc/sysrq-trigger, e.g.: - echo t > /proc/sysrq-trigger + return 0; + } -+On all - Enable network SysRq by writing a cookie to icmp_echo_sysrq, e.g. -+ echo 0x01020304 >/proc/sys/net/ipv4/icmp_echo_sysrq -+ Send an ICMP echo request with this pattern plus the particular -+ SysRq command key. Example: -+ # ping -c1 -s57 -p0102030468 -+ will trigger the SysRq-H (help) command. +@@ -247,6 +245,9 @@ + pr_err("CPU%u: cpu didn't die\n", cpu); + return; + } + ++ clear_tasks_mm_cpumask(cpu); + - * What are the 'command' keys? - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 'b' - Will immediately reboot the system without syncing or unmounting -diff --git a/Documentation/trace/histograms.txt b/Documentation/trace/histograms.txt -new file mode 100644 -index 000000000000..6f2aeabf7faa ---- /dev/null -+++ b/Documentation/trace/histograms.txt -@@ -0,0 +1,186 @@ -+ Using the Linux Kernel Latency Histograms -+ -+ -+This document gives a short explanation how to enable, configure and use -+latency histograms. Latency histograms are primarily relevant in the -+context of real-time enabled kernels (CONFIG_PREEMPT/CONFIG_PREEMPT_RT) -+and are used in the quality management of the Linux real-time -+capabilities. -+ -+ -+* Purpose of latency histograms -+ -+A latency histogram continuously accumulates the frequencies of latency -+data. There are two types of histograms -+- potential sources of latencies -+- effective latencies -+ -+ -+* Potential sources of latencies -+ -+Potential sources of latencies are code segments where interrupts, -+preemption or both are disabled (aka critical sections). To create -+histograms of potential sources of latency, the kernel stores the time -+stamp at the start of a critical section, determines the time elapsed -+when the end of the section is reached, and increments the frequency -+counter of that latency value - irrespective of whether any concurrently -+running process is affected by latency or not. -+- Configuration items (in the Kernel hacking/Tracers submenu) -+ CONFIG_INTERRUPT_OFF_LATENCY -+ CONFIG_PREEMPT_OFF_LATENCY -+ -+ -+* Effective latencies -+ -+Effective latencies are actually occuring during wakeup of a process. To -+determine effective latencies, the kernel stores the time stamp when a -+process is scheduled to be woken up, and determines the duration of the -+wakeup time shortly before control is passed over to this process. Note -+that the apparent latency in user space may be somewhat longer, since the -+process may be interrupted after control is passed over to it but before -+the execution in user space takes place. Simply measuring the interval -+between enqueuing and wakeup may also not appropriate in cases when a -+process is scheduled as a result of a timer expiration. The timer may have -+missed its deadline, e.g. due to disabled interrupts, but this latency -+would not be registered. Therefore, the offsets of missed timers are -+recorded in a separate histogram. If both wakeup latency and missed timer -+offsets are configured and enabled, a third histogram may be enabled that -+records the overall latency as a sum of the timer latency, if any, and the -+wakeup latency. This histogram is called "timerandwakeup". -+- Configuration items (in the Kernel hacking/Tracers submenu) -+ CONFIG_WAKEUP_LATENCY -+ CONFIG_MISSED_TIMER_OFSETS -+ -+ -+* Usage -+ -+The interface to the administration of the latency histograms is located -+in the debugfs file system. To mount it, either enter -+ -+mount -t sysfs nodev /sys -+mount -t debugfs nodev /sys/kernel/debug -+ -+from shell command line level, or add -+ -+nodev /sys sysfs defaults 0 0 -+nodev /sys/kernel/debug debugfs defaults 0 0 -+ -+to the file /etc/fstab. All latency histogram related files are then -+available in the directory /sys/kernel/debug/tracing/latency_hist. A -+particular histogram type is enabled by writing non-zero to the related -+variable in the /sys/kernel/debug/tracing/latency_hist/enable directory. -+Select "preemptirqsoff" for the histograms of potential sources of -+latencies and "wakeup" for histograms of effective latencies etc. The -+histogram data - one per CPU - are available in the files -+ -+/sys/kernel/debug/tracing/latency_hist/preemptoff/CPUx -+/sys/kernel/debug/tracing/latency_hist/irqsoff/CPUx -+/sys/kernel/debug/tracing/latency_hist/preemptirqsoff/CPUx -+/sys/kernel/debug/tracing/latency_hist/wakeup/CPUx -+/sys/kernel/debug/tracing/latency_hist/wakeup/sharedprio/CPUx -+/sys/kernel/debug/tracing/latency_hist/missed_timer_offsets/CPUx -+/sys/kernel/debug/tracing/latency_hist/timerandwakeup/CPUx -+ -+The histograms are reset by writing non-zero to the file "reset" in a -+particular latency directory. To reset all latency data, use -+ -+#!/bin/sh -+ -+TRACINGDIR=/sys/kernel/debug/tracing -+HISTDIR=$TRACINGDIR/latency_hist -+ -+if test -d $HISTDIR -+then -+ cd $HISTDIR -+ for i in `find . | grep /reset$` -+ do -+ echo 1 >$i -+ done -+fi -+ -+ -+* Data format -+ -+Latency data are stored with a resolution of one microsecond. The -+maximum latency is 10,240 microseconds. The data are only valid, if the -+overflow register is empty. Every output line contains the latency in -+microseconds in the first row and the number of samples in the second -+row. To display only lines with a positive latency count, use, for -+example, -+ -+grep -v " 0$" /sys/kernel/debug/tracing/latency_hist/preemptoff/CPU0 -+ -+#Minimum latency: 0 microseconds. -+#Average latency: 0 microseconds. -+#Maximum latency: 25 microseconds. -+#Total samples: 3104770694 -+#There are 0 samples greater or equal than 10240 microseconds -+#usecs samples -+ 0 2984486876 -+ 1 49843506 -+ 2 58219047 -+ 3 5348126 -+ 4 2187960 -+ 5 3388262 -+ 6 959289 -+ 7 208294 -+ 8 40420 -+ 9 4485 -+ 10 14918 -+ 11 18340 -+ 12 25052 -+ 13 19455 -+ 14 5602 -+ 15 969 -+ 16 47 -+ 17 18 -+ 18 14 -+ 19 1 -+ 20 3 -+ 21 2 -+ 22 5 -+ 23 2 -+ 25 1 -+ -+ -+* Wakeup latency of a selected process -+ -+To only collect wakeup latency data of a particular process, write the -+PID of the requested process to -+ -+/sys/kernel/debug/tracing/latency_hist/wakeup/pid -+ -+PIDs are not considered, if this variable is set to 0. -+ -+ -+* Details of the process with the highest wakeup latency so far -+ -+Selected data of the process that suffered from the highest wakeup -+latency that occurred in a particular CPU are available in the file -+ -+/sys/kernel/debug/tracing/latency_hist/wakeup/max_latency-CPUx. -+ -+In addition, other relevant system data at the time when the -+latency occurred are given. -+ -+The format of the data is (all in one line): -+ () \ -+<- -+ -+The value of is only relevant in the combined timer -+and wakeup latency recording. In the wakeup recording, it is -+always 0, in the missed_timer_offsets recording, it is the same -+as . -+ -+When retrospectively searching for the origin of a latency and -+tracing was not enabled, it may be helpful to know the name and -+some basic data of the task that (finally) was switching to the -+late real-tlme task. In addition to the victim's data, also the -+data of the possible culprit are therefore displayed after the -+"<-" symbol. -+ -+Finally, the timestamp of the time when the latency occurred -+in . after the most recent system boot -+is provided. -+ -+These data are also reset when the wakeup histogram is reset. -diff --git a/Makefile b/Makefile -index 695c64ec160c..45b60fceb84b 100644 ---- a/Makefile -+++ b/Makefile -@@ -768,6 +768,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=strict-prototypes) - # Prohibit date/time macros, which would make the build non-deterministic - KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) - -+# enforce correct pointer usage -+KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) -+ - # use the deterministic mode of AR if available - KBUILD_ARFLAGS := $(call ar-option,D) + pr_notice("CPU%u: shutdown\n", cpu); -diff --git a/arch/Kconfig b/arch/Kconfig -index 4e949e58b192..3b26d76933fb 100644 ---- a/arch/Kconfig -+++ b/arch/Kconfig -@@ -9,6 +9,7 @@ config OPROFILE - 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 KPROBES - 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 --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index 34e1569a11ee..79c4603e9453 100644 ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -33,7 +33,7 @@ config ARM - 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 @@ config ARM - 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 --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 -+++ b/arch/arm/include/asm/switch_to.h -@@ -3,6 +3,13 @@ + /* +diff -Nur linux-4.4.28.orig/arch/arm/kernel/unwind.c linux-4.4.28/arch/arm/kernel/unwind.c +--- linux-4.4.28.orig/arch/arm/kernel/unwind.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/kernel/unwind.c 2016-11-01 21:26:56.776213352 +0100 +@@ -93,7 +93,7 @@ + static const struct unwind_idx *__origin_unwind_idx; + extern const struct unwind_idx __stop_unwind_idx[]; - #include +-static DEFINE_SPINLOCK(unwind_lock); ++static DEFINE_RAW_SPINLOCK(unwind_lock); + static LIST_HEAD(unwind_tables); -+#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 @@ extern struct task_struct *__switch_to(struct task_struct *, struct thread_info - #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 --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h -index 776757d1604a..1f36a4eccc72 100644 ---- a/arch/arm/include/asm/thread_info.h -+++ b/arch/arm/include/asm/thread_info.h -@@ -49,6 +49,7 @@ struct cpu_context_save { - 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 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, - #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 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, - #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 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, - * 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 --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c -index 871b8267d211..4dbe70de7318 100644 ---- a/arch/arm/kernel/asm-offsets.c -+++ b/arch/arm/kernel/asm-offsets.c -@@ -65,6 +65,7 @@ int main(void) - 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 --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S -index 3ce377f7251f..d044cea59f54 100644 ---- a/arch/arm/kernel/entry-armv.S -+++ b/arch/arm/kernel/entry-armv.S -@@ -215,11 +215,18 @@ __irq_svc: - #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 @@ svc_preempt: - 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 --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S -index 30a7228eaceb..c3bd6cbfce4b 100644 ---- a/arch/arm/kernel/entry-common.S -+++ b/arch/arm/kernel/entry-common.S -@@ -36,7 +36,9 @@ ret_fast_syscall: - 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 @@ ret_fast_syscall: - 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 --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c -index 4adfb46e3ee9..15f1d94b47c5 100644 ---- a/arch/arm/kernel/process.c -+++ b/arch/arm/kernel/process.c -@@ -319,6 +319,30 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) - } - - #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 --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c -index 7b8f2141427b..96541e00b74a 100644 ---- a/arch/arm/kernel/signal.c -+++ b/arch/arm/kernel/signal.c -@@ -572,7 +572,8 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) - */ - 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 --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c -index b26361355dae..e5754e3b03c4 100644 ---- a/arch/arm/kernel/smp.c -+++ b/arch/arm/kernel/smp.c -@@ -230,8 +230,6 @@ int __cpu_disable(void) - flush_cache_louis(); - local_flush_tlb_all(); - -- clear_tasks_mm_cpumask(cpu); -- - return 0; - } - -@@ -247,6 +245,9 @@ void __cpu_die(unsigned int cpu) - pr_err("CPU%u: cpu didn't die\n", cpu); - return; - } -+ -+ clear_tasks_mm_cpumask(cpu); -+ - pr_notice("CPU%u: shutdown\n", cpu); - - /* -diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c -index 0bee233fef9a..314cfb232a63 100644 ---- a/arch/arm/kernel/unwind.c -+++ b/arch/arm/kernel/unwind.c -@@ -93,7 +93,7 @@ extern const struct unwind_idx __start_unwind_idx[]; - 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 @@ static const struct unwind_idx *unwind_find_idx(unsigned long addr) - /* module unwind tables */ - struct unwind_table *table; + /* 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 @@ static const struct unwind_idx *unwind_find_idx(unsigned long addr) +@@ -213,7 +213,7 @@ break; } } @@ -612,7 +259,7 @@ index 0bee233fef9a..314cfb232a63 100644 } pr_debug("%s: idx = %p\n", __func__, idx); -@@ -529,9 +529,9 @@ struct unwind_table *unwind_table_add(unsigned long start, unsigned long size, +@@ -529,9 +529,9 @@ tab->begin_addr = text_addr; tab->end_addr = text_addr + text_size; @@ -624,7 +271,7 @@ index 0bee233fef9a..314cfb232a63 100644 return tab; } -@@ -543,9 +543,9 @@ void unwind_table_del(struct unwind_table *tab) +@@ -543,9 +543,9 @@ if (!tab) return; @@ -636,11 +283,10 @@ index 0bee233fef9a..314cfb232a63 100644 kfree(tab); } -diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c -index e06fd299de08..bb43bc396f06 100644 ---- a/arch/arm/kvm/arm.c -+++ b/arch/arm/kvm/arm.c -@@ -498,18 +498,18 @@ static void kvm_arm_resume_guest(struct kvm *kvm) +diff -Nur linux-4.4.28.orig/arch/arm/kvm/arm.c linux-4.4.28/arch/arm/kvm/arm.c +--- linux-4.4.28.orig/arch/arm/kvm/arm.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/kvm/arm.c 2016-11-01 21:26:56.776213352 +0100 +@@ -496,18 +496,18 @@ struct kvm_vcpu *vcpu; kvm_for_each_vcpu(i, vcpu, kvm) { @@ -663,7 +309,7 @@ index e06fd299de08..bb43bc396f06 100644 (!vcpu->arch.pause))); } -@@ -568,7 +568,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) +@@ -566,7 +566,7 @@ * involves poking the GIC, which must be done in a * non-preemptible context. */ @@ -672,7 +318,7 @@ index e06fd299de08..bb43bc396f06 100644 kvm_timer_flush_hwstate(vcpu); kvm_vgic_flush_hwstate(vcpu); -@@ -587,7 +587,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) +@@ -585,7 +585,7 @@ local_irq_enable(); kvm_timer_sync_hwstate(vcpu); kvm_vgic_sync_hwstate(vcpu); @@ -681,7 +327,7 @@ index e06fd299de08..bb43bc396f06 100644 continue; } -@@ -641,7 +641,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) +@@ -639,7 +639,7 @@ kvm_vgic_sync_hwstate(vcpu); @@ -690,11 +336,10 @@ index e06fd299de08..bb43bc396f06 100644 ret = handle_exit(vcpu, run, ret); } -diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c -index a9b3b905e661..c2b131527a64 100644 ---- a/arch/arm/kvm/psci.c -+++ b/arch/arm/kvm/psci.c -@@ -70,7 +70,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) +diff -Nur linux-4.4.28.orig/arch/arm/kvm/psci.c linux-4.4.28/arch/arm/kvm/psci.c +--- linux-4.4.28.orig/arch/arm/kvm/psci.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/kvm/psci.c 2016-11-01 21:26:56.780213616 +0100 +@@ -70,7 +70,7 @@ { struct kvm *kvm = source_vcpu->kvm; struct kvm_vcpu *vcpu = NULL; @@ -703,7 +348,7 @@ index a9b3b905e661..c2b131527a64 100644 unsigned long cpu_id; unsigned long context_id; phys_addr_t target_pc; -@@ -119,7 +119,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) +@@ -119,7 +119,7 @@ smp_mb(); /* Make sure the above is visible */ wq = kvm_arch_vcpu_wq(vcpu); @@ -712,22 +357,9 @@ index a9b3b905e661..c2b131527a64 100644 return PSCI_RET_SUCCESS; } -diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig -index 28656c2b54a0..3f501305ca26 100644 ---- a/arch/arm/mach-at91/Kconfig -+++ b/arch/arm/mach-at91/Kconfig -@@ -99,6 +99,7 @@ config HAVE_AT91_USB_CLK - config COMMON_CLK_AT91 - bool - select COMMON_CLK -+ select MFD_SYSCON - - config HAVE_AT91_SMD - bool -diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c -index c1a7c6cc00e1..63b4fa25b48a 100644 ---- a/arch/arm/mach-at91/at91rm9200.c -+++ b/arch/arm/mach-at91/at91rm9200.c +diff -Nur linux-4.4.28.orig/arch/arm/mach-at91/at91rm9200.c linux-4.4.28/arch/arm/mach-at91/at91rm9200.c +--- linux-4.4.28.orig/arch/arm/mach-at91/at91rm9200.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-at91/at91rm9200.c 2016-11-01 21:26:56.784213869 +0100 @@ -12,7 +12,6 @@ #include @@ -736,7 +368,7 @@ index c1a7c6cc00e1..63b4fa25b48a 100644 #include "generic.h" #include "soc.h" -@@ -33,7 +32,6 @@ static void __init at91rm9200_dt_device_init(void) +@@ -33,7 +32,6 @@ of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); @@ -744,11 +376,10 @@ index c1a7c6cc00e1..63b4fa25b48a 100644 at91rm9200_pm_init(); } -diff --git a/arch/arm/mach-at91/at91sam9.c b/arch/arm/mach-at91/at91sam9.c -index 7eb64f763034..cada2a6412b3 100644 ---- a/arch/arm/mach-at91/at91sam9.c -+++ b/arch/arm/mach-at91/at91sam9.c -@@ -62,8 +62,6 @@ static void __init at91sam9_common_init(void) +diff -Nur linux-4.4.28.orig/arch/arm/mach-at91/at91sam9.c linux-4.4.28/arch/arm/mach-at91/at91sam9.c +--- linux-4.4.28.orig/arch/arm/mach-at91/at91sam9.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-at91/at91sam9.c 2016-11-01 21:26:56.784213869 +0100 +@@ -62,8 +62,6 @@ soc_dev = soc_device_to_device(soc); of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); @@ -757,10 +388,9 @@ index 7eb64f763034..cada2a6412b3 100644 } static void __init at91sam9_dt_device_init(void) -diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h -index b0fa7dc7286d..28ca57a2060f 100644 ---- a/arch/arm/mach-at91/generic.h -+++ b/arch/arm/mach-at91/generic.h +diff -Nur linux-4.4.28.orig/arch/arm/mach-at91/generic.h linux-4.4.28/arch/arm/mach-at91/generic.h +--- linux-4.4.28.orig/arch/arm/mach-at91/generic.h 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-at91/generic.h 2016-11-01 21:26:56.784213869 +0100 @@ -11,27 +11,18 @@ #ifndef _AT91_GENERIC_H #define _AT91_GENERIC_H @@ -791,10 +421,20 @@ index b0fa7dc7286d..28ca57a2060f 100644 #endif #endif /* _AT91_GENERIC_H */ -diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c -index 23726fb31741..f06270198bf1 100644 ---- a/arch/arm/mach-at91/pm.c -+++ b/arch/arm/mach-at91/pm.c +diff -Nur linux-4.4.28.orig/arch/arm/mach-at91/Kconfig linux-4.4.28/arch/arm/mach-at91/Kconfig +--- linux-4.4.28.orig/arch/arm/mach-at91/Kconfig 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-at91/Kconfig 2016-11-01 21:26:56.784213869 +0100 +@@ -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.28.orig/arch/arm/mach-at91/pm.c linux-4.4.28/arch/arm/mach-at91/pm.c +--- linux-4.4.28.orig/arch/arm/mach-at91/pm.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-at91/pm.c 2016-11-01 21:26:56.788214125 +0100 @@ -31,10 +31,13 @@ #include #include @@ -809,7 +449,7 @@ index 23726fb31741..f06270198bf1 100644 /* * 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 @@ static int at91_pm_verify_clocks(void) +@@ -87,7 +90,7 @@ unsigned long scsr; int i; @@ -818,7 +458,7 @@ index 23726fb31741..f06270198bf1 100644 /* USB must not be using PLLB */ if ((scsr & at91_pm_data.uhp_udp_mask) != 0) { -@@ -101,8 +104,7 @@ static int at91_pm_verify_clocks(void) +@@ -101,8 +104,7 @@ if ((scsr & (AT91_PMC_PCK0 << i)) == 0) continue; @@ -828,7 +468,7 @@ index 23726fb31741..f06270198bf1 100644 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 @@ static void at91_pm_suspend(suspend_state_t state) +@@ -145,8 +147,8 @@ flush_cache_all(); outer_disable(); @@ -839,7 +479,7 @@ index 23726fb31741..f06270198bf1 100644 outer_resume(); } -@@ -353,6 +355,21 @@ static __init void at91_dt_ramc(void) +@@ -353,6 +355,21 @@ at91_pm_set_standby(standby); } @@ -861,7 +501,7 @@ index 23726fb31741..f06270198bf1 100644 static void __init at91_pm_sram_init(void) { struct gen_pool *sram_pool; -@@ -399,13 +416,36 @@ static void __init at91_pm_sram_init(void) +@@ -399,13 +416,36 @@ &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); } @@ -900,7 +540,7 @@ index 23726fb31741..f06270198bf1 100644 if (at91_suspend_sram_fn) suspend_set_ops(&at91_pm_ops); else -@@ -424,7 +464,7 @@ void __init at91rm9200_pm_init(void) +@@ -424,7 +464,7 @@ at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP; at91_pm_data.memctrl = AT91_MEMCTRL_MC; @@ -909,7 +549,7 @@ index 23726fb31741..f06270198bf1 100644 } void __init at91sam9260_pm_init(void) -@@ -432,7 +472,7 @@ 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; @@ -918,7 +558,7 @@ index 23726fb31741..f06270198bf1 100644 } void __init at91sam9g45_pm_init(void) -@@ -440,7 +480,7 @@ 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; @@ -927,7 +567,7 @@ index 23726fb31741..f06270198bf1 100644 } void __init at91sam9x5_pm_init(void) -@@ -448,5 +488,13 @@ 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; @@ -942,11 +582,10 @@ index 23726fb31741..f06270198bf1 100644 + at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; + at91_pm_init(NULL); } -diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c -index d9cf6799aec0..df8fdf1cf66d 100644 ---- a/arch/arm/mach-at91/sama5.c -+++ b/arch/arm/mach-at91/sama5.c -@@ -51,7 +51,7 @@ static void __init sama5_dt_device_init(void) +diff -Nur linux-4.4.28.orig/arch/arm/mach-at91/sama5.c linux-4.4.28/arch/arm/mach-at91/sama5.c +--- linux-4.4.28.orig/arch/arm/mach-at91/sama5.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-at91/sama5.c 2016-11-01 21:26:56.788214125 +0100 +@@ -51,7 +51,7 @@ soc_dev = soc_device_to_device(soc); of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); @@ -955,11 +594,10 @@ index d9cf6799aec0..df8fdf1cf66d 100644 } static const char *const sama5_dt_board_compat[] __initconst = { -diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c -index 98a2c0cbb833..310dce500d3e 100644 ---- a/arch/arm/mach-exynos/platsmp.c -+++ b/arch/arm/mach-exynos/platsmp.c -@@ -230,7 +230,7 @@ static void __iomem *scu_base_addr(void) +diff -Nur linux-4.4.28.orig/arch/arm/mach-exynos/platsmp.c linux-4.4.28/arch/arm/mach-exynos/platsmp.c +--- linux-4.4.28.orig/arch/arm/mach-exynos/platsmp.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-exynos/platsmp.c 2016-11-01 21:26:56.796214642 +0100 +@@ -230,7 +230,7 @@ return (void __iomem *)(S5P_VA_SCU); } @@ -968,7 +606,7 @@ index 98a2c0cbb833..310dce500d3e 100644 static void exynos_secondary_init(unsigned int cpu) { -@@ -243,8 +243,8 @@ static void exynos_secondary_init(unsigned int cpu) +@@ -243,8 +243,8 @@ /* * Synchronise with the boot thread. */ @@ -979,7 +617,7 @@ index 98a2c0cbb833..310dce500d3e 100644 } int exynos_set_boot_addr(u32 core_id, unsigned long boot_addr) -@@ -308,7 +308,7 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) +@@ -308,7 +308,7 @@ * Set synchronisation state between this boot processor * and the secondary one */ @@ -988,7 +626,7 @@ index 98a2c0cbb833..310dce500d3e 100644 /* * The secondary processor is waiting to be released from -@@ -335,7 +335,7 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) +@@ -335,7 +335,7 @@ if (timeout == 0) { printk(KERN_ERR "cpu1 power enable failed"); @@ -997,7 +635,7 @@ index 98a2c0cbb833..310dce500d3e 100644 return -ETIMEDOUT; } } -@@ -381,7 +381,7 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) +@@ -381,7 +381,7 @@ * calibrations, then wait for it to finish */ fail: @@ -1006,10 +644,9 @@ index 98a2c0cbb833..310dce500d3e 100644 return pen_release != -1 ? ret : 0; } -diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c -index b5f8f5ffda79..9753a84df9c4 100644 ---- a/arch/arm/mach-hisi/platmcpm.c -+++ b/arch/arm/mach-hisi/platmcpm.c +diff -Nur linux-4.4.28.orig/arch/arm/mach-hisi/platmcpm.c linux-4.4.28/arch/arm/mach-hisi/platmcpm.c +--- linux-4.4.28.orig/arch/arm/mach-hisi/platmcpm.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-hisi/platmcpm.c 2016-11-01 21:26:56.800214899 +0100 @@ -61,7 +61,7 @@ static void __iomem *sysctrl, *fabric; @@ -1019,7 +656,7 @@ index b5f8f5ffda79..9753a84df9c4 100644 static u32 fabric_phys_addr; /* * [0]: bootwrapper physical address -@@ -113,7 +113,7 @@ static int hip04_boot_secondary(unsigned int l_cpu, struct task_struct *idle) +@@ -113,7 +113,7 @@ if (cluster >= HIP04_MAX_CLUSTERS || cpu >= HIP04_MAX_CPUS_PER_CLUSTER) return -EINVAL; @@ -1028,7 +665,7 @@ index b5f8f5ffda79..9753a84df9c4 100644 if (hip04_cpu_table[cluster][cpu]) goto out; -@@ -147,7 +147,7 @@ static int hip04_boot_secondary(unsigned int l_cpu, struct task_struct *idle) +@@ -147,7 +147,7 @@ out: hip04_cpu_table[cluster][cpu]++; @@ -1037,7 +674,7 @@ index b5f8f5ffda79..9753a84df9c4 100644 return 0; } -@@ -162,11 +162,11 @@ static void hip04_cpu_die(unsigned int l_cpu) +@@ -162,11 +162,11 @@ cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); @@ -1051,7 +688,7 @@ index b5f8f5ffda79..9753a84df9c4 100644 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 @@ static void hip04_cpu_die(unsigned int l_cpu) +@@ -174,7 +174,7 @@ } last_man = hip04_cluster_is_down(cluster); @@ -1060,7 +697,7 @@ index b5f8f5ffda79..9753a84df9c4 100644 if (last_man) { /* Since it's Cortex A15, disable L2 prefetching. */ asm volatile( -@@ -203,7 +203,7 @@ static int hip04_cpu_kill(unsigned int l_cpu) +@@ -203,7 +203,7 @@ cpu >= HIP04_MAX_CPUS_PER_CLUSTER); count = TIMEOUT_MSEC / POLL_MSEC; @@ -1069,7 +706,7 @@ index b5f8f5ffda79..9753a84df9c4 100644 for (tries = 0; tries < count; tries++) { if (hip04_cpu_table[cluster][cpu]) goto err; -@@ -211,10 +211,10 @@ static int hip04_cpu_kill(unsigned int l_cpu) +@@ -211,10 +211,10 @@ data = readl_relaxed(sysctrl + SC_CPU_RESET_STATUS(cluster)); if (data & CORE_WFI_STATUS(cpu)) break; @@ -1082,7 +719,7 @@ index b5f8f5ffda79..9753a84df9c4 100644 } if (tries >= count) goto err; -@@ -231,10 +231,10 @@ static int hip04_cpu_kill(unsigned int l_cpu) +@@ -231,10 +231,10 @@ goto err; if (hip04_cluster_is_down(cluster)) hip04_set_snoop_filter(cluster, 0); @@ -1095,11 +732,10 @@ index b5f8f5ffda79..9753a84df9c4 100644 return 0; } #endif -diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig -index 8ceda2844c4f..08bcf8fb76f2 100644 ---- a/arch/arm/mach-imx/Kconfig -+++ b/arch/arm/mach-imx/Kconfig -@@ -524,7 +524,7 @@ config SOC_IMX6Q +diff -Nur linux-4.4.28.orig/arch/arm/mach-imx/Kconfig linux-4.4.28/arch/arm/mach-imx/Kconfig +--- linux-4.4.28.orig/arch/arm/mach-imx/Kconfig 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-imx/Kconfig 2016-11-01 21:26:56.804215163 +0100 +@@ -524,7 +524,7 @@ bool "i.MX6 Quad/DualLite support" select ARM_ERRATA_764369 if SMP select HAVE_ARM_SCU if SMP @@ -1108,10 +744,9 @@ index 8ceda2844c4f..08bcf8fb76f2 100644 select PCI_DOMAINS if PCI select PINCTRL_IMX6Q select SOC_IMX6 -diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c -index 79e1f876d1c9..7e625c17f78e 100644 ---- a/arch/arm/mach-omap2/omap-smp.c -+++ b/arch/arm/mach-omap2/omap-smp.c +diff -Nur linux-4.4.28.orig/arch/arm/mach-omap2/omap-smp.c linux-4.4.28/arch/arm/mach-omap2/omap-smp.c +--- linux-4.4.28.orig/arch/arm/mach-omap2/omap-smp.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-omap2/omap-smp.c 2016-11-01 21:26:56.836217219 +0100 @@ -43,7 +43,7 @@ /* SCU base address */ static void __iomem *scu_base; @@ -1121,7 +756,7 @@ index 79e1f876d1c9..7e625c17f78e 100644 void __iomem *omap4_get_scu_base(void) { -@@ -74,8 +74,8 @@ static void omap4_secondary_init(unsigned int cpu) +@@ -74,8 +74,8 @@ /* * Synchronise with the boot thread. */ @@ -1132,7 +767,7 @@ index 79e1f876d1c9..7e625c17f78e 100644 } static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle) -@@ -89,7 +89,7 @@ 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 */ @@ -1141,7 +776,7 @@ index 79e1f876d1c9..7e625c17f78e 100644 /* * Update the AuxCoreBoot0 with boot state for secondary core. -@@ -166,7 +166,7 @@ static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle) +@@ -166,7 +166,7 @@ * Now the secondary core is starting up let it run its * calibrations, then wait for it to finish */ @@ -1150,10 +785,9 @@ index 79e1f876d1c9..7e625c17f78e 100644 return 0; } -diff --git a/arch/arm/mach-prima2/platsmp.c b/arch/arm/mach-prima2/platsmp.c -index e46c91094dde..dcb3ed0c26da 100644 ---- a/arch/arm/mach-prima2/platsmp.c -+++ b/arch/arm/mach-prima2/platsmp.c +diff -Nur linux-4.4.28.orig/arch/arm/mach-prima2/platsmp.c linux-4.4.28/arch/arm/mach-prima2/platsmp.c +--- linux-4.4.28.orig/arch/arm/mach-prima2/platsmp.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-prima2/platsmp.c 2016-11-01 21:26:56.864219031 +0100 @@ -22,7 +22,7 @@ static void __iomem *clk_base; @@ -1163,7 +797,7 @@ index e46c91094dde..dcb3ed0c26da 100644 static void sirfsoc_secondary_init(unsigned int cpu) { -@@ -36,8 +36,8 @@ static void sirfsoc_secondary_init(unsigned int cpu) +@@ -36,8 +36,8 @@ /* * Synchronise with the boot thread. */ @@ -1174,7 +808,7 @@ index e46c91094dde..dcb3ed0c26da 100644 } static const struct of_device_id clk_ids[] = { -@@ -75,7 +75,7 @@ static int sirfsoc_boot_secondary(unsigned int cpu, struct task_struct *idle) +@@ -75,7 +75,7 @@ /* make sure write buffer is drained */ mb(); @@ -1183,7 +817,7 @@ index e46c91094dde..dcb3ed0c26da 100644 /* * The secondary processor is waiting to be released from -@@ -107,7 +107,7 @@ static int sirfsoc_boot_secondary(unsigned int cpu, struct task_struct *idle) +@@ -107,7 +107,7 @@ * now the secondary core is starting up let it run its * calibrations, then wait for it to finish */ @@ -1192,10 +826,9 @@ index e46c91094dde..dcb3ed0c26da 100644 return pen_release != -1 ? -ENOSYS : 0; } -diff --git a/arch/arm/mach-qcom/platsmp.c b/arch/arm/mach-qcom/platsmp.c -index 9b00123a315d..0a49fe1bc8cf 100644 ---- a/arch/arm/mach-qcom/platsmp.c -+++ b/arch/arm/mach-qcom/platsmp.c +diff -Nur linux-4.4.28.orig/arch/arm/mach-qcom/platsmp.c linux-4.4.28/arch/arm/mach-qcom/platsmp.c +--- linux-4.4.28.orig/arch/arm/mach-qcom/platsmp.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-qcom/platsmp.c 2016-11-01 21:26:56.872219540 +0100 @@ -46,7 +46,7 @@ extern void secondary_startup_arm(void); @@ -1205,7 +838,7 @@ index 9b00123a315d..0a49fe1bc8cf 100644 #ifdef CONFIG_HOTPLUG_CPU static void qcom_cpu_die(unsigned int cpu) -@@ -60,8 +60,8 @@ static void qcom_secondary_init(unsigned int cpu) +@@ -60,8 +60,8 @@ /* * Synchronise with the boot thread. */ @@ -1216,7 +849,7 @@ index 9b00123a315d..0a49fe1bc8cf 100644 } static int scss_release_secondary(unsigned int cpu) -@@ -284,7 +284,7 @@ static int qcom_boot_secondary(unsigned int cpu, int (*func)(unsigned int)) +@@ -284,7 +284,7 @@ * set synchronisation state between this boot processor * and the secondary one */ @@ -1225,7 +858,7 @@ index 9b00123a315d..0a49fe1bc8cf 100644 /* * Send the secondary CPU a soft interrupt, thereby causing -@@ -297,7 +297,7 @@ static int qcom_boot_secondary(unsigned int cpu, int (*func)(unsigned int)) +@@ -297,7 +297,7 @@ * now the secondary core is starting up let it run its * calibrations, then wait for it to finish */ @@ -1234,11 +867,10 @@ index 9b00123a315d..0a49fe1bc8cf 100644 return ret; } -diff --git a/arch/arm/mach-spear/platsmp.c b/arch/arm/mach-spear/platsmp.c -index fd4297713d67..b0553b2c2d53 100644 ---- a/arch/arm/mach-spear/platsmp.c -+++ b/arch/arm/mach-spear/platsmp.c -@@ -32,7 +32,7 @@ static void write_pen_release(int val) +diff -Nur linux-4.4.28.orig/arch/arm/mach-spear/platsmp.c linux-4.4.28/arch/arm/mach-spear/platsmp.c +--- linux-4.4.28.orig/arch/arm/mach-spear/platsmp.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-spear/platsmp.c 2016-11-01 21:26:56.896221093 +0100 +@@ -32,7 +32,7 @@ sync_cache_w(&pen_release); } @@ -1247,7 +879,7 @@ index fd4297713d67..b0553b2c2d53 100644 static void __iomem *scu_base = IOMEM(VA_SCU_BASE); -@@ -47,8 +47,8 @@ static void spear13xx_secondary_init(unsigned int cpu) +@@ -47,8 +47,8 @@ /* * Synchronise with the boot thread. */ @@ -1258,7 +890,7 @@ index fd4297713d67..b0553b2c2d53 100644 } static int spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle) -@@ -59,7 +59,7 @@ 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 */ @@ -1267,7 +899,7 @@ index fd4297713d67..b0553b2c2d53 100644 /* * The secondary processor is waiting to be released from -@@ -84,7 +84,7 @@ static int spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle) +@@ -84,7 +84,7 @@ * now the secondary core is starting up let it run its * calibrations, then wait for it to finish */ @@ -1276,11 +908,10 @@ index fd4297713d67..b0553b2c2d53 100644 return pen_release != -1 ? -ENOSYS : 0; } -diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c -index c4ad6eae67fa..e830b20b212f 100644 ---- a/arch/arm/mach-sti/platsmp.c -+++ b/arch/arm/mach-sti/platsmp.c -@@ -35,7 +35,7 @@ static void write_pen_release(int val) +diff -Nur linux-4.4.28.orig/arch/arm/mach-sti/platsmp.c linux-4.4.28/arch/arm/mach-sti/platsmp.c +--- linux-4.4.28.orig/arch/arm/mach-sti/platsmp.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mach-sti/platsmp.c 2016-11-01 21:26:56.896221093 +0100 +@@ -35,7 +35,7 @@ sync_cache_w(&pen_release); } @@ -1289,7 +920,7 @@ index c4ad6eae67fa..e830b20b212f 100644 static void sti_secondary_init(unsigned int cpu) { -@@ -48,8 +48,8 @@ static void sti_secondary_init(unsigned int cpu) +@@ -48,8 +48,8 @@ /* * Synchronise with the boot thread. */ @@ -1300,7 +931,7 @@ index c4ad6eae67fa..e830b20b212f 100644 } static int sti_boot_secondary(unsigned int cpu, struct task_struct *idle) -@@ -60,7 +60,7 @@ 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 */ @@ -1309,7 +940,7 @@ index c4ad6eae67fa..e830b20b212f 100644 /* * The secondary processor is waiting to be released from -@@ -91,7 +91,7 @@ static int sti_boot_secondary(unsigned int cpu, struct task_struct *idle) +@@ -91,7 +91,7 @@ * now the secondary core is starting up let it run its * calibrations, then wait for it to finish */ @@ -1318,11 +949,10 @@ index c4ad6eae67fa..e830b20b212f 100644 return pen_release != -1 ? -ENOSYS : 0; } -diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c -index daafcf121ce0..b8aa1e9ee8ee 100644 ---- a/arch/arm/mm/fault.c -+++ b/arch/arm/mm/fault.c -@@ -430,6 +430,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr, +diff -Nur linux-4.4.28.orig/arch/arm/mm/fault.c linux-4.4.28/arch/arm/mm/fault.c +--- linux-4.4.28.orig/arch/arm/mm/fault.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mm/fault.c 2016-11-01 21:26:56.900221345 +0100 +@@ -430,6 +430,9 @@ if (addr < TASK_SIZE) return do_page_fault(addr, fsr, regs); @@ -1332,7 +962,7 @@ index daafcf121ce0..b8aa1e9ee8ee 100644 if (user_mode(regs)) goto bad_area; -@@ -497,6 +500,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr, +@@ -497,6 +500,9 @@ static int do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) { @@ -1342,11 +972,10 @@ index daafcf121ce0..b8aa1e9ee8ee 100644 do_bad_area(addr, fsr, regs); return 0; } -diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c -index d02f8187b1cc..542692dbd40a 100644 ---- a/arch/arm/mm/highmem.c -+++ b/arch/arm/mm/highmem.c -@@ -34,6 +34,11 @@ static inline pte_t get_fixmap_pte(unsigned long vaddr) +diff -Nur linux-4.4.28.orig/arch/arm/mm/highmem.c linux-4.4.28/arch/arm/mm/highmem.c +--- linux-4.4.28.orig/arch/arm/mm/highmem.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/mm/highmem.c 2016-11-01 21:26:56.904221609 +0100 +@@ -34,6 +34,11 @@ return *ptep; } @@ -1358,7 +987,7 @@ index d02f8187b1cc..542692dbd40a 100644 void *kmap(struct page *page) { might_sleep(); -@@ -54,12 +59,13 @@ EXPORT_SYMBOL(kunmap); +@@ -54,12 +59,13 @@ void *kmap_atomic(struct page *page) { @@ -1373,7 +1002,7 @@ index d02f8187b1cc..542692dbd40a 100644 pagefault_disable(); if (!PageHighMem(page)) return page_address(page); -@@ -79,7 +85,7 @@ void *kmap_atomic(struct page *page) +@@ -79,7 +85,7 @@ type = kmap_atomic_idx_push(); @@ -1382,7 +1011,7 @@ index d02f8187b1cc..542692dbd40a 100644 vaddr = __fix_to_virt(idx); #ifdef CONFIG_DEBUG_HIGHMEM /* -@@ -93,7 +99,10 @@ void *kmap_atomic(struct page *page) +@@ -93,7 +99,10 @@ * in place, so the contained TLB flush ensures the TLB is updated * with the new mapping. */ @@ -1394,7 +1023,7 @@ index d02f8187b1cc..542692dbd40a 100644 return (void *)vaddr; } -@@ -106,44 +115,75 @@ void __kunmap_atomic(void *kvaddr) +@@ -106,44 +115,75 @@ if (kvaddr >= (void *)FIXADDR_START) { type = kmap_atomic_idx(); @@ -1476,11 +1105,10 @@ index d02f8187b1cc..542692dbd40a 100644 + } +} +#endif -diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c -index 53feb90c840c..b4a8d54fc3f3 100644 ---- a/arch/arm/plat-versatile/platsmp.c -+++ b/arch/arm/plat-versatile/platsmp.c -@@ -30,7 +30,7 @@ static void write_pen_release(int val) +diff -Nur linux-4.4.28.orig/arch/arm/plat-versatile/platsmp.c linux-4.4.28/arch/arm/plat-versatile/platsmp.c +--- linux-4.4.28.orig/arch/arm/plat-versatile/platsmp.c 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm/plat-versatile/platsmp.c 2016-11-01 21:26:56.936223672 +0100 +@@ -30,7 +30,7 @@ sync_cache_w(&pen_release); } @@ -1489,7 +1117,7 @@ index 53feb90c840c..b4a8d54fc3f3 100644 void versatile_secondary_init(unsigned int cpu) { -@@ -43,8 +43,8 @@ void versatile_secondary_init(unsigned int cpu) +@@ -43,8 +43,8 @@ /* * Synchronise with the boot thread. */ @@ -1500,7 +1128,7 @@ index 53feb90c840c..b4a8d54fc3f3 100644 } int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle) -@@ -55,7 +55,7 @@ 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 */ @@ -1509,7 +1137,7 @@ index 53feb90c840c..b4a8d54fc3f3 100644 /* * This is really belt and braces; we hold unintended secondary -@@ -85,7 +85,7 @@ int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle) +@@ -85,7 +85,7 @@ * now the secondary core is starting up let it run its * calibrations, then wait for it to finish */ @@ -1518,32 +1146,10 @@ index 53feb90c840c..b4a8d54fc3f3 100644 return pen_release != -1 ? -ENOSYS : 0; } -diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig -index 871f21783866..1baa6537cf3f 100644 ---- a/arch/arm64/Kconfig -+++ b/arch/arm64/Kconfig -@@ -76,6 +76,7 @@ config ARM64 - 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_DOM0 - - 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 --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h -index 90c7ff233735..5f4e89fbc290 100644 ---- a/arch/arm64/include/asm/thread_info.h -+++ b/arch/arm64/include/asm/thread_info.h -@@ -49,6 +49,7 @@ struct thread_info { +diff -Nur linux-4.4.28.orig/arch/arm64/include/asm/thread_info.h linux-4.4.28/arch/arm64/include/asm/thread_info.h +--- linux-4.4.28.orig/arch/arm64/include/asm/thread_info.h 2016-10-28 09:53:25.000000000 +0200 ++++ linux-4.4.28/arch/arm64/include/asm/thread_info.h 2016-11-01 21:26:56.948224439 +0100 +@@ -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 */ @@ -1551,7 +1157,7 @@ index 90c7ff233735..5f4e89fbc290 100644 int cpu; /* cpu */ }; -@@ -103,6 +104,7 @@ static inline struct thread_info *current_thread_info(void) +@@ -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 */ @@ -1559,7 +1165,7 @@ index 90c7ff233735..5f4e89fbc290 100644 #define TIF_NOHZ 7 #define TIF_SYSCALL_TRACE 8 #define TIF_SYSCALL_AUDIT 9 -@@ -118,6 +120,7 @@ static inline struct thread_info *current_thread_info(void) +@@ -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) @@ -1567,7 +1173,7 @@ index 90c7ff233735..5f4e89fbc290 100644 #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 @@ static inline struct thread_info *current_thread_info(void) +@@ -126,7 +129,8 @@ #define _TIF_32BIT (1 << TIF_32BIT) #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ @@ -1577,11 +1183,30 @@ index 90c7ff233735..5f4e89fbc290 100644 #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 087cf9a65359..d74475928399 100644 ---- a/arch/arm64/kernel/asm-offsets.c