From: Greg Kroah-Hartman Date: Mon, 7 Aug 2017 20:38:16 +0000 (-0700) Subject: 3.18-stable patches X-Git-Tag: v4.12.6~53 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef72be166130428314c916efe7aa77d8b4017649;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: alsa-hda-fix-speaker-output-from-vaio-vpcl14m1r.patch arch-powerpc-provide-zero_bytemask-for-big-endian.patch asoc-do-not-close-shared-backend-dailink.patch kvm-async_pf-make-rcu-irq-exit-if-not-triggered-from-idle-task.patch libata-array-underflow-in-ata_find_dev.patch tile-use-global-strscpy-rather-than-private-copy.patch workqueue-restore-wq_unbound-max_active-1-to-be-ordered.patch --- diff --git a/queue-3.18/alsa-hda-fix-speaker-output-from-vaio-vpcl14m1r.patch b/queue-3.18/alsa-hda-fix-speaker-output-from-vaio-vpcl14m1r.patch new file mode 100644 index 00000000000..6ce91bc9986 --- /dev/null +++ b/queue-3.18/alsa-hda-fix-speaker-output-from-vaio-vpcl14m1r.patch @@ -0,0 +1,30 @@ +From 3f3c371421e601fa93b6cb7fb52da9ad59ec90b4 Mon Sep 17 00:00:00 2001 +From: "Sergei A. Trusov" +Date: Wed, 2 Aug 2017 20:23:48 +1000 +Subject: ALSA: hda - Fix speaker output from VAIO VPCL14M1R + +From: Sergei A. Trusov + +commit 3f3c371421e601fa93b6cb7fb52da9ad59ec90b4 upstream. + +Sony VAIO VPCL14M1R needs the quirk to make the speaker working properly. + +Tested-by: Dmitriy +Signed-off-by: Sergei A. Trusov +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -2203,6 +2203,7 @@ static const struct snd_pci_quirk alc882 + SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), + SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), + SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), ++ SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP), + SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), + SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), + diff --git a/queue-3.18/arch-powerpc-provide-zero_bytemask-for-big-endian.patch b/queue-3.18/arch-powerpc-provide-zero_bytemask-for-big-endian.patch new file mode 100644 index 00000000000..1a66ce98a43 --- /dev/null +++ b/queue-3.18/arch-powerpc-provide-zero_bytemask-for-big-endian.patch @@ -0,0 +1,35 @@ +From 7a5692e6e533fd379081ab06fb58f3f5ee4d80bc Mon Sep 17 00:00:00 2001 +From: Chris Metcalf +Date: Wed, 7 Oct 2015 09:29:11 -0400 +Subject: arch/powerpc: provide zero_bytemask() for big-endian + +From: Chris Metcalf + +commit 7a5692e6e533fd379081ab06fb58f3f5ee4d80bc upstream. + +For some reason, only the little-endian flavor of +powerpc provided the zero_bytemask() implementation. + +Reported-by: Michal Sojka +Acked-by: Michael Ellerman +Signed-off-by: Chris Metcalf +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/include/asm/word-at-a-time.h | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/powerpc/include/asm/word-at-a-time.h ++++ b/arch/powerpc/include/asm/word-at-a-time.h +@@ -40,6 +40,11 @@ static inline bool has_zero(unsigned lon + return (val + c->high_bits) & ~rhs; + } + ++static inline unsigned long zero_bytemask(unsigned long mask) ++{ ++ return ~1ul << __fls(mask); ++} ++ + #else + + #ifdef CONFIG_64BIT diff --git a/queue-3.18/asoc-do-not-close-shared-backend-dailink.patch b/queue-3.18/asoc-do-not-close-shared-backend-dailink.patch new file mode 100644 index 00000000000..62cf1c97791 --- /dev/null +++ b/queue-3.18/asoc-do-not-close-shared-backend-dailink.patch @@ -0,0 +1,39 @@ +From b1cd2e34c69a2f3988786af451b6e17967c293a0 Mon Sep 17 00:00:00 2001 +From: Banajit Goswami +Date: Fri, 14 Jul 2017 23:15:05 -0700 +Subject: ASoC: do not close shared backend dailink + +From: Banajit Goswami + +commit b1cd2e34c69a2f3988786af451b6e17967c293a0 upstream. + +Multiple frontend dailinks may be connected to a backend +dailink at the same time. When one of frontend dailinks is +closed, the associated backend dailink should not be closed +if it is connected to other active frontend dailinks. Change +ensures that backend dailink is closed only after all +connected frontend dailinks are closed. + +Signed-off-by: Gopikrishnaiah Anandan +Signed-off-by: Banajit Goswami +Signed-off-by: Patrick Lai +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/soc-pcm.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/sound/soc/soc-pcm.c ++++ b/sound/soc/soc-pcm.c +@@ -163,6 +163,10 @@ int dpcm_dapm_stream_event(struct snd_so + dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n", + be->dai_link->name, event, dir); + ++ if ((event == SND_SOC_DAPM_STREAM_STOP) && ++ (be->dpcm[dir].users >= 1)) ++ continue; ++ + snd_soc_dapm_stream_event(be, dir, event); + } + diff --git a/queue-3.18/kvm-async_pf-make-rcu-irq-exit-if-not-triggered-from-idle-task.patch b/queue-3.18/kvm-async_pf-make-rcu-irq-exit-if-not-triggered-from-idle-task.patch new file mode 100644 index 00000000000..3631ff58ff3 --- /dev/null +++ b/queue-3.18/kvm-async_pf-make-rcu-irq-exit-if-not-triggered-from-idle-task.patch @@ -0,0 +1,75 @@ +From 337c017ccdf2653d0040099433fc1a2b1beb5926 Mon Sep 17 00:00:00 2001 +From: Wanpeng Li +Date: Tue, 1 Aug 2017 05:20:03 -0700 +Subject: KVM: async_pf: make rcu irq exit if not triggered from idle task +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Wanpeng Li + +commit 337c017ccdf2653d0040099433fc1a2b1beb5926 upstream. + + WARNING: CPU: 5 PID: 1242 at kernel/rcu/tree_plugin.h:323 rcu_note_context_switch+0x207/0x6b0 + CPU: 5 PID: 1242 Comm: unity-settings- Not tainted 4.13.0-rc2+ #1 + RIP: 0010:rcu_note_context_switch+0x207/0x6b0 + Call Trace: + __schedule+0xda/0xba0 + ? kvm_async_pf_task_wait+0x1b2/0x270 + schedule+0x40/0x90 + kvm_async_pf_task_wait+0x1cc/0x270 + ? prepare_to_swait+0x22/0x70 + do_async_page_fault+0x77/0xb0 + ? do_async_page_fault+0x77/0xb0 + async_page_fault+0x28/0x30 + RIP: 0010:__d_lookup_rcu+0x90/0x1e0 + +I encounter this when trying to stress the async page fault in L1 guest w/ +L2 guests running. + +Commit 9b132fbe5419 (Add rcu user eqs exception hooks for async page +fault) adds rcu_irq_enter/exit() to kvm_async_pf_task_wait() to exit cpu +idle eqs when needed, to protect the code that needs use rcu. However, +we need to call the pair even if the function calls schedule(), as seen +from the above backtrace. + +This patch fixes it by informing the RCU subsystem exit/enter the irq +towards/away from idle for both n.halted and !n.halted. + +Cc: Paolo Bonzini +Cc: Radim Krčmář +Cc: Paul E. McKenney +Signed-off-by: Wanpeng Li +Reviewed-by: Paolo Bonzini +Signed-off-by: Radim Krčmář +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/kvm.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/arch/x86/kernel/kvm.c ++++ b/arch/x86/kernel/kvm.c +@@ -151,6 +151,8 @@ void kvm_async_pf_task_wait(u32 token) + if (hlist_unhashed(&n.link)) + break; + ++ rcu_irq_exit(); ++ + if (!n.halted) { + local_irq_enable(); + schedule(); +@@ -159,11 +161,11 @@ void kvm_async_pf_task_wait(u32 token) + /* + * We cannot reschedule. So halt. + */ +- rcu_irq_exit(); + native_safe_halt(); + local_irq_disable(); +- rcu_irq_enter(); + } ++ ++ rcu_irq_enter(); + } + if (!n.halted) + finish_wait(&n.wq, &wait); diff --git a/queue-3.18/libata-array-underflow-in-ata_find_dev.patch b/queue-3.18/libata-array-underflow-in-ata_find_dev.patch new file mode 100644 index 00000000000..573c249336f --- /dev/null +++ b/queue-3.18/libata-array-underflow-in-ata_find_dev.patch @@ -0,0 +1,44 @@ +From 59a5e266c3f5c1567508888dd61a45b86daed0fa Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 19 Jul 2017 13:06:41 +0300 +Subject: libata: array underflow in ata_find_dev() + +From: Dan Carpenter + +commit 59a5e266c3f5c1567508888dd61a45b86daed0fa upstream. + +My static checker complains that "devno" can be negative, meaning that +we read before the start of the loop. I've looked at the code, and I +think the warning is right. This come from /proc so it's root only or +it would be quite a quite a serious bug. The call tree looks like this: + +proc_scsi_write() <- gets id and channel from simple_strtoul() +-> scsi_add_single_device() <- calls shost->transportt->user_scan() + -> ata_scsi_user_scan() + -> ata_find_dev() + +Signed-off-by: Dan Carpenter +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/libata-scsi.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/ata/libata-scsi.c ++++ b/drivers/ata/libata-scsi.c +@@ -2798,10 +2798,12 @@ static unsigned int atapi_xlat(struct at + static struct ata_device *ata_find_dev(struct ata_port *ap, int devno) + { + if (!sata_pmp_attached(ap)) { +- if (likely(devno < ata_link_max_devices(&ap->link))) ++ if (likely(devno >= 0 && ++ devno < ata_link_max_devices(&ap->link))) + return &ap->link.device[devno]; + } else { +- if (likely(devno < ap->nr_pmp_links)) ++ if (likely(devno >= 0 && ++ devno < ap->nr_pmp_links)) + return &ap->pmp_link[devno].device[0]; + } + diff --git a/queue-3.18/series b/queue-3.18/series index 919c53b9b3f..231072b140d 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -55,3 +55,6 @@ arch-powerpc-provide-zero_bytemask-for-big-endian.patch tile-use-global-strscpy-rather-than-private-copy.patch libata-array-underflow-in-ata_find_dev.patch workqueue-restore-wq_unbound-max_active-1-to-be-ordered.patch +alsa-hda-fix-speaker-output-from-vaio-vpcl14m1r.patch +asoc-do-not-close-shared-backend-dailink.patch +kvm-async_pf-make-rcu-irq-exit-if-not-triggered-from-idle-task.patch diff --git a/queue-3.18/tile-use-global-strscpy-rather-than-private-copy.patch b/queue-3.18/tile-use-global-strscpy-rather-than-private-copy.patch new file mode 100644 index 00000000000..9f9830c6cfe --- /dev/null +++ b/queue-3.18/tile-use-global-strscpy-rather-than-private-copy.patch @@ -0,0 +1,88 @@ +From 30059d494a72603d066baf55c748803df968aa08 Mon Sep 17 00:00:00 2001 +From: Chris Metcalf +Date: Wed, 29 Apr 2015 13:07:38 -0400 +Subject: tile: use global strscpy() rather than private copy + +From: Chris Metcalf + +commit 30059d494a72603d066baf55c748803df968aa08 upstream. + +Now that strscpy() is a standard API, remove the local copy. + +Signed-off-by: Chris Metcalf +Signed-off-by: Greg Kroah-Hartman + +--- + arch/tile/gxio/mpipe.c | 33 ++++----------------------------- + 1 file changed, 4 insertions(+), 29 deletions(-) + +--- a/arch/tile/gxio/mpipe.c ++++ b/arch/tile/gxio/mpipe.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -29,32 +30,6 @@ + /* HACK: Avoid pointless "shadow" warnings. */ + #define link link_shadow + +-/** +- * strscpy - Copy a C-string into a sized buffer, but only if it fits +- * @dest: Where to copy the string to +- * @src: Where to copy the string from +- * @size: size of destination buffer +- * +- * Use this routine to avoid copying too-long strings. +- * The routine returns the total number of bytes copied +- * (including the trailing NUL) or zero if the buffer wasn't +- * big enough. To ensure that programmers pay attention +- * to the return code, the destination has a single NUL +- * written at the front (if size is non-zero) when the +- * buffer is not big enough. +- */ +-static size_t strscpy(char *dest, const char *src, size_t size) +-{ +- size_t len = strnlen(src, size) + 1; +- if (len > size) { +- if (size) +- dest[0] = '\0'; +- return 0; +- } +- memcpy(dest, src, len); +- return len; +-} +- + int gxio_mpipe_init(gxio_mpipe_context_t *context, unsigned int mpipe_index) + { + char file[32]; +@@ -537,7 +512,7 @@ int gxio_mpipe_link_instance(const char + if (!context) + return GXIO_ERR_NO_DEVICE; + +- if (strscpy(name.name, link_name, sizeof(name.name)) == 0) ++ if (strscpy(name.name, link_name, sizeof(name.name)) < 0) + return GXIO_ERR_NO_DEVICE; + + return gxio_mpipe_info_instance_aux(context, name); +@@ -555,7 +530,7 @@ int gxio_mpipe_link_enumerate_mac(int id + + rv = gxio_mpipe_info_enumerate_aux(context, idx, &name, &mac); + if (rv >= 0) { +- if (strscpy(link_name, name.name, sizeof(name.name)) == 0) ++ if (strscpy(link_name, name.name, sizeof(name.name)) < 0) + return GXIO_ERR_INVAL_MEMORY_SIZE; + memcpy(link_mac, mac.mac, sizeof(mac.mac)); + } +@@ -572,7 +547,7 @@ int gxio_mpipe_link_open(gxio_mpipe_link + _gxio_mpipe_link_name_t name; + int rv; + +- if (strscpy(name.name, link_name, sizeof(name.name)) == 0) ++ if (strscpy(name.name, link_name, sizeof(name.name)) < 0) + return GXIO_ERR_NO_DEVICE; + + rv = gxio_mpipe_link_open_aux(context, name, flags); diff --git a/queue-3.18/workqueue-restore-wq_unbound-max_active-1-to-be-ordered.patch b/queue-3.18/workqueue-restore-wq_unbound-max_active-1-to-be-ordered.patch new file mode 100644 index 00000000000..bd23456f2ec --- /dev/null +++ b/queue-3.18/workqueue-restore-wq_unbound-max_active-1-to-be-ordered.patch @@ -0,0 +1,53 @@ +From 5c0338c68706be53b3dc472e4308961c36e4ece1 Mon Sep 17 00:00:00 2001 +From: Tejun Heo +Date: Tue, 18 Jul 2017 18:41:52 -0400 +Subject: workqueue: restore WQ_UNBOUND/max_active==1 to be ordered + +From: Tejun Heo + +commit 5c0338c68706be53b3dc472e4308961c36e4ece1 upstream. + +The combination of WQ_UNBOUND and max_active == 1 used to imply +ordered execution. After NUMA affinity 4c16bd327c74 ("workqueue: +implement NUMA affinity for unbound workqueues"), this is no longer +true due to per-node worker pools. + +While the right way to create an ordered workqueue is +alloc_ordered_workqueue(), the documentation has been misleading for a +long time and people do use WQ_UNBOUND and max_active == 1 for ordered +workqueues which can lead to subtle bugs which are very difficult to +trigger. + +It's unlikely that we'd see noticeable performance impact by enforcing +ordering on WQ_UNBOUND / max_active == 1 workqueues. Let's +automatically set __WQ_ORDERED for those workqueues. + +Signed-off-by: Tejun Heo +Reported-by: Christoph Hellwig +Reported-by: Alexei Potashnik +Fixes: 4c16bd327c74 ("workqueue: implement NUMA affinity for unbound workqueues") +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/workqueue.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -4075,6 +4075,16 @@ struct workqueue_struct *__alloc_workque + struct workqueue_struct *wq; + struct pool_workqueue *pwq; + ++ /* ++ * Unbound && max_active == 1 used to imply ordered, which is no ++ * longer the case on NUMA machines due to per-node pools. While ++ * alloc_ordered_workqueue() is the right way to create an ordered ++ * workqueue, keep the previous behavior to avoid subtle breakages ++ * on NUMA. ++ */ ++ if ((flags & WQ_UNBOUND) && max_active == 1) ++ flags |= __WQ_ORDERED; ++ + /* see the comment above the definition of WQ_POWER_EFFICIENT */ + if ((flags & WQ_POWER_EFFICIENT) && wq_power_efficient) + flags |= WQ_UNBOUND;