From: Greg Kroah-Hartman Date: Fri, 14 Jun 2013 20:04:54 +0000 (-0700) Subject: 3.4-stable patches X-Git-Tag: v3.0.83~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=07e609b42c45dec1c2886701d702bce79dabdf6c;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: ath9k-disable-powersave-by-default.patch ath9k-use-minstrel-rate-control-by-default.patch bluetooth-fix-mgmt-handling-of-power-on-failures.patch ceph-add-cpu_to_le32-calls-when-encoding-a-reconnect-capability.patch ceph-ceph_pagelist_append-might-sleep-while-atomic.patch cpu-hotplug-provide-a-generic-helper-to-disable-enable-cpu-hotplug.patch drivers-rtc-rtc-twl.c-fix-missing-device_init_wakeup-when-booted-with-device-tree.patch drm-gma500-cdv-unpin-framebuffer-on-crtc-disable.patch drm-gma500-psb-unpin-framebuffer-on-crtc-disable.patch libceph-must-hold-mutex-for-reset_changed_osds.patch reboot-rigrate-shutdown-reboot-to-boot-cpu.patch --- diff --git a/queue-3.4/ath9k-disable-powersave-by-default.patch b/queue-3.4/ath9k-disable-powersave-by-default.patch new file mode 100644 index 00000000000..b2189383377 --- /dev/null +++ b/queue-3.4/ath9k-disable-powersave-by-default.patch @@ -0,0 +1,37 @@ +From 531671cb17af07281e6f28c1425f754346e65c41 Mon Sep 17 00:00:00 2001 +From: Sujith Manoharan +Date: Sat, 1 Jun 2013 07:08:09 +0530 +Subject: ath9k: Disable PowerSave by default + +From: Sujith Manoharan + +commit 531671cb17af07281e6f28c1425f754346e65c41 upstream. + +Almost all the DMA issues which have plagued ath9k (in station mode) +for years are related to PS. Disabling PS usually "fixes" the user's +connection stablility. Reports of DMA problems are still trickling in +and are sitting in the kernel bugzilla. Until the PS code in ath9k is +given a thorough review, disbale it by default. The slight increase +in chip power consumption is a small price to pay for improved link +stability. + +Signed-off-by: Sujith Manoharan +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath/ath9k/init.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -671,8 +671,7 @@ void ath9k_set_hw_capab(struct ath_softc + BIT(NL80211_IFTYPE_ADHOC) | + BIT(NL80211_IFTYPE_MESH_POINT); + +- if (AR_SREV_5416(sc->sc_ah)) +- hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; ++ hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; + + hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; + hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; diff --git a/queue-3.4/ath9k-use-minstrel-rate-control-by-default.patch b/queue-3.4/ath9k-use-minstrel-rate-control-by-default.patch new file mode 100644 index 00000000000..7967ed5e286 --- /dev/null +++ b/queue-3.4/ath9k-use-minstrel-rate-control-by-default.patch @@ -0,0 +1,90 @@ +From 5efac94999ff218e0101f67a059e44abb4b0b523 Mon Sep 17 00:00:00 2001 +From: Sujith Manoharan +Date: Thu, 6 Jun 2013 10:06:29 +0530 +Subject: ath9k: Use minstrel rate control by default + +From: Sujith Manoharan + +commit 5efac94999ff218e0101f67a059e44abb4b0b523 upstream. + +The ath9k rate control algorithm has various architectural +issues that make it a poor fit in scenarios like congested +environments etc. + +An example: https://bugzilla.redhat.com/show_bug.cgi?id=927191 + +Change the default to minstrel which is more robust in such cases. +The ath9k RC code is left in the driver for now, maybe it can +be removed altogether later on. + +Signed-off-by: Sujith Manoharan +Cc: Jouni Malinen +Cc: Linus Torvalds +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath/ath9k/Kconfig | 10 +++++++--- + drivers/net/wireless/ath/ath9k/Makefile | 2 +- + drivers/net/wireless/ath/ath9k/init.c | 4 ---- + drivers/net/wireless/ath/ath9k/rc.h | 2 +- + 4 files changed, 9 insertions(+), 9 deletions(-) + +--- a/drivers/net/wireless/ath/ath9k/Kconfig ++++ b/drivers/net/wireless/ath/ath9k/Kconfig +@@ -89,13 +89,17 @@ config ATH9K_MAC_DEBUG + This option enables collection of statistics for Rx/Tx status + data and some other MAC related statistics + +-config ATH9K_RATE_CONTROL ++config ATH9K_LEGACY_RATE_CONTROL + bool "Atheros ath9k rate control" + depends on ATH9K +- default y ++ default n + ---help--- + Say Y, if you want to use the ath9k specific rate control +- module instead of minstrel_ht. ++ module instead of minstrel_ht. Be warned that there are various ++ issues with the ath9k RC and minstrel is a more robust algorithm. ++ Note that even if this option is selected, "ath9k_rate_control" ++ has to be passed to mac80211 using the module parameter, ++ ieee80211_default_rc_algo. + + config ATH9K_HTC + tristate "Atheros HTC based wireless cards support" +--- a/drivers/net/wireless/ath/ath9k/Makefile ++++ b/drivers/net/wireless/ath/ath9k/Makefile +@@ -6,7 +6,7 @@ ath9k-y += beacon.o \ + xmit.o + + ath9k-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += mci.o +-ath9k-$(CONFIG_ATH9K_RATE_CONTROL) += rc.o ++ath9k-$(CONFIG_ATH9K_LEGACY_RATE_CONTROL) += rc.o + ath9k-$(CONFIG_ATH9K_PCI) += pci.o + ath9k-$(CONFIG_ATH9K_AHB) += ahb.o + ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -694,10 +694,6 @@ void ath9k_set_hw_capab(struct ath_softc + sc->ant_rx = hw->wiphy->available_antennas_rx; + sc->ant_tx = hw->wiphy->available_antennas_tx; + +-#ifdef CONFIG_ATH9K_RATE_CONTROL +- hw->rate_control_algorithm = "ath9k_rate_control"; +-#endif +- + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) + hw->wiphy->bands[IEEE80211_BAND_2GHZ] = + &sc->sbands[IEEE80211_BAND_2GHZ]; +--- a/drivers/net/wireless/ath/ath9k/rc.h ++++ b/drivers/net/wireless/ath/ath9k/rc.h +@@ -219,7 +219,7 @@ struct ath_rate_priv { + struct ath_rc_stats rcstats[RATE_TABLE_SIZE]; + }; + +-#ifdef CONFIG_ATH9K_RATE_CONTROL ++#ifdef CONFIG_ATH9K_LEGACY_RATE_CONTROL + int ath_rate_control_register(void); + void ath_rate_control_unregister(void); + #else diff --git a/queue-3.4/bluetooth-fix-mgmt-handling-of-power-on-failures.patch b/queue-3.4/bluetooth-fix-mgmt-handling-of-power-on-failures.patch new file mode 100644 index 00000000000..c03043f0ad3 --- /dev/null +++ b/queue-3.4/bluetooth-fix-mgmt-handling-of-power-on-failures.patch @@ -0,0 +1,98 @@ +From 96570ffcca0b872dc8626e97569d2697f374d868 Mon Sep 17 00:00:00 2001 +From: Johan Hedberg +Date: Wed, 29 May 2013 09:51:29 +0300 +Subject: Bluetooth: Fix mgmt handling of power on failures + +From: Johan Hedberg + +commit 96570ffcca0b872dc8626e97569d2697f374d868 upstream. + +If hci_dev_open fails we need to ensure that the corresponding +mgmt_set_powered command gets an appropriate response. This patch fixes +the missing response by adding a new mgmt_set_powered_failed function +that's used to indicate a power on failure to mgmt. Since a situation +with the device being rfkilled may require special handling in user +space the patch uses a new dedicated mgmt status code for this. + +Signed-off-by: Johan Hedberg +Acked-by: Marcel Holtmann +Signed-off-by: Gustavo Padovan +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + include/net/bluetooth/hci_core.h | 1 + + include/net/bluetooth/mgmt.h | 1 + + net/bluetooth/hci_core.c | 6 +++++- + net/bluetooth/mgmt.c | 21 +++++++++++++++++++++ + 4 files changed, 28 insertions(+), 1 deletion(-) + +--- a/include/net/bluetooth/hci_core.h ++++ b/include/net/bluetooth/hci_core.h +@@ -976,6 +976,7 @@ void hci_sock_dev_event(struct hci_dev * + int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); + int mgmt_index_added(struct hci_dev *hdev); + int mgmt_index_removed(struct hci_dev *hdev); ++int mgmt_set_powered_failed(struct hci_dev *hdev, int err); + int mgmt_powered(struct hci_dev *hdev, u8 powered); + int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); + int mgmt_connectable(struct hci_dev *hdev, u8 connectable); +--- a/include/net/bluetooth/mgmt.h ++++ b/include/net/bluetooth/mgmt.h +@@ -42,6 +42,7 @@ + #define MGMT_STATUS_NOT_POWERED 0x0f + #define MGMT_STATUS_CANCELLED 0x10 + #define MGMT_STATUS_INVALID_INDEX 0x11 ++#define MGMT_STATUS_RFKILLED 0x12 + + struct mgmt_hdr { + __le16 opcode; +--- a/net/bluetooth/hci_core.c ++++ b/net/bluetooth/hci_core.c +@@ -1120,11 +1120,15 @@ EXPORT_SYMBOL(hci_free_dev); + static void hci_power_on(struct work_struct *work) + { + struct hci_dev *hdev = container_of(work, struct hci_dev, power_on); ++ int err; + + BT_DBG("%s", hdev->name); + +- if (hci_dev_open(hdev->id) < 0) ++ err = hci_dev_open(hdev->id); ++ if (err < 0) { ++ mgmt_set_powered_failed(hdev, err); + return; ++ } + + if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) + schedule_delayed_work(&hdev->power_off, +--- a/net/bluetooth/mgmt.c ++++ b/net/bluetooth/mgmt.c +@@ -2833,6 +2833,27 @@ int mgmt_powered(struct hci_dev *hdev, u + return err; + } + ++int mgmt_set_powered_failed(struct hci_dev *hdev, int err) ++{ ++ struct pending_cmd *cmd; ++ u8 status; ++ ++ cmd = mgmt_pending_find(MGMT_OP_SET_POWERED, hdev); ++ if (!cmd) ++ return -ENOENT; ++ ++ if (err == -ERFKILL) ++ status = MGMT_STATUS_RFKILLED; ++ else ++ status = MGMT_STATUS_FAILED; ++ ++ err = cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_POWERED, status); ++ ++ mgmt_pending_remove(cmd); ++ ++ return err; ++} ++ + int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable) + { + struct cmd_lookup match = { NULL, hdev }; diff --git a/queue-3.4/ceph-add-cpu_to_le32-calls-when-encoding-a-reconnect-capability.patch b/queue-3.4/ceph-add-cpu_to_le32-calls-when-encoding-a-reconnect-capability.patch new file mode 100644 index 00000000000..639ee0e6715 --- /dev/null +++ b/queue-3.4/ceph-add-cpu_to_le32-calls-when-encoding-a-reconnect-capability.patch @@ -0,0 +1,67 @@ +From c420276a532a10ef59849adc2681f45306166b89 Mon Sep 17 00:00:00 2001 +From: Jim Schutt +Date: Wed, 15 May 2013 13:03:35 -0500 +Subject: ceph: add cpu_to_le32() calls when encoding a reconnect capability + +From: Jim Schutt + +commit c420276a532a10ef59849adc2681f45306166b89 upstream. + +In his review, Alex Elder mentioned that he hadn't checked that +num_fcntl_locks and num_flock_locks were properly decoded on the +server side, from a le32 over-the-wire type to a cpu type. +I checked, and AFAICS it is done; those interested can consult + Locker::_do_cap_update() +in src/mds/Locker.cc and src/include/encoding.h in the Ceph server +code (git://github.com/ceph/ceph). + +I also checked the server side for flock_len decoding, and I believe +that also happens correctly, by virtue of having been declared +__le32 in struct ceph_mds_cap_reconnect, in src/include/ceph_fs.h. + +Signed-off-by: Jim Schutt +Reviewed-by: Alex Elder +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ceph/locks.c | 7 +++++-- + fs/ceph/mds_client.c | 2 +- + 2 files changed, 6 insertions(+), 3 deletions(-) + +--- a/fs/ceph/locks.c ++++ b/fs/ceph/locks.c +@@ -206,10 +206,12 @@ int ceph_encode_locks(struct inode *inod + int err = 0; + int seen_fcntl = 0; + int seen_flock = 0; ++ __le32 nlocks; + + dout("encoding %d flock and %d fcntl locks", num_flock_locks, + num_fcntl_locks); +- err = ceph_pagelist_append(pagelist, &num_fcntl_locks, sizeof(u32)); ++ nlocks = cpu_to_le32(num_fcntl_locks); ++ err = ceph_pagelist_append(pagelist, &nlocks, sizeof(nlocks)); + if (err) + goto fail; + for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { +@@ -229,7 +231,8 @@ int ceph_encode_locks(struct inode *inod + goto fail; + } + +- err = ceph_pagelist_append(pagelist, &num_flock_locks, sizeof(u32)); ++ nlocks = cpu_to_le32(num_flock_locks); ++ err = ceph_pagelist_append(pagelist, &nlocks, sizeof(nlocks)); + if (err) + goto fail; + for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { +--- a/fs/ceph/mds_client.c ++++ b/fs/ceph/mds_client.c +@@ -2462,7 +2462,7 @@ static int encode_caps_cb(struct inode * + lock_flocks(); + ceph_count_locks(inode, &num_fcntl_locks, + &num_flock_locks); +- rec.v2.flock_len = (2*sizeof(u32) + ++ rec.v2.flock_len = cpu_to_le32(2*sizeof(u32) + + (num_fcntl_locks+num_flock_locks) * + sizeof(struct ceph_filelock)); + unlock_flocks(); diff --git a/queue-3.4/ceph-ceph_pagelist_append-might-sleep-while-atomic.patch b/queue-3.4/ceph-ceph_pagelist_append-might-sleep-while-atomic.patch new file mode 100644 index 00000000000..e6846c94c39 --- /dev/null +++ b/queue-3.4/ceph-ceph_pagelist_append-might-sleep-while-atomic.patch @@ -0,0 +1,272 @@ +From 39be95e9c8c0b5668c9f8806ffe29bf9f4bc0f40 Mon Sep 17 00:00:00 2001 +From: Jim Schutt +Date: Wed, 15 May 2013 13:03:35 -0500 +Subject: ceph: ceph_pagelist_append might sleep while atomic + +From: Jim Schutt + +commit 39be95e9c8c0b5668c9f8806ffe29bf9f4bc0f40 upstream. + +Ceph's encode_caps_cb() worked hard to not call __page_cache_alloc() +while holding a lock, but it's spoiled because ceph_pagelist_addpage() +always calls kmap(), which might sleep. Here's the result: + +[13439.295457] ceph: mds0 reconnect start +[13439.300572] BUG: sleeping function called from invalid context at include/linux/highmem.h:58 +[13439.309243] in_atomic(): 1, irqs_disabled(): 0, pid: 12059, name: kworker/1:1 + . . . +[13439.376225] Call Trace: +[13439.378757] [] __might_sleep+0xfc/0x110 +[13439.384353] [] ceph_pagelist_append+0x120/0x1b0 [libceph] +[13439.391491] [] ceph_encode_locks+0x89/0x190 [ceph] +[13439.398035] [] ? _raw_spin_lock+0x49/0x50 +[13439.403775] [] ? lock_flocks+0x15/0x20 +[13439.409277] [] encode_caps_cb+0x41f/0x4a0 [ceph] +[13439.415622] [] ? igrab+0x28/0x70 +[13439.420610] [] ? iterate_session_caps+0xe8/0x250 [ceph] +[13439.427584] [] iterate_session_caps+0x115/0x250 [ceph] +[13439.434499] [] ? set_request_path_attr+0x2d0/0x2d0 [ceph] +[13439.441646] [] send_mds_reconnect+0x238/0x450 [ceph] +[13439.448363] [] ? ceph_mdsmap_decode+0x5e2/0x770 [ceph] +[13439.455250] [] check_new_map+0x352/0x500 [ceph] +[13439.461534] [] ceph_mdsc_handle_map+0x1bd/0x260 [ceph] +[13439.468432] [] ? mutex_unlock+0xe/0x10 +[13439.473934] [] extra_mon_dispatch+0x22/0x30 [ceph] +[13439.480464] [] dispatch+0xbc/0x110 [libceph] +[13439.486492] [] process_message+0x1ad/0x1d0 [libceph] +[13439.493190] [] ? read_partial_message+0x3e8/0x520 [libceph] + . . . +[13439.587132] ceph: mds0 reconnect success +[13490.720032] ceph: mds0 caps stale +[13501.235257] ceph: mds0 recovery completed +[13501.300419] ceph: mds0 caps renewed + +Fix it up by encoding locks into a buffer first, and when the number +of encoded locks is stable, copy that into a ceph_pagelist. + +[elder@inktank.com: abbreviated the stack info a bit.] + +Signed-off-by: Jim Schutt +Reviewed-by: Alex Elder +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ceph/locks.c | 76 +++++++++++++++++++++++++++++++-------------------- + fs/ceph/mds_client.c | 63 ++++++++++++++++++++++-------------------- + fs/ceph/super.h | 9 ++++-- + 3 files changed, 88 insertions(+), 60 deletions(-) + +--- a/fs/ceph/locks.c ++++ b/fs/ceph/locks.c +@@ -191,29 +191,23 @@ void ceph_count_locks(struct inode *inod + } + + /** +- * Encode the flock and fcntl locks for the given inode into the pagelist. +- * Format is: #fcntl locks, sequential fcntl locks, #flock locks, +- * sequential flock locks. +- * Must be called with lock_flocks() already held. +- * If we encounter more of a specific lock type than expected, +- * we return the value 1. ++ * Encode the flock and fcntl locks for the given inode into the ceph_filelock ++ * array. Must be called with lock_flocks() already held. ++ * If we encounter more of a specific lock type than expected, return -ENOSPC. + */ +-int ceph_encode_locks(struct inode *inode, struct ceph_pagelist *pagelist, +- int num_fcntl_locks, int num_flock_locks) ++int ceph_encode_locks_to_buffer(struct inode *inode, ++ struct ceph_filelock *flocks, ++ int num_fcntl_locks, int num_flock_locks) + { + struct file_lock *lock; +- struct ceph_filelock cephlock; + int err = 0; + int seen_fcntl = 0; + int seen_flock = 0; +- __le32 nlocks; ++ int l = 0; + + dout("encoding %d flock and %d fcntl locks", num_flock_locks, + num_fcntl_locks); +- nlocks = cpu_to_le32(num_fcntl_locks); +- err = ceph_pagelist_append(pagelist, &nlocks, sizeof(nlocks)); +- if (err) +- goto fail; ++ + for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { + if (lock->fl_flags & FL_POSIX) { + ++seen_fcntl; +@@ -221,20 +215,12 @@ int ceph_encode_locks(struct inode *inod + err = -ENOSPC; + goto fail; + } +- err = lock_to_ceph_filelock(lock, &cephlock); ++ err = lock_to_ceph_filelock(lock, &flocks[l]); + if (err) + goto fail; +- err = ceph_pagelist_append(pagelist, &cephlock, +- sizeof(struct ceph_filelock)); ++ ++l; + } +- if (err) +- goto fail; + } +- +- nlocks = cpu_to_le32(num_flock_locks); +- err = ceph_pagelist_append(pagelist, &nlocks, sizeof(nlocks)); +- if (err) +- goto fail; + for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) { + if (lock->fl_flags & FL_FLOCK) { + ++seen_flock; +@@ -242,19 +228,51 @@ int ceph_encode_locks(struct inode *inod + err = -ENOSPC; + goto fail; + } +- err = lock_to_ceph_filelock(lock, &cephlock); ++ err = lock_to_ceph_filelock(lock, &flocks[l]); + if (err) + goto fail; +- err = ceph_pagelist_append(pagelist, &cephlock, +- sizeof(struct ceph_filelock)); ++ ++l; + } +- if (err) +- goto fail; + } + fail: + return err; + } + ++/** ++ * Copy the encoded flock and fcntl locks into the pagelist. ++ * Format is: #fcntl locks, sequential fcntl locks, #flock locks, ++ * sequential flock locks. ++ * Returns zero on success. ++ */ ++int ceph_locks_to_pagelist(struct ceph_filelock *flocks, ++ struct ceph_pagelist *pagelist, ++ int num_fcntl_locks, int num_flock_locks) ++{ ++ int err = 0; ++ __le32 nlocks; ++ ++ nlocks = cpu_to_le32(num_fcntl_locks); ++ err = ceph_pagelist_append(pagelist, &nlocks, sizeof(nlocks)); ++ if (err) ++ goto out_fail; ++ ++ err = ceph_pagelist_append(pagelist, flocks, ++ num_fcntl_locks * sizeof(*flocks)); ++ if (err) ++ goto out_fail; ++ ++ nlocks = cpu_to_le32(num_flock_locks); ++ err = ceph_pagelist_append(pagelist, &nlocks, sizeof(nlocks)); ++ if (err) ++ goto out_fail; ++ ++ err = ceph_pagelist_append(pagelist, ++ &flocks[num_fcntl_locks], ++ num_flock_locks * sizeof(*flocks)); ++out_fail: ++ return err; ++} ++ + /* + * Given a pointer to a lock, convert it to a ceph filelock + */ +--- a/fs/ceph/mds_client.c ++++ b/fs/ceph/mds_client.c +@@ -2455,39 +2455,44 @@ static int encode_caps_cb(struct inode * + + if (recon_state->flock) { + int num_fcntl_locks, num_flock_locks; +- struct ceph_pagelist_cursor trunc_point; ++ struct ceph_filelock *flocks; + +- ceph_pagelist_set_cursor(pagelist, &trunc_point); +- do { +- lock_flocks(); +- ceph_count_locks(inode, &num_fcntl_locks, +- &num_flock_locks); +- rec.v2.flock_len = cpu_to_le32(2*sizeof(u32) + +- (num_fcntl_locks+num_flock_locks) * +- sizeof(struct ceph_filelock)); +- unlock_flocks(); +- +- /* pre-alloc pagelist */ +- ceph_pagelist_truncate(pagelist, &trunc_point); +- err = ceph_pagelist_append(pagelist, &rec, reclen); +- if (!err) +- err = ceph_pagelist_reserve(pagelist, +- rec.v2.flock_len); +- +- /* encode locks */ +- if (!err) { +- lock_flocks(); +- err = ceph_encode_locks(inode, +- pagelist, +- num_fcntl_locks, +- num_flock_locks); +- unlock_flocks(); +- } +- } while (err == -ENOSPC); ++encode_again: ++ lock_flocks(); ++ ceph_count_locks(inode, &num_fcntl_locks, &num_flock_locks); ++ unlock_flocks(); ++ flocks = kmalloc((num_fcntl_locks+num_flock_locks) * ++ sizeof(struct ceph_filelock), GFP_NOFS); ++ if (!flocks) { ++ err = -ENOMEM; ++ goto out_free; ++ } ++ lock_flocks(); ++ err = ceph_encode_locks_to_buffer(inode, flocks, ++ num_fcntl_locks, ++ num_flock_locks); ++ unlock_flocks(); ++ if (err) { ++ kfree(flocks); ++ if (err == -ENOSPC) ++ goto encode_again; ++ goto out_free; ++ } ++ /* ++ * number of encoded locks is stable, so copy to pagelist ++ */ ++ rec.v2.flock_len = cpu_to_le32(2*sizeof(u32) + ++ (num_fcntl_locks+num_flock_locks) * ++ sizeof(struct ceph_filelock)); ++ err = ceph_pagelist_append(pagelist, &rec, reclen); ++ if (!err) ++ err = ceph_locks_to_pagelist(flocks, pagelist, ++ num_fcntl_locks, ++ num_flock_locks); ++ kfree(flocks); + } else { + err = ceph_pagelist_append(pagelist, &rec, reclen); + } +- + out_free: + kfree(path); + out_dput: +--- a/fs/ceph/super.h ++++ b/fs/ceph/super.h +@@ -847,8 +847,13 @@ extern const struct export_operations ce + extern int ceph_lock(struct file *file, int cmd, struct file_lock *fl); + extern int ceph_flock(struct file *file, int cmd, struct file_lock *fl); + extern void ceph_count_locks(struct inode *inode, int *p_num, int *f_num); +-extern int ceph_encode_locks(struct inode *i, struct ceph_pagelist *p, +- int p_locks, int f_locks); ++extern int ceph_encode_locks_to_buffer(struct inode *inode, ++ struct ceph_filelock *flocks, ++ int num_fcntl_locks, ++ int num_flock_locks); ++extern int ceph_locks_to_pagelist(struct ceph_filelock *flocks, ++ struct ceph_pagelist *pagelist, ++ int num_fcntl_locks, int num_flock_locks); + extern int lock_to_ceph_filelock(struct file_lock *fl, struct ceph_filelock *c); + + /* debugfs.c */ diff --git a/queue-3.4/cpu-hotplug-provide-a-generic-helper-to-disable-enable-cpu-hotplug.patch b/queue-3.4/cpu-hotplug-provide-a-generic-helper-to-disable-enable-cpu-hotplug.patch new file mode 100644 index 00000000000..12a538f0acb --- /dev/null +++ b/queue-3.4/cpu-hotplug-provide-a-generic-helper-to-disable-enable-cpu-hotplug.patch @@ -0,0 +1,138 @@ +From 16e53dbf10a2d7e228709a7286310e629ede5e45 Mon Sep 17 00:00:00 2001 +From: "Srivatsa S. Bhat" +Date: Wed, 12 Jun 2013 14:04:36 -0700 +Subject: CPU hotplug: provide a generic helper to disable/enable CPU hotplug + +From: "Srivatsa S. Bhat" + +commit 16e53dbf10a2d7e228709a7286310e629ede5e45 upstream. + +There are instances in the kernel where we would like to disable CPU +hotplug (from sysfs) during some important operation. Today the freezer +code depends on this and the code to do it was kinda tailor-made for +that. + +Restructure the code and make it generic enough to be useful for other +usecases too. + +Signed-off-by: Srivatsa S. Bhat +Signed-off-by: Robin Holt +Cc: H. Peter Anvin +Cc: Thomas Gleixner +Cc: Ingo Molnar +Cc: Russ Anderson +Cc: Robin Holt +Cc: Russell King +Cc: Guan Xuetao +Cc: Shawn Guo +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/cpu.h | 4 +++ + kernel/cpu.c | 55 +++++++++++++++++++++------------------------------- + 2 files changed, 27 insertions(+), 32 deletions(-) + +--- a/include/linux/cpu.h ++++ b/include/linux/cpu.h +@@ -177,6 +177,8 @@ extern struct bus_type cpu_subsys; + + extern void get_online_cpus(void); + extern void put_online_cpus(void); ++extern void cpu_hotplug_disable(void); ++extern void cpu_hotplug_enable(void); + #define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) + #define register_hotcpu_notifier(nb) register_cpu_notifier(nb) + #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) +@@ -199,6 +201,8 @@ static inline void cpu_hotplug_driver_un + + #define get_online_cpus() do { } while (0) + #define put_online_cpus() do { } while (0) ++#define cpu_hotplug_disable() do { } while (0) ++#define cpu_hotplug_enable() do { } while (0) + #define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) + /* These aren't inline functions due to a GCC bug. */ + #define register_hotcpu_notifier(nb) ({ (void)(nb); 0; }) +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -124,6 +124,27 @@ static void cpu_hotplug_done(void) + mutex_unlock(&cpu_hotplug.lock); + } + ++/* ++ * Wait for currently running CPU hotplug operations to complete (if any) and ++ * disable future CPU hotplug (from sysfs). The 'cpu_add_remove_lock' protects ++ * the 'cpu_hotplug_disabled' flag. The same lock is also acquired by the ++ * hotplug path before performing hotplug operations. So acquiring that lock ++ * guarantees mutual exclusion from any currently running hotplug operations. ++ */ ++void cpu_hotplug_disable(void) ++{ ++ cpu_maps_update_begin(); ++ cpu_hotplug_disabled = 1; ++ cpu_maps_update_done(); ++} ++ ++void cpu_hotplug_enable(void) ++{ ++ cpu_maps_update_begin(); ++ cpu_hotplug_disabled = 0; ++ cpu_maps_update_done(); ++} ++ + #else /* #if CONFIG_HOTPLUG_CPU */ + static void cpu_hotplug_begin(void) {} + static void cpu_hotplug_done(void) {} +@@ -479,36 +500,6 @@ static int __init alloc_frozen_cpus(void + core_initcall(alloc_frozen_cpus); + + /* +- * Prevent regular CPU hotplug from racing with the freezer, by disabling CPU +- * hotplug when tasks are about to be frozen. Also, don't allow the freezer +- * to continue until any currently running CPU hotplug operation gets +- * completed. +- * To modify the 'cpu_hotplug_disabled' flag, we need to acquire the +- * 'cpu_add_remove_lock'. And this same lock is also taken by the regular +- * CPU hotplug path and released only after it is complete. Thus, we +- * (and hence the freezer) will block here until any currently running CPU +- * hotplug operation gets completed. +- */ +-void cpu_hotplug_disable_before_freeze(void) +-{ +- cpu_maps_update_begin(); +- cpu_hotplug_disabled = 1; +- cpu_maps_update_done(); +-} +- +- +-/* +- * When tasks have been thawed, re-enable regular CPU hotplug (which had been +- * disabled while beginning to freeze tasks). +- */ +-void cpu_hotplug_enable_after_thaw(void) +-{ +- cpu_maps_update_begin(); +- cpu_hotplug_disabled = 0; +- cpu_maps_update_done(); +-} +- +-/* + * When callbacks for CPU hotplug notifications are being executed, we must + * ensure that the state of the system with respect to the tasks being frozen + * or not, as reported by the notification, remains unchanged *throughout the +@@ -527,12 +518,12 @@ cpu_hotplug_pm_callback(struct notifier_ + + case PM_SUSPEND_PREPARE: + case PM_HIBERNATION_PREPARE: +- cpu_hotplug_disable_before_freeze(); ++ cpu_hotplug_disable(); + break; + + case PM_POST_SUSPEND: + case PM_POST_HIBERNATION: +- cpu_hotplug_enable_after_thaw(); ++ cpu_hotplug_enable(); + break; + + default: diff --git a/queue-3.4/drivers-rtc-rtc-twl.c-fix-missing-device_init_wakeup-when-booted-with-device-tree.patch b/queue-3.4/drivers-rtc-rtc-twl.c-fix-missing-device_init_wakeup-when-booted-with-device-tree.patch new file mode 100644 index 00000000000..4922e9af464 --- /dev/null +++ b/queue-3.4/drivers-rtc-rtc-twl.c-fix-missing-device_init_wakeup-when-booted-with-device-tree.patch @@ -0,0 +1,43 @@ +From 24b8256a1fb28d357bc6fa09184ba29b4255ba5c Mon Sep 17 00:00:00 2001 +From: Tony Lindgren +Date: Wed, 12 Jun 2013 14:04:48 -0700 +Subject: drivers/rtc/rtc-twl.c: fix missing device_init_wakeup() when booted with device tree + +From: Tony Lindgren + +commit 24b8256a1fb28d357bc6fa09184ba29b4255ba5c upstream. + +When booted in legacy mode device_init_wakeup() gets called by +drivers/mfd/twl-core.c when the children are initialized. However, when +booted using device tree, the children are created with +of_platform_populate() instead add_children(). + +This means that the RTC driver will not have device_init_wakeup() set, +and we need to call it from the driver probe like RTC drivers typically +do. + +Without this we cannot test PM wake-up events on omaps for cases where +there may not be any physical wake-up event. + +Signed-off-by: Tony Lindgren +Reported-by: Kevin Hilman +Cc: Alessandro Zummo +Cc: Jingoo Han +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/rtc-twl.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/rtc/rtc-twl.c ++++ b/drivers/rtc/rtc-twl.c +@@ -523,6 +523,7 @@ static int __devinit twl_rtc_probe(struc + } + + platform_set_drvdata(pdev, rtc); ++ device_init_wakeup(&pdev->dev, 1); + return 0; + + out2: diff --git a/queue-3.4/drm-gma500-cdv-unpin-framebuffer-on-crtc-disable.patch b/queue-3.4/drm-gma500-cdv-unpin-framebuffer-on-crtc-disable.patch new file mode 100644 index 00000000000..19fa8c2d0bf --- /dev/null +++ b/queue-3.4/drm-gma500-cdv-unpin-framebuffer-on-crtc-disable.patch @@ -0,0 +1,54 @@ +From 22e7c385a80d771aaf3a15ae7ccea3b0686bbe10 Mon Sep 17 00:00:00 2001 +From: Patrik Jakobsson +Date: Sat, 8 Jun 2013 20:23:08 +0200 +Subject: drm/gma500/cdv: Unpin framebuffer on crtc disable + +From: Patrik Jakobsson + +commit 22e7c385a80d771aaf3a15ae7ccea3b0686bbe10 upstream. + +The framebuffer needs to be unpinned in the crtc->disable callback +because of previous pinning in psb_intel_pipe_set_base(). This will fix +a memory leak where the framebuffer was released but not unpinned +properly. This patch only affects Cedarview. + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=889511 +Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=812113 +Reviewed-by: Daniel Vetter +Signed-off-by: Patrik Jakobsson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/gma500/cdv_intel_display.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/gpu/drm/gma500/cdv_intel_display.c ++++ b/drivers/gpu/drm/gma500/cdv_intel_display.c +@@ -1439,6 +1439,19 @@ static void cdv_intel_crtc_destroy(struc + kfree(psb_intel_crtc); + } + ++static void cdv_intel_crtc_disable(struct drm_crtc *crtc) ++{ ++ struct gtt_range *gt; ++ struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; ++ ++ crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); ++ ++ if (crtc->fb) { ++ gt = to_psb_fb(crtc->fb)->gtt; ++ psb_gtt_unpin(gt); ++ } ++} ++ + const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = { + .dpms = cdv_intel_crtc_dpms, + .mode_fixup = cdv_intel_crtc_mode_fixup, +@@ -1446,6 +1459,7 @@ const struct drm_crtc_helper_funcs cdv_i + .mode_set_base = cdv_intel_pipe_set_base, + .prepare = cdv_intel_crtc_prepare, + .commit = cdv_intel_crtc_commit, ++ .disable = cdv_intel_crtc_disable, + }; + + const struct drm_crtc_funcs cdv_intel_crtc_funcs = { diff --git a/queue-3.4/drm-gma500-psb-unpin-framebuffer-on-crtc-disable.patch b/queue-3.4/drm-gma500-psb-unpin-framebuffer-on-crtc-disable.patch new file mode 100644 index 00000000000..154a9555b9b --- /dev/null +++ b/queue-3.4/drm-gma500-psb-unpin-framebuffer-on-crtc-disable.patch @@ -0,0 +1,54 @@ +From 820de86a90089ee607d7864538c98a23b503c846 Mon Sep 17 00:00:00 2001 +From: Patrik Jakobsson +Date: Wed, 5 Jun 2013 14:24:01 +0200 +Subject: drm/gma500/psb: Unpin framebuffer on crtc disable + +From: Patrik Jakobsson + +commit 820de86a90089ee607d7864538c98a23b503c846 upstream. + +The framebuffer needs to be unpinned in the crtc->disable callback +because of previous pinning in psb_intel_pipe_set_base(). This will fix +a memory leak where the framebuffer was released but not unpinned +properly. This patch only affects Poulsbo. + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=889511 +Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=812113 +Reviewed-by: Daniel Vetter +Signed-off-by: Patrik Jakobsson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/gma500/psb_intel_display.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/gpu/drm/gma500/psb_intel_display.c ++++ b/drivers/gpu/drm/gma500/psb_intel_display.c +@@ -1262,6 +1262,19 @@ void psb_intel_crtc_destroy(struct drm_c + kfree(psb_intel_crtc); + } + ++static void psb_intel_crtc_disable(struct drm_crtc *crtc) ++{ ++ struct gtt_range *gt; ++ struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; ++ ++ crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); ++ ++ if (crtc->fb) { ++ gt = to_psb_fb(crtc->fb)->gtt; ++ psb_gtt_unpin(gt); ++ } ++} ++ + const struct drm_crtc_helper_funcs psb_intel_helper_funcs = { + .dpms = psb_intel_crtc_dpms, + .mode_fixup = psb_intel_crtc_mode_fixup, +@@ -1269,6 +1282,7 @@ const struct drm_crtc_helper_funcs psb_i + .mode_set_base = psb_intel_pipe_set_base, + .prepare = psb_intel_crtc_prepare, + .commit = psb_intel_crtc_commit, ++ .disable = psb_intel_crtc_disable, + }; + + const struct drm_crtc_funcs psb_intel_crtc_funcs = { diff --git a/queue-3.4/libceph-must-hold-mutex-for-reset_changed_osds.patch b/queue-3.4/libceph-must-hold-mutex-for-reset_changed_osds.patch new file mode 100644 index 00000000000..106c8450135 --- /dev/null +++ b/queue-3.4/libceph-must-hold-mutex-for-reset_changed_osds.patch @@ -0,0 +1,55 @@ +From 14d2f38df67fadee34625fcbd282ee22514c4846 Mon Sep 17 00:00:00 2001 +From: Alex Elder +Date: Wed, 15 May 2013 16:28:33 -0500 +Subject: libceph: must hold mutex for reset_changed_osds() + +From: Alex Elder + +commit 14d2f38df67fadee34625fcbd282ee22514c4846 upstream. + +An osd client has a red-black tree describing its osds, and +occasionally we would get crashes due to one of these trees tree +becoming corrupt somehow. + +The problem turned out to be that reset_changed_osds() was being +called without protection of the osd client request mutex. That +function would call __reset_osd() for any osd that had changed, and +__reset_osd() would call __remove_osd() for any osd with no +outstanding requests, and finally __remove_osd() would remove the +corresponding entry from the red-black tree. Thus, the tree was +getting modified without having any lock protection, and was +vulnerable to problems due to concurrent updates. + +This appears to be the only osd tree updating path that has this +problem. It can be fairly easily fixed by moving the call up +a few lines, to just before the request mutex gets dropped +in kick_requests(). + +This resolves: + http://tracker.ceph.com/issues/5043 + +Signed-off-by: Alex Elder +Reviewed-by: Sage Weil +Signed-off-by: Greg Kroah-Hartman + +--- + net/ceph/osd_client.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/ceph/osd_client.c ++++ b/net/ceph/osd_client.c +@@ -1337,13 +1337,13 @@ static void kick_requests(struct ceph_os + __register_request(osdc, req); + __unregister_linger_request(osdc, req); + } ++ reset_changed_osds(osdc); + mutex_unlock(&osdc->request_mutex); + + if (needmap) { + dout("%d requests for down osds, need new map\n", needmap); + ceph_monc_request_next_osdmap(&osdc->client->monc); + } +- reset_changed_osds(osdc); + } + + diff --git a/queue-3.4/reboot-rigrate-shutdown-reboot-to-boot-cpu.patch b/queue-3.4/reboot-rigrate-shutdown-reboot-to-boot-cpu.patch new file mode 100644 index 00000000000..458d422a9c0 --- /dev/null +++ b/queue-3.4/reboot-rigrate-shutdown-reboot-to-boot-cpu.patch @@ -0,0 +1,100 @@ +From cf7df378aa4ff7da3a44769b7ff6e9eef1a9f3db Mon Sep 17 00:00:00 2001 +From: Robin Holt +Date: Wed, 12 Jun 2013 14:04:37 -0700 +Subject: reboot: rigrate shutdown/reboot to boot cpu + +From: Robin Holt + +commit cf7df378aa4ff7da3a44769b7ff6e9eef1a9f3db upstream. + +We recently noticed that reboot of a 1024 cpu machine takes approx 16 +minutes of just stopping the cpus. The slowdown was tracked to commit +f96972f2dc63 ("kernel/sys.c: call disable_nonboot_cpus() in +kernel_restart()"). + +The current implementation does all the work of hot removing the cpus +before halting the system. We are switching to just migrating to the +boot cpu and then continuing with shutdown/reboot. + +This also has the effect of not breaking x86's command line parameter +for specifying the reboot cpu. Note, this code was shamelessly copied +from arch/x86/kernel/reboot.c with bits removed pertaining to the +reboot_cpu command line parameter. + +Signed-off-by: Robin Holt +Tested-by: Shawn Guo +Cc: "Srivatsa S. Bhat" +Cc: H. Peter Anvin +Cc: Thomas Gleixner +Cc: Ingo Molnar +Cc: Russ Anderson +Cc: Robin Holt +Cc: Russell King +Cc: Guan Xuetao +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/sys.c | 29 ++++++++++++++++++++++++++--- + 1 file changed, 26 insertions(+), 3 deletions(-) + +--- a/kernel/sys.c ++++ b/kernel/sys.c +@@ -353,6 +353,29 @@ int unregister_reboot_notifier(struct no + } + EXPORT_SYMBOL(unregister_reboot_notifier); + ++/* Add backwards compatibility for stable trees. */ ++#ifndef PF_NO_SETAFFINITY ++#define PF_NO_SETAFFINITY PF_THREAD_BOUND ++#endif ++ ++static void migrate_to_reboot_cpu(void) ++{ ++ /* The boot cpu is always logical cpu 0 */ ++ int cpu = 0; ++ ++ cpu_hotplug_disable(); ++ ++ /* Make certain the cpu I'm about to reboot on is online */ ++ if (!cpu_online(cpu)) ++ cpu = cpumask_first(cpu_online_mask); ++ ++ /* Prevent races with other tasks migrating this task */ ++ current->flags |= PF_NO_SETAFFINITY; ++ ++ /* Make certain I only run on the appropriate processor */ ++ set_cpus_allowed_ptr(current, cpumask_of(cpu)); ++} ++ + /** + * kernel_restart - reboot the system + * @cmd: pointer to buffer containing command to execute for restart +@@ -364,7 +387,7 @@ EXPORT_SYMBOL(unregister_reboot_notifier + void kernel_restart(char *cmd) + { + kernel_restart_prepare(cmd); +- disable_nonboot_cpus(); ++ migrate_to_reboot_cpu(); + syscore_shutdown(); + if (!cmd) + printk(KERN_EMERG "Restarting system.\n"); +@@ -391,7 +414,7 @@ static void kernel_shutdown_prepare(enum + void kernel_halt(void) + { + kernel_shutdown_prepare(SYSTEM_HALT); +- disable_nonboot_cpus(); ++ migrate_to_reboot_cpu(); + syscore_shutdown(); + printk(KERN_EMERG "System halted.\n"); + kmsg_dump(KMSG_DUMP_HALT); +@@ -410,7 +433,7 @@ void kernel_power_off(void) + kernel_shutdown_prepare(SYSTEM_POWER_OFF); + if (pm_power_off_prepare) + pm_power_off_prepare(); +- disable_nonboot_cpus(); ++ migrate_to_reboot_cpu(); + syscore_shutdown(); + printk(KERN_EMERG "Power down.\n"); + kmsg_dump(KMSG_DUMP_POWEROFF); diff --git a/queue-3.4/series b/queue-3.4/series index 9208fd03bcc..0ef063c55f9 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -1 +1,12 @@ b43-stop-format-string-leaking-into-error-msgs.patch +libceph-must-hold-mutex-for-reset_changed_osds.patch +ceph-add-cpu_to_le32-calls-when-encoding-a-reconnect-capability.patch +ceph-ceph_pagelist_append-might-sleep-while-atomic.patch +drivers-rtc-rtc-twl.c-fix-missing-device_init_wakeup-when-booted-with-device-tree.patch +drm-gma500-psb-unpin-framebuffer-on-crtc-disable.patch +drm-gma500-cdv-unpin-framebuffer-on-crtc-disable.patch +bluetooth-fix-mgmt-handling-of-power-on-failures.patch +ath9k-disable-powersave-by-default.patch +ath9k-use-minstrel-rate-control-by-default.patch +cpu-hotplug-provide-a-generic-helper-to-disable-enable-cpu-hotplug.patch +reboot-rigrate-shutdown-reboot-to-boot-cpu.patch