]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.8-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 May 2013 21:49:27 +0000 (14:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 May 2013 21:49:27 +0000 (14:49 -0700)
added patches:
asoc-max98088-fix-logging-of-hardware-revision.patch
drivers-rtc-rtc-cmos.c-don-t-disable-hpet-emulation-on-suspend.patch
hrtimer-add-expiry-time-overflow-check-in-hrtimer_interrupt.patch
hrtimer-fix-ktime_add_ns-overflow-on-32bit-architectures.patch
mm-swap-mark-swap-pages-writeback-before-queueing-for-direct-io.patch
swap-redirty-page-if-page-write-fails-on-swap-file.patch

queue-3.8/asoc-max98088-fix-logging-of-hardware-revision.patch [new file with mode: 0644]
queue-3.8/drivers-rtc-rtc-cmos.c-don-t-disable-hpet-emulation-on-suspend.patch [new file with mode: 0644]
queue-3.8/hrtimer-add-expiry-time-overflow-check-in-hrtimer_interrupt.patch [new file with mode: 0644]
queue-3.8/hrtimer-fix-ktime_add_ns-overflow-on-32bit-architectures.patch [new file with mode: 0644]
queue-3.8/mm-swap-mark-swap-pages-writeback-before-queueing-for-direct-io.patch [new file with mode: 0644]
queue-3.8/series
queue-3.8/swap-redirty-page-if-page-write-fails-on-swap-file.patch [new file with mode: 0644]

diff --git a/queue-3.8/asoc-max98088-fix-logging-of-hardware-revision.patch b/queue-3.8/asoc-max98088-fix-logging-of-hardware-revision.patch
new file mode 100644 (file)
index 0000000..c1b927e
--- /dev/null
@@ -0,0 +1,31 @@
+From 98682063549bedd6e2d2b6b7222f150c6fbce68c Mon Sep 17 00:00:00 2001
+From: Dylan Reid <dgreid@chromium.org>
+Date: Tue, 16 Apr 2013 20:02:34 -0700
+Subject: ASoC: max98088: Fix logging of hardware revision.
+
+From: Dylan Reid <dgreid@chromium.org>
+
+commit 98682063549bedd6e2d2b6b7222f150c6fbce68c upstream.
+
+The hardware revision of the codec is based at 0x40.  Subtract that
+before convering to ASCII.  The same as it is done for 98095.
+
+Signed-off-by: Dylan Reid <dgreid@chromium.org>
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/max98088.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/soc/codecs/max98088.c
++++ b/sound/soc/codecs/max98088.c
+@@ -2006,7 +2006,7 @@ static int max98088_probe(struct snd_soc
+                        ret);
+                goto err_access;
+        }
+-       dev_info(codec->dev, "revision %c\n", ret + 'A');
++       dev_info(codec->dev, "revision %c\n", ret - 0x40 + 'A');
+        snd_soc_write(codec, M98088_REG_51_PWR_SYS, M98088_PWRSV);
diff --git a/queue-3.8/drivers-rtc-rtc-cmos.c-don-t-disable-hpet-emulation-on-suspend.patch b/queue-3.8/drivers-rtc-rtc-cmos.c-don-t-disable-hpet-emulation-on-suspend.patch
new file mode 100644 (file)
index 0000000..3f8d39f
--- /dev/null
@@ -0,0 +1,53 @@
+From e005715efaf674660ae59af83b13822567e3a758 Mon Sep 17 00:00:00 2001
+From: Derek Basehore <dbasehore@chromium.org>
+Date: Mon, 29 Apr 2013 16:20:23 -0700
+Subject: drivers/rtc/rtc-cmos.c: don't disable hpet emulation on suspend
+
+From: Derek Basehore <dbasehore@chromium.org>
+
+commit e005715efaf674660ae59af83b13822567e3a758 upstream.
+
+There's a bug where rtc alarms are ignored after the rtc cmos suspends
+but before the system finishes suspend.  Since hpet emulation is
+disabled and it still handles the interrupts, a wake event is never
+registered which is done from the rtc layer.
+
+This patch reverts commit d1b2efa83fbf ("rtc: disable hpet emulation on
+suspend") which disabled hpet emulation.  To fix the problem mentioned
+in that commit, hpet_rtc_timer_init() is called directly on resume.
+
+Signed-off-by: Derek Basehore <dbasehore@chromium.org>
+Cc: Maxim Levitsky <maximlevitsky@gmail.com>
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Ingo Molnar <mingo@elte.hu>
+Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/rtc/rtc-cmos.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/rtc/rtc-cmos.c
++++ b/drivers/rtc/rtc-cmos.c
+@@ -805,9 +805,8 @@ static int cmos_suspend(struct device *d
+                       mask = RTC_IRQMASK;
+               tmp &= ~mask;
+               CMOS_WRITE(tmp, RTC_CONTROL);
++              hpet_mask_rtc_irq_bit(mask);
+-              /* shut down hpet emulation - we don't need it for alarm */
+-              hpet_mask_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE);
+               cmos_checkintr(cmos, tmp);
+       }
+       spin_unlock_irq(&rtc_lock);
+@@ -872,6 +871,7 @@ static int cmos_resume(struct device *de
+                       rtc_update_irq(cmos->rtc, 1, mask);
+                       tmp &= ~RTC_AIE;
+                       hpet_mask_rtc_irq_bit(RTC_AIE);
++                      hpet_rtc_timer_init();
+               } while (mask & RTC_AIE);
+               spin_unlock_irq(&rtc_lock);
+       }
diff --git a/queue-3.8/hrtimer-add-expiry-time-overflow-check-in-hrtimer_interrupt.patch b/queue-3.8/hrtimer-add-expiry-time-overflow-check-in-hrtimer_interrupt.patch
new file mode 100644 (file)
index 0000000..998821f
--- /dev/null
@@ -0,0 +1,82 @@
+From 8f294b5a139ee4b75e890ad5b443c93d1e558a8b Mon Sep 17 00:00:00 2001
+From: Prarit Bhargava <prarit@redhat.com>
+Date: Mon, 8 Apr 2013 08:47:15 -0400
+Subject: hrtimer: Add expiry time overflow check in hrtimer_interrupt
+
+From: Prarit Bhargava <prarit@redhat.com>
+
+commit 8f294b5a139ee4b75e890ad5b443c93d1e558a8b upstream.
+
+The settimeofday01 test in the LTP testsuite effectively does
+
+        gettimeofday(current time);
+        settimeofday(Jan 1, 1970 + 100 seconds);
+        settimeofday(current time);
+
+This test causes a stack trace to be displayed on the console during the
+setting of timeofday to Jan 1, 1970 + 100 seconds:
+
+[  131.066751] ------------[ cut here ]------------
+[  131.096448] WARNING: at kernel/time/clockevents.c:209 clockevents_program_event+0x135/0x140()
+[  131.104935] Hardware name: Dinar
+[  131.108150] Modules linked in: sg nfsv3 nfs_acl nfsv4 auth_rpcgss nfs dns_resolver fscache lockd sunrpc nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6table_mangle ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 iptable_nat nf_nat_ipv4 nf_nat iptable_mangle ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables kvm_amd kvm sp5100_tco bnx2 i2c_piix4 crc32c_intel k10temp fam15h_power ghash_clmulni_intel amd64_edac_mod pcspkr serio_raw edac_mce_amd edac_core microcode xfs libcrc32c sr_mod sd_mod cdrom ata_generic crc_t10dif pata_acpi radeon i2c_algo_bit drm_kms_helper ttm drm ahci pata_atiixp libahci libata usb_storage i2c_core dm_mirror dm_region_hash dm_log dm_mod
+[  131.176784] Pid: 0, comm: swapper/28 Not tainted 3.8.0+ #6
+[  131.182248] Call Trace:
+[  131.184684]  <IRQ>  [<ffffffff810612af>] warn_slowpath_common+0x7f/0xc0
+[  131.191312]  [<ffffffff8106130a>] warn_slowpath_null+0x1a/0x20
+[  131.197131]  [<ffffffff810b9fd5>] clockevents_program_event+0x135/0x140
+[  131.203721]  [<ffffffff810bb584>] tick_program_event+0x24/0x30
+[  131.209534]  [<ffffffff81089ab1>] hrtimer_interrupt+0x131/0x230
+[  131.215437]  [<ffffffff814b9600>] ? cpufreq_p4_target+0x130/0x130
+[  131.221509]  [<ffffffff81619119>] smp_apic_timer_interrupt+0x69/0x99
+[  131.227839]  [<ffffffff8161805d>] apic_timer_interrupt+0x6d/0x80
+[  131.233816]  <EOI>  [<ffffffff81099745>] ? sched_clock_cpu+0xc5/0x120
+[  131.240267]  [<ffffffff814b9ff0>] ? cpuidle_wrap_enter+0x50/0xa0
+[  131.246252]  [<ffffffff814b9fe9>] ? cpuidle_wrap_enter+0x49/0xa0
+[  131.252238]  [<ffffffff814ba050>] cpuidle_enter_tk+0x10/0x20
+[  131.257877]  [<ffffffff814b9c89>] cpuidle_idle_call+0xa9/0x260
+[  131.263692]  [<ffffffff8101c42f>] cpu_idle+0xaf/0x120
+[  131.268727]  [<ffffffff815f8971>] start_secondary+0x255/0x257
+[  131.274449] ---[ end trace 1151a50552231615 ]---
+
+When we change the system time to a low value like this, the value of
+timekeeper->offs_real will be a negative value.
+
+It seems that the WARN occurs because an hrtimer has been started in the time
+between the releasing of the timekeeper lock and the IPI call (via a call to
+on_each_cpu) in clock_was_set() in the do_settimeofday() code.  The end result
+is that a REALTIME_CLOCK timer has been added with softexpires = expires =
+KTIME_MAX.  The hrtimer_interrupt() fires/is called and the loop at
+kernel/hrtimer.c:1289 is executed.  In this loop the code subtracts the
+clock base's offset (which was set to timekeeper->offs_real in
+do_settimeofday()) from the current hrtimer_cpu_base->expiry value (which
+was KTIME_MAX):
+
+       KTIME_MAX - (a negative value) = overflow
+
+A simple check for an overflow can resolve this problem.  Using KTIME_MAX
+instead of the overflow value will result in the hrtimer function being run,
+and the reprogramming of the timer after that.
+
+Reviewed-by: Rik van Riel <riel@redhat.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Prarit Bhargava <prarit@redhat.com>
+[jstultz: Tweaked commit subject]
+Signed-off-by: John Stultz <john.stultz@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/hrtimer.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/kernel/hrtimer.c
++++ b/kernel/hrtimer.c
+@@ -1312,6 +1312,8 @@ retry:
+                               expires = ktime_sub(hrtimer_get_expires(timer),
+                                                   base->offset);
++                              if (expires.tv64 < 0)
++                                      expires.tv64 = KTIME_MAX;
+                               if (expires.tv64 < expires_next.tv64)
+                                       expires_next = expires;
+                               break;
diff --git a/queue-3.8/hrtimer-fix-ktime_add_ns-overflow-on-32bit-architectures.patch b/queue-3.8/hrtimer-fix-ktime_add_ns-overflow-on-32bit-architectures.patch
new file mode 100644 (file)
index 0000000..4145b69
--- /dev/null
@@ -0,0 +1,54 @@
+From 51fd36f3fad8447c487137ae26b9d0b3ce77bb25 Mon Sep 17 00:00:00 2001
+From: David Engraf <david.engraf@sysgo.com>
+Date: Tue, 19 Mar 2013 13:29:55 +0100
+Subject: hrtimer: Fix ktime_add_ns() overflow on 32bit architectures
+
+From: David Engraf <david.engraf@sysgo.com>
+
+commit 51fd36f3fad8447c487137ae26b9d0b3ce77bb25 upstream.
+
+One can trigger an overflow when using ktime_add_ns() on a 32bit
+architecture not supporting CONFIG_KTIME_SCALAR.
+
+When passing a very high value for u64 nsec, e.g. 7881299347898368000
+the do_div() function converts this value to seconds (7881299347) which
+is still to high to pass to the ktime_set() function as long. The result
+in is a negative value.
+
+The problem on my system occurs in the tick-sched.c,
+tick_nohz_stop_sched_tick() when time_delta is set to
+timekeeping_max_deferment(). The check for time_delta < KTIME_MAX is
+valid, thus ktime_add_ns() is called with a too large value resulting in
+a negative expire value. This leads to an endless loop in the ticker code:
+
+time_delta: 7881299347898368000
+expires = ktime_add_ns(last_update, time_delta)
+expires: negative value
+
+This fix caps the value to KTIME_MAX.
+
+This error doesn't occurs on 64bit or architectures supporting
+CONFIG_KTIME_SCALAR (e.g. ARM, x86-32).
+
+Signed-off-by: David Engraf <david.engraf@sysgo.com>
+[jstultz: Minor tweaks to commit message & header]
+Signed-off-by: John Stultz <john.stultz@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/hrtimer.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/kernel/hrtimer.c
++++ b/kernel/hrtimer.c
+@@ -298,6 +298,10 @@ ktime_t ktime_sub_ns(const ktime_t kt, u
+       } else {
+               unsigned long rem = do_div(nsec, NSEC_PER_SEC);
++              /* Make sure nsec fits into long */
++              if (unlikely(nsec > KTIME_SEC_MAX))
++                      return (ktime_t){ .tv64 = KTIME_MAX };
++
+               tmp = ktime_set((long)nsec, rem);
+       }
diff --git a/queue-3.8/mm-swap-mark-swap-pages-writeback-before-queueing-for-direct-io.patch b/queue-3.8/mm-swap-mark-swap-pages-writeback-before-queueing-for-direct-io.patch
new file mode 100644 (file)
index 0000000..2b0b023
--- /dev/null
@@ -0,0 +1,93 @@
+From 0cdc444a67ccdbd58bfbcba865cb17a9f17a7691 Mon Sep 17 00:00:00 2001
+From: Mel Gorman <mgorman@suse.de>
+Date: Mon, 29 Apr 2013 15:08:48 -0700
+Subject: mm: swap: mark swap pages writeback before queueing for direct IO
+
+From: Mel Gorman <mgorman@suse.de>
+
+commit 0cdc444a67ccdbd58bfbcba865cb17a9f17a7691 upstream.
+
+As pointed out by Andrew Morton, the swap-over-NFS writeback is not
+setting PageWriteback before it is queued for direct IO.  While swap
+pages do not participate in BDI or process dirty accounting and the IO
+is synchronous, the writeback bit is still required and not setting it
+in this case was an oversight.  swapoff depends on the page writeback to
+synchronoise all pending writes on a swap page before it is reused.
+Swapcache freeing and reuse depend on checking the PageWriteback under
+lock to ensure the page is safe to reuse.
+
+Direct IO handlers and the direct IO handler for NFS do not deal with
+PageWriteback as they are synchronous writes.  In the case of NFS, it
+schedules pages (or a page in the case of swap) for IO and then waits
+synchronously for IO to complete in nfs_direct_write().  It is
+recognised that this is a slowdown from normal swap handling which is
+asynchronous and uses a completion handler.  Shoving PageWriteback
+handling down into direct IO handlers looks like a bad fit to handle the
+swap case although it may have to be dealt with some day if swap is
+converted to use direct IO in general and bmap is finally done away
+with.  At that point it will be necessary to refit asynchronous direct
+IO with completion handlers onto the swap subsystem.
+
+As swapcache currently depends on PageWriteback to protect against
+races, this patch sets PageWriteback under the page lock before queueing
+it for direct IO.  It is cleared when the direct IO handler returns.  IO
+errors are treated similarly to the direct-to-bio case except PageError
+is not set as in the case of swap-over-NFS, it is likely to be a
+transient error.
+
+It was asked what prevents such a page being reclaimed in parallel.
+With this patch applied, such a page will now be skipped (most of the
+time) or blocked until the writeback completes.  Reclaim checks
+PageWriteback under the page lock before calling try_to_free_swap and
+the page lock should prevent the page being requeued for IO before it is
+freed.
+
+This and Jerome's related patch should considered for -stable as far
+back as 3.6 when swap-over-NFS was introduced.
+
+[akpm@linux-foundation.org: use pr_err_ratelimited()]
+[akpm@linux-foundation.org: remove hopefully-unneeded cast in printk]
+Signed-off-by: Mel Gorman <mgorman@suse.de>
+Cc: Jerome Marchand <jmarchan@redhat.com>
+Cc: Hugh Dickins <hughd@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/page_io.c |   15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+--- a/mm/page_io.c
++++ b/mm/page_io.c
+@@ -214,6 +214,7 @@ int swap_writepage(struct page *page, st
+               kiocb.ki_left = PAGE_SIZE;
+               kiocb.ki_nbytes = PAGE_SIZE;
++              set_page_writeback(page);
+               unlock_page(page);
+               ret = mapping->a_ops->direct_IO(KERNEL_WRITE,
+                                               &kiocb, &iov,
+@@ -223,8 +224,22 @@ int swap_writepage(struct page *page, st
+                       count_vm_event(PSWPOUT);
+                       ret = 0;
+               } else {
++                      /*
++                       * In the case of swap-over-nfs, this can be a
++                       * temporary failure if the system has limited
++                       * memory for allocating transmit buffers.
++                       * Mark the page dirty and avoid
++                       * rotate_reclaimable_page but rate-limit the
++                       * messages but do not flag PageError like
++                       * the normal direct-to-bio case as it could
++                       * be temporary.
++                       */
+                       set_page_dirty(page);
++                      ClearPageReclaim(page);
++                      pr_err_ratelimited("Write error on dio swapfile (%Lu)\n",
++                              page_file_offset(page));
+               }
++              end_page_writeback(page);
+               return ret;
+       }
index afbb23ea3e03e743f244d78399d4b09ca66a4571..b3667671c6756c7356a598cf51a767a0e17f6843 100644 (file)
@@ -61,3 +61,9 @@ alsa-usb-audio-fix-autopm-error-during-probing.patch
 alsa-usb-adjust-for-changed-3.8-usb-api.patch
 alsa-hda-add-the-support-for-alc286-codec.patch
 arm-7702-1-set-the-page-table-freeing-ceiling-to-task_size.patch
+asoc-max98088-fix-logging-of-hardware-revision.patch
+hrtimer-fix-ktime_add_ns-overflow-on-32bit-architectures.patch
+hrtimer-add-expiry-time-overflow-check-in-hrtimer_interrupt.patch
+swap-redirty-page-if-page-write-fails-on-swap-file.patch
+mm-swap-mark-swap-pages-writeback-before-queueing-for-direct-io.patch
+drivers-rtc-rtc-cmos.c-don-t-disable-hpet-emulation-on-suspend.patch
diff --git a/queue-3.8/swap-redirty-page-if-page-write-fails-on-swap-file.patch b/queue-3.8/swap-redirty-page-if-page-write-fails-on-swap-file.patch
new file mode 100644 (file)
index 0000000..83c3c4b
--- /dev/null
@@ -0,0 +1,42 @@
+From 2d30d31ea3c5be426ce25607b9bd1835acb85e0a Mon Sep 17 00:00:00 2001
+From: Jerome Marchand <jmarchan@redhat.com>
+Date: Mon, 29 Apr 2013 15:08:47 -0700
+Subject: swap: redirty page if page write fails on swap file
+
+From: Jerome Marchand <jmarchan@redhat.com>
+
+commit 2d30d31ea3c5be426ce25607b9bd1835acb85e0a upstream.
+
+Since commit 62c230bc1790 ("mm: add support for a filesystem to activate
+swap files and use direct_IO for writing swap pages"), swap_writepage()
+calls direct_IO on swap files.  However, in that case the page isn't
+redirtied if I/O fails, and is therefore handled afterwards as if it has
+been successfully written to the swap file, leading to memory corruption
+when the page is eventually swapped back in.
+
+This patch sets the page dirty when direct_IO() fails.  It fixes a
+memory corruption that happened while using swap-over-NFS.
+
+Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
+Acked-by: Johannes Weiner <hannes@cmpxchg.org>
+Acked-by: Mel Gorman <mgorman@suse.de>
+Cc: Hugh Dickins <hughd@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/page_io.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/mm/page_io.c
++++ b/mm/page_io.c
+@@ -222,6 +222,8 @@ int swap_writepage(struct page *page, st
+               if (ret == PAGE_SIZE) {
+                       count_vm_event(PSWPOUT);
+                       ret = 0;
++              } else {
++                      set_page_dirty(page);
+               }
+               return ret;
+       }