summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2021-11-02 11:49:06 +0100
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>2021-11-02 11:49:06 +0100
commit5487e2783b8a1f0b1e8db435e74c5c694215f0da (patch)
treed71537c4cc7a15ad3c1f07f8cb055cdf87e46e2e
parent42ef83f2d169a9f90bca5d2d37aae1208a0392da (diff)
downloadlinux-rt-5487e2783b8a1f0b1e8db435e74c5c694215f0da.tar.gz
[ANNOUNCE] v5.15-rt17v5.15-rt17-patches
Dear RT folks! I'm pleased to announce the v5.15-rt17 patch set. Changes since v5.15-rt16: - Remove put_cpu_var() in fscache which removal was overseen in the last release. - Redo the fs/dcache/start_dir_add() related patch and its description. - Drop preempt_disable_rt(), no more users. Known issues - netconsole triggers WARN. - The "Memory controller" (CONFIG_MEMCG) has been disabled. - Valentin Schneider reported a few splats on ARM64, see https://lkml.kernel.org/r/20210810134127.1394269-1-valentin.schneider@arm.com The delta patch against v5.15-rt16 is appended below and can be found here: https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/incr/patch-5.15-rt16-rt17.patch.xz You can get this release via the git tree at: git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git v5.15-rt17 The RT patch against v5.15 can be found here: https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/older/patch-5.15-rt17.patch.xz The split quilt queue is available at: https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/older/patches-5.15-rt17.tar.xz Sebastian Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-rw-r--r--patches/Add_localversion_for_-RT_release.patch2
-rw-r--r--patches/fs_dcache__disable_preemption_on_i_dir_seqs_write_side.patch114
-rw-r--r--patches/fscache-Use-only-one-fscache_object_cong_wait.patch13
-rw-r--r--patches/sched-Add-preempt_disable_rt.patch30
-rw-r--r--patches/series3
5 files changed, 54 insertions, 108 deletions
diff --git a/patches/Add_localversion_for_-RT_release.patch b/patches/Add_localversion_for_-RT_release.patch
index 22146ab020cb..efeddd431fc4 100644
--- a/patches/Add_localversion_for_-RT_release.patch
+++ b/patches/Add_localversion_for_-RT_release.patch
@@ -15,4 +15,4 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
--- /dev/null
+++ b/localversion-rt
@@ -0,0 +1 @@
-+-rt16
++-rt17
diff --git a/patches/fs_dcache__disable_preemption_on_i_dir_seqs_write_side.patch b/patches/fs_dcache__disable_preemption_on_i_dir_seqs_write_side.patch
index d603d8b410e0..e31b2b834f29 100644
--- a/patches/fs_dcache__disable_preemption_on_i_dir_seqs_write_side.patch
+++ b/patches/fs_dcache__disable_preemption_on_i_dir_seqs_write_side.patch
@@ -4,89 +4,61 @@ Date: Fri Oct 20 11:29:53 2017 +0200
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-i_dir_seq is an opencoded seqcounter. Based on the code it looks like we
-could have two writers in parallel despite the fact that the d_lock is
-held. The problem is that during the write process on RT the preemption
-is still enabled and if this process is interrupted by a reader with RT
-priority then we lock up.
-To avoid that lock up I am disabling the preemption during the update.
-The rename of i_dir_seq is here to ensure to catch new write sides in
-future.
+i_dir_seq is a sequence counter with a lock which is represented by the lowest
+bit. The writer atomically updates the counter which ensures that it can be
+modified by only one writer at a time.
+The commit introducing this change claims that the lock has been integrated
+into the counter for space reasons within the inode struct. The i_dir_seq
+member is within a union which shares also a pointer. That means by using
+seqlock_t we would have a sequence counter and a lock without increasing the
+size of the data structure on 64bit and 32bit would grow by 4 bytes. With
+lockdep enabled the size would grow and on PREEMPT_RT the spinlock_t is also
+larger.
-Cc: stable-rt@vger.kernel.org
-Reported-by: Oleg.Karfich@wago.com
-Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+In order to keep this construct working on PREEMPT_RT, the writer needs to
+disable preemption while obtaining the lock on the sequence counter / starting
+the write critical section. The writer acquires an otherwise unrelated
+spinlock_t which serves the same purpose on !PREEMPT_RT. With enabled
+preemption a high priority reader could preempt the writer and live lock the
+system while waiting for the locked bit to disappear.
+
+Another solution would be to have global spinlock_t which is always acquired
+by the writer. The reader would then acquire the lock if the sequence count is
+odd and by doing so force the writer out of the critical section. The global
+spinlock_t could be replaced by a hashed lock based on the address of the inode
+to lower the lock contention.
+For now, manually disable preemption on PREEMPT_RT to avoid live locks.
+Reported-by: Oleg.Karfich@wago.com
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
- fs/dcache.c | 12 +++++++-----
- fs/inode.c | 2 +-
- include/linux/fs.h | 2 +-
- 3 files changed, 9 insertions(+), 7 deletions(-)
+ fs/dcache.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
---
--- a/fs/dcache.c
+++ b/fs/dcache.c
-@@ -2538,9 +2538,10 @@ EXPORT_SYMBOL(d_rehash);
+@@ -2537,7 +2537,13 @@ EXPORT_SYMBOL(d_rehash);
+
static inline unsigned start_dir_add(struct inode *dir)
{
-
-+ preempt_disable_rt();
+-
++ /*
++ * The caller has a spinlock_t (dentry::d_lock) acquired which disables
++ * preemption on !PREEMPT_RT. On PREEMPT_RT the lock does not disable
++ * preemption and it has be done explicitly.
++ */
++ if (IS_ENABLED(CONFIG_PREEMPT_RT))
++ preempt_disable();
for (;;) {
-- unsigned n = dir->i_dir_seq;
-- if (!(n & 1) && cmpxchg(&dir->i_dir_seq, n, n + 1) == n)
-+ unsigned n = dir->__i_dir_seq;
-+ if (!(n & 1) && cmpxchg(&dir->__i_dir_seq, n, n + 1) == n)
- return n;
- cpu_relax();
- }
-@@ -2548,7 +2549,8 @@ static inline unsigned start_dir_add(str
-
+ unsigned n = dir->i_dir_seq;
+ if (!(n & 1) && cmpxchg(&dir->i_dir_seq, n, n + 1) == n)
+@@ -2549,6 +2555,8 @@ static inline unsigned start_dir_add(str
static inline void end_dir_add(struct inode *dir, unsigned n)
{
-- smp_store_release(&dir->i_dir_seq, n + 2);
-+ smp_store_release(&dir->__i_dir_seq, n + 2);
-+ preempt_enable_rt();
+ smp_store_release(&dir->i_dir_seq, n + 2);
++ if (IS_ENABLED(CONFIG_PREEMPT_RT))
++ preempt_enable();
}
static void d_wait_lookup(struct dentry *dentry)
-@@ -2584,7 +2586,7 @@ struct dentry *d_alloc_parallel(struct d
-
- retry:
- rcu_read_lock();
-- seq = smp_load_acquire(&parent->d_inode->i_dir_seq);
-+ seq = smp_load_acquire(&parent->d_inode->__i_dir_seq);
- r_seq = read_seqbegin(&rename_lock);
- dentry = __d_lookup_rcu(parent, name, &d_seq);
- if (unlikely(dentry)) {
-@@ -2612,7 +2614,7 @@ struct dentry *d_alloc_parallel(struct d
- }
-
- hlist_bl_lock(b);
-- if (unlikely(READ_ONCE(parent->d_inode->i_dir_seq) != seq)) {
-+ if (unlikely(READ_ONCE(parent->d_inode->__i_dir_seq) != seq)) {
- hlist_bl_unlock(b);
- rcu_read_unlock();
- goto retry;
---- a/fs/inode.c
-+++ b/fs/inode.c
-@@ -157,7 +157,7 @@ int inode_init_always(struct super_block
- inode->i_pipe = NULL;
- inode->i_cdev = NULL;
- inode->i_link = NULL;
-- inode->i_dir_seq = 0;
-+ inode->__i_dir_seq = 0;
- inode->i_rdev = 0;
- inode->dirtied_when = 0;
-
---- a/include/linux/fs.h
-+++ b/include/linux/fs.h
-@@ -711,7 +711,7 @@ struct inode {
- struct pipe_inode_info *i_pipe;
- struct cdev *i_cdev;
- char *i_link;
-- unsigned i_dir_seq;
-+ unsigned __i_dir_seq;
- };
-
- __u32 i_generation;
diff --git a/patches/fscache-Use-only-one-fscache_object_cong_wait.patch b/patches/fscache-Use-only-one-fscache_object_cong_wait.patch
index 6a8f1b05a566..7ed718fb88fe 100644
--- a/patches/fscache-Use-only-one-fscache_object_cong_wait.patch
+++ b/patches/fscache-Use-only-one-fscache_object_cong_wait.patch
@@ -26,11 +26,12 @@ Fixes: 8b8edefa2fffb ("fscache: convert object to use workqueue instead of slow-
Reported-by: Gregor Beck <gregor.beck@gmail.com>
Cc: stable-rt@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Link: https://lkml.kernel.org/r/20211029083839.xwwt7jgzru3kcpii@linutronix.de
---
fs/fscache/internal.h | 1 -
fs/fscache/main.c | 6 ------
- fs/fscache/object.c | 11 +++++------
- 3 files changed, 5 insertions(+), 13 deletions(-)
+ fs/fscache/object.c | 13 +++++--------
+ 3 files changed, 5 insertions(+), 15 deletions(-)
--- a/fs/fscache/internal.h
+++ b/fs/fscache/internal.h
@@ -82,7 +83,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/*
* enqueue an object for metadata-type processing
*/
-@@ -806,12 +808,10 @@ void fscache_enqueue_object(struct fscac
+@@ -806,16 +808,12 @@ void fscache_enqueue_object(struct fscac
_enter("{OBJ%x}", object->debug_id);
if (fscache_get_object(object, fscache_obj_get_queue) >= 0) {
@@ -95,8 +96,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ wake_up(&fscache_object_cong_wait);
} else
fscache_put_object(object, fscache_obj_put_queue);
+-
+- put_cpu_var(fscache_object_cong_wait);
+ }
+ }
-@@ -833,16 +833,15 @@ void fscache_enqueue_object(struct fscac
+@@ -833,16 +831,15 @@ void fscache_enqueue_object(struct fscac
*/
bool fscache_object_sleep_till_congested(signed long *timeoutp)
{
diff --git a/patches/sched-Add-preempt_disable_rt.patch b/patches/sched-Add-preempt_disable_rt.patch
deleted file mode 100644
index ab250dcb1014..000000000000
--- a/patches/sched-Add-preempt_disable_rt.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: Thomas Gleixner <tglx@linutronix.de>
-Date: Fri, 17 Sep 2021 12:56:34 +0200
-Subject: [PATCH] sched: Add preempt_disable_rt()
-
-RT needs a few preempt_disable/enable points which are not necessary
-otherwise. Implement variants to avoid #ifdeffery.
-
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
----
- include/linux/preempt.h | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
---- a/include/linux/preempt.h
-+++ b/include/linux/preempt.h
-@@ -283,6 +283,14 @@ do { \
- set_preempt_need_resched(); \
- } while (0)
-
-+#ifdef CONFIG_PREEMPT_RT
-+# define preempt_disable_rt() preempt_disable()
-+# define preempt_enable_rt() preempt_enable()
-+#else
-+# define preempt_disable_rt() barrier()
-+# define preempt_enable_rt() barrier()
-+#endif
-+
- #ifdef CONFIG_PREEMPT_NOTIFIERS
-
- struct preempt_notifier;
diff --git a/patches/series b/patches/series
index 6467f5571a62..04ff72f08b60 100644
--- a/patches/series
+++ b/patches/series
@@ -44,6 +44,7 @@ mm_allow_only_slub_on_preempt_rt.patch
mm_page_alloc_use_migrate_disable_in_drain_local_pages_wq.patch
mm_scatterlist_replace_the_preemptible_warning_in_sg_miter_stop.patch
mm-Disable-NUMA_BALANCING_DEFAULT_ENABLED-and-TRANSP.patch
+x86-softirq-Disable-softirq-stacks-on-PREEMPT_RT.patch
# KCOV (akpm)
0001_documentation_kcov_include_types_h_in_the_example.patch
@@ -79,7 +80,6 @@ net-stats-Read-the-statistics-in-___gnet_stats_copy_.patch
###########################################################################
irq_poll-Use-raise_softirq_irqoff-in-cpu_dead-notifi.patch
smp_wake_ksoftirqd_on_preempt_rt_instead_do_softirq.patch
-x86-softirq-Disable-softirq-stacks-on-PREEMPT_RT.patch
fs-namespace-Boost-the-mount_lock.lock-owner-instead.patch
fscache-Use-only-one-fscache_object_cong_wait.patch
@@ -129,7 +129,6 @@ locking-Allow-to-include-asm-spinlock_types.h-from-l.patch
###########################################################################
# preempt: Conditional variants
###########################################################################
-sched-Add-preempt_disable_rt.patch
sched-Make-preempt_enable_no_resched-behave-like-pre.patch
###########################################################################