3.14.4-stable review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 3.14.4-stable review
This is the start of the stable review cycle for the 3.14.4 release. There are 83 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 13 19:18:44 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.4-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.14.4-rc1
George Spelvin <[email protected]>
x86-64, build: Fix stack protector Makefile breakage with 32-bit userland
Gerd Hoffmann <[email protected]>
drm: bochs: add power management support
Gerd Hoffmann <[email protected]>
drm: cirrus: add power management support
Chen Gang <[email protected]>
cpufreq: unicore32: fix typo issue for 'clk'
Lan Tianyu <[email protected]>
ACPI / processor: Fix failure of loading acpi-cpufreq driver
Viresh Kumar <[email protected]>
cpufreq: at32ap: don't declare local variable as static
Viresh Kumar <[email protected]>
cpufreq: loongson2_cpufreq: don't declare local variable as static
Hans de Goede <[email protected]>
Input: synaptics - add min/max quirk for ThinkPad Edge E431
Hans de Goede <[email protected]>
Input: synaptics - add min/max quirk for ThinkPad T431s, L440, L540, S1 Yoga and X1
Takashi Iwai <[email protected]>
thinkpad_acpi: Fix inconsistent mute LED after resume
Russell King <[email protected]>
mmc: sdhci-bcm-kona: fix build errors when built-in
Jens Axboe <[email protected]>
lib/percpu_counter.c: fix bad percpu counter state during suspend
Jeff Layton <[email protected]>
lockd: ensure we tear down any live sockets when socket creation fails during lockd_up
Benjamin LaHaise <[email protected]>
aio: v4 ensure access to ctx->ring_pages is correctly serialised for migration
Sekhar Nori <[email protected]>
dma: edma: fix incorrect SG list handling
Joe Thornber <[email protected]>
dm cache: fix a lock-inversion
Mike Snitzer <[email protected]>
dm thin: fix dangling bio in process_deferred_bios error path
Joe Thornber <[email protected]>
dm: take care to copy the space map roots before locking the superblock
Joe Thornber <[email protected]>
dm transaction manager: fix corruption due to non-atomic transaction commit
Mike Snitzer <[email protected]>
dm cache: prevent corruption caused by discard_block_size > cache_block_size
Giacomo Comes <[email protected]>
Skip intel_crt_init for Dell XPS 8700
Dan Carpenter <[email protected]>
mtd: sm_ftl: heap corruption in sm_create_sysfs_attributes()
Dan Carpenter <[email protected]>
mtd: nuc900_nand: NULL dereference in nuc900_nand_enable()
Sasha Levin <[email protected]>
mtd: diskonchip: mem resource name is not optional
Herve Codina <[email protected]>
mtd: atmel_nand: Disable subpage NAND write when using Atmel PMECC
Mikulas Patocka <[email protected]>
tgafb: fix data copying
Mikulas Patocka <[email protected]>
tgafb: fix mode setting with fbset
Andrew Bresticker <[email protected]>
pinctrl: as3722: fix handling of GPIO invert bit
Marek Vasut <[email protected]>
gpio: mxs: Allow for recursive enable_irq_wake() call
Colin Ian King <[email protected]>
rtlwifi: rtl8188ee: initialize packet_beacon
Larry Finger <[email protected]>
rtlwifi: rtl8192se: Fix regression due to commit 1bf4bbb
Larry Finger <[email protected]>
rtlwifi: rtl8192se: Fix too long disable of IRQs
Larry Finger <[email protected]>
rtlwifi: rtl8192cu: Fix too long disable of IRQs
Larry Finger <[email protected]>
rtlwifi: rtl8188ee: Fix too long disable of IRQs
Larry Finger <[email protected]>
rtlwifi: rtl8723ae: Fix too long disable of IRQs
Jeff Layton <[email protected]>
locks: allow __break_lease to sleep even when break_time is 0
Felix Fietkau <[email protected]>
ath9k: fix ready time of the multicast buffer queue
Felix Fietkau <[email protected]>
mac80211: exclude AP_VLAN interfaces from tx power calculation
Johannes Berg <[email protected]>
mac80211: fix software remain-on-channel implementation
Johannes Berg <[email protected]>
mac80211: fix suspend vs. authentication race
Michael Braun <[email protected]>
mac80211: fix WPA with VLAN on AP side with ps-sta again
Johannes Berg <[email protected]>
mac80211: fix potential use-after-free
Ilya Dryomov <[email protected]>
crush: fix off-by-one errors in total_tries refactor
Emmanuel Grumbach <[email protected]>
iwlwifi: mvm: disable uAPSD due to bugs in the firmware
Emmanuel Grumbach <[email protected]>
iwlwifi: dvm: take mutex when sending SYNC BT config command
Martin K. Petersen <[email protected]>
libata: Update queued trim blacklist for M5x0 drives
Alexander Gordeev <[email protected]>
ahci: Do not receive interrupts sent by dummy ports
Alexander Gordeev <[email protected]>
ahci: Ensure "MSI Revert to Single Message" mode is not enforced
Dan Williams <[email protected]>
libata/ahci: accommodate tag ordered controllers
David Milburn <[email protected]>
ahci: do not request irq for dummy port
Thomas Petazzoni <[email protected]>
Revert "net: mvneta: fix usage as a module on RGMII configurations"
Rafał Miłecki <[email protected]>
b43: Fix machine check error due to improper access of B43_MMIO_PSM_PHY_HDR
Mikulas Patocka <[email protected]>
mach64: fix cursor when character width is not a multiple of 8 pixels
Mikulas Patocka <[email protected]>
mach64: use unaligned access
Mikulas Patocka <[email protected]>
matroxfb: restore the registers M_ACCESS and M_PITCH
Mikulas Patocka <[email protected]>
framebuffer: fix cfb_copyarea
Vineet Gupta <[email protected]>
ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe
Steve Dickson <[email protected]>
SUNRPC: Ensure call_connect_status() deals correctly with SOFTCONN tasks
Trond Myklebust <[email protected]>
SUNRPC: Ensure that call_connect times out correctly
Richard Weinberger <[email protected]>
ARC: Remove ARC_HAS_COH_RTSC
Jarkko Nikula <[email protected]>
ASoC: dapm: Fix widget double free with auto-disable DAPM kcontrol
Martin Schwidefsky <[email protected]>
s390/bpf,jit: initialize A register if 1st insn is BPF_S_LDX_B_MSH
Sebastian Ott <[email protected]>
s390/chsc: fix SEI usage on old FW levels
Li Zhong <[email protected]>
powerpc: Fix Oops in rtas_stop_self()
Michael Neuling <[email protected]>
powerpc/tm: Disable IRQ in tm_recheckpoint
Anton Blanchard <[email protected]>
powerpc/compat: 32-bit little endian machine name is ppcle, not ppc
Tyler Stachecki <[email protected]>
mpt2sas: Don't disable device twice at suspend.
Fam Zheng <[email protected]>
virtio-scsi: Skip setting affinity on uninitialized vq
Joel Stanley <[email protected]>
tools/virtio: add a missing )
Rusty Russell <[email protected]>
virtio_balloon: don't softlockup on huge balloon changes.
Huacai Chen <[email protected]>
MIPS: Hibernate: Flush TLB entries in swsusp_arch_resume()
Anton Blanchard <[email protected]>
KVM: PPC: Book3S HV: Fix KVM hang with CONFIG_KVM_XICS=n
James Hogan <[email protected]>
MIPS: KVM: Pass reserved instruction exceptions to guest
Paolo Bonzini <[email protected]>
KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi (CVE-2014-0155)
Oleg Nesterov <[email protected]>
KVM: async_pf: mm->mm_users can not pin apf->mm
Mark Salter <[email protected]>
arm: KVM: fix possible misalignment of PGDs and bounce page
Haibin Wang <[email protected]>
KVM: ARM: vgic: Fix sgi dispatch problem
Matthew Daley <[email protected]>
floppy: don't write kernel-only members to FDRAWCMD ioctl output
Matthew Daley <[email protected]>
floppy: ignore kernel-only members in FDRAWCMD ioctl input
Peter Hurley <[email protected]>
n_tty: Fix n_tty_write crash when echoing in raw mode
Peter Hurley <[email protected]>
tty: Fix lockless tty buffer race
Michael Welling <[email protected]>
tty: serial: 8250_core.c Bug fix for Exar chips.
Tomoki Sekiyama <[email protected]>
drivers/tty/hvc: don't free hvc_console_setup after init
-------------
Diffstat:
Makefile | 4 +- arch/arc/kernel/entry.S | 8 +- arch/arc/plat-arcfpga/Kconfig | 1 - arch/arm/kvm/mmu.c | 15 +- arch/mips/kvm/kvm_mips_emul.c | 7 +- arch/mips/power/hibernate.S | 1 + arch/powerpc/include/asm/compat.h | 4 + arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kernel/process.c | 34 ++- arch/powerpc/kernel/signal_32.c | 2 + arch/powerpc/kernel/signal_64.c | 2 + arch/powerpc/kernel/tm.S | 2 +- arch/powerpc/kvm/book3s_hv.c | 4 +- arch/powerpc/platforms/pseries/hotplug-cpu.c | 5 +- arch/s390/net/bpf_jit_comp.c | 1 - arch/x86/Makefile | 1 + drivers/acpi/acpi_processor.c | 7 +- drivers/ata/ahci.c | 27 +- drivers/ata/ahci.h | 1 + drivers/ata/libata-core.c | 27 +- drivers/block/floppy.c | 11 +- drivers/cpufreq/at32ap-cpufreq.c | 2 +- drivers/cpufreq/loongson2_cpufreq.c | 2 +- drivers/cpufreq/unicore2-cpufreq.c | 2 +- drivers/dma/edma.c | 6 +- drivers/gpio/gpio-mxs.c | 3 +- drivers/gpu/drm/bochs/bochs.h | 1 + drivers/gpu/drm/bochs/bochs_drv.c | 44 ++++ drivers/gpu/drm/cirrus/cirrus_drv.c | 42 +++ drivers/gpu/drm/cirrus/cirrus_mode.c | 3 + drivers/gpu/drm/i915/intel_crt.c | 8 + drivers/input/mouse/synaptics.c | 50 ++++ drivers/md/dm-cache-metadata.c | 98 ++++--- drivers/md/dm-cache-metadata.h | 9 +- drivers/md/dm-cache-target.c | 65 +---- drivers/md/dm-thin-metadata.c | 80 +++--- drivers/md/dm-thin.c | 2 +- drivers/md/persistent-data/dm-block-manager.c | 15 +- drivers/md/persistent-data/dm-block-manager.h | 3 +- .../md/persistent-data/dm-transaction-manager.c | 5 +- .../md/persistent-data/dm-transaction-manager.h | 17 +- drivers/mmc/host/sdhci-bcm-kona.c | 2 +- drivers/mtd/nand/atmel_nand.c | 1 + drivers/mtd/nand/diskonchip.c | 2 +- drivers/mtd/nand/nuc900_nand.c | 2 +- drivers/mtd/sm_ftl.c | 11 +- drivers/net/ethernet/marvell/mvneta.c | 41 ++- drivers/net/wireless/ath/ath9k/xmit.c | 2 +- drivers/net/wireless/b43/phy_n.c | 14 +- drivers/net/wireless/iwlwifi/dvm/main.c | 8 +- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 +- drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | 20 +- drivers/net/wireless/rtlwifi/rtl8188ee/trx.c | 2 +- drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 15 +- drivers/net/wireless/rtlwifi/rtl8192se/hw.c | 27 +- drivers/net/wireless/rtlwifi/rtl8192se/trx.c | 6 + drivers/net/wireless/rtlwifi/rtl8723ae/hw.c | 18 +- drivers/pinctrl/pinctrl-as3722.c | 17 +- drivers/platform/x86/thinkpad_acpi.c | 12 + drivers/s390/cio/chsc.c | 22 +- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 1 - drivers/scsi/virtio_scsi.c | 6 +- drivers/tty/hvc/hvc_console.c | 2 +- drivers/tty/n_tty.c | 4 + drivers/tty/serial/8250/8250_core.c | 2 +- drivers/tty/tty_buffer.c | 17 +- drivers/video/aty/mach64_accel.c | 3 +- drivers/video/aty/mach64_cursor.c | 22 +- drivers/video/cfbcopyarea.c | 153 +++++------ drivers/video/matrox/matroxfb_accel.c | 38 ++- drivers/video/matrox/matroxfb_base.h | 2 + drivers/video/tgafb.c | 282 +++++---------------- drivers/virtio/virtio_balloon.c | 6 + fs/aio.c | 120 +++++---- fs/lockd/svc.c | 1 + fs/locks.c | 7 +- include/linux/libata.h | 1 + lib/percpu_counter.c | 2 +- net/ceph/crush/mapper.c | 46 ++-- net/mac80211/ieee80211_i.h | 1 + net/mac80211/main.c | 2 + net/mac80211/mlme.c | 28 +- net/mac80211/offchannel.c | 1 + net/mac80211/pm.c | 14 +- net/mac80211/tx.c | 2 +- net/sunrpc/clnt.c | 12 +- sound/soc/soc-dapm.c | 1 - tools/virtio/virtio_test.c | 2 +- virt/kvm/arm/vgic.c | 1 + virt/kvm/async_pf.c | 8 +- virt/kvm/ioapic.c | 2 +- 91 files changed, 938 insertions(+), 697 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/83 drivers/tty/hvc: dont free hvc_console_setup after init
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomoki Sekiyama <[email protected]>
commit 501fed45b7e8836ee9373f4d31e2d85e3db6103a upstream.
When 'console=hvc0' is specified to the kernel parameter in x86 KVM guest, hvc console is setup within a kthread. However, that will cause SEGV and the boot will fail when the driver is builtin to the kernel, because currently hvc_console_setup() is annotated with '__init'. This patch removes '__init' to boot the guest successfully with 'console=hvc0'.
--- drivers/tty/hvc/hvc_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/hvc/hvc_console.c +1 -1
@@ -190,7 +190,7 @@ static struct tty_driver *hvc_console_dereturn hvc_driver; } -static int __init hvc_console_setup (struct console *co,char *options) +static int hvc_console_setup (struct console *co,char *options) {if (co->index <0 || co->index >=MAX_NR_HVC_CONSOLES )return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 2/83 tty: serial: 8250_core.c Bug fix for Exar chips.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Welling <[email protected]>
commit b790f210fe8423eff881b2a8a93ba5dbc45534d0 upstream.
The sleep function was updated to put the serial port to sleep only when necessary. This appears to resolve the errant behavior of the driver as described in Kernel Bug 61961 – "My Exar Corp. XR17C/D152 Dual PCI UART modem does not work with 3.8.0".
--- drivers/tty/serial/8250/8250_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +1 -1
@@ -555,7 +555,7 @@ static void serial8250_set_sleep(struct*/ if ((p->port.type ==PORT_XR17V35X ) || (p->port.type ==PORT_XR17D15X )) { -serial_out (p,UART_EXAR_SLEEP ,0xff ); +serial_out (p,UART_EXAR_SLEEP , sleep ?0xff :0 );return ; }
Greg Kroah-Hartman
maintainerPATCH 3/83 tty: Fix lockless tty buffer race
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit 62a0d8d7c2b29f92850e4ee3c38e5dfd936e92b2 upstream.
Commit 6a20dbd6caa2358716136144bf524331d70b1e03,
"tty: Fix race condition between __tty_buffer_request_room and flush_to_ldisc" correctly identifies an unsafe race condition between __tty_buffer_request_room() and flush_to_ldisc(), where the consumer flush_to_ldisc() prematurely advances the head before consuming the last of the data committed. For example:
CPU 0 | CPU 1
__tty_buffer_request_room | flush_to_ldisc
... | ...
| count = head->commit - head->read
n = tty_buffer_alloc() |
b->commit = b->used |
b->next = n |
| if (!count) /* T */
| if (head->next == NULL) /* F */
| buf->head = head->nextIn this case, buf->head has been advanced but head->commit may have been updated with a new value.
Instead of reintroducing an unnecessary lock, fix the race locklessly. Read the commit-next pair in the reverse order of writing, which guarantees the commit value read is the latest value written if the head is advancing.
--- drivers/tty/tty_buffer.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/tty/tty_buffer.c +14 -3
@@ -258,7 +258,11 @@ static int __tty_buffer_request_room(str n->flags = flags; buf->tail = n; b->commit = b->used; -smp_mb (); +/* paired w/ barrier in flush_to_ldisc(); ensures the +* latest commit value can be read before the head is +* advanced to the next buffer +*/ +smp_wmb (); b->next = n; }else if (change) size =0 ;
@@ -444,17 +448,24 @@ static void flush_to_ldisc(struct work_swhile (1 ) {struct tty_buffer *head = buf->head; +struct tty_buffer *next;int count;/* Ldisc or user is trying to gain exclusive access */ if (atomic_read (&buf->priority))break ; + next = head->next; +/* paired w/ barrier in __tty_buffer_request_room(); +* ensures commit value read is not stale if the head +* is advancing to the next buffer +*/ +smp_rmb (); count = head->commit - head->read;if (!count) { -if (head->next ==NULL ) +if (next ==NULL )break ; - buf->head = head->next; + buf->head = next;tty_buffer_free (port, head);continue ; }
Greg Kroah-Hartman
maintainerPATCH 4/83 n_tty: Fix n_tty_write crash when echoing in raw mode
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit 4291086b1f081b869c6d79e5b7441633dc3ace00 upstream.
The tty atomic_write_lock does not provide an exclusion guarantee for the tty driver if the termios settings are LECHO & !OPOST. And since it is unexpected and not allowed to call TTY buffer helpers like tty_insert_flip_string concurrently, this may lead to crashes when concurrect writers call pty_write. In that case the following two writers:
* the ECHOing from a workqueue and
* pty_write from the process
race and can overflow the corresponding TTY buffer like follows.
If we look into tty_insert_flip_string_fixed_flag, there is:
int space = __tty_buffer_request_room(port, goal, flags); struct tty_buffer *tb = port->buf.tail;
...
memcpy(char_buf_ptr(tb, tb->used), chars, space);
...
tb->used += space;
so the race of the two can result in something like this:
A B__tty_buffer_request_room
__tty_buffer_request_roommemcpy(buf(tb->used), ...)
tb->used += space;
memcpy(buf(tb->used), ...) ->BOOMB's memcpy is past the tty_buffer due to the previous A's tb->used increment.
Since the N_TTY line discipline input processing can output concurrently with a tty write, obtain the N_TTY ldisc output_lock to serialize echo output with normal tty writes. This ensures the tty buffer helper tty_insert_flip_string is not called concurrently and everything is fine.
Note that this is nicely reproducible by an ordinary user using forkpty and some setup around that (raw termios + ECHO). And it is present in kernels at least after commit d945cb9cce20ac7143c2de8d88b187f62db99bdc (pty: Rework the pty layer to use the normal buffering logic) in 2.6.31-rc3.
js: add more info to the commit log
js: switch to bool
js: lock unconditionally
js: lock only the tty->ops->write call
References: CVE-2014-0196
--- drivers/tty/n_tty.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/n_tty.c +4 -0
@@ -2356,8 +2356,12 @@ static ssize_t n_tty_write(struct tty_stif (tty->ops->flush_chars) tty->ops->flush_chars (tty); }else { +struct n_tty_data *ldata = tty->disc_data; +while (nr >0 ) { +mutex_lock (&ldata->output_lock); c = tty->ops->write (tty, b, nr); +mutex_unlock (&ldata->output_lock);if (c <0 ) { retval = c; goto break_out;
Greg Kroah-Hartman
maintainerPATCH 5/83 floppy: ignore kernel-only members in FDRAWCMD ioctl input
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Daley <[email protected]>
commit ef87dbe7614341c2e7bfe8d32fcb7028cc97442c upstream.
Always clear out these floppy_raw_cmd struct members after copying the entire structure from userspace so that the in-kernel version is always valid and never left in an interdeterminate state.
--- drivers/block/floppy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/floppy.c +3 -3
@@ -3107,10 +3107,11 @@ loop:return -ENOMEM ; *rcmd = ptr; ret =copy_from_user (ptr, param,sizeof (*ptr)); -if (ret) -return -EFAULT ; ptr->next =NULL ; ptr->buffer_length =0 ; + ptr->kernel_data =NULL ; +if (ret) +return -EFAULT ; param +=sizeof (struct floppy_raw_cmd );if (ptr->cmd_count >33 )/* the command may now also take up the space
@@ -3126,7 +3127,6 @@ loop:for (i =0 ; i <16 ; i++) ptr->reply[i] =0 ; ptr->resultcode =0 ; - ptr->kernel_data =NULL ;if (ptr->flags & (FD_RAW_READ |FD_RAW_WRITE )) {if (ptr->length <=0 )
Greg Kroah-Hartman
maintainerPATCH 6/83 floppy: dont write kernel-only members to FDRAWCMD ioctl output
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Daley <[email protected]>
commit 2145e15e0557a01b9195d1c7199a1b92cb9be81f upstream.
Do not leak kernel-only floppy_raw_cmd structure members to userspace. This includes the linked-list pointer and the pointer to the allocated DMA space.
--- drivers/block/floppy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/block/floppy.c +4 -1
@@ -3053,7 +3053,10 @@ static int raw_cmd_copyout(int cmd, voidint ret;while (ptr) { - ret =copy_to_user (param, ptr,sizeof (*ptr)); +struct floppy_raw_cmd cmd = *ptr; + cmd.next =NULL ; + cmd.kernel_data =NULL ; + ret =copy_to_user (param, &cmd,sizeof (cmd));if (ret)return -EFAULT ; param +=sizeof (struct floppy_raw_cmd );
Greg Kroah-Hartman
maintainerPATCH 7/83 KVM: ARM: vgic: Fix sgi dispatch problem
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haibin Wang <[email protected]>
commit 91021a6c8ffdc55804dab5acdfc7de4f278b9ac3 upstream.
When dispatch SGI(mode == 0), that is the vcpu of VM should send sgi to the cpu which the target_cpus list.
So, there must add the "break" to branch of case 0.
--- virt/kvm/arm/vgic.c | 1 + 1 file changed, 1 insertion(+)
virt/kvm/arm/vgic.c +1 -0
@@ -916,6 +916,7 @@ static void vgic_dispatch_sgi(struct kvmcase 0 :if (!target_cpus)return ; +break ;case 1 : target_cpus = ((1 << nrcpus) -1 ) & ~(1 << vcpu_id) &0xff ;
Greg Kroah-Hartman
maintainerPATCH 8/83 arm: KVM: fix possible misalignment of PGDs and bounce page
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Salter <[email protected]>
commit 5d4e08c45a6cf8f1ab3c7fa375007635ac569165 upstream.
The kvm/mmu code shared by arm and arm64 uses kalloc() to allocate a bounce page (if hypervisor init code crosses page boundary) and hypervisor PGDs. The problem is that kalloc() does not guarantee the proper alignment. In the case of the bounce page, the page sized buffer allocated may also cross a page boundary negating the purpose and leading to a hang during kvm initialization. Likewise the PGDs allocated may not meet the minimum alignment requirements of the underlying MMU. This patch uses __get_free_page() to guarantee the worst case alignment needs of the bounce page and PGDs on both arm and arm64.
--- arch/arm/kvm/mmu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
arch/arm/kvm/mmu.c +9 -6
@@ -42,6 +42,8 @@ static unsigned long hyp_idmap_start;static unsigned long hyp_idmap_end;static phys_addr_t hyp_idmap_vector; +#define pgd_order get_order(PTRS_PER_PGD * sizeof(pgd_t)) +#define kvm_pmd_huge (_x) (pmd_huge(_x) || pmd_trans_huge(_x))static void kvm_tlb_flush_vmid_ipa (struct kvm *kvm,phys_addr_t ipa)
@@ -199,14 +201,14 @@ void free_boot_hyp_pgd(void)if (boot_hyp_pgd) {unmap_range (NULL , boot_hyp_pgd, hyp_idmap_start,PAGE_SIZE );unmap_range (NULL , boot_hyp_pgd,TRAMPOLINE_VA ,PAGE_SIZE ); -kfree (boot_hyp_pgd); +free_pages ((unsigned long )boot_hyp_pgd, pgd_order); boot_hyp_pgd =NULL ; }if (hyp_pgd)unmap_range (NULL , hyp_pgd,TRAMPOLINE_VA ,PAGE_SIZE ); -kfree (init_bounce_page); +free_page ((unsigned long )init_bounce_page); init_bounce_page =NULL ;mutex_unlock (&kvm_hyp_pgd_mutex);
@@ -236,7 +238,7 @@ void free_hyp_pgds(void)for (addr =VMALLOC_START ;is_vmalloc_addr ((void *)addr); addr +=PGDIR_SIZE )unmap_range (NULL , hyp_pgd,KERN_TO_HYP (addr),PGDIR_SIZE ); -kfree (hyp_pgd); +free_pages ((unsigned long )hyp_pgd, pgd_order); hyp_pgd =NULL ; }
@@ -930,7 +932,7 @@ int kvm_mmu_init(void)size_t len = __hyp_idmap_text_end - __hyp_idmap_text_start;phys_addr_t phys_base; - init_bounce_page =kmalloc (PAGE_SIZE ,GFP_KERNEL ); + init_bounce_page = (void *)__get_free_page (GFP_KERNEL );if (!init_bounce_page) {kvm_err ("Couldn't allocate HYP init bounce page\n" ); err = -ENOMEM ;
@@ -956,8 +958,9 @@ int kvm_mmu_init(void) (unsigned long)phys_base); } - hyp_pgd =kzalloc (PTRS_PER_PGD *sizeof (pgd_t),GFP_KERNEL ); - boot_hyp_pgd =kzalloc (PTRS_PER_PGD *sizeof (pgd_t),GFP_KERNEL ); + hyp_pgd = (pgd_t *)__get_free_pages (GFP_KERNEL | __GFP_ZERO, pgd_order); + boot_hyp_pgd = (pgd_t *)__get_free_pages (GFP_KERNEL | __GFP_ZERO, pgd_order); +if (!hyp_pgd || !boot_hyp_pgd) {kvm_err ("Hyp mode PGD not allocated\n" ); err = -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 9/83 KVM: async_pf: mm->mm_users can not pin apf->mm
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 41c22f626254b9dc0376928cae009e73d1b6a49a upstream.
get_user_pages(mm) is simply wrong if mm->mm_users == 0 and exit_mmap/etc was already called (or is in progress), mm->mm_count can only pin mm->pgd and mm_struct itself.
Change kvm_setup_async_pf/async_pf_execute to inc/dec mm->mm_users.
kvm_create_vm/kvm_destroy_vm play with ->mm_count too but this case looks fine at first glance, it seems that this ->mm is only used to verify that current->mm == kvm->mm.
--- virt/kvm/async_pf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
virt/kvm/async_pf.c +4 -4
@@ -85,7 +85,7 @@ static void async_pf_execute(struct workif (waitqueue_active (&vcpu->wq))wake_up_interruptible (&vcpu->wq); -mmdrop (mm); +mmput (mm);kvm_put_kvm (vcpu->kvm); }
@@ -98,7 +98,7 @@ void kvm_clear_async_pf_completion_queue typeof(*work), queue);list_del (&work->queue);if (cancel_work_sync (&work->work)) { -mmdrop (work->mm); +mmput (work->mm);kvm_put_kvm (vcpu->kvm);/* == work->vcpu->kvm */ kmem_cache_free (async_pf_cache, work); }
@@ -162,7 +162,7 @@ int kvm_setup_async_pf(struct kvm_vcpu * work->addr =gfn_to_hva (vcpu->kvm, gfn); work->arch = *arch; work->mm = current->mm; -atomic_inc (&work->mm->mm_count); +atomic_inc (&work->mm->mm_users);kvm_get_kvm (work->vcpu->kvm);/* this can't really happen otherwise gfn_to_pfn_async
@@ -180,7 +180,7 @@ int kvm_setup_async_pf(struct kvm_vcpu *return 1 ; retry_sync:kvm_put_kvm (work->vcpu->kvm); -mmdrop (work->mm); +mmput (work->mm);kmem_cache_free (async_pf_cache, work);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 10/83 KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi (CVE-2014-0155)
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit 5678de3f15010b9022ee45673f33bcfc71d47b60 upstream.
QE reported that they got the BUG_ON in ioapic_service to trigger. I cannot reproduce it, but there are two reasons why this could happen.
The less likely but also easiest one, is when kvm_irq_delivery_to_apic does not deliver to any APIC and returns -1.
Because irqe.shorthand == 0, the kvm_for_each_vcpu loop in that function is never reached. However, you can target the similar loop in kvm_irq_delivery_to_apic_fast; just program a zero logical destination address into the IOAPIC, or an out-of-range physical destination address.
--- virt/kvm/ioapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/ioapic.c +1 -1
@@ -306,7 +306,7 @@ static int ioapic_deliver(struct kvm_ioaBUG_ON (ioapic->rtc_status.pending_eoi !=0 ); ret =kvm_irq_delivery_to_apic (ioapic->kvm,NULL , &irqe, ioapic->rtc_status.dest_map); - ioapic->rtc_status.pending_eoi = ret; + ioapic->rtc_status.pending_eoi = (ret <0 ?0 : ret); }else ret =kvm_irq_delivery_to_apic (ioapic->kvm,NULL , &irqe,NULL );
Greg Kroah-Hartman
maintainerPATCH 11/83 MIPS: KVM: Pass reserved instruction exceptions to guest
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit 15505679362270d02c449626385cb74af8905514 upstream.
Previously a reserved instruction exception while in guest code would cause a KVM internal error if kvm_mips_handle_ri() didn't recognise the instruction (including a RDHWR from an unrecognised hardware register).
However the guest OS should really have the opportunity to catch the exception so that it can take the appropriate actions such as sending a SIGILL to the guest user process or emulating the instruction itself.
Therefore in these cases emulate a guest RI exception and only return EMULATE_FAIL if that fails, being careful to revert the PC first in case the exception occurred in a branch delay slot in which case the PC will already point to the branch target.
Also turn the printk messages relating to these cases into kvm_debug messages so that they aren't usually visible.
This allows crashme to run in the guest without killing the entire VM.
--- arch/mips/kvm/kvm_mips_emul.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/mips/kvm/kvm_mips_emul.c +4 -3
@@ -1571,17 +1571,17 @@ kvm_mips_handle_ri(unsigned long cause, arch->gprs[rt] =kvm_read_c0_guest_userlocal (cop0);#else /* UserLocal not implemented */ - er =kvm_mips_emulate_ri_exc (cause, opc, run, vcpu); + er =EMULATE_FAIL ;#endif break ;default : -printk ("RDHWR not supported\n" ); +kvm_debug ("RDHWR %#x not supported @ %p\n" , rd, opc); er =EMULATE_FAIL ;break ; } }else { -printk ("Emulate RI not supported @ %p: %#x\n" , opc, inst); +kvm_debug ("Emulate RI not supported @ %p: %#x\n" , opc, inst); er =EMULATE_FAIL ; }
@@ -1590,6 +1590,7 @@ kvm_mips_handle_ri(unsigned long cause,*/ if (er ==EMULATE_FAIL ) { vcpu->arch.pc = curr_pc; + er =kvm_mips_emulate_ri_exc (cause, opc, run, vcpu); }return er; }
Greg Kroah-Hartman
maintainerPATCH 12/83 KVM: PPC: Book3S HV: Fix KVM hang with CONFIG_KVM_XICS=n
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 7505258c5fcb0a1cc3c76a47b4cf9506d21d10e6 upstream.
I noticed KVM is broken when KVM in-kernel XICS emulation (CONFIG_KVM_XICS) is disabled.
The problem was introduced in 48eaef05 (KVM: PPC: Book3S HV: use xics_wake_cpu only when defined). It used CONFIG_KVM_XICS to wrap xics_wake_cpu, where CONFIG_PPC_ICP_NATIVE should have been used.
--- arch/powerpc/kvm/book3s_hv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/kvm/book3s_hv.c +1 -3
@@ -86,7 +86,7 @@ static void kvmppc_fast_vcpu_kick_hv(str/* CPU points to the first thread of the core */ if (cpu != me && cpu >=0 && cpu < nr_cpu_ids) { -#ifdef CONFIG_KVM_XICS +#ifdef CONFIG_PPC_ICP_NATIVE int real_cpu = cpu + vcpu->arch.ptid;if (paca[real_cpu].kvm_hstate.xics_phys)xics_wake_cpu (real_cpu);
@@ -1360,9 +1360,7 @@ static void kvmppc_start_thread(struct ksmp_wmb ();#if defined(CONFIG_PPC_ICP_NATIVE ) && defined(CONFIG_SMP )if (cpu !=smp_processor_id ()) { -#ifdef CONFIG_KVM_XICS xics_wake_cpu (cpu); -#endif if (vcpu->arch.ptid) ++vc->n_woken; }
Greg Kroah-Hartman
maintainerPATCH 13/83 MIPS: Hibernate: Flush TLB entries in swsusp_arch_resume()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit c14af233fbe279d0e561ecf84f1208b1bae087ef upstream.
The original MIPS hibernate code flushes cache and TLB entries in swsusp_arch_resume(). But they are removed in Commit 44eeab67416711 (MIPS: Hibernation: Remove SMP TLB and cacheflushing code.). A cross- CPU flush is surely unnecessary because all but the local CPU have already been disabled. But a local flush (at least the TLB flush) is needed. When we do hibernation on Loongson-3 with an E1000E NIC, it is very easy to produce a kernel panic (kernel page fault, or unaligned access). The root cause is E1000E driver use vzalloc_node() to allocate pages, the stale TLB entries of the booting kernel will be misused by the resumed target kernel.
Patchwork: https://patchwork.linux-mips.org/patch/6643/
--- arch/mips/power/hibernate.S | 1 + 1 file changed, 1 insertion(+)
arch/mips/power/hibernate.S +1 -0
@@ -43,6 +43,7 @@ LEAF(swsusp_arch_resume) bne t1, t3, 1b PTR_L t0, PBE_NEXT(t0) bnez t0, 0b + jal local_flush_tlb_all /* Avoid TLB mismatch after kernel resume */ PTR_LA t0, saved_regs PTR_L ra, PT_R31(t0) PTR_L sp, PT_R29(t0)
Greg Kroah-Hartman
maintainerPATCH 14/83 virtio_balloon: dont softlockup on huge balloon changes.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rusty Russell <[email protected]>
commit 1f74ef0f2d7d692fcd615621e0e734c3e7771413 upstream.
When adding or removing 100G from a balloon:
BUG: soft lockup - CPU#0 stuck for 22s! [vballoon:367]
We have a wait_event_interruptible(), but the condition is always true (more ballooning to do) so we don't ever sleep. We also have a wait_event() for the host to ack, but that is also always true as QEMU is synchronous for balloon operations.
--- drivers/virtio/virtio_balloon.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/virtio/virtio_balloon.c +6 -0
@@ -310,6 +310,12 @@ static int balloon(void *_vballoon)else if (diff <0 )leak_balloon (vb, -diff);update_balloon_size (vb); + +/* +* For large balloon changes, we could spend a lot of time +* and always have work to do. Be nice if preempt disabled. +*/ +cond_resched (); }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 15/83 tools/virtio: add a missing )
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Stanley <[email protected]>
commit be40d5ccab34d579512d932fc1c6cfaffe9d1551 upstream.
Fixes the following build failure:
cc -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign
-fno-strict-overflow -fno-strict-aliasing -fno-common -MMD
-U_FORTIFY_SOURCE -c -o virtio_test.o virtio_test.c
virtio_test.c: In function ‘run_test’:
virtio_test.c:176:7: error: expected ‘)’ before ‘r’
r = -1;
^--- tools/virtio/virtio_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/virtio/virtio_test.c +1 -1
@@ -172,7 +172,7 @@ static void run_test(struct vdev_info *d GFP_ATOMIC);if (likely (r ==0 )) { ++started; - if (unlikely(!virtqueue_kick(vq->vq)) +if (unlikely (!virtqueue_kick (vq->vq))) r =-1 ; } }else
Greg Kroah-Hartman
maintainerPATCH 16/83 virtio-scsi: Skip setting affinity on uninitialized vq
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fam Zheng <[email protected]>
commit 0c8482ac92db5ac15792caf23b7f7df9e4f48ae1 upstream.
virtscsi_init calls virtscsi_remove_vqs on err, even before initializing the vqs. The latter calls virtscsi_set_affinity, so let's check the pointer there before setting affinity on it.
This fixes a panic when setting device's num_queues=2 on RHEL 6.5:
qemu-system-x86_64 ... \
-device virtio-scsi-pci,id=scsi0,addr=0x13,...,num_queues=2 \
-drive file=/stor/vm/dummy.raw,id=drive-scsi-disk,... \
-device scsi-hd,drive=drive-scsi-disk,...
[ 0.354734] scsi0 : Virtio SCSI HBA [ 0.379504] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 [ 0.380141] IP: [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120 [ 0.380141] PGD 0 [ 0.380141] Oops: 0000 [#1] SMP [ 0.380141] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #5 [ 0.380141] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007 [ 0.380141] task: ffff88003c9f0000 ti: ffff88003c9f8000 task.ti: ffff88003c9f8000 [ 0.380141] RIP: 0010:[<ffffffff814741ef>] [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120 [ 0.380141] RSP: 0000:ffff88003c9f9c08 EFLAGS: 00010256 [ 0.380141] RAX: 0000000000000000 RBX: ffff88003c3a9d40 RCX: 0000000000001070 [ 0.380141] RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000 [ 0.380141] RBP: ffff88003c9f9c28 R08: 00000000000136c0 R09: ffff88003c801c00 [ 0.380141] R10: ffffffff81475229 R11: 0000000000000008 R12: 0000000000000000 [ 0.380141] R13: ffffffff81cc7ca8 R14: ffff88003cac3d40 R15: ffff88003cac37a0 [ 0.380141] FS: 0000000000000000(0000) GS:ffff88003e400000(0000) knlGS:0000000000000000 [ 0.380141] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 0.380141] CR2: 0000000000000020 CR3: 0000000001c0e000 CR4: 00000000000006f0 [ 0.380141] Stack: [ 0.380141] ffff88003c3a9d40 0000000000000000 ffff88003cac3d80 ffff88003cac3d40 [ 0.380141] ffff88003c9f9c48 ffffffff814742e8 ffff88003c26d000 ffff88003c26d000 [ 0.380141] ffff88003c9f9c68 ffffffff81474321 ffff88003c26d000 ffff88003c3a9d40 [ 0.380141] Call Trace: [ 0.380141] [<ffffffff814742e8>] virtscsi_set_affinity+0x28/0x40 [ 0.380141] [<ffffffff81474321>] virtscsi_remove_vqs+0x21/0x50 [ 0.380141] [<ffffffff81475231>] virtscsi_init+0x91/0x240 [ 0.380141] [<ffffffff81365290>] ? vp_get+0x50/0x70 [ 0.380141] [<ffffffff81475544>] virtscsi_probe+0xf4/0x280 [ 0.380141] [<ffffffff81363ea5>] virtio_dev_probe+0xe5/0x140 [ 0.380141] [<ffffffff8144c669>] driver_probe_device+0x89/0x230 [ 0.380141] [<ffffffff8144c8ab>] __driver_attach+0x9b/0xa0 [ 0.380141] [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230 [ 0.380141] [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230 [ 0.380141] [<ffffffff8144ac1c>] bus_for_each_dev+0x8c/0xb0 [ 0.380141] [<ffffffff8144c499>] driver_attach+0x19/0x20 [ 0.380141] [<ffffffff8144bf28>] bus_add_driver+0x198/0x220 [ 0.380141] [<ffffffff8144ce9f>] driver_register+0x5f/0xf0 [ 0.380141] [<ffffffff81d27c91>] ? spi_transport_init+0x79/0x79 [ 0.380141] [<ffffffff8136403b>] register_virtio_driver+0x1b/0x30 [ 0.380141] [<ffffffff81d27d19>] init+0x88/0xd6 [ 0.380141] [<ffffffff81d27c18>] ? scsi_init_procfs+0x5b/0x5b [ 0.380141] [<ffffffff81ce88a7>] do_one_initcall+0x7f/0x10a [ 0.380141] [<ffffffff81ce8aa7>] kernel_init_freeable+0x14a/0x1de [ 0.380141] [<ffffffff81ce8b3b>] ? kernel_init_freeable+0x1de/0x1de [ 0.380141] [<ffffffff817dec20>] ? rest_init+0x80/0x80 [ 0.380141] [<ffffffff817dec29>] kernel_init+0x9/0xf0 [ 0.380141] [<ffffffff817e68fc>] ret_from_fork+0x7c/0xb0 [ 0.380141] [<ffffffff817dec20>] ? rest_init+0x80/0x80 [ 0.380141] RIP [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120 [ 0.380141] RSP <ffff88003c9f9c08> [ 0.380141] CR2: 0000000000000020 [ 0.380141] ---[ end trace 8074b70c3d5e1d73 ]--- [ 0.475018] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 0.475018] [ 0.475068] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff) [ 0.475068] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
--- drivers/scsi/virtio_scsi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/virtio_scsi.c +5 -1
@@ -750,8 +750,12 @@ static void __virtscsi_set_affinity(stru vscsi->affinity_hint_set = true; }else { -for (i =0 ; i < vscsi->num_queues; i++) +for (i =0 ; i < vscsi->num_queues; i++) { +if (!vscsi->req_vqs[i].vq) +continue ; +virtqueue_set_affinity (vscsi->req_vqs[i].vq,-1 ); + } vscsi->affinity_hint_set = false; }
Greg Kroah-Hartman
maintainerPATCH 17/83 mpt2sas: Dont disable device twice at suspend.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Stachecki <[email protected]>
commit af61e27c3f77c7623b5335590ae24b6a5c323e22 upstream.
On suspend, _scsih_suspend calls mpt2sas_base_free_resources, which in turn calls pci_disable_device if the device is enabled prior to suspending. However, _scsih_suspend also calls pci_disable_device itself.
Thus, in the event that the device is enabled prior to suspending, pci_disable_device will be called twice. This patch removes the duplicate call to pci_disable_device in _scsi_suspend as it is both unnecessary and results in a kernel oops.
--- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/mpt2sas/mpt2sas_scsih.c +0 -1
@@ -8293,7 +8293,6 @@ _scsih_suspend(struct pci_dev *pdev, pm_mpt2sas_base_free_resources (ioc);pci_save_state (pdev); -pci_disable_device (pdev);pci_set_power_state (pdev, device_state);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 18/83 powerpc/compat: 32-bit little endian machine name is ppcle, not ppc
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 422b9b9684db3c511e65c91842275c43f5910ae9 upstream.
I noticed this when testing setarch. No, we don't magically support a big endian userspace on a little endian kernel.
--- arch/powerpc/include/asm/compat.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/include/asm/compat.h +4 -0
@@ -8,7 +8,11 @@#include <linux/sched.h> #define COMPAT_USER_HZ 100 +#ifdef __BIG_ENDIAN__#define COMPAT_UTS_MACHINE "ppc\0\0" +#else +#define COMPAT_UTS_MACHINE "ppcle\0\0" +#endif typedef u32 compat_size_t ;typedef s32 compat_ssize_t ;
Greg Kroah-Hartman
maintainerPATCH 19/83 powerpc/tm: Disable IRQ in tm_recheckpoint
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Neuling <[email protected]>
commit e6b8fd028b584ffca7a7255b8971f254932c9fce upstream.
We can't take an IRQ when we're about to do a trechkpt as our GPR state is set to user GPR values.
We've hit this when running some IBM Java stress tests in the lab resulting in the following dump:
cpu 0x3f: Vector: 700 (Program Check) at [c000000007eb3d40]
pc: c000000000050074: restore_gprs+0xc0/0x148
lr: 00000000b52a8184
sp: ac57d360
msr: 8000000100201030
current = 0xc00000002c500000
paca = 0xc000000007dbfc00 softe: 0 irq_happened: 0x00
pid = 34535, comm = Pooled Thread #
R00 = 00000000b52a8184 R16 = 00000000b3e48fda
R01 = 00000000ac57d360 R17 = 00000000ade79bd8
R02 = 00000000ac586930 R18 = 000000000fac9bcc
R03 = 00000000ade60000 R19 = 00000000ac57f930
R04 = 00000000f6624918 R20 = 00000000ade79be8
R05 = 00000000f663f238 R21 = 00000000ac218a54
R06 = 0000000000000002 R22 = 000000000f956280
R07 = 0000000000000008 R23 = 000000000000007e
R08 = 000000000000000a R24 = 000000000000000c
R09 = 00000000b6e69160 R25 = 00000000b424cf00
R10 = 0000000000000181 R26 = 00000000f66256d4
R11 = 000000000f365ec0 R27 = 00000000b6fdcdd0
R12 = 00000000f66400f0 R28 = 0000000000000001
R13 = 00000000ada71900 R29 = 00000000ade5a300
R14 = 00000000ac2185a8 R30 = 00000000f663f238
R15 = 0000000000000004 R31 = 00000000f6624918 pc = c000000000050074 restore_gprs+0xc0/0x148 cfar= c00000000004fe28 dont_restore_vec+0x1c/0x1a4 lr = 00000000b52a8184
msr = 8000000100201030 cr = 24804888
ctr = 0000000000000000 xer = 0000000000000000 trap = 700
This moves tm_recheckpoint to a C function and moves the tm_restore_sprs into that function. It then adds IRQ disabling over the trechkpt critical section. It also sets the TEXASR FS in the signals code to ensure this is never set now that we explictly write the TM sprs in tm_recheckpoint.
--- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kernel/process.c | 34 ++++++++++++++++++++++++++++------ arch/powerpc/kernel/signal_32.c | 2 ++ arch/powerpc/kernel/signal_64.c | 2 ++ arch/powerpc/kernel/tm.S | 2 +- 5 files changed, 34 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/reg.h +1 -0
@@ -213,6 +213,7 @@#define SPRN_ACOP 0x1F/* Available Coprocessor Register */ #define SPRN_TFIAR 0x81/* Transaction Failure Inst Addr */ #define SPRN_TEXASR 0x82/* Transaction EXception & Summary */ +#define TEXASR_FS __MASK(63-36)/* Transaction Failure Summary */ #define SPRN_TEXASRU 0x83/* '' '' '' Upper 32 */ #define SPRN_TFHAR 0x80/* Transaction Failure Handler Addr */ #define SPRN_CTRLF 0x088
arch/powerpc/kernel/process.c +28 -6
@@ -610,6 +610,31 @@ out_and_saveregs:tm_save_sprs (thr); } +extern void __tm_recheckpoint (struct thread_struct *thread, +unsigned long orig_msr); + +void tm_recheckpoint (struct thread_struct *thread, +unsigned long orig_msr) +{ +unsigned long flags; + +/* We really can't be interrupted here as the TEXASR registers can't +* change and later in the trecheckpoint code, we have a userspace R1. +* So let's hard disable over this region. +*/ +local_irq_save (flags); +hard_irq_disable (); + +/* The TM SPRs are restored here, so that TEXASR.FS can be set +* before the trecheckpoint and no explosion occurs. +*/ +tm_restore_sprs (thread); + +__tm_recheckpoint (thread, orig_msr); + +local_irq_restore (flags); +} +static inline void tm_recheckpoint_new_task (struct task_struct *new) {unsigned long msr;
@@ -628,13 +653,10 @@ static inline void tm_recheckpoint_new_tif (!new->thread.regs)return ; -/* The TM SPRs are restored here, so that TEXASR.FS can be set -* before the trecheckpoint and no explosion occurs. -*/ -tm_restore_sprs (&new->thread); - -if (!MSR_TM_ACTIVE (new->thread.regs->msr)) +if (!MSR_TM_ACTIVE (new->thread.regs->msr)){ +tm_restore_sprs (&new->thread);return ; + } msr = new->thread.tm_orig_msr;/* Recheckpoint to restore original checkpointed register state. */ TM_DEBUG("*** tm_recheckpoint of pid %d "
arch/powerpc/kernel/signal_32.c +2 -0
@@ -881,6 +881,8 @@ static long restore_tm_user_regs(struct* transactional versions should be loaded. */ tm_enable (); +/* Make sure the transaction is marked as failed */ + current->thread.tm_texasr |=TEXASR_FS ;/* This loads the checkpointed FP/VEC state, if used */ tm_recheckpoint (¤t->thread, msr);/* Get the top half of the MSR */
arch/powerpc/kernel/signal_64.c +2 -0
@@ -527,6 +527,8 @@ static long restore_tm_sigcontexts(struc }#endif tm_enable (); +/* Make sure the transaction is marked as failed */ + current->thread.tm_texasr |=TEXASR_FS ;/* This loads the checkpointed FP/VEC state, if used */ tm_recheckpoint (¤t->thread, msr);
arch/powerpc/kernel/tm.S +1 -1
@@ -307,7 +307,7 @@ dont_backup_fp: * Call with IRQs off, stacks get all out of sync for * some periods in here! */ -_GLOBAL(tm_recheckpoint) +_GLOBAL(__tm_recheckpoint) mfcr r5 mflr r0 stw r5, 8(r1)
Greg Kroah-Hartman
maintainerPATCH 20/83 powerpc: Fix Oops in rtas_stop_self()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zhong <[email protected]>
commit 4fb8d027dca0236c811272d342cf185569d91311 upstream.
commit 41dd03a9 may cause Oops in rtas_stop_self().
The reason is that the rtas_args was moved into stack space. For a box with more that 4GB RAM, the stack could easily be outside 32bit range, but RTAS is 32bit.
So the patch moves rtas_args away from stack by adding static before it.
--- arch/powerpc/platforms/pseries/hotplug-cpu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/hotplug-cpu.c +3 -2
@@ -88,13 +88,14 @@ void set_default_offline_state(int cpu)static void rtas_stop_self (void ) { -struct rtas_args args = { - .token =cpu_to_be32 (rtas_stop_self_token), +static struct rtas_args args = { .nargs =0 , .nret =1 , .rets = &args.args[0 ], }; + args.token =cpu_to_be32 (rtas_stop_self_token); +local_irq_disable ();BUG_ON (rtas_stop_self_token ==RTAS_UNKNOWN_SERVICE );
Greg Kroah-Hartman
maintainerPATCH 21/83 s390/chsc: fix SEI usage on old FW levels
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
commit 06cd7a874ec6e09d151aeb1fa8600e14f1ff89f6 upstream.
Using a notification type mask for the store event information chsc is unsupported on some firmware levels. Retry SEI with that mask set to zero (which is the old way of requesting only channel subsystem related events).
--- drivers/s390/cio/chsc.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/s390/cio/chsc.c +17 -5
@@ -541,18 +541,27 @@ static void chsc_process_sei_nt0(structstatic void chsc_process_event_information (struct chsc_sei *sei,u64 ntsm) { - do { +static int ntsm_unsupported; + +while (true) {memset (sei,0 ,sizeof (*sei)); sei->request.length =0x0010 ; sei->request.code =0x000e ; - sei->ntsm = ntsm; +if (!ntsm_unsupported) + sei->ntsm = ntsm;if (chsc (sei))break ;if (sei->response.code !=0x0001 ) { - CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n", - sei->response.code); +CIO_CRW_EVENT (2 ,"chsc: sei failed (rc=%04x, ntsm=%llx)\n" , + sei->response.code, sei->ntsm); + +if (sei->response.code ==3 && sei->ntsm) { +/* Fallback for old firmware. */ + ntsm_unsupported =1 ; +continue ; + }break ; }
@@ -568,7 +577,10 @@ static void chsc_process_event_informatiCIO_CRW_EVENT (2 ,"chsc: unhandled nt: %d\n" , sei->nt);break ; } - }while (sei->u.nt0_area.flags &0x80 ); + +if (!(sei->u.nt0_area.flags &0x80 )) +break ; + } }/*
Greg Kroah-Hartman
maintainerPATCH 22/83 s390/bpf,jit: initialize A register if 1st insn is BPF_S_LDX_B_MSH
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 6e0de817594c61f3b392a9245deeb09609ec707d upstream.
The A register needs to be initialized to zero in the prolog if the first instruction of the BPF program is BPF_S_LDX_B_MSH to prevent leaking the content of %r5 to user space.
--- arch/s390/net/bpf_jit_comp.c | 1 - 1 file changed, 1 deletion(-)
arch/s390/net/bpf_jit_comp.c +0 -1
@@ -276,7 +276,6 @@ static void bpf_jit_noleaks(struct bpf_jcase BPF_S_LD_W_IND :case BPF_S_LD_H_IND :case BPF_S_LD_B_IND : -case BPF_S_LDX_B_MSH :case BPF_S_LD_IMM :case BPF_S_LD_MEM :case BPF_S_MISC_TXA :
Greg Kroah-Hartman
maintainerPATCH 23/83 ASoC: dapm: Fix widget double free with auto-disable DAPM kcontrol
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Nikula <[email protected]>
commit 2697e4fb9209dfe1d1b24c92d254158f63d4bc8e upstream.
Commit 9e1fda4ae158 ("ASoC: dapm: Implement mixer input auto-disable") is trying to free the widget it allocated by snd_soc_dapm_new_control() call in dapm_kcontrol_data_alloc() by adding kfree(data->widget) to dapm_kcontrol_free().
This is causing a widget double free with auto-disabled DAPM kcontrols in sound card unregistration because widgets are already freed before dapm_kcontrol_free() is called.
Reason for that is all widgets are added into dapm->card->widgets list in snd_soc_dapm_new_control() and freed in dapm_free_widgets() during execution of snd_soc_dapm_free().
Now snd_soc_dapm_free() calls for different DAPM contexts happens before snd_card_free() call from where the call chain to dapm_kcontrol_free() begins:
soc_cleanup_card_resources()
soc_remove_dai_links()
soc_remove_link_dais()
snd_soc_dapm_free(&cpu_dai->dapm)
soc_remove_link_components()
soc_remove_platform()
snd_soc_dapm_free(&platform->dapm)
soc_remove_codec()
snd_soc_dapm_free(&codec->dapm)
snd_soc_dapm_free(&card->dapm)
snd_card_free()
snd_card_do_free()
snd_device_free_all()
snd_device_free()
snd_ctl_dev_free()
snd_ctl_remove()
snd_ctl_free_one()
dapm_kcontrol_free()This wasn't making harm with ordinary DAPM kcontrols since data->widget is NULL for them.
--- sound/soc/soc-dapm.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/soc-dapm.c +0 -1
@@ -251,7 +251,6 @@ static int dapm_kcontrol_data_alloc(strustatic void dapm_kcontrol_free (struct snd_kcontrol *kctl) {struct dapm_kcontrol_data *data =snd_kcontrol_chip (kctl); -kfree (data->widget);kfree (data->wlist);kfree (data); }
Greg Kroah-Hartman
maintainerPATCH 24/83 ARC: Remove ARC_HAS_COH_RTSC
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit d345ea2892ae7a2b70f84cf881c20731e43e4993 upstream.
The symbol is an orphan, get rid of it.
--- arch/arc/plat-arcfpga/Kconfig | 1 - 1 file changed, 1 deletion(-)
arch/arc/plat-arcfpga/Kconfig +0 -1
@@ -33,7 +33,6 @@ config ISS_SMP_EXTN bool "ARC SMP Extensions (ISS Models only)" default n depends on SMP - select ARC_HAS_COH_RTSC help SMP Extensions to ARC700, in a "simulation only" Model, supported in ARC ISS (Instruction Set Simulator).
Greg Kroah-Hartman
maintainerPATCH 25/83 SUNRPC: Ensure that call_connect times out correctly
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 485f2251782f7c44299c491d4676a8a01428d191 upstream.
When the server is unavailable due to a networking error, etc, we want the RPC client to respect the timeout delays when attempting to reconnect.
--- net/sunrpc/clnt.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/sunrpc/clnt.c +3 -5
@@ -1798,10 +1798,6 @@ call_connect_status(struct rpc_task *tastrace_rpc_connect_status (task, status); task->tk_status =0 ;switch (status) { -/* if soft mounted, test if we've timed out */ -case -ETIMEDOUT : - task->tk_action = call_timeout; -return ;case -ECONNREFUSED :case -ECONNRESET :case -ECONNABORTED :
@@ -1812,7 +1808,9 @@ call_connect_status(struct rpc_task *tasif (RPC_IS_SOFTCONN (task))break ;case -EAGAIN : - task->tk_action = call_bind; +/* Check for timeouts before looping back to call_bind */ +case -ETIMEDOUT : + task->tk_action = call_timeout;return ;case 0 : clnt->cl_stats->netreconn++;
Greg Kroah-Hartman
maintainerPATCH 26/83 SUNRPC: Ensure call_connect_status() deals correctly with SOFTCONN tasks
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Dickson <[email protected]>
commit 1fa3e2eb9db07f30a605c66d1a2fdde4b24e74d5 upstream.
Don't schedule an rpc_delay before checking to see if the task is a SOFTCONN because the tk_callback from the delay (__rpc_atrun) clears the task status before the rpc_exit_task can be run.
--- net/sunrpc/clnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/clnt.c +2 -2
@@ -1803,10 +1803,10 @@ call_connect_status(struct rpc_task *tascase -ECONNABORTED :case -ENETUNREACH :case -EHOSTUNREACH : -/* retry with existing socket, after a delay */ -rpc_delay (task,3 *HZ );if (RPC_IS_SOFTCONN (task))break ; +/* retry with existing socket, after a delay */ +rpc_delay (task,3 *HZ );case -EAGAIN :/* Check for timeouts before looping back to call_bind */ case -ETIMEDOUT :
Greg Kroah-Hartman
maintainerPATCH 27/83 ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit 8aa9e85adac609588eeec356e5a85059b3b819ba upstream.
There was a very small race window where resume to kernel mode from a Exception Path (or pure kernel mode which is true for most of ARC exceptions anyways), was not disabling interrupts in restore_regs, clobbering the exception regs
Anton found the culprit call flow (after many sleepless nights)
| 1. we got a Trap from user land | 2. started to service it. | 3. While doing some stuff on user-land memory (I think it is padzero()), | we got a DataTlbMiss | 4. On return from it we are taking "resume_kernel_mode" path | 5. NEED_RESHED is not set, so we go to "return from exception" path in | restore regs. | 6. there seems to be IRQ happening
--- arch/arc/kernel/entry.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/arc/kernel/entry.S +5 -3
@@ -614,11 +614,13 @@ resume_user_mode_begin: resume_kernel_mode: -#ifdef CONFIG_PREEMPT - - ; This is a must for preempt_schedule_irq() + ; Disable Interrupts from this point on + ; CONFIG_PREEMPT: This is a must for preempt_schedule_irq() + ; !CONFIG_PREEMPT: To ensure restore_regs is intr safe IRQ_DISABLE r9 +#ifdef CONFIG_PREEMPT + ; Can't preempt if preemption disabled GET_CURR_THR_INFO_FROM_SP r10 ld r8, [r10, THREAD_INFO_PREEMPT_COUNT]
Re: [PATCH 3.14 27/83] ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe
Quoted 7 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit
8aa9e85adac609588eeec356e5a85059b3b819baupstream.
Hi Greg,
This one was also marked for stable 3.10 however because the 2 pre-req patches were not in yet, applying it would have failed and AFAIKR I did describe the state of things in that failure report. Anyhow can you please queue this one up for the next 3.10 stable.
Thx,
-Vineet
Quoted 49 lines
There was a very small race window where resume to kernel mode from a Exception Path (or pure kernel mode which is true for most of ARC exceptions anyways), was not disabling interrupts in
restore_regs, clobbering the exception regsAnton found the culprit call flow (after many sleepless nights)
| 1. we got a Trap from user land | 2. started to service it. | 3. While doing some stuff on user-land memory (I think it is padzero()), | we got a DataTlbMiss | 4. On return from it we are taking "resume_kernel_mode" path | 5. NEED_RESHED is not set, so we go to "return from exception" path in | restore regs. | 6. there seems to be IRQ happeningSigned-off-by Vineet Gupta <[email protected]>Cc Anton Kolesov <[email protected]>Cc Francois Bedard <[email protected]>Signed-off-by Linus Torvalds <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/arc/kernel/entry.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)arch/arc/kernel/entry.S +5
-3@@ -614,11 +614,13 @@ resume_user_mode_begin: resume_kernel_mode: -#ifdef CONFIG_PREEMPT - - ; This is a must for preempt_schedule_irq() + ; Disable Interrupts from this point on + ; CONFIG_PREEMPT: This is a must for preempt_schedule_irq() + ; !CONFIG_PREEMPT: To ensure restore_regs is intr safe IRQ_DISABLE r9 +#ifdef CONFIG_PREEMPT + ; Can't preempt if preemption disabled GET_CURR_THR_INFO_FROM_SP r10 ld r8, [r10, THREAD_INFO_PREEMPT_COUNT]
Greg Kroah-Hartman
maintainerRe: [PATCH 3.14 27/83] ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe
Quoted 8 lines · Vineet Gupta
Quoted 6 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
Quoted 8 lines
Quoted 1 line
commit
8aa9e85adac609588eeec356e5a85059b3b819baupstream.Hi Greg,
This one was also marked for stable 3.10 however because the 2 pre-req patches were not in yet, applying it would have failed and AFAIKR I did describe the state of things in that failure report. Anyhow can you please queue this one up for the next 3.10 stable.
Now applied, sorry for the delay.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 28/83 framebuffer: fix cfb_copyarea
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 00a9d699bc85052d2d3ed56251cd928024ce06a3 upstream.
The function cfb_copyarea is buggy when the copy operation is not aligned on long boundary (4 bytes on 32-bit machines, 8 bytes on 64-bit machines).
How to reproduce:
- use x86-64 machine
- use a framebuffer driver without acceleration (for example uvesafb)
- set the framebuffer to 8-bit depth
(for example fbset -a 1024x768-60 -depth 8)
- load a font with character width that is not a multiple of 8 pixels
note: the console-tools package cannot load a font that has width different from 8 pixels. You need to install the packages "kbd" and "console-terminus" and use the program "setfont" to set font width (for example: setfont Uni2-Terminus20x10)
- move some text left and right on the bash command line and you get a screen corruption
To expose more bugs, put this line to the end of uvesafb_init_info:info->flags |= FBINFO_HWACCEL_COPYAREA | FBINFO_READS_FAST;
- Now framebuffer console will use cfb_copyarea for console scrolling. You get a screen corruption when console is scrolled.
This patch is a rewrite of cfb_copyarea. It fixes the bugs, with this patch, console scrolling in 8-bit depth with a font width that is not a multiple of 8 pixels works fine.
The cfb_copyarea code was very buggy and it looks like it was written and never tried with non-8-pixel font.
--- drivers/video/cfbcopyarea.c | 153 ++++++++++++++++++++++---------------------- 1 file changed, 78 insertions(+), 75 deletions(-)
drivers/video/cfbcopyarea.c +78 -75
@@ -43,13 +43,22 @@*/ static void -bitcpy (struct fb_info *p,unsigned long __iomem *dst,int dst_idx, -const unsigned long __iomem *src,int src_idx,int bits, +bitcpy (struct fb_info *p,unsigned long __iomem *dst,unsigned dst_idx, +const unsigned long __iomem *src,unsigned src_idx,int bits,unsigned n,u32 bswapmask) {unsigned long first, last;int const shift = dst_idx-src_idx; -int left, right; + +#if 0 +/* +* If you suspect bug in this function, compare it with this simple +* memmove implementation. +*/ +fb_memmove ((char *)dst + ((dst_idx & (bits -1 ))) /8 , + (char *)src + ((src_idx & (bits -1 ))) /8 , n /8 ); +return ; +#endif first =fb_shifted_pixels_mask_long (p, dst_idx, bswapmask); last = ~fb_shifted_pixels_mask_long (p, (dst_idx+n) % bits, bswapmask);
@@ -98,9 +107,8 @@ bitcpy(struct fb_info *p, unsigned longunsigned long d0, d1;int m; - right = shift & (bits -1 ); - left = -shift & (bits -1 ); - bswapmask &= shift; +int const left = shift & (bits -1 ); +int const right = -shift & (bits -1 );if (dst_idx+n <= bits) {// Single destination word
@@ -110,15 +118,15 @@ bitcpy(struct fb_info *p, unsigned long d0 =fb_rev_pixels_in_long (d0, bswapmask);if (shift >0 ) {// Single source word - d0 >>= right; + d0 <<= left; }else if (src_idx+n <= bits) {// Single source word - d0 <<= left; + d0 >>= right; }else {// 2 source words d1 =FB_READL (src +1 ); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0<<left | d1>>right; + d0 = d0 >> right | d1 << left; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), first), dst);
@@ -135,60 +143,59 @@ bitcpy(struct fb_info *p, unsigned longif (shift >0 ) {// Single source word d1 = d0; - d0 >>= right; - dst++; + d0 <<= left; n -= bits - dst_idx; }else {// 2 source words d1 =FB_READL (src++); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0<<left | d1>>right; - dst++; + d0 = d0 >> right | d1 << left; n -= bits - dst_idx; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), first), dst); d0 = d1; + dst++;// Main chunk m = n % bits; n /= bits;while ((n >=4 ) && !bswapmask) { d1 =FB_READL (src++); -FB_WRITEL (d0 << left | d1 >> right, dst++); +FB_WRITEL (d0 >> right | d1 << left, dst++); d0 = d1; d1 =FB_READL (src++); -FB_WRITEL (d0 << left | d1 >> right, dst++); +FB_WRITEL (d0 >> right | d1 << left, dst++); d0 = d1; d1 =FB_READL (src++); -FB_WRITEL (d0 << left | d1 >> right, dst++); +FB_WRITEL (d0 >> right | d1 << left, dst++); d0 = d1; d1 =FB_READL (src++); -FB_WRITEL (d0 << left | d1 >> right, dst++); +FB_WRITEL (d0 >> right | d1 << left, dst++); d0 = d1; n -=4 ; }while (n--) { d1 =FB_READL (src++); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0 << left | d1 >> right; + d0 = d0 >> right | d1 << left; d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (d0, dst++); d0 = d1; }// Trailing bits -if (last) { -if (m <= right) { +if (m) { +if (m <= bits - right) {// Single source word - d0 <<= left; + d0 >>= right; }else {// 2 source words d1 =FB_READL (src); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0<<left | d1>>right; + d0 = d0 >> right | d1 << left; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), last), dst);
@@ -202,43 +209,46 @@ bitcpy(struct fb_info *p, unsigned long*/ static void -bitcpy_rev (struct fb_info *p,unsigned long __iomem *dst,int dst_idx, -const unsigned long __iomem *src,int src_idx,int bits, +bitcpy_rev (struct fb_info *p,unsigned long __iomem *dst,unsigned dst_idx, +const unsigned long __iomem *src,unsigned src_idx,int bits,unsigned n,u32 bswapmask) {unsigned long first, last;int shift; - dst += (n-1 )/bits; - src += (n-1 )/bits; -if ((n-1 ) % bits) { - dst_idx += (n-1 ) % bits; - dst += dst_idx >> (ffs (bits) -1 ); - dst_idx &= bits -1 ; - src_idx += (n-1 ) % bits; - src += src_idx >> (ffs (bits) -1 ); - src_idx &= bits -1 ; - } +#if 0 +/* +* If you suspect bug in this function, compare it with this simple +* memmove implementation. +*/ +fb_memmove ((char *)dst + ((dst_idx & (bits -1 ))) /8 , + (char *)src + ((src_idx & (bits -1 ))) /8 , n /8 ); +return ; +#endif + + dst += (dst_idx + n -1 ) / bits; + src += (src_idx + n -1 ) / bits; + dst_idx = (dst_idx + n -1 ) % bits; + src_idx = (src_idx + n -1 ) % bits; shift = dst_idx-src_idx; - first =fb_shifted_pixels_mask_long (p, bits -1 - dst_idx, bswapmask); - last = ~fb_shifted_pixels_mask_long (p, bits -1 - ((dst_idx-n) % bits), - bswapmask); + first = ~fb_shifted_pixels_mask_long (p, (dst_idx +1 ) % bits, bswapmask); + last =fb_shifted_pixels_mask_long (p, (bits + dst_idx +1 - n) % bits, bswapmask);if (!shift) {// Same alignment for source and dest if ((unsigned long )dst_idx+1 >= n) {// Single word -if (last) - first &= last; -FB_WRITEL (comp (FB_READL (src),FB_READL (dst), first), dst); +if (first) + last &= first; +FB_WRITEL (comp (FB_READL (src),FB_READL (dst), last), dst); }else {// Multiple destination words // Leading bits -if (first != ~0UL ) { +if (first) {FB_WRITEL (comp (FB_READL (src),FB_READL (dst), first), dst); dst--; src--;
@@ -262,7 +272,7 @@ bitcpy_rev(struct fb_info *p, unsigned lFB_WRITEL (FB_READL (src--), dst--);// Trailing bits -if (last) +if (last !=-1UL )FB_WRITEL (comp (FB_READL (src),FB_READL (dst), last), dst); } }else {
@@ -270,29 +280,28 @@ bitcpy_rev(struct fb_info *p, unsigned lunsigned long d0, d1;int m; -int const left = -shift & (bits-1 ); -int const right = shift & (bits-1 ); - bswapmask &= shift; +int const left = shift & (bits-1 ); +int const right = -shift & (bits-1 );if ((unsigned long )dst_idx+1 >= n) {// Single destination word -if (last) - first &= last; +if (first) + last &= first; d0 =FB_READL (src);if (shift <0 ) {// Single source word - d0 <<= left; + d0 >>= right; }else if (1 +(unsigned long )src_idx >= n) {// Single source word - d0 >>= right; + d0 <<= left; }else {// 2 source words d1 =FB_READL (src -1 ); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0>>right | d1<<left; + d0 = d0 << left | d1 >> right; } d0 =fb_rev_pixels_in_long (d0, bswapmask); -FB_WRITEL (comp (d0,FB_READL (dst), first), dst); +FB_WRITEL (comp (d0,FB_READL (dst), last), dst); }else {// Multiple destination words /** We must always remember the last value read, because in case
@@ -307,12 +316,12 @@ bitcpy_rev(struct fb_info *p, unsigned lif (shift <0 ) {// Single source word d1 = d0; - d0 <<= left; + d0 >>= right; }else {// 2 source words d1 =FB_READL (src--); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0>>right | d1<<left; + d0 = d0 << left | d1 >> right; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), first), dst);
@@ -325,39 +334,39 @@ bitcpy_rev(struct fb_info *p, unsigned l n /= bits;while ((n >=4 ) && !bswapmask) { d1 =FB_READL (src--); -FB_WRITEL (d0 >> right | d1 << left, dst--); +FB_WRITEL (d0 << left | d1 >> right, dst--); d0 = d1; d1 =FB_READL (src--); -FB_WRITEL (d0 >> right | d1 << left, dst--); +FB_WRITEL (d0 << left | d1 >> right, dst--); d0 = d1; d1 =FB_READL (src--); -FB_WRITEL (d0 >> right | d1 << left, dst--); +FB_WRITEL (d0 << left | d1 >> right, dst--); d0 = d1; d1 =FB_READL (src--); -FB_WRITEL (d0 >> right | d1 << left, dst--); +FB_WRITEL (d0 << left | d1 >> right, dst--); d0 = d1; n -=4 ; }while (n--) { d1 =FB_READL (src--); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0 >> right | d1 << left; + d0 = d0 << left | d1 >> right; d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (d0, dst--); d0 = d1; }// Trailing bits -if (last) { -if (m <= left) { +if (m) { +if (m <= bits - left) {// Single source word - d0 >>= right; + d0 <<= left; }else {// 2 source words d1 =FB_READL (src); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0>>right | d1<<left; + d0 = d0 << left | d1 >> right; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), last), dst);
@@ -371,9 +380,9 @@ void cfb_copyarea(struct fb_info *p, conu32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy;u32 height = area->height, width = area->width;unsigned long const bits_per_line = p->fix.line_length*8u ; -unsigned long __iomem *dst =NULL , *src =NULL ; +unsigned long __iomem *base =NULL ;int bits =BITS_PER_LONG , bytes = bits >>3 ; -int dst_idx =0 , src_idx =0 , rev_copy =0 ; +unsigned dst_idx =0 , src_idx =0 , rev_copy =0 ;u32 bswapmask =fb_compute_bswapmask (p);if (p->state !=FBINFO_STATE_RUNNING )
@@ -389,7 +398,7 @@ void cfb_copyarea(struct fb_info *p, con// split the base of the framebuffer into a long-aligned address and the // index of the first bit - dst = src = (unsigned long __iomem *)((unsigned long )p->screen_base & ~(bytes-1 )); + base = (unsigned long __iomem *)((unsigned long )p->screen_base & ~(bytes-1 )); dst_idx = src_idx =8 *((unsigned long )p->screen_base & (bytes-1 ));// add offset of source and target area dst_idx += dy*bits_per_line + dx*p->var.bits_per_pixel;
@@ -402,20 +411,14 @@ void cfb_copyarea(struct fb_info *p, conwhile (height--) { dst_idx -= bits_per_line; src_idx -= bits_per_line; - dst += dst_idx >> (ffs (bits) -1 ); - dst_idx &= (bytes -1 ); - src += src_idx >> (ffs (bits) -1 ); - src_idx &= (bytes -1 ); -bitcpy_rev (p, dst, dst_idx, src, src_idx, bits, +bitcpy_rev (p, base + (dst_idx / bits), dst_idx % bits, + base + (src_idx / bits), src_idx % bits, bits, width*p->var.bits_per_pixel, bswapmask); } }else {while (height--) { - dst += dst_idx >> (ffs (bits) -1 ); - dst_idx &= (bytes -1 ); - src += src_idx >> (ffs (bits) -1 ); - src_idx &= (bytes -1 ); -bitcpy (p, dst, dst_idx, src, src_idx, bits, +bitcpy (p, base + (dst_idx / bits), dst_idx % bits, + base + (src_idx / bits), src_idx % bits, bits, width*p->var.bits_per_pixel, bswapmask); dst_idx += bits_per_line; src_idx += bits_per_line;
Greg Kroah-Hartman
maintainerPATCH 29/83 matroxfb: restore the registers M_ACCESS and M_PITCH
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit a772d4736641ec1b421ad965e13457c17379fc86 upstream.
When X11 is running and the user switches back to console, the card modifies the content of registers M_MACCESS and M_PITCH in periodic intervals.
This patch fixes it by restoring the content of these registers before issuing any accelerator command.
--- drivers/video/matrox/matroxfb_accel.c | 38 +++++++++++++++++++++++++--------- drivers/video/matrox/matroxfb_base.h | 2 + 2 files changed, 30 insertions(+), 10 deletions(-)
drivers/video/matrox/matroxfb_accel.c +28 -10
@@ -192,10 +192,18 @@ void matrox_cfbX_init(struct matrox_fb_i minfo->accel.m_dwg_rect =M_DWG_TRAP |M_DWG_SOLID |M_DWG_ARZERO |M_DWG_SGNZERO |M_DWG_SHIFTZERO ;if (isMilleniumII (minfo)) minfo->accel.m_dwg_rect |=M_DWG_TRANSC ; minfo->accel.m_opmode = mopmode; + minfo->accel.m_access = maccess; + minfo->accel.m_pitch = mpitch; }EXPORT_SYMBOL (matrox_cfbX_init); +static void matrox_accel_restore_maccess (struct matrox_fb_info *minfo) +{ +mga_outl (M_MACCESS , minfo->accel.m_access); +mga_outl (M_PITCH , minfo->accel.m_pitch); +} +static void matrox_accel_bmove (struct matrox_fb_info *minfo,int vxres,int sy,int sx,int dy,int dx,int height,int width) {
@@ -207,7 +215,8 @@ static void matrox_accel_bmove(struct maCRITBEGIN if ((dy < sy) || ((dy == sy) && (dx <= sx))) { -mga_fifo (2 ); +mga_fifo (4 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL ,M_DWG_BITBLT |M_DWG_SHIFTZERO |M_DWG_SGNZERO |M_DWG_BFCOL |M_DWG_REPLACE );mga_outl (M_AR5 , vxres);
@@ -215,7 +224,8 @@ static void matrox_accel_bmove(struct ma start = sy*vxres+sx+curr_ydstorg (minfo); end = start+width; }else { -mga_fifo (3 ); +mga_fifo (5 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL ,M_DWG_BITBLT |M_DWG_SHIFTZERO |M_DWG_BFCOL |M_DWG_REPLACE );mga_outl (M_SGN ,5 );mga_outl (M_AR5 , -vxres);
@@ -224,7 +234,8 @@ static void matrox_accel_bmove(struct ma start = end+width; dy += height-1 ; } -mga_fifo (4 ); +mga_fifo (6 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_AR0 , end);mga_outl (M_AR3 , start);mga_outl (M_FXBNDRY , ((dx+width)<<16 ) | dx);
@@ -246,7 +257,8 @@ static void matrox_accel_bmove_lin(strucCRITBEGIN if ((dy < sy) || ((dy == sy) && (dx <= sx))) { -mga_fifo (2 ); +mga_fifo (4 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL ,M_DWG_BITBLT |M_DWG_SHIFTZERO |M_DWG_SGNZERO |M_DWG_BFCOL |M_DWG_REPLACE );mga_outl (M_AR5 , vxres);
@@ -254,7 +266,8 @@ static void matrox_accel_bmove_lin(struc start = sy*vxres+sx+curr_ydstorg (minfo); end = start+width; }else { -mga_fifo (3 ); +mga_fifo (5 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL ,M_DWG_BITBLT |M_DWG_SHIFTZERO |M_DWG_BFCOL |M_DWG_REPLACE );mga_outl (M_SGN ,5 );mga_outl (M_AR5 , -vxres);
@@ -263,7 +276,8 @@ static void matrox_accel_bmove_lin(struc start = end+width; dy += height-1 ; } -mga_fifo (5 ); +mga_fifo (7 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_AR0 , end);mga_outl (M_AR3 , start);mga_outl (M_FXBNDRY , ((dx+width)<<16 ) | dx);
@@ -298,7 +312,8 @@ static void matroxfb_accel_clear(structCRITBEGIN - mga_fifo(5); + mga_fifo(7); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL , minfo->accel.m_dwg_rect |M_DWG_REPLACE );mga_outl (M_FCOL , color);mga_outl (M_FXBNDRY , ((sx + width) <<16 ) | sx);
@@ -341,7 +356,8 @@ static void matroxfb_cfb4_clear(struct m width >>=1 ; sx >>=1 ;if (width) { -mga_fifo (5 ); +mga_fifo (7 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL , minfo->accel.m_dwg_rect |M_DWG_REPLACE2 );mga_outl (M_FCOL , bgx);mga_outl (M_FXBNDRY , ((sx + width) <<16 ) | sx);
@@ -415,7 +431,8 @@ static void matroxfb_1bpp_imageblit(struCRITBEGIN - mga_fifo(3); + mga_fifo(5); +matrox_accel_restore_maccess (minfo);if (easy)mga_outl (M_DWGCTL ,M_DWG_ILOAD |M_DWG_SGNZERO |M_DWG_SHIFTZERO |M_DWG_BMONOWF |M_DWG_LINEAR |M_DWG_REPLACE );else
@@ -425,7 +442,8 @@ static void matroxfb_1bpp_imageblit(stru fxbndry = ((xx + width -1 ) <<16 ) | xx; mmio = minfo->mmio.vbase; -mga_fifo (6 ); +mga_fifo (8 ); +matrox_accel_restore_maccess (minfo);mga_writel (mmio,M_FXBNDRY , fxbndry);mga_writel (mmio,M_AR0 , ar0);mga_writel (mmio,M_AR3 ,0 );
drivers/video/matrox/matroxfb_base.h +2 -0
@@ -307,6 +307,8 @@ struct matrox_accel_data {#endif u_int32_t m_dwg_rect;u_int32_t m_opmode; +u_int32_t m_access; +u_int32_t m_pitch; };struct v4l2_queryctrl ;
Greg Kroah-Hartman
maintainerPATCH 30/83 mach64: use unaligned access
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit c29dd8696dc5dbd50b3ac441b8a26751277ba520 upstream.
This patch fixes mach64 to use unaligned access to the font bitmap.
This fixes unaligned access warning on sparc64 when 14x8 font is loaded.
On x86(64), unaligned access is handled in hardware, so both functions le32_to_cpup and get_unaligned_le32 perform the same operation.
On RISC machines, unaligned access is not handled in hardware, so we better use get_unaligned_le32 to avoid the unaligned trap and warning.
--- drivers/video/aty/mach64_accel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/aty/mach64_accel.c +2 -1
@@ -4,6 +4,7 @@*/ #include <linux/delay.h> +#include <asm/unaligned.h> #include <linux/fb.h> #include <video/mach64.h> #include "atyfb.h"
@@ -419,7 +420,7 @@ void atyfb_imageblit(struct fb_info *infu32 *pbitmap, dwords = (src_bytes +3 ) /4 ;for (pbitmap = (u32 *)(image->data); dwords; dwords--, pbitmap++) {wait_for_fifo (1 , par); -aty_st_le32 (HOST_DATA0 ,le32_to_cpup (pbitmap), par); +aty_st_le32 (HOST_DATA0 ,get_unaligned_le32 (pbitmap), par); } }
Greg Kroah-Hartman
maintainerPATCH 31/83 mach64: fix cursor when character width is not a multiple of 8 pixels
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 43751a1b8ee2e70ce392bf31ef3133da324e68b3 upstream.
This patch fixes the hardware cursor on mach64 when font width is not a multiple of 8 pixels.
If you load such a font, the cursor is expanded to the next 8-byte boundary and a part of the next character after the cursor is not visible.
For example, when you load a font with 12-pixel width, the cursor width is 16 pixels and when the cursor is displayed, 4 pixels of the next character are not visible.
The reason is this: atyfb_cursor is called with proper parameters to load an image that is 12-pixel wide. However, the number is aligned on the next 8-pixel boundary on the line
"unsigned int width = (cursor->image.width + 7) >> 3;" and the whole function acts as it is was loading a 16-pixel image.
This patch fixes it so that the value written to the framebuffer is padded with 0xaaaa (the transparent pattern) when the image size it not a multiple of 8 pixels. The transparent pattern causes that the cursor will not interfere with the next character.
--- drivers/video/aty/mach64_cursor.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/video/aty/mach64_cursor.c +16 -6
@@ -5,6 +5,7 @@#include <linux/fb.h> #include <linux/init.h> #include <linux/string.h> +#include "../fb_draw.h" #include <asm/io.h>
@@ -157,24 +158,33 @@ static int atyfb_cursor(struct fb_info *for (i =0 ; i < height; i++) {for (j =0 ; j < width; j++) { +u16 l =0xaaaa ; b = *src++; m = *msk++;switch (cursor->rop) {case ROP_XOR :// Upper 4 bits of mask data -fb_writeb (cursor_bits_lookup[(b ^ m) >>4 ], dst++); + l = cursor_bits_lookup[(b ^ m) >>4 ] |// Lower 4 bits of mask -fb_writeb (cursor_bits_lookup[(b ^ m) &0x0f ], - dst++); + (cursor_bits_lookup[(b ^ m) &0x0f ] <<8 );break ;case ROP_COPY :// Upper 4 bits of mask data -fb_writeb (cursor_bits_lookup[(b & m) >>4 ], dst++); + l = cursor_bits_lookup[(b & m) >>4 ] |// Lower 4 bits of mask -fb_writeb (cursor_bits_lookup[(b & m) &0x0f ], - dst++); + (cursor_bits_lookup[(b & m) &0x0f ] <<8 );break ; } +/* +* If cursor size is not a multiple of 8 characters +* we must pad it with transparent pattern (0xaaaa). +*/ +if ((j +1 ) *8 > cursor->image.width) { + l =comp (l,0xaaaa , + (1 << ((cursor->image.width &7 ) *2 )) -1 ); + } +fb_writeb (l &0xff , dst++); +fb_writeb (l >>8 , dst++); } dst += offset; }
Greg Kroah-Hartman
maintainerPATCH 32/83 b43: Fix machine check error due to improper access of B43_MMIO_PSM_PHY_HDR
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
commit 12cd43c6ed6da7bf7c5afbd74da6959cda6d056b upstream.
Register B43_MMIO_PSM_PHY_HDR is 16 bit one, so accessing it with 32b functions isn't safe. On my machine it causes delayed (!) CPU exception:
Disabling lock debugging due to kernel taint
mce: [Hardware Error]: CPU 0: Machine Check Exception: 4 Bank 4: b200000000070f0f
mce: [Hardware Error]: TSC 164083803dc
mce: [Hardware Error]: PROCESSOR 2:20fc2 TIME 1396650505 SOCKET 0 APIC 0 microcode 0
mce: [Hardware Error]: Run the above through 'mcelog --ascii'
mce: [Hardware Error]: Machine check: Processor context corrupt
Kernel panic - not syncing: Fatal machine check on current CPU
Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
--- drivers/net/wireless/b43/phy_n.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/b43/phy_n.c +7 -7
@@ -5176,22 +5176,22 @@ static void b43_nphy_channel_setup(strucint ch = new_channel->hw_value;u16 old_band_5ghz; -u32 tmp32; +u16 tmp16; old_band_5ghz =b43_phy_read (dev,B43_NPHY_BANDCTL ) &B43_NPHY_BANDCTL_5GHZ ;if (new_channel->band ==IEEE80211_BAND_5GHZ && !old_band_5ghz) { - tmp32 =b43_read32 (dev,B43_MMIO_PSM_PHY_HDR ); -b43_write32 (dev,B43_MMIO_PSM_PHY_HDR , tmp32 |4 ); + tmp16 =b43_read16 (dev,B43_MMIO_PSM_PHY_HDR ); +b43_write16 (dev,B43_MMIO_PSM_PHY_HDR , tmp16 |4 );b43_phy_set (dev,B43_PHY_B_BBCFG ,0xC000 ); -b43_write32 (dev,B43_MMIO_PSM_PHY_HDR , tmp32); +b43_write16 (dev,B43_MMIO_PSM_PHY_HDR , tmp16);b43_phy_set (dev,B43_NPHY_BANDCTL ,B43_NPHY_BANDCTL_5GHZ ); }else if (new_channel->band ==IEEE80211_BAND_2GHZ && old_band_5ghz) {b43_phy_mask (dev,B43_NPHY_BANDCTL , ~B43_NPHY_BANDCTL_5GHZ ); - tmp32 =b43_read32 (dev,B43_MMIO_PSM_PHY_HDR ); -b43_write32 (dev,B43_MMIO_PSM_PHY_HDR , tmp32 |4 ); + tmp16 =b43_read16 (dev,B43_MMIO_PSM_PHY_HDR ); +b43_write16 (dev,B43_MMIO_PSM_PHY_HDR , tmp16 |4 );b43_phy_mask (dev,B43_PHY_B_BBCFG ,0x3FFF ); -b43_write32 (dev,B43_MMIO_PSM_PHY_HDR , tmp32); +b43_write16 (dev,B43_MMIO_PSM_PHY_HDR , tmp16); }b43_chantab_phy_upload (dev, e);
Greg Kroah-Hartman
maintainerPATCH 33/83 Revert "net: mvneta: fix usage as a module on RGMII configurations"
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit cc6ca3023f2c2bbcd062e9d4cf6afc2ba2821ada upstream.
This reverts commit e3a8786c10e75903f1269474e21fe8cb49c3a670. While this commit allows to use the mvneta driver as a module on some configurations, it breaks other configurations even if mvneta is used built-in.
This breakage is due to the fact that on some RGMII platforms, the PCS bit has to be set, and on some other platforms, it has to be cleared. At the moment, we lack informations to know exactly the significance of this bit (the datasheet only says "enables PCS"), and so we can't produce a patch that will work on all platforms at this point. And since this change is breaking the network completely for many users, it's much better to revert it for now. We'll come back later with a proper fix that takes into account all platforms.
Basically:
* Armada XP GP is configured as RGMII-ID, and needs the PCS bit to be set.
* Armada 370 Mirabox is configured as RGMII-ID, and needs the PCS bit to be cleared.
And at the moment, we don't know how to make the distinction between those two cases. One hint is that the Armada XP GP appears in fact to be using a QSGMII connection with the PHY (Quad-SGMII), but configuring it as SGMII doesn't work, while RGMII-ID works. This needs more investigation, but in the mean time, let's unbreak the network for all those users.
--- drivers/net/ethernet/marvell/mvneta.c | 41 +++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +33 -8
@@ -89,9 +89,8 @@#define MVNETA_TX_IN_PRGRS BIT(1)#define MVNETA_TX_FIFO_EMPTY BIT(8)#define MVNETA_RX_MIN_FRAME_SIZE 0x247c -#define MVNETA_SERDES_CFG 0x24A0 +#define MVNETA_SGMII_SERDES_CFG 0x24A0#define MVNETA_SGMII_SERDES_PROTO 0x0cc7 -#define MVNETA_RGMII_SERDES_PROTO 0x0667#define MVNETA_TYPE_PRIO 0x24bc#define MVNETA_FORCE_UNI BIT(21)#define MVNETA_TXQ_CMD_1 0x24e4
@@ -712,6 +711,35 @@ static void mvneta_rxq_bm_disable(structmvreg_write (pp,MVNETA_RXQ_CONFIG_REG (rxq->id), val); } + + +/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */ +static void mvneta_gmac_rgmii_set (struct mvneta_port *pp,int enable) +{ +u32 val; + + val =mvreg_read (pp,MVNETA_GMAC_CTRL_2 ); + +if (enable) + val |=MVNETA_GMAC2_PORT_RGMII ; +else + val &= ~MVNETA_GMAC2_PORT_RGMII ; + +mvreg_write (pp,MVNETA_GMAC_CTRL_2 , val); +} + +/* Config SGMII port */ +static void mvneta_port_sgmii_config (struct mvneta_port *pp) +{ +u32 val; + + val =mvreg_read (pp,MVNETA_GMAC_CTRL_2 ); + val |=MVNETA_GMAC2_PCS_ENABLE ; +mvreg_write (pp,MVNETA_GMAC_CTRL_2 , val); + +mvreg_write (pp,MVNETA_SGMII_SERDES_CFG ,MVNETA_SGMII_SERDES_PROTO ); +} +/* Start the Ethernet port RX and TX activity */ static void mvneta_port_up (struct mvneta_port *pp) {
@@ -2729,15 +2757,12 @@ static void mvneta_port_power_up(structmvreg_write (pp,MVNETA_UNIT_INTR_CAUSE ,0 );if (phy_mode ==PHY_INTERFACE_MODE_SGMII ) -mvreg_write (pp,MVNETA_SERDES_CFG ,MVNETA_SGMII_SERDES_PROTO ); -else -mvreg_write (pp,MVNETA_SERDES_CFG ,MVNETA_RGMII_SERDES_PROTO ); +mvneta_port_sgmii_config (pp); - val =mvreg_read (pp,MVNETA_GMAC_CTRL_2 ); - - val |=MVNETA_GMAC2_PCS_ENABLE |MVNETA_GMAC2_PORT_RGMII ; +mvneta_gmac_rgmii_set (pp,1 );/* Cancel Port Reset */ + val =mvreg_read (pp,MVNETA_GMAC_CTRL_2 ); val &= ~MVNETA_GMAC2_PORT_RESET ;mvreg_write (pp,MVNETA_GMAC_CTRL_2 , val);
Greg Kroah-Hartman
maintainerPATCH 34/83 ahci: do not request irq for dummy port
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Milburn <[email protected]>
commit 9ae794ac5e407d3bc3fec785db481d5a2c0fa275 upstream.
System may crash in ahci_hw_interrupt() or ahci_thread_fn() when accessing the interrupt status in a port's private_data if the port is actually a DUMMY port.
00:1f.2 SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI Controller
<snip console output for linux-3.15-rc1>
[ 9.352080] ahci 0000:00:1f.2: AHCI 0001.0200 32 slots 6 ports 3 Gbps 0x1 impl SATA mode [ 9.352084] ahci 0000:00:1f.2: flags: 64bit ncq sntf pm led clo pio slum part ccc [ 9.368155] Console: switching to colour frame buffer device 128x48 [ 9.439759] mgag200 0000:11:00.0: fb0: mgadrmfb frame buffer device [ 9.446765] mgag200 0000:11:00.0: registered panic notifier [ 9.470166] scsi1 : ahci [ 9.479166] scsi2 : ahci [ 9.488172] scsi3 : ahci [ 9.497174] scsi4 : ahci [ 9.506175] scsi5 : ahci [ 9.515174] scsi6 : ahci [ 9.518181] ata1: SATA max UDMA/133 abar m2048@0x95c00000 port 0x95c00100 irq 91 [ 9.526448] ata2: DUMMY [ 9.529182] ata3: DUMMY [ 9.531916] ata4: DUMMY [ 9.534650] ata5: DUMMY [ 9.537382] ata6: DUMMY [ 9.576196] [drm] Initialized mgag200 1.0.0 20110418 for 0000:11:00.0 on minor 0 [ 9.845257] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300) [ 9.865161] ata1.00: ATAPI: Optiarc DVD RW AD-7580S, FX04, max UDMA/100 [ 9.891407] ata1.00: configured for UDMA/100 [ 9.900525] scsi 1:0:0:0: CD-ROM Optiarc DVD RW AD-7580S FX04 PQ: 0 ANSI: 5 [ 10.247399] iTCO_vendor_support: vendor-support=0 [ 10.261572] iTCO_wdt: Intel TCO WatchDog Timer Driver v1.11 [ 10.269764] iTCO_wdt: unable to reset NO_REBOOT flag, device disabled by hardware/BIOS [ 10.301932] sd 0:2:0:0: [sda] 570310656 512-byte logical blocks: (291 GB/271 GiB) [ 10.317085] sd 0:2:0:0: [sda] Write Protect is off [ 10.328326] sd 0:2:0:0: [sda] Write cache: disabled, read cache: disabled, supports DPO and FUA [ 10.375452] BUG: unable to handle kernel NULL pointer dereference at 000000000000003c [ 10.384217] IP: [<ffffffffa0133df0>] ahci_hw_interrupt+0x100/0x130 [libahci] [ 10.392101] PGD 0 [ 10.394353] Oops: 0000 [#1] SMP [ 10.397978] Modules linked in: sr_mod(+) cdrom sd_mod iTCO_wdt crc_t10dif iTCO_vendor_support crct10dif_common ahci libahci libata lpc_ich mfd_core mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit drm_kms_helper ttm drm i2c_core megaraid_sas dm_mirror dm_region_hash dm_log dm_mod [ 10.426499] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.15.0-rc1 #1 [ 10.433495] Hardware name: QCI QSSC-S4R/QSSC-S4R, BIOS QSSC-S4R.QCI.01.00.S013.032920111005 03/29/2011 [ 10.443886] task: ffffffff81906460 ti: ffffffff818f0000 task.ti: ffffffff818f0000 [ 10.452239] RIP: 0010:[<ffffffffa0133df0>] [<ffffffffa0133df0>] ahci_hw_interrupt+0x100/0x130 [libahci] [ 10.462838] RSP: 0018:ffff880033c03d98 EFLAGS: 00010046 [ 10.468767] RAX: 0000000000a400a4 RBX: ffff880029a6bc18 RCX: 00000000fffffffa [ 10.476731] RDX: 00000000000000a4 RSI: ffff880029bb0000 RDI: ffff880029a6bc18 [ 10.484696] RBP: ffff880033c03dc8 R08: 0000000000000000 R09: ffff88002f800490 [ 10.492661] R10: 0000000000000000 R11: 0000000000000005 R12: 0000000000000000 [ 10.500625] R13: ffff880029a6bd98 R14: 0000000000000000 R15: ffffc90000194000 [ 10.508590] FS: 0000000000000000(0000) GS:ffff880033c00000(0000) knlGS:0000000000000000 [ 10.517623] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 10.524035] CR2: 000000000000003c CR3: 00000000328ff000 CR4: 00000000000007b0 [ 10.531999] Stack: [ 10.534241] 0000000000000017 ffff880031ba7d00 000000000000005c ffff880031ba7d00 [ 10.542535] 0000000000000000 000000000000005c ffff880033c03e10 ffffffff810c2a1e [ 10.550827] ffff880031ae2900 000000008108fb4f ffff880031ae2900 ffff880031ae2984 [ 10.559121] Call Trace: [ 10.561849] <IRQ> [ 10.563994] [<ffffffff810c2a1e>] handle_irq_event_percpu+0x3e/0x1a0 [ 10.571309] [<ffffffff810c2bbd>] handle_irq_event+0x3d/0x60 [ 10.577631] [<ffffffff810c4fdd>] try_one_irq.isra.6+0x8d/0xf0 [ 10.584142] [<ffffffff810c5313>] note_interrupt+0x173/0x1f0 [ 10.590460] [<ffffffff810c2a8e>] handle_irq_event_percpu+0xae/0x1a0 [ 10.597554] [<ffffffff810c2bbd>] handle_irq_event+0x3d/0x60 [ 10.603872] [<ffffffff810c5727>] handle_edge_irq+0x77/0x130 [ 10.610199] [<ffffffff81014b8f>] handle_irq+0xbf/0x150 [ 10.616040] [<ffffffff8109ff4e>] ? vtime_account_idle+0xe/0x50 [ 10.622654] [<ffffffff815fca1a>] ? atomic_notifier_call_chain+0x1a/0x20 [ 10.630140] [<ffffffff816038cf>] do_IRQ+0x4f/0xf0 [ 10.635490] [<ffffffff815f8aed>] common_interrupt+0x6d/0x6d [ 10.641805] <EOI> [ 10.643950] [<ffffffff8149ca9f>] ? cpuidle_enter_state+0x4f/0xc0 [ 10.650972] [<ffffffff8149ca98>] ? cpuidle_enter_state+0x48/0xc0 [ 10.657775] [<ffffffff8149cb47>] cpuidle_enter+0x17/0x20 [ 10.663807] [<ffffffff810b0070>] cpu_startup_entry+0x2c0/0x3d0 [ 10.670423] [<ffffffff815dfcc7>] rest_init+0x77/0x80 [ 10.676065] [<ffffffff81a60f47>] start_kernel+0x40f/0x41a [ 10.682190] [<ffffffff81a60941>] ? repair_env_string+0x5c/0x5c [ 10.688799] [<ffffffff81a60120>] ? early_idt_handlers+0x120/0x120 [ 10.695699] [<ffffffff81a605ee>] x86_64_start_reservations+0x2a/0x2c [ 10.702889] [<ffffffff81a60733>] x86_64_start_kernel+0x143/0x152 [ 10.709689] Code: a0 fc ff 85 c0 8b 4d d4 74 c3 48 8b 7b 08 89 ca 48 c7 c6 60 66 13 a0 31 c0 e8 9d 70 28 e1 8b 4d d4 eb aa 0f 1f 84 00 00 00 00 00 <45> 8b 64 24 3c 48 89 df e8 23 47 4c e1 41 83 fc 01 19 c0 48 83 [ 10.731470] RIP [<ffffffffa0133df0>] ahci_hw_interrupt+0x100/0x130 [libahci] [ 10.739441] RSP <ffff880033c03d98> [ 10.743333] CR2: 000000000000003c [ 10.747032] ---[ end trace b6e82636970e2690 ]--- [ 10.760190] Kernel panic - not syncing: Fatal exception in interrupt [ 10.767291] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
--- drivers/ata/ahci.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/ata/ahci.c +4 -8
@@ -1233,18 +1233,14 @@ int ahci_host_activate(struct ata_host *return rc;for (i =0 ; i < host->n_ports; i++) { -const char * desc;struct ahci_port_priv *pp = host->ports[i]->private_data;/* pp is NULL for dummy ports */ if (pp) - desc = pp->irq_desc; -else - desc =dev_driver_string (host->dev); - - rc =devm_request_threaded_irq (host->dev, - irq + i, ahci_hw_interrupt, ahci_thread_fn,IRQF_SHARED , - desc, host->ports[i]); + rc =devm_request_threaded_irq (host->dev, + irq + i, ahci_hw_interrupt, + ahci_thread_fn,IRQF_SHARED , + pp->irq_desc, host->ports[i]);if (rc) goto out_free_irqs; }
Greg Kroah-Hartman
maintainerPATCH 35/83 libata/ahci: accommodate tag ordered controllers
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 8a4aeec8d2d6a3edeffbdfae451cdf05cbf0fefd upstream.
The AHCI spec allows implementations to issue commands in tag order rather than FIFO order:
5.3.2.12 P:SelectCmd
HBA sets pSlotLoc = (pSlotLoc + 1) mod (CAP.NCS + 1) or HBA selects the command to issue that has had the PxCI bit set to '1' longer than any other command pending to be issued.
The result is that commands posted sequentially (time-wise) may play out of sequence when issued by hardware.
This behavior has likely been hidden by drives that arrange for commands to complete in issue order. However, it appears recent drives (two from different vendors that we have found so far) inflict out-of-order completions as a matter of course. So, we need to take care to maintain ordered submission, otherwise we risk triggering a drive to fall out of sequential-io automation and back to random-io processing, which incurs large latency and degrades throughput.
This issue was found in simple benchmarks where QD=2 seq-write performance was 30-50% *greater* than QD=32 seq-write performance.
Tagging for -stable and making the change globally since it has a low risk-to-reward ratio. Also, word is that recent versions of an unnamed OS also does it this way now. So, drives in the field are already experienced with this tag ordering scheme.
--- drivers/ata/libata-core.c | 21 +++++++++++++-------- include/linux/libata.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/ata/libata-core.c +13 -8
@@ -4792,21 +4792,26 @@ void swap_buf_le16(u16 *buf, unsigned instatic struct ata_queued_cmd *ata_qc_new (struct ata_port *ap) {struct ata_queued_cmd *qc =NULL ; -unsigned int i; +unsigned int i, tag;/* no command while frozen */ if (unlikely (ap->pflags &ATA_PFLAG_FROZEN ))return NULL ; -/* the last tag is reserved for internal command. */ -for (i =0 ; i <ATA_MAX_QUEUE -1 ; i++) -if (!test_and_set_bit (i, &ap->qc_allocated)) { - qc =__ata_qc_from_tag (ap, i); +for (i =0 ; i <ATA_MAX_QUEUE ; i++) { + tag = (i + ap->last_tag +1 ) %ATA_MAX_QUEUE ; + +/* the last tag is reserved for internal command. */ +if (tag ==ATA_TAG_INTERNAL ) +continue ; + +if (!test_and_set_bit (tag, &ap->qc_allocated)) { + qc =__ata_qc_from_tag (ap, tag); + qc->tag = tag; + ap->last_tag = tag;break ; } - -if (qc) - qc->tag = i; + }return qc; }
include/linux/libata.h +1 -0
@@ -822,6 +822,7 @@ struct ata_port {unsigned long qc_allocated;unsigned int qc_active;int nr_active_links;/* #links with active qcs */ +unsigned int last_tag;/* track next tag hw expects */ struct ata_link link;/* host default link */ struct ata_link *slave_link;/* see ata_slave_link_init() */
Greg Kroah-Hartman
maintainerPATCH 36/83 ahci: Ensure "MSI Revert to Single Message" mode is not enforced
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Gordeev <[email protected]>
commit ab0f9e78b97f5193dd38b3757b42b6fbded05fb7 upstream.
The AHCI specification allows hardware to choose to revert to single MSI mode when fewer messages are allocated than requested. Yet, at least ICH10 chipset reverts to single MSI mode even when enough messages are allocated in some cases (see below).
This update forces the driver to not rely on initialization of multiple MSIs mode alone and always check if "MSI Revert to Single Message" (MRSM) mode was enforced by the controller and fallback to the single MSI mode in case it did.
That prevents a situation when the driver configured multiple per-port IRQ handlers, but the controller sends all port's interrupts to a single IRQ, which could easily screw up the interrupt handling and lead to delays and possibly crashes.
The fix was tested on a 6-port controller that successfully reverted to the single MSI mode:
00:1f.2 SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI Controller (prog-if 01 [AHCI 1.0])
Subsystem: Super Micro Computer Inc Device 10a7 Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 101 I/O ports at f110 [size=8] I/O ports at f100 [size=4] I/O ports at f0f0 [size=8] I/O ports at f0e0 [size=4] I/O ports at f020 [size=32] Memory at fbf00000 (32-bit, non-prefetchable) [size=2K] Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit- Capabilities: [70] Power Management version 3 Capabilities: [a8] SATA HBA v1.0 Capabilities: [b0] PCI Advanced Features Kernel driver in use: ahci
With 6 ports just 8 MSI vectors should be enough, but the adapter enforces the MRSM mode when less than 16 vectors are written to the Multiple Messages Enable PCI register. I instigated MRSM mode by forcing @nvec to 8 in ahci_init_interrupts().
--- drivers/ata/ahci.c | 9 ++++++++- drivers/ata/ahci.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/ata/ahci.c +8 -1
@@ -1163,7 +1163,7 @@ static inline void ahci_gtf_filter_worka#endif static int ahci_init_interrupts (struct pci_dev *pdev,unsigned int n_ports, -struct ahci_host_priv *hpriv) +struct ahci_host_priv *hpriv) {int rc, nvec;
@@ -1189,6 +1189,13 @@ static int ahci_init_interrupts(struct pelse if (rc >0 ) goto single_msi; +/* fallback to single MSI mode if the controller enforced MRSM mode */ +if (readl (hpriv->mmio +HOST_CTL ) &HOST_MRSM ) { +pci_disable_msi (pdev); +printk (KERN_INFO "ahci: MRSM is on, fallback to single MSI\n" ); + goto single_msi; + } +return nvec; single_msi:
drivers/ata/ahci.h +1 -0
@@ -91,6 +91,7 @@ enum {/* HOST_CTL bits */ HOST_RESET = (1 <<0 ),/* reset controller; self-clear */ HOST_IRQ_EN = (1 <<1 ),/* global IRQ enable */ +HOST_MRSM = (1 <<2 ),/* MSI Revert to Single Message */ HOST_AHCI_EN = (1 << 31), /* AHCI enabled *//* HOST_CAP bits */
Greg Kroah-Hartman
maintainerPATCH 37/83 ahci: Do not receive interrupts sent by dummy ports
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Gordeev <[email protected]>
commit 2cf532f5e67c0cfe38c8c100e49280cdadacd2be upstream.
In multiple MSI mode all AHCI ports (including dummy) get assigned separate MSI vectors and (as result of execution pci_enable_msi_exact() function) separate IRQ numbers, (mapped to the MSI vectors).
Therefore, although interrupts from dummy ports are not desired they are still enabled. We do not request IRQs for dummy ports, but that only means we do not assign AHCI-specific ISRs to corresponding IRQ numbers.
As result, dummy port interrupts still could come and traverse all the way from the PCI device to the kernel, causing unnecessary overhead.
This update disables IRQs for dummy ports and prevents the described issue.
--- drivers/ata/ahci.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/ata/ahci.c +10 -6
@@ -1242,12 +1242,16 @@ int ahci_host_activate(struct ata_host *for (i =0 ; i < host->n_ports; i++) {struct ahci_port_priv *pp = host->ports[i]->private_data; -/* pp is NULL for dummy ports */ -if (pp) - rc =devm_request_threaded_irq (host->dev, - irq + i, ahci_hw_interrupt, - ahci_thread_fn,IRQF_SHARED , - pp->irq_desc, host->ports[i]); +/* Do not receive interrupts sent by dummy ports */ +if (!pp) { +disable_irq (irq + i); +continue ; + } + + rc =devm_request_threaded_irq (host->dev, irq + i, + ahci_hw_interrupt, + ahci_thread_fn,IRQF_SHARED , + pp->irq_desc, host->ports[i]);if (rc) goto out_free_irqs; }
Greg Kroah-Hartman
maintainerPATCH 38/83 libata: Update queued trim blacklist for M5x0 drives
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <[email protected]>
commit d121f7d0cbb875abce249dbf7eb191f9bafe80b7 upstream.
Crucial/Micron M500 drives properly support queued DSM TRIM starting with firmware MU05. Update the blacklist so we only disable queued trim for older firmware releases.
Early M550 series drives suffer from the same issue as M500. A bugfix firmware is in the pipeline but not ready yet. Until then, blacklist queued trim for M550.
--- drivers/ata/libata-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ata/libata-core.c +4 -2
@@ -4224,8 +4224,10 @@ static const struct ata_blacklist_entry { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },/* devices that don't properly handle queued TRIM commands */ - { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, - { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, + { "Micron_M500*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, + { "Crucial_CT???M500SSD*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, + { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, + { "Crucial_CT???M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },/* * Some WD SATA-I drives spin up and down erratically when the link
Greg Kroah-Hartman
maintainerPATCH 39/83 iwlwifi: dvm: take mutex when sending SYNC BT config command
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 82e5a649453a3cf23516277abb84273768a1592b upstream.
There is a flow in which we send the host command in SYNC mode, but we don't take priv->mutex.
--- drivers/net/wireless/iwlwifi/dvm/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/dvm/main.c +6 -2
@@ -252,13 +252,17 @@ static void iwl_bg_bt_runtime_config(strstruct iwl_priv *priv = container_of(work, struct iwl_priv, bt_runtime_config); +mutex_lock (&priv->mutex);if (test_bit (STATUS_EXIT_PENDING , &priv->status)) -return ; + goto out;/* dont send host command if rf-kill is on */ if (!iwl_is_ready_rf (priv)) -return ; + goto out; +iwlagn_send_advance_bt_config (priv); +out: +mutex_unlock (&priv->mutex); }static void iwl_bg_bt_full_concurrency (struct work_struct *work)
Greg Kroah-Hartman
maintainerPATCH 40/83 iwlwifi: mvm: disable uAPSD due to bugs in the firmware
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit a82dda6cd492b8c88952be6f6527f3656f7ac585 upstream.
The current firmware advertises support for uAPSD, but critical bugs force us to disable the feature. When a fixed firmware will be available, we will be able to re-enable uAPSD.
--- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/mvm/mac80211.c +1 -1
@@ -179,7 +179,7 @@ int iwl_mvm_mac_setup_register(struct iw !iwlwifi_mod_params.sw_crypto) hw->flags |=IEEE80211_HW_MFP_CAPABLE ; -if (mvm->fw->ucode_capa.flags &IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT ) { +if (0 && mvm->fw->ucode_capa.flags &IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT ) { hw->flags |=IEEE80211_HW_SUPPORTS_UAPSD ; hw->uapsd_queues =IWL_UAPSD_AC_INFO ; hw->uapsd_max_sp_len =IWL_UAPSD_MAX_SP ;
Greg Kroah-Hartman
maintainerPATCH 41/83 crush: fix off-by-one errors in total_tries refactor
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit 48a163dbb517eba13643bf404a0d695c1ab0a60d upstream.
Back in 27f4d1f6bc32c2ed7b2c5080cbd58b14df622607 we refactored the CRUSH code to allow adjustment of the retry counts on a per-pool basis. That commit had an off-by-one bug: the previous "tries" counter was a *retry* count, not a *try* count, but the new code was passing in 1 meaning there should be no retries.
Fix the ftotal vs tries comparison to use < instead of <= to fix the problem. Note that the original code used <= here, which means the global "choose_total_tries" tunable is actually counting retries. Compensate for that by adding 1 in crush_do_rule when we pull the tunable into the local variable.
This was noticed looking at output from a user provided osdmap. Unfortunately the map doesn't illustrate the change in mapping behavior and I haven't managed to construct one yet that does. Inspection of the crush debug output now aligns with prior versions, though.
Reflects ceph.git commit 795704fd615f0b008dcc81aa088a859b2d075138.
--- net/ceph/crush/mapper.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-)
net/ceph/crush/mapper.c +27 -19
@@ -292,8 +292,8 @@ static int is_out(const struct crush_map* @outpos: our position in that vector * @tries: number of attempts to make * @recurse_tries: number of attempts to have recursive chooseleaf make -* @local_tries: localized retries -* @local_fallback_tries: localized fallback retries +* @local_retries: localized retries +* @local_fallback_retries: localized fallback retries * @recurse_to_leaf: true if we want one device under each item of given type (chooseleaf instead of choose) * @out2: second output vector for leaf items (if @recurse_to_leaf) */
@@ -304,8 +304,8 @@ static int crush_choose_firstn(const str int *out, int outpos, unsigned int tries, unsigned int recurse_tries, - unsigned int local_tries, - unsigned int local_fallback_tries, + unsigned int local_retries, + unsigned int local_fallback_retries, int recurse_to_leaf, int *out2) {
@@ -344,9 +344,9 @@ static int crush_choose_firstn(const str reject =1 ; goto reject; } -if (local_fallback_tries >0 && +if (local_fallback_retries >0 && flocal >= (in->size>>1 ) && - flocal > local_fallback_tries) + flocal > local_fallback_retries) item =bucket_perm_choose (in, x, r);else item =crush_bucket_choose (in, x, r);
@@ -393,8 +393,8 @@ static int crush_choose_firstn(const str x, outpos+1 ,0 , out2, outpos, recurse_tries,0 , - local_tries, - local_fallback_tries, + local_retries, + local_fallback_retries,0 , NULL) <= outpos)/* didn't get leaf */
@@ -420,14 +420,14 @@ reject: ftotal++; flocal++; -if (collide && flocal <= local_tries) +if (collide && flocal <= local_retries)/* retry locally a few times */ retry_bucket =1 ; -else if (local_fallback_tries >0 && - flocal <= in->size + local_fallback_tries) +else if (local_fallback_retries >0 && + flocal <= in->size + local_fallback_retries)/* exhaustive bucket search */ retry_bucket =1 ; -else if (ftotal <= tries) +else if (ftotal < tries)/* then retry descent */ retry_descent =1 ;else
@@ -640,10 +640,18 @@ int crush_do_rule(const struct crush_map__u32 step;int i, j;int numrep; -int choose_tries = map->choose_total_tries; -int choose_local_tries = map->choose_local_tries; -int choose_local_fallback_tries = map->choose_local_fallback_tries; +/* +* the original choose_total_tries value was off by one (it +* counted "retries" and not "tries"). add one. +*/ +int choose_tries = map->choose_total_tries +1 ;int choose_leaf_tries =0 ; +/* +* the local tries values were counted as "retries", though, +* and need no adjustment +*/ +int choose_local_retries = map->choose_local_tries; +int choose_local_fallback_retries = map->choose_local_fallback_tries;if ((__u32 )ruleno >= map->max_rules) {dprintk (" bad ruleno %d\n" , ruleno);
@@ -677,12 +685,12 @@ int crush_do_rule(const struct crush_mapcase CRUSH_RULE_SET_CHOOSE_LOCAL_TRIES :if (curstep->arg1 >0 ) - choose_local_tries = curstep->arg1; + choose_local_retries = curstep->arg1;break ;case CRUSH_RULE_SET_CHOOSE_LOCAL_FALLBACK_TRIES :if (curstep->arg1 >0 ) - choose_local_fallback_tries = curstep->arg1; + choose_local_fallback_retries = curstep->arg1;break ;case CRUSH_RULE_CHOOSELEAF_FIRSTN :
@@ -734,8 +742,8 @@ int crush_do_rule(const struct crush_map o+osize, j, choose_tries, recurse_tries, - choose_local_tries, - choose_local_fallback_tries, + choose_local_retries, + choose_local_fallback_retries, recurse_to_leaf, c+osize); }else {
Greg Kroah-Hartman
maintainerPATCH 42/83 mac80211: fix potential use-after-free
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit d2722f8b87fb172ff2f31d3a2816b31d58678d40 upstream.
The bss struct might be freed in ieee80211_rx_bss_put(), so we shouldn't use it afterwards.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -2708,8 +2708,8 @@ static void ieee80211_rx_bss_info(struct bss =ieee80211_bss_info_update (local, rx_status, mgmt, len, elems, channel);if (bss) { -ieee80211_rx_bss_put (local, bss); sdata->vif.bss_conf.beacon_rate = bss->beacon_rate; +ieee80211_rx_bss_put (local, bss); } }
Greg Kroah-Hartman
maintainerPATCH 43/83 mac80211: fix WPA with VLAN on AP side with ps-sta again
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Braun <[email protected]>
commit 112c44b2df0984121a52fbda89425843b8e1a457 upstream.
commit de74a1d9032f4d37ea453ad2a647e1aff4cd2591
"mac80211: fix WPA with VLAN on AP side with ps-sta"
fixed an issue where queued multicast packets would be sent out encrypted with the key of an other bss.
commit "7cbf9d017dbb5e3276de7d527925d42d4c11e732"
"mac80211: fix oops on mesh PS broadcast forwarding"
essentially reverted it, because vif.type cannot be AP_VLAN due to the check to vif.type in ieee80211_get_buffered_bc before.
As the later commit intended to fix the MESH case, fix it by checking for IFTYPE_AP instead of IFTYPE_AP_VLAN.
--- net/mac80211/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/tx.c +1 -1
@@ -2909,7 +2909,7 @@ ieee80211_get_buffered_bc(struct ieee802cpu_to_le16 (IEEE80211_FCTL_MOREDATA ); } -if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) +if (sdata->vif.type ==NL80211_IFTYPE_AP ) sdata =IEEE80211_DEV_TO_SUB_IF (skb->dev);if (!ieee80211_tx_prepare (sdata, &tx, skb))break ;
Greg Kroah-Hartman
maintainerPATCH 44/83 mac80211: fix suspend vs. authentication race
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 1a1cb744de160ee70086a77afff605bbc275d291 upstream.
Since Stanislaw's patch removing the quiescing code, mac80211 had a race regarding suspend vs. authentication: as cfg80211 doesn't track authentication attempts, it can't abort them. Therefore the attempts may be kept running while suspending, which can lead to all kinds of issues, in at least some cases causing an error in iwlmvm firmware.
Fix this by aborting the authentication attempt when suspending.
--- net/mac80211/ieee80211_i.h | 1 + net/mac80211/mlme.c | 26 ++++++++++++++++++++++++++ net/mac80211/pm.c | 14 +++++++++++--- 3 files changed, 38 insertions(+), 3 deletions(-)
net/mac80211/ieee80211_i.h +1 -0
@@ -1385,6 +1385,7 @@ void ieee80211_sta_reset_conn_monitor(stvoid ieee80211_mgd_stop (struct ieee80211_sub_if_data *sdata);void ieee80211_mgd_conn_tx_status (struct ieee80211_sub_if_data *sdata,__le16 fc,bool acked); +void ieee80211_mgd_quiesce (struct ieee80211_sub_if_data *sdata);void ieee80211_sta_restart (struct ieee80211_sub_if_data *sdata);/* IBSS code */
net/mac80211/mlme.c +26 -0
@@ -3504,6 +3504,32 @@ static void ieee80211_restart_sta_timer( }#ifdef CONFIG_PM +void ieee80211_mgd_quiesce (struct ieee80211_sub_if_data *sdata) +{ +struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; +u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN ]; + +sdata_lock (sdata); + +if (ifmgd->auth_data) { +/* +* If we are trying to authenticate while suspending, cfg80211 +* won't know and won't actually abort those attempts, thus we +* need to do that ourselves. +*/ +ieee80211_send_deauth_disassoc (sdata, + ifmgd->auth_data->bss->bssid, +IEEE80211_STYPE_DEAUTH , +WLAN_REASON_DEAUTH_LEAVING , + false, frame_buf); +ieee80211_destroy_auth_data (sdata, false); +cfg80211_tx_mlme_mgmt (sdata->dev, frame_buf, +IEEE80211_DEAUTH_FRAME_LEN ); + } + +sdata_unlock (sdata); +} +void ieee80211_sta_restart (struct ieee80211_sub_if_data *sdata) {struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
net/mac80211/pm.c +11 -3
@@ -100,10 +100,18 @@ int __ieee80211_suspend(struct ieee80211/* remove all interfaces that were created in the driver */ list_for_each_entry (sdata, &local->interfaces, list) { -if (!ieee80211_sdata_running (sdata) || - sdata->vif.type ==NL80211_IFTYPE_AP_VLAN || - sdata->vif.type ==NL80211_IFTYPE_MONITOR ) +if (!ieee80211_sdata_running (sdata))continue ; +switch (sdata->vif.type) { +case NL80211_IFTYPE_AP_VLAN : +case NL80211_IFTYPE_MONITOR : +continue ; +case NL80211_IFTYPE_STATION : +ieee80211_mgd_quiesce (sdata); +break ; +default : +break ; + }drv_remove_interface (local, sdata); }
Greg Kroah-Hartman
maintainerPATCH 45/83 mac80211: fix software remain-on-channel implementation
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 115b943a6ea12656088fa1ff6634c0d30815e55b upstream.
Jouni reported that when doing off-channel transmissions mixed with on-channel transmissions, the on-channel ones ended up on the off-channel in some cases.
The reason for that is that during the refactoring of the off- channel code, I lost the part that stopped all activity and as a consequence the on-channel frames (including data frames) were no longer queued but would be transmitted on the temporary channel.
Fix this by simply restoring the lost activity stop call.
--- net/mac80211/offchannel.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/offchannel.c +1 -0
@@ -355,6 +355,7 @@ void ieee80211_sw_roc_work(struct work_sstruct ieee80211_roc_work *dep;/* start this ROC */ +ieee80211_offchannel_stop_vifs (local);/* switch channel etc */ ieee80211_recalc_idle (local);
Greg Kroah-Hartman
maintainerPATCH 46/83 mac80211: exclude AP_VLAN interfaces from tx power calculation
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 764152ff66f4a8be1f9d7981e542ffdaa5bd7aff upstream.
Their power value is initialized to zero. This patch fixes an issue where the configured power drops to the minimum value when AP_VLAN interfaces are created/removed.
--- net/mac80211/main.c | 2 ++ 1 file changed, 2 insertions(+)
net/mac80211/main.c +2 -0
@@ -148,6 +148,8 @@ static u32 ieee80211_hw_conf_chan(structlist_for_each_entry_rcu (sdata, &local->interfaces, list) {if (!rcu_access_pointer (sdata->vif.chanctx_conf))continue ; +if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) +continue ; power =min (power, sdata->vif.bss_conf.txpower); }rcu_read_unlock ();
Greg Kroah-Hartman
maintainerPATCH 47/83 ath9k: fix ready time of the multicast buffer queue
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 3b3e0efb5c72c4fc940af50b33626b8a78a907dc upstream.
qi->tqi_readyTime is written directly to registers that expect microseconds as unit instead of TU.
When setting the CABQ ready time, cur_conf->beacon_interval is in TU, so convert it to microseconds before passing it to ath9k_hw.
This should hopefully fix some Tx DMA issues with buffered multicast frames in AP mode.
--- drivers/net/wireless/ath/ath9k/xmit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/xmit.c +1 -1
@@ -1698,7 +1698,7 @@ int ath_cabq_update(struct ath_softc *scath9k_hw_get_txq_props (sc->sc_ah, qnum, &qi); - qi.tqi_readyTime = (cur_conf->beacon_interval * + qi.tqi_readyTime = (TU_TO_USEC (cur_conf->beacon_interval) *ATH_CABQ_READY_TIME ) /100 ;ath_txq_update (sc, qnum, &qi);
Greg Kroah-Hartman
maintainerPATCH 48/83 locks: allow __break_lease to sleep even when break_time is 0
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 4991a628a789dc5954e98e79476d9808812292ec upstream.
A fl->fl_break_time of 0 has a special meaning to the lease break code that basically means "never break the lease". knfsd uses this to ensure that leases don't disappear out from under it.
Unfortunately, the code in __break_lease can end up passing this value to wait_event_interruptible as a timeout, which prevents it from going to sleep at all. This causes __break_lease to spin in a tight loop and causes soft lockups.
Fix this by ensuring that we pass a minimum value of 1 as a timeout instead.
--- fs/locks.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/locks.c +3 -4
@@ -1376,11 +1376,10 @@ int __break_lease(struct inode *inode, u restart: break_time = flock->fl_break_time; -if (break_time !=0 ) { +if (break_time !=0 ) break_time -= jiffies; -if (break_time ==0 ) - break_time++; - } +if (break_time ==0 ) + break_time++;locks_insert_block (flock, new_fl);spin_unlock (&inode->i_lock); error = wait_event_interruptible_timeout(new_fl->fl_wait,
Greg Kroah-Hartman
maintainerPATCH 49/83 rtlwifi: rtl8723ae: Fix too long disable of IRQs
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit bfc1010c418a22cbebd8b1bd1e75dad6a527a609 upstream.
In commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 entitled "rtlwifi:
rtl8192ce: Fix too long disable of IRQs", Olivier Langlois <[email protected]> fixed a problem caused by an extra long disabling of interrupts. This patch makes the same fix for rtl8723ae.
--- drivers/net/wireless/rtlwifi/rtl8723ae/hw.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/net/wireless/rtlwifi/rtl8723ae/hw.c +15 -3
@@ -880,14 +880,25 @@ int rtl8723ae_hw_init(struct ieee80211_hbool rtstatus = true;int err;u8 tmp_u1b; +unsigned long flags; rtlpriv->rtlhal.being_init_adapter = true; +/* As this function can take a very long time (up to 350 ms) +* and can be called with irqs disabled, reenable the irqs +* to let the other devices continue being serviced. +* +* It is safe doing so since our own interrupts will only be enabled +* in a subsequent step. +*/ +local_save_flags (flags); +local_irq_enable (); + rtlpriv->intf_ops->disable_aspm (hw); rtstatus =_rtl8712e_init_mac (hw);if (rtstatus != true) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"Init MAC failed\n" ); err =1 ; -return err; + goto exit; } err =rtl8723ae_download_fw (hw);
@@ -895,8 +906,7 @@ int rtl8723ae_hw_init(struct ieee80211_hRT_TRACE (rtlpriv,COMP_ERR ,DBG_WARNING ,"Failed to download FW. Init HW without FW now..\n" ); err =1 ; - rtlhal->fw_ready = false; -return err; + goto exit; }else { rtlhal->fw_ready = true; }
@@ -971,6 +981,8 @@ int rtl8723ae_hw_init(struct ieee80211_hRT_TRACE (rtlpriv,COMP_INIT ,DBG_TRACE ,"under 1.5V\n" ); }rtl8723ae_dm_init (hw); +exit: +local_irq_restore (flags); rtlpriv->rtlhal.being_init_adapter = false;return err; }
Greg Kroah-Hartman
maintainerPATCH 50/83 rtlwifi: rtl8188ee: Fix too long disable of IRQs
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 6b6392715856d563719991e9ce95e773491a8983 upstream.
In commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 entitled "rtlwifi:
rtl8192ce: Fix too long disable of IRQs", Olivier Langlois <[email protected]> fixed a problem caused by an extra long disabling of interrupts. This patch makes the same fix for rtl8188ee.
--- drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/net/wireless/rtlwifi/rtl8188ee/hw.c +16 -4
@@ -1025,9 +1025,20 @@ int rtl88ee_hw_init(struct ieee80211_hwbool rtstatus = true;int err =0 ;u8 tmp_u1b, u1byte; +unsigned long flags;RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD ,"Rtl8188EE hw init\n" ); rtlpriv->rtlhal.being_init_adapter = true; +/* As this function can take a very long time (up to 350 ms) +* and can be called with irqs disabled, reenable the irqs +* to let the other devices continue being serviced. +* +* It is safe doing so since our own interrupts will only be enabled +* in a subsequent step. +*/ +local_save_flags (flags); +local_irq_enable (); + rtlpriv->intf_ops->disable_aspm (hw); tmp_u1b =rtl_read_byte (rtlpriv,REG_SYS_CLKR +1 );
@@ -1043,7 +1054,7 @@ int rtl88ee_hw_init(struct ieee80211_hwif (rtstatus != true) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"Init MAC failed\n" ); err =1 ; -return err; + goto exit; } err =rtl88e_download_fw (hw, false);
@@ -1051,8 +1062,7 @@ int rtl88ee_hw_init(struct ieee80211_hwRT_TRACE (rtlpriv,COMP_ERR ,DBG_WARNING ,"Failed to download FW. Init HW without FW now..\n" ); err =1 ; - rtlhal->fw_ready = false; -return err; + goto exit; }else { rtlhal->fw_ready = true; }
@@ -1135,10 +1145,12 @@ int rtl88ee_hw_init(struct ieee80211_hw }rtl_write_byte (rtlpriv,REG_NAV_CTRL +2 , ((30000 +127 )/128 ));rtl88e_dm_init (hw); +exit: +local_irq_restore (flags); rtlpriv->rtlhal.being_init_adapter = false;RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD ,"end of Rtl8188EE hw init %x\n" , err); -return 0 ; +return err; }static enum version_8188e _rtl88ee_read_chip_version (struct ieee80211_hw *hw)
Greg Kroah-Hartman
maintainerPATCH 51/83 rtlwifi: rtl8192cu: Fix too long disable of IRQs
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit a53268be0cb9763f11da4f6fe3fb924cbe3a7d4a upstream.
In commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 entitled "rtlwifi:
rtl8192ce: Fix too long disable of IRQs", Olivier Langlois <[email protected]> fixed a problem caused by an extra long disabling of interrupts. This patch makes the same fix for rtl8192cu.
--- drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +14 -1
@@ -985,6 +985,17 @@ int rtl92cu_hw_init(struct ieee80211_hwstruct rtl_ps_ctl *ppsc =rtl_psc (rtl_priv (hw));int err =0 ;static bool iqk_initialized; +unsigned long flags; + +/* As this function can take a very long time (up to 350 ms) +* and can be called with irqs disabled, reenable the irqs +* to let the other devices continue being serviced. +* +* It is safe doing so since our own interrupts will only be enabled +* in a subsequent step. +*/ +local_save_flags (flags); +local_irq_enable (); rtlhal->hw_type =HARDWARE_TYPE_RTL8192CU ; err =_rtl92cu_init_mac (hw);
@@ -997,7 +1008,7 @@ int rtl92cu_hw_init(struct ieee80211_hwRT_TRACE (rtlpriv,COMP_ERR ,DBG_WARNING ,"Failed to download FW. Init HW without FW now..\n" ); err =1 ; -return err; + goto exit; } rtlhal->last_hmeboxnum =0 ;/* h2c */ _rtl92cu_phy_param_tab_init (hw);
@@ -1034,6 +1045,8 @@ int rtl92cu_hw_init(struct ieee80211_hw_InitPABias (hw);_update_mac_setting (hw);rtl92c_dm_init (hw); +exit: +local_irq_restore (flags);return err; }
Greg Kroah-Hartman
maintainerPATCH 52/83 rtlwifi: rtl8192se: Fix too long disable of IRQs
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 2610decdd0b3808ba20471a999835cfee5275f98 upstream.
In commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 entitled "rtlwifi:
rtl8192ce: Fix too long disable of IRQs", Olivier Langlois <[email protected]> fixed a problem caused by an extra long disabling of interrupts. This patch makes the same fix for rtl8192se.
--- drivers/net/wireless/rtlwifi/rtl8192se/hw.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192se/hw.c +21 -6
@@ -955,7 +955,7 @@ int rtl92se_hw_init(struct ieee80211_hwstruct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw));struct rtl_efuse *rtlefuse =rtl_efuse (rtl_priv (hw));u8 tmp_byte =0 ; - +unsigned long flags;bool rtstatus = true;u8 tmp_u1b;int err = false;
@@ -967,6 +967,16 @@ int rtl92se_hw_init(struct ieee80211_hw rtlpci->being_init_adapter = true; +/* As this function can take a very long time (up to 350 ms) +* and can be called with irqs disabled, reenable the irqs +* to let the other devices continue being serviced. +* +* It is safe doing so since our own interrupts will only be enabled +* in a subsequent step. +*/ +local_save_flags (flags); +local_irq_enable (); + rtlpriv->intf_ops->disable_aspm (hw);/* 1. MAC Initialize */
@@ -984,7 +994,8 @@ int rtl92se_hw_init(struct ieee80211_hwRT_TRACE (rtlpriv,COMP_ERR ,DBG_WARNING ,"Failed to download FW. Init HW without FW now... " "Please copy FW into /lib/firmware/rtlwifi\n" ); -return 1 ; + err =1 ; + goto exit; }/* After FW download, we have to reset MAC register */
@@ -997,7 +1008,8 @@ int rtl92se_hw_init(struct ieee80211_hw/* 3. Initialize MAC/PHY Config by MACPHY_reg.txt */ if (!rtl92s_phy_mac_config (hw)) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"MAC Config failed\n" ); -return rtstatus; + err = rtstatus; + goto exit; }/* because last function modify RCR, so we update
@@ -1016,7 +1028,8 @@ int rtl92se_hw_init(struct ieee80211_hw/* 4. Initialize BB After MAC Config PHY_reg.txt, AGC_Tab.txt */ if (!rtl92s_phy_bb_config (hw)) {RT_TRACE (rtlpriv,COMP_INIT ,DBG_EMERG ,"BB Config failed\n" ); -return rtstatus; + err = rtstatus; + goto exit; }/* 5. Initiailze RF RAIO_A.txt RF RAIO_B.txt */
@@ -1033,7 +1046,8 @@ int rtl92se_hw_init(struct ieee80211_hwif (!rtl92s_phy_rf_config (hw)) {RT_TRACE (rtlpriv,COMP_INIT ,DBG_DMESG ,"RF Config failed\n" ); -return rtstatus; + err = rtstatus; + goto exit; }/* After read predefined TXT, we must set BB/MAC/RF
@@ -1122,8 +1136,9 @@ int rtl92se_hw_init(struct ieee80211_hw rtlpriv->cfg->ops->led_control (hw,LED_CTL_POWER_ON );rtl92s_dm_init (hw); +exit: +local_irq_restore (flags); rtlpci->being_init_adapter = false; -return err; }
Greg Kroah-Hartman
maintainerPATCH 53/83 rtlwifi: rtl8192se: Fix regression due to commit 1bf4bbb
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 5f9186990ec4579ee5b7a99b3254c29eda479f36 upstream.
Beginning with kernel 3.13, this driver fails on some systems. The problem was bisected to:
Commit 1bf4bbb4024dcdab5e57634dd8ae1072d42a53ac
Author: Felix Fietkau <[email protected]>
Title: mac80211: send control port protocol frames to the VO queue
There is noting wrong with the above commit. The regression occurs because V0 queue on RTL8192SE cards uses priority 6, not the usual 7. The fix is to modify the rtl8192se routine that sets the correct transmit queue.
--- drivers/net/wireless/rtlwifi/rtl8192se/trx.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/rtlwifi/rtl8192se/trx.c +6 -0
@@ -49,6 +49,12 @@ static u8 _rtl92se_map_hwqueue_to_fwqueuif (ieee80211_is_nullfunc (fc))return QSLT_HIGH ; +/* Kernel commit 1bf4bbb4024dcdab changed EAPOL packets to use +* queue V0 at priority 7; however, the RTL8192SE appears to have +* that queue at priority 6 +*/ +if (skb->priority ==7 ) +return QSLT_VO ;return skb->priority; }
Greg Kroah-Hartman
maintainerPATCH 54/83 rtlwifi: rtl8188ee: initialize packet_beacon
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 328e203fc35f0b4f6df1c4943f74cf553bcc04f8 upstream.
static code analysis from cppcheck reports:
[drivers/net/wireless/rtlwifi/rtl8188ee/trx.c:322]:
(error) Uninitialized variable: packet_beacon
packet_beacon is not initialized and hence packet_beacon contains garbage from the stack, so set it to false.
--- drivers/net/wireless/rtlwifi/rtl8188ee/trx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/rtl8188ee/trx.c +1 -1
@@ -293,7 +293,7 @@ static void _rtl88ee_translate_rx_signalu8 *psaddr;__le16 fc;u16 type, ufc; -bool match_bssid, packet_toself, packet_beacon, addr; +bool match_bssid, packet_toself, packet_beacon = false, addr; tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift;
Greg Kroah-Hartman
maintainerPATCH 55/83 gpio: mxs: Allow for recursive enable_irq_wake() call
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit a585f87c863e4e1d496459d382b802bf5ebe3717 upstream.
The scenario here is that someone calls enable_irq_wake() from somewhere in the code. This will result in the lockdep producing a backtrace as can be seen below. In my case, this problem is triggered when using the wl1271 (TI WlCore) driver found in drivers/net/wireless/ti/ .
The problem cause is rather obvious from the backtrace, but let's outline the dependency. enable_irq_wake() grabs the IRQ buslock in irq_set_irq_wake(), which in turns calls mxs_gpio_set_wake_irq() . But mxs_gpio_set_wake_irq() calls enable_irq_wake() again on the one-level-higher IRQ , thus it tries to grab the IRQ buslock again in irq_set_irq_wake() . Because the spinlock in irq_set_irq_wake()->irq_get_desc_buslock()->__irq_get_desc_lock() is not marked as recursive, lockdep will spew the stuff below.
We know we can safely re-enter the lock, so use IRQ_GC_INIT_NESTED_LOCK to fix the spew.
=============================================
[ INFO: possible recursive locking detected ] 3.10.33-00012-gf06b763-dirty #61 Not tainted
---------------------------------------------
kworker/0:1/18 is trying to acquire lock:
(&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
but task is already holding lock:
(&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&irq_desc_lock_class);
lock(&irq_desc_lock_class);
*** DEADLOCK ***
May be due to missing lock nesting notation
3 locks held by kworker/0:1/18:
#0: (events){.+.+.+}, at: [<c0036308>] process_one_work+0x134/0x4a4
#1: ((&fw_work->work)){+.+.+.}, at: [<c0036308>] process_one_work+0x134/0x4a4
#2: (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88stack backtrace: CPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 3.10.33-00012-gf06b763-dirty #61 Workqueue: events request_firmware_work_func [<c0013eb4>] (unwind_backtrace+0x0/0xf0) from [<c0011c74>] (show_stack+0x10/0x14) [<c0011c74>] (show_stack+0x10/0x14) from [<c005bb08>] (__lock_acquire+0x140c/0x1a64) [<c005bb08>] (__lock_acquire+0x140c/0x1a64) from [<c005c6a8>] (lock_acquire+0x9c/0x104) [<c005c6a8>] (lock_acquire+0x9c/0x104) from [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58) [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c00685f0>] (__irq_get_desc_lock+0x48/0x88) [<c00685f0>] (__irq_get_desc_lock+0x48/0x88) from [<c0068e78>] (irq_set_irq_wake+0x20/0xf4) [<c0068e78>] (irq_set_irq_wake+0x20/0xf4) from [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24) [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24) from [<c0068cf4>] (set_irq_wake_real+0x30/0x44) [<c0068cf4>] (set_irq_wake_real+0x30/0x44) from [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4) [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4) from [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c) [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c) from [<c02be5e8>] (request_firmware_work_func+0x38/0x58) [<c02be5e8>] (request_firmware_work_func+0x38/0x58) from [<c0036394>] (process_one_work+0x1c0/0x4a4) [<c0036394>] (process_one_work+0x1c0/0x4a4) from [<c0036a4c>] (worker_thread+0x138/0x394) [<c0036a4c>] (worker_thread+0x138/0x394) from [<c003cb74>] (kthread+0xa4/0xb0) [<c003cb74>] (kthread+0xa4/0xb0) from [<c000ee00>] (ret_from_fork+0x14/0x34) wlcore: loaded
--- drivers/gpio/gpio-mxs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-mxs.c +2 -1
@@ -214,7 +214,8 @@ static void __init mxs_gpio_init_gc(stru ct->regs.ack =PINCTRL_IRQSTAT (port) +MXS_CLR ; ct->regs.mask =PINCTRL_IRQEN (port); -irq_setup_generic_chip (gc,IRQ_MSK (32 ),0 ,IRQ_NOREQUEST ,0 ); +irq_setup_generic_chip (gc,IRQ_MSK (32 ),IRQ_GC_INIT_NESTED_LOCK , +IRQ_NOREQUEST ,0 ); }static int mxs_gpio_to_irq (struct gpio_chip *gc,unsigned offset)
Greg Kroah-Hartman
maintainerPATCH 56/83 pinctrl: as3722: fix handling of GPIO invert bit
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Bresticker <[email protected]>
commit a73d2e30b46787d478275db36c19222020e29dc5 upstream.
The AS3722_GPIO_INV bit will always be blindly overwritten by as3722_pinctrl_gpio_set_direction() and will be ignored when setting the value of the GPIO in as3722_gpio_set() since the enable_gpio_invert flag is never set. This will cause an initially inverted GPIO to toggle when requested as an output, which could be problematic if, for example, the GPIO controls a critical regulator.
Instead of setting up the enable_gpio_invert flag, just leave the invert bit alone and check it before setting the GPIO value.
--- drivers/pinctrl/pinctrl-as3722.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/pinctrl/pinctrl-as3722.c +11 -6
@@ -64,7 +64,6 @@ struct as3722_pin_function { };struct as3722_gpio_pin_control { -bool enable_gpio_invert;unsigned mode_prop;int io_function; };
@@ -320,10 +319,8 @@ static int as3722_pinctrl_gpio_set_direcreturn mode; } -if (as_pci->gpio_control[offset].enable_gpio_invert) - mode |=AS3722_GPIO_INV ; - -return as3722_write (as3722,AS3722_GPIOn_CONTROL_REG (offset), mode); +return as3722_update_bits (as3722,AS3722_GPIOn_CONTROL_REG (offset), +AS3722_GPIO_MODE_MASK , mode); }static const struct pinmux_ops as3722_pinmux_ops = {
@@ -496,10 +493,18 @@ static void as3722_gpio_set(struct gpio_ {struct as3722_pctrl_info *as_pci =to_as_pci (chip);struct as3722 *as3722 = as_pci->as3722; -int en_invert = as_pci->gpio_control[offset].enable_gpio_invert; +int en_invert;u32 val;int ret; + ret =as3722_read (as3722,AS3722_GPIOn_CONTROL_REG (offset), &val); +if (ret <0 ) { +dev_err (as_pci->dev, +"GPIO_CONTROL%d_REG read failed: %d\n" , offset, ret); +return ; + } + en_invert = !!(val &AS3722_GPIO_INV ); +if (value) val = (en_invert) ?0 :AS3722_GPIOn_SIGNAL (offset);else
Greg Kroah-Hartman
maintainerPATCH 57/83 tgafb: fix mode setting with fbset
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 624966589041deb32a2626ee2e176e8274581101 upstream.
Mode setting in the TGA driver is broken for these reasons:
- info->fix.line_length is set just once in tgafb_init_fix function. If we change videomode, info->fix.line_length is not recalculated - so the video mode is changed but the screen is corrupted because of wrong info->fix.line_length.
- info->fix.smem_len is set in tgafb_init_fix to the size of the default video mode (640x480). If we set a higher resolution, info->fix.smem_len is smaller than the current screen size, preventing the userspace program from mapping the framebuffer.
This patch fixes it:
- info->fix.line_length initialization is moved to tgafb_set_par so that it is recalculated with each mode change.
- info->fix.smem_len is set to a fixed value representing the real amount of video ram (the values are taken from xfree86 driver).
- add a check to tgafb_check_var to prevent us from setting a videomode that doesn't fit into videoram.
- in tgafb_register, tgafb_init_fix is moved upwards, to be called before fb_find_mode (because fb_find_mode already needs the videoram size set in tgafb_init_fix).
--- drivers/video/tgafb.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/video/tgafb.c +14 -4
@@ -182,6 +182,8 @@ tgafb_check_var(struct fb_var_screeninfoif (var->xres_virtual != var->xres || var->yres_virtual != var->yres)return -EINVAL ; +if (var->xres * var->yres * (var->bits_per_pixel >>3 ) > info->fix.smem_len) +return -EINVAL ;if (var->nonstd)return -EINVAL ;if (1000000000 / var->pixclock >TGA_PLL_MAX_FREQ )
@@ -262,6 +264,7 @@ tgafb_set_par(struct fb_info *info) par->yres = info->var.yres; par->pll_freq = pll_freq =1000000000 / info->var.pixclock; par->bits_per_pixel = info->var.bits_per_pixel; + info->fix.line_length = par->xres * (par->bits_per_pixel >>3 ); tga_type = par->tga_type;
@@ -1470,6 +1473,7 @@ tgafb_init_fix(struct fb_info *info)int tga_bus_tc =TGA_BUS_TC (par->dev);u8 tga_type = par->tga_type;const char *tga_type_name =NULL ; +unsigned memory_size;switch (tga_type) {case TGA_TYPE_8PLANE :
@@ -1477,22 +1481,27 @@ tgafb_init_fix(struct fb_info *info) tga_type_name ="Digital ZLXp-E1" ;if (tga_bus_tc) tga_type_name ="Digital ZLX-E1" ; + memory_size =2097152 ;break ;case TGA_TYPE_24PLANE :if (tga_bus_pci) tga_type_name ="Digital ZLXp-E2" ;if (tga_bus_tc) tga_type_name ="Digital ZLX-E2" ; + memory_size =8388608 ;break ;case TGA_TYPE_24PLUSZ :if (tga_bus_pci) tga_type_name ="Digital ZLXp-E3" ;if (tga_bus_tc) tga_type_name ="Digital ZLX-E3" ; + memory_size =16777216 ;break ; } -if (!tga_type_name) +if (!tga_type_name) { tga_type_name ="Unknown" ; + memory_size =16777216 ; + }strlcpy (info->fix.id, tga_type_name,sizeof (info->fix.id));
@@ -1502,9 +1511,8 @@ tgafb_init_fix(struct fb_info *info) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR); - info->fix.line_length = par->xres * (par->bits_per_pixel >>3 ); info->fix.smem_start = (size_t ) par->tga_fb_base; - info->fix.smem_len = info->fix.line_length * par->yres; + info->fix.smem_len = memory_size; info->fix.mmio_start = (size_t ) par->tga_regs_base; info->fix.mmio_len =512 ;
@@ -1628,6 +1636,9 @@ static int tgafb_register(struct device modedb_tga = &modedb_tc; modedbsize_tga =1 ; } + +tgafb_init_fix (info); + ret = fb_find_mode(&info->var, info, mode_option ? mode_option : mode_option_tga, modedb_tga, modedbsize_tga, NULL,
@@ -1645,7 +1656,6 @@ static int tgafb_register(struct device }tgafb_set_par (info); -tgafb_init_fix (info);if (register_framebuffer (info) <0 ) {printk (KERN_ERR "tgafb: Could not register framebuffer\n" );
Greg Kroah-Hartman
maintainerPATCH 58/83 tgafb: fix data copying
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 6b0df6827bb6fcacb158dff29ad0a62d6418b534 upstream.
The functions for data copying copyarea_foreward_8bpp and copyarea_backward_8bpp are buggy, they produce screen corruption.
This patch fixes the functions and moves the logic to one function "copyarea_8bpp". For simplicity, the function only handles copying that is aligned on 8 pixes. If we copy an unaligned area, generic function cfb_copyarea is used.
--- drivers/video/tgafb.c | 264 +++++++++----------------------------------------- 1 file changed, 51 insertions(+), 213 deletions(-)
drivers/video/tgafb.c +51 -213
@@ -1139,222 +1139,57 @@ copyarea_line_32bpp(struct fb_info *info__raw_writel (TGA_MODE_SBM_24BPP |TGA_MODE_SIMPLE , tga_regs+TGA_MODE_REG ); } -/* The general case of forward copy in 8bpp mode. */ +/* The (almost) general case of backward copy in 8bpp mode. */ static inline void -copyarea_foreward_8bpp (struct fb_info *info,u32 dx,u32 dy,u32 sx,u32 sy, -u32 height,u32 width,u32 line_length) +copyarea_8bpp (struct fb_info *info,u32 dx,u32 dy,u32 sx,u32 sy, +u32 height,u32 width,u32 line_length, +const struct fb_copyarea *area) {struct tga_par *par = (struct tga_par *) info->par; -unsigned long i, copied, left; -unsigned long dpos, spos, dalign, salign, yincr; -u32 smask_first, dmask_first, dmask_last; -int pixel_shift, need_prime, need_second; -unsigned long n64, n32, xincr_first; +unsigned i, yincr; +int depos, sepos, backward, last_step, step; +u32 mask_last; +unsigned n32;void __iomem *tga_regs;void __iomem *tga_fb; - yincr = line_length; -if (dy > sy) { - dy += height -1 ; - sy += height -1 ; - yincr = -yincr; - } - -/* Compute the offsets and alignments in the frame buffer. -More than anything else, these control how we do copies. */ - dpos = dy * line_length + dx; - spos = sy * line_length + sx; - dalign = dpos &7 ; - salign = spos &7 ; - dpos &=-8 ; - spos &=-8 ; - -/* Compute the value for the PIXELSHIFT register. This controls -both non-co-aligned source and destination and copy direction. */ -if (dalign >= salign) - pixel_shift = dalign - salign; -else - pixel_shift =8 - (salign - dalign); - -/* Figure out if we need an additional priming step for the -residue register. */ - need_prime = (salign > dalign); -if (need_prime) - dpos -=8 ; - -/* Begin by copying the leading unaligned destination. Copy enough -to make the next destination address 32-byte aligned. */ - copied =32 - (dalign + (dpos &31 )); -if (copied ==32 ) - copied =0 ; - xincr_first = (copied +7 ) &-8 ; - smask_first = dmask_first = (1ul << copied) -1 ; - smask_first <<= salign; - dmask_first <<= dalign + need_prime*8 ; -if (need_prime && copied >24 ) - copied -=8 ; - left = width - copied; - -/* Care for small copies. */ -if (copied > width) { -u32 t; - t = (1ul << width) -1 ; - t <<= dalign + need_prime*8 ; - dmask_first &= t; - left =0 ; - } - -/* Attempt to use 64-byte copies. This is only possible if the -source and destination are co-aligned at 64 bytes. */ - n64 = need_second =0 ; -if ((dpos &63 ) == (spos &63 ) - && (height ==1 || line_length %64 ==0 )) { -/* We may need a 32-byte copy to ensure 64 byte alignment. */ - need_second = (dpos + xincr_first) &63 ; -if ((need_second &32 ) != need_second) -printk (KERN_ERR "tgafb: need_second wrong\n" ); -if (left >= need_second +64 ) { - left -= need_second; - n64 = left /64 ; - left %=64 ; - }else - need_second =0 ; - } - -/* Copy trailing full 32-byte sections. This will be the main -loop if the 64 byte loop can't be used. */ - n32 = left /32 ; - left %=32 ; - -/* Copy the trailing unaligned destination. */ - dmask_last = (1ul << left) -1 ; - - tga_regs = par->tga_regs_base; - tga_fb = par->tga_fb_base; - -/* Set up the MODE and PIXELSHIFT registers. */ -__raw_writel (TGA_MODE_SBM_8BPP |TGA_MODE_COPY , tga_regs+TGA_MODE_REG ); -__raw_writel (pixel_shift, tga_regs+TGA_PIXELSHIFT_REG ); -wmb (); - -for (i =0 ; i < height; ++i) { -unsigned long j; -void __iomem *sfb; -void __iomem *dfb; - - sfb = tga_fb + spos; - dfb = tga_fb + dpos; -if (dmask_first) { -__raw_writel (smask_first, sfb); -wmb (); -__raw_writel (dmask_first, dfb); -wmb (); - sfb += xincr_first; - dfb += xincr_first; - } - -if (need_second) { -__raw_writel (0xffffffff , sfb); -wmb (); -__raw_writel (0xffffffff , dfb); -wmb (); - sfb +=32 ; - dfb +=32 ; - } - -if (n64 && (((unsigned long )sfb | (unsigned long )dfb) &63 )) -printk (KERN_ERR -"tgafb: misaligned copy64 (s:%p, d:%p)\n" , - sfb, dfb); - -for (j =0 ; j < n64; ++j) { -__raw_writel (sfb - tga_fb, tga_regs+TGA_COPY64_SRC ); -wmb (); -__raw_writel (dfb - tga_fb, tga_regs+TGA_COPY64_DST ); -wmb (); - sfb +=64 ; - dfb +=64 ; - } - -for (j =0 ; j < n32; ++j) { -__raw_writel (0xffffffff , sfb); -wmb (); -__raw_writel (0xffffffff , dfb); -wmb (); - sfb +=32 ; - dfb +=32 ; - } - -if (dmask_last) { -__raw_writel (0xffffffff , sfb); -wmb (); -__raw_writel (dmask_last, dfb); -wmb (); - } - - spos += yincr; - dpos += yincr; +/* Do acceleration only if we are aligned on 8 pixels */ +if ((dx | sx | width) &7 ) { +cfb_copyarea (info, area); +return ; } -/* Reset the MODE register to normal. */ -__raw_writel (TGA_MODE_SBM_8BPP |TGA_MODE_SIMPLE , tga_regs+TGA_MODE_REG ); -} - -/* The (almost) general case of backward copy in 8bpp mode. */ -static inline void -copyarea_backward_8bpp (struct fb_info *info,u32 dx,u32 dy,u32 sx,u32 sy, -u32 height,u32 width,u32 line_length, -const struct fb_copyarea *area) -{ -struct tga_par *par = (struct tga_par *) info->par; -unsigned long i, left, yincr; -unsigned long depos, sepos, dealign, sealign; -u32 mask_first, mask_last; -unsigned long n32; -void __iomem *tga_regs; -void __iomem *tga_fb; - yincr = line_length;if (dy > sy) { dy += height -1 ; sy += height -1 ; yincr = -yincr; } + backward = dy == sy && dx > sx && dx < sx + width;/* Compute the offsets and alignments in the frame buffer. More than anything else, these control how we do copies. */ - depos = dy * line_length + dx + width; - sepos = sy * line_length + sx + width; - dealign = depos &7 ; - sealign = sepos &7 ; - -/* ??? The documentation appears to be incorrect (or very -misleading) wrt how pixel shifting works in backward copy -mode, i.e. when PIXELSHIFT is negative. I give up for now. -Do handle the common case of co-aligned backward copies, -but frob everything else back on generic code. */ -if (dealign != sealign) { -cfb_copyarea (info, area); -return ; - } - -/* We begin the copy with the trailing pixels of the -unaligned destination. */ - mask_first = (1ul << dealign) -1 ; - left = width - dealign; - -/* Care for small copies. */ -if (dealign > width) { - mask_first ^= (1ul << (dealign - width)) -1 ; - left =0 ; - } + depos = dy * line_length + dx; + sepos = sy * line_length + sx; +if (backward) + depos += width, sepos += width;/* Next copy full words at a time. */ - n32 = left /32 ; - left %=32 ; + n32 = width /32 ; + last_step = width %32 ;/* Finally copy the unaligned head of the span. */ - mask_last =-1 << (32 - left); + mask_last = (1ul << last_step) -1 ; + +if (!backward) { + step =32 ; + last_step =32 ; + }else { + step =-32 ; + last_step = -last_step; + sepos -=32 ; + depos -=32 ; + } tga_regs = par->tga_regs_base; tga_fb = par->tga_fb_base;
@@ -1371,25 +1206,33 @@ copyarea_backward_8bpp(struct fb_info *i sfb = tga_fb + sepos; dfb = tga_fb + depos; -if (mask_first) { -__raw_writel (mask_first, sfb); -wmb (); -__raw_writel (mask_first, dfb); -wmb (); - } -for (j =0 ; j < n32; ++j) { - sfb -=32 ; - dfb -=32 ; +for (j =0 ; j < n32; j++) { +if (j <2 && j +1 < n32 && !backward && + !(((unsigned long )sfb | (unsigned long )dfb) &63 )) { +do { +__raw_writel (sfb - tga_fb, tga_regs+TGA_COPY64_SRC ); +wmb (); +__raw_writel (dfb - tga_fb, tga_regs+TGA_COPY64_DST ); +wmb (); + sfb +=64 ; + dfb +=64 ; + j +=2 ; + }while (j +1 < n32); + j--; +continue ; + }__raw_writel (0xffffffff , sfb);wmb ();__raw_writel (0xffffffff , dfb);wmb (); + sfb += step; + dfb += step; }if (mask_last) { - sfb -=32 ; - dfb -=32 ; + sfb += last_step - step; + dfb += last_step - step;__raw_writel (mask_last, sfb);wmb ();__raw_writel (mask_last, dfb);
@@ -1450,14 +1293,9 @@ tgafb_copyarea(struct fb_info *info, conelse if (bpp ==32 )cfb_copyarea (info, area); -/* Detect overlapping source and destination that requires -a backward copy. */ -else if (dy == sy && dx > sx && dx < sx + width) -copyarea_backward_8bpp (info, dx, dy, sx, sy, height, - width, line_length, area);else -copyarea_foreward_8bpp (info, dx, dy, sx, sy, height, - width, line_length); +copyarea_8bpp (info, dx, dy, sx, sy, height, + width, line_length, area); }
Greg Kroah-Hartman
maintainerPATCH 59/83 mtd: atmel_nand: Disable subpage NAND write when using Atmel PMECC
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herve Codina <[email protected]>
commit 90445ff6241e2a13445310803e2efa606c61f276 upstream.
Crash detected on sam5d35 and its pmecc nand ecc controller.
The problem was a call to chip->ecc.hwctl from nand_write_subpage_hwecc (nand_base.c) when we write a sub page.chip->ecc.hwctl function is not set when we are using PMECC controller. As a workaround, set NAND_NO_SUBPAGE_WRITE for PMECC controller in order to disable sub page access in nand_write_page.
--- drivers/mtd/nand/atmel_nand.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/atmel_nand.c +1 -0
@@ -1220,6 +1220,7 @@ static int atmel_pmecc_nand_init_params( goto err; } + nand_chip->options |=NAND_NO_SUBPAGE_WRITE ; nand_chip->ecc.read_page = atmel_nand_pmecc_read_page; nand_chip->ecc.write_page = atmel_nand_pmecc_write_page;
Greg Kroah-Hartman
maintainerPATCH 60/83 mtd: diskonchip: mem resource name is not optional
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit 86e4bbc766b9456f583f2fc3c4f6c623b422af88 upstream.
Passing a name to request_mem_region() isn't optional and can't just be NULL. Passing NULL causes a NULL ptr deref later in the boot process.
--- drivers/mtd/nand/diskonchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/diskonchip.c +1 -1
@@ -1438,7 +1438,7 @@ static int __init doc_probe(unsigned lonint reg, len, numchips;int ret =0 ; -if (!request_mem_region (physadr,DOC_IOREMAP_LEN ,NULL )) +if (!request_mem_region (physadr,DOC_IOREMAP_LEN ,"DiskOnChip" ))return -EBUSY ; virtadr =ioremap (physadr,DOC_IOREMAP_LEN );if (!virtadr) {
Greg Kroah-Hartman
maintainerPATCH 61/83 mtd: nuc900_nand: NULL dereference in nuc900_nand_enable()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit c69dbbf3335a21aae74376d7e5db50a486d52439 upstream.
Instead of writing to "nand->reg + REG_FMICSR" we write to "REG_FMICSR" which is NULL and not a valid register.
--- drivers/mtd/nand/nuc900_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/nuc900_nand.c +1 -1
@@ -225,7 +225,7 @@ static void nuc900_nand_enable(struct nu val =__raw_readl (nand->reg +REG_FMICSR );if (!(val &NAND_EN )) -__raw_writel (val |NAND_EN ,REG_FMICSR ); +__raw_writel (val |NAND_EN , nand->reg +REG_FMICSR ); val =__raw_readl (nand->reg +REG_SMCSR );
Greg Kroah-Hartman
maintainerPATCH 62/83 mtd: sm_ftl: heap corruption in sm_create_sysfs_attributes()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit b4c233057771581698a13694ab6f33b48ce837dc upstream.
We always put a NUL terminator one space past the end of the "vendor" buffer. Walter Harms also pointed out that this should just use kstrndup().
--- drivers/mtd/sm_ftl.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/mtd/sm_ftl.c +4 -7
@@ -59,15 +59,12 @@ static struct attribute_group *sm_createstruct attribute_group *attr_group;struct attribute **attributes;struct sm_sysfs_attribute *vendor_attribute; +char *vendor; -int vendor_len =strnlen (ftl->cis_buffer +SM_CIS_VENDOR_OFFSET , -SM_SMALL_PAGE -SM_CIS_VENDOR_OFFSET ); - -char *vendor =kmalloc (vendor_len,GFP_KERNEL ); + vendor =kstrndup (ftl->cis_buffer +SM_CIS_VENDOR_OFFSET , +SM_SMALL_PAGE -SM_CIS_VENDOR_OFFSET ,GFP_KERNEL );if (!vendor) goto error1; -memcpy (vendor, ftl->cis_buffer +SM_CIS_VENDOR_OFFSET , vendor_len); - vendor[vendor_len] =0 ;/* Initialize sysfs attributes */ vendor_attribute =
@@ -78,7 +75,7 @@ static struct attribute_group *sm_createsysfs_attr_init (&vendor_attribute->dev_attr.attr); vendor_attribute->data = vendor; - vendor_attribute->len = vendor_len; + vendor_attribute->len =strlen (vendor); vendor_attribute->dev_attr.attr.name ="vendor" ; vendor_attribute->dev_attr.attr.mode =S_IRUGO ; vendor_attribute->dev_attr.show = sm_attr_show;
Greg Kroah-Hartman
maintainerPATCH 63/83 Skip intel_crt_init for Dell XPS 8700
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giacomo Comes <[email protected]>
commit 10b6ee4a87811a110cb01eaca01eb04da6801baf upstream.
The Dell XPS 8700 has a onboard Display port and HDMI port and no VGA port. The call intel_crt_init freeze the machine, so skip such call.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73559
--- drivers/gpu/drm/i915/intel_crt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_crt.c +8 -0
@@ -765,6 +765,14 @@ static const struct dmi_system_id intel_ DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"), }, }, + { + .callback = intel_no_crt_dmi_callback, + .ident = "DELL XPS 8700", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "XPS 8700"), + }, + }, { } };
Greg Kroah-Hartman
maintainerPATCH 64/83 dm cache: prevent corruption caused by discard_block_size > cache_block_size
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit d132cc6d9e92424bb9d4fd35f5bd0e55d583f4be upstream.
If the discard block size is larger than the cache block size we will not properly quiesce IO to a region that is about to be discarded. This results in a race between a cache migration where no copy is needed, and a write to an adjacent cache block that's within the same large discard block.
Workaround this by limiting the discard_block_size to cache_block_size. Also limit the max_discard_sectors to cache_block_size.
A more comprehensive fix that introduces range locking support in the bio_prison and proper quiescing of a discard range that spans multiple cache blocks is already in development.
--- drivers/md/dm-cache-target.c | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-)
drivers/md/dm-cache-target.c +3 -34
@@ -239,7 +239,7 @@ struct cache {*/ dm_dblock_t discard_nr_blocks;unsigned long *discard_bitset; -uint32_t discard_block_size;/* a power of 2 times sectors per block */ +uint32_t discard_block_size;/* * Rather than reconstructing the table line for the status we just
@@ -2171,35 +2171,6 @@ static int create_cache_policy(struct careturn 0 ; } -/* -* We want the discard block size to be a power of two, at least the size -* of the cache block size, and have no more than 2^14 discard blocks -* across the origin. -*/ -#define MAX_DISCARD_BLOCKS (1 << 14) - -static bool too_many_discard_blocks (sector_t discard_block_size, -sector_t origin_size) -{ - (void )sector_div (origin_size, discard_block_size); - -return origin_size >MAX_DISCARD_BLOCKS ; -} - -static sector_t calculate_discard_block_size (sector_t cache_block_size, -sector_t origin_size) -{ -sector_t discard_block_size; - - discard_block_size =roundup_pow_of_two (cache_block_size); - -if (origin_size) -while (too_many_discard_blocks (discard_block_size, origin_size)) - discard_block_size *=2 ; - -return discard_block_size; -} -#define DEFAULT_MIGRATION_THRESHOLD 2048static int cache_create (struct cache_args *ca,struct cache **result)
@@ -2321,9 +2292,7 @@ static int cache_create(struct cache_arg }clear_bitset (cache->dirty_bitset,from_cblock (cache->cache_size)); - cache->discard_block_size = -calculate_discard_block_size (cache->sectors_per_block, - cache->origin_sectors); + cache->discard_block_size = cache->sectors_per_block; cache->discard_nr_blocks =oblock_to_dblock (cache, cache->origin_blocks); cache->discard_bitset =alloc_bitset (from_dblock (cache->discard_nr_blocks));if (!cache->discard_bitset) {
@@ -3120,7 +3089,7 @@ static void set_discard_limits(struct ca/* * FIXME: these limits may be incompatible with the cache device */ - limits->max_discard_sectors = cache->discard_block_size *1024 ; + limits->max_discard_sectors = cache->discard_block_size; limits->discard_granularity = cache->discard_block_size <<SECTOR_SHIFT ; }
Greg Kroah-Hartman
maintainerPATCH 65/83 dm transaction manager: fix corruption due to non-atomic transaction commit
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit a9d45396f5956d0b615c7ae3b936afd888351a47 upstream.
The persistent-data library used by dm-thin, dm-cache, etc is transactional. If anything goes wrong, such as an io error when writing new metadata or a power failure, then we roll back to the last transaction.
Atomicity when committing a transaction is achieved by:
a) Never overwriting data from the previous transaction.
b) Writing the superblock last, after all other metadata has hit the disk.
This commit and the following commit ("dm: take care to copy the space map roots before locking the superblock") fix a bug associated with (b). When committing it was possible for the superblock to still be written in spite of an io error occurring during the preceeding metadata flush. With these commits we're careful not to take the write lock out on the superblock until after the metadata flush has completed.
Change the transaction manager's semantics for dm_tm_commit() to assume all data has been flushed _before_ the single superblock that is passed in.
As a prerequisite, split the block manager's block unlocking and flushing by simplifying dm_bm_flush_and_unlock() to dm_bm_flush(). Now the unlocking must be done separately.
This issue was discovered by forcing io errors at the crucial time using dm-flakey.
--- drivers/md/dm-cache-metadata.c | 3 ++- drivers/md/persistent-data/dm-block-manager.c | 15 ++------------- drivers/md/persistent-data/dm-block-manager.h | 3 +-- drivers/md/persistent-data/dm-transaction-manager.c | 5 +++-- drivers/md/persistent-data/dm-transaction-manager.h | 17 ++++++++--------- 5 files changed, 16 insertions(+), 27 deletions(-)
drivers/md/dm-cache-metadata.c +2 -1
@@ -530,8 +530,9 @@ static int __begin_transaction_flags(str disk_super =dm_block_data (sblock);update_flags (disk_super, mutator);read_superblock_fields (cmd, disk_super); +dm_bm_unlock (sblock); -return dm_bm_flush_and_unlock (cmd->bm, sblock); +return dm_bm_flush (cmd->bm); }static int __begin_transaction (struct dm_cache_metadata *cmd)
drivers/md/persistent-data/dm-block-manager.c +2 -13
@@ -595,25 +595,14 @@ int dm_bm_unlock(struct dm_block *b) }EXPORT_SYMBOL_GPL (dm_bm_unlock); -int dm_bm_flush_and_unlock (struct dm_block_manager *bm, -struct dm_block *superblock) +int dm_bm_flush (struct dm_block_manager *bm) { -int r; -if (bm->read_only)return -EPERM ; - r =dm_bufio_write_dirty_buffers (bm->bufio); -if (unlikely (r)) { -dm_bm_unlock (superblock); -return r; - } - -dm_bm_unlock (superblock); -return dm_bufio_write_dirty_buffers (bm->bufio); } -EXPORT_SYMBOL_GPL (dm_bm_flush_and_unlock); +EXPORT_SYMBOL_GPL (dm_bm_flush);void dm_bm_prefetch (struct dm_block_manager *bm,dm_block_t b) {
drivers/md/persistent-data/dm-block-manager.h +1 -2
@@ -105,8 +105,7 @@ int dm_bm_unlock(struct dm_block *b);* * This method always blocks. */ -int dm_bm_flush_and_unlock (struct dm_block_manager *bm, -struct dm_block *superblock); +int dm_bm_flush (struct dm_block_manager *bm);/* * Request data is prefetched into the cache.
drivers/md/persistent-data/dm-transaction-manager.c +3 -2
@@ -154,7 +154,7 @@ int dm_tm_pre_commit(struct dm_transactiif (r <0 )return r; -return 0 ; +return dm_bm_flush (tm->bm); }EXPORT_SYMBOL_GPL (dm_tm_pre_commit);
@@ -164,8 +164,9 @@ int dm_tm_commit(struct dm_transaction_mreturn -EWOULDBLOCK ;wipe_shadow_table (tm); +dm_bm_unlock (root); -return dm_bm_flush_and_unlock (tm->bm, root); +return dm_bm_flush (tm->bm); }EXPORT_SYMBOL_GPL (dm_tm_commit);
drivers/md/persistent-data/dm-transaction-manager.h +8 -9
@@ -38,18 +38,17 @@ struct dm_transaction_manager *dm_tm_cre/* * We use a 2-phase commit here. * -* i) In the first phase the block manager is told to start flushing, and -* the changes to the space map are written to disk. You should interrogate -* your particular space map to get detail of its root node etc. to be -* included in your superblock. +* i) Make all changes for the transaction *except* for the superblock. +* Then call dm_tm_pre_commit() to flush them to disk. * -* ii) @root will be committed last. You shouldn't use more than the -* first 512 bytes of @root if you wish the transaction to survive a power -* failure. You *must* have a write lock held on @root for both stage (i) -* and (ii). The commit will drop the write lock. +* ii) Lock your superblock. Update. Then call dm_tm_commit() which will +* unlock the superblock and flush it. No other blocks should be updated +* during this period. Care should be taken to never unlock a partially +* updated superblock; perform any operations that could fail *before* you +* take the superblock lock. */ int dm_tm_pre_commit (struct dm_transaction_manager *tm); -int dm_tm_commit (struct dm_transaction_manager *tm,struct dm_block *root); +int dm_tm_commit (struct dm_transaction_manager *tm,struct dm_block *superblock);/* * These methods are the only way to get hold of a writeable block.
Greg Kroah-Hartman
maintainerPATCH 66/83 dm: take care to copy the space map roots before locking the superblock
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 5a32083d03fb543f63489b2946c4948398579ba0 upstream.
In theory copying the space map root can fail, but in practice it never does because we're careful to check what size buffer is needed.
But make certain we're able to copy the space map roots before locking the superblock.
--- drivers/md/dm-cache-metadata.c | 60 +++++++++++++++++++----------- drivers/md/dm-thin-metadata.c | 80 ++++++++++++++++++++++++----------------- 2 files changed, 85 insertions(+), 55 deletions(-)
drivers/md/dm-cache-metadata.c +38 -22
@@ -120,6 +120,12 @@ struct dm_cache_metadata {unsigned policy_version[CACHE_POLICY_VERSION_SIZE ];size_t policy_hint_size;struct dm_cache_statistics stats; + +/* +* Reading the space map root can fail, so we read it into this +* buffer before the superblock is locked and updated. +*/ +__u8 metadata_space_map_root[SPACE_MAP_ROOT_SIZE ]; };/*-------------------------------------------------------------------
@@ -260,11 +266,31 @@ static void __setup_mapping_info(struct } } +static int __save_sm_root (struct dm_cache_metadata *cmd) +{ +int r; +size_t metadata_len; + + r =dm_sm_root_size (cmd->metadata_sm, &metadata_len); +if (r <0 ) +return r; + +return dm_sm_copy_root (cmd->metadata_sm, &cmd->metadata_space_map_root, + metadata_len); +} + +static void __copy_sm_root (struct dm_cache_metadata *cmd, +struct cache_disk_superblock *disk_super) +{ +memcpy (&disk_super->metadata_space_map_root, + &cmd->metadata_space_map_root, +sizeof (cmd->metadata_space_map_root)); +} +static int __write_initial_superblock (struct dm_cache_metadata *cmd) {int r;struct dm_block *sblock; -size_t metadata_len;struct cache_disk_superblock *disk_super;sector_t bdev_size =i_size_read (cmd->bdev->bd_inode) >>SECTOR_SHIFT ;
@@ -272,12 +298,16 @@ static int __write_initial_superblock(stif (bdev_size >DM_CACHE_METADATA_MAX_SECTORS ) bdev_size =DM_CACHE_METADATA_MAX_SECTORS ; - r =dm_sm_root_size (cmd->metadata_sm, &metadata_len); + r =dm_tm_pre_commit (cmd->tm);if (r <0 )return r; - r =dm_tm_pre_commit (cmd->tm); -if (r <0 ) +/* +* dm_sm_copy_root() can fail. So we need to do it before we start +* updating the superblock. +*/ + r =__save_sm_root (cmd); +if (r)return r; r =superblock_lock_zero (cmd, &sblock);
@@ -293,10 +323,7 @@ static int __write_initial_superblock(stmemset (disk_super->policy_version,0 ,sizeof (disk_super->policy_version)); disk_super->policy_hint_size =0 ; - r =dm_sm_copy_root (cmd->metadata_sm, &disk_super->metadata_space_map_root, - metadata_len); -if (r <0 ) - goto bad_locked; +__copy_sm_root (cmd, disk_super); disk_super->mapping_root =cpu_to_le64 (cmd->root); disk_super->hint_root =cpu_to_le64 (cmd->hint_root);
@@ -313,10 +340,6 @@ static int __write_initial_superblock(st disk_super->write_misses =cpu_to_le32 (0 );return dm_tm_commit (cmd->tm, sblock); - -bad_locked: -dm_bm_unlock (sblock); -return r; }static int __format_metadata (struct dm_cache_metadata *cmd)
@@ -560,7 +583,6 @@ static int __commit_transaction(struct d flags_mutator mutator) {int r; -size_t metadata_len;struct cache_disk_superblock *disk_super;struct dm_block *sblock;
@@ -578,8 +600,8 @@ static int __commit_transaction(struct dif (r <0 )return r; - r =dm_sm_root_size (cmd->metadata_sm, &metadata_len); -if (r <0 ) + r =__save_sm_root (cmd); +if (r)return r; r =superblock_lock (cmd, &sblock);
@@ -606,13 +628,7 @@ static int __commit_transaction(struct d disk_super->read_misses =cpu_to_le32 (cmd->stats.read_misses); disk_super->write_hits =cpu_to_le32 (cmd->stats.write_hits); disk_super->write_misses =cpu_to_le32 (cmd->stats.write_misses); - - r =dm_sm_copy_root (cmd->metadata_sm, &disk_super->metadata_space_map_root, - metadata_len); -if (r <0 ) { -dm_bm_unlock (sblock); -return r; - } +__copy_sm_root (cmd, disk_super);return dm_tm_commit (cmd->tm, sblock); }
drivers/md/dm-thin-metadata.c +47 -33
131 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 67/83 dm thin: fix dangling bio in process_deferred_bios error path
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit fe76cd88e654124d1431bb662a0fc6e99ca811a5 upstream.
If unable to ensure_next_mapping() we must add the current bio, which was removed from the @bios list via bio_list_pop, back to the deferred_bios list before all the remaining @bios.
--- drivers/md/dm-thin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-thin.c +1 -1
@@ -1392,9 +1392,9 @@ static void process_deferred_bios(struct*/ if (ensure_next_mapping (pool)) {spin_lock_irqsave (&pool->lock, flags); +bio_list_add (&pool->deferred_bios, bio);bio_list_merge (&pool->deferred_bios, &bios);spin_unlock_irqrestore (&pool->lock, flags); -break ; }
Greg Kroah-Hartman
maintainerPATCH 68/83 dm cache: fix a lock-inversion
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 0596661f0a16d9d69bf1033320e70b6ff52b5e81 upstream.
When suspending a cache the policy is walked and the individual policy hints written to the metadata via sync_metadata(). This led to this lock order:
policy->lock
cache_metadata->root_lockWhen loading the cache target the policy is populated while the metadata lock is held:
cache_metadata->root_lock
policy->lockFix this potential lock-inversion (ABBA) deadlock in sync_metadata() by ensuring the cache_metadata root_lock is held whilst all the hints are written, rather than being repeatedly locked while policy->lock is held (as was the case with each callout that policy_walk_mappings() made to the old save_hint() method).
Found by turning on the CONFIG_PROVE_LOCKING ("Lock debugging: prove locking correctness") build option. However, it is not clear how the LOCKDEP reported paths can lead to a deadlock since the two paths, suspending a target and loading a target, never occur at the same time. But that doesn't mean the same lock-inversion couldn't have occurred elsewhere.
--- drivers/md/dm-cache-metadata.c | 35 +++++++++++++++++------------------ drivers/md/dm-cache-metadata.h | 9 +-------- drivers/md/dm-cache-target.c | 28 ++-------------------------- 3 files changed, 20 insertions(+), 52 deletions(-)
drivers/md/dm-cache-metadata.c +17 -18
@@ -1245,22 +1245,12 @@ static int begin_hints(struct dm_cache_mreturn 0 ; } -int dm_cache_begin_hints (struct dm_cache_metadata *cmd,struct dm_cache_policy *policy) +static int save_hint (void *context,dm_cblock_t cblock,dm_oblock_t oblock,uint32_t hint) { +struct dm_cache_metadata *cmd = context; +__le32 value =cpu_to_le32 (hint);int r; -down_write (&cmd->root_lock); - r =begin_hints (cmd, policy); -up_write (&cmd->root_lock); - -return r; -} - -static int save_hint (struct dm_cache_metadata *cmd,dm_cblock_t cblock, -uint32_t hint) -{ -int r; -__le32 value =cpu_to_le32 (hint);__dm_bless_for_disk (&value); r = dm_array_set_value(&cmd->hint_info, cmd->hint_root,
@@ -1270,16 +1260,25 @@ static int save_hint(struct dm_cache_metreturn r; } -int dm_cache_save_hint (struct dm_cache_metadata *cmd,dm_cblock_t cblock, -uint32_t hint) +static int write_hints (struct dm_cache_metadata *cmd,struct dm_cache_policy *policy) {int r; -if (!hints_array_initialized (cmd)) -return 0 ; + r =begin_hints (cmd, policy); +if (r) { +DMERR ("begin_hints failed" ); +return r; + } + +return policy_walk_mappings (policy, save_hint, cmd); +} + +int dm_cache_write_hints (struct dm_cache_metadata *cmd,struct dm_cache_policy *policy) +{ +int r;down_write (&cmd->root_lock); - r =save_hint (cmd, cblock, hint); + r =write_hints (cmd, policy);up_write (&cmd->root_lock);return r;
drivers/md/dm-cache-metadata.h +1 -8
@@ -128,14 +128,7 @@ void dm_cache_dump(struct dm_cache_metad* rather than querying the policy for each cblock, we let it walk its data * structures and fill in the hints in whatever order it wishes. */ - -int dm_cache_begin_hints (struct dm_cache_metadata *cmd,struct dm_cache_policy *p); - -/* -* requests hints for every cblock and stores in the metadata device. -*/ -int dm_cache_save_hint (struct dm_cache_metadata *cmd, -dm_cblock_t cblock,uint32_t hint); +int dm_cache_write_hints (struct dm_cache_metadata *cmd,struct dm_cache_policy *p);/* * Query method. Are all the blocks in the cache clean?
drivers/md/dm-cache-target.c +2 -26
@@ -2600,30 +2600,6 @@ static int write_discard_bitset(struct creturn 0 ; } -static int save_hint (void *context,dm_cblock_t cblock,dm_oblock_t oblock, -uint32_t hint) -{ -struct cache *cache = context; -return dm_cache_save_hint (cache->cmd, cblock, hint); -} - -static int write_hints (struct cache *cache) -{ -int r; - - r =dm_cache_begin_hints (cache->cmd, cache->policy); -if (r) { -DMERR ("dm_cache_begin_hints failed" ); -return r; - } - - r =policy_walk_mappings (cache->policy, save_hint, cache); -if (r) -DMERR ("policy_walk_mappings failed" ); - -return r; -} -/* * returns true on success */
@@ -2641,7 +2617,7 @@ static bool sync_metadata(struct cache *save_stats (cache); - r3 =write_hints (cache); + r3 =dm_cache_write_hints (cache->cmd, cache->policy);if (r3)DMERR ("could not write hints" );
@@ -3114,7 +3090,7 @@ static void cache_io_hints(struct dm_tarstatic struct target_type cache_target = { .name ="cache" , - .version = {1 ,3 ,0 }, + .version = {1 ,4 ,0 }, .module =THIS_MODULE , .ctr = cache_ctr, .dtr = cache_dtr,
Greg Kroah-Hartman
maintainerPATCH 69/83 dma: edma: fix incorrect SG list handling
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sekhar Nori <[email protected]>
commit 5fc68a6cad658e45dca3e0a6607df3a8e5df4ef9 upstream.
The code to handle any length SG lists calls edma_resume() even before edma_start() is called. This is incorrect because edma_resume() enables edma events on the channel after which CPU (in edma_start) cannot clear posted events by writing to ECR (per the EDMA user's guide).
Because of this EDMA transfers fail to start if due to some reason there is a pending EDMA event registered even before EDMA transfers are started. This can happen if an EDMA event is a byproduct of device initialization.
Fix this by calling edma_resume() only if it is not the first batch of MAX_NR_SG elements.
Without this patch, MMC/SD fails to function on DA850 EVM with DMA. The behaviour is triggered by specific IP and this can explain why the issue was not reported before (example with MMC/SD on AM335x).
Tested on DA850 EVM and AM335x EVM-SK using MMC/SD card.
--- drivers/dma/edma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/edma.c +4 -2
@@ -182,11 +182,13 @@ static void edma_execute(struct edma_cha echan->ecc->dummy_slot); } -edma_resume (echan->ch_num); -if (edesc->processed <=MAX_NR_SG ) {dev_dbg (dev,"first transfer starting %d\n" , echan->ch_num);edma_start (echan->ch_num); + }else { +dev_dbg (dev,"chan: %d: completed %d elements, resuming\n" , + echan->ch_num, edesc->processed); +edma_resume (echan->ch_num); }/*
Greg Kroah-Hartman
maintainerPATCH 70/83 aio: v4 ensure access to ctx->ring_pages is correctly serialised for migration
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin LaHaise <[email protected]>
commit fa8a53c39f3fdde98c9eace6a9b412143f0f6ed6 upstream.
As reported by Tang Chen, Gu Zheng and Yasuaki Isimatsu, the following issues exist in the aio ring page migration support.
As a result, for example, we have the following problem:
thread 1 | thread 2
|
aio_migratepage() |
|-> take ctx->completion_lock |
|-> migrate_page_copy(new, old) |
| *NOW*, ctx->ring_pages[idx] == old |
|
| *NOW*, ctx->ring_pages[idx] == old
| aio_read_events_ring()
| |-> ring = kmap_atomic(ctx->ring_pages[0])
| |-> ring->head = head; *HERE, write to the old ring page*
| |-> kunmap_atomic(ring);
|
|-> ctx->ring_pages[idx] = new |
| *BUT NOW*, the content of |
| ring_pages[idx] is old. |
|-> release ctx->completion_lock |As above, the new ring page will not be updated.
Fix this issue, as well as prevent races in aio_ring_setup() by holding the ring_lock mutex during kioctx setup and page migration. This avoids the overhead of taking another spinlock in aio_read_events_ring() as Tang's and Gu's original fix did, pushing the overhead into the migration code.
Note that to handle the nesting of ring_lock inside of mmap_sem, the migratepage operation uses mutex_trylock(). Page migration is not a 100% critical operation in this case, so the ocassional failure can be tolerated. This issue was reported by Sasha Levin.
Based on feedback from Linus, avoid the extra taking of ctx->completion_lock. Instead, make page migration fully serialised by mapping->private_lock, and have aio_free_ring() simply disconnect the kioctx from the mapping by calling put_aio_ring_file() before touching ctx->ring_pages[]. This simplifies the error handling logic in aio_migratepage(), and should improve robustness.
v4: always do mutex_unlock() in cases when kioctx setup fails.
--- fs/aio.c | 120 +++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 67 insertions(+), 53 deletions(-)
fs/aio.c +67 -53
@@ -52,7 +52,8 @@struct aio_ring {unsigned id;/* kernel internal index number */ unsigned nr;/* number of io_events */ -unsigned head; +unsigned head;/* Written to by userland or under ring_lock +* mutex by aio_read_events_ring(). */ unsigned tail;unsigned magic;
@@ -243,6 +244,11 @@ static void aio_free_ring(struct kioctx {int i; +/* Disconnect the kiotx from the ring file. This prevents future +* accesses to the kioctx from page migration. +*/ +put_aio_ring_file (ctx); +for (i =0 ; i < ctx->nr_pages; i++) {struct page *page; pr_debug("pid(%d) [%d] page->count=%d\n", current->pid, i,
@@ -254,8 +260,6 @@ static void aio_free_ring(struct kioctxput_page (page); } -put_aio_ring_file (ctx); -if (ctx->ring_pages && ctx->ring_pages != ctx->internal_pages) {kfree (ctx->ring_pages); ctx->ring_pages =NULL ;
@@ -283,29 +287,38 @@ static int aio_migratepage(struct addres {struct kioctx *ctx;unsigned long flags; +pgoff_t idx;int rc; rc =0 ; -/* Make sure the old page hasn't already been changed */ +/* mapping->private_lock here protects against the kioctx teardown. */ spin_lock (&mapping->private_lock); ctx = mapping->private_data; -if (ctx) { -pgoff_t idx; -spin_lock_irqsave (&ctx->completion_lock, flags); - idx = old->index; -if (idx < (pgoff_t )ctx->nr_pages) { -if (ctx->ring_pages[idx] != old) - rc = -EAGAIN ; - }else - rc = -EINVAL ; -spin_unlock_irqrestore (&ctx->completion_lock, flags); +if (!ctx) { + rc = -EINVAL ; + goto out; + } + +/* The ring_lock mutex. The prevents aio_read_events() from writing +* to the ring's head, and prevents page migration from mucking in +* a partially initialized kiotx. +*/ +if (!mutex_trylock (&ctx->ring_lock)) { + rc = -EAGAIN ; + goto out; + } + + idx = old->index; +if (idx < (pgoff_t )ctx->nr_pages) { +/* Make sure the old page hasn't already been changed */ +if (ctx->ring_pages[idx] != old) + rc = -EAGAIN ; }else rc = -EINVAL ; -spin_unlock (&mapping->private_lock);if (rc !=0 ) -return rc; + goto out_unlock;/* Writeback must be complete */ BUG_ON (PageWriteback (old));
@@ -314,38 +327,26 @@ static int aio_migratepage(struct addres rc =migrate_page_move_mapping (mapping, new, old,NULL , mode,1 );if (rc !=MIGRATEPAGE_SUCCESS ) {put_page (new); -return rc; + goto out_unlock; } -/* We can potentially race against kioctx teardown here. Use the -* address_space's private data lock to protect the mapping's -* private_data. +/* Take completion_lock to prevent other writes to the ring buffer +* while the old page is copied to the new. This prevents new +* events from being lost. */ -spin_lock (&mapping->private_lock); - ctx = mapping->private_data; -if (ctx) { -pgoff_t idx; -spin_lock_irqsave (&ctx->completion_lock, flags); -migrate_page_copy (new, old); - idx = old->index; -if (idx < (pgoff_t )ctx->nr_pages) { -/* And only do the move if things haven't changed */ -if (ctx->ring_pages[idx] == old) - ctx->ring_pages[idx] = new; -else - rc = -EAGAIN ; - }else - rc = -EINVAL ; -spin_unlock_irqrestore (&ctx->completion_lock, flags); - }else - rc = -EBUSY ; -spin_unlock (&mapping->private_lock); +spin_lock_irqsave (&ctx->completion_lock, flags); +migrate_page_copy (new, old); +BUG_ON (ctx->ring_pages[idx] != old); + ctx->ring_pages[idx] = new; +spin_unlock_irqrestore (&ctx->completion_lock, flags); -if (rc ==MIGRATEPAGE_SUCCESS ) -put_page (old); -else -put_page (new); +/* The old page is no longer accessible. */ +put_page (old); +out_unlock: +mutex_unlock (&ctx->ring_lock); +out: +spin_unlock (&mapping->private_lock); return rc; }#endif
@@ -380,7 +381,7 @@ static int aio_setup_ring(struct kioctx file =aio_private_file (ctx, nr_pages);if (IS_ERR (file)) { ctx->aio_ring_file =NULL ; -return -EAGAIN ; +return -ENOMEM ; } ctx->aio_ring_file = file;
@@ -415,7 +416,7 @@ static int aio_setup_ring(struct kioctxif (unlikely (i != nr_pages)) {aio_free_ring (ctx); -return -EAGAIN ; +return -ENOMEM ; } ctx->mmap_size = nr_pages *PAGE_SIZE ;
@@ -429,7 +430,7 @@ static int aio_setup_ring(struct kioctxif (IS_ERR ((void *)ctx->mmap_base)) { ctx->mmap_size =0 ;aio_free_ring (ctx); -return -EAGAIN ; +return -ENOMEM ; }pr_debug ("mmap address: 0x%08lx\n" , ctx->mmap_base);
@@ -556,6 +557,10 @@ static int ioctx_add_table(struct kioctxrcu_read_unlock ();spin_unlock (&mm->ioctx_lock); +/* While kioctx setup is in progress, +* we are protected from page migration +* changes ring_pages by ->ring_lock. +*/ ring =kmap_atomic (ctx->ring_pages[0 ]); ring->id = ctx->id;kunmap_atomic (ring);
@@ -640,24 +645,28 @@ static struct kioctx *ioctx_alloc(unsign ctx->max_reqs = nr_events; -if (percpu_ref_init (&ctx->users, free_ioctx_users)) - goto err; - -if (percpu_ref_init (&ctx->reqs, free_ioctx_reqs)) - goto err; -spin_lock_init (&ctx->ctx_lock);spin_lock_init (&ctx->completion_lock);mutex_init (&ctx->ring_lock); +/* Protect against page migration throughout kiotx setup by keeping +* the ring_lock mutex held until setup is complete. */ +mutex_lock (&ctx->ring_lock);init_waitqueue_head (&ctx->wait);INIT_LIST_HEAD (&ctx->active_reqs); +if (percpu_ref_init (&ctx->users, free_ioctx_users)) + goto err; + +if (percpu_ref_init (&ctx->reqs, free_ioctx_reqs)) + goto err; + ctx->cpu = alloc_percpu(struct kioctx_cpu);if (!ctx->cpu) goto err; -if (aio_setup_ring (ctx) <0 ) + err =aio_setup_ring (ctx); +if (err <0 ) goto err;atomic_set (&ctx->reqs_available, ctx->nr_events -1 );
@@ -683,6 +692,9 @@ static struct kioctx *ioctx_alloc(unsignif (err) goto err_cleanup; +/* Release the ring_lock mutex now that all setup is complete. */ +mutex_unlock (&ctx->ring_lock); +pr_debug ("allocated ioctx %p[%ld]: mm=%p mask=0x%x\n" , ctx, ctx->user_id, mm, ctx->nr_events);return ctx;
@@ -692,6 +704,7 @@ err_cleanup: err_ctx:aio_free_ring (ctx); err: +mutex_unlock (&ctx->ring_lock);free_percpu (ctx->cpu);free_percpu (ctx->reqs.pcpu_count);free_percpu (ctx->users.pcpu_count);
@@ -1024,6 +1037,7 @@ static long aio_read_events_ring(structmutex_lock (&ctx->ring_lock); +/* Access to ->ring_pages here is protected by ctx->ring_lock. */ ring =kmap_atomic (ctx->ring_pages[0 ]); head = ring->head; tail = ring->tail;
Greg Kroah-Hartman
maintainerPATCH 71/83 lockd: ensure we tear down any live sockets when socket creation fails during lockd_up
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 679b033df48422191c4cac52b610d9980e019f9b upstream.
We had a Fedora ABRT report with a stack trace like this:
kernel BUG at net/sunrpc/svc.c:550!
invalid opcode: 0000 [#1] SMP
[...]
CPU: 2 PID: 913 Comm: rpc.nfsd Not tainted 3.13.6-200.fc20.x86_64 #1 Hardware name: Hewlett-Packard HP ProBook 4740s/1846, BIOS 68IRR Ver. F.40 01/29/2013 task: ffff880146b00000 ti: ffff88003f9b8000 task.ti: ffff88003f9b8000 RIP: 0010:[<ffffffffa0305fa8>] [<ffffffffa0305fa8>] svc_destroy+0x128/0x130 [sunrpc] RSP: 0018:ffff88003f9b9de0 EFLAGS: 00010206 RAX: ffff88003f829628 RBX: ffff88003f829600 RCX: 00000000000041ee RDX: 0000000000000000 RSI: 0000000000000286 RDI: 0000000000000286 RBP: ffff88003f9b9de8 R08: 0000000000017360 R09: ffff88014fa97360 R10: ffffffff8114ce57 R11: ffffea00051c9c00 R12: ffff88003f829600 R13: 00000000ffffff9e R14: ffffffff81cc7cc0 R15: 0000000000000000 FS: 00007f4fde284840(0000) GS:ffff88014fa80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f4fdf5192f8 CR3: 00000000a569a000 CR4: 00000000001407e0 Stack: ffff88003f792300 ffff88003f9b9e18 ffffffffa02de02a 0000000000000000 ffffffff81cc7cc0 ffff88003f9cb000 0000000000000008 ffff88003f9b9e60 ffffffffa033bb35 ffffffff8131c86c ffff88003f9cb000 ffff8800a5715008 Call Trace: [<ffffffffa02de02a>] lockd_up+0xaa/0x330 [lockd] [<ffffffffa033bb35>] nfsd_svc+0x1b5/0x2f0 [nfsd] [<ffffffff8131c86c>] ? simple_strtoull+0x2c/0x50 [<ffffffffa033c630>] ? write_pool_threads+0x280/0x280 [nfsd] [<ffffffffa033c6bb>] write_threads+0x8b/0xf0 [nfsd] [<ffffffff8114efa4>] ? __get_free_pages+0x14/0x50 [<ffffffff8114eff6>] ? get_zeroed_page+0x16/0x20 [<ffffffff811dec51>] ? simple_transaction_get+0xb1/0xd0 [<ffffffffa033c098>] nfsctl_transaction_write+0x48/0x80 [nfsd] [<ffffffff811b8b34>] vfs_write+0xb4/0x1f0 [<ffffffff811c3f99>] ? putname+0x29/0x40 [<ffffffff811b9569>] SyS_write+0x49/0xa0 [<ffffffff810fc2a6>] ? __audit_syscall_exit+0x1f6/0x2a0 [<ffffffff816962e9>] system_call_fastpath+0x16/0x1b Code: 31 c0 e8 82 db 37 e1 e9 2a ff ff ff 48 8b 07 8b 57 14 48 c7 c7 d5 c6 31 a0 48 8b 70 20 31 c0 e8 65 db 37 e1 e9 f4 fe ff ff 0f 0b <0f> 0b 66 0f 1f 44 00 00 0f 1f 44 00 00 55 48 89 e5 41 56 41 55 RIP [<ffffffffa0305fa8>] svc_destroy+0x128/0x130 [sunrpc] RSP <ffff88003f9b9de0>
Evidently, we created some lockd sockets and then failed to create others. make_socks then returned an error and we tried to tear down the svc, but svc->sv_permsocks was not empty so we ended up tripping over the BUG() in svc_destroy().
Fix this by ensuring that we tear down any live sockets we created when socket creation is going to return an error.
--- fs/lockd/svc.c | 1 + 1 file changed, 1 insertion(+)
fs/lockd/svc.c +1 -0
@@ -235,6 +235,7 @@ out_err:if (warned++ ==0 )printk (KERN_WARNING "lockd_up: makesock failed, error=%d\n" , err); +svc_shutdown_net (serv, net);return err; }
Greg Kroah-Hartman
maintainerPATCH 72/83 lib/percpu_counter.c: fix bad percpu counter state during suspend
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit e39435ce68bb4685288f78b1a7e24311f7ef939f upstream.
I got a bug report yesterday from Laszlo Ersek in which he states that his kvm instance fails to suspend. Laszlo bisected it down to this commit 1cf7e9c68fe8 ("virtio_blk: blk-mq support") where virtio-blk is converted to use the blk-mq infrastructure.
After digging a bit, it became clear that the issue was with the queue drain. blk-mq tracks queue usage in a percpu counter, which is incremented on request alloc and decremented when the request is freed. The initial hunt was for an inconsistency in blk-mq, but everything seemed fine. In fact, the counter only returned crazy values when suspend was in progress.
When a CPU is unplugged, the percpu counters merges that CPU state with the general state. blk-mq takes care to register a hotcpu notifier with the appropriate priority, so we know it runs after the percpu counter notifier. However, the percpu counter notifier only merges the state when the CPU is fully gone. This leaves a state transition where the CPU going away is no longer in the online mask, yet it still holds private values. This means that in this state, percpu_counter_sum() returns invalid results, and the suspend then hangs waiting for abs(dead-cpu-value) requests to complete which of course will never happen.
Fix this by clearing the state earlier, so we never have a case where the CPU isn't in online mask but still holds private state. This bug has been there since forever, I guess we don't have a lot of users where percpu counters needs to be reliable during the suspend cycle.
--- lib/percpu_counter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/percpu_counter.c +1 -1
@@ -169,7 +169,7 @@ static int percpu_counter_hotcpu_callbacstruct percpu_counter *fbc;compute_batch_value (); -if (action !=CPU_DEAD ) +if (action !=CPU_DEAD && action !=CPU_DEAD_FROZEN )return NOTIFY_OK ; cpu = (unsigned long )hcpu;
Greg Kroah-Hartman
maintainerPATCH 73/83 mmc: sdhci-bcm-kona: fix build errors when built-in
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 4025ce24f326830135341814307c072f6c2a7738 upstream.
sdhci_bcm_kona_remove' referenced in section .data' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
--- drivers/mmc/host/sdhci-bcm-kona.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-bcm-kona.c +1 -1
@@ -314,7 +314,7 @@ err_pltfm_free:return ret; } -static int __exit sdhci_bcm_kona_remove(struct platform_device *pdev) +static int sdhci_bcm_kona_remove (struct platform_device *pdev) {return sdhci_pltfm_unregister (pdev); }
Greg Kroah-Hartman
maintainerPATCH 74/83 thinkpad_acpi: Fix inconsistent mute LED after resume
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 119f449866ad18785b0445adaf0d2859c6dbdaa3 upstream.
The mute LED states have to be restored after resume.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70351
--- drivers/platform/x86/thinkpad_acpi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +12 -0
@@ -8447,9 +8447,21 @@ static void mute_led_exit(void)tpacpi_led_set (i, false); } +static void mute_led_resume (void ) +{ +int i; + +for (i =0 ; i <TPACPI_LED_MAX ; i++) { +struct tp_led_table *t = &led_tables[i]; +if (t->state >=0 ) +mute_led_on_off (t, t->state); + } +} +static struct ibm_struct mute_led_driver_data = { .name ="mute_led" , .exit = mute_led_exit, + .resume = mute_led_resume, };/****************************************************************************
Greg Kroah-Hartman
maintainerPATCH 75/83 Input: synaptics - add min/max quirk for ThinkPad T431s, L440, L540, S1 Yoga and X1
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 46a2986ebbe18757c2d8c352f8fb6e0f4f0754e3 upstream.
We expect that all the Haswell series will need such quirks, sigh.
The T431s seems to be T430 hardware in a T440s case, using the T440s touchpad, with the same min/max issue.
The X1 Carbon 3rd generation name says 2nd while it is a 3rd generation.
The X1 and T431s share a PnPID with the T540p, but the reported ranges are closer to those of the T440s.
HdG: Squashed 5 quirk patches into one. T431s + L440 + L540 are written by me, S1 Yoga and X1 are written by Benjamin Tissoires.
Hdg: Standardized S1 Yoga and X1 values, Yoga uses the same touchpad as the X240, X1 uses the same touchpad as the T440.
--- drivers/input/mouse/synaptics.c | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/input/mouse/synaptics.c +42 -0
@@ -1515,6 +1515,14 @@ static const struct dmi_system_id min_ma .driver_data = (int []){1232, 5710, 1156, 4696}, }, { +/* Lenovo ThinkPad T431s */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"), + }, + .driver_data = (int []){1024, 5112, 2024, 4832}, + }, + {/* Lenovo ThinkPad T440s */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
@@ -1523,6 +1531,14 @@ static const struct dmi_system_id min_ma .driver_data = (int []){1024, 5112, 2024, 4832}, }, { +/* Lenovo ThinkPad L440 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"), + }, + .driver_data = (int []){1024, 5112, 2024, 4832}, + }, + {/* Lenovo ThinkPad T540p */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
@@ -1530,6 +1546,32 @@ static const struct dmi_system_id min_ma }, .driver_data = (int []){1024, 5056, 2058, 4832}, }, + { + /* Lenovo ThinkPad L540 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"), + }, + .driver_data = (int []){1024, 5112, 2024, 4832}, + }, + { + /* Lenovo Yoga S1 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, + "ThinkPad S1 Yoga"), + }, + .driver_data = (int []){1232, 5710, 1156, 4696}, + }, + { + /* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, + "ThinkPad X1 Carbon 2nd"), + }, + .driver_data = (int []){1024, 5112, 2024, 4832}, + }, #endif { } };
Greg Kroah-Hartman
maintainerPATCH 76/83 Input: synaptics - add min/max quirk for ThinkPad Edge E431
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 27a38856a948c3e8de30dc71647ff9e1778c99fc upstream.
--- drivers/input/mouse/synaptics.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/input/mouse/synaptics.c +8 -0
@@ -1515,6 +1515,14 @@ static const struct dmi_system_id min_ma .driver_data = (int []){1232, 5710, 1156, 4696}, }, { +/* Lenovo ThinkPad Edge E431 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Edge E431"), + }, + .driver_data = (int []){1024, 5022, 2508, 4832}, + }, + {/* Lenovo ThinkPad T431s */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Greg Kroah-Hartman
maintainerPATCH 77/83 cpufreq: loongson2_cpufreq: dont declare local variable as static
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 05ed672292dc9d37db4fafdd49baa782158cd795 upstream.
Earlier commit:
commit 652ed95d5fa6074b3c4ea245deb0691f1acb6656 Author: Viresh Kumar <[email protected]> Date: Thu Jan 9 20:38:43 2014 +0530 cpufreq: introduce cpufreq_generic_get() routine
did some changes to driver and by mistake made cpuclk as a 'static' local variable, which wasn't actually required. Fix it.
--- drivers/cpufreq/loongson2_cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/loongson2_cpufreq.c +1 -1
@@ -69,7 +69,7 @@ static int loongson2_cpufreq_target(strustatic int loongson2_cpufreq_cpu_init (struct cpufreq_policy *policy) { -static struct clk *cpuclk; +struct clk *cpuclk;int i;unsigned long rate;int ret;
Greg Kroah-Hartman
maintainerPATCH 78/83 cpufreq: at32ap: dont declare local variable as static
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 0ca97886fece9e1acd71ade4ca3a250945c8fc8b upstream.
Earlier commit:
commit 652ed95d5fa6074b3c4ea245deb0691f1acb6656 Author: Viresh Kumar <[email protected]> Date: Thu Jan 9 20:38:43 2014 +0530 cpufreq: introduce cpufreq_generic_get() routine
did some changes to driver and by mistake made cpuclk as a 'static' local variable, which wasn't actually required. Fix it.
--- drivers/cpufreq/at32ap-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/at32ap-cpufreq.c +1 -1
@@ -52,7 +52,7 @@ static int at32_set_target(struct cpufrestatic int at32_cpufreq_driver_init (struct cpufreq_policy *policy) {unsigned int frequency, rate, min_freq; -static struct clk *cpuclk; +struct clk *cpuclk;int retval, steps, i;if (policy->cpu !=0 )
Greg Kroah-Hartman
maintainerPATCH 79/83 ACPI / processor: Fix failure of loading acpi-cpufreq driver
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit 4985c32ee4241d1aba1beeac72294faa46aaff10 upstream.
According commit d640113fe (ACPI: processor: fix acpi_get_cpuid for UP processor), BIOS may not provide _MAT or MADT tables and acpi_get_apicid() always returns -1. For these cases, original code will pass apic_id with vaule of -1 to acpi_map_cpuid() and it will check the acpi_id. If acpi_id is equal to zero, ignores apic_id and return zero for CPU0.
Commit b981513 (ACPI / scan: bail out early if failed to parse APIC ID for CPU) changed the behavior. Return ENODEV when find apic_id is less than zero after calling acpi_get_apicid(). This causes acpi-cpufreq driver fails to be loaded on some machines. This patch is to fix it.
References: https://bugzilla.kernel.org/show_bug.cgi?id=73781
--- drivers/acpi/acpi_processor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/acpi/acpi_processor.c +4 -3
@@ -170,6 +170,9 @@ static int acpi_processor_hotadd_init(stacpi_status status;int ret; +if (pr->apic_id ==-1 ) +return -ENODEV ; + status =acpi_evaluate_integer (pr->handle,"_STA" ,NULL , &sta);if (ACPI_FAILURE (status) || !(sta &ACPI_STA_DEVICE_PRESENT ))return -ENODEV ;
@@ -260,10 +263,8 @@ static int acpi_processor_get_info(struc } apic_id =acpi_get_apicid (pr->handle, device_declaration, pr->acpi_id); -if (apic_id <0 ) { +if (apic_id <0 )acpi_handle_debug (pr->handle,"failed to get CPU APIC ID.\n" ); -return -ENODEV ; - } pr->apic_id = apic_id; cpu_index =acpi_map_cpuid (pr->apic_id, pr->acpi_id);
Greg Kroah-Hartman
maintainerPATCH 80/83 cpufreq: unicore32: fix typo issue for clk
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Gang <[email protected]>
commit b4ddad95020e65cfbbf9aee63d3bcdf682794ade upstream.
Need use 'clk' instead of 'mclk', which is the original removed local variable.
The related original commit:
"652ed95 cpufreq: introduce cpufreq_generic_get() routine"
The related error with allmodconfig for unicore32:
CC drivers/cpufreq/unicore2-cpufreq.o
drivers/cpufreq/unicore2-cpufreq.c: In function ‘ucv2_target’:
drivers/cpufreq/unicore2-cpufreq.c:48: error: ‘struct cpufreq_policy’ has no member named ‘mclk’ make[2]: *** [drivers/cpufreq/unicore2-cpufreq.o] Error 1
make[1]: *** [drivers/cpufreq] Error 2
make: *** [drivers] Error 2
--- drivers/cpufreq/unicore2-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/unicore2-cpufreq.c +1 -1
@@ -45,7 +45,7 @@ static int ucv2_target(struct cpufreq_po freqs.new = target_freq;cpufreq_notify_transition (policy, &freqs,CPUFREQ_PRECHANGE ); - ret =clk_set_rate (policy->mclk, target_freq *1000 ); + ret =clk_set_rate (policy->clk, target_freq *1000 );cpufreq_notify_post_transition (policy, &freqs, ret);return ret;
Greg Kroah-Hartman
maintainerPATCH 81/83 drm: cirrus: add power management support
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerd Hoffmann <[email protected]>
commit 2f1e800799bf478494cec3573cd63eb34ca89c9d upstream.
cirrus kms driver lacks power management support, thus the vga display doesn't work any more after S3 resume.
Fix this by adding suspend and resume functions. Also make the mode_set function unblank the screen.
--- drivers/gpu/drm/cirrus/cirrus_drv.c | 42 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/cirrus/cirrus_mode.c | 3 ++ 2 files changed, 45 insertions(+)
drivers/gpu/drm/cirrus/cirrus_drv.c +42 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/console.h> #include <drm/drmP.h> +#include <drm/drm_crtc_helper.h> #include "cirrus_drv.h"
@@ -75,6 +76,41 @@ static void cirrus_pci_remove(struct pcidrm_put_dev (dev); } +static int cirrus_pm_suspend (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct drm_device *drm_dev =pci_get_drvdata (pdev); +struct cirrus_device *cdev = drm_dev->dev_private; + +drm_kms_helper_poll_disable (drm_dev); + +if (cdev->mode_info.gfbdev) { +console_lock (); +fb_set_suspend (cdev->mode_info.gfbdev->helper.fbdev,1 ); +console_unlock (); + } + +return 0 ; +} + +static int cirrus_pm_resume (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct drm_device *drm_dev =pci_get_drvdata (pdev); +struct cirrus_device *cdev = drm_dev->dev_private; + +drm_helper_resume_force_mode (drm_dev); + +if (cdev->mode_info.gfbdev) { +console_lock (); +fb_set_suspend (cdev->mode_info.gfbdev->helper.fbdev,0 ); +console_unlock (); + } + +drm_kms_helper_poll_enable (drm_dev); +return 0 ; +} +static const struct file_operations cirrus_driver_fops = { .owner =THIS_MODULE , .open = drm_open,
@@ -103,11 +139,17 @@ static struct drm_driver driver = { .dumb_destroy = drm_gem_dumb_destroy, }; +static const struct dev_pm_ops cirrus_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (cirrus_pm_suspend, + cirrus_pm_resume) +}; +static struct pci_driver cirrus_pci_driver = { .name =DRIVER_NAME , .id_table = pciidlist, .probe = cirrus_pci_probe, .remove = cirrus_pci_remove, + .driver.pm = &cirrus_pm_ops, };static int __init cirrus_init (void )
drivers/gpu/drm/cirrus/cirrus_mode.c +3 -0
@@ -308,6 +308,9 @@ static int cirrus_crtc_mode_set(struct dWREG_HDR (hdr);cirrus_crtc_do_set_base (crtc, old_fb, x, y,0 ); + +/* Unblank (needed on S3 resume, vgabios doesn't do it then) */ +outb (0x20 ,0x3c0 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 82/83 drm: bochs: add power management support
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerd Hoffmann <[email protected]>
commit b8ccd70f1363f7d4e49219dbc46ec973a14f49cd upstream.
bochs kms driver lacks power management support, thus the vga display doesn't work any more after S3 resume.
Fix this by adding suspend and resume functions.
--- drivers/gpu/drm/bochs/bochs.h | 1 drivers/gpu/drm/bochs/bochs_drv.c | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+)
drivers/gpu/drm/bochs/bochs.h +1 -0
@@ -1,5 +1,6 @@#include <linux/io.h> #include <linux/fb.h> +#include <linux/console.h> #include <drm/drmP.h> #include <drm/drm_crtc.h>
drivers/gpu/drm/bochs/bochs_drv.c +44 -0
56 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 83/83 x86-64, build: Fix stack protector Makefile breakage with 32-bit userland
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Spelvin <[email protected]>
commit 14262d67fe348018af368a07430fbc06eadeabb1 upstream.
If you are using a 64-bit kernel with 32-bit userland, then scripts/gcc-x86_64-has-stack-protector.sh invokes 32-bit gcc with -mcmodel=kernel, which produces:
<stdin>:1:0: error: code model 'kernel' not supported in the 32 bit mode
and trips the "broken compiler" test at arch/x86/Makefile:120.
There are several places a fix is possible, but the following seems cleanest. (But it's minimal; it would also be possible to factor out a bunch of stuff from the two branches of the if.)
--- arch/x86/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/x86/Makefile +1 -0
@@ -79,6 +79,7 @@ else UTS_MACHINE := x86_64 CHECKFLAGS += -D__x86_64__ -m64 + biarch := -m64 KBUILD_AFLAGS += -m64 KBUILD_CFLAGS += -m64
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.4 release. There are 83 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 13 19:18:44 UTC 2014. Anything received after that time might be too late.
Build results:
total: 127 pass: 121 skipped: 4 fail: 2
Failing builds are powerpc:allmodconfig and unicore32:defconfig.
Qemu tests all passed.
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 13 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.4 release. There are 83 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 13 19:18:44 UTC 2014. Anything received after that time might be too late.
Build results:
total: 127 pass: 121 skipped: 4 fail: 2
Quoted 8 lines
Failing builds are powerpc:allmodconfig and unicore32:defconfig.
Qemu tests all passed.
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
Thanks for testing all 3 of these and letting me know.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.4 release. There are 83 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 13 19:18:44 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.4-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Compiled and booted on my test systems. No dmesg regressions.
-- Shuah
Signature · 4 lines
Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) [email protected] | (970) 672-0658
Greg Kroah-Hartman
maintainerQuoted 13 lines · Shuah Khan
Quoted 12 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.4 release. There are 83 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 13 19:18:44 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.4-rc1.gzand the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test systems. No dmesg regressions.
Thanks for testing all 3 and letting me know.
greg k-h