summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2016-10-31 20:36:11 +0100
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>2016-10-31 20:36:11 +0100
commitd2c367e680dfca620a985c6b63e4ac4f67c96a2a (patch)
tree303baef53d98b101899d06d4efb5f27025e1be39
parente15768118871bf62612c041632155ce0182203a5 (diff)
download4.9-rt-patches-d2c367e680dfca620a985c6b63e4ac4f67c96a2a.tar.gz
[ANNOUNCE] 4.8.6-rt5
Dear RT folks! I'm pleased to announce the v4.8.6-rt5 patch set. Changes since v4.8.6-rt5: - Added `-no-PIE' to the Makefile for AFLAGS as well. This breaks gcc 3.2. Is someone here still using it? - The NFS fixup was slightly adjusted to avoid disabling preemption on !RT. Known issues - CPU hotplug got a little better but can deadlock. The delta patch against 4.8.6-rt5 is appended below and can be found here: https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.8/incr/patch-4.8.6-rt4-rt5.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 v4.8.6-rt5 The RT patch against 4.8.6 can be found here: https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.8/patch-4.8.6-rt5.patch.xz The split quilt queue is available at: https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.8/patches-4.8.6-rt5.tar.xz Sebastian Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-rw-r--r--patches/NFSv4-replace-seqcount_t-with-a-seqlock_t.patch64
-rw-r--r--patches/kbuild-add-fno-PIE.patch17
-rw-r--r--patches/localversion.patch2
3 files changed, 43 insertions, 40 deletions
diff --git a/patches/NFSv4-replace-seqcount_t-with-a-seqlock_t.patch b/patches/NFSv4-replace-seqcount_t-with-a-seqlock_t.patch
index 9ead03f07c2861..97d117033bd1b5 100644
--- a/patches/NFSv4-replace-seqcount_t-with-a-seqlock_t.patch
+++ b/patches/NFSv4-replace-seqcount_t-with-a-seqlock_t.patch
@@ -1,7 +1,10 @@
-From 270706631839c60dfb6ed7ac7c1c7dde4cc1092f Mon Sep 17 00:00:00 2001
-From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-Date: Fri, 21 Oct 2016 18:07:24 +0200
-Subject: [RFC PATCH] NFSv4: replace seqcount_t with a seqlock_t
+Date: Fri, 28 Oct 2016 23:05:11 +0200
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+To: Trond Myklebust <trond.myklebust@primarydata.com>
+Cc: Anna Schumaker <anna.schumaker@netapp.com>,
+ linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
+ tglx@linutronix.de
+Subject: NFSv4: replace seqcount_t with a seqlock_t
The raw_write_seqcount_begin() in nfs4_reclaim_open_state() bugs me
because it maps to preempt_disable() in -RT which I can't have at this
@@ -11,42 +14,19 @@ raw_write_seqcount_begin/end int nfs4_reclaim_open_state") because
lockdep complained. The whole seqcount thing was introduced in commit
c137afabe330 ("NFSv4: Allow the state manager to mark an open_owner as
being recovered").
-I don't understand how it is possible that we don't end up with two
-writers for the same resource because the `sp->so_lock' lock is dropped
-is soon in the list_for_each_entry() loop. It might be the
-test_and_clear_bit() check in nfs4_do_reclaim() but it might clear one
-bit on each iteration so I *think* we could have two invocations of the
-same struct nfs4_state_owner in nfs4_reclaim_open_state().
-So there is that.
-
-But back to the list_for_each_entry() macro.
-It seems that this `so_lock' lock protects the ->so_states list among
-other atomic_t & flags members. So at the begin of the loop we inc ->count
-ensuring that this field is not removed while we use it. So we drop the
-->so_lock lock during the loop. And after nfs4_reclaim_locks() invocation we
-nfs4_put_open_state() and then grab the ->so_lock again. So if we were the last
-user of this struct and we remove it, then the following list_next_entry()
-invocation is a use-after-free. Even if we use list_for_each_entry_safe() there
-is no guarantee that the following member is still valid because it might have
-been removed by something that invoked nfs4_put_open_state(), right?
-So there is this.
-
-However to address my initial problem I have here a patch :) So it uses
-a seqlock_t which ensures that there is only one writer at a time. So it
-should be basically what is happening now plus a tiny tiny tiny lock
-plus lockdep coverage. I tried to test this myself but I don't manage to get
-into this code path at all so I might be doing something wrong.
-
-Could you please check if this patch is working for you and whether my
-list_for_each_entry() observation is correct or not?
+The recovery threads runs only once.
+write_seqlock() does not work on !RT because it disables preemption and it the
+writer side is preemptible (has to remain so despite the fact that it will
+block readers).
+Reported-by: kernel test robot <xiaolong.ye@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
fs/nfs/delegation.c | 4 ++--
fs/nfs/nfs4_fs.h | 2 +-
fs/nfs/nfs4proc.c | 4 ++--
- fs/nfs/nfs4state.c | 10 ++++------
- 4 files changed, 9 insertions(+), 11 deletions(-)
+ fs/nfs/nfs4state.c | 22 ++++++++++++++++------
+ 4 files changed, 21 insertions(+), 11 deletions(-)
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -106,30 +86,42 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
mutex_init(&sp->so_delegreturn_mutex);
return sp;
}
-@@ -1459,8 +1459,8 @@ static int nfs4_reclaim_open_state(struc
+@@ -1459,8 +1459,12 @@ static int nfs4_reclaim_open_state(struc
* recovering after a network partition or a reboot from a
* server that doesn't support a grace period.
*/
++#ifdef CONFIG_PREEMPT_RT_FULL
+ write_seqlock(&sp->so_reclaim_seqlock);
++#else
++ write_seqcount_begin(&sp->so_reclaim_seqlock.seqcount);
++#endif
spin_lock(&sp->so_lock);
- raw_write_seqcount_begin(&sp->so_reclaim_seqcount);
restart:
list_for_each_entry(state, &sp->so_states, open_states) {
if (!test_and_clear_bit(ops->state_flag_bit, &state->flags))
-@@ -1528,14 +1528,12 @@ static int nfs4_reclaim_open_state(struc
+@@ -1528,14 +1532,20 @@ static int nfs4_reclaim_open_state(struc
spin_lock(&sp->so_lock);
goto restart;
}
- raw_write_seqcount_end(&sp->so_reclaim_seqcount);
spin_unlock(&sp->so_lock);
++#ifdef CONFIG_PREEMPT_RT_FULL
+ write_sequnlock(&sp->so_reclaim_seqlock);
++#else
++ write_seqcount_end(&sp->so_reclaim_seqlock.seqcount);
++#endif
return 0;
out_err:
nfs4_put_open_state(state);
- spin_lock(&sp->so_lock);
- raw_write_seqcount_end(&sp->so_reclaim_seqcount);
- spin_unlock(&sp->so_lock);
++#ifdef CONFIG_PREEMPT_RT_FULL
+ write_sequnlock(&sp->so_reclaim_seqlock);
++#else
++ write_seqcount_end(&sp->so_reclaim_seqlock.seqcount);
++#endif
return status;
}
diff --git a/patches/kbuild-add-fno-PIE.patch b/patches/kbuild-add-fno-PIE.patch
index 87a1885446a8f4..f6364adc2890a4 100644
--- a/patches/kbuild-add-fno-PIE.patch
+++ b/patches/kbuild-add-fno-PIE.patch
@@ -7,14 +7,19 @@ Debian started to build the gcc with -fPIE by default so the kernel
build ends before it starts properly with:
|kernel/bounds.c:1:0: error: code model kernel does not support PIC mode
+Also add to KBUILD_AFLAGSi due to:
+
+|gcc -Wp,-MD,arch/x86/entry/vdso/vdso32/.note.o.d … -mfentry -DCC_USING_FENTRY … vdso/vdso32/note.S
+|arch/x86/entry/vdso/vdso32/note.S:1:0: sorry, unimplemented: -mfentry isn’t supported for 32-bit in c ombination with -fpic
+
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
- Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
--- a/Makefile
+++ b/Makefile
-@@ -398,7 +398,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__
+@@ -398,12 +398,12 @@ KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
@@ -23,3 +28,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-std=gnu89
KBUILD_AFLAGS_KERNEL :=
+ KBUILD_CFLAGS_KERNEL :=
+-KBUILD_AFLAGS := -D__ASSEMBLY__
++KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
+ KBUILD_AFLAGS_MODULE := -DMODULE
+ KBUILD_CFLAGS_MODULE := -DMODULE
+ KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
diff --git a/patches/localversion.patch b/patches/localversion.patch
index 03a80b8b0e8035..72cdd2b3c76008 100644
--- a/patches/localversion.patch
+++ b/patches/localversion.patch
@@ -10,4 +10,4 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
--- /dev/null
+++ b/localversion-rt
@@ -0,0 +1 @@
-+-rt4
++-rt5