Skip to contentSkip to conversation

Linux 4.4.12-rt20-rc1

PATCH In review Steven Rostedt 2 participants 9 messages Jul 12, 2016

Subsystems (8)
Memory management x86 VFS Tracing +4 more subsystems
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover Linux 4.4.12-rt20-rc1

Dear RT Folks,

This is the RT stable review cycle of patch 4.4.12-rt20-rc1.

Please scream at me if I messed something up. Please test the patches too.

The -rc release will be uploaded to kernel.org and will be deleted when the final release is out. This is just a review release (or release candidate).

The pre-releases will not be pushed to the git repository, only the final release is.

If all goes well, this patch will be converted to the next main release on 7/14/2016.

Enjoy,

-- Steve

To build 4.4.12-rt20-rc1 directly, the following patches should be applied:

http://www.kernel.org/pub/linux/kernel/v3.x/linux-4.4.tar.xz

http://www.kernel.org/pub/linux/kernel/v3.x/patch-4.4.12.xz

http://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patch-4.4.12-rt20-rc1.patch.xz

You can also build from 4.4.12-rt19 by applying the incremental patch:

http://www.kernel.org/pub/linux/kernel/projects/rt/4.4/incr/patch-4.4.12-rt19-rt20-rc1.patch.xz

Changes from 4.4.12-rt19:

---

Luiz Capitulino (1):
mm: perform lru_add_drain_all() remotely

Mike Galbraith (1):
work-simple: Rename work-simple.[ch] to swork.[ch] for consistency

Sebastian Andrzej Siewior (2):
locallock: add local_lock_on()
trace: correct off by one while recording the trace-event

Steven Rostedt (Red Hat) (1):

      Linux 4.4.12-rt20-rc1

----

 arch/x86/kernel/cpu/mcheck/mce.c         |  2 +-
 drivers/thermal/x86_pkg_temp_thermal.c   |  2 +-
 fs/aio.c                                 |  2 +-
 include/linux/cgroup-defs.h              |  2 +-
 include/linux/locallock.h                |  6 ++++++
 include/linux/{work-simple.h => swork.h} |  0
 kernel/sched/Makefile                    |  2 +-
 kernel/sched/{work-simple.c => swork.c}  |  2 +-
 kernel/trace/trace_events.c              |  8 +++++++
 localversion-rt                          |  2 +-
 mm/swap.c                                | 37 ++++++++++++++++++++++++++------
 11 files changed, 51 insertions(+), 14 deletions(-)
 rename include/linux/{work-simple.h => swork.h} (100%)
 rename kernel/sched/{work-simple.c => swork.c} (99%)
author maintainer
#1 lore raw

PATCH 1/5 locallock: add local_lock_on()

4.4.12-rt20-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Sebastian Andrzej Siewior <[email protected]>

---
 include/linux/locallock.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/locallock.h +6 -0
index 6fe5928fc2ab..e572a3971631 100644
@@ -66,6 +66,9 @@ static inline void __local_lock(struct local_irq_lock *lv)
 #define local_lock(lvar)					\
 	do { __local_lock(&get_local_var(lvar)); } while (0)
 
+#define local_lock_on(lvar, cpu)				\
+	do { __local_lock(&per_cpu(lvar, cpu)); } while (0)
+
 static inline int __local_trylock(struct local_irq_lock *lv)
 {
 	if (lv->owner != current && spin_trylock_local(&lv->lock)) {
@@ -104,6 +107,9 @@ static inline void __local_unlock(struct local_irq_lock *lv)
 		put_local_var(lvar);				\
 	} while (0)
 
+#define local_unlock_on(lvar, cpu)                       \
+	do { __local_unlock(&per_cpu(lvar, cpu)); } while (0)
+
 static inline void __local_lock_irq(struct local_irq_lock *lv)
 {
 	spin_lock_irqsave(&lv->lock, lv->flags);
Signature · 1 line
2.8.1
author maintainer
#2 lore raw

PATCH 2/5 mm: perform lru_add_drain_all() remotely

In reply to Steven Rostedt

4.4.12-rt20-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Luiz Capitulino <[email protected]>

lru_add_drain_all() works by scheduling lru_add_drain_cpu() to run on all CPUs that have non-empty LRU pagevecs and then waiting for the scheduled work to complete. However, workqueue threads may never have the chance to run on a CPU that's running a SCHED_FIFO task. This causes lru_add_drain_all() to block forever.

This commit solves this problem by changing lru_add_drain_all() to drain the LRU pagevecs of remote CPUs. This is done by grabbing swapvec_lock and calling lru_add_drain_cpu().

PS: This is based on an idea and initial implementation by
Rik van Riel.

---
 mm/swap.c | 37 ++++++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)
mm/swap.c +30 -7
index ca194aeb45d0..ad16649221d7 100644
@@ -821,9 +821,15 @@ void lru_add_drain_cpu(int cpu)
 		unsigned long flags;
 
 		/* No harm done if a racing interrupt already did this */
+#ifdef CONFIG_PREEMPT_RT_BASE
+		local_lock_irqsave_on(rotate_lock, flags, cpu);
+		pagevec_move_tail(pvec);
+		local_unlock_irqrestore_on(rotate_lock, flags, cpu);
+#else
 		local_lock_irqsave(rotate_lock, flags);
 		pagevec_move_tail(pvec);
 		local_unlock_irqrestore(rotate_lock, flags);
+#endif
 	}
 
 	pvec = &per_cpu(lru_deactivate_file_pvecs, cpu);
@@ -866,12 +872,32 @@ void lru_add_drain(void)
 	local_unlock_cpu(swapvec_lock);
 }
 
+
+#ifdef CONFIG_PREEMPT_RT_BASE
+static inline void remote_lru_add_drain(int cpu, struct cpumask *has_work)
+{
+	local_lock_on(swapvec_lock, cpu);
+	lru_add_drain_cpu(cpu);
+	local_unlock_on(swapvec_lock, cpu);
+}
+
+#else
+
 static void lru_add_drain_per_cpu(struct work_struct *dummy)
 {
 	lru_add_drain();
 }
 
 static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work);
+static inline void remote_lru_add_drain(int cpu, struct cpumask *has_work)
+{
+	struct work_struct *work = &per_cpu(lru_add_drain_work, cpu);
+
+	INIT_WORK(work, lru_add_drain_per_cpu);
+	schedule_work_on(cpu, work);
+	cpumask_set_cpu(cpu, has_work);
+}
+#endif
 
 void lru_add_drain_all(void)
 {
@@ -884,20 +910,17 @@ void lru_add_drain_all(void)
 	cpumask_clear(&has_work);
 
 	for_each_online_cpu(cpu) {
-		struct work_struct *work = &per_cpu(lru_add_drain_work, cpu);
-
 		if (pagevec_count(&per_cpu(lru_add_pvec, cpu)) ||
 		    pagevec_count(&per_cpu(lru_rotate_pvecs, cpu)) ||
 		    pagevec_count(&per_cpu(lru_deactivate_file_pvecs, cpu)) ||
-		    need_activate_page_drain(cpu)) {
-			INIT_WORK(work, lru_add_drain_per_cpu);
-			schedule_work_on(cpu, work);
-			cpumask_set_cpu(cpu, &has_work);
-		}
+		    need_activate_page_drain(cpu))
+			remote_lru_add_drain(cpu, &has_work);
 	}
 
+#ifndef CONFIG_PREEMPT_RT_BASE
 	for_each_cpu(cpu, &has_work)
 		flush_work(&per_cpu(lru_add_drain_work, cpu));
+#endif
 
 	put_online_cpus();
 	mutex_unlock(&lock);
Signature · 1 line
2.8.1
author maintainer
#7 lore raw

PATCH 4/5 work-simple: Rename work-simple.[ch] to swork.[ch] for consistency

In reply to Steven Rostedt

4.4.12-rt20-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Mike Galbraith <[email protected]>

The internal bits are already swork_blah, rename source to match.

