diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2016-09-17 12:50:53 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2016-09-17 12:50:53 -0400 |
commit | 9cf42b99c82bf931d4e1d4392c80387b6969f3e2 (patch) | |
tree | 13a429248a4b3fbb8c39b4879981a586ba6440fc | |
parent | 12767dd2a9f3817215e469707405c105a5495dcc (diff) | |
download | 4.8-rt-patches-9cf42b99c82bf931d4e1d4392c80387b6969f3e2.tar.gz |
parallel changes of ANNOUNCE-4.6.7-rt13
-rw-r--r-- | patches/fs-dcache-resched-chill-only-if-we-make-no-progress.patch | 22 | ||||
-rw-r--r-- | patches/lockdep-Quiet-gcc-about-dangerous-__builtin_return_a.patch | 110 | ||||
-rw-r--r-- | patches/series | 5 | ||||
-rw-r--r-- | patches/x86-preempt-lazy-fixup-should_resched.patch | 49 |
4 files changed, 171 insertions, 15 deletions
diff --git a/patches/fs-dcache-resched-chill-only-if-we-make-no-progress.patch b/patches/fs-dcache-resched-chill-only-if-we-make-no-progress.patch index a59001e85da832..185bf2e8cd886c 100644 --- a/patches/fs-dcache-resched-chill-only-if-we-make-no-progress.patch +++ b/patches/fs-dcache-resched-chill-only-if-we-make-no-progress.patch @@ -23,21 +23,12 @@ progress. Cc: stable-rt@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- - fs/dcache.c | 19 +++++++++++++------ - 1 file changed, 13 insertions(+), 6 deletions(-) + fs/dcache.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) --- a/fs/dcache.c +++ b/fs/dcache.c -@@ -40,6 +40,8 @@ - #include <linux/ratelimit.h> - #include <linux/list_lru.h> - #include <linux/kasan.h> -+#include <linux/sched/rt.h> -+#include <linux/sched/deadline.h> - - #include "internal.h" - #include "mount.h" -@@ -748,6 +750,8 @@ static inline bool fast_dput(struct dent +@@ -748,6 +748,8 @@ static inline bool fast_dput(struct dent */ void dput(struct dentry *dentry) { @@ -46,7 +37,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> if (unlikely(!dentry)) return; -@@ -784,14 +788,17 @@ void dput(struct dentry *dentry) +@@ -784,14 +786,18 @@ void dput(struct dentry *dentry) return; kill_it: @@ -63,10 +54,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + if (parent == dentry) { + /* the task with the highest priority won't schedule */ + r = cond_resched(); -+ if (!r && (rt_task(current) || dl_task(current))) ++ if (!r) + cpu_chill(); -+ } else ++ } else { + dentry = parent; ++ } goto repeat; } } diff --git a/patches/lockdep-Quiet-gcc-about-dangerous-__builtin_return_a.patch b/patches/lockdep-Quiet-gcc-about-dangerous-__builtin_return_a.patch new file mode 100644 index 00000000000000..bce6d3d9d0b223 --- /dev/null +++ b/patches/lockdep-Quiet-gcc-about-dangerous-__builtin_return_a.patch @@ -0,0 +1,110 @@ +From: Steven Rostedt <rostedt@goodmis.org> +Date: Thu, 8 Sep 2016 12:34:33 -0400 +Subject: [PATCH] lockdep: Quiet gcc about dangerous __builtin_return_address() + operations + +[ + Boris, does this quiet gcc for you? + I haven't fully tested this yet, as I still don't have a compiler + that does the warning. +] + +Gcc's new warnings about __builtin_return_address(n) operations with +n > 0 is popping up around the kernel. The operation is dangerous, and +the warning is "good to know". But there's instances that we use +__builtin_return_address(n) with n > 0 and are aware of the issues, +and work around them. And its used mostly for tracing and debugging. In +these cases, the warning becomes a distraction and is not helpful. + +To get better lock issue traces, a function like get_lock_parent_ip() +uses __builtin_return_address() to find the caller of the lock, and +skip over the internal callers of the lock itself. Currently it is only +used in the kernel/ directory and only if certain configs are enabled. + +Create a new config called CONFIG_USING_GET_LOCK_PARENT_IP that gets +selected when another config relies on get_lock_parent_ip(), and this +will now enable the function get_lock_parent_ip(), otherwise it wont be +defined. It will also disable the frame-address warnings from gcc in +the kernel directory. + +Reported-by: Borislav Petkov <bp@alien8.de> +Signed-off-by: Steven Rostedt <rostedt@goodmis.org> +--- + include/linux/ftrace.h | 2 ++ + kernel/Makefile | 7 +++++++ + kernel/trace/Kconfig | 1 + + lib/Kconfig.debug | 10 ++++++++++ + 4 files changed, 20 insertions(+) + +--- a/include/linux/ftrace.h ++++ b/include/linux/ftrace.h +@@ -713,6 +713,7 @@ static inline void __ftrace_enabled_rest + #define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5)) + #define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6)) + ++#ifdef CONFIG_USING_GET_LOCK_PARENT_IP + static inline unsigned long get_lock_parent_ip(void) + { + unsigned long addr = CALLER_ADDR0; +@@ -724,6 +725,7 @@ static inline unsigned long get_lock_par + return addr; + return CALLER_ADDR2; + } ++#endif + + #ifdef CONFIG_IRQSOFF_TRACER + extern void time_hardirqs_on(unsigned long a0, unsigned long a1); +--- a/kernel/Makefile ++++ b/kernel/Makefile +@@ -11,6 +11,13 @@ obj-y = fork.o exec_domain.o panic.o + notifier.o ksysfs.o cred.o reboot.o \ + async.o range.o smpboot.o + ++# Tracing may do some dangerous __builtin_return_address() operations ++# We know they are dangerous, we don't need gcc telling us that. ++ifdef CONFIG_USING_GET_LOCK_PARENT_IP ++FRAME_CFLAGS := $(call cc-disable-warning,frame-address) ++KBUILD_CFLAGS += $(FRAME_CFLAGS) ++endif ++ + obj-$(CONFIG_MULTIUSER) += groups.o + + ifdef CONFIG_FUNCTION_TRACER +--- a/kernel/trace/Kconfig ++++ b/kernel/trace/Kconfig +@@ -197,6 +197,7 @@ config PREEMPT_TRACER + select RING_BUFFER_ALLOW_SWAP + select TRACER_SNAPSHOT + select TRACER_SNAPSHOT_PER_CPU_SWAP ++ select USING_GET_LOCK_PARENT_IP + help + This option measures the time spent in preemption-off critical + sections, with microsecond accuracy. +--- a/lib/Kconfig.debug ++++ b/lib/Kconfig.debug +@@ -962,6 +962,7 @@ config TIMER_STATS + config DEBUG_PREEMPT + bool "Debug preemptible kernel" + depends on DEBUG_KERNEL && PREEMPT && TRACE_IRQFLAGS_SUPPORT ++ select USING_GET_LOCK_PARENT_IP + default y + help + If you say Y here then the kernel will use a debug variant of the +@@ -1144,8 +1145,17 @@ config LOCK_TORTURE_TEST + + endmenu # lock debugging + ++config USING_GET_LOCK_PARENT_IP ++ bool ++ help ++ Enables the use of the function get_lock_parent_ip() that ++ will use __builtin_return_address(n) with n > 0 causing ++ some gcc warnings. When this is selected, those warnings ++ will be suppressed. ++ + config TRACE_IRQFLAGS + bool ++ select USING_GET_LOCK_PARENT_IP + help + Enables hooks to interrupt enabling and disabling for + either tracing or lock debugging. diff --git a/patches/series b/patches/series index 8073ce6718b692..ce850eca05c9e0 100644 --- a/patches/series +++ b/patches/series @@ -17,6 +17,7 @@ rbtree_augmented-fix-implicit-rcu-assign-pointer-dep.patch # Stuff broken upstream, patches submitted ############################################################ sc16is7xx_Drop_bogus_use_of_IRQF_ONESHOT.patch +lockdep-Quiet-gcc-about-dangerous-__builtin_return_a.patch # Those two should vanish soon (not use PIT during bootup) at91_dont_enable_disable_clock.patch @@ -402,6 +403,7 @@ block-use-cpu-chill.patch # FS LIVELOCK PREVENTION fs-dcache-use-cpu-chill-in-trylock-loops.patch +fs-dcache-resched-chill-only-if-we-make-no-progress.patch net-use-cpu-chill.patch # WORKQUEUE more fixes @@ -428,6 +430,8 @@ net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch net-move-xmit_recursion-to-per-task-variable-on-RT.patch net-provide-a-way-to-delegate-processing-a-softirq-t.patch net-dev-always-take-qdisc-s-busylock-in-__dev_xmit_s.patch +net-add-back-the-missing-serialization-in-ip_send_un.patch +net-add-a-lock-around-icmp_sk.patch # NETWORK DEBUGGING AID ping-sysrq.patch @@ -551,6 +555,7 @@ preempt-lazy-support.patch preempt-lazy-check-preempt_schedule.patch sched-lazy_preempt-avoid-a-warning-in-the-RT-case.patch x86-preempt-lazy.patch +x86-preempt-lazy-fixup-should_resched.patch arm-preempt-lazy-support.patch arm-lazy-preempt-correct-resched-condition.patch powerpc-preempt-lazy-support.patch diff --git a/patches/x86-preempt-lazy-fixup-should_resched.patch b/patches/x86-preempt-lazy-fixup-should_resched.patch new file mode 100644 index 00000000000000..5e771a368d9e78 --- /dev/null +++ b/patches/x86-preempt-lazy-fixup-should_resched.patch @@ -0,0 +1,49 @@ +From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +Date: Wed, 14 Sep 2016 19:18:47 +0200 +Subject: [PATCH] x86/preempt-lazy: fixup should_resched() + +should_resched() returns true if NEED_RESCHED is set and the +preempt_count is 0 _or_ if NEED_RESCHED_LAZY is set ignoring the preempt +counter. Ignoring the preemp counter is wrong. This patch adds this into +account. +While at it, __preempt_count_dec_and_test() ignores preempt_lazy_count +while checking TIF_NEED_RESCHED_LAZY so we this check, too. + +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +--- + arch/x86/include/asm/preempt.h | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +--- a/arch/x86/include/asm/preempt.h ++++ b/arch/x86/include/asm/preempt.h +@@ -89,6 +89,8 @@ static __always_inline bool __preempt_co + if (____preempt_count_dec_and_test()) + return true; + #ifdef CONFIG_PREEMPT_LAZY ++ if (current_thread_info()->preempt_lazy_count) ++ return false; + return test_thread_flag(TIF_NEED_RESCHED_LAZY); + #else + return false; +@@ -101,8 +103,19 @@ static __always_inline bool __preempt_co + static __always_inline bool should_resched(int preempt_offset) + { + #ifdef CONFIG_PREEMPT_LAZY +- return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset || +- test_thread_flag(TIF_NEED_RESCHED_LAZY)); ++ u32 tmp; ++ ++ tmp = raw_cpu_read_4(__preempt_count); ++ if (tmp == preempt_offset) ++ return true; ++ ++ /* preempt count == 0 ? */ ++ tmp &= ~PREEMPT_NEED_RESCHED; ++ if (tmp) ++ return false; ++ if (current_thread_info()->preempt_lazy_count) ++ return false; ++ return test_thread_flag(TIF_NEED_RESCHED_LAZY); + #else + return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset); + #endif |