]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.7-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jan 2013 18:56:20 +0000 (10:56 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jan 2013 18:56:20 +0000 (10:56 -0800)
added patches:
can-do-not-call-dev_put-if-restart-timer-is-running-upon-close.patch
cris-fix-i-o-macros.patch
drivers-rtc-rtc-vt8500.c-correct-handling-of-cr_24h-bitfield.patch
drivers-rtc-rtc-vt8500.c-fix-handling-of-data-passed-in-struct-rtc_time.patch
hid-add-apple-wireless-keyboard-2011-ansi-to-special-driver-list.patch
lib-atomic64-initialize-locks-statically-to-fix-early-users.patch
linux-kernel.h-fix-div_round_closest-with-unsigned-divisors.patch
mm-limit-mmu_gather-batching-to-fix-soft-lockups-on-config_preempt.patch
proc-pid-status-show-all-supplementary-groups.patch
revert-rtc-recycle-id-when-unloading-a-rtc-driver.patch

queue-3.7/can-do-not-call-dev_put-if-restart-timer-is-running-upon-close.patch [new file with mode: 0644]
queue-3.7/cris-fix-i-o-macros.patch [new file with mode: 0644]
queue-3.7/drivers-rtc-rtc-vt8500.c-correct-handling-of-cr_24h-bitfield.patch [new file with mode: 0644]
queue-3.7/drivers-rtc-rtc-vt8500.c-fix-handling-of-data-passed-in-struct-rtc_time.patch [new file with mode: 0644]
queue-3.7/hid-add-apple-wireless-keyboard-2011-ansi-to-special-driver-list.patch [new file with mode: 0644]
queue-3.7/lib-atomic64-initialize-locks-statically-to-fix-early-users.patch [new file with mode: 0644]
queue-3.7/linux-kernel.h-fix-div_round_closest-with-unsigned-divisors.patch [new file with mode: 0644]
queue-3.7/mm-limit-mmu_gather-batching-to-fix-soft-lockups-on-config_preempt.patch [new file with mode: 0644]
queue-3.7/proc-pid-status-show-all-supplementary-groups.patch [new file with mode: 0644]
queue-3.7/revert-rtc-recycle-id-when-unloading-a-rtc-driver.patch [new file with mode: 0644]
queue-3.7/series

diff --git a/queue-3.7/can-do-not-call-dev_put-if-restart-timer-is-running-upon-close.patch b/queue-3.7/can-do-not-call-dev_put-if-restart-timer-is-running-upon-close.patch
new file mode 100644 (file)
index 0000000..5756861
--- /dev/null
@@ -0,0 +1,38 @@
+From ab48b03ec9ae1840a1e427e2375bd0d9d554b4ed Mon Sep 17 00:00:00 2001
+From: Alexander Stein <alexander.stein@systec-electronic.com>
+Date: Tue, 27 Nov 2012 08:52:34 +0100
+Subject: can: Do not call dev_put if restart timer is running upon close
+
+From: Alexander Stein <alexander.stein@systec-electronic.com>
+
+commit ab48b03ec9ae1840a1e427e2375bd0d9d554b4ed upstream.
+
+If the restart timer is running due to BUS-OFF and the device is
+disconnected an dev_put will decrease the usage counter to -1 thus
+blocking the interface removal, resulting in the following dmesg
+lines repeating every 10s:
+can: notifier: receive list not found for dev can0
+can: notifier: receive list not found for dev can0
+can: notifier: receive list not found for dev can0
+unregister_netdevice: waiting for can0 to become free. Usage count = -1
+
+Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/can/dev.c |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/net/can/dev.c
++++ b/drivers/net/can/dev.c
+@@ -609,8 +609,7 @@ void close_candev(struct net_device *dev
+ {
+       struct can_priv *priv = netdev_priv(dev);
+-      if (del_timer_sync(&priv->restart_timer))
+-              dev_put(dev);
++      del_timer_sync(&priv->restart_timer);
+       can_flush_echo_skb(dev);
+ }
+ EXPORT_SYMBOL_GPL(close_candev);
diff --git a/queue-3.7/cris-fix-i-o-macros.patch b/queue-3.7/cris-fix-i-o-macros.patch
new file mode 100644 (file)
index 0000000..534d9b0
--- /dev/null
@@ -0,0 +1,79 @@
+From c24bf9b4cc6a0f330ea355d73bfdf1dae7e63a05 Mon Sep 17 00:00:00 2001
+From: Corey Minyard <cminyard@mvista.com>
+Date: Tue, 18 Dec 2012 14:21:19 -0800
+Subject: CRIS: fix I/O macros
+
+From: Corey Minyard <cminyard@mvista.com>
+
+commit c24bf9b4cc6a0f330ea355d73bfdf1dae7e63a05 upstream.
+
+The inb/outb macros for CRIS are broken from a number of points of view,
+missing () around parameters and they have an unprotected if statement
+in them.  This was breaking the compile of IPMI on CRIS and thus I was
+being annoyed by build regressions, so I fixed them.
+
+Plus I don't think they would have worked at all, since the data values
+were missing "&" and the outsl had a "3" instead of a "4" for the size.
+From what I can tell, this stuff is not used at all, so this can't be
+any more broken than it was before, anyway.
+
+Signed-off-by: Corey Minyard <cminyard@mvista.com>
+Cc: Jesper Nilsson <jesper.nilsson@axis.com>
+Cc: Mikael Starvik <starvik@axis.com>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+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>
+
+---
+ arch/cris/include/asm/io.h |   39 +++++++++++++++++++++++++++++++++------
+ 1 file changed, 33 insertions(+), 6 deletions(-)
+
+--- a/arch/cris/include/asm/io.h
++++ b/arch/cris/include/asm/io.h
+@@ -133,12 +133,39 @@ static inline void writel(unsigned int b
+ #define insb(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,1,count) : 0)
+ #define insw(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,2,count) : 0)
+ #define insl(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,4,count) : 0)
+-#define outb(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,1,1)
+-#define outw(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,2,1)
+-#define outl(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,4,1)
+-#define outsb(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,1,count)
+-#define outsw(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,2,count)
+-#define outsl(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,3,count)
++static inline void outb(unsigned char data, unsigned int port)
++{
++      if (cris_iops)
++              cris_iops->write_io(port, (void *) &data, 1, 1);
++}
++static inline void outw(unsigned short data, unsigned int port)
++{
++      if (cris_iops)
++              cris_iops->write_io(port, (void *) &data, 2, 1);
++}
++static inline void outl(unsigned int data, unsigned int port)
++{
++      if (cris_iops)
++              cris_iops->write_io(port, (void *) &data, 4, 1);
++}
++static inline void outsb(unsigned int port, const void *addr,
++                       unsigned long count)
++{
++      if (cris_iops)
++              cris_iops->write_io(port, (void *)addr, 1, count);
++}
++static inline void outsw(unsigned int port, const void *addr,
++                       unsigned long count)
++{
++      if (cris_iops)
++              cris_iops->write_io(port, (void *)addr, 2, count);
++}
++static inline void outsl(unsigned int port, const void *addr,
++                       unsigned long count)
++{
++      if (cris_iops)
++              cris_iops->write_io(port, (void *)addr, 4, count);
++}
+ /*
+  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
diff --git a/queue-3.7/drivers-rtc-rtc-vt8500.c-correct-handling-of-cr_24h-bitfield.patch b/queue-3.7/drivers-rtc-rtc-vt8500.c-correct-handling-of-cr_24h-bitfield.patch
new file mode 100644 (file)
index 0000000..82b06a8
--- /dev/null
@@ -0,0 +1,43 @@
+From 532db570e5181abc8f4f7bfa6c77c69ec2240198 Mon Sep 17 00:00:00 2001
+From: Tony Prisk <linux@prisktech.co.nz>
+Date: Fri, 4 Jan 2013 15:35:47 -0800
+Subject: drivers/rtc/rtc-vt8500.c: correct handling of CR_24H bitfield
+
+From: Tony Prisk <linux@prisktech.co.nz>
+
+commit 532db570e5181abc8f4f7bfa6c77c69ec2240198 upstream.
+
+Control register bitfield for 12H/24H mode is handled incorrectly.
+Setting CR_24H actually enables 12H mode.  This patch renames the define
+and changes the initialization code to correctly set 24H mode.
+
+Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
+Cc: Edgar Toernig <froese@gmx.de>
+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-vt8500.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/rtc/rtc-vt8500.c
++++ b/drivers/rtc/rtc-vt8500.c
+@@ -70,7 +70,7 @@
+                               | ALARM_SEC_BIT)
+ #define VT8500_RTC_CR_ENABLE  (1 << 0)        /* Enable RTC */
+-#define VT8500_RTC_CR_24H     (1 << 1)        /* 24h time format */
++#define VT8500_RTC_CR_12H     (1 << 1)        /* 12h time format */
+ #define VT8500_RTC_CR_SM_ENABLE       (1 << 2)        /* Enable periodic irqs */
+ #define VT8500_RTC_CR_SM_SEC  (1 << 3)        /* 0: 1Hz/60, 1: 1Hz */
+ #define VT8500_RTC_CR_CALIB   (1 << 4)        /* Enable calibration */
+@@ -249,7 +249,7 @@ static int __devinit vt8500_rtc_probe(st
+       }
+       /* Enable RTC and set it to 24-hour mode */
+-      writel(VT8500_RTC_CR_ENABLE | VT8500_RTC_CR_24H,
++      writel(VT8500_RTC_CR_ENABLE,
+              vt8500_rtc->regbase + VT8500_RTC_CR);
+       vt8500_rtc->rtc = rtc_device_register("vt8500-rtc", &pdev->dev,
diff --git a/queue-3.7/drivers-rtc-rtc-vt8500.c-fix-handling-of-data-passed-in-struct-rtc_time.patch b/queue-3.7/drivers-rtc-rtc-vt8500.c-fix-handling-of-data-passed-in-struct-rtc_time.patch
new file mode 100644 (file)
index 0000000..9a765f1
--- /dev/null
@@ -0,0 +1,50 @@
+From 2f90b68309683f2c5765a1b04ca23d71e51f1494 Mon Sep 17 00:00:00 2001
+From: Tony Prisk <linux@prisktech.co.nz>
+Date: Fri, 4 Jan 2013 15:35:48 -0800
+Subject: drivers/rtc/rtc-vt8500.c: fix handling of data passed in struct rtc_time
+
+From: Tony Prisk <linux@prisktech.co.nz>
+
+commit 2f90b68309683f2c5765a1b04ca23d71e51f1494 upstream.
+
+tm_mon is 0..11, whereas vt8500 expects 1..12 for the month field,
+causing invalid date errors for January, and causing the day field to
+roll over incorrectly.
+
+The century flag is only handled in vt8500_rtc_read_time, but not set in
+vt8500_rtc_set_time.  This patch corrects the behaviour of the century
+flag.
+
+Signed-off-by: Edgar Toernig <froese@gmx.de>
+Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
+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-vt8500.c |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/rtc/rtc-vt8500.c
++++ b/drivers/rtc/rtc-vt8500.c
+@@ -119,7 +119,7 @@ static int vt8500_rtc_read_time(struct d
+       tm->tm_min = bcd2bin((time & TIME_MIN_MASK) >> TIME_MIN_S);
+       tm->tm_hour = bcd2bin((time & TIME_HOUR_MASK) >> TIME_HOUR_S);
+       tm->tm_mday = bcd2bin(date & DATE_DAY_MASK);
+-      tm->tm_mon = bcd2bin((date & DATE_MONTH_MASK) >> DATE_MONTH_S);
++      tm->tm_mon = bcd2bin((date & DATE_MONTH_MASK) >> DATE_MONTH_S) - 1;
+       tm->tm_year = bcd2bin((date & DATE_YEAR_MASK) >> DATE_YEAR_S)
+                       + ((date >> DATE_CENTURY_S) & 1 ? 200 : 100);
+       tm->tm_wday = (time & TIME_DOW_MASK) >> TIME_DOW_S;
+@@ -138,8 +138,9 @@ static int vt8500_rtc_set_time(struct de
+       }
+       writel((bin2bcd(tm->tm_year - 100) << DATE_YEAR_S)
+-              | (bin2bcd(tm->tm_mon) << DATE_MONTH_S)
+-              | (bin2bcd(tm->tm_mday)),
++              | (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S)
++              | (bin2bcd(tm->tm_mday))
++              | ((tm->tm_year >= 200) << DATE_CENTURY_S),
+               vt8500_rtc->regbase + VT8500_RTC_DS);
+       writel((bin2bcd(tm->tm_wday) << TIME_DOW_S)
+               | (bin2bcd(tm->tm_hour) << TIME_HOUR_S)
diff --git a/queue-3.7/hid-add-apple-wireless-keyboard-2011-ansi-to-special-driver-list.patch b/queue-3.7/hid-add-apple-wireless-keyboard-2011-ansi-to-special-driver-list.patch
new file mode 100644 (file)
index 0000000..2c88709
--- /dev/null
@@ -0,0 +1,33 @@
+From f9af7b9edccb87d4d80b58687ab63e58f3b64c4c Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Sun, 2 Dec 2012 14:38:23 +0000
+Subject: HID: Add Apple wireless keyboard 2011 ANSI to special driver list
+
+From: Ben Hutchings <ben@decadent.org.uk>
+
+commit f9af7b9edccb87d4d80b58687ab63e58f3b64c4c upstream.
+
+Commit 0a97e1e9f9a6 ('HID: apple: Add Apple wireless keyboard 2011 ANSI PID')
+did not update the special driver list in hid-core.c, so hid-generic may
+still bind to this device.
+
+Reported-by: Ari Pollak <ari@scvngr.com>
+References: http://bugs.debian.org/694546
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/hid-core.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/hid/hid-core.c
++++ b/drivers/hid/hid-core.c
+@@ -1538,6 +1538,7 @@ static const struct hid_device_id hid_ha
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
++      { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
diff --git a/queue-3.7/lib-atomic64-initialize-locks-statically-to-fix-early-users.patch b/queue-3.7/lib-atomic64-initialize-locks-statically-to-fix-early-users.patch
new file mode 100644 (file)
index 0000000..f45fc5a
--- /dev/null
@@ -0,0 +1,79 @@
+From fcc16882ac4532aaa644bff444f0c5d6228ba71e Mon Sep 17 00:00:00 2001
+From: Stephen Boyd <sboyd@codeaurora.org>
+Date: Wed, 19 Dec 2012 23:39:48 -0800
+Subject: lib: atomic64: Initialize locks statically to fix early users
+
+From: Stephen Boyd <sboyd@codeaurora.org>
+
+commit fcc16882ac4532aaa644bff444f0c5d6228ba71e upstream.
+
+The atomic64 library uses a handful of static spin locks to implement
+atomic 64-bit operations on architectures without support for atomic
+64-bit instructions.
+
+Unfortunately, the spinlocks are initialized in a pure initcall and that
+is too late for the vfs namespace code which wants to use atomic64
+operations before the initcall is run.
+
+This became a problem as of commit 8823c079ba71: "vfs: Add setns support
+for the mount namespace".
+
+This leads to BUG messages such as:
+
+  BUG: spinlock bad magic on CPU#0, swapper/0/0
+   lock: atomic64_lock+0x240/0x400, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
+    do_raw_spin_lock+0x158/0x198
+    _raw_spin_lock_irqsave+0x4c/0x58
+    atomic64_add_return+0x30/0x5c
+    alloc_mnt_ns.clone.14+0x44/0xac
+    create_mnt_ns+0xc/0x54
+    mnt_init+0x120/0x1d4
+    vfs_caches_init+0xe0/0x10c
+    start_kernel+0x29c/0x300
+
+coming out early on during boot when spinlock debugging is enabled.
+
+Fix this by initializing the spinlocks statically at compile time.
+
+Reported-and-tested-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
+Tested-by: Tony Lindgren <tony@atomide.com>
+Cc: Eric W. Biederman <ebiederm@xmission.com>
+Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ lib/atomic64.c |   17 +++++------------
+ 1 file changed, 5 insertions(+), 12 deletions(-)
+
+--- a/lib/atomic64.c
++++ b/lib/atomic64.c
+@@ -31,7 +31,11 @@
+ static union {
+       raw_spinlock_t lock;
+       char pad[L1_CACHE_BYTES];
+-} atomic64_lock[NR_LOCKS] __cacheline_aligned_in_smp;
++} atomic64_lock[NR_LOCKS] __cacheline_aligned_in_smp = {
++      [0 ... (NR_LOCKS - 1)] = {
++              .lock =  __RAW_SPIN_LOCK_UNLOCKED(atomic64_lock.lock),
++      },
++};
+ static inline raw_spinlock_t *lock_addr(const atomic64_t *v)
+ {
+@@ -173,14 +177,3 @@ int atomic64_add_unless(atomic64_t *v, l
+       return ret;
+ }
+ EXPORT_SYMBOL(atomic64_add_unless);
+-
+-static int init_atomic64_lock(void)
+-{
+-      int i;
+-
+-      for (i = 0; i < NR_LOCKS; ++i)
+-              raw_spin_lock_init(&atomic64_lock[i].lock);
+-      return 0;
+-}
+-
+-pure_initcall(init_atomic64_lock);
diff --git a/queue-3.7/linux-kernel.h-fix-div_round_closest-with-unsigned-divisors.patch b/queue-3.7/linux-kernel.h-fix-div_round_closest-with-unsigned-divisors.patch
new file mode 100644 (file)
index 0000000..727f02b
--- /dev/null
@@ -0,0 +1,65 @@
+From c4e18497d8fd92eef2c6e7eadcc1a107ccd115ea Mon Sep 17 00:00:00 2001
+From: Guenter Roeck <linux@roeck-us.net>
+Date: Thu, 20 Dec 2012 15:05:42 -0800
+Subject: linux/kernel.h: fix DIV_ROUND_CLOSEST with unsigned divisors
+
+From: Guenter Roeck <linux@roeck-us.net>
+
+commit c4e18497d8fd92eef2c6e7eadcc1a107ccd115ea upstream.
+
+Commit 263a523d18bc ("linux/kernel.h: Fix warning seen with W=1 due to
+change in DIV_ROUND_CLOSEST") fixes a warning seen with W=1 due to
+change in DIV_ROUND_CLOSEST.
+
+Unfortunately, the C compiler converts divide operations with unsigned
+divisors to unsigned, even if the dividend is signed and negative (for
+example, -10 / 5U = 858993457).  The C standard says "If one operand has
+unsigned int type, the other operand is converted to unsigned int", so
+the compiler is not to blame.  As a result, DIV_ROUND_CLOSEST(0, 2U) and
+similar operations now return bad values, since the automatic conversion
+of expressions such as "0 - 2U/2" to unsigned was not taken into
+account.
+
+Fix by checking for the divisor variable type when deciding which
+operation to perform.  This fixes DIV_ROUND_CLOSEST(0, 2U), but still
+returns bad values for negative dividends divided by unsigned divisors.
+Mark the latter case as unsupported.
+
+One observed effect of this problem is that the s2c_hwmon driver reports
+a value of 4198403 instead of 0 if the ADC reads 0.
+
+Other impact is unpredictable.  Problem is seen if the divisor is an
+unsigned variable or constant and the dividend is less than (divisor/2).
+
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Reported-by: Juergen Beisert <jbe@pengutronix.de>
+Tested-by: Juergen Beisert <jbe@pengutronix.de>
+Cc: Jean Delvare <khali@linux-fr.org>
+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>
+
+---
+ include/linux/kernel.h |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/include/linux/kernel.h
++++ b/include/linux/kernel.h
+@@ -77,13 +77,15 @@
+ /*
+  * Divide positive or negative dividend by positive divisor and round
+- * to closest integer. Result is undefined for negative divisors.
++ * to closest integer. Result is undefined for negative divisors and
++ * for negative dividends if the divisor variable type is unsigned.
+  */
+ #define DIV_ROUND_CLOSEST(x, divisor)(                        \
+ {                                                     \
+       typeof(x) __x = x;                              \
+       typeof(divisor) __d = divisor;                  \
+-      (((typeof(x))-1) > 0 || (__x) > 0) ?            \
++      (((typeof(x))-1) > 0 ||                         \
++       ((typeof(divisor))-1) > 0 || (__x) > 0) ?      \
+               (((__x) + ((__d) / 2)) / (__d)) :       \
+               (((__x) - ((__d) / 2)) / (__d));        \
+ }                                                     \
diff --git a/queue-3.7/mm-limit-mmu_gather-batching-to-fix-soft-lockups-on-config_preempt.patch b/queue-3.7/mm-limit-mmu_gather-batching-to-fix-soft-lockups-on-config_preempt.patch
new file mode 100644 (file)
index 0000000..b195f6a
--- /dev/null
@@ -0,0 +1,132 @@
+From 53a59fc67f97374758e63a9c785891ec62324c81 Mon Sep 17 00:00:00 2001
+From: Michal Hocko <mhocko@suse.cz>
+Date: Fri, 4 Jan 2013 15:35:12 -0800
+Subject: mm: limit mmu_gather batching to fix soft lockups on !CONFIG_PREEMPT
+
+From: Michal Hocko <mhocko@suse.cz>
+
+commit 53a59fc67f97374758e63a9c785891ec62324c81 upstream.
+
+Since commit e303297e6c3a ("mm: extended batches for generic
+mmu_gather") we are batching pages to be freed until either
+tlb_next_batch cannot allocate a new batch or we are done.
+
+This works just fine most of the time but we can get in troubles with
+non-preemptible kernel (CONFIG_PREEMPT_NONE or CONFIG_PREEMPT_VOLUNTARY)
+on large machines where too aggressive batching might lead to soft
+lockups during process exit path (exit_mmap) because there are no
+scheduling points down the free_pages_and_swap_cache path and so the
+freeing can take long enough to trigger the soft lockup.
+
+The lockup is harmless except when the system is setup to panic on
+softlockup which is not that unusual.
+
+The simplest way to work around this issue is to limit the maximum
+number of batches in a single mmu_gather.  10k of collected pages should
+be safe to prevent from soft lockups (we would have 2ms for one) even if
+they are all freed without an explicit scheduling point.
+
+This patch doesn't add any new explicit scheduling points because it
+relies on zap_pmd_range during page tables zapping which calls
+cond_resched per PMD.
+
+The following lockup has been reported for 3.0 kernel with a huge
+process (in order of hundreds gigs but I do know any more details).
+
+  BUG: soft lockup - CPU#56 stuck for 22s! [kernel:31053]
+  Modules linked in: af_packet nfs lockd fscache auth_rpcgss nfs_acl sunrpc mptctl mptbase autofs4 binfmt_misc dm_round_robin dm_multipath bonding cpufreq_conservative cpufreq_userspace cpufreq_powersave pcc_cpufreq mperf microcode fuse loop osst sg sd_mod crc_t10dif st qla2xxx scsi_transport_fc scsi_tgt netxen_nic i7core_edac iTCO_wdt joydev e1000e serio_raw pcspkr edac_core iTCO_vendor_support acpi_power_meter rtc_cmos hpwdt hpilo button container usbhid hid dm_mirror dm_region_hash dm_log linear uhci_hcd ehci_hcd usbcore usb_common scsi_dh_emc scsi_dh_alua scsi_dh_hp_sw scsi_dh_rdac scsi_dh dm_snapshot pcnet32 mii edd dm_mod raid1 ext3 mbcache jbd fan thermal processor thermal_sys hwmon cciss scsi_mod
+  Supported: Yes
+  CPU 56
+  Pid: 31053, comm: kernel Not tainted 3.0.31-0.9-default #1 HP ProLiant DL580 G7
+  RIP: 0010:  _raw_spin_unlock_irqrestore+0x8/0x10
+  RSP: 0018:ffff883ec1037af0  EFLAGS: 00000206
+  RAX: 0000000000000e00 RBX: ffffea01a0817e28 RCX: ffff88803ffd9e80
+  RDX: 0000000000000200 RSI: 0000000000000206 RDI: 0000000000000206
+  RBP: 0000000000000002 R08: 0000000000000001 R09: ffff887ec724a400
+  R10: 0000000000000000 R11: dead000000200200 R12: ffffffff8144c26e
+  R13: 0000000000000030 R14: 0000000000000297 R15: 000000000000000e
+  FS:  00007ed834282700(0000) GS:ffff88c03f200000(0000) knlGS:0000000000000000
+  CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
+  CR2: 000000000068b240 CR3: 0000003ec13c5000 CR4: 00000000000006e0
+  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+  DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
+  Process kernel (pid: 31053, threadinfo ffff883ec1036000, task ffff883ebd5d4100)
+  Call Trace:
+    release_pages+0xc5/0x260
+    free_pages_and_swap_cache+0x9d/0xc0
+    tlb_flush_mmu+0x5c/0x80
+    tlb_finish_mmu+0xe/0x50
+    exit_mmap+0xbd/0x120
+    mmput+0x49/0x120
+    exit_mm+0x122/0x160
+    do_exit+0x17a/0x430
+    do_group_exit+0x3d/0xb0
+    get_signal_to_deliver+0x247/0x480
+    do_signal+0x71/0x1b0
+    do_notify_resume+0x98/0xb0
+    int_signal+0x12/0x17
+  DWARF2 unwinder stuck at int_signal+0x12/0x17
+
+Signed-off-by: Michal Hocko <mhocko@suse.cz>
+Cc: Mel Gorman <mgorman@suse.de>
+Cc: Rik van Riel <riel@redhat.com>
+Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
+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>
+
+---
+ include/asm-generic/tlb.h |    9 +++++++++
+ mm/memory.c               |    5 +++++
+ 2 files changed, 14 insertions(+)
+
+--- a/include/asm-generic/tlb.h
++++ b/include/asm-generic/tlb.h
+@@ -78,6 +78,14 @@ struct mmu_gather_batch {
+ #define MAX_GATHER_BATCH      \
+       ((PAGE_SIZE - sizeof(struct mmu_gather_batch)) / sizeof(void *))
++/*
++ * Limit the maximum number of mmu_gather batches to reduce a risk of soft
++ * lockups for non-preemptible kernels on huge machines when a lot of memory
++ * is zapped during unmapping.
++ * 10K pages freed at once should be safe even without a preemption point.
++ */
++#define MAX_GATHER_BATCH_COUNT        (10000UL/MAX_GATHER_BATCH)
++
+ /* struct mmu_gather is an opaque type used by the mm code for passing around
+  * any data needed by arch specific code for tlb_remove_page.
+  */
+@@ -96,6 +104,7 @@ struct mmu_gather {
+       struct mmu_gather_batch *active;
+       struct mmu_gather_batch local;
+       struct page             *__pages[MMU_GATHER_BUNDLE];
++      unsigned int            batch_count;
+ };
+ #define HAVE_GENERIC_MMU_GATHER
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -182,10 +182,14 @@ static int tlb_next_batch(struct mmu_gat
+               return 1;
+       }
++      if (tlb->batch_count == MAX_GATHER_BATCH_COUNT)
++              return 0;
++
+       batch = (void *)__get_free_pages(GFP_NOWAIT | __GFP_NOWARN, 0);
+       if (!batch)
+               return 0;
++      tlb->batch_count++;
+       batch->next = NULL;
+       batch->nr   = 0;
+       batch->max  = MAX_GATHER_BATCH;
+@@ -214,6 +218,7 @@ void tlb_gather_mmu(struct mmu_gather *t
+       tlb->local.nr   = 0;
+       tlb->local.max  = ARRAY_SIZE(tlb->__pages);
+       tlb->active     = &tlb->local;
++      tlb->batch_count = 0;
+ #ifdef CONFIG_HAVE_RCU_TABLE_FREE
+       tlb->batch = NULL;
diff --git a/queue-3.7/proc-pid-status-show-all-supplementary-groups.patch b/queue-3.7/proc-pid-status-show-all-supplementary-groups.patch
new file mode 100644 (file)
index 0000000..3d3c4b6
--- /dev/null
@@ -0,0 +1,49 @@
+From 8d238027b87e654be552eabdf492042a34c5c300 Mon Sep 17 00:00:00 2001
+From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+Date: Mon, 17 Dec 2012 16:03:17 -0800
+Subject: proc: pid/status: show all supplementary groups
+
+From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+
+commit 8d238027b87e654be552eabdf492042a34c5c300 upstream.
+
+We display a list of supplementary group for each process in
+/proc/<pid>/status.  However, we show only the first 32 groups, not all of
+them.
+
+Although this is rare, but sometimes processes do have more than 32
+supplementary groups, and this kernel limitation breaks user-space apps
+that rely on the group list in /proc/<pid>/status.
+
+Number 32 comes from the internal NGROUPS_SMALL macro which defines the
+length for the internal kernel "small" groups buffer.  There is no
+apparent reason to limit to this value.
+
+This patch removes the 32 groups printing limit.
+
+The Linux kernel limits the amount of supplementary groups by NGROUPS_MAX,
+which is currently set to 65536.  And this is the maximum count of groups
+we may possibly print.
+
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
+Acked-by: Kees Cook <keescook@chromium.org>
+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>
+
+---
+ fs/proc/array.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/proc/array.c
++++ b/fs/proc/array.c
+@@ -212,7 +212,7 @@ static inline void task_state(struct seq
+       group_info = cred->group_info;
+       task_unlock(p);
+-      for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++)
++      for (g = 0; g < group_info->ngroups; g++)
+               seq_printf(m, "%d ",
+                          from_kgid_munged(user_ns, GROUP_AT(group_info, g)));
+       put_cred(cred);
diff --git a/queue-3.7/revert-rtc-recycle-id-when-unloading-a-rtc-driver.patch b/queue-3.7/revert-rtc-recycle-id-when-unloading-a-rtc-driver.patch
new file mode 100644 (file)
index 0000000..b8416ad
--- /dev/null
@@ -0,0 +1,45 @@
+From 5abe257af8b95857b95fa0ba694530b446ae32d8 Mon Sep 17 00:00:00 2001
+From: Andrew Morton <akpm@linux-foundation.org>
+Date: Thu, 20 Dec 2012 15:05:34 -0800
+Subject: revert "rtc: recycle id when unloading a rtc driver"
+
+From: Andrew Morton <akpm@linux-foundation.org>
+
+commit 5abe257af8b95857b95fa0ba694530b446ae32d8 upstream.
+
+Revert commit 2830a6d20139df2198d63235df7957712adb28e5.
+
+We already perform the ida_simple_remove() in rtc_device_release(),
+which is an appropriate place.  Commit 2830a6d20 ("rtc: recycle id when
+unloading a rtc driver") caused the kernel to emit
+
+       ida_remove called for id=0 which is not allocated.
+
+warnings when rtc_device_release() tries to release an alread-released
+ID.
+
+Let's restore things to their previous state and then work out why
+Vincent's kernel wasn't calling rtc_device_release() - presumably a bug
+in a specific sub-driver.
+
+Reported-by: Lothar Waßmann <LW@KARO-electronics.de>
+Acked-by: Alexander Holler <holler@ahsoftware.de>
+Cc: Vincent Palatin <vpalatin@chromium.org>
+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/class.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/rtc/class.c
++++ b/drivers/rtc/class.c
+@@ -244,7 +244,6 @@ void rtc_device_unregister(struct rtc_de
+               rtc_proc_del_device(rtc);
+               device_unregister(&rtc->dev);
+               rtc->ops = NULL;
+-              ida_simple_remove(&rtc_ida, rtc->id);
+               mutex_unlock(&rtc->ops_lock);
+               put_device(&rtc->dev);
+       }
index b20e875ee84247bd9d9cb42048790d97ba648d05..681637cd5e27c1d36d61a9bcaf7337806faa4222 100644 (file)
@@ -109,3 +109,13 @@ bluetooth-add-support-for-bcm20702a0.patch
 bluetooth-add-missing-lock-nesting-notation.patch
 bluetooth-cancel-power_on-work-when-unregistering-the-device.patch
 revert-bluetooth-fix-possible-deadlock-in-sco-code.patch
+lib-atomic64-initialize-locks-statically-to-fix-early-users.patch
+proc-pid-status-show-all-supplementary-groups.patch
+cris-fix-i-o-macros.patch
+revert-rtc-recycle-id-when-unloading-a-rtc-driver.patch
+drivers-rtc-rtc-vt8500.c-correct-handling-of-cr_24h-bitfield.patch
+drivers-rtc-rtc-vt8500.c-fix-handling-of-data-passed-in-struct-rtc_time.patch
+mm-limit-mmu_gather-batching-to-fix-soft-lockups-on-config_preempt.patch
+linux-kernel.h-fix-div_round_closest-with-unsigned-divisors.patch
+hid-add-apple-wireless-keyboard-2011-ansi-to-special-driver-list.patch
+can-do-not-call-dev_put-if-restart-timer-is-running-upon-close.patch