From 5bc8b1f2eaecab038635d8218a125abd52b461f0 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Thu, 19 Dec 2019 13:01:46 +0100 Subject: linux-toradex-rt: update to latest 4.14-2.0.x Signed-off-by: Max Krummenacher --- .../0001-sources-prepare-for-rt-patch.patch | 80 ++++++++++++++++++++++ .../0003-Revert-sources-prepare-for-rt-patch.patch | 80 ++++++++++++++++++++++ .../linux/linux-toradex-rt_4.14-2.0.x.bb | 8 ++- 3 files changed, 165 insertions(+), 3 deletions(-) create mode 100644 recipes-kernel/linux/linux-toradex-rt-4.14-2.0.x/0001-sources-prepare-for-rt-patch.patch create mode 100644 recipes-kernel/linux/linux-toradex-rt-4.14-2.0.x/0003-Revert-sources-prepare-for-rt-patch.patch (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-toradex-rt-4.14-2.0.x/0001-sources-prepare-for-rt-patch.patch b/recipes-kernel/linux/linux-toradex-rt-4.14-2.0.x/0001-sources-prepare-for-rt-patch.patch new file mode 100644 index 0000000..24855d4 --- /dev/null +++ b/recipes-kernel/linux/linux-toradex-rt-4.14-2.0.x/0001-sources-prepare-for-rt-patch.patch @@ -0,0 +1,80 @@ +From afa1b55dfb1a9d9c8d4158ca0625d200fa7c3b3b Mon Sep 17 00:00:00 2001 +From: Max Krummenacher +Date: Thu, 19 Dec 2019 11:21:52 +0100 +Subject: [PATCH 1/5] sources: prepare for rt patch + +patch-4.14.155-rt70.patch does not apply to the 4.14.159 downstream +kernel. +Change the sources so that it does apply and revert afterwards. + +Signed-off-by: Max Krummenacher +--- + arch/arm/mach-imx/cpuidle-imx6q.c | 30 ++++++++++-------------------- + fs/nfs/delegation.c | 2 +- + 2 files changed, 11 insertions(+), 21 deletions(-) + +diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c +index 02d55ae7e0eb..2a2129c1cdb8 100644 +--- a/arch/arm/mach-imx/cpuidle-imx6q.c ++++ b/arch/arm/mach-imx/cpuidle-imx6q.c +@@ -16,34 +16,24 @@ + #include "cpuidle.h" + #include "hardware.h" + +-static atomic_t master = ATOMIC_INIT(0); +-static DEFINE_SPINLOCK(master_lock); ++static int num_idle_cpus = 0; ++static DEFINE_SPINLOCK(cpuidle_lock); + + static int imx6q_enter_wait(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) + { +- if (atomic_inc_return(&master) == num_online_cpus()) { +- /* +- * With this lock, we prevent other cpu to exit and enter +- * this function again and become the master. +- */ +- if (!spin_trylock(&master_lock)) +- goto idle; ++ spin_lock(&cpuidle_lock); ++ if (++num_idle_cpus == num_online_cpus()) + imx6_set_lpm(WAIT_UNCLOCKED); +- if (atomic_read(&master) != num_online_cpus()) +- imx6_set_lpm(WAIT_CLOCKED); +- cpu_do_idle(); +- imx6_set_lpm(WAIT_CLOCKED); +- spin_unlock(&master_lock); +- goto done; +- } ++ spin_unlock(&cpuidle_lock); + +-idle: + cpu_do_idle(); +-done: +- atomic_dec(&master); + +- imx6_set_lpm(WAIT_CLOCKED); ++ spin_lock(&cpuidle_lock); ++ if (num_idle_cpus-- == num_online_cpus()) ++ imx6_set_lpm(WAIT_CLOCKED); ++ spin_unlock(&cpuidle_lock); ++ + return index; + } + +diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c +index 04d57e11577e..7b59dbdd83a4 100644 +--- a/fs/nfs/delegation.c ++++ b/fs/nfs/delegation.c +@@ -163,7 +163,7 @@ static int nfs_delegation_claim_opens(struct inode *inode, + seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); + err = nfs4_open_delegation_recall(ctx, state, stateid, type); + if (!err) +- err = nfs_delegation_claim_locks(state, stateid); ++ err = nfs_delegation_claim_locks(ctx, state, stateid); + if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) + err = -EAGAIN; + mutex_unlock(&sp->so_delegreturn_mutex); +-- +2.20.1 + diff --git a/recipes-kernel/linux/linux-toradex-rt-4.14-2.0.x/0003-Revert-sources-prepare-for-rt-patch.patch b/recipes-kernel/linux/linux-toradex-rt-4.14-2.0.x/0003-Revert-sources-prepare-for-rt-patch.patch new file mode 100644 index 0000000..23d884d --- /dev/null +++ b/recipes-kernel/linux/linux-toradex-rt-4.14-2.0.x/0003-Revert-sources-prepare-for-rt-patch.patch @@ -0,0 +1,80 @@ +From 2fb4ad548f92270908b14ae4cc62134c447e8b25 Mon Sep 17 00:00:00 2001 +From: Max Krummenacher +Date: Thu, 19 Dec 2019 12:02:06 +0100 +Subject: [PATCH 3/5] Revert "sources: prepare for rt patch" + +Revert and fixup the preparation for applying the rt patch. + +This reverts commit afa1b55dfb1a9d9c8d4158ca0625d200fa7c3b3b. + +Signed-off-by: Max Krummenacher +--- + arch/arm/mach-imx/cpuidle-imx6q.c | 30 ++++++++++++++++++++---------- + fs/nfs/delegation.c | 2 +- + 2 files changed, 21 insertions(+), 11 deletions(-) + +diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c +index 39df89d3fbaa..439a69ec4543 100644 +--- a/arch/arm/mach-imx/cpuidle-imx6q.c ++++ b/arch/arm/mach-imx/cpuidle-imx6q.c +@@ -16,24 +16,34 @@ + #include "cpuidle.h" + #include "hardware.h" + +-static int num_idle_cpus = 0; +-static DEFINE_RAW_SPINLOCK(cpuidle_lock); ++static atomic_t master = ATOMIC_INIT(0); ++static DEFINE_RAW_SPINLOCK(master_lock); + + static int imx6q_enter_wait(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) + { +- raw_spin_lock(&cpuidle_lock); +- if (++num_idle_cpus == num_online_cpus()) ++ if (atomic_inc_return(&master) == num_online_cpus()) { ++ /* ++ * With this lock, we prevent other cpu to exit and enter ++ * this function again and become the master. ++ */ ++ if (!raw_spin_trylock(&master_lock)) ++ goto idle; + imx6_set_lpm(WAIT_UNCLOCKED); +- raw_spin_unlock(&cpuidle_lock); ++ if (atomic_read(&master) != num_online_cpus()) ++ imx6_set_lpm(WAIT_CLOCKED); ++ cpu_do_idle(); ++ imx6_set_lpm(WAIT_CLOCKED); ++ raw_spin_unlock(&master_lock); ++ goto done; ++ } + ++idle: + cpu_do_idle(); ++done: ++ atomic_dec(&master); + +- raw_spin_lock(&cpuidle_lock); +- if (num_idle_cpus-- == num_online_cpus()) +- imx6_set_lpm(WAIT_CLOCKED); +- raw_spin_unlock(&cpuidle_lock); +- ++ imx6_set_lpm(WAIT_CLOCKED); + return index; + } + +diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c +index d8d40062ec79..a8a3f2b2299c 100644 +--- a/fs/nfs/delegation.c ++++ b/fs/nfs/delegation.c +@@ -163,7 +163,7 @@ static int nfs_delegation_claim_opens(struct inode *inode, + seq = read_seqbegin(&sp->so_reclaim_seqlock); + err = nfs4_open_delegation_recall(ctx, state, stateid, type); + if (!err) +- err = nfs_delegation_claim_locks(ctx, state, stateid); ++ err = nfs_delegation_claim_locks(state, stateid); + if (!err && read_seqretry(&sp->so_reclaim_seqlock, seq)) + err = -EAGAIN; + mutex_unlock(&sp->so_delegreturn_mutex); +-- +2.20.1 + diff --git a/recipes-kernel/linux/linux-toradex-rt_4.14-2.0.x.bb b/recipes-kernel/linux/linux-toradex-rt_4.14-2.0.x.bb index e2ebd82..d6291b8 100644 --- a/recipes-kernel/linux/linux-toradex-rt_4.14-2.0.x.bb +++ b/recipes-kernel/linux/linux-toradex-rt_4.14-2.0.x.bb @@ -7,10 +7,12 @@ SUMMARY = "Real-Time Linux kernel for Toradex Freescale i.MX based modules" # both possible storage locations. MIRRORS += "${KERNELORG_MIRROR}/linux/kernel/projects/rt/4.14/older/ ${KERNELORG_MIRROR}/linux/kernel/projects/rt/4.14/" SRC_URI += " \ - ${KERNELORG_MIRROR}/linux/kernel/projects/rt/4.14/older/patch-4.14.126-rt62.patch.xz;name=rt-patch \ + file://0001-sources-prepare-for-rt-patch.patch \ + ${KERNELORG_MIRROR}/linux/kernel/projects/rt/4.14/older/patch-4.14.155-rt70.patch.xz;name=rt-patch \ + file://0003-Revert-sources-prepare-for-rt-patch.patch \ file://0001-imx_sc_thermal-prevent-BUG-with-rt-patch.patch \ file://0002-ddr-perf-prevent-BUG-with-rt-patch.patch \ " -SRC_URI[rt-patch.md5sum] = "47f2bb663112711d7270902e7e42cd16" -SRC_URI[rt-patch.sha256sum] = "496d2e788eb878c828dedda35e1def95c3e922ed4f010593fb8f0fcc523834ff" +SRC_URI[rt-patch.md5sum] = "39e7b169bd4d8dc9eb6690575c6582ed" +SRC_URI[rt-patch.sha256sum] = "5220a902427063cd428208d8df7181d36677a6f7cf7908bb66cc2031c6257686" -- cgit v1.2.3