]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Sep 2018 12:44:46 +0000 (14:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Sep 2018 12:44:46 +0000 (14:44 +0200)
added patches:
alsa-hda-fix-cancel_work_sync-stall-from-jackpoll-work.patch
cpu-hotplug-adjust-misplaced-smb-in-cpuhp_thread_fun.patch
cpu-hotplug-prevent-state-corruption-on-error-rollback.patch
x86-microcode-make-sure-boot_cpu_data.microcode-is-up-to-date.patch
x86-microcode-update-the-new-microcode-revision-unconditionally.patch

queue-4.14/alsa-hda-fix-cancel_work_sync-stall-from-jackpoll-work.patch [new file with mode: 0644]
queue-4.14/cpu-hotplug-adjust-misplaced-smb-in-cpuhp_thread_fun.patch [new file with mode: 0644]
queue-4.14/cpu-hotplug-prevent-state-corruption-on-error-rollback.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/x86-microcode-make-sure-boot_cpu_data.microcode-is-up-to-date.patch [new file with mode: 0644]
queue-4.14/x86-microcode-update-the-new-microcode-revision-unconditionally.patch [new file with mode: 0644]

diff --git a/queue-4.14/alsa-hda-fix-cancel_work_sync-stall-from-jackpoll-work.patch b/queue-4.14/alsa-hda-fix-cancel_work_sync-stall-from-jackpoll-work.patch
new file mode 100644 (file)
index 0000000..264a92f
--- /dev/null
@@ -0,0 +1,46 @@
+From 16037643969e095509cd8446a3f8e406a6dc3a2c Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 30 Aug 2018 15:13:16 +0200
+Subject: ALSA: hda - Fix cancel_work_sync() stall from jackpoll work
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 16037643969e095509cd8446a3f8e406a6dc3a2c upstream.
+
+On AMD/ATI controllers, the HD-audio controller driver allows a bus
+reset upon the error recovery, and its procedure includes the
+cancellation of pending jack polling work as found in
+snd_hda_bus_codec_reset().  This works usually fine, but it becomes a
+problem when the reset happens from the jack poll work itself; then
+calling cancel_work_sync() from the work being processed tries to wait
+the finish endlessly.
+
+As a workaround, this patch adds the check of current_work() and
+applies the cancel_work_sync() only when it's not from the
+jackpoll_work.
+
+This doesn't fix the root cause of the reported error below, but at
+least, it eases the unexpected stall of the whole system.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200937
+Cc: <stable@vger.kernel.org>
+Cc: Lukas Wunner <lukas@wunner.de>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/hda_codec.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/hda_codec.c
++++ b/sound/pci/hda/hda_codec.c
+@@ -3923,7 +3923,8 @@ void snd_hda_bus_reset_codecs(struct hda
+       list_for_each_codec(codec, bus) {
+               /* FIXME: maybe a better way needed for forced reset */
+-              cancel_delayed_work_sync(&codec->jackpoll_work);
++              if (current_work() != &codec->jackpoll_work.work)
++                      cancel_delayed_work_sync(&codec->jackpoll_work);
+ #ifdef CONFIG_PM
+               if (hda_codec_is_power_on(codec)) {
+                       hda_call_codec_suspend(codec);
diff --git a/queue-4.14/cpu-hotplug-adjust-misplaced-smb-in-cpuhp_thread_fun.patch b/queue-4.14/cpu-hotplug-adjust-misplaced-smb-in-cpuhp_thread_fun.patch
new file mode 100644 (file)
index 0000000..6b46759
--- /dev/null
@@ -0,0 +1,55 @@
+From f8b7530aa0a1def79c93101216b5b17cf408a70a Mon Sep 17 00:00:00 2001
+From: Neeraj Upadhyay <neeraju@codeaurora.org>
+Date: Wed, 5 Sep 2018 11:22:07 +0530
+Subject: cpu/hotplug: Adjust misplaced smb() in cpuhp_thread_fun()
+
+From: Neeraj Upadhyay <neeraju@codeaurora.org>
+
+commit f8b7530aa0a1def79c93101216b5b17cf408a70a upstream.
+
+The smp_mb() in cpuhp_thread_fun() is misplaced. It needs to be after the
+load of st->should_run to prevent reordering of the later load/stores
+w.r.t. the load of st->should_run.
+
+Fixes: 4dddfb5faa61 ("smp/hotplug: Rewrite AP state machine core")
+Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: Peter Zijlstra (Intel) <peterz@infraded.org>
+Cc: josh@joshtriplett.org
+Cc: peterz@infradead.org
+Cc: jiangshanlai@gmail.com
+Cc: dzickus@redhat.com
+Cc: brendan.jackman@arm.com
+Cc: malat@debian.org
+Cc: mojha@codeaurora.org
+Cc: sramana@codeaurora.org
+Cc: linux-arm-msm@vger.kernel.org
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/1536126727-11629-1-git-send-email-neeraju@codeaurora.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/cpu.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/kernel/cpu.c
++++ b/kernel/cpu.c
+@@ -612,15 +612,15 @@ static void cpuhp_thread_fun(unsigned in
+       bool bringup = st->bringup;
+       enum cpuhp_state state;
++      if (WARN_ON_ONCE(!st->should_run))
++              return;
++
+       /*
+        * ACQUIRE for the cpuhp_should_run() load of ->should_run. Ensures
+        * that if we see ->should_run we also see the rest of the state.
+        */
+       smp_mb();
+-      if (WARN_ON_ONCE(!st->should_run))
+-              return;
+-
+       cpuhp_lock_acquire(bringup);
+       if (st->single) {
diff --git a/queue-4.14/cpu-hotplug-prevent-state-corruption-on-error-rollback.patch b/queue-4.14/cpu-hotplug-prevent-state-corruption-on-error-rollback.patch
new file mode 100644 (file)
index 0000000..801b66d
--- /dev/null
@@ -0,0 +1,67 @@
+From 69fa6eb7d6a64801ea261025cce9723d9442d773 Mon Sep 17 00:00:00 2001
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Thu, 6 Sep 2018 15:21:38 +0200
+Subject: cpu/hotplug: Prevent state corruption on error rollback
+
+From: Thomas Gleixner <tglx@linutronix.de>
+
+commit 69fa6eb7d6a64801ea261025cce9723d9442d773 upstream.
+
+When a teardown callback fails, the CPU hotplug code brings the CPU back to
+the previous state. The previous state becomes the new target state. The
+rollback happens in undo_cpu_down() which increments the state
+unconditionally even if the state is already the same as the target.
+
+As a consequence the next CPU hotplug operation will start at the wrong
+state. This is easily to observe when __cpu_disable() fails.
+
+Prevent the unconditional undo by checking the state vs. target before
+incrementing state and fix up the consequently wrong conditional in the
+unplug code which handles the failure of the final CPU take down on the
+control CPU side.
+
+Fixes: 4dddfb5faa61 ("smp/hotplug: Rewrite AP state machine core")
+Reported-by: Neeraj Upadhyay <neeraju@codeaurora.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Tested-by: Sudeep Holla <sudeep.holla@arm.com>
+Tested-by: Neeraj Upadhyay <neeraju@codeaurora.org>
+Cc: josh@joshtriplett.org
+Cc: peterz@infradead.org
+Cc: jiangshanlai@gmail.com
+Cc: dzickus@redhat.com
+Cc: brendan.jackman@arm.com
+Cc: malat@debian.org
+Cc: sramana@codeaurora.org
+Cc: linux-arm-msm@vger.kernel.org
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1809051419580.1416@nanos.tec.linutronix.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+----
+
+---
+ kernel/cpu.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/kernel/cpu.c
++++ b/kernel/cpu.c
+@@ -932,7 +932,8 @@ static int cpuhp_down_callbacks(unsigned
+               ret = cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL);
+               if (ret) {
+                       st->target = prev_state;
+-                      undo_cpu_down(cpu, st);
++                      if (st->state < prev_state)
++                              undo_cpu_down(cpu, st);
+                       break;
+               }
+       }
+@@ -985,7 +986,7 @@ static int __ref _cpu_down(unsigned int
+        * to do the further cleanups.
+        */
+       ret = cpuhp_down_callbacks(cpu, st, target);
+-      if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) {
++      if (ret && st->state == CPUHP_TEARDOWN_CPU && st->state < prev_state) {
+               cpuhp_reset_state(st, prev_state);
+               __cpuhp_kick_ap(st);
+       }
index 1d5e15d55352a6a93758d01aadd587ca44fe9819..ca595cba4f094e2fba7dcfc185b4d8d3600a8ded 100644 (file)
@@ -10,3 +10,8 @@ smb3-check-for-and-properly-advertise-directory-lease-support.patch
 btrfs-fix-data-corruption-when-deduplicating-between-different-files.patch
 kvm-s390-vsie-copy-wrapping-keys-to-right-place.patch
 kvm-vmx-do-not-allow-reexecute_instruction-when-skipping-mmio-instr.patch
+alsa-hda-fix-cancel_work_sync-stall-from-jackpoll-work.patch
+cpu-hotplug-adjust-misplaced-smb-in-cpuhp_thread_fun.patch
+cpu-hotplug-prevent-state-corruption-on-error-rollback.patch
+x86-microcode-make-sure-boot_cpu_data.microcode-is-up-to-date.patch
+x86-microcode-update-the-new-microcode-revision-unconditionally.patch
diff --git a/queue-4.14/x86-microcode-make-sure-boot_cpu_data.microcode-is-up-to-date.patch b/queue-4.14/x86-microcode-make-sure-boot_cpu_data.microcode-is-up-to-date.patch
new file mode 100644 (file)
index 0000000..9ec40bb
--- /dev/null
@@ -0,0 +1,62 @@
+From 370a132bb2227ff76278f98370e0e701d86ff752 Mon Sep 17 00:00:00 2001
+From: Prarit Bhargava <prarit@redhat.com>
+Date: Tue, 31 Jul 2018 07:27:39 -0400
+Subject: x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
+
+From: Prarit Bhargava <prarit@redhat.com>
+
+commit 370a132bb2227ff76278f98370e0e701d86ff752 upstream.
+
+When preparing an MCE record for logging, boot_cpu_data.microcode is used
+to read out the microcode revision on the box.
+
+However, on systems where late microcode update has happened, the microcode
+revision output in a MCE log record is wrong because
+boot_cpu_data.microcode is not updated when the microcode gets updated.
+
+But, the microcode revision saved in boot_cpu_data's microcode member
+should be kept up-to-date, regardless, for consistency.
+
+Make it so.
+
+Fixes: fa94d0c6e0f3 ("x86/MCE: Save microcode revision in machine check records")
+Signed-off-by: Prarit Bhargava <prarit@redhat.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Tony Luck <tony.luck@intel.com>
+Cc: sironi@amazon.de
+Cc: stable@vger.kernel.org
+Link: http://lkml.kernel.org/r/20180731112739.32338-1-prarit@redhat.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/cpu/microcode/amd.c   |    4 ++++
+ arch/x86/kernel/cpu/microcode/intel.c |    4 ++++
+ 2 files changed, 8 insertions(+)
+
+--- a/arch/x86/kernel/cpu/microcode/amd.c
++++ b/arch/x86/kernel/cpu/microcode/amd.c
+@@ -537,6 +537,10 @@ static enum ucode_state apply_microcode_
+       uci->cpu_sig.rev = mc_amd->hdr.patch_id;
+       c->microcode = mc_amd->hdr.patch_id;
++      /* Update boot_cpu_data's revision too, if we're on the BSP: */
++      if (c->cpu_index == boot_cpu_data.cpu_index)
++              boot_cpu_data.microcode = mc_amd->hdr.patch_id;
++
+       return UCODE_UPDATED;
+ }
+--- a/arch/x86/kernel/cpu/microcode/intel.c
++++ b/arch/x86/kernel/cpu/microcode/intel.c
+@@ -851,6 +851,10 @@ static enum ucode_state apply_microcode_
+       uci->cpu_sig.rev = rev;
+       c->microcode = rev;
++      /* Update boot_cpu_data's revision too, if we're on the BSP: */
++      if (c->cpu_index == boot_cpu_data.cpu_index)
++              boot_cpu_data.microcode = rev;
++
+       return UCODE_UPDATED;
+ }
diff --git a/queue-4.14/x86-microcode-update-the-new-microcode-revision-unconditionally.patch b/queue-4.14/x86-microcode-update-the-new-microcode-revision-unconditionally.patch
new file mode 100644 (file)
index 0000000..b90421e
--- /dev/null
@@ -0,0 +1,121 @@
+From 8da38ebaad23fe1b0c4a205438676f6356607cfc Mon Sep 17 00:00:00 2001
+From: Filippo Sironi <sironi@amazon.de>
+Date: Tue, 31 Jul 2018 17:29:30 +0200
+Subject: x86/microcode: Update the new microcode revision unconditionally
+
+From: Filippo Sironi <sironi@amazon.de>
+
+commit 8da38ebaad23fe1b0c4a205438676f6356607cfc upstream.
+
+Handle the case where microcode gets loaded on the BSP's hyperthread
+sibling first and the boot_cpu_data's microcode revision doesn't get
+updated because of early exit due to the siblings sharing a microcode
+engine.
+
+For that, simply write the updated revision on all CPUs unconditionally.
+
+Signed-off-by: Filippo Sironi <sironi@amazon.de>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: prarit@redhat.com
+Cc: stable@vger.kernel.org
+Link: http://lkml.kernel.org/r/1533050970-14385-1-git-send-email-sironi@amazon.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/cpu/microcode/amd.c   |   22 +++++++++++++---------
+ arch/x86/kernel/cpu/microcode/intel.c |   13 ++++++++-----
+ 2 files changed, 21 insertions(+), 14 deletions(-)
+
+--- a/arch/x86/kernel/cpu/microcode/amd.c
++++ b/arch/x86/kernel/cpu/microcode/amd.c
+@@ -504,6 +504,7 @@ static enum ucode_state apply_microcode_
+       struct microcode_amd *mc_amd;
+       struct ucode_cpu_info *uci;
+       struct ucode_patch *p;
++      enum ucode_state ret;
+       u32 rev, dummy;
+       BUG_ON(raw_smp_processor_id() != cpu);
+@@ -521,9 +522,8 @@ static enum ucode_state apply_microcode_
+       /* need to apply patch? */
+       if (rev >= mc_amd->hdr.patch_id) {
+-              c->microcode = rev;
+-              uci->cpu_sig.rev = rev;
+-              return UCODE_OK;
++              ret = UCODE_OK;
++              goto out;
+       }
+       if (__apply_microcode_amd(mc_amd)) {
+@@ -531,17 +531,21 @@ static enum ucode_state apply_microcode_
+                       cpu, mc_amd->hdr.patch_id);
+               return UCODE_ERROR;
+       }
+-      pr_info("CPU%d: new patch_level=0x%08x\n", cpu,
+-              mc_amd->hdr.patch_id);
+-      uci->cpu_sig.rev = mc_amd->hdr.patch_id;
+-      c->microcode = mc_amd->hdr.patch_id;
++      rev = mc_amd->hdr.patch_id;
++      ret = UCODE_UPDATED;
++
++      pr_info("CPU%d: new patch_level=0x%08x\n", cpu, rev);
++
++out:
++      uci->cpu_sig.rev = rev;
++      c->microcode     = rev;
+       /* Update boot_cpu_data's revision too, if we're on the BSP: */
+       if (c->cpu_index == boot_cpu_data.cpu_index)
+-              boot_cpu_data.microcode = mc_amd->hdr.patch_id;
++              boot_cpu_data.microcode = rev;
+-      return UCODE_UPDATED;
++      return ret;
+ }
+ static int install_equiv_cpu_table(const u8 *buf)
+--- a/arch/x86/kernel/cpu/microcode/intel.c
++++ b/arch/x86/kernel/cpu/microcode/intel.c
+@@ -795,6 +795,7 @@ static enum ucode_state apply_microcode_
+       struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+       struct cpuinfo_x86 *c = &cpu_data(cpu);
+       struct microcode_intel *mc;
++      enum ucode_state ret;
+       static int prev_rev;
+       u32 rev;
+@@ -817,9 +818,8 @@ static enum ucode_state apply_microcode_
+        */
+       rev = intel_get_microcode_revision();
+       if (rev >= mc->hdr.rev) {
+-              uci->cpu_sig.rev = rev;
+-              c->microcode = rev;
+-              return UCODE_OK;
++              ret = UCODE_OK;
++              goto out;
+       }
+       /*
+@@ -848,14 +848,17 @@ static enum ucode_state apply_microcode_
+               prev_rev = rev;
+       }
++      ret = UCODE_UPDATED;
++
++out:
+       uci->cpu_sig.rev = rev;
+-      c->microcode = rev;
++      c->microcode     = rev;
+       /* Update boot_cpu_data's revision too, if we're on the BSP: */
+       if (c->cpu_index == boot_cpu_data.cpu_index)
+               boot_cpu_data.microcode = rev;
+-      return UCODE_UPDATED;
++      return ret;
+ }
+ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,