From: Greg Kroah-Hartman Date: Thu, 23 Feb 2017 17:10:27 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v4.4.52~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bce40ab81c059b89f375ee1620954406d858e138;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: blk-mq-really-fix-plug-list-flushing-for-nomerge-queues.patch rtc-interface-ignore-expired-timers-when-enqueuing-new-timers.patch --- diff --git a/queue-4.4/blk-mq-really-fix-plug-list-flushing-for-nomerge-queues.patch b/queue-4.4/blk-mq-really-fix-plug-list-flushing-for-nomerge-queues.patch new file mode 100644 index 00000000000..35cddf74b6d --- /dev/null +++ b/queue-4.4/blk-mq-really-fix-plug-list-flushing-for-nomerge-queues.patch @@ -0,0 +1,61 @@ +From 87c279e613f848c691111b29d49de8df3f4f56da Mon Sep 17 00:00:00 2001 +From: Omar Sandoval +Date: Wed, 1 Jun 2016 22:18:48 -0700 +Subject: blk-mq: really fix plug list flushing for nomerge queues + +From: Omar Sandoval + +commit 87c279e613f848c691111b29d49de8df3f4f56da upstream. + +Commit 0809e3ac6231 ("block: fix plug list flushing for nomerge queues") +updated blk_mq_make_request() to set request_count even when +blk_queue_nomerges() returns true. However, blk_mq_make_request() only +does limited plugging and doesn't use request_count; +blk_sq_make_request() is the one that should have been fixed. Do that +and get rid of the unnecessary work in the mq version. + +Fixes: 0809e3ac6231 ("block: fix plug list flushing for nomerge queues") +Signed-off-by: Omar Sandoval +Reviewed-by: Ming Lei +Reviewed-by: Jeff Moyer +Signed-off-by: Jens Axboe +Cc: Sumit Semwal +Signed-off-by: Greg Kroah-Hartman + +--- + block/blk-mq.c | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +--- a/block/blk-mq.c ++++ b/block/blk-mq.c +@@ -1259,12 +1259,9 @@ static blk_qc_t blk_mq_make_request(stru + + blk_queue_split(q, &bio, q->bio_split); + +- if (!is_flush_fua && !blk_queue_nomerges(q)) { +- if (blk_attempt_plug_merge(q, bio, &request_count, +- &same_queue_rq)) +- return BLK_QC_T_NONE; +- } else +- request_count = blk_plug_queued_count(q); ++ if (!is_flush_fua && !blk_queue_nomerges(q) && ++ blk_attempt_plug_merge(q, bio, &request_count, &same_queue_rq)) ++ return BLK_QC_T_NONE; + + rq = blk_mq_map_request(q, bio, &data); + if (unlikely(!rq)) +@@ -1355,9 +1352,11 @@ static blk_qc_t blk_sq_make_request(stru + + blk_queue_split(q, &bio, q->bio_split); + +- if (!is_flush_fua && !blk_queue_nomerges(q) && +- blk_attempt_plug_merge(q, bio, &request_count, NULL)) +- return BLK_QC_T_NONE; ++ if (!is_flush_fua && !blk_queue_nomerges(q)) { ++ if (blk_attempt_plug_merge(q, bio, &request_count, NULL)) ++ return BLK_QC_T_NONE; ++ } else ++ request_count = blk_plug_queued_count(q); + + rq = blk_mq_map_request(q, bio, &data); + if (unlikely(!rq)) diff --git a/queue-4.4/rtc-interface-ignore-expired-timers-when-enqueuing-new-timers.patch b/queue-4.4/rtc-interface-ignore-expired-timers-when-enqueuing-new-timers.patch new file mode 100644 index 00000000000..c30a77a4fd5 --- /dev/null +++ b/queue-4.4/rtc-interface-ignore-expired-timers-when-enqueuing-new-timers.patch @@ -0,0 +1,65 @@ +From 2b2f5ff00f63847d95adad6289bd8b05f5983dd5 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Mon, 16 May 2016 17:22:54 +0100 +Subject: rtc: interface: ignore expired timers when enqueuing new timers + +From: Colin Ian King + +commit 2b2f5ff00f63847d95adad6289bd8b05f5983dd5 upstream. + +This patch fixes a RTC wakealarm issue, namely, the event fires during +hibernate and is not cleared from the list, causing hwclock to block. + +The current enqueuing does not trigger an alarm if any expired timers +already exist on the timerqueue. This can occur when a RTC wake alarm +is used to wake a machine out of hibernate and the resumed state has +old expired timers that have not been removed from the timer queue. +This fix skips over any expired timers and triggers an alarm if there +are no pending timers on the timerqueue. Note that the skipped expired +timer will get reaped later on, so there is no need to clean it up +immediately. + +The issue can be reproduced by putting a machine into hibernate and +waking it with the RTC wakealarm. Running the example RTC test program +from tools/testing/selftests/timers/rtctest.c after the hibernate will +block indefinitely. With the fix, it no longer blocks after the +hibernate resume. + +BugLink: http://bugs.launchpad.net/bugs/1333569 + +Signed-off-by: Colin Ian King +Signed-off-by: Alexandre Belloni +Cc: Sumit Semwal +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/interface.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +--- a/drivers/rtc/interface.c ++++ b/drivers/rtc/interface.c +@@ -748,9 +748,23 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_freq); + */ + static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) + { ++ struct timerqueue_node *next = timerqueue_getnext(&rtc->timerqueue); ++ struct rtc_time tm; ++ ktime_t now; ++ + timer->enabled = 1; ++ __rtc_read_time(rtc, &tm); ++ now = rtc_tm_to_ktime(tm); ++ ++ /* Skip over expired timers */ ++ while (next) { ++ if (next->expires.tv64 >= now.tv64) ++ break; ++ next = timerqueue_iterate_next(next); ++ } ++ + timerqueue_add(&rtc->timerqueue, &timer->node); +- if (&timer->node == timerqueue_getnext(&rtc->timerqueue)) { ++ if (!next) { + struct rtc_wkalrm alarm; + int err; + alarm.time = rtc_ktime_to_tm(timer->node.expires); diff --git a/queue-4.4/series b/queue-4.4/series index d4729f05fbd..b4150522e51 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -1 +1,3 @@ rtlwifi-rtl_usb-fix-missing-entry-in-usb-driver-s-private-data.patch +rtc-interface-ignore-expired-timers-when-enqueuing-new-timers.patch +blk-mq-really-fix-plug-list-flushing-for-nomerge-queues.patch