---
 arch/x86/kernel/cpu/mcheck/mce.c       |   2 +-
 drivers/thermal/x86_pkg_temp_thermal.c |   2 +-
 fs/aio.c                               |   2 +-
 include/linux/cgroup-defs.h            |   2 +-
 include/linux/swork.h                  |  24 +++++
 include/linux/work-simple.h            |  24 -----
 kernel/sched/Makefile                  |   2 +-
 kernel/sched/swork.c                   | 173 +++++++++++++++++++++++++++++++++
 kernel/sched/work-simple.c             | 173 ---------------------------------
 9 files changed, 202 insertions(+), 202 deletions(-)
 create mode 100644 include/linux/swork.h
 delete mode 100644 include/linux/work-simple.h
 create mode 100644 kernel/sched/swork.c
 delete mode 100644 kernel/sched/work-simple.c
arch/x86/kernel/cpu/mcheck/mce.c +1 -1
index a080b4939019..430a4ec07811 100644
@@ -42,7 +42,7 @@
 #include <linux/irq_work.h>
 #include <linux/export.h>
 #include <linux/jiffies.h>
-#include <linux/work-simple.h>
+#include <linux/swork.h>
 
 #include <asm/processor.h>
 #include <asm/traps.h>
drivers/thermal/x86_pkg_temp_thermal.c +1 -1
index a774f0c8d22b..e03fa17b8670 100644
@@ -29,7 +29,7 @@
 #include <linux/pm.h>
 #include <linux/thermal.h>
 #include <linux/debugfs.h>
-#include <linux/work-simple.h>
+#include <linux/swork.h>
 #include <asm/cpu_device_id.h>
 #include <asm/mce.h>
 
fs/aio.c +1 -1
index 14af01540288..dd8d6f234a0b 100644
@@ -40,7 +40,7 @@
 #include <linux/ramfs.h>
 #include <linux/percpu-refcount.h>
 #include <linux/mount.h>
-#include <linux/work-simple.h>
+#include <linux/swork.h>
 
 #include <asm/kmap_types.h>
 #include <asm/uaccess.h>
include/linux/cgroup-defs.h +1 -1
index 1c12de3bedbe..0cc474291e08 100644
@@ -16,7 +16,7 @@
 #include <linux/percpu-refcount.h>
 #include <linux/percpu-rwsem.h>
 #include <linux/workqueue.h>
-#include <linux/work-simple.h>
+#include <linux/swork.h>
 
 #ifdef CONFIG_CGROUPS
 
include/linux/swork.h new file +24 -0
new file mode 100644
index 000000000000..f175fa9a6016
@@ -0,0 +1,24 @@
+#ifndef _LINUX_SWORK_H
+#define _LINUX_SWORK_H
+
+#include <linux/list.h>
+
+struct swork_event {
+	struct list_head item;
+	unsigned long flags;
+	void (*func)(struct swork_event *);
+};
+
+static inline void INIT_SWORK(struct swork_event *event,
+			      void (*func)(struct swork_event *))
+{
+	event->flags = 0;
+	event->func = func;
+}
+
+bool swork_queue(struct swork_event *sev);
+
+int swork_get(void);
+void swork_put(void);
+
+#endif /* _LINUX_SWORK_H */
include/linux/work-simple.h deleted +0 -24
deleted file mode 100644
index f175fa9a6016..000000000000
@@ -1,24 +0,0 @@
-#ifndef _LINUX_SWORK_H
-#define _LINUX_SWORK_H
-
-#include <linux/list.h>
-
-struct swork_event {
-	struct list_head item;
-	unsigned long flags;
-	void (*func)(struct swork_event *);
-};
-
-static inline void INIT_SWORK(struct swork_event *event,
-			      void (*func)(struct swork_event *))
-{
-	event->flags = 0;
-	event->func = func;
-}
-
-bool swork_queue(struct swork_event *sev);
-
-int swork_get(void);
-void swork_put(void);
-
-#endif /* _LINUX_SWORK_H */
kernel/sched/Makefile +1 -1
index debedbee5692..01b9994b367a 100644
@@ -13,7 +13,7 @@ endif
 
 obj-y += core.o loadavg.o clock.o cputime.o
 obj-y += idle_task.o fair.o rt.o deadline.o stop_task.o
-obj-y += wait.o swait.o work-simple.o completion.o idle.o
+obj-y += wait.o swait.o swork.o completion.o idle.o
 obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o
 obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o
 obj-$(CONFIG_SCHEDSTATS) += stats.o
kernel/sched/swork.c new file +173 -0

173 lines not on this page · raw message

kernel/sched/work-simple.c deleted +0 -173

173 lines not on this page · raw message

Signature · 1 line
2.8.1
author maintainer
#3 lore raw

PATCH 3/5 trace: correct off by one while recording the trace-event

In reply to Steven Rostedt

4.4.12-rt20-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Sebastian Andrzej Siewior <[email protected]>

Trace events like raw_syscalls show always a preempt code of one. The reason is that on PREEMPT kernels rcu_read_lock_sched_notrace() increases the preemption counter and the function recording the counter is caller within the RCU section.

[ Changed this to upstream version. See commit e947841c0dce ]
---
 kernel/trace/trace_events.c | 8 ++++++++
 1 file changed, 8 insertions(+)
kernel/trace/trace_events.c +8 -0
index 4a48f97a2256..5bd79b347398 100644
@@ -246,6 +246,14 @@ void *trace_event_buffer_reserve(struct trace_event_buffer *fbuffer,
 
 	local_save_flags(fbuffer->flags);
 	fbuffer->pc = preempt_count();
+	/*
+	 * If CONFIG_PREEMPT is enabled, then the tracepoint itself disables
+	 * preemption (adding one to the preempt_count). Since we are
+	 * interested in the preempt_count at the time the tracepoint was
+	 * hit, we need to subtract one to offset the increment.
+	 */
+	if (IS_ENABLED(CONFIG_PREEMPT))
+		fbuffer->pc--;
 	fbuffer->trace_file = trace_file;
 
 	fbuffer->event =
Signature · 1 line
2.8.1
author maintainer
#8 lore raw

PATCH 5/5 Linux 4.4.12-rt20-rc1

In reply to Steven Rostedt

4.4.12-rt20-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (Red Hat)" <[email protected]>

---
 localversion-rt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
localversion-rt +1 -1
index 483ad771f201..53614196cb36 100644
@@ -1 +1 @@
--rt19
+-rt20-rc1
Signature · 1 line
2.8.1
#4 lore raw

Re: [PATCH RT 3/5] trace: correct off by one while recording the trace-event

In reply to Steven Rostedt
Quoted 1 line · * Steven Rostedt | 2016-07-12 10:21:56 [-0400]:

From: Sebastian Andrzej Siewior <[email protected]>

…

Quoted 4 lines
[ Changed this to upstream version. See commit e947841c0dce ]

I am not the Author of this commit (and it is not yet in TIP). I haven't had the chance (yet) to test this and check if it breaks / works so I did not yet respond to your patch.

Assuming this behaves equally I don't mind a diffent patch in stable vs the devel tree (and I hope to test this & get into the devel tree within this week).

Sebastian

author maintainer
#5 lore raw

Re: [PATCH RT 3/5] trace: correct off by one while recording the trace-event

Quoted 4 lines · On Tue, 12 Jul 2016 16:40:50 +0200 Sebastian Andrzej Siewior…
Quoted 1 line · * Steven Rostedt | 2016-07-12 10:21:56 [-0400]:

From: Sebastian Andrzej Siewior <[email protected]>

…

Quoted 8 lines
Quoted 4 lines
[ Changed this to upstream version. See commit e947841c0dce ]

I am not the Author of this commit (and it is not yet in TIP). I haven't had the chance (yet) to test this and check if it breaks / works so I did not yet respond to your patch.

That's why I added the "Changed this to upstream version".

Quoted 4 lines

Assuming this behaves equally I don't mind a diffent patch in stable vs the devel tree (and I hope to test this & get into the devel tree within this week).

This is what's going into mainline. See commit e947841c0dce in linux-next.

-- Steve

author maintainer
#6 lore raw

Re: [PATCH RT 3/5] trace: correct off by one while recording the trace-event

Quoted 4 lines · On Tue, 12 Jul 2016 10:45:55 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 1 line · On Tue, 12 Jul 2016 16:40:50 +0200 Sebastian Andrzej Siewior…

I am not the Author of this commit (and it is not yet in TIP). I haven't

Oh, I forgot to add, I don't go through the tip tree.

-- Steve