From: Greg Kroah-Hartman Date: Sun, 16 Sep 2018 12:44:46 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v4.18.9~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3f011da4b8e288fb0062120962712e994e6677d;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches 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 --- 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 index 00000000000..264a92faf15 --- /dev/null +++ b/queue-4.14/alsa-hda-fix-cancel_work_sync-stall-from-jackpoll-work.patch @@ -0,0 +1,46 @@ +From 16037643969e095509cd8446a3f8e406a6dc3a2c Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 30 Aug 2018 15:13:16 +0200 +Subject: ALSA: hda - Fix cancel_work_sync() stall from jackpoll work + +From: Takashi Iwai + +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: +Cc: Lukas Wunner +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..6b467596b28 --- /dev/null +++ b/queue-4.14/cpu-hotplug-adjust-misplaced-smb-in-cpuhp_thread_fun.patch @@ -0,0 +1,55 @@ +From f8b7530aa0a1def79c93101216b5b17cf408a70a Mon Sep 17 00:00:00 2001 +From: Neeraj Upadhyay +Date: Wed, 5 Sep 2018 11:22:07 +0530 +Subject: cpu/hotplug: Adjust misplaced smb() in cpuhp_thread_fun() + +From: Neeraj Upadhyay + +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 +Signed-off-by: Thomas Gleixner +Acked-by: Peter Zijlstra (Intel) +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 + +--- + 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 index 00000000000..801b66dd1b2 --- /dev/null +++ b/queue-4.14/cpu-hotplug-prevent-state-corruption-on-error-rollback.patch @@ -0,0 +1,67 @@ +From 69fa6eb7d6a64801ea261025cce9723d9442d773 Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Thu, 6 Sep 2018 15:21:38 +0200 +Subject: cpu/hotplug: Prevent state corruption on error rollback + +From: Thomas Gleixner + +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 +Signed-off-by: Thomas Gleixner +Tested-by: Geert Uytterhoeven +Tested-by: Sudeep Holla +Tested-by: Neeraj Upadhyay +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 + +---- + +--- + 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); + } diff --git a/queue-4.14/series b/queue-4.14/series index 1d5e15d5535..ca595cba4f0 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -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 index 00000000000..9ec40bb97b2 --- /dev/null +++ b/queue-4.14/x86-microcode-make-sure-boot_cpu_data.microcode-is-up-to-date.patch @@ -0,0 +1,62 @@ +From 370a132bb2227ff76278f98370e0e701d86ff752 Mon Sep 17 00:00:00 2001 +From: Prarit Bhargava +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 + +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 +Signed-off-by: Borislav Petkov +Signed-off-by: Thomas Gleixner +Cc: Tony Luck +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 + +--- + 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 index 00000000000..b90421ed9ef --- /dev/null +++ b/queue-4.14/x86-microcode-update-the-new-microcode-revision-unconditionally.patch @@ -0,0 +1,121 @@ +From 8da38ebaad23fe1b0c4a205438676f6356607cfc Mon Sep 17 00:00:00 2001 +From: Filippo Sironi +Date: Tue, 31 Jul 2018 17:29:30 +0200 +Subject: x86/microcode: Update the new microcode revision unconditionally + +From: Filippo Sironi + +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 +Signed-off-by: Borislav Petkov +Signed-off-by: Thomas Gleixner +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 + +--- + 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,