]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Nov 2019 09:25:43 +0000 (10:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Nov 2019 09:25:43 +0000 (10:25 +0100)
added patches:
arc-perf-accommodate-big-endian-cpu.patch
x86-insn-fix-awk-regexp-warnings.patch

queue-4.14/arc-perf-accommodate-big-endian-cpu.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/x86-insn-fix-awk-regexp-warnings.patch [new file with mode: 0644]

diff --git a/queue-4.14/arc-perf-accommodate-big-endian-cpu.patch b/queue-4.14/arc-perf-accommodate-big-endian-cpu.patch
new file mode 100644 (file)
index 0000000..efdb04c
--- /dev/null
@@ -0,0 +1,80 @@
+From 5effc09c4907901f0e71e68e5f2e14211d9a203f Mon Sep 17 00:00:00 2001
+From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
+Date: Tue, 22 Oct 2019 17:04:11 +0300
+Subject: ARC: perf: Accommodate big-endian CPU
+
+From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
+
+commit 5effc09c4907901f0e71e68e5f2e14211d9a203f upstream.
+
+8-letter strings representing ARC perf events are stores in two
+32-bit registers as ASCII characters like that: "IJMP", "IALL", "IJMPTAK" etc.
+
+And the same order of bytes in the word is used regardless CPU endianness.
+
+Which means in case of big-endian CPU core we need to swap bytes to get
+the same order as if it was on little-endian CPU.
+
+Otherwise we're seeing the following error message on boot:
+------------------------->8----------------------
+ARC perf        : 8 counters (32 bits), 40 conditions, [overflow IRQ support]
+sysfs: cannot create duplicate filename '/devices/arc_pct/events/pmji'
+CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
+Stack Trace:
+  arc_unwind_core+0xd4/0xfc
+  dump_stack+0x64/0x80
+  sysfs_warn_dup+0x46/0x58
+  sysfs_add_file_mode_ns+0xb2/0x168
+  create_files+0x70/0x2a0
+------------[ cut here ]------------
+WARNING: CPU: 0 PID: 1 at kernel/events/core.c:12144 perf_event_sysfs_init+0x70/0xa0
+Failed to register pmu: arc_pct, reason -17
+Modules linked in:
+CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
+Stack Trace:
+  arc_unwind_core+0xd4/0xfc
+  dump_stack+0x64/0x80
+  __warn+0x9c/0xd4
+  warn_slowpath_fmt+0x22/0x2c
+  perf_event_sysfs_init+0x70/0xa0
+---[ end trace a75fb9a9837bd1ec ]---
+------------------------->8----------------------
+
+What happens here we're trying to register more than one raw perf event
+with the same name "PMJI". Why? Because ARC perf events are 4 to 8 letters
+and encoded into two 32-bit words. In this particular case we deal with 2
+events:
+ * "IJMP____" which counts all jump & branch instructions
+ * "IJMPC___" which counts only conditional jumps & branches
+
+Those strings are split in two 32-bit words this way "IJMP" + "____" &
+"IJMP" + "C___" correspondingly. Now if we read them swapped due to CPU core
+being big-endian then we read "PMJI" + "____" & "PMJI" + "___C".
+
+And since we interpret read array of ASCII letters as a null-terminated string
+on big-endian CPU we end up with 2 events of the same name "PMJI".
+
+Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+
+---
+ arch/arc/kernel/perf_event.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arc/kernel/perf_event.c
++++ b/arch/arc/kernel/perf_event.c
+@@ -488,8 +488,8 @@ static int arc_pmu_device_probe(struct p
+       /* loop thru all available h/w condition indexes */
+       for (j = 0; j < cc_bcr.c; j++) {
+               write_aux_reg(ARC_REG_CC_INDEX, j);
+-              cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0);
+-              cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1);
++              cc_name.indiv.word0 = le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME0));
++              cc_name.indiv.word1 = le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME1));
+               /* See if it has been mapped to a perf event_id */
+               for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) {
index eb709ad18852c03d9f680930f770129aff2770ee..d2894f155d43f18e995cba343715f07eb5760a82 100644 (file)
@@ -173,3 +173,5 @@ arm64-fix-for-bad_mode-handler-to-always-result-in-panic.patch
 cpufreq-skip-cpufreq-resume-if-it-s-not-suspended.patch
 ocfs2-remove-ocfs2_is_o2cb_active.patch
 arm-8904-1-skip-nomap-memblocks-while-finding-the-lowmem-highmem-boundary.patch
+arc-perf-accommodate-big-endian-cpu.patch
+x86-insn-fix-awk-regexp-warnings.patch
diff --git a/queue-4.14/x86-insn-fix-awk-regexp-warnings.patch b/queue-4.14/x86-insn-fix-awk-regexp-warnings.patch
new file mode 100644 (file)
index 0000000..9a026ad
--- /dev/null
@@ -0,0 +1,88 @@
+From 700c1018b86d0d4b3f1f2d459708c0cdf42b521d Mon Sep 17 00:00:00 2001
+From: Alexander Kapshuk <alexander.kapshuk@gmail.com>
+Date: Tue, 24 Sep 2019 07:46:59 +0300
+Subject: x86/insn: Fix awk regexp warnings
+
+From: Alexander Kapshuk <alexander.kapshuk@gmail.com>
+
+commit 700c1018b86d0d4b3f1f2d459708c0cdf42b521d upstream.
+
+gawk 5.0.1 generates the following regexp warnings:
+
+  GEN      /home/sasha/torvalds/tools/objtool/arch/x86/lib/inat-tables.c
+  awk: ../arch/x86/tools/gen-insn-attr-x86.awk:260: warning: regexp escape sequence `\:' is not a known regexp operator
+  awk: ../arch/x86/tools/gen-insn-attr-x86.awk:350: (FILENAME=../arch/x86/lib/x86-opcode-map.txt FNR=41) warning: regexp escape sequence `\&' is  not a known regexp operator
+
+Ealier versions of gawk are not known to generate these warnings. The
+gawk manual referenced below does not list characters ':' and '&' as
+needing escaping, so 'unescape' them. See
+
+  https://www.gnu.org/software/gawk/manual/html_node/Escape-Sequences.html
+
+for more info.
+
+Running diff on the output generated by the script before and after
+applying the patch reported no differences.
+
+ [ bp: Massage commit message. ]
+
+[ Caught the respective tools header discrepancy. ]
+Reported-by: kbuild test robot <lkp@intel.com>
+Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
+Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: x86-ml <x86@kernel.org>
+Link: https://lkml.kernel.org/r/20190924044659.3785-1-alexander.kapshuk@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/tools/gen-insn-attr-x86.awk               |    4 ++--
+ tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk |    4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+--- a/arch/x86/tools/gen-insn-attr-x86.awk
++++ b/arch/x86/tools/gen-insn-attr-x86.awk
+@@ -69,7 +69,7 @@ BEGIN {
+       lprefix1_expr = "\\((66|!F3)\\)"
+       lprefix2_expr = "\\(F3\\)"
+-      lprefix3_expr = "\\((F2|!F3|66\\&F2)\\)"
++      lprefix3_expr = "\\((F2|!F3|66&F2)\\)"
+       lprefix_expr = "\\((66|F2|F3)\\)"
+       max_lprefix = 4
+@@ -257,7 +257,7 @@ function convert_operands(count,opnd,
+       return add_flags(imm, mod)
+ }
+-/^[0-9a-f]+\:/ {
++/^[0-9a-f]+:/ {
+       if (NR == 1)
+               next
+       # get index
+--- a/tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk
++++ b/tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk
+@@ -69,7 +69,7 @@ BEGIN {
+       lprefix1_expr = "\\((66|!F3)\\)"
+       lprefix2_expr = "\\(F3\\)"
+-      lprefix3_expr = "\\((F2|!F3|66\\&F2)\\)"
++      lprefix3_expr = "\\((F2|!F3|66&F2)\\)"
+       lprefix_expr = "\\((66|F2|F3)\\)"
+       max_lprefix = 4
+@@ -257,7 +257,7 @@ function convert_operands(count,opnd,
+       return add_flags(imm, mod)
+ }
+-/^[0-9a-f]+\:/ {
++/^[0-9a-f]+:/ {
+       if (NR == 1)
+               next
+       # get index