]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Apr 2021 14:04:36 +0000 (16:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Apr 2021 14:04:36 +0000 (16:04 +0200)
added patches:
net-sfp-cope-with-sfps-that-set-both-los-normal-and-los-inverted.patch
net-sfp-relax-bitrate-derived-mode-check.patch
perf-map-tighten-snprintf-string-precision-to-pass-gcc-check-on-some-32-bit-arches.patch
xen-events-fix-setting-irq-affinity.patch

queue-5.10/net-sfp-cope-with-sfps-that-set-both-los-normal-and-los-inverted.patch [new file with mode: 0644]
queue-5.10/net-sfp-relax-bitrate-derived-mode-check.patch [new file with mode: 0644]
queue-5.10/perf-map-tighten-snprintf-string-precision-to-pass-gcc-check-on-some-32-bit-arches.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/xen-events-fix-setting-irq-affinity.patch [new file with mode: 0644]

diff --git a/queue-5.10/net-sfp-cope-with-sfps-that-set-both-los-normal-and-los-inverted.patch b/queue-5.10/net-sfp-cope-with-sfps-that-set-both-los-normal-and-los-inverted.patch
new file mode 100644 (file)
index 0000000..6846ba3
--- /dev/null
@@ -0,0 +1,99 @@
+From 624407d2cf14ff58e53bf4b2af9595c4f21d606e Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Sun, 10 Jan 2021 10:58:32 +0000
+Subject: net: sfp: cope with SFPs that set both LOS normal and LOS inverted
+
+From: Russell King <rmk+kernel@armlinux.org.uk>
+
+commit 624407d2cf14ff58e53bf4b2af9595c4f21d606e upstream.
+
+The SFP MSA defines two option bits in byte 65 to indicate how the
+Rx_LOS signal on SFP pin 8 behaves:
+
+bit 2 - Loss of Signal implemented, signal inverted from standard
+        definition in SFP MSA (often called "Signal Detect").
+bit 1 - Loss of Signal implemented, signal as defined in SFP MSA
+        (often called "Rx_LOS").
+
+Clearly, setting both bits results in a meaningless situation: it would
+mean that LOS is implemented in both the normal sense (1 = signal loss)
+and inverted sense (0 = signal loss).
+
+Unfortunately, there are modules out there which set both bits, which
+will be initially interpret as "inverted" sense, and then, if the LOS
+signal changes state, we will toggle between LINK_UP and WAIT_LOS
+states.
+
+Change our LOS handling to give well defined behaviour: only interpret
+these bits as meaningful if exactly one is set, otherwise treat it as
+if LOS is not implemented.
+
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Link: https://lore.kernel.org/r/E1kyYQa-0004iR-CU@rmk-PC.armlinux.org.uk
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Cc: Pali Rohár <pali@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/phy/sfp.c |   36 ++++++++++++++++++++++--------------
+ 1 file changed, 22 insertions(+), 14 deletions(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -1501,15 +1501,19 @@ static void sfp_sm_link_down(struct sfp
+ static void sfp_sm_link_check_los(struct sfp *sfp)
+ {
+-      unsigned int los = sfp->state & SFP_F_LOS;
++      const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
++      const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
++      __be16 los_options = sfp->id.ext.options & (los_inverted | los_normal);
++      bool los = false;
+       /* If neither SFP_OPTIONS_LOS_INVERTED nor SFP_OPTIONS_LOS_NORMAL
+-       * are set, we assume that no LOS signal is available.
++       * are set, we assume that no LOS signal is available. If both are
++       * set, we assume LOS is not implemented (and is meaningless.)
+        */
+-      if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED))
+-              los ^= SFP_F_LOS;
+-      else if (!(sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_NORMAL)))
+-              los = 0;
++      if (los_options == los_inverted)
++              los = !(sfp->state & SFP_F_LOS);
++      else if (los_options == los_normal)
++              los = !!(sfp->state & SFP_F_LOS);
+       if (los)
+               sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
+@@ -1519,18 +1523,22 @@ static void sfp_sm_link_check_los(struct
+ static bool sfp_los_event_active(struct sfp *sfp, unsigned int event)
+ {
+-      return (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) &&
+-              event == SFP_E_LOS_LOW) ||
+-             (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_NORMAL) &&
+-              event == SFP_E_LOS_HIGH);
++      const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
++      const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
++      __be16 los_options = sfp->id.ext.options & (los_inverted | los_normal);
++
++      return (los_options == los_inverted && event == SFP_E_LOS_LOW) ||
++             (los_options == los_normal && event == SFP_E_LOS_HIGH);
+ }
+ static bool sfp_los_event_inactive(struct sfp *sfp, unsigned int event)
+ {
+-      return (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) &&
+-              event == SFP_E_LOS_HIGH) ||
+-             (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_NORMAL) &&
+-              event == SFP_E_LOS_LOW);
++      const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
++      const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
++      __be16 los_options = sfp->id.ext.options & (los_inverted | los_normal);
++
++      return (los_options == los_inverted && event == SFP_E_LOS_HIGH) ||
++             (los_options == los_normal && event == SFP_E_LOS_LOW);
+ }
+ static void sfp_sm_fault(struct sfp *sfp, unsigned int next_state, bool warn)
diff --git a/queue-5.10/net-sfp-relax-bitrate-derived-mode-check.patch b/queue-5.10/net-sfp-relax-bitrate-derived-mode-check.patch
new file mode 100644 (file)
index 0000000..7fcdd1f
--- /dev/null
@@ -0,0 +1,49 @@
+From 7a77233ec6d114322e2c4f71b4e26dbecd9ea8a7 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Wed, 9 Dec 2020 11:22:54 +0000
+Subject: net: sfp: relax bitrate-derived mode check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Russell King <rmk+kernel@armlinux.org.uk>
+
+commit 7a77233ec6d114322e2c4f71b4e26dbecd9ea8a7 upstream.
+
+Do not check the encoding when deriving 1000BASE-X from the bitrate
+when no other modes are discovered. Some GPON modules (VSOL V2801F
+and CarlitoxxPro CPGOS03-0490 v2.0) indicate NRZ encoding with a
+1200Mbaud bitrate, but should be driven with 1000BASE-X on the host
+side.
+
+Tested-by: Pali Rohár <pali@kernel.org>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/phy/sfp-bus.c |   11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/phy/sfp-bus.c
++++ b/drivers/net/phy/sfp-bus.c
+@@ -349,14 +349,13 @@ void sfp_parse_support(struct sfp_bus *b
+       }
+       /* If we haven't discovered any modes that this module supports, try
+-       * the encoding and bitrate to determine supported modes. Some BiDi
+-       * modules (eg, 1310nm/1550nm) are not 1000BASE-BX compliant due to
+-       * the differing wavelengths, so do not set any transceiver bits.
++       * the bitrate to determine supported modes. Some BiDi modules (eg,
++       * 1310nm/1550nm) are not 1000BASE-BX compliant due to the differing
++       * wavelengths, so do not set any transceiver bits.
+        */
+       if (bitmap_empty(modes, __ETHTOOL_LINK_MODE_MASK_NBITS)) {
+-              /* If the encoding and bit rate allows 1000baseX */
+-              if (id->base.encoding == SFF8024_ENCODING_8B10B && br_nom &&
+-                  br_min <= 1300 && br_max >= 1200)
++              /* If the bit rate allows 1000baseX */
++              if (br_nom && br_min <= 1300 && br_max >= 1200)
+                       phylink_set(modes, 1000baseX_Full);
+       }
diff --git a/queue-5.10/perf-map-tighten-snprintf-string-precision-to-pass-gcc-check-on-some-32-bit-arches.patch b/queue-5.10/perf-map-tighten-snprintf-string-precision-to-pass-gcc-check-on-some-32-bit-arches.patch
new file mode 100644 (file)
index 0000000..03df946
--- /dev/null
@@ -0,0 +1,64 @@
+From 77d02bd00cea9f1a87afe58113fa75b983d6c23a Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Fri, 5 Mar 2021 10:02:09 -0300
+Subject: perf map: Tighten snprintf() string precision to pass gcc check on some 32-bit arches
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit 77d02bd00cea9f1a87afe58113fa75b983d6c23a upstream.
+
+Noticed on a debian:experimental mips and mipsel cross build build
+environment:
+
+  perfbuilder@ec265a086e9b:~$ mips-linux-gnu-gcc --version | head -1
+  mips-linux-gnu-gcc (Debian 10.2.1-3) 10.2.1 20201224
+  perfbuilder@ec265a086e9b:~$
+
+    CC       /tmp/build/perf/util/map.o
+  util/map.c: In function 'map__new':
+  util/map.c:109:5: error: '%s' directive output may be truncated writing between 1 and 2147483645 bytes into a region of size 4096 [-Werror=format-truncation=]
+    109 |    "%s/platforms/%s/arch-%s/usr/lib/%s",
+        |     ^~
+  In file included from /usr/mips-linux-gnu/include/stdio.h:867,
+                   from util/symbol.h:11,
+                   from util/map.c:2:
+  /usr/mips-linux-gnu/include/bits/stdio2.h:67:10: note: '__builtin___snprintf_chk' output 32 or more bytes (assuming 4294967321) into a destination of size 4096
+     67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
+        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+     68 |        __bos (__s), __fmt, __va_arg_pack ());
+        |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  cc1: all warnings being treated as errors
+
+Since we have the lenghts for what lands in that place, use it to give
+the compiler more info and make it happy.
+
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Anders Roxell <anders.roxell@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/perf/util/map.c |    7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+--- a/tools/perf/util/map.c
++++ b/tools/perf/util/map.c
+@@ -77,8 +77,7 @@ static inline bool replace_android_lib(c
+       if (strstarts(filename, "/system/lib/")) {
+               char *ndk, *app;
+               const char *arch;
+-              size_t ndk_length;
+-              size_t app_length;
++              int ndk_length, app_length;
+               ndk = getenv("NDK_ROOT");
+               app = getenv("APP_PLATFORM");
+@@ -106,8 +105,8 @@ static inline bool replace_android_lib(c
+               if (new_length > PATH_MAX)
+                       return false;
+               snprintf(newfilename, new_length,
+-                      "%s/platforms/%s/arch-%s/usr/lib/%s",
+-                      ndk, app, arch, libname);
++                      "%.*s/platforms/%.*s/arch-%s/usr/lib/%s",
++                      ndk_length, ndk, app_length, app, arch, libname);
+               return true;
+       }
index c0105be6b3113f1226fffc121b982444be066054..558062c301e1aa8ae34723f2a5b76b73dbca0b52 100644 (file)
@@ -19,3 +19,7 @@ io_uring-don-t-mark-s_isblk-async-work-as-unbounded.patch
 riscv-entry-fix-misaligned-base-for-excp_vect_table.patch
 block-don-t-ignore-req_nowait-for-direct-io.patch
 netfilter-x_tables-fix-compat-match-target-pad-out-of-bound-write.patch
+perf-map-tighten-snprintf-string-precision-to-pass-gcc-check-on-some-32-bit-arches.patch
+net-sfp-relax-bitrate-derived-mode-check.patch
+net-sfp-cope-with-sfps-that-set-both-los-normal-and-los-inverted.patch
+xen-events-fix-setting-irq-affinity.patch
diff --git a/queue-5.10/xen-events-fix-setting-irq-affinity.patch b/queue-5.10/xen-events-fix-setting-irq-affinity.patch
new file mode 100644 (file)
index 0000000..39a52f7
--- /dev/null
@@ -0,0 +1,50 @@
+From jgross@suse.com  Thu Apr 15 15:56:08 2021
+From: Juergen Gross <jgross@suse.com>
+Date: Mon, 12 Apr 2021 08:28:45 +0200
+Subject: xen/events: fix setting irq affinity
+To: stable@vger.kernel.org
+Cc: Juergen Gross <jgross@suse.com>, Boris Ostrovsky <boris.ostrovsky@oracle.com>, Stefano Stabellini <sstabellini@kernel.org>, xen-devel@lists.xenproject.org
+Message-ID: <20210412062845.13946-1-jgross@suse.com>
+
+From: Juergen Gross <jgross@suse.com>
+
+The backport of upstream patch 25da4618af240fbec61 ("xen/events: don't
+unmask an event channel when an eoi is pending") introduced a
+regression for stable kernels 5.10 and older: setting IRQ affinity for
+IRQs related to interdomain events would no longer work, as moving the
+IRQ to its new cpu was not included in the irq_ack callback for those
+events.
+
+Fix that by adding the needed call.
+
+Note that kernels 5.11 and later don't need the explicit moving of the
+IRQ to the target cpu in the irq_ack callback, due to a rework of the
+affinity setting in kernel 5.11.
+
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/xen/events/events_base.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/xen/events/events_base.c
++++ b/drivers/xen/events/events_base.c
+@@ -1809,7 +1809,7 @@ static void lateeoi_ack_dynirq(struct ir
+       if (VALID_EVTCHN(evtchn)) {
+               do_mask(info, EVT_MASK_REASON_EOI_PENDING);
+-              event_handler_exit(info);
++              ack_dynirq(data);
+       }
+ }
+@@ -1820,7 +1820,7 @@ static void lateeoi_mask_ack_dynirq(stru
+       if (VALID_EVTCHN(evtchn)) {
+               do_mask(info, EVT_MASK_REASON_EXPLICIT);
+-              event_handler_exit(info);
++              ack_dynirq(data);
+       }
+ }