summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO8
-rw-r--r--0001-dccp-fix-freeing-skb-too-early-for-IPV6_RECVPKTINFO.patch47
-rw-r--r--0001-x86-fpu-Fix-invalid-FPU-ptrace-state-after-execve.patch65
-rw-r--r--0005-BFQ-update-to-v8r8.patch606
-rw-r--r--PKGBUILD18
5 files changed, 667 insertions, 77 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e795381f0eed..9228705b00f4 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = linux-rt-bfq
pkgver = 4.9.11_rt9
- pkgrel = 1
+ pkgrel = 2
url = http://algo.ing.unimo.it
arch = i686
arch = x86_64
@@ -26,7 +26,8 @@ pkgbase = linux-rt-bfq
source = config.x86_64
source = 99-linux.hook
source = linux.preset
- source = 0001-x86-fpu-Fix-invalid-FPU-ptrace-state-after-execve.patch
+ source = 0001-dccp-fix-freeing-skb-too-early-for-IPV6_RECVPKTINFO.patch
+ source = 0005-BFQ-update-to-v8r8.patch
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
validpgpkeys = 64254695FFF0AA4466CC19E67B96E8162A8CF5D1
@@ -49,7 +50,8 @@ pkgbase = linux-rt-bfq
sha512sums = 7a0a6eb4a2f0c4a981104ff4d09ff1a4ad75c9dc47d27276e0971b9fa16aeb208cb2c4158c491e8d067bf5f7f6c33ebd6826e18ad0d6203cac5711be453da93a
sha512sums = d6faa67f3ef40052152254ae43fee031365d0b1524aa0718b659eb75afc21a3f79ea8d62d66ea311a800109bed545bc8f79e8752319cd378eef2cbd3a09aba22
sha512sums = 2dc6b0ba8f7dbf19d2446c5c5f1823587de89f4e28e9595937dd51a87755099656f2acec50e3e2546ea633ad1bfd1c722e0c2b91eef1d609103d8abdc0a7cbaf
- sha512sums = 002d5e0ccfa5824c1750912a6400ff722672d6587b74ba66b1127cf1228048f604bba107617cf4f4477884039af4d4d196cf1b74cefe43b0bddc82270f11940d
+ sha512sums = cddd1349c0a7f7ffcd7615f31c8107144eb086326c09121cc9071e95d04d2a30ee8d7a3f5d1fe76e6377803dbf2fcb1791e482e0974b8474155419ad94c0fd2b
+ sha512sums = dab3dba300e276dd552cb86c903af5cac9f7c7954b938ac9c300745a175198c553d84cd3a5e58c350d83160f33b07f6dd20a570da4afdce178464c402ac7829b
pkgname = linux-rt-bfq
pkgdesc = Linux Kernel and modules with the RT patch and the BFQ scheduler.
diff --git a/0001-dccp-fix-freeing-skb-too-early-for-IPV6_RECVPKTINFO.patch b/0001-dccp-fix-freeing-skb-too-early-for-IPV6_RECVPKTINFO.patch
new file mode 100644
index 000000000000..9adaf0b305f2
--- /dev/null
+++ b/0001-dccp-fix-freeing-skb-too-early-for-IPV6_RECVPKTINFO.patch
@@ -0,0 +1,47 @@
+From 5edabca9d4cff7f1f2b68f0bac55ef99d9798ba4 Mon Sep 17 00:00:00 2001
+From: Andrey Konovalov <andreyknvl@google.com>
+Date: Thu, 16 Feb 2017 17:22:46 +0100
+Subject: [PATCH] dccp: fix freeing skb too early for IPV6_RECVPKTINFO
+
+In the current DCCP implementation an skb for a DCCP_PKT_REQUEST packet
+is forcibly freed via __kfree_skb in dccp_rcv_state_process if
+dccp_v6_conn_request successfully returns.
+
+However, if IPV6_RECVPKTINFO is set on a socket, the address of the skb
+is saved to ireq->pktopts and the ref count for skb is incremented in
+dccp_v6_conn_request, so skb is still in use. Nevertheless, it gets freed
+in dccp_rcv_state_process.
+
+Fix by calling consume_skb instead of doing goto discard and therefore
+calling __kfree_skb.
+
+Similar fixes for TCP:
+
+fb7e2399ec17f1004c0e0ccfd17439f8759ede01 [TCP]: skb is unexpectedly freed.
+0aea76d35c9651d55bbaf746e7914e5f9ae5a25d tcp: SYN packets are now
+simply consumed
+
+Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
+Acked-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ net/dccp/input.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/dccp/input.c b/net/dccp/input.c
+index ba347184bda9b3fe..8fedc2d497709b3d 100644
+--- a/net/dccp/input.c
++++ b/net/dccp/input.c
+@@ -606,7 +606,8 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
+ if (inet_csk(sk)->icsk_af_ops->conn_request(sk,
+ skb) < 0)
+ return 1;
+- goto discard;
++ consume_skb(skb);
++ return 0;
+ }
+ if (dh->dccph_type == DCCP_PKT_RESET)
+ goto discard;
+--
+2.11.1
+
diff --git a/0001-x86-fpu-Fix-invalid-FPU-ptrace-state-after-execve.patch b/0001-x86-fpu-Fix-invalid-FPU-ptrace-state-after-execve.patch
deleted file mode 100644
index 8cef8463520f..000000000000
--- a/0001-x86-fpu-Fix-invalid-FPU-ptrace-state-after-execve.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 885bad1e5f32bbf30787ead9578f8174047e6904 Mon Sep 17 00:00:00 2001
-From: Yu-cheng Yu <yu-cheng.yu@intel.com>
-Date: Thu, 17 Nov 2016 09:11:35 -0800
-Subject: [PATCH] x86/fpu: Fix invalid FPU ptrace state after execve()
-
-commit b22cbe404a9cc3c7949e380fa1861e31934c8978 upstream.
-
-Robert O'Callahan reported that after an execve PTRACE_GETREGSET
-NT_X86_XSTATE continues to return the pre-exec register values
-until the exec'ed task modifies FPU state.
-
-The test code is at:
-
- https://bugzilla.redhat.com/attachment.cgi?id=1164286.
-
-What is happening is fpu__clear() does not properly clear fpstate.
-Fix it by doing just that.
-
-Reported-by: Robert O'Callahan <robert@ocallahan.org>
-Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
-Cc: Andy Lutomirski <luto@kernel.org>
-Cc: Borislav Petkov <bp@suse.de>
-Cc: David Hansen <dave.hansen@linux.intel.com>
-Cc: Fenghua Yu <fenghua.yu@intel.com>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Ravi V. Shankar <ravi.v.shankar@intel.com>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Link: http://lkml.kernel.org/r/1479402695-6553-1-git-send-email-yu-cheng.yu@intel.com
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/x86/kernel/fpu/core.c | 16 ++++++++--------
- 1 file changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
-index 3fc03a09a93b1710..c289e2f4a6e5b464 100644
---- a/arch/x86/kernel/fpu/core.c
-+++ b/arch/x86/kernel/fpu/core.c
-@@ -517,14 +517,14 @@ void fpu__clear(struct fpu *fpu)
- {
- WARN_ON_FPU(fpu != &current->thread.fpu); /* Almost certainly an anomaly */
-
-- if (!use_eager_fpu() || !static_cpu_has(X86_FEATURE_FPU)) {
-- /* FPU state will be reallocated lazily at the first use. */
-- fpu__drop(fpu);
-- } else {
-- if (!fpu->fpstate_active) {
-- fpu__activate_curr(fpu);
-- user_fpu_begin();
-- }
-+ fpu__drop(fpu);
-+
-+ /*
-+ * Make sure fpstate is cleared and initialized.
-+ */
-+ if (static_cpu_has(X86_FEATURE_FPU)) {
-+ fpu__activate_curr(fpu);
-+ user_fpu_begin();
- copy_init_fpstate_to_fpregs();
- }
- }
---
-2.10.2
-
diff --git a/0005-BFQ-update-to-v8r8.patch b/0005-BFQ-update-to-v8r8.patch
new file mode 100644
index 000000000000..78df2638ba5f
--- /dev/null
+++ b/0005-BFQ-update-to-v8r8.patch
@@ -0,0 +1,606 @@
+From 23a3965c19616da0b723f0a83288dfc76aace016 Mon Sep 17 00:00:00 2001
+From: Paolo Valente <paolo.valente@linaro.org>
+Date: Sat, 4 Feb 2017 17:31:41 +0100
+Subject: [PATCH 01/10] Remove wrong compilation warning
+
+BUGFIX: Removed a wrong compilation warning, due to the compiler
+not taking into account short circuit in a condition.
+
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+---
+ block/bfq-sched.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/block/bfq-sched.c b/block/bfq-sched.c
+index 797bce7..2e9dc59 100644
+--- a/block/bfq-sched.c
++++ b/block/bfq-sched.c
+@@ -1301,7 +1301,7 @@ static void bfq_deactivate_entity(struct bfq_entity *entity,
+ bool expiration)
+ {
+ struct bfq_sched_data *sd;
+- struct bfq_entity *parent;
++ struct bfq_entity *parent = NULL;
+
+ for_each_entity_safe(entity, parent) {
+ sd = entity->sched_data;
+
+From 62fcb1a9aaa77eb835640d8681fd2f5ad0f1111a Mon Sep 17 00:00:00 2001
+From: Paolo Valente <paolo.valente@linaro.org>
+Date: Mon, 19 Dec 2016 17:14:58 +0100
+Subject: [PATCH 02/10] Add a ton of forgotten static qualifiers
+
+BUGIFX: Added several forgotten static qualifiers in function
+definitions (completely harmless issue).
+
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+---
+ block/bfq-iosched.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+index 2a2c130..98a1acd 100644
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -107,7 +107,7 @@ static const int bfq_async_charge_factor = 10;
+ /* Default timeout values, in jiffies, approximating CFQ defaults. */
+ static const int bfq_timeout = (HZ / 8);
+
+-struct kmem_cache *bfq_pool;
++static struct kmem_cache *bfq_pool;
+
+ /* Below this threshold (in ns), we consider thinktime immediate. */
+ #define BFQ_MIN_TT (2 * NSEC_PER_MSEC)
+@@ -1868,7 +1868,7 @@ static bool bfq_may_be_close_cooperator(struct bfq_queue *bfqq,
+ * positives. In case bfqq is weight-raised, such false positives
+ * would evidently degrade latency guarantees for bfqq.
+ */
+-bool wr_from_too_long(struct bfq_queue *bfqq)
++static bool wr_from_too_long(struct bfq_queue *bfqq)
+ {
+ return bfqq->wr_coeff > 1 &&
+ time_is_before_jiffies(bfqq->last_wr_start_finish +
+@@ -2298,7 +2298,7 @@ static unsigned long bfq_calc_max_budget(struct bfq_data *bfqd)
+ * function of the estimated peak rate. See comments on
+ * bfq_calc_max_budget(), and on T_slow and T_fast arrays.
+ */
+-void update_thr_responsiveness_params(struct bfq_data *bfqd)
++static void update_thr_responsiveness_params(struct bfq_data *bfqd)
+ {
+ int dev_type = blk_queue_nonrot(bfqd->queue);
+
+@@ -2333,7 +2333,7 @@ void update_thr_responsiveness_params(struct bfq_data *bfqd)
+ BFQ_RATE_SHIFT);
+ }
+
+-void bfq_reset_rate_computation(struct bfq_data *bfqd, struct request *rq)
++static void bfq_reset_rate_computation(struct bfq_data *bfqd, struct request *rq)
+ {
+ if (rq != NULL) { /* new rq dispatch now, reset accordingly */
+ bfqd->last_dispatch = bfqd->first_dispatch = ktime_get_ns() ;
+@@ -2350,7 +2350,7 @@ void bfq_reset_rate_computation(struct bfq_data *bfqd, struct request *rq)
+ bfqd->tot_sectors_dispatched);
+ }
+
+-void bfq_update_rate_reset(struct bfq_data *bfqd, struct request *rq)
++static void bfq_update_rate_reset(struct bfq_data *bfqd, struct request *rq)
+ {
+ u32 rate, weight, divisor;
+
+@@ -2515,7 +2515,7 @@ void bfq_update_rate_reset(struct bfq_data *bfqd, struct request *rq)
+ * of the observed dispatch rate. The function assumes to be invoked
+ * on every request dispatch.
+ */
+-void bfq_update_peak_rate(struct bfq_data *bfqd, struct request *rq)
++static void bfq_update_peak_rate(struct bfq_data *bfqd, struct request *rq)
+ {
+ u64 now_ns = ktime_get_ns();
+
+
+From 588042943eab576d65c0ebf57ccf57b82211e7c2 Mon Sep 17 00:00:00 2001
+From: Paolo Valente <paolo.valente@linaro.org>
+Date: Fri, 3 Feb 2017 11:53:01 +0100
+Subject: [PATCH 03/10] BUGFIX: Put async queues on exit also without cgroups
+
+BUGFIX: The putting of async queues on scheduler exit was missing in case
+cgroups support was not active. This fix adds the missing operation.
+
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+---
+ block/bfq-cgroup.c | 3 +++
+ block/bfq-iosched.c | 11 ++++++++---
+ 2 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
+index bbaecd0..a5f8dc1 100644
+--- a/block/bfq-cgroup.c
++++ b/block/bfq-cgroup.c
+@@ -1140,6 +1140,9 @@ static inline void bfqg_stats_update_idle_time(struct bfq_group *bfqg) { }
+ static inline void bfqg_stats_set_start_idle_time(struct bfq_group *bfqg) { }
+ static inline void bfqg_stats_update_avg_queue_size(struct bfq_group *bfqg) { }
+
++static void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
++ struct bfq_group *bfqg) {}
++
+ static void bfq_init_entity(struct bfq_entity *entity,
+ struct bfq_group *bfqg)
+ {
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+index 98a1acd..517f513 100644
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -4093,7 +4093,13 @@ static struct bfq_queue *bfq_get_queue(struct bfq_data *bfqd,
+ * prune it.
+ */
+ if (async_bfqq) {
+- bfqq->ref++;
++ bfqq->ref++; /*
++ * Extra group reference, w.r.t. sync
++ * queue. This extra reference is removed
++ * only if bfqq->bfqg disappears, to
++ * guarantee that this queue is not freed
++ * until its group goes away.
++ */
+ bfq_log_bfqq(bfqd, bfqq, "get_queue, bfqq not in async: %p, %d",
+ bfqq, bfqq->ref);
+ *async_bfqq = bfqq;
+@@ -4697,7 +4703,6 @@ static void bfq_shutdown_timer_wq(struct bfq_data *bfqd)
+ cancel_work_sync(&bfqd->unplug_work);
+ }
+
+-#ifdef CONFIG_BFQ_GROUP_IOSCHED
+ static void __bfq_put_async_bfqq(struct bfq_data *bfqd,
+ struct bfq_queue **bfqq_ptr)
+ {
+@@ -4730,7 +4735,6 @@ static void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg)
+
+ __bfq_put_async_bfqq(bfqd, &bfqg->async_idle_bfqq);
+ }
+-#endif
+
+ static void bfq_exit_queue(struct elevator_queue *e)
+ {
+@@ -4755,6 +4759,7 @@ static void bfq_exit_queue(struct elevator_queue *e)
+ #ifdef CONFIG_BFQ_GROUP_IOSCHED
+ blkcg_deactivate_policy(q, &blkcg_policy_bfq);
+ #else
++ bfq_put_async_queues(bfqd, bfqd->root_group);
+ kfree(bfqd->root_group);
+ #endif
+
+
+From 737da1cfab00974c57bdc132f93056e5c5da2cbb Mon Sep 17 00:00:00 2001
+From: Paolo Valente <paolo.valente@linaro.org>
+Date: Sat, 4 Feb 2017 17:54:35 +0100
+Subject: [PATCH 04/10] Fix check of the percentage of sequential dispatches
+
+BUGFIX: In the peak-rate estimator, there was a serious error in the
+check that the percentage of sequential I/O-request dispatches was high
+enough to trigger an update of the peak-rate estimate. This commit fixes
+that check.
+
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+---
+ block/bfq-iosched.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+index 517f513..d603cf9 100644
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -2400,7 +2400,7 @@ static void bfq_update_rate_reset(struct bfq_data *bfqd, struct request *rq)
+ * total, and rate is below the current estimated peak rate
+ * - rate is unreasonably high (> 20M sectors/sec)
+ */
+- if ((bfqd->peak_rate_samples > (3 * bfqd->sequential_samples)>>2 &&
++ if ((bfqd->sequential_samples < (3 * bfqd->peak_rate_samples)>>2 &&
+ rate <= bfqd->peak_rate) ||
+ rate > 20<<BFQ_RATE_SHIFT) {
+ bfq_log(bfqd,
+
+From 7a2380425fe4d433a75982295fae3079f6a7b6a3 Mon Sep 17 00:00:00 2001
+From: Luca Miccio <lucmiccio@gmail.com>
+Date: Sat, 4 Feb 2017 18:03:06 +0100
+Subject: [PATCH 05/10] Better tune weight-raising for slow flash-based devices
+
+IMPROVEMENT Luca Miccio has run a few responsiveness tests on recent
+Android systems with average-speed storage devices. These tests have
+shown that the following BFQ parameter was too low for these systems:
+reference duration for slow storage devices of weight raising for
+interactive applications. This commit raises that duration to a
+value that is yelding optimal results in our tests.
+
+Signed-off-by: Luca Miccio <lucmiccio@gmail.com>
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+---
+ block/bfq-iosched.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+index d603cf9..ba82d8f 100644
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -5260,7 +5260,7 @@ static int __init bfq_init(void)
+ * be run for a long time.
+ */
+ T_slow[0] = msecs_to_jiffies(3500); /* actually 4 sec */
+- T_slow[1] = msecs_to_jiffies(1000); /* actually 1.5 sec */
++ T_slow[1] = msecs_to_jiffies(6000); /* actually 6.5 sec */
+ T_fast[0] = msecs_to_jiffies(7000); /* actually 8 sec */
+ T_fast[1] = msecs_to_jiffies(2500); /* actually 3 sec */
+
+
+From 905e1281d01d0abcb151530cc362ad173b9b2959 Mon Sep 17 00:00:00 2001
+From: Paolo Valente <paolo.valente@linaro.org>
+Date: Sat, 4 Feb 2017 18:16:59 +0100
+Subject: [PATCH 06/10] BFQ-v8r8-rc1
+
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+---
+ block/bfq-iosched.c | 2 +-
+ block/bfq.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+index ba82d8f..7ffc167 100644
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -5234,7 +5234,7 @@ static struct blkcg_policy blkcg_policy_bfq = {
+ static int __init bfq_init(void)
+ {
+ int ret;
+- char msg[60] = "BFQ I/O-scheduler: v8r7";
++ char msg[60] = "BFQ I/O-scheduler: v8r8-rc1";
+
+ #ifdef CONFIG_BFQ_GROUP_IOSCHED
+ ret = blkcg_policy_register(&blkcg_policy_bfq);
+diff --git a/block/bfq.h b/block/bfq.h
+index bef8244..7b12f3c 100644
+--- a/block/bfq.h
++++ b/block/bfq.h
+@@ -1,5 +1,5 @@
+ /*
+- * BFQ v8r7 for 4.9.0: data structures and common functions prototypes.
++ * BFQ v8r8-rc1 for 4.10.0: data structures and common functions prototypes.
+ *
+ * Based on ideas and code from CFQ:
+ * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
+
+From 3955e8c82ce05297fb9e2c5beecbd8df9312abb3 Mon Sep 17 00:00:00 2001
+From: Paolo Valente <paolo.valente@linaro.org>
+Date: Sun, 5 Feb 2017 18:50:51 +0100
+Subject: [PATCH 07/10] Avoid a second dispatch in case of budget exhaustion
+
+IMPROVEMENT This commit anticipates the complete check of budget exhaustion,
+for the in-service bfq_queue, to when the next bfq_queue to serve is selected
+(during a dispatch operation). This enables a new bfq_queue to be immediately
+selected for service in case the in-service bfq_queue has actually exhausted
+its budget. As a consequence, a second dispatch invocation is not needed
+any more, to have a new request dispatched.
+To implement this improvement, this commit implements a further improvement
+too: the field next_rq of a bfq_queue now always contains the actual next
+request to dispatch (or NULL if the bfq_queue is empty).
+
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+---
+ block/bfq-iosched.c | 122 +++++++++++++++++++++++++++-------------------------
+ 1 file changed, 63 insertions(+), 59 deletions(-)
+
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+index 7ffc167..2796927 100644
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -519,13 +519,45 @@ static void bfq_weights_tree_remove(struct bfq_data *bfqd,
+ entity->weight_counter = NULL;
+ }
+
++/*
++ * Return expired entry, or NULL to just start from scratch in rbtree.
++ */
++static struct request *bfq_check_fifo(struct bfq_queue *bfqq,
++ struct request *last)
++{
++ struct request *rq;
++
++ if (bfq_bfqq_fifo_expire(bfqq))
++ return NULL;
++
++ bfq_mark_bfqq_fifo_expire(bfqq);
++
++ rq = rq_entry_fifo(bfqq->fifo.next);
++
++ if (rq == last || ktime_get_ns() < rq->fifo_time)
++ return NULL;
++
++ bfq_log_bfqq(bfqq->bfqd, bfqq, "check_fifo: returned %p", rq);
++ BUG_ON(RB_EMPTY_NODE(&rq->rb_node));
++ return rq;
++}
++
+ static struct request *bfq_find_next_rq(struct bfq_data *bfqd,
+ struct bfq_queue *bfqq,
+ struct request *last)
+ {
+ struct rb_node *rbnext = rb_next(&last->rb_node);
+ struct rb_node *rbprev = rb_prev(&last->rb_node);
+- struct request *next = NULL, *prev = NULL;
++ struct request *next, *prev = NULL;
++
++ BUG_ON(list_empty(&bfqq->fifo));
++
++ /* Follow expired path, else get first next available. */
++ next = bfq_check_fifo(bfqq, last);
++ if (next) {
++ BUG_ON(next == last);
++ return next;
++ }
+
+ BUG_ON(RB_EMPTY_NODE(&last->rb_node));
+
+@@ -1523,11 +1555,12 @@ static void bfq_remove_request(struct request *rq)
+ elv_rb_del(&bfqq->sort_list, rq);
+
+ if (RB_EMPTY_ROOT(&bfqq->sort_list)) {
++ bfqq->next_rq = NULL;
++
+ BUG_ON(bfqq->entity.budget < 0);
+
+ if (bfq_bfqq_busy(bfqq) && bfqq != bfqd->in_service_queue) {
+ bfq_del_bfqq_busy(bfqd, bfqq, false);
+-
+ /* bfqq emptied. In normal operation, when
+ * bfqq is empty, bfqq->entity.service and
+ * bfqq->entity.budget must contain,
+@@ -2616,29 +2649,6 @@ static void bfq_dispatch_insert(struct request_queue *q, struct request *rq)
+ elv_dispatch_sort(q, rq);
+ }
+
+-/*
+- * Return expired entry, or NULL to just start from scratch in rbtree.
+- */
+-static struct request *bfq_check_fifo(struct bfq_queue *bfqq)
+-{
+- struct request *rq = NULL;
+-
+- if (bfq_bfqq_fifo_expire(bfqq))
+- return NULL;
+-
+- bfq_mark_bfqq_fifo_expire(bfqq);
+-
+- if (list_empty(&bfqq->fifo))
+- return NULL;
+-
+- rq = rq_entry_fifo(bfqq->fifo.next);
+-
+- if (ktime_get_ns() < rq->fifo_time)
+- return NULL;
+-
+- return rq;
+-}
+-
+ static void __bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq)
+ {
+ BUG_ON(bfqq != bfqd->in_service_queue);
+@@ -3504,14 +3514,29 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd)
+ !bfq_bfqq_must_idle(bfqq))
+ goto expire;
+
++check_queue:
++ /*
++ * This loop is rarely executed more than once. Even when it
++ * happens, it is much more convenient to re-execute this loop
++ * than to return NULL and trigger a new dispatch to get a
++ * request served.
++ */
+ next_rq = bfqq->next_rq;
+ /*
+ * If bfqq has requests queued and it has enough budget left to
+ * serve them, keep the queue, otherwise expire it.
+ */
+ if (next_rq) {
++ BUG_ON(RB_EMPTY_ROOT(&bfqq->sort_list));
++
+ if (bfq_serv_to_charge(next_rq, bfqq) >
+ bfq_bfqq_budget_left(bfqq)) {
++ /*
++ * Expire the queue for budget exhaustion,
++ * which makes sure that the next budget is
++ * enough to serve the next request, even if
++ * it comes from the fifo expired path.
++ */
+ reason = BFQ_BFQQ_BUDGET_EXHAUSTED;
+ goto expire;
+ } else {
+@@ -3559,9 +3584,16 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd)
+ bfq_bfqq_expire(bfqd, bfqq, false, reason);
+ new_queue:
+ bfqq = bfq_set_in_service_queue(bfqd);
+- bfq_log(bfqd, "select_queue: new queue %d returned",
+- bfqq ? bfqq->pid : 0);
++ if (bfqq) {
++ bfq_log_bfqq(bfqd, bfqq, "select_queue: checking new queue");
++ goto check_queue;
++ }
+ keep_queue:
++ if (bfqq)
++ bfq_log_bfqq(bfqd, bfqq, "select_queue: returned this queue");
++ else
++ bfq_log(bfqd, "select_queue: no queue returned");
++
+ return bfqq;
+ }
+
+@@ -3627,45 +3659,17 @@ static int bfq_dispatch_request(struct bfq_data *bfqd,
+ struct bfq_queue *bfqq)
+ {
+ int dispatched = 0;
+- struct request *rq;
++ struct request *rq = bfqq->next_rq;
+ unsigned long service_to_charge;
+
+ BUG_ON(RB_EMPTY_ROOT(&bfqq->sort_list));
+-
+- /* Follow expired path, else get first next available. */
+- rq = bfq_check_fifo(bfqq);
+- if (!rq)
+- rq = bfqq->next_rq;
++ BUG_ON(!rq);
+ service_to_charge = bfq_serv_to_charge(rq, bfqq);
+
+- if (service_to_charge > bfq_bfqq_budget_left(bfqq)) {
+- /*
+- * This may happen if the next rq is chosen in fifo order
+- * instead of sector order. The budget is properly
+- * dimensioned to be always sufficient to serve the next
+- * request only if it is chosen in sector order. The reason
+- * is that it would be quite inefficient and little useful
+- * to always make sure that the budget is large enough to
+- * serve even the possible next rq in fifo order.
+- * In fact, requests are seldom served in fifo order.
+- *
+- * Expire the queue for budget exhaustion, and make sure
+- * that the next act_budget is enough to serve the next
+- * request, even if it comes from the fifo expired path.
+- */
+- bfqq->next_rq = rq;
+- /*
+- * Since this dispatch is failed, make sure that
+- * a new one will be performed
+- */
+- if (!bfqd->rq_in_driver)
+- bfq_schedule_dispatch(bfqd);
+- BUG_ON(bfqq->entity.budget < bfqq->entity.service);
+- goto expire;
+- }
++ BUG_ON(service_to_charge > bfq_bfqq_budget_left(bfqq));
+
+ BUG_ON(bfqq->entity.budget < bfqq->entity.service);
+- /* Finally, insert request into driver dispatch list. */
++
+ bfq_bfqq_served(bfqq, service_to_charge);
+
+ BUG_ON(bfqq->entity.budget < bfqq->entity.service);
+
+From 99a658b6797c828d52466c5ceef93cf9b3bd1268 Mon Sep 17 00:00:00 2001
+From: Paolo Valente <paolo.valente@linaro.org>
+Date: Sun, 5 Feb 2017 22:56:25 +0100
+Subject: [PATCH 08/10] BFQ-v8r8-rc2
+
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+---
+ block/bfq-iosched.c | 4 ++--
+ block/bfq.h | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+index 2796927..5bfeb16 100644
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -9,7 +9,7 @@
+ *
+ * Copyright (C) 2015 Paolo Valente <paolo.valente@unimore.it>
+ *
+- * Copyright (C) 2016 Paolo Valente <paolo.valente@linaro.org>
++ * Copyright (C) 2017 Paolo Valente <paolo.valente@linaro.org>
+ *
+ * Licensed under the GPL-2 as detailed in the accompanying COPYING.BFQ
+ * file.
+@@ -5238,7 +5238,7 @@ static struct blkcg_policy blkcg_policy_bfq = {
+ static int __init bfq_init(void)
+ {
+ int ret;
+- char msg[60] = "BFQ I/O-scheduler: v8r8-rc1";
++ char msg[60] = "BFQ I/O-scheduler: v8r8-rc2";
+
+ #ifdef CONFIG_BFQ_GROUP_IOSCHED
+ ret = blkcg_policy_register(&blkcg_policy_bfq);
+diff --git a/block/bfq.h b/block/bfq.h
+index 7b12f3c..a08e8a6 100644
+--- a/block/bfq.h
++++ b/block/bfq.h
+@@ -1,5 +1,5 @@
+ /*
+- * BFQ v8r8-rc1 for 4.10.0: data structures and common functions prototypes.
++ * BFQ v8r8-rc2 for 4.10.0: data structures and common functions prototypes.
+ *
+ * Based on ideas and code from CFQ:
+ * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
+@@ -9,7 +9,7 @@
+ *
+ * Copyright (C) 2015 Paolo Valente <paolo.valente@unimore.it>
+ *
+- * Copyright (C) 2016 Paolo Valente <paolo.valente@linaro.org>
++ * Copyright (C) 2017 Paolo Valente <paolo.valente@linaro.org>
+ */
+
+ #ifndef _BFQ_H
+
+From 0796dc37acb561ef9c544a68045ff9a016b1ccab Mon Sep 17 00:00:00 2001
+From: Oleksandr Natalenko <oleksandr@natalenko.name>
+Date: Mon, 20 Feb 2017 16:02:07 +0100
+Subject: [PATCH 09/10] block/bfq-cgroup: fix bfq_bic_update_cgroup() API
+
+bfq_bic_update_cgroup() should return nothing even if
+CONFIG_BFQ_GROUP_IOSCHED is disabled.
+
+Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
+---
+ block/bfq-cgroup.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
+index a5f8dc1..de045cf 100644
+--- a/block/bfq-cgroup.c
++++ b/block/bfq-cgroup.c
+@@ -1157,13 +1157,7 @@ static void bfq_init_entity(struct bfq_entity *entity,
+ entity->sched_data = &bfqg->sched_data;
+ }
+
+-static struct bfq_group *
+-bfq_bic_update_cgroup(struct bfq_io_cq *bic, struct bio *bio)
+-{
+- struct bfq_data *bfqd = bic_to_bfqd(bic);
+-
+- return bfqd->root_group;
+-}
++static void bfq_bic_update_cgroup(struct bfq_io_cq *bic, struct bio *bio) {}
+
+ static void bfq_end_wr_async(struct bfq_data *bfqd)
+ {
+
+From 99b8292bad900ffa16aea9cc9df7a68954026829 Mon Sep 17 00:00:00 2001
+From: Paolo Valente <paolo.valente@linaro.org>
+Date: Thu, 23 Feb 2017 12:28:00 +0100
+Subject: [PATCH 10/10] BFQ-v8r8
+
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+---
+ block/bfq-iosched.c | 2 +-
+ block/bfq.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+index 5bfeb16..6348d55 100644
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -5238,7 +5238,7 @@ static struct blkcg_policy blkcg_policy_bfq = {
+ static int __init bfq_init(void)
+ {
+ int ret;
+- char msg[60] = "BFQ I/O-scheduler: v8r8-rc2";
++ char msg[60] = "BFQ I/O-scheduler: v8r8";
+
+ #ifdef CONFIG_BFQ_GROUP_IOSCHED
+ ret = blkcg_policy_register(&blkcg_policy_bfq);
+diff --git a/block/bfq.h b/block/bfq.h
+index a08e8a6..2a2bc30 100644
+--- a/block/bfq.h
++++ b/block/bfq.h
+@@ -1,5 +1,5 @@
+ /*
+- * BFQ v8r8-rc2 for 4.10.0: data structures and common functions prototypes.
++ * BFQ v8r8 for 4.10.0: data structures and common functions prototypes.
+ *
+ * Based on ideas and code from CFQ:
+ * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
+0
diff --git a/PKGBUILD b/PKGBUILD
index a4e2102530a7..725cd53ed13f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -54,7 +54,7 @@ _srcname=linux-4.9
_pkgver=4.9.11
_rtpatchver=rt9
pkgver=${_pkgver}_${_rtpatchver}
-pkgrel=1
+pkgrel=2
arch=('i686' 'x86_64')
url="http://algo.ing.unimo.it"
license=('GPL2')
@@ -85,9 +85,9 @@ source=("http://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz"
'99-linux.hook'
# standard config files for mkinitcpio ramdisk
'linux.preset'
- '0001-x86-fpu-Fix-invalid-FPU-ptrace-state-after-execve.patch'
+ '0001-dccp-fix-freeing-skb-too-early-for-IPV6_RECVPKTINFO.patch'
# patches from https://github.com/linusw/linux-bfq/commits/bfq-v8
- )
+ '0005-BFQ-update-to-v8r8.patch')
_kernelname=${pkgbase#linux}
@@ -113,14 +113,13 @@ prepare() {
msg "Patching set DEFAULT_CONSOLE_LOGLEVEL to 4"
patch -p1 -i "${srcdir}/change-default-console-loglevel.patch"
- ### Revert a commit that causes memory corruption in i686 chroots on our
- # build server ("valgrind bash" immediately crashes)
- msg "Revert a commit that causes memory corruption in i686 chroots on our build server"
- patch -Rp1 -i "${srcdir}/0001-x86-fpu-Fix-invalid-FPU-ptrace-state-after-execve.patch"
+ ### Fix https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-6074
+ msg "Fix CVE-2017-6074"
+ patch -p1 -i "${srcdir}/0001-dccp-fix-freeing-skb-too-early-for-IPV6_RECVPKTINFO.patch"
### Patch source with BFQ
msg "Patching source with BFQ patches"
- for p in "${srcdir}"/000{1,2,3,4}-*BFQ*.patch; do
+ for p in "${srcdir}"/000{1,2,3,4,5}-*BFQ*.patch; do
msg " $p"
patch -Np1 -i "$p"
done
@@ -479,7 +478,8 @@ sha512sums=('bf67ff812cc3cb7e5059e82cc5db0d9a7c5637f7ed9a42e4730c715bf7047c81ed3
'7a0a6eb4a2f0c4a981104ff4d09ff1a4ad75c9dc47d27276e0971b9fa16aeb208cb2c4158c491e8d067bf5f7f6c33ebd6826e18ad0d6203cac5711be453da93a'
'd6faa67f3ef40052152254ae43fee031365d0b1524aa0718b659eb75afc21a3f79ea8d62d66ea311a800109bed545bc8f79e8752319cd378eef2cbd3a09aba22'
'2dc6b0ba8f7dbf19d2446c5c5f1823587de89f4e28e9595937dd51a87755099656f2acec50e3e2546ea633ad1bfd1c722e0c2b91eef1d609103d8abdc0a7cbaf'
- '002d5e0ccfa5824c1750912a6400ff722672d6587b74ba66b1127cf1228048f604bba107617cf4f4477884039af4d4d196cf1b74cefe43b0bddc82270f11940d')
+ 'cddd1349c0a7f7ffcd7615f31c8107144eb086326c09121cc9071e95d04d2a30ee8d7a3f5d1fe76e6377803dbf2fcb1791e482e0974b8474155419ad94c0fd2b'
+ 'dab3dba300e276dd552cb86c903af5cac9f7c7954b938ac9c300745a175198c553d84cd3a5e58c350d83160f33b07f6dd20a570da4afdce178464c402ac7829b')
validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds