From: Greg Kroah-Hartman Date: Sun, 15 Jul 2018 10:13:24 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v4.4.141~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=05a48d21f70750fe34b925455cd203dac701bb24;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: alsa-hda-handle-pm-failure-during-hotplug.patch alsa-hda-realtek-two-more-lenovo-models-need-fixup-of-mic_location.patch arm64-neon-fix-function-may_use_simd-return-error-status.patch fs-elf-make-sure-to-page-align-bss-in-load_elf_library.patch fs-proc-task_mmu.c-fix-locked-field-in-proc-pid-smaps.patch i2c-tegra-fix-nack-error-handling.patch ib-hfi1-fix-incorrect-mixing-of-err_ptr-and-null-return-values.patch iw_cxgb4-correctly-enforce-the-max-reg_mr-depth.patch kbuild-delete-install_fw_path-from-kbuild-documentation.patch mm-do-not-bug_on-on-incorrect-length-in-__mm_populate.patch mm-do-not-drop-unused-pages-when-userfaultd-is-running.patch tools-build-fix-escaping-in-.cmd-files-for-future-make.patch tracing-reorder-display-of-tgid-to-be-after-pid.patch xen-setup-pv-irq-ops-vector-earlier.patch --- diff --git a/queue-4.14/alsa-hda-handle-pm-failure-during-hotplug.patch b/queue-4.14/alsa-hda-handle-pm-failure-during-hotplug.patch new file mode 100644 index 00000000000..3722622b875 --- /dev/null +++ b/queue-4.14/alsa-hda-handle-pm-failure-during-hotplug.patch @@ -0,0 +1,103 @@ +From aaa23f86001bdb82d2f937c5c7bce0a1e11a6c5b Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Wed, 27 Jun 2018 07:25:32 +0100 +Subject: ALSA: hda - Handle pm failure during hotplug + +From: Chris Wilson + +commit aaa23f86001bdb82d2f937c5c7bce0a1e11a6c5b upstream. + +Obtaining the runtime pm wakeref can fail, especially in a hotplug +scenario where i915.ko has been unloaded. If we do not catch the +failure, we end up with an unbalanced pm. + +v2 additions by tiwai: +hdmi_present_sense() checks the return value and handle only a +negative error case and bails out only if it's really still suspended. +Also, snd_hda_power_down() is called at the error path so that the +refcount is balanced. + +Along with it, the spec->pcm_lock is taken outside +hdmi_present_sense() in the caller side, so that it won't cause +deadlock at reentrace via runtime resume. + +v3 fix by tiwai: +Missing linux/pm_runtime.h is included. + +References: 222bde03881c ("ALSA: hda - Fix mutex deadlock at HDMI/DP hotplug") +Signed-off-by: Chris Wilson +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_hdmi.c | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -764,8 +765,10 @@ static void check_presence_and_report(st + + if (pin_idx < 0) + return; ++ mutex_lock(&spec->pcm_lock); + if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) + snd_hda_jack_report_sync(codec); ++ mutex_unlock(&spec->pcm_lock); + } + + static void jack_callback(struct hda_codec *codec, +@@ -1628,21 +1631,23 @@ static void sync_eld_via_acomp(struct hd + static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) + { + struct hda_codec *codec = per_pin->codec; +- struct hdmi_spec *spec = codec->spec; + int ret; + + /* no temporary power up/down needed for component notifier */ +- if (!codec_has_acomp(codec)) +- snd_hda_power_up_pm(codec); ++ if (!codec_has_acomp(codec)) { ++ ret = snd_hda_power_up_pm(codec); ++ if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec))) { ++ snd_hda_power_down_pm(codec); ++ return false; ++ } ++ } + +- mutex_lock(&spec->pcm_lock); + if (codec_has_acomp(codec)) { + sync_eld_via_acomp(codec, per_pin); + ret = false; /* don't call snd_hda_jack_report_sync() */ + } else { + ret = hdmi_present_sense_via_verbs(per_pin, repoll); + } +- mutex_unlock(&spec->pcm_lock); + + if (!codec_has_acomp(codec)) + snd_hda_power_down_pm(codec); +@@ -1654,12 +1659,16 @@ static void hdmi_repoll_eld(struct work_ + { + struct hdmi_spec_per_pin *per_pin = + container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); ++ struct hda_codec *codec = per_pin->codec; ++ struct hdmi_spec *spec = codec->spec; + + if (per_pin->repoll_count++ > 6) + per_pin->repoll_count = 0; + ++ mutex_lock(&spec->pcm_lock); + if (hdmi_present_sense(per_pin, per_pin->repoll_count)) + snd_hda_jack_report_sync(per_pin->codec); ++ mutex_unlock(&spec->pcm_lock); + } + + static void intel_haswell_fixup_connect_list(struct hda_codec *codec, diff --git a/queue-4.14/alsa-hda-realtek-two-more-lenovo-models-need-fixup-of-mic_location.patch b/queue-4.14/alsa-hda-realtek-two-more-lenovo-models-need-fixup-of-mic_location.patch new file mode 100644 index 00000000000..7942b44c1fa --- /dev/null +++ b/queue-4.14/alsa-hda-realtek-two-more-lenovo-models-need-fixup-of-mic_location.patch @@ -0,0 +1,45 @@ +From c6b17f1020d956f4113d478cae6171b9093817ba Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Fri, 6 Jul 2018 15:14:11 +0800 +Subject: ALSA: hda/realtek - two more lenovo models need fixup of MIC_LOCATION + +From: Hui Wang + +commit c6b17f1020d956f4113d478cae6171b9093817ba upstream. + +We have two new lenovo desktop models which need to apply the fixup of +ALC294_FIXUP_LENOVO_MIC_LOCATION, and they have the same pin cfg as +the machine with subsystem id:0x17aa3136, now use the pincfg table +to apply the fixup for them. + +Cc: +Signed-off-by: Hui Wang +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6445,7 +6445,6 @@ static const struct snd_pci_quirk alc269 + SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), + SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), + SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), +- SND_PCI_QUIRK(0x17aa, 0x3136, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), + SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), + SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), + SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), +@@ -6628,6 +6627,11 @@ static const struct snd_hda_pin_quirk al + {0x1a, 0x02a11040}, + {0x1b, 0x01014020}, + {0x21, 0x0221101f}), ++ SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION, ++ {0x14, 0x90170110}, ++ {0x19, 0x02a11020}, ++ {0x1a, 0x02a11030}, ++ {0x21, 0x0221101f}), + SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, + {0x12, 0x90a60140}, + {0x14, 0x90170150}, diff --git a/queue-4.14/arm64-neon-fix-function-may_use_simd-return-error-status.patch b/queue-4.14/arm64-neon-fix-function-may_use_simd-return-error-status.patch new file mode 100644 index 00000000000..6c30d10a765 --- /dev/null +++ b/queue-4.14/arm64-neon-fix-function-may_use_simd-return-error-status.patch @@ -0,0 +1,65 @@ +From 2fd8eb4ad87104c54800ef3cea498c92eb15c78a Mon Sep 17 00:00:00 2001 +From: Yandong Zhao +Date: Wed, 11 Jul 2018 19:06:28 +0800 +Subject: arm64: neon: Fix function may_use_simd() return error status + +From: Yandong Zhao + +commit 2fd8eb4ad87104c54800ef3cea498c92eb15c78a upstream. + +It does not matter if the caller of may_use_simd() migrates to +another cpu after the call, but it is still important that the +kernel_neon_busy percpu instance that is read matches the cpu the +task is running on at the time of the read. + +This means that raw_cpu_read() is not sufficient. kernel_neon_busy +may appear true if the caller migrates during the execution of +raw_cpu_read() and the next task to be scheduled in on the initial +cpu calls kernel_neon_begin(). + +This patch replaces raw_cpu_read() with this_cpu_read() to protect +against this race. + +Cc: +Fixes: cb84d11e1625 ("arm64: neon: Remove support for nested or hardirq kernel-mode NEON") +Acked-by: Ard Biesheuvel +Reviewed-by: Dave Martin +Reviewed-by: Mark Rutland +Signed-off-by: Yandong Zhao +Signed-off-by: Will Deacon +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/include/asm/simd.h | 19 +++++++------------ + 1 file changed, 7 insertions(+), 12 deletions(-) + +--- a/arch/arm64/include/asm/simd.h ++++ b/arch/arm64/include/asm/simd.h +@@ -29,20 +29,15 @@ DECLARE_PER_CPU(bool, kernel_neon_busy); + static __must_check inline bool may_use_simd(void) + { + /* +- * The raw_cpu_read() is racy if called with preemption enabled. +- * This is not a bug: kernel_neon_busy is only set when +- * preemption is disabled, so we cannot migrate to another CPU +- * while it is set, nor can we migrate to a CPU where it is set. +- * So, if we find it clear on some CPU then we're guaranteed to +- * find it clear on any CPU we could migrate to. +- * +- * If we are in between kernel_neon_begin()...kernel_neon_end(), +- * the flag will be set, but preemption is also disabled, so we +- * can't migrate to another CPU and spuriously see it become +- * false. ++ * kernel_neon_busy is only set while preemption is disabled, ++ * and is clear whenever preemption is enabled. Since ++ * this_cpu_read() is atomic w.r.t. preemption, kernel_neon_busy ++ * cannot change under our feet -- if it's set we cannot be ++ * migrated, and if it's clear we cannot be migrated to a CPU ++ * where it is set. + */ + return !in_irq() && !irqs_disabled() && !in_nmi() && +- !raw_cpu_read(kernel_neon_busy); ++ !this_cpu_read(kernel_neon_busy); + } + + #else /* ! CONFIG_KERNEL_MODE_NEON */ diff --git a/queue-4.14/fs-elf-make-sure-to-page-align-bss-in-load_elf_library.patch b/queue-4.14/fs-elf-make-sure-to-page-align-bss-in-load_elf_library.patch new file mode 100644 index 00000000000..47e175f5b6c --- /dev/null +++ b/queue-4.14/fs-elf-make-sure-to-page-align-bss-in-load_elf_library.patch @@ -0,0 +1,48 @@ +From 24962af7e1041b7e50c1bc71d8d10dc678c556b5 Mon Sep 17 00:00:00 2001 +From: Oscar Salvador +Date: Fri, 13 Jul 2018 16:59:13 -0700 +Subject: fs, elf: make sure to page align bss in load_elf_library + +From: Oscar Salvador + +commit 24962af7e1041b7e50c1bc71d8d10dc678c556b5 upstream. + +The current code does not make sure to page align bss before calling +vm_brk(), and this can lead to a VM_BUG_ON() in __mm_populate() due to +the requested lenght not being correctly aligned. + +Let us make sure to align it properly. + +Kees: only applicable to CONFIG_USELIB kernels: 32-bit and configured +for libc5. + +Link: http://lkml.kernel.org/r/20180705145539.9627-1-osalvador@techadventures.net +Signed-off-by: Oscar Salvador +Reported-by: syzbot+5dcb560fe12aa5091c06@syzkaller.appspotmail.com +Tested-by: Tetsuo Handa +Acked-by: Kees Cook +Cc: Michal Hocko +Cc: Nicolas Pitre +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/binfmt_elf.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/fs/binfmt_elf.c ++++ b/fs/binfmt_elf.c +@@ -1235,9 +1235,8 @@ static int load_elf_library(struct file + goto out_free_ph; + } + +- len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + +- ELF_MIN_ALIGN - 1); +- bss = eppnt->p_memsz + eppnt->p_vaddr; ++ len = ELF_PAGEALIGN(eppnt->p_filesz + eppnt->p_vaddr); ++ bss = ELF_PAGEALIGN(eppnt->p_memsz + eppnt->p_vaddr); + if (bss > len) { + error = vm_brk(len, bss - len); + if (error) diff --git a/queue-4.14/fs-proc-task_mmu.c-fix-locked-field-in-proc-pid-smaps.patch b/queue-4.14/fs-proc-task_mmu.c-fix-locked-field-in-proc-pid-smaps.patch new file mode 100644 index 00000000000..3fb071ee035 --- /dev/null +++ b/queue-4.14/fs-proc-task_mmu.c-fix-locked-field-in-proc-pid-smaps.patch @@ -0,0 +1,57 @@ +From e70cc2bd579e8a9d6d153762f0fe294d0e652ff0 Mon Sep 17 00:00:00 2001 +From: Vlastimil Babka +Date: Fri, 13 Jul 2018 16:58:56 -0700 +Subject: fs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps* + +From: Vlastimil Babka + +commit e70cc2bd579e8a9d6d153762f0fe294d0e652ff0 upstream. + +Thomas reports: + "While looking around in /proc on my v4.14.52 system I noticed that all + processes got a lot of "Locked" memory in /proc/*/smaps. A lot more + memory than a regular user can usually lock with mlock(). + + Commit 493b0e9d945f (in v4.14-rc1) seems to have changed the behavior + of "Locked". + + Before that commit the code was like this. Notice the VM_LOCKED check. + + (vma->vm_flags & VM_LOCKED) ? + (unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0); + + After that commit Locked is now the same as Pss: + + (unsigned long)(mss->pss >> (10 + PSS_SHIFT))); + + This looks like a mistake." + +Indeed, the commit has added mss->pss_locked with the correct value that +depends on VM_LOCKED, but forgot to actually use it. Fix it. + +Link: http://lkml.kernel.org/r/ebf6c7fb-fec3-6a26-544f-710ed193c154@suse.cz +Fixes: 493b0e9d945f ("mm: add /proc/pid/smaps_rollup") +Signed-off-by: Vlastimil Babka +Reported-by: Thomas Lindroth +Cc: Alexey Dobriyan +Cc: Daniel Colascione +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/proc/task_mmu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/proc/task_mmu.c ++++ b/fs/proc/task_mmu.c +@@ -850,7 +850,7 @@ static int show_smap(struct seq_file *m, + mss->private_hugetlb >> 10, + mss->swap >> 10, + (unsigned long)(mss->swap_pss >> (10 + PSS_SHIFT)), +- (unsigned long)(mss->pss >> (10 + PSS_SHIFT))); ++ (unsigned long)(mss->pss_locked >> (10 + PSS_SHIFT))); + + if (!rollup_mode) { + arch_show_smap(m, vma); diff --git a/queue-4.14/i2c-tegra-fix-nack-error-handling.patch b/queue-4.14/i2c-tegra-fix-nack-error-handling.patch new file mode 100644 index 00000000000..75c598e0a04 --- /dev/null +++ b/queue-4.14/i2c-tegra-fix-nack-error-handling.patch @@ -0,0 +1,72 @@ +From 54836e2d03e76d80aec3399368ffaf5b7caadd1b Mon Sep 17 00:00:00 2001 +From: Jon Hunter +Date: Tue, 3 Jul 2018 09:55:43 +0100 +Subject: i2c: tegra: Fix NACK error handling + +From: Jon Hunter + +commit 54836e2d03e76d80aec3399368ffaf5b7caadd1b upstream. + +On Tegra30 Cardhu the PCA9546 I2C mux is not ACK'ing I2C commands on +resume from suspend (which is caused by the reset signal for the I2C +mux not being configured correctl). However, this NACK is causing the +Tegra30 to hang on resuming from suspend which is not expected as we +detect NACKs and handle them. The hang observed appears to occur when +resetting the I2C controller to recover from the NACK. + +Commit 77821b4678f9 ("i2c: tegra: proper handling of error cases") added +additional error handling for some error cases including NACK, however, +it appears that this change conflicts with an early fix by commit +f70893d08338 ("i2c: tegra: Add delay before resetting the controller +after NACK"). After commit 77821b4678f9 was made we now disable 'packet +mode' before the delay from commit f70893d08338 happens. Testing shows +that moving the delay to before disabling 'packet mode' fixes the hang +observed on Tegra30. The delay was added to give the I2C controller +chance to send a stop condition and so it makes sense to move this to +before we disable packet mode. Please note that packet mode is always +enabled for Tegra. + +Fixes: 77821b4678f9 ("i2c: tegra: proper handling of error cases") +Signed-off-by: Jon Hunter +Acked-by: Thierry Reding +Signed-off-by: Wolfram Sang +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/i2c/busses/i2c-tegra.c | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +--- a/drivers/i2c/busses/i2c-tegra.c ++++ b/drivers/i2c/busses/i2c-tegra.c +@@ -547,6 +547,14 @@ static int tegra_i2c_disable_packet_mode + { + u32 cnfg; + ++ /* ++ * NACK interrupt is generated before the I2C controller generates ++ * the STOP condition on the bus. So wait for 2 clock periods ++ * before disabling the controller so that the STOP condition has ++ * been delivered properly. ++ */ ++ udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); ++ + cnfg = i2c_readl(i2c_dev, I2C_CNFG); + if (cnfg & I2C_CNFG_PACKET_MODE_EN) + i2c_writel(i2c_dev, cnfg & ~I2C_CNFG_PACKET_MODE_EN, I2C_CNFG); +@@ -708,15 +716,6 @@ static int tegra_i2c_xfer_msg(struct teg + if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) + return 0; + +- /* +- * NACK interrupt is generated before the I2C controller generates +- * the STOP condition on the bus. So wait for 2 clock periods +- * before resetting the controller so that the STOP condition has +- * been delivered properly. +- */ +- if (i2c_dev->msg_err == I2C_ERR_NO_ACK) +- udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); +- + tegra_i2c_init(i2c_dev); + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { + if (msg->flags & I2C_M_IGNORE_NAK) diff --git a/queue-4.14/ib-hfi1-fix-incorrect-mixing-of-err_ptr-and-null-return-values.patch b/queue-4.14/ib-hfi1-fix-incorrect-mixing-of-err_ptr-and-null-return-values.patch new file mode 100644 index 00000000000..e0afea44a87 --- /dev/null +++ b/queue-4.14/ib-hfi1-fix-incorrect-mixing-of-err_ptr-and-null-return-values.patch @@ -0,0 +1,120 @@ +From b697d7d8c741f27b728a878fc55852b06d0f6f5e Mon Sep 17 00:00:00 2001 +From: "Michael J. Ruhl" +Date: Wed, 20 Jun 2018 09:29:08 -0700 +Subject: IB/hfi1: Fix incorrect mixing of ERR_PTR and NULL return values + +From: Michael J. Ruhl + +commit b697d7d8c741f27b728a878fc55852b06d0f6f5e upstream. + +The __get_txreq() function can return a pointer, ERR_PTR(-EBUSY), or NULL. +All of the relevant call sites look for IS_ERR, so the NULL return would +lead to a NULL pointer exception. + +Do not use the ERR_PTR mechanism for this function. + +Update all call sites to handle the return value correctly. + +Clean up error paths to reflect return value. + +Fixes: 45842abbb292 ("staging/rdma/hfi1: move txreq header code") +Cc: # 4.9.x+ +Reported-by: Dan Carpenter +Reviewed-by: Mike Marciniszyn +Reviewed-by: Kamenee Arumugam +Signed-off-by: Michael J. Ruhl +Signed-off-by: Dennis Dalessandro +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/hfi1/rc.c | 2 +- + drivers/infiniband/hw/hfi1/uc.c | 4 ++-- + drivers/infiniband/hw/hfi1/ud.c | 4 ++-- + drivers/infiniband/hw/hfi1/verbs_txreq.c | 4 ++-- + drivers/infiniband/hw/hfi1/verbs_txreq.h | 4 ++-- + 5 files changed, 9 insertions(+), 9 deletions(-) + +--- a/drivers/infiniband/hw/hfi1/rc.c ++++ b/drivers/infiniband/hw/hfi1/rc.c +@@ -273,7 +273,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, + + lockdep_assert_held(&qp->s_lock); + ps->s_txreq = get_txreq(ps->dev, qp); +- if (IS_ERR(ps->s_txreq)) ++ if (!ps->s_txreq) + goto bail_no_tx; + + ps->s_txreq->phdr.hdr.hdr_type = priv->hdr_type; +--- a/drivers/infiniband/hw/hfi1/uc.c ++++ b/drivers/infiniband/hw/hfi1/uc.c +@@ -1,5 +1,5 @@ + /* +- * Copyright(c) 2015, 2016 Intel Corporation. ++ * Copyright(c) 2015 - 2018 Intel Corporation. + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. +@@ -72,7 +72,7 @@ int hfi1_make_uc_req(struct rvt_qp *qp, + int middle = 0; + + ps->s_txreq = get_txreq(ps->dev, qp); +- if (IS_ERR(ps->s_txreq)) ++ if (!ps->s_txreq) + goto bail_no_tx; + + if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_SEND_OK)) { +--- a/drivers/infiniband/hw/hfi1/ud.c ++++ b/drivers/infiniband/hw/hfi1/ud.c +@@ -1,5 +1,5 @@ + /* +- * Copyright(c) 2015, 2016 Intel Corporation. ++ * Copyright(c) 2015 - 2018 Intel Corporation. + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. +@@ -479,7 +479,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp, + u32 lid; + + ps->s_txreq = get_txreq(ps->dev, qp); +- if (IS_ERR(ps->s_txreq)) ++ if (!ps->s_txreq) + goto bail_no_tx; + + if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_NEXT_SEND_OK)) { +--- a/drivers/infiniband/hw/hfi1/verbs_txreq.c ++++ b/drivers/infiniband/hw/hfi1/verbs_txreq.c +@@ -1,5 +1,5 @@ + /* +- * Copyright(c) 2016 - 2017 Intel Corporation. ++ * Copyright(c) 2016 - 2018 Intel Corporation. + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. +@@ -94,7 +94,7 @@ struct verbs_txreq *__get_txreq(struct h + struct rvt_qp *qp) + __must_hold(&qp->s_lock) + { +- struct verbs_txreq *tx = ERR_PTR(-EBUSY); ++ struct verbs_txreq *tx = NULL; + + write_seqlock(&dev->txwait_lock); + if (ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK) { +--- a/drivers/infiniband/hw/hfi1/verbs_txreq.h ++++ b/drivers/infiniband/hw/hfi1/verbs_txreq.h +@@ -1,5 +1,5 @@ + /* +- * Copyright(c) 2016 Intel Corporation. ++ * Copyright(c) 2016 - 2018 Intel Corporation. + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. +@@ -83,7 +83,7 @@ static inline struct verbs_txreq *get_tx + if (unlikely(!tx)) { + /* call slow path to get the lock */ + tx = __get_txreq(dev, qp); +- if (IS_ERR(tx)) ++ if (!tx) + return tx; + } + tx->qp = qp; diff --git a/queue-4.14/iw_cxgb4-correctly-enforce-the-max-reg_mr-depth.patch b/queue-4.14/iw_cxgb4-correctly-enforce-the-max-reg_mr-depth.patch new file mode 100644 index 00000000000..1b8bca9b2db --- /dev/null +++ b/queue-4.14/iw_cxgb4-correctly-enforce-the-max-reg_mr-depth.patch @@ -0,0 +1,35 @@ +From 7b72717a20bba8bdd01b14c0460be7d15061cd6b Mon Sep 17 00:00:00 2001 +From: Steve Wise +Date: Thu, 21 Jun 2018 07:43:21 -0700 +Subject: iw_cxgb4: correctly enforce the max reg_mr depth + +From: Steve Wise + +commit 7b72717a20bba8bdd01b14c0460be7d15061cd6b upstream. + +The code was mistakenly using the length of the page array memory instead +of the depth of the page array. + +This would cause MR creation to fail in some cases. + +Fixes: 8376b86de7d3 ("iw_cxgb4: Support the new memory registration API") +Cc: stable@vger.kernel.org +Signed-off-by: Steve Wise +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/cxgb4/mem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/hw/cxgb4/mem.c ++++ b/drivers/infiniband/hw/cxgb4/mem.c +@@ -720,7 +720,7 @@ static int c4iw_set_page(struct ib_mr *i + { + struct c4iw_mr *mhp = to_c4iw_mr(ibmr); + +- if (unlikely(mhp->mpl_len == mhp->max_mpl_len)) ++ if (unlikely(mhp->mpl_len == mhp->attr.pbl_size)) + return -ENOMEM; + + mhp->mpl[mhp->mpl_len++] = addr; diff --git a/queue-4.14/kbuild-delete-install_fw_path-from-kbuild-documentation.patch b/queue-4.14/kbuild-delete-install_fw_path-from-kbuild-documentation.patch new file mode 100644 index 00000000000..ecdaf0a071b --- /dev/null +++ b/queue-4.14/kbuild-delete-install_fw_path-from-kbuild-documentation.patch @@ -0,0 +1,44 @@ +From 3f9cdee5929b7d035e86302dcf08fbf3e80b0739 Mon Sep 17 00:00:00 2001 +From: Randy Dunlap +Date: Wed, 4 Jul 2018 12:59:16 -0700 +Subject: kbuild: delete INSTALL_FW_PATH from kbuild documentation + +From: Randy Dunlap + +commit 3f9cdee5929b7d035e86302dcf08fbf3e80b0739 upstream. + +Removed Kbuild documentation for INSTALL_FW_PATH. + +The kbuild symbol INSTALL_FW_PATH was removed from Kbuild tools in +September 2017 (for 4.14) but the symbol was not deleted from +the kbuild documentation, so do that now. + +Fixes: 5620a0d1aacd ("firmware: delete in-kernel firmware") +Signed-off-by: Randy Dunlap +Cc: stable@vger.kernel.org # 4.14+ +Cc: Greg Kroah-Hartman +Signed-off-by: Masahiro Yamada +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/kbuild/kbuild.txt | 9 --------- + 1 file changed, 9 deletions(-) + +--- a/Documentation/kbuild/kbuild.txt ++++ b/Documentation/kbuild/kbuild.txt +@@ -152,15 +152,6 @@ stripped after they are installed. If I + the default option --strip-debug will be used. Otherwise, + INSTALL_MOD_STRIP value will be used as the options to the strip command. + +-INSTALL_FW_PATH +--------------------------------------------------- +-INSTALL_FW_PATH specifies where to install the firmware blobs. +-The default value is: +- +- $(INSTALL_MOD_PATH)/lib/firmware +- +-The value can be overridden in which case the default value is ignored. +- + INSTALL_HDR_PATH + -------------------------------------------------- + INSTALL_HDR_PATH specifies where to install user space headers when diff --git a/queue-4.14/mm-do-not-bug_on-on-incorrect-length-in-__mm_populate.patch b/queue-4.14/mm-do-not-bug_on-on-incorrect-length-in-__mm_populate.patch new file mode 100644 index 00000000000..cebd0aca73f --- /dev/null +++ b/queue-4.14/mm-do-not-bug_on-on-incorrect-length-in-__mm_populate.patch @@ -0,0 +1,148 @@ +From bb177a732c4369bb58a1fe1df8f552b6f0f7db5f Mon Sep 17 00:00:00 2001 +From: Michal Hocko +Date: Fri, 13 Jul 2018 16:59:20 -0700 +Subject: mm: do not bug_on on incorrect length in __mm_populate() + +From: Michal Hocko + +commit bb177a732c4369bb58a1fe1df8f552b6f0f7db5f upstream. + +syzbot has noticed that a specially crafted library can easily hit +VM_BUG_ON in __mm_populate + + kernel BUG at mm/gup.c:1242! + invalid opcode: 0000 [#1] SMP + CPU: 2 PID: 9667 Comm: a.out Not tainted 4.18.0-rc3 #644 + Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/19/2017 + RIP: 0010:__mm_populate+0x1e2/0x1f0 + Code: 55 d0 65 48 33 14 25 28 00 00 00 89 d8 75 21 48 83 c4 20 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 75 18 f1 ff 0f 0b e8 6e 18 f1 ff <0f> 0b 31 db eb c9 e8 93 06 e0 ff 0f 1f 00 55 48 89 e5 53 48 89 fb + Call Trace: + vm_brk_flags+0xc3/0x100 + vm_brk+0x1f/0x30 + load_elf_library+0x281/0x2e0 + __ia32_sys_uselib+0x170/0x1e0 + do_fast_syscall_32+0xca/0x420 + entry_SYSENTER_compat+0x70/0x7f + +The reason is that the length of the new brk is not page aligned when we +try to populate the it. There is no reason to bug on that though. +do_brk_flags already aligns the length properly so the mapping is +expanded as it should. All we need is to tell mm_populate about it. +Besides that there is absolutely no reason to to bug_on in the first +place. The worst thing that could happen is that the last page wouldn't +get populated and that is far from putting system into an inconsistent +state. + +Fix the issue by moving the length sanitization code from do_brk_flags +up to vm_brk_flags. The only other caller of do_brk_flags is brk +syscall entry and it makes sure to provide the proper length so t here +is no need for sanitation and so we can use do_brk_flags without it. + +Also remove the bogus BUG_ONs. + +[osalvador@techadventures.net: fix up vm_brk_flags s@request@len@] +Link: http://lkml.kernel.org/r/20180706090217.GI32658@dhcp22.suse.cz +Signed-off-by: Michal Hocko +Reported-by: syzbot +Tested-by: Tetsuo Handa +Reviewed-by: Oscar Salvador +Cc: Zi Yan +Cc: "Aneesh Kumar K.V" +Cc: Dan Williams +Cc: "Kirill A. Shutemov" +Cc: Michael S. Tsirkin +Cc: Al Viro +Cc: "Huang, Ying" +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/gup.c | 2 -- + mm/mmap.c | 29 ++++++++++++----------------- + 2 files changed, 12 insertions(+), 19 deletions(-) + +--- a/mm/gup.c ++++ b/mm/gup.c +@@ -1235,8 +1235,6 @@ int __mm_populate(unsigned long start, u + int locked = 0; + long ret = 0; + +- VM_BUG_ON(start & ~PAGE_MASK); +- VM_BUG_ON(len != PAGE_ALIGN(len)); + end = start + len; + + for (nstart = start; nstart < end; nstart = nend) { +--- a/mm/mmap.c ++++ b/mm/mmap.c +@@ -177,8 +177,8 @@ static struct vm_area_struct *remove_vma + return next; + } + +-static int do_brk(unsigned long addr, unsigned long len, struct list_head *uf); +- ++static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long flags, ++ struct list_head *uf); + SYSCALL_DEFINE1(brk, unsigned long, brk) + { + unsigned long retval; +@@ -236,7 +236,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) + goto out; + + /* Ok, looks good - let it rip. */ +- if (do_brk(oldbrk, newbrk-oldbrk, &uf) < 0) ++ if (do_brk_flags(oldbrk, newbrk-oldbrk, 0, &uf) < 0) + goto out; + + set_brk: +@@ -2887,21 +2887,14 @@ static inline void verify_mm_writelocked + * anonymous maps. eventually we may be able to do some + * brk-specific accounting here. + */ +-static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long flags, struct list_head *uf) ++static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long flags, struct list_head *uf) + { + struct mm_struct *mm = current->mm; + struct vm_area_struct *vma, *prev; +- unsigned long len; + struct rb_node **rb_link, *rb_parent; + pgoff_t pgoff = addr >> PAGE_SHIFT; + int error; + +- len = PAGE_ALIGN(request); +- if (len < request) +- return -ENOMEM; +- if (!len) +- return 0; +- + /* Until we need other flags, refuse anything except VM_EXEC. */ + if ((flags & (~VM_EXEC)) != 0) + return -EINVAL; +@@ -2973,18 +2966,20 @@ out: + return 0; + } + +-static int do_brk(unsigned long addr, unsigned long len, struct list_head *uf) +-{ +- return do_brk_flags(addr, len, 0, uf); +-} +- +-int vm_brk_flags(unsigned long addr, unsigned long len, unsigned long flags) ++int vm_brk_flags(unsigned long addr, unsigned long request, unsigned long flags) + { + struct mm_struct *mm = current->mm; ++ unsigned long len; + int ret; + bool populate; + LIST_HEAD(uf); + ++ len = PAGE_ALIGN(request); ++ if (len < request) ++ return -ENOMEM; ++ if (!len) ++ return 0; ++ + if (down_write_killable(&mm->mmap_sem)) + return -EINTR; + diff --git a/queue-4.14/mm-do-not-drop-unused-pages-when-userfaultd-is-running.patch b/queue-4.14/mm-do-not-drop-unused-pages-when-userfaultd-is-running.patch new file mode 100644 index 00000000000..2b17a37b2e9 --- /dev/null +++ b/queue-4.14/mm-do-not-drop-unused-pages-when-userfaultd-is-running.patch @@ -0,0 +1,68 @@ +From bce73e4842390f7b7309c8e253e139db71288ac3 Mon Sep 17 00:00:00 2001 +From: Christian Borntraeger +Date: Fri, 13 Jul 2018 16:58:52 -0700 +Subject: mm: do not drop unused pages when userfaultd is running + +From: Christian Borntraeger + +commit bce73e4842390f7b7309c8e253e139db71288ac3 upstream. + +KVM guests on s390 can notify the host of unused pages. This can result +in pte_unused callbacks to be true for KVM guest memory. + +If a page is unused (checked with pte_unused) we might drop this page +instead of paging it. This can have side-effects on userfaultd, when +the page in question was already migrated: + +The next access of that page will trigger a fault and a user fault +instead of faulting in a new and empty zero page. As QEMU does not +expect a userfault on an already migrated page this migration will fail. + +The most straightforward solution is to ignore the pte_unused hint if a +userfault context is active for this VMA. + +Link: http://lkml.kernel.org/r/20180703171854.63981-1-borntraeger@de.ibm.com +Signed-off-by: Christian Borntraeger +Cc: Martin Schwidefsky +Cc: Andrea Arcangeli +Cc: Mike Rapoport +Cc: Janosch Frank +Cc: David Hildenbrand +Cc: Cornelia Huck +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/rmap.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/mm/rmap.c ++++ b/mm/rmap.c +@@ -64,6 +64,7 @@ + #include + #include + #include ++#include + + #include + +@@ -1476,11 +1477,16 @@ static bool try_to_unmap_one(struct page + set_pte_at(mm, address, pvmw.pte, pteval); + } + +- } else if (pte_unused(pteval)) { ++ } else if (pte_unused(pteval) && !userfaultfd_armed(vma)) { + /* + * The guest indicated that the page content is of no + * interest anymore. Simply discard the pte, vmscan + * will take care of the rest. ++ * A future reference will then fault in a new zero ++ * page. When userfaultfd is active, we must not drop ++ * this page though, as its main user (postcopy ++ * migration) will not expect userfaults on already ++ * copied pages. + */ + dec_mm_counter(mm, mm_counter(page)); + } else if (IS_ENABLED(CONFIG_MIGRATION) && diff --git a/queue-4.14/series b/queue-4.14/series index a0523cb35fe..64c40374f81 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -28,3 +28,17 @@ scsi-megaraid_sas-replace-instance-ctrl_context-checks-with-instance-adapter_typ scsi-megaraid_sas-replace-is_ventura-with-adapter_type-checks.patch scsi-megaraid_sas-create-separate-functions-to-allocate-ctrl-memory.patch scsi-megaraid_sas-fix-selection-of-reply-queue.patch +alsa-hda-realtek-two-more-lenovo-models-need-fixup-of-mic_location.patch +alsa-hda-handle-pm-failure-during-hotplug.patch +mm-do-not-drop-unused-pages-when-userfaultd-is-running.patch +fs-proc-task_mmu.c-fix-locked-field-in-proc-pid-smaps.patch +fs-elf-make-sure-to-page-align-bss-in-load_elf_library.patch +mm-do-not-bug_on-on-incorrect-length-in-__mm_populate.patch +tracing-reorder-display-of-tgid-to-be-after-pid.patch +kbuild-delete-install_fw_path-from-kbuild-documentation.patch +arm64-neon-fix-function-may_use_simd-return-error-status.patch +tools-build-fix-escaping-in-.cmd-files-for-future-make.patch +ib-hfi1-fix-incorrect-mixing-of-err_ptr-and-null-return-values.patch +i2c-tegra-fix-nack-error-handling.patch +iw_cxgb4-correctly-enforce-the-max-reg_mr-depth.patch +xen-setup-pv-irq-ops-vector-earlier.patch diff --git a/queue-4.14/tools-build-fix-escaping-in-.cmd-files-for-future-make.patch b/queue-4.14/tools-build-fix-escaping-in-.cmd-files-for-future-make.patch new file mode 100644 index 00000000000..be1374401c8 --- /dev/null +++ b/queue-4.14/tools-build-fix-escaping-in-.cmd-files-for-future-make.patch @@ -0,0 +1,60 @@ +From 9feeb638cde083c737e295c0547f1b4f28e99583 Mon Sep 17 00:00:00 2001 +From: Paul Menzel +Date: Tue, 5 Jun 2018 19:00:22 +0200 +Subject: tools build: fix # escaping in .cmd files for future Make + +From: Paul Menzel + +commit 9feeb638cde083c737e295c0547f1b4f28e99583 upstream. + +In 2016 GNU Make made a backwards incompatible change to the way '#' +characters were handled in Makefiles when used inside functions or +macros: + +http://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b57 + +Due to this change, when attempting to run `make prepare' I get a +spurious make syntax error: + + /home/earnest/linux/tools/objtool/.fixdep.o.cmd:1: *** missing separator. Stop. + +When inspecting `.fixdep.o.cmd' it includes two lines which use +unescaped comment characters at the top: + + \# cannot find fixdep (/home/earnest/linux/tools/objtool//fixdep) + \# using basic dep data + +This is because `tools/build/Build.include' prints these '\#' +characters: + + printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \ + printf '\# using basic dep data\n\n' >> $(dot-target).cmd; \ + +This completes commit 9564a8cf422d ("Kbuild: fix # escaping in .cmd files +for future Make"). + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=197847 +Cc: Randy Dunlap +Cc: Rasmus Villemoes +Cc: stable@vger.kernel.org +Signed-off-by: Paul Menzel +Signed-off-by: Masahiro Yamada +Signed-off-by: Greg Kroah-Hartman + +--- + tools/build/Build.include | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/tools/build/Build.include ++++ b/tools/build/Build.include +@@ -63,8 +63,8 @@ dep-cmd = $(if $(wildcard $(fixdep)), + $(fixdep) $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp; \ + rm -f $(depfile); \ + mv -f $(dot-target).tmp $(dot-target).cmd, \ +- printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \ +- printf '\# using basic dep data\n\n' >> $(dot-target).cmd; \ ++ printf '$(pound) cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \ ++ printf '$(pound) using basic dep data\n\n' >> $(dot-target).cmd; \ + cat $(depfile) >> $(dot-target).cmd; \ + printf '\n%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd) + diff --git a/queue-4.14/tracing-reorder-display-of-tgid-to-be-after-pid.patch b/queue-4.14/tracing-reorder-display-of-tgid-to-be-after-pid.patch new file mode 100644 index 00000000000..baf43ddbc48 --- /dev/null +++ b/queue-4.14/tracing-reorder-display-of-tgid-to-be-after-pid.patch @@ -0,0 +1,109 @@ +From f8494fa3dd10b52eab47a9666a8bc34719a129aa Mon Sep 17 00:00:00 2001 +From: "Joel Fernandes (Google)" +Date: Mon, 25 Jun 2018 17:08:22 -0700 +Subject: tracing: Reorder display of TGID to be after PID + +From: Joel Fernandes (Google) + +commit f8494fa3dd10b52eab47a9666a8bc34719a129aa upstream. + +Currently ftrace displays data in trace output like so: + + _-----=> irqs-off + / _----=> need-resched + | / _---=> hardirq/softirq + || / _--=> preempt-depth + ||| / delay + TASK-PID CPU TGID |||| TIMESTAMP FUNCTION + | | | | |||| | | + bash-1091 [000] ( 1091) d..2 28.313544: sched_switch: + +However Android's trace visualization tools expect a slightly different +format due to an out-of-tree patch patch that was been carried for a +decade, notice that the TGID and CPU fields are reversed: + + _-----=> irqs-off + / _----=> need-resched + | / _---=> hardirq/softirq + || / _--=> preempt-depth + ||| / delay + TASK-PID TGID CPU |||| TIMESTAMP FUNCTION + | | | | |||| | | + bash-1091 ( 1091) [002] d..2 64.965177: sched_switch: + +From kernel v4.13 onwards, during which TGID was introduced, tracing +with systrace on all Android kernels will break (most Android kernels +have been on 4.9 with Android patches, so this issues hasn't been seen +yet). From v4.13 onwards things will break. + +The chrome browser's tracing tools also embed the systrace viewer which +uses the legacy TGID format and updates to that are known to be +difficult to make. + +Considering this, I suggest we make this change to the upstream kernel +and backport it to all Android kernels. I believe this feature is merged +recently enough into the upstream kernel that it shouldn't be a problem. +Also logically, IMO it makes more sense to group the TGID with the +TASK-PID and the CPU after these. + +Link: http://lkml.kernel.org/r/20180626000822.113931-1-joel@joelfernandes.org + +Cc: jreck@google.com +Cc: tkjos@google.com +Cc: stable@vger.kernel.org +Fixes: 441dae8f2f29 ("tracing: Add support for display of tgid in trace output") +Signed-off-by: Joel Fernandes (Google) +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/trace/trace.c | 8 ++++---- + kernel/trace/trace_output.c | 5 +++-- + 2 files changed, 7 insertions(+), 6 deletions(-) + +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -3359,8 +3359,8 @@ static void print_func_help_header(struc + + print_event_info(buf, m); + +- seq_printf(m, "# TASK-PID CPU# %s TIMESTAMP FUNCTION\n", tgid ? "TGID " : ""); +- seq_printf(m, "# | | | %s | |\n", tgid ? " | " : ""); ++ seq_printf(m, "# TASK-PID %s CPU# TIMESTAMP FUNCTION\n", tgid ? "TGID " : ""); ++ seq_printf(m, "# | | %s | | |\n", tgid ? " | " : ""); + } + + static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file *m, +@@ -3380,9 +3380,9 @@ static void print_func_help_header_irq(s + tgid ? tgid_space : space); + seq_printf(m, "# %s||| / delay\n", + tgid ? tgid_space : space); +- seq_printf(m, "# TASK-PID CPU#%s|||| TIMESTAMP FUNCTION\n", ++ seq_printf(m, "# TASK-PID %sCPU# |||| TIMESTAMP FUNCTION\n", + tgid ? " TGID " : space); +- seq_printf(m, "# | | | %s|||| | |\n", ++ seq_printf(m, "# | | %s | |||| | |\n", + tgid ? " | " : space); + } + +--- a/kernel/trace/trace_output.c ++++ b/kernel/trace/trace_output.c +@@ -594,8 +594,7 @@ int trace_print_context(struct trace_ite + + trace_find_cmdline(entry->pid, comm); + +- trace_seq_printf(s, "%16s-%-5d [%03d] ", +- comm, entry->pid, iter->cpu); ++ trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid); + + if (tr->trace_flags & TRACE_ITER_RECORD_TGID) { + unsigned int tgid = trace_find_tgid(entry->pid); +@@ -606,6 +605,8 @@ int trace_print_context(struct trace_ite + trace_seq_printf(s, "(%5d) ", tgid); + } + ++ trace_seq_printf(s, "[%03d] ", iter->cpu); ++ + if (tr->trace_flags & TRACE_ITER_IRQ_INFO) + trace_print_lat_fmt(s, entry); + diff --git a/queue-4.14/xen-setup-pv-irq-ops-vector-earlier.patch b/queue-4.14/xen-setup-pv-irq-ops-vector-earlier.patch new file mode 100644 index 00000000000..3da1a7cecdc --- /dev/null +++ b/queue-4.14/xen-setup-pv-irq-ops-vector-earlier.patch @@ -0,0 +1,98 @@ +From 0ce0bba4e5e0eb9b753bb821785de5d23c494392 Mon Sep 17 00:00:00 2001 +From: Juergen Gross +Date: Thu, 12 Jul 2018 17:40:34 +0200 +Subject: xen: setup pv irq ops vector earlier + +From: Juergen Gross + +commit 0ce0bba4e5e0eb9b753bb821785de5d23c494392 upstream. + +Setting pv_irq_ops for Xen PV domains should be done as early as +possible in order to support e.g. very early printk() usage. + +The same applies to xen_vcpu_info_reset(0), as it is needed for the +pv irq ops. + +Move the call of xen_setup_machphys_mapping() after initializing the +pv functions as it contains a WARN_ON(), too. + +Remove the no longer necessary conditional in xen_init_irq_ops() +from PVH V1 times to make clear this is a PV only function. + +Cc: # 4.14 +Signed-off-by: Juergen Gross +Reviewed-by: Boris Ostrovsky +Signed-off-by: Juergen Gross +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/xen/enlighten_pv.c | 24 +++++++++++------------- + arch/x86/xen/irq.c | 4 +--- + 2 files changed, 12 insertions(+), 16 deletions(-) + +--- a/arch/x86/xen/enlighten_pv.c ++++ b/arch/x86/xen/enlighten_pv.c +@@ -1230,12 +1230,20 @@ asmlinkage __visible void __init xen_sta + + xen_setup_features(); + +- xen_setup_machphys_mapping(); +- + /* Install Xen paravirt ops */ + pv_info = xen_info; + pv_init_ops.patch = paravirt_patch_default; + pv_cpu_ops = xen_cpu_ops; ++ xen_init_irq_ops(); ++ ++ /* ++ * Setup xen_vcpu early because it is needed for ++ * local_irq_disable(), irqs_disabled(), e.g. in printk(). ++ * ++ * Don't do the full vcpu_info placement stuff until we have ++ * the cpu_possible_mask and a non-dummy shared_info. ++ */ ++ xen_vcpu_info_reset(0); + + x86_platform.get_nmi_reason = xen_get_nmi_reason; + +@@ -1247,6 +1255,7 @@ asmlinkage __visible void __init xen_sta + * Set up some pagetable state before starting to set any ptes. + */ + ++ xen_setup_machphys_mapping(); + xen_init_mmu_ops(); + + /* Prevent unwanted bits from being set in PTEs. */ +@@ -1271,20 +1280,9 @@ asmlinkage __visible void __init xen_sta + get_cpu_cap(&boot_cpu_data); + x86_configure_nx(); + +- xen_init_irq_ops(); +- + /* Let's presume PV guests always boot on vCPU with id 0. */ + per_cpu(xen_vcpu_id, 0) = 0; + +- /* +- * Setup xen_vcpu early because idt_setup_early_handler needs it for +- * local_irq_disable(), irqs_disabled(). +- * +- * Don't do the full vcpu_info placement stuff until we have +- * the cpu_possible_mask and a non-dummy shared_info. +- */ +- xen_vcpu_info_reset(0); +- + idt_setup_early_handler(); + + xen_init_capabilities(); +--- a/arch/x86/xen/irq.c ++++ b/arch/x86/xen/irq.c +@@ -128,8 +128,6 @@ static const struct pv_irq_ops xen_irq_o + + void __init xen_init_irq_ops(void) + { +- /* For PVH we use default pv_irq_ops settings. */ +- if (!xen_feature(XENFEAT_hvm_callback_vector)) +- pv_irq_ops = xen_irq_ops; ++ pv_irq_ops = xen_irq_ops; + x86_init.irqs.intr_init = xen_init_IRQ; + }