From 2315d89136c7147931b3cd658fc43f2441c7ceb0 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Thu, 21 May 2020 01:22:46 +0200 Subject: linux kernel rt 4.9: update to latest rt patch Update linux-toradex-rt_4.9-2.3.x to patch-4.9.220-rt143. Signed-off-by: Marcel Ziswiler --- .../0001-ARM-imx6-cpuidle-Use-raw_spinlock_t.patch | 51 ++++++++ ...rt_aio_fix_spectre_gadget_in_lookup_ioctx.patch | 28 ----- ..._address_is_aligned_in_handle_futex_death.patch | 23 ---- ...ex_restructure_rt_mutex_finish_proxy_lock.patch | 132 --------------------- recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb | 10 +- 5 files changed, 55 insertions(+), 189 deletions(-) create mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/0001-ARM-imx6-cpuidle-Use-raw_spinlock_t.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/0001-ARM-imx6-cpuidle-Use-raw_spinlock_t.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/0001-ARM-imx6-cpuidle-Use-raw_spinlock_t.patch new file mode 100644 index 0000000..f5d5962 --- /dev/null +++ b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/0001-ARM-imx6-cpuidle-Use-raw_spinlock_t.patch @@ -0,0 +1,51 @@ +From 99ae52edeba17c78753695e0d94d49c5f9e9a803 Mon Sep 17 00:00:00 2001 +Message-Id: <99ae52edeba17c78753695e0d94d49c5f9e9a803.1590137782.git.marcel.ziswiler@toradex.com> +From: Sebastian Andrzej Siewior +Date: Wed, 29 May 2019 17:42:29 +0200 +Subject: [PATCH] ARM: imx6: cpuidle: Use raw_spinlock_t + +The idle call back is invoked with disabled interrupts and requires +raw_spinlock_t locks to work. + +Signed-off-by: Sebastian Andrzej Siewior +Reviewed-by: Fabio Estevam +Signed-off-by: Shawn Guo +--- + arch/arm/mach-imx/cpuidle-imx6q.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c +index 326e870d71239..d9ac80aa1eb0a 100644 +--- a/arch/arm/mach-imx/cpuidle-imx6q.c ++++ b/arch/arm/mach-imx/cpuidle-imx6q.c +@@ -17,22 +17,22 @@ + #include "hardware.h" + + static int num_idle_cpus = 0; +-static DEFINE_SPINLOCK(cpuidle_lock); ++static DEFINE_RAW_SPINLOCK(cpuidle_lock); + + static int imx6q_enter_wait(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) + { +- spin_lock(&cpuidle_lock); ++ raw_spin_lock(&cpuidle_lock); + if (++num_idle_cpus == num_online_cpus()) + imx6_set_lpm(WAIT_UNCLOCKED); +- spin_unlock(&cpuidle_lock); ++ raw_spin_unlock(&cpuidle_lock); + + cpu_do_idle(); + +- spin_lock(&cpuidle_lock); ++ raw_spin_lock(&cpuidle_lock); + if (num_idle_cpus-- == num_online_cpus()) + imx6_set_lpm(WAIT_CLOCKED); +- spin_unlock(&cpuidle_lock); ++ raw_spin_unlock(&cpuidle_lock); + + return index; + } +-- +2.25.4 + diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch deleted file mode 100644 index c56c72f..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch +++ /dev/null @@ -1,28 +0,0 @@ -commit 2f7fbc052b632c0ae2d4a2bb5d5c928bbc24ca43 -Author: Marcel Ziswiler -Date: Tue Apr 9 04:12:18 2019 +0200 - - Revert "aio: fix spectre gadget in lookup_ioctx" - - This reverts commit 3a7bac902691cd92cb69f95d98dc675dea8b3228. - -diff --git a/fs/aio.c b/fs/aio.c -index c3fc80294397..b1170a7affe2 100644 ---- a/fs/aio.c -+++ b/fs/aio.c -@@ -40,7 +40,6 @@ - #include - #include - #include --#include - - #include - #include -@@ -1072,7 +1071,6 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) - if (!table || id >= table->nr) - goto out; - -- id = array_index_nospec(id, table->nr); - ctx = rcu_dereference(table->table[id]); - if (ctx && ctx->user_id == ctx_id) { - if (percpu_ref_tryget_live(&ctx->users)) diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch deleted file mode 100644 index 428bbdf..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch +++ /dev/null @@ -1,23 +0,0 @@ -commit f90e153d43ab26a02975c5de9d50b01161f044da -Author: Marcel Ziswiler -Date: Tue Apr 16 03:06:34 2019 +0200 - - Revert "futex: Ensure that futex address is aligned in handle_futex_death()" - - This reverts commit 726c28f30ac16e0d4cab17751b447e4abf61b102. - -diff --git a/kernel/futex.c b/kernel/futex.c -index 2e766ffff2cb..30fe0432c46d 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -3110,10 +3110,6 @@ int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi) - { - u32 uval, uninitialized_var(nval), mval; - -- /* Futex address must be 32bit aligned */ -- if ((((unsigned long)uaddr) % sizeof(*uaddr)) != 0) -- return -1; -- - retry: - if (get_user(uval, uaddr)) - return -1; diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch deleted file mode 100644 index 3718efd..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch +++ /dev/null @@ -1,132 +0,0 @@ -commit 1b190aef79b0e83bd8fccdc267a1761968f4a20a -Author: Marcel Ziswiler -Date: Tue Apr 16 03:30:56 2019 +0200 - - Revert "futex,rt_mutex: Restructure rt_mutex_finish_proxy_lock()" - - This reverts commit ce813552312bfbb28bae32064d65afff3c0e7c82. - -diff --git a/kernel/futex.c b/kernel/futex.c -index 30fe0432c46d..053d7be08be5 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -2966,13 +2966,10 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - */ - WARN_ON(!q.pi_state); - pi_mutex = &q.pi_state->pi_mutex; -- ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); -+ ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter); -+ debug_rt_mutex_free_waiter(&rt_waiter); - - spin_lock(q.lock_ptr); -- if (ret && !rt_mutex_cleanup_proxy_lock(pi_mutex, &rt_waiter)) -- ret = 0; -- -- debug_rt_mutex_free_waiter(&rt_waiter); - /* - * Fixup the pi_state owner and possibly acquire the lock if we - * haven't already. -diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c -index 7615e7722258..196cc460e38d 100644 ---- a/kernel/locking/rtmutex.c -+++ b/kernel/locking/rtmutex.c -@@ -1746,23 +1746,21 @@ struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock) - } - - /** -- * rt_mutex_wait_proxy_lock() - Wait for lock acquisition -+ * rt_mutex_finish_proxy_lock() - Complete lock acquisition - * @lock: the rt_mutex we were woken on - * @to: the timeout, null if none. hrtimer should already have - * been started. - * @waiter: the pre-initialized rt_mutex_waiter - * -- * Wait for the the lock acquisition started on our behalf by -- * rt_mutex_start_proxy_lock(). Upon failure, the caller must call -- * rt_mutex_cleanup_proxy_lock(). -+ * Complete the lock acquisition started our behalf by another thread. - * - * Returns: - * 0 - success - * <0 - error, one of -EINTR, -ETIMEDOUT - * -- * Special API call for PI-futex support -+ * Special API call for PI-futex requeue support - */ --int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, -+int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, - struct hrtimer_sleeper *to, - struct rt_mutex_waiter *waiter) - { -@@ -1775,6 +1773,9 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, - /* sleep on the mutex */ - ret = __rt_mutex_slowlock(lock, TASK_INTERRUPTIBLE, to, waiter); - -+ if (unlikely(ret)) -+ remove_waiter(lock, waiter); -+ - /* - * try_to_take_rt_mutex() sets the waiter bit unconditionally. We might - * have to fix that up. -@@ -1785,42 +1786,3 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, - - return ret; - } -- --/** -- * rt_mutex_cleanup_proxy_lock() - Cleanup failed lock acquisition -- * @lock: the rt_mutex we were woken on -- * @waiter: the pre-initialized rt_mutex_waiter -- * -- * Attempt to clean up after a failed rt_mutex_wait_proxy_lock(). -- * -- * Unless we acquired the lock; we're still enqueued on the wait-list and can -- * in fact still be granted ownership until we're removed. Therefore we can -- * find we are in fact the owner and must disregard the -- * rt_mutex_wait_proxy_lock() failure. -- * -- * Returns: -- * true - did the cleanup, we done. -- * false - we acquired the lock after rt_mutex_wait_proxy_lock() returned, -- * caller should disregards its return value. -- * -- * Special API call for PI-futex support -- */ --bool rt_mutex_cleanup_proxy_lock(struct rt_mutex *lock, -- struct rt_mutex_waiter *waiter) --{ -- bool cleanup = false; -- -- raw_spin_lock_irq(&lock->wait_lock); -- /* -- * Unless we're the owner; we're still enqueued on the wait_list. -- * So check if we became owner, if not, take us off the wait_list. -- */ -- if (rt_mutex_owner(lock) != current) { -- remove_waiter(lock, waiter); -- fixup_rt_mutex_waiters(lock); -- cleanup = true; -- } -- raw_spin_unlock_irq(&lock->wait_lock); -- -- return cleanup; --} -diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h -index 14cbafed0014..50848b460851 100644 ---- a/kernel/locking/rtmutex_common.h -+++ b/kernel/locking/rtmutex_common.h -@@ -107,11 +107,9 @@ extern void rt_mutex_proxy_unlock(struct rt_mutex *lock, - extern int rt_mutex_start_proxy_lock(struct rt_mutex *lock, - struct rt_mutex_waiter *waiter, - struct task_struct *task); --extern int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, -- struct hrtimer_sleeper *to, -- struct rt_mutex_waiter *waiter); --extern bool rt_mutex_cleanup_proxy_lock(struct rt_mutex *lock, -- struct rt_mutex_waiter *waiter); -+extern int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, -+ struct hrtimer_sleeper *to, -+ struct rt_mutex_waiter *waiter); - extern int rt_mutex_timed_futex_lock(struct rt_mutex *l, struct hrtimer_sleeper *to); - extern bool rt_mutex_futex_unlock(struct rt_mutex *lock, - struct wake_q_head *wqh); diff --git a/recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb b/recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb index 26948b2..61c1061 100644 --- a/recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb +++ b/recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb @@ -4,15 +4,13 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/linux-toradex-rt-4.9-2.3.x:" SUMMARY = "Real-Time Linux kernel for Toradex Freescale i.MX based modules" SRC_URI += " \ - file://revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch \ - file://revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch \ - file://revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch \ - https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patch-4.9.146-rt125.patch.xz;name=rt-patch \ + https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patch-4.9.220-rt143.patch.xz;name=rt-patch \ + file://0001-ARM-imx6-cpuidle-Use-raw_spinlock_t.patch \ file://0002-mm-Work-around-the-oops-below-by-disabling-split-ptl.patch \ " -SRC_URI[rt-patch.md5sum] = "b7869d612f2572191ed45c796bde7abe" -SRC_URI[rt-patch.sha256sum] = "925106e44f4bd5213bd38d29bcc0cfdda670fca20600357b15ac576d286ab445" +SRC_URI[rt-patch.md5sum] = "dc00267b39b9b257ca7b5252e7389840" +SRC_URI[rt-patch.sha256sum] = "ce42db14bce8afabf84babbb60db662b839e497cecd9a0559d3fc0566ff3d282" SRCREV = "d899927728beca8357a5b4120b690cb3c1d80844" SRCBRANCH = "toradex_4.9-2.3.x-imx" -- cgit v1.2.3