]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Apr 2022 09:56:58 +0000 (11:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Apr 2022 09:56:58 +0000 (11:56 +0200)
added patches:
i2c-pasemi-wait-for-write-xfers-to-finish.patch
smp-fix-offline-cpu-check-in-flush_smp_call_function_queue.patch

queue-4.19/i2c-pasemi-wait-for-write-xfers-to-finish.patch [new file with mode: 0644]
queue-4.19/series
queue-4.19/smp-fix-offline-cpu-check-in-flush_smp_call_function_queue.patch [new file with mode: 0644]

diff --git a/queue-4.19/i2c-pasemi-wait-for-write-xfers-to-finish.patch b/queue-4.19/i2c-pasemi-wait-for-write-xfers-to-finish.patch
new file mode 100644 (file)
index 0000000..8f4ae5f
--- /dev/null
@@ -0,0 +1,53 @@
+From bd8963e602c77adc76dbbbfc3417c3cf14fed76b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Povi=C5=A1er?= <povik+lin@cutebit.org>
+Date: Tue, 29 Mar 2022 20:38:17 +0200
+Subject: i2c: pasemi: Wait for write xfers to finish
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Martin Povišer <povik+lin@cutebit.org>
+
+commit bd8963e602c77adc76dbbbfc3417c3cf14fed76b upstream.
+
+Wait for completion of write transfers before returning from the driver.
+At first sight it may seem advantageous to leave write transfers queued
+for the controller to carry out on its own time, but there's a couple of
+issues with it:
+
+ * Driver doesn't check for FIFO space.
+
+ * The queued writes can complete while the driver is in its I2C read
+   transfer path which means it will get confused by the raising of
+   XEN (the 'transaction ended' signal). This can cause a spurious
+   ENODATA error due to premature reading of the MRXFIFO register.
+
+Adding the wait fixes some unreliability issues with the driver. There's
+some efficiency cost to it (especially with pasemi_smb_waitready doing
+its polling), but that will be alleviated once the driver receives
+interrupt support.
+
+Fixes: beb58aa39e6e ("i2c: PA Semi SMBus driver")
+Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
+Reviewed-by: Sven Peter <sven@svenpeter.dev>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/i2c/busses/i2c-pasemi.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/i2c/busses/i2c-pasemi.c
++++ b/drivers/i2c/busses/i2c-pasemi.c
+@@ -145,6 +145,12 @@ static int pasemi_i2c_xfer_msg(struct i2
+               TXFIFO_WR(smbus, msg->buf[msg->len-1] |
+                         (stop ? MTXFIFO_STOP : 0));
++
++              if (stop) {
++                      err = pasemi_smb_waitready(smbus);
++                      if (err)
++                              goto reset_out;
++              }
+       }
+       return 0;
index 1a89419f7e8549b7961ca4606b5e193fe44cfc3c..6e59465b944b9e7375c27012722bfd5c8ce1633c 100644 (file)
@@ -28,3 +28,5 @@ alsa-hda-realtek-add-quirk-for-clevo-pd50pnt.patch
 alsa-pcm-test-for-silence-field-in-struct-pcm_format_data.patch
 ipv6-fix-panic-when-forwarding-a-pkt-with-no-in6-dev.patch
 arm-davinci-da850-evm-avoid-null-pointer-dereference.patch
+smp-fix-offline-cpu-check-in-flush_smp_call_function_queue.patch
+i2c-pasemi-wait-for-write-xfers-to-finish.patch
diff --git a/queue-4.19/smp-fix-offline-cpu-check-in-flush_smp_call_function_queue.patch b/queue-4.19/smp-fix-offline-cpu-check-in-flush_smp_call_function_queue.patch
new file mode 100644 (file)
index 0000000..47d4578
--- /dev/null
@@ -0,0 +1,42 @@
+From 9e949a3886356fe9112c6f6f34a6e23d1d35407f Mon Sep 17 00:00:00 2001
+From: Nadav Amit <namit@vmware.com>
+Date: Sat, 19 Mar 2022 00:20:15 -0700
+Subject: smp: Fix offline cpu check in flush_smp_call_function_queue()
+
+From: Nadav Amit <namit@vmware.com>
+
+commit 9e949a3886356fe9112c6f6f34a6e23d1d35407f upstream.
+
+The check in flush_smp_call_function_queue() for callbacks that are sent
+to offline CPUs currently checks whether the queue is empty.
+
+However, flush_smp_call_function_queue() has just deleted all the
+callbacks from the queue and moved all the entries into a local list.
+This checks would only be positive if some callbacks were added in the
+short time after llist_del_all() was called. This does not seem to be
+the intention of this check.
+
+Change the check to look at the local list to which the entries were
+moved instead of the queue from which all the callbacks were just
+removed.
+
+Fixes: 8d056c48e4862 ("CPU hotplug, smp: flush any pending IPI callbacks before CPU offline")
+Signed-off-by: Nadav Amit <namit@vmware.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Link: https://lore.kernel.org/r/20220319072015.1495036-1-namit@vmware.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/smp.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/smp.c
++++ b/kernel/smp.c
+@@ -221,7 +221,7 @@ static void flush_smp_call_function_queu
+       /* There shouldn't be any pending callbacks on an offline CPU. */
+       if (unlikely(warn_cpu_offline && !cpu_online(smp_processor_id()) &&
+-                   !warned && !llist_empty(head))) {
++                   !warned && entry != NULL)) {
+               warned = true;
+               WARN(1, "IPI on offline CPU %d\n", smp_processor_id());