From: Greg Kroah-Hartman Date: Tue, 3 Jun 2014 00:16:40 +0000 (-0700) Subject: 3.10-stable patches X-Git-Tag: v3.14.6~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=92052b7125d3eec9049964e0a25b00f610aa2b3f;p=thirdparty%2Fkernel%2Fstable-queue.git 3.10-stable patches added patches: 8250_core-fix-unwanted-tx-chars-write.patch clocksource-exynos_mct-register-clock-event-after-request_irq.patch genirq-allow-forcing-cpu-affinity-of-interrupts.patch mm-make-fixup_user_fault-check-the-vma-access-rights-too.patch pata_at91-fix-ata_host_activate-failure-handling.patch serial-8250-fix-thread-unsafe-__dma_tx_complete-function.patch topology-fix-compilation-warning-when-not-in-smp.patch --- diff --git a/queue-3.10/8250_core-fix-unwanted-tx-chars-write.patch b/queue-3.10/8250_core-fix-unwanted-tx-chars-write.patch new file mode 100644 index 00000000000..3122bf599c0 --- /dev/null +++ b/queue-3.10/8250_core-fix-unwanted-tx-chars-write.patch @@ -0,0 +1,32 @@ +From b08c9c317e3f7764a91d522cd031639ba42b98cc Mon Sep 17 00:00:00 2001 +From: Loic Poulain +Date: Thu, 24 Apr 2014 11:38:56 +0200 +Subject: 8250_core: Fix unwanted TX chars write + +From: Loic Poulain + +commit b08c9c317e3f7764a91d522cd031639ba42b98cc upstream. + +On transmit-hold-register empty, serial8250_tx_chars +should be called only if we don't use DMA. +DMA has its own tx cycle. + +Signed-off-by: Loic Poulain +Reviewed-by: Heikki Krogerus +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/8250/8250_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/serial/8250/8250_core.c ++++ b/drivers/tty/serial/8250/8250_core.c +@@ -1520,7 +1520,7 @@ int serial8250_handle_irq(struct uart_po + status = serial8250_rx_chars(up, status); + } + serial8250_modem_status(up); +- if (status & UART_LSR_THRE) ++ if (!up->dma && (status & UART_LSR_THRE)) + serial8250_tx_chars(up); + + spin_unlock_irqrestore(&port->lock, flags); diff --git a/queue-3.10/clocksource-exynos_mct-register-clock-event-after-request_irq.patch b/queue-3.10/clocksource-exynos_mct-register-clock-event-after-request_irq.patch new file mode 100644 index 00000000000..9f4c2915a56 --- /dev/null +++ b/queue-3.10/clocksource-exynos_mct-register-clock-event-after-request_irq.patch @@ -0,0 +1,55 @@ +From 8db6e5104b77de5d0b7002b95069da0992a34be9 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Wed, 16 Apr 2014 14:36:45 +0000 +Subject: clocksource: Exynos_mct: Register clock event after request_irq() + +From: Krzysztof Kozlowski + +commit 8db6e5104b77de5d0b7002b95069da0992a34be9 upstream. + +After hotplugging CPU1 the first call of interrupt handler for CPU1 +oneshot timer was called on CPU0 because it fired before setting IRQ +affinity. Affected are SoCs where Multi Core Timer interrupts are +shared (SPI), e.g. Exynos 4210. + +During setup of the MCT timers the clock event device should be +registered after setting the affinity for interrupt. This will prevent +starting the timer too early. + +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Thomas Gleixner +Cc: Kyungmin Park +Cc: Marek Szyprowski +Cc: Bartlomiej Zolnierkiewicz +Cc: Tomasz Figa , +Cc: Daniel Lezcano , +Cc: Kukjin Kim +Cc: linux-arm-kernel@lists.infradead.org, +Link: http://lkml.kernel.org/r/20140416143316.299247848@linutronix.de +Signed-off-by: Thomas Gleixner +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/clocksource/exynos_mct.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/clocksource/exynos_mct.c ++++ b/drivers/clocksource/exynos_mct.c +@@ -429,8 +429,6 @@ static int __cpuinit exynos4_local_timer + evt->set_mode = exynos4_tick_set_mode; + evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; + evt->rating = 450; +- clockevents_config_and_register(evt, clk_rate / (TICK_BASE_CNT + 1), +- 0xf, 0x7fffffff); + + exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET); + +@@ -448,6 +446,8 @@ static int __cpuinit exynos4_local_timer + } else { + enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); + } ++ clockevents_config_and_register(evt, clk_rate / (TICK_BASE_CNT + 1), ++ 0xf, 0x7fffffff); + + return 0; + } diff --git a/queue-3.10/genirq-allow-forcing-cpu-affinity-of-interrupts.patch b/queue-3.10/genirq-allow-forcing-cpu-affinity-of-interrupts.patch new file mode 100644 index 00000000000..ebc8212cefe --- /dev/null +++ b/queue-3.10/genirq-allow-forcing-cpu-affinity-of-interrupts.patch @@ -0,0 +1,177 @@ +From 01f8fa4f01d8362358eb90e412bd7ae18a3ec1ad Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Wed, 16 Apr 2014 14:36:44 +0000 +Subject: genirq: Allow forcing cpu affinity of interrupts + +From: Thomas Gleixner + +commit 01f8fa4f01d8362358eb90e412bd7ae18a3ec1ad upstream. + +The current implementation of irq_set_affinity() refuses rightfully to +route an interrupt to an offline cpu. + +But there is a special case, where this is actually desired. Some of +the ARM SoCs have per cpu timers which require setting the affinity +during cpu startup where the cpu is not yet in the online mask. + +If we can't do that, then the local timer interrupt for the about to +become online cpu is routed to some random online cpu. + +The developers of the affected machines tried to work around that +issue, but that results in a massive mess in that timer code. + +We have a yet unused argument in the set_affinity callbacks of the irq +chips, which I added back then for a similar reason. It was never +required so it got not used. But I'm happy that I never removed it. + +That allows us to implement a sane handling of the above scenario. So +the affected SoC drivers can add the required force handling to their +interrupt chip, switch the timer code to irq_force_affinity() and +things just work. + +This does not affect any existing user of irq_set_affinity(). + +Tagged for stable to allow a simple fix of the affected SoC clock +event drivers. + +Reported-and-tested-by: Krzysztof Kozlowski +Signed-off-by: Thomas Gleixner +Cc: Kyungmin Park +Cc: Marek Szyprowski +Cc: Bartlomiej Zolnierkiewicz +Cc: Tomasz Figa , +Cc: Daniel Lezcano , +Cc: Kukjin Kim +Cc: linux-arm-kernel@lists.infradead.org, +Link: http://lkml.kernel.org/r/20140416143315.717251504@linutronix.de +Signed-off-by: Thomas Gleixner +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/cavium-octeon/octeon-irq.c | 2 +- + include/linux/interrupt.h | 35 ++++++++++++++++++++++++++++++++++- + include/linux/irq.h | 3 ++- + kernel/irq/manage.c | 17 ++++++----------- + 4 files changed, 43 insertions(+), 14 deletions(-) + +--- a/arch/mips/cavium-octeon/octeon-irq.c ++++ b/arch/mips/cavium-octeon/octeon-irq.c +@@ -635,7 +635,7 @@ static void octeon_irq_cpu_offline_ciu(s + cpumask_clear(&new_affinity); + cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity); + } +- __irq_set_affinity_locked(data, &new_affinity); ++ irq_set_affinity_locked(data, &new_affinity, false); + } + + static int octeon_irq_ciu_set_affinity(struct irq_data *data, +--- a/include/linux/interrupt.h ++++ b/include/linux/interrupt.h +@@ -239,7 +239,40 @@ static inline int check_wakeup_irqs(void + + extern cpumask_var_t irq_default_affinity; + +-extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); ++/* Internal implementation. Use the helpers below */ ++extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask, ++ bool force); ++ ++/** ++ * irq_set_affinity - Set the irq affinity of a given irq ++ * @irq: Interrupt to set affinity ++ * @mask: cpumask ++ * ++ * Fails if cpumask does not contain an online CPU ++ */ ++static inline int ++irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) ++{ ++ return __irq_set_affinity(irq, cpumask, false); ++} ++ ++/** ++ * irq_force_affinity - Force the irq affinity of a given irq ++ * @irq: Interrupt to set affinity ++ * @mask: cpumask ++ * ++ * Same as irq_set_affinity, but without checking the mask against ++ * online cpus. ++ * ++ * Solely for low level cpu hotplug code, where we need to make per ++ * cpu interrupts affine before the cpu becomes online. ++ */ ++static inline int ++irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) ++{ ++ return __irq_set_affinity(irq, cpumask, true); ++} ++ + extern int irq_can_set_affinity(unsigned int irq); + extern int irq_select_affinity(unsigned int irq); + +--- a/include/linux/irq.h ++++ b/include/linux/irq.h +@@ -375,7 +375,8 @@ extern void remove_percpu_irq(unsigned i + + extern void irq_cpu_online(void); + extern void irq_cpu_offline(void); +-extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask); ++extern int irq_set_affinity_locked(struct irq_data *data, ++ const struct cpumask *cpumask, bool force); + + #ifdef CONFIG_GENERIC_HARDIRQS + +--- a/kernel/irq/manage.c ++++ b/kernel/irq/manage.c +@@ -150,7 +150,7 @@ int irq_do_set_affinity(struct irq_data + struct irq_chip *chip = irq_data_get_irq_chip(data); + int ret; + +- ret = chip->irq_set_affinity(data, mask, false); ++ ret = chip->irq_set_affinity(data, mask, force); + switch (ret) { + case IRQ_SET_MASK_OK: + cpumask_copy(data->affinity, mask); +@@ -162,7 +162,8 @@ int irq_do_set_affinity(struct irq_data + return ret; + } + +-int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask) ++int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, ++ bool force) + { + struct irq_chip *chip = irq_data_get_irq_chip(data); + struct irq_desc *desc = irq_data_to_desc(data); +@@ -172,7 +173,7 @@ int __irq_set_affinity_locked(struct irq + return -EINVAL; + + if (irq_can_move_pcntxt(data)) { +- ret = irq_do_set_affinity(data, mask, false); ++ ret = irq_do_set_affinity(data, mask, force); + } else { + irqd_set_move_pending(data); + irq_copy_pending(desc, mask); +@@ -187,13 +188,7 @@ int __irq_set_affinity_locked(struct irq + return ret; + } + +-/** +- * irq_set_affinity - Set the irq affinity of a given irq +- * @irq: Interrupt to set affinity +- * @mask: cpumask +- * +- */ +-int irq_set_affinity(unsigned int irq, const struct cpumask *mask) ++int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) + { + struct irq_desc *desc = irq_to_desc(irq); + unsigned long flags; +@@ -203,7 +198,7 @@ int irq_set_affinity(unsigned int irq, c + return -EINVAL; + + raw_spin_lock_irqsave(&desc->lock, flags); +- ret = __irq_set_affinity_locked(irq_desc_get_irq_data(desc), mask); ++ ret = irq_set_affinity_locked(irq_desc_get_irq_data(desc), mask, force); + raw_spin_unlock_irqrestore(&desc->lock, flags); + return ret; + } diff --git a/queue-3.10/mm-make-fixup_user_fault-check-the-vma-access-rights-too.patch b/queue-3.10/mm-make-fixup_user_fault-check-the-vma-access-rights-too.patch new file mode 100644 index 00000000000..4b5f338f71f --- /dev/null +++ b/queue-3.10/mm-make-fixup_user_fault-check-the-vma-access-rights-too.patch @@ -0,0 +1,55 @@ +From 1b17844b29ae042576bea588164f2f1e9590a8bc Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Tue, 22 Apr 2014 13:49:40 -0700 +Subject: mm: make fixup_user_fault() check the vma access rights too + +From: Linus Torvalds + +commit 1b17844b29ae042576bea588164f2f1e9590a8bc upstream. + +fixup_user_fault() is used by the futex code when the direct user access +fails, and the futex code wants it to either map in the page in a usable +form or return an error. It relied on handle_mm_fault() to map the +page, and correctly checked the error return from that, but while that +does map the page, it doesn't actually guarantee that the page will be +mapped with sufficient permissions to be then accessed. + +So do the appropriate tests of the vma access rights by hand. + +[ Side note: arguably handle_mm_fault() could just do that itself, but + we have traditionally done it in the caller, because some callers - + notably get_user_pages() - have been able to access pages even when + they are mapped with PROT_NONE. Maybe we should re-visit that design + decision, but in the meantime this is the minimal patch. ] + +Found by Dave Jones running his trinity tool. + +Reported-by: Dave Jones +Acked-by: Hugh Dickins +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/memory.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -1937,12 +1937,17 @@ int fixup_user_fault(struct task_struct + unsigned long address, unsigned int fault_flags) + { + struct vm_area_struct *vma; ++ vm_flags_t vm_flags; + int ret; + + vma = find_extend_vma(mm, address); + if (!vma || address < vma->vm_start) + return -EFAULT; + ++ vm_flags = (fault_flags & FAULT_FLAG_WRITE) ? VM_WRITE : VM_READ; ++ if (!(vm_flags & vma->vm_flags)) ++ return -EFAULT; ++ + ret = handle_mm_fault(mm, vma, address, fault_flags); + if (ret & VM_FAULT_ERROR) { + if (ret & VM_FAULT_OOM) diff --git a/queue-3.10/pata_at91-fix-ata_host_activate-failure-handling.patch b/queue-3.10/pata_at91-fix-ata_host_activate-failure-handling.patch new file mode 100644 index 00000000000..2628522987a --- /dev/null +++ b/queue-3.10/pata_at91-fix-ata_host_activate-failure-handling.patch @@ -0,0 +1,51 @@ +From 27aa64b9d1bd0d23fd692c91763a48309b694311 Mon Sep 17 00:00:00 2001 +From: Bartlomiej Zolnierkiewicz +Date: Mon, 31 Mar 2014 19:51:14 +0200 +Subject: pata_at91: fix ata_host_activate() failure handling + +From: Bartlomiej Zolnierkiewicz + +commit 27aa64b9d1bd0d23fd692c91763a48309b694311 upstream. + +Add missing clk_put() call to ata_host_activate() failure path. + +Sergei says, + + "Hm, I have once fixed that (see that *if* (!ret)) but looks like a + later commit 477c87e90853d136b188c50c0e4a93d01cad872e (ARM: + at91/pata: use gpio_is_valid to check the gpio) broke it again. :-( + Would be good if the changelog did mention that..." + +Cc: Andrew Victor +Cc: Nicolas Ferre +Cc: Jean-Christophe Plagniol-Villard +Cc: Sergei Shtylyov +Signed-off-by: Bartlomiej Zolnierkiewicz +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/pata_at91.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +--- a/drivers/ata/pata_at91.c ++++ b/drivers/ata/pata_at91.c +@@ -408,12 +408,13 @@ static int pata_at91_probe(struct platfo + + host->private_data = info; + +- return ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, +- gpio_is_valid(irq) ? ata_sff_interrupt : NULL, +- irq_flags, &pata_at91_sht); ++ ret = ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, ++ gpio_is_valid(irq) ? ata_sff_interrupt : NULL, ++ irq_flags, &pata_at91_sht); ++ if (ret) ++ goto err_put; + +- if (!ret) +- return 0; ++ return 0; + + err_put: + clk_put(info->mck); diff --git a/queue-3.10/serial-8250-fix-thread-unsafe-__dma_tx_complete-function.patch b/queue-3.10/serial-8250-fix-thread-unsafe-__dma_tx_complete-function.patch new file mode 100644 index 00000000000..b2048152f04 --- /dev/null +++ b/queue-3.10/serial-8250-fix-thread-unsafe-__dma_tx_complete-function.patch @@ -0,0 +1,53 @@ +From f8fd1b0350d3a4581125f5eda6528f5a2c5f9183 Mon Sep 17 00:00:00 2001 +From: Loic Poulain +Date: Thu, 24 Apr 2014 11:34:48 +0200 +Subject: serial: 8250: Fix thread unsafe __dma_tx_complete function + +From: Loic Poulain + +commit f8fd1b0350d3a4581125f5eda6528f5a2c5f9183 upstream. + +__dma_tx_complete is not protected against concurrent +call of serial8250_tx_dma. it can lead to circular tail +index corruption or parallel call of serial_tx_dma on the +same data portion. + +This patch fixes this issue by holding the port lock. + +Signed-off-by: Loic Poulain +Reviewed-by: Heikki Krogerus +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/8250/8250_dma.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/tty/serial/8250/8250_dma.c ++++ b/drivers/tty/serial/8250/8250_dma.c +@@ -20,12 +20,15 @@ static void __dma_tx_complete(void *para + struct uart_8250_port *p = param; + struct uart_8250_dma *dma = p->dma; + struct circ_buf *xmit = &p->port.state->xmit; +- +- dma->tx_running = 0; ++ unsigned long flags; + + dma_sync_single_for_cpu(dma->txchan->device->dev, dma->tx_addr, + UART_XMIT_SIZE, DMA_TO_DEVICE); + ++ spin_lock_irqsave(&p->port.lock, flags); ++ ++ dma->tx_running = 0; ++ + xmit->tail += dma->tx_size; + xmit->tail &= UART_XMIT_SIZE - 1; + p->port.icount.tx += dma->tx_size; +@@ -35,6 +38,8 @@ static void __dma_tx_complete(void *para + + if (!uart_circ_empty(xmit) && !uart_tx_stopped(&p->port)) + serial8250_tx_dma(p); ++ ++ spin_unlock_irqrestore(&p->port.lock, flags); + } + + static void __dma_rx_complete(void *param) diff --git a/queue-3.10/series b/queue-3.10/series index 2c4f28b8a31..e8dba5aa646 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -4,3 +4,10 @@ mips-dts-fix-missing-device_type-memory-property-in-memory-nodes.patch ftrace-module-hardcode-ftrace_module_init-call-into-load_module.patch of-irq-do-irq-resolution-in-platform_get_irq.patch irqchip-gic-support-forced-affinity-setting.patch +genirq-allow-forcing-cpu-affinity-of-interrupts.patch +clocksource-exynos_mct-register-clock-event-after-request_irq.patch +pata_at91-fix-ata_host_activate-failure-handling.patch +topology-fix-compilation-warning-when-not-in-smp.patch +mm-make-fixup_user_fault-check-the-vma-access-rights-too.patch +serial-8250-fix-thread-unsafe-__dma_tx_complete-function.patch +8250_core-fix-unwanted-tx-chars-write.patch diff --git a/queue-3.10/topology-fix-compilation-warning-when-not-in-smp.patch b/queue-3.10/topology-fix-compilation-warning-when-not-in-smp.patch new file mode 100644 index 00000000000..4a04f0b778c --- /dev/null +++ b/queue-3.10/topology-fix-compilation-warning-when-not-in-smp.patch @@ -0,0 +1,47 @@ +From 53974e06603977f348ed978d75c426b0532daa67 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= +Date: Fri, 4 Apr 2014 08:43:18 +0200 +Subject: topology: Fix compilation warning when not in SMP +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= + +commit 53974e06603977f348ed978d75c426b0532daa67 upstream. + +The topology_##name() macro does not use its argument when CONFIG_SMP is not +set, as it ultimately calls the cpu_data() macro. + +So we avoid maintaining a possibly unused `cpu' variable, to avoid the +following compilation warning: + + drivers/base/topology.c: In function ‘show_physical_package_id’: + drivers/base/topology.c:103:118: warning: unused variable ‘cpu’ [-Wunused-variable] + define_id_show_func(physical_package_id); + + drivers/base/topology.c: In function ‘show_core_id’: + drivers/base/topology.c:106:106: warning: unused variable ‘cpu’ [-Wunused-variable] + define_id_show_func(core_id); + +This can be seen with e.g. x86 defconfig and CONFIG_SMP not set. + +Signed-off-by: Vincent Stehlé +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/topology.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/base/topology.c ++++ b/drivers/base/topology.c +@@ -40,8 +40,7 @@ + static ssize_t show_##name(struct device *dev, \ + struct device_attribute *attr, char *buf) \ + { \ +- unsigned int cpu = dev->id; \ +- return sprintf(buf, "%d\n", topology_##name(cpu)); \ ++ return sprintf(buf, "%d\n", topology_##name(dev->id)); \ + } + + #if defined(topology_thread_cpumask) || defined(topology_core_cpumask) || \