diff options
Diffstat (limited to 'debian/patches-rt/net-Qdisc-use-a-seqlock-instead-seqcount.patch')
-rw-r--r-- | debian/patches-rt/net-Qdisc-use-a-seqlock-instead-seqcount.patch | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/debian/patches-rt/net-Qdisc-use-a-seqlock-instead-seqcount.patch b/debian/patches-rt/net-Qdisc-use-a-seqlock-instead-seqcount.patch index 16d930b52..668bf4bc2 100644 --- a/debian/patches-rt/net-Qdisc-use-a-seqlock-instead-seqcount.patch +++ b/debian/patches-rt/net-Qdisc-use-a-seqlock-instead-seqcount.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Wed, 14 Sep 2016 17:36:35 +0200 Subject: [PATCH] net/Qdisc: use a seqlock instead seqcount -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.2/older/patches-5.2.17-rt9.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patches-5.4.3-rt1.tar.xz The seqcount disables preemption on -RT while it is held which can't remove. Also we don't want the reader to spin for ages if the writer is @@ -17,8 +17,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> net/core/gen_estimator.c | 6 +++--- net/core/gen_stats.c | 12 ++++++------ net/sched/sch_api.c | 2 +- - net/sched/sch_generic.c | 12 ++++++++++++ - 8 files changed, 69 insertions(+), 17 deletions(-) + net/sched/sch_generic.c | 13 +++++++++++++ + 8 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 include/net/net_seq_lock.h --- a/include/linux/seqlock.h @@ -90,7 +90,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +#ifndef __NET_NET_SEQ_LOCK_H__ +#define __NET_NET_SEQ_LOCK_H__ + -+#ifdef CONFIG_PREEMPT_RT_BASE ++#ifdef CONFIG_PREEMPT_RT +# define net_seqlock_t seqlock_t +# define net_seq_begin(__r) read_seqbegin(__r) +# define net_seq_retry(__r, __s) read_seqretry(__r, __s) @@ -112,7 +112,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> #include <linux/refcount.h> #include <linux/workqueue.h> #include <linux/mutex.h> -@@ -102,7 +103,7 @@ struct Qdisc { +@@ -100,7 +101,7 @@ struct Qdisc { struct sk_buff_head gso_skb ____cacheline_aligned_in_smp; struct qdisc_skb_head q; struct gnet_stats_basic_packed bstats; @@ -121,11 +121,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> struct gnet_stats_queue qstats; unsigned long state; struct Qdisc *next_sched; -@@ -140,7 +141,11 @@ static inline bool qdisc_is_running(stru +@@ -138,7 +139,11 @@ static inline bool qdisc_is_running(stru { if (qdisc->flags & TCQ_F_NOLOCK) return spin_is_locked(&qdisc->seqlock); -+#ifdef CONFIG_PREEMPT_RT_BASE ++#ifdef CONFIG_PREEMPT_RT + return spin_is_locked(&qdisc->running.lock) ? true : false; +#else return (raw_read_seqcount(&qdisc->running) & 1) ? true : false; @@ -133,11 +133,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } static inline bool qdisc_is_percpu_stats(const struct Qdisc *q) -@@ -164,17 +169,27 @@ static inline bool qdisc_run_begin(struc +@@ -162,17 +167,27 @@ static inline bool qdisc_run_begin(struc } else if (qdisc_is_running(qdisc)) { return false; } -+#ifdef CONFIG_PREEMPT_RT_BASE ++#ifdef CONFIG_PREEMPT_RT + if (try_write_seqlock(&qdisc->running)) + return true; + return false; @@ -153,7 +153,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> static inline void qdisc_run_end(struct Qdisc *qdisc) { -+#ifdef CONFIG_PREEMPT_RT_BASE ++#ifdef CONFIG_PREEMPT_RT + write_sequnlock(&qdisc->running); +#else write_seqcount_end(&qdisc->running); @@ -161,7 +161,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> if (qdisc->flags & TCQ_F_NOLOCK) spin_unlock(&qdisc->seqlock); } -@@ -554,7 +569,7 @@ static inline spinlock_t *qdisc_root_sle +@@ -535,7 +550,7 @@ static inline spinlock_t *qdisc_root_sle return qdisc_lock(root); } @@ -264,7 +264,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> .ops = &noop_qdisc_ops, .q.lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.q.lock), .dev_queue = &noop_netdev_queue, -+#ifdef CONFIG_PREEMPT_RT_BASE ++#ifdef CONFIG_PREEMPT_RT + .running = __SEQLOCK_UNLOCKED(noop_qdisc.running), +#else .running = SEQCNT_ZERO(noop_qdisc.running), @@ -272,21 +272,28 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> .busylock = __SPIN_LOCK_UNLOCKED(noop_qdisc.busylock), .gso_skb = { .next = (struct sk_buff *)&noop_qdisc.gso_skb, -@@ -862,9 +866,17 @@ struct Qdisc *qdisc_alloc(struct netdev_ - lockdep_set_class(&sch->busylock, - dev->qdisc_tx_busylock ?: &qdisc_tx_busylock); - -+#ifdef CONFIG_PREEMPT_RT_BASE +@@ -853,7 +857,11 @@ struct Qdisc *qdisc_alloc(struct netdev_ + spin_lock_init(&sch->busylock); + /* seqlock has the same scope of busylock, for NOLOCK qdisc */ + spin_lock_init(&sch->seqlock); ++#ifdef CONFIG_PREEMPT_RT + seqlock_init(&sch->running); -+ lockdep_set_class(&sch->running.seqcount, -+ dev->qdisc_running_key ?: &qdisc_running_key); -+ lockdep_set_class(&sch->running.lock, -+ dev->qdisc_running_key ?: &qdisc_running_key); +#else seqcount_init(&sch->running); - lockdep_set_class(&sch->running, - dev->qdisc_running_key ?: &qdisc_running_key); +#endif sch->ops = ops; sch->flags = ops->static_flags; +@@ -867,7 +875,12 @@ struct Qdisc *qdisc_alloc(struct netdev_ + if (sch != &noop_qdisc) { + lockdep_set_class(&sch->busylock, &dev->qdisc_tx_busylock_key); + lockdep_set_class(&sch->seqlock, &dev->qdisc_tx_busylock_key); ++#ifdef CONFIG_PREEMPT_RT ++ lockdep_set_class(&sch->running.seqcount, &dev->qdisc_running_key); ++ lockdep_set_class(&sch->running.lock, &dev->qdisc_running_key); ++#else + lockdep_set_class(&sch->running, &dev->qdisc_running_key); ++#endif + } + + return sch; |