From d16f2d4bfbe79d9bfa730134fb37c6447124abd3 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Tue, 11 Jul 2017 16:17:20 +0200 Subject: linux-toradex-rt-3.14.52: add patches to metadata The checksums of the files fetched from Github's linux-fslc repository changed. Rather than fixing the checksum provide the patches from the meta data. Signed-off-by: Max Krummenacher --- .../linux-toradex-rt-3.14.52/cond_resched.patch | 186 +++++++++++++++++++++ .../linux-toradex-rt-3.14.52/rename_define.patch | 59 +++++++ recipes-kernel/linux/linux-toradex-rt_3.14.52.bb | 12 +- 3 files changed, 250 insertions(+), 7 deletions(-) create mode 100644 recipes-kernel/linux/linux-toradex-rt-3.14.52/cond_resched.patch create mode 100644 recipes-kernel/linux/linux-toradex-rt-3.14.52/rename_define.patch (limited to 'recipes-kernel/linux') diff --git a/recipes-kernel/linux/linux-toradex-rt-3.14.52/cond_resched.patch b/recipes-kernel/linux/linux-toradex-rt-3.14.52/cond_resched.patch new file mode 100644 index 0000000..1b9524a --- /dev/null +++ b/recipes-kernel/linux/linux-toradex-rt-3.14.52/cond_resched.patch @@ -0,0 +1,186 @@ +From e211cb68dd3c951b104ff0b47dbaed2c8b8d2399 Mon Sep 17 00:00:00 2001 +From: Konstantin Khlebnikov +Date: Wed, 15 Jul 2015 12:52:04 +0300 +Subject: [PATCH] sched/preempt: Fix cond_resched_lock() and + cond_resched_softirq() + +commit fe32d3cd5e8eb0f82e459763374aa80797023403 upstream. + +These functions check should_resched() before unlocking spinlock/bh-enable: +preempt_count always non-zero => should_resched() always returns false. +cond_resched_lock() worked iff spin_needbreak is set. + +This patch adds argument "preempt_offset" to should_resched(). + +preempt_count offset constants for that: + + PREEMPT_DISABLE_OFFSET - offset after preempt_disable() + PREEMPT_LOCK_OFFSET - offset after spin_lock() + SOFTIRQ_DISABLE_OFFSET - offset after local_bh_distable() + SOFTIRQ_LOCK_OFFSET - offset after spin_lock_bh() + +Signed-off-by: Konstantin Khlebnikov +Signed-off-by: Peter Zijlstra (Intel) +Cc: Alexander Graf +Cc: Boris Ostrovsky +Cc: David Vrabel +Cc: Linus Torvalds +Cc: Mike Galbraith +Cc: Paul Mackerras +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Fixes: bdb438065890 ("sched: Extract the basic add/sub preempt_count modifiers") +Link: http://lkml.kernel.org/r/20150715095204.12246.98268.stgit@buzz +Signed-off-by: Ingo Molnar +Signed-off-by: Mike Galbraith +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/include/asm/preempt.h | 4 ++-- + include/asm-generic/preempt.h | 5 +++-- + include/linux/preempt.h | 5 +++-- + include/linux/preempt_mask.h | 14 +++++++++++--- + include/linux/sched.h | 6 ------ + kernel/sched/core.c | 6 +++--- + 6 files changed, 22 insertions(+), 18 deletions(-) + +diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h +index b39e194f6c8d1..999b4a3e65f58 100644 +--- a/arch/x86/include/asm/preempt.h ++++ b/arch/x86/include/asm/preempt.h +@@ -105,9 +105,9 @@ static __always_inline bool __preempt_count_dec_and_test(void) + /* + * Returns true when we need to resched and can (barring IRQ state). + */ +-static __always_inline bool should_resched(void) ++static __always_inline bool should_resched(int preempt_offset) + { +- return unlikely(!__this_cpu_read_4(__preempt_count)); ++ return unlikely(__this_cpu_read_4(__preempt_count) == preempt_offset); + } + + #ifdef CONFIG_PREEMPT +diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h +index 1cd3f5d767a81..54352f4dde1a4 100644 +--- a/include/asm-generic/preempt.h ++++ b/include/asm-generic/preempt.h +@@ -74,9 +74,10 @@ static __always_inline bool __preempt_count_dec_and_test(void) + /* + * Returns true when we need to resched and can (barring IRQ state). + */ +-static __always_inline bool should_resched(void) ++static __always_inline bool should_resched(int preempt_offset) + { +- return unlikely(!preempt_count() && tif_need_resched()); ++ return unlikely(preempt_count() == preempt_offset && ++ tif_need_resched()); + } + + #ifdef CONFIG_PREEMPT +diff --git a/include/linux/preempt.h b/include/linux/preempt.h +index 1841b58cf1734..411a5c6371da8 100644 +--- a/include/linux/preempt.h ++++ b/include/linux/preempt.h +@@ -22,7 +22,8 @@ + #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) + extern void preempt_count_add(int val); + extern void preempt_count_sub(int val); +-#define preempt_count_dec_and_test() ({ preempt_count_sub(1); should_resched(); }) ++#define preempt_count_dec_and_test() \ ++ ({ preempt_count_sub(1); should_resched(0); }) + #else + #define preempt_count_add(val) __preempt_count_add(val) + #define preempt_count_sub(val) __preempt_count_sub(val) +@@ -61,7 +62,7 @@ do { \ + + #define preempt_check_resched() \ + do { \ +- if (should_resched()) \ ++ if (should_resched(0)) \ + __preempt_schedule(); \ + } while (0) + +diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h +index 1f654ee836b7d..5cb25f17331a3 100644 +--- a/include/linux/preempt_mask.h ++++ b/include/linux/preempt_mask.h +@@ -71,13 +71,21 @@ + */ + #define in_nmi() (preempt_count() & NMI_MASK) + ++/* ++ * The preempt_count offset after preempt_disable(); ++ */ + #if defined(CONFIG_PREEMPT_COUNT) +-# define PREEMPT_DISABLE_OFFSET 1 ++# define PREEMPT_DISABLE_OFFSET PREEMPT_OFFSET + #else +-# define PREEMPT_DISABLE_OFFSET 0 ++# define PREEMPT_DISABLE_OFFSET 0 + #endif + + /* ++ * The preempt_count offset after spin_lock() ++ */ ++#define PREEMPT_LOCK_OFFSET PREEMPT_DISABLE_OFFSET ++ ++/* + * The preempt_count offset needed for things like: + * + * spin_lock_bh() +@@ -90,7 +98,7 @@ + * + * Work as expected. + */ +-#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_DISABLE_OFFSET) ++#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_LOCK_OFFSET) + + /* + * Are we running in atomic context? WARNING: this macro cannot +diff --git a/include/linux/sched.h b/include/linux/sched.h +index 91fe6a38b3076..ec6000f66e75b 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -2647,12 +2647,6 @@ extern int _cond_resched(void); + + extern int __cond_resched_lock(spinlock_t *lock); + +-#ifdef CONFIG_PREEMPT_COUNT +-#define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET +-#else +-#define PREEMPT_LOCK_OFFSET 0 +-#endif +- + #define cond_resched_lock(lock) ({ \ + __might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET); \ + __cond_resched_lock(lock); \ +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index a19262a7d70b3..bbe957762ace6 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -4113,7 +4113,7 @@ static void __cond_resched(void) + + int __sched _cond_resched(void) + { +- if (should_resched()) { ++ if (should_resched(0)) { + __cond_resched(); + return 1; + } +@@ -4131,7 +4131,7 @@ EXPORT_SYMBOL(_cond_resched); + */ + int __cond_resched_lock(spinlock_t *lock) + { +- int resched = should_resched(); ++ int resched = should_resched(PREEMPT_LOCK_OFFSET); + int ret = 0; + + lockdep_assert_held(lock); +@@ -4153,7 +4153,7 @@ int __sched __cond_resched_softirq(void) + { + BUG_ON(!in_softirq()); + +- if (should_resched()) { ++ if (should_resched(SOFTIRQ_DISABLE_OFFSET)) { + local_bh_enable(); + __cond_resched(); + local_bh_disable(); diff --git a/recipes-kernel/linux/linux-toradex-rt-3.14.52/rename_define.patch b/recipes-kernel/linux/linux-toradex-rt-3.14.52/rename_define.patch new file mode 100644 index 0000000..6f5b962 --- /dev/null +++ b/recipes-kernel/linux/linux-toradex-rt-3.14.52/rename_define.patch @@ -0,0 +1,59 @@ +From d379e64ca4fc535334a02dc0314cba6e50f4b720 Mon Sep 17 00:00:00 2001 +From: Frederic Weisbecker +Date: Tue, 12 May 2015 16:41:48 +0200 +Subject: [PATCH] sched/preempt: Rename PREEMPT_CHECK_OFFSET to + PREEMPT_DISABLE_OFFSET + +commit 90b62b5129d5cb50f62f40e684de7a1961e57197 upstream. + +"CHECK" suggests it's only used as a comparison mask. But now it's used +further as a config-conditional preempt disabler offset. Lets +disambiguate this name. + +Signed-off-by: Frederic Weisbecker +Signed-off-by: Peter Zijlstra (Intel) +Cc: Linus Torvalds +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Link: http://lkml.kernel.org/r/1431441711-29753-4-git-send-email-fweisbec@gmail.com +Signed-off-by: Ingo Molnar +Signed-off-by: Mike Galbraith +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/preempt_mask.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h +index dbeec4d4a3bea..1f654ee836b7d 100644 +--- a/include/linux/preempt_mask.h ++++ b/include/linux/preempt_mask.h +@@ -72,9 +72,9 @@ + #define in_nmi() (preempt_count() & NMI_MASK) + + #if defined(CONFIG_PREEMPT_COUNT) +-# define PREEMPT_CHECK_OFFSET 1 ++# define PREEMPT_DISABLE_OFFSET 1 + #else +-# define PREEMPT_CHECK_OFFSET 0 ++# define PREEMPT_DISABLE_OFFSET 0 + #endif + + /* +@@ -90,7 +90,7 @@ + * + * Work as expected. + */ +-#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_CHECK_OFFSET) ++#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_DISABLE_OFFSET) + + /* + * Are we running in atomic context? WARNING: this macro cannot +@@ -106,7 +106,7 @@ + * (used by the scheduler, *after* releasing the kernel lock) + */ + #define in_atomic_preempt_off() \ +- ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) ++ ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_DISABLE_OFFSET) + + #ifdef CONFIG_PREEMPT_COUNT + # define preemptible() (preempt_count() == 0 && !irqs_disabled()) diff --git a/recipes-kernel/linux/linux-toradex-rt_3.14.52.bb b/recipes-kernel/linux/linux-toradex-rt_3.14.52.bb index 8728102..9e163c6 100644 --- a/recipes-kernel/linux/linux-toradex-rt_3.14.52.bb +++ b/recipes-kernel/linux/linux-toradex-rt_3.14.52.bb @@ -4,8 +4,8 @@ require recipes-kernel/linux/linux-dtb.inc SUMMARY = "Real-time Linux kernel for Toradex Freescale i.MX based modules" SRC_URI = "git://git.toradex.com/linux-toradex.git;protocol=git;branch=${SRCBRANCH} \ - https://github.com/Freescale/linux-fslc/commit/d379e64ca4fc535334a02dc0314cba6e50f4b720.patch;name=rename_define.patch \ - https://github.com/Freescale/linux-fslc/commit/e211cb68dd3c951b104ff0b47dbaed2c8b8d2399.patch;name=cond_resched.patch \ + file://rename_define.patch \ + file://cond_resched.patch \ file://patch-3.14.61-rt64-acpi-removed.patch.gz \ file://0001-fix-build.patch \ file://0003-no-split-ptlocks.patch \ @@ -13,11 +13,9 @@ SRC_URI = "git://git.toradex.com/linux-toradex.git;protocol=git;branch=${SRCBRAN file://defconfig \ " -SRC_URI[rename_define.patch.md5sum] = "efae6dd8a584fd02888f5c9bae8461cd" -SRC_URI[rename_define.patch.sha256sum] = "4aec310ce68114d7025db33f5b766acae454c77407cb57ffd3fa53e7b9a85488" - -SRC_URI[cond_resched.patch.md5sum] = "1316f67ec098639048c8d1c28af2a150" -SRC_URI[cond_resched.patch.sha256sum] = "40e5db88b03b98d81ea672ee70af7d02ed3cf39104ebfa5a193000fc3adad489" +# two patches taken from here: +# rename_define.patch https://github.com/Freescale/linux-fslc/commit/d379e64ca4fc535334a02dc0314cba6e50f4b720.patch +# cond_resched.patch https://github.com/Freescale/linux-fslc/commit/e211cb68dd3c951b104ff0b47dbaed2c8b8d2399.patch LOCALVERSION = "-v2.6b2-rt" SRCBRANCH = "toradex_imx_3.14.52_1.1.0_ga" -- cgit v1.2.3