]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Mar 2023 11:02:43 +0000 (12:02 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Mar 2023 11:02:43 +0000 (12:02 +0100)
added patches:
alsa-hda-intel-dsp-config-add-mtl-pci-id.patch
alsa-hda-realtek-fix-the-speaker-output-on-samsung-galaxy-book2-pro.patch
cifs-fix-smb2_set_path_size.patch
drm-shmem-helper-remove-another-errant-put-in-error-path.patch
kvm-nvmx-add-missing-consistency-checks-for-cr0-and-cr4.patch
mptcp-avoid-setting-tcp_close-state-twice.patch
tracing-check-field-value-in-hist_field_name.patch
tracing-make-splice_read-available-again.patch
tracing-make-tracepoint-lockdep-check-actually-test-something.patch

queue-5.10/alsa-hda-intel-dsp-config-add-mtl-pci-id.patch [new file with mode: 0644]
queue-5.10/alsa-hda-realtek-fix-the-speaker-output-on-samsung-galaxy-book2-pro.patch [new file with mode: 0644]
queue-5.10/cifs-fix-smb2_set_path_size.patch [new file with mode: 0644]
queue-5.10/drm-shmem-helper-remove-another-errant-put-in-error-path.patch [new file with mode: 0644]
queue-5.10/kvm-nvmx-add-missing-consistency-checks-for-cr0-and-cr4.patch [new file with mode: 0644]
queue-5.10/mptcp-avoid-setting-tcp_close-state-twice.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/tracing-check-field-value-in-hist_field_name.patch [new file with mode: 0644]
queue-5.10/tracing-make-splice_read-available-again.patch [new file with mode: 0644]
queue-5.10/tracing-make-tracepoint-lockdep-check-actually-test-something.patch [new file with mode: 0644]

diff --git a/queue-5.10/alsa-hda-intel-dsp-config-add-mtl-pci-id.patch b/queue-5.10/alsa-hda-intel-dsp-config-add-mtl-pci-id.patch
new file mode 100644 (file)
index 0000000..7eeefce
--- /dev/null
@@ -0,0 +1,40 @@
+From bbdf904b13a62bb8b1272d92a7dde082dff86fbb Mon Sep 17 00:00:00 2001
+From: Bard Liao <yung-chuan.liao@linux.intel.com>
+Date: Mon, 6 Mar 2023 15:41:01 +0800
+Subject: ALSA: hda: intel-dsp-config: add MTL PCI id
+
+From: Bard Liao <yung-chuan.liao@linux.intel.com>
+
+commit bbdf904b13a62bb8b1272d92a7dde082dff86fbb upstream.
+
+Use SOF as default audio driver.
+
+Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Reviewed-by: Gongjun Song <gongjun.song@intel.com>
+Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20230306074101.3906707-1-yung-chuan.liao@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/hda/intel-dsp-config.c |    9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/sound/hda/intel-dsp-config.c
++++ b/sound/hda/intel-dsp-config.c
+@@ -359,6 +359,15 @@ static const struct config_entry config_
+       },
+ #endif
++/* Meteor Lake */
++#if IS_ENABLED(CONFIG_SND_SOC_SOF_METEORLAKE)
++      /* Meteorlake-P */
++      {
++              .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
++              .device = 0x7e28,
++      },
++#endif
++
+ };
+ static const struct config_entry *snd_intel_dsp_find_config
diff --git a/queue-5.10/alsa-hda-realtek-fix-the-speaker-output-on-samsung-galaxy-book2-pro.patch b/queue-5.10/alsa-hda-realtek-fix-the-speaker-output-on-samsung-galaxy-book2-pro.patch
new file mode 100644 (file)
index 0000000..c8e7400
--- /dev/null
@@ -0,0 +1,32 @@
+From a86e79e3015f5dd8e1b01ccfa49bd5c6e41047a1 Mon Sep 17 00:00:00 2001
+From: "Hamidreza H. Fard" <nitocris@posteo.net>
+Date: Tue, 7 Mar 2023 16:37:41 +0000
+Subject: ALSA: hda/realtek: Fix the speaker output on Samsung Galaxy Book2 Pro
+
+From: Hamidreza H. Fard <nitocris@posteo.net>
+
+commit a86e79e3015f5dd8e1b01ccfa49bd5c6e41047a1 upstream.
+
+Samsung Galaxy Book2 Pro (13" 2022 NP930XED-KA1DE) with codec SSID
+144d:c868 requires the same workaround for enabling the speaker amp
+like other Samsung models with ALC298 code.
+
+Signed-off-by: Hamidreza H. Fard <nitocris@posteo.net>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20230307163741.3878-1-nitocris@posteo.net
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -9091,6 +9091,7 @@ static const struct snd_pci_quirk alc269
+       SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
+       SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
+       SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
++      SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
+       SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
+       SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
+       SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
diff --git a/queue-5.10/cifs-fix-smb2_set_path_size.patch b/queue-5.10/cifs-fix-smb2_set_path_size.patch
new file mode 100644 (file)
index 0000000..183d611
--- /dev/null
@@ -0,0 +1,63 @@
+From 211baef0eabf4169ce4f73ebd917749d1a7edd74 Mon Sep 17 00:00:00 2001
+From: Volker Lendecke <vl@samba.org>
+Date: Mon, 13 Mar 2023 16:09:54 +0100
+Subject: cifs: Fix smb2_set_path_size()
+
+From: Volker Lendecke <vl@samba.org>
+
+commit 211baef0eabf4169ce4f73ebd917749d1a7edd74 upstream.
+
+If cifs_get_writable_path() finds a writable file, smb2_compound_op()
+must use that file's FID and not the COMPOUND_FID.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Volker Lendecke <vl@samba.org>
+Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/cifs/smb2inode.c |   31 ++++++++++++++++++++++++-------
+ 1 file changed, 24 insertions(+), 7 deletions(-)
+
+--- a/fs/cifs/smb2inode.c
++++ b/fs/cifs/smb2inode.c
+@@ -236,15 +236,32 @@ smb2_compound_op(const unsigned int xid,
+               size[0] = 8; /* sizeof __le64 */
+               data[0] = ptr;
+-              rc = SMB2_set_info_init(tcon, server,
+-                                      &rqst[num_rqst], COMPOUND_FID,
+-                                      COMPOUND_FID, current->tgid,
+-                                      FILE_END_OF_FILE_INFORMATION,
+-                                      SMB2_O_INFO_FILE, 0, data, size);
++              if (cfile) {
++                      rc = SMB2_set_info_init(tcon, server,
++                                              &rqst[num_rqst],
++                                              cfile->fid.persistent_fid,
++                                              cfile->fid.volatile_fid,
++                                              current->tgid,
++                                              FILE_END_OF_FILE_INFORMATION,
++                                              SMB2_O_INFO_FILE, 0,
++                                              data, size);
++              } else {
++                      rc = SMB2_set_info_init(tcon, server,
++                                              &rqst[num_rqst],
++                                              COMPOUND_FID,
++                                              COMPOUND_FID,
++                                              current->tgid,
++                                              FILE_END_OF_FILE_INFORMATION,
++                                              SMB2_O_INFO_FILE, 0,
++                                              data, size);
++                      if (!rc) {
++                              smb2_set_next_command(tcon, &rqst[num_rqst]);
++                              smb2_set_related(&rqst[num_rqst]);
++                      }
++              }
+               if (rc)
+                       goto finished;
+-              smb2_set_next_command(tcon, &rqst[num_rqst]);
+-              smb2_set_related(&rqst[num_rqst++]);
++              num_rqst++;
+               trace_smb3_set_eof_enter(xid, ses->Suid, tcon->tid, full_path);
+               break;
+       case SMB2_OP_SET_INFO:
diff --git a/queue-5.10/drm-shmem-helper-remove-another-errant-put-in-error-path.patch b/queue-5.10/drm-shmem-helper-remove-another-errant-put-in-error-path.patch
new file mode 100644 (file)
index 0000000..04c015e
--- /dev/null
@@ -0,0 +1,43 @@
+From ee9adb7a45516cfa536ca92253d7ae59d56db9e4 Mon Sep 17 00:00:00 2001
+From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
+Date: Mon, 9 Jan 2023 00:13:11 +0300
+Subject: drm/shmem-helper: Remove another errant put in error path
+
+From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
+
+commit ee9adb7a45516cfa536ca92253d7ae59d56db9e4 upstream.
+
+drm_gem_shmem_mmap() doesn't own reference in error code path, resulting
+in the dma-buf shmem GEM object getting prematurely freed leading to a
+later use-after-free.
+
+Fixes: f49a51bfdc8e ("drm/shme-helpers: Fix dma_buf_mmap forwarding bug")
+Cc: stable@vger.kernel.org
+Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
+Reviewed-by: Rob Clark <robdclark@gmail.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20230108211311.3950107-1-dmitry.osipenko@collabora.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/drm_gem_shmem_helper.c |    9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
++++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
+@@ -614,11 +614,14 @@ int drm_gem_shmem_mmap(struct drm_gem_ob
+       int ret;
+       if (obj->import_attach) {
+-              /* Drop the reference drm_gem_mmap_obj() acquired.*/
+-              drm_gem_object_put(obj);
+               vma->vm_private_data = NULL;
++              ret = dma_buf_mmap(obj->dma_buf, vma, 0);
++
++              /* Drop the reference drm_gem_mmap_obj() acquired.*/
++              if (!ret)
++                      drm_gem_object_put(obj);
+-              return dma_buf_mmap(obj->dma_buf, vma, 0);
++              return ret;
+       }
+       shmem = to_drm_gem_shmem_obj(obj);
diff --git a/queue-5.10/kvm-nvmx-add-missing-consistency-checks-for-cr0-and-cr4.patch b/queue-5.10/kvm-nvmx-add-missing-consistency-checks-for-cr0-and-cr4.patch
new file mode 100644 (file)
index 0000000..9be2273
--- /dev/null
@@ -0,0 +1,57 @@
+From 112e66017bff7f2837030f34c2bc19501e9212d5 Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini@redhat.com>
+Date: Fri, 10 Mar 2023 11:10:56 -0500
+Subject: KVM: nVMX: add missing consistency checks for CR0 and CR4
+
+From: Paolo Bonzini <pbonzini@redhat.com>
+
+commit 112e66017bff7f2837030f34c2bc19501e9212d5 upstream.
+
+The effective values of the guest CR0 and CR4 registers may differ from
+those included in the VMCS12.  In particular, disabling EPT forces
+CR4.PAE=1 and disabling unrestricted guest mode forces CR0.PG=CR0.PE=1.
+
+Therefore, checks on these bits cannot be delegated to the processor
+and must be performed by KVM.
+
+Reported-by: Reima ISHII <ishiir@g.ecc.u-tokyo.ac.jp>
+Cc: stable@vger.kernel.org
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/vmx/nested.c |   10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/kvm/vmx/nested.c
++++ b/arch/x86/kvm/vmx/nested.c
+@@ -2998,7 +2998,7 @@ static int nested_vmx_check_guest_state(
+                                       struct vmcs12 *vmcs12,
+                                       enum vm_entry_failure_code *entry_failure_code)
+ {
+-      bool ia32e;
++      bool ia32e = !!(vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE);
+       *entry_failure_code = ENTRY_FAIL_DEFAULT;
+@@ -3024,6 +3024,13 @@ static int nested_vmx_check_guest_state(
+                                          vmcs12->guest_ia32_perf_global_ctrl)))
+               return -EINVAL;
++      if (CC((vmcs12->guest_cr0 & (X86_CR0_PG | X86_CR0_PE)) == X86_CR0_PG))
++              return -EINVAL;
++
++      if (CC(ia32e && !(vmcs12->guest_cr4 & X86_CR4_PAE)) ||
++          CC(ia32e && !(vmcs12->guest_cr0 & X86_CR0_PG)))
++              return -EINVAL;
++
+       /*
+        * If the load IA32_EFER VM-entry control is 1, the following checks
+        * are performed on the field for the IA32_EFER MSR:
+@@ -3035,7 +3042,6 @@ static int nested_vmx_check_guest_state(
+        */
+       if (to_vmx(vcpu)->nested.nested_run_pending &&
+           (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_EFER)) {
+-              ia32e = (vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE) != 0;
+               if (CC(!kvm_valid_efer(vcpu, vmcs12->guest_ia32_efer)) ||
+                   CC(ia32e != !!(vmcs12->guest_ia32_efer & EFER_LMA)) ||
+                   CC(((vmcs12->guest_cr0 & X86_CR0_PG) &&
diff --git a/queue-5.10/mptcp-avoid-setting-tcp_close-state-twice.patch b/queue-5.10/mptcp-avoid-setting-tcp_close-state-twice.patch
new file mode 100644 (file)
index 0000000..7c77f61
--- /dev/null
@@ -0,0 +1,35 @@
+From 3ba14528684f528566fb7d956bfbfb958b591d86 Mon Sep 17 00:00:00 2001
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+Date: Thu, 9 Mar 2023 15:50:03 +0100
+Subject: mptcp: avoid setting TCP_CLOSE state twice
+
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+
+commit 3ba14528684f528566fb7d956bfbfb958b591d86 upstream.
+
+tcp_set_state() is called from tcp_done() already.
+
+There is then no need to first set the state to TCP_CLOSE, then call
+tcp_done().
+
+Fixes: d582484726c4 ("mptcp: fix fallback for MP_JOIN subflows")
+Cc: stable@vger.kernel.org
+Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/362
+Acked-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/mptcp/subflow.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/net/mptcp/subflow.c
++++ b/net/mptcp/subflow.c
+@@ -275,7 +275,6 @@ void mptcp_subflow_reset(struct sock *ss
+       struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
+       struct sock *sk = subflow->conn;
+-      tcp_set_state(ssk, TCP_CLOSE);
+       tcp_send_active_reset(ssk, GFP_ATOMIC);
+       tcp_done(ssk);
+       if (!test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &mptcp_sk(sk)->flags) &&
index 02103da5a8b2075debc8fecccd0635115263bb4f..18cedcf57111885fb5090624aa1ea3204cddc7e7 100644 (file)
@@ -58,3 +58,12 @@ tty-serial-fsl_lpuart-skip-waiting-for-transmission-complete-when-uartctrl_sbk-i
 serial-8250_em-fix-uart-port-type.patch
 firmware-xilinx-don-t-make-a-sleepable-memory-allocation-from-an-atomic-context.patch
 interconnect-fix-mem-leak-when-freeing-nodes.patch
+tracing-make-splice_read-available-again.patch
+tracing-check-field-value-in-hist_field_name.patch
+tracing-make-tracepoint-lockdep-check-actually-test-something.patch
+cifs-fix-smb2_set_path_size.patch
+kvm-nvmx-add-missing-consistency-checks-for-cr0-and-cr4.patch
+alsa-hda-intel-dsp-config-add-mtl-pci-id.patch
+alsa-hda-realtek-fix-the-speaker-output-on-samsung-galaxy-book2-pro.patch
+drm-shmem-helper-remove-another-errant-put-in-error-path.patch
+mptcp-avoid-setting-tcp_close-state-twice.patch
diff --git a/queue-5.10/tracing-check-field-value-in-hist_field_name.patch b/queue-5.10/tracing-check-field-value-in-hist_field_name.patch
new file mode 100644 (file)
index 0000000..294f953
--- /dev/null
@@ -0,0 +1,43 @@
+From 9f116f76fa8c04c81aef33ad870dbf9a158e5b70 Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
+Date: Wed, 1 Mar 2023 20:00:53 -0500
+Subject: tracing: Check field value in hist_field_name()
+
+From: Steven Rostedt (Google) <rostedt@goodmis.org>
+
+commit 9f116f76fa8c04c81aef33ad870dbf9a158e5b70 upstream.
+
+The function hist_field_name() cannot handle being passed a NULL field
+parameter. It should never be NULL, but due to a previous bug, NULL was
+passed to the function and the kernel crashed due to a NULL dereference.
+Mark Rutland reported this to me on IRC.
+
+The bug was fixed, but to prevent future bugs from crashing the kernel,
+check the field and add a WARN_ON() if it is NULL.
+
+Link: https://lkml.kernel.org/r/20230302020810.762384440@goodmis.org
+
+Cc: stable@vger.kernel.org
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Reported-by: Mark Rutland <mark.rutland@arm.com>
+Fixes: c6afad49d127f ("tracing: Add hist trigger 'sym' and 'sym-offset' modifiers")
+Tested-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/trace_events_hist.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/kernel/trace/trace_events_hist.c
++++ b/kernel/trace/trace_events_hist.c
+@@ -1087,6 +1087,9 @@ static const char *hist_field_name(struc
+ {
+       const char *field_name = "";
++      if (WARN_ON_ONCE(!field))
++              return field_name;
++
+       if (level > 1)
+               return field_name;
diff --git a/queue-5.10/tracing-make-splice_read-available-again.patch b/queue-5.10/tracing-make-splice_read-available-again.patch
new file mode 100644 (file)
index 0000000..88a866c
--- /dev/null
@@ -0,0 +1,40 @@
+From e400be674a1a40e9dcb2e95f84d6c1fd2d88f31d Mon Sep 17 00:00:00 2001
+From: Sung-hun Kim <sfoon.kim@samsung.com>
+Date: Tue, 14 Mar 2023 10:37:07 +0900
+Subject: tracing: Make splice_read available again
+
+From: Sung-hun Kim <sfoon.kim@samsung.com>
+
+commit e400be674a1a40e9dcb2e95f84d6c1fd2d88f31d upstream.
+
+Since the commit 36e2c7421f02 ("fs: don't allow splice read/write
+without explicit ops") is applied to the kernel, splice() and
+sendfile() calls on the trace file (/sys/kernel/debug/tracing
+/trace) return EINVAL.
+
+This patch restores these system calls by initializing splice_read
+in file_operations of the trace file. This patch only enables such
+functionalities for the read case.
+
+Link: https://lore.kernel.org/linux-trace-kernel/20230314013707.28814-1-sfoon.kim@samsung.com
+
+Cc: stable@vger.kernel.org
+Fixes: 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")
+Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/trace.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -4705,6 +4705,8 @@ loff_t tracing_lseek(struct file *file,
+ static const struct file_operations tracing_fops = {
+       .open           = tracing_open,
+       .read           = seq_read,
++      .read_iter      = seq_read_iter,
++      .splice_read    = generic_file_splice_read,
+       .write          = tracing_write_stub,
+       .llseek         = tracing_lseek,
+       .release        = tracing_release,
diff --git a/queue-5.10/tracing-make-tracepoint-lockdep-check-actually-test-something.patch b/queue-5.10/tracing-make-tracepoint-lockdep-check-actually-test-something.patch
new file mode 100644 (file)
index 0000000..d4e96dd
--- /dev/null
@@ -0,0 +1,86 @@
+From c2679254b9c9980d9045f0f722cf093a2b1f7590 Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
+Date: Fri, 10 Mar 2023 17:28:56 -0500
+Subject: tracing: Make tracepoint lockdep check actually test something
+
+From: Steven Rostedt (Google) <rostedt@goodmis.org>
+
+commit c2679254b9c9980d9045f0f722cf093a2b1f7590 upstream.
+
+A while ago where the trace events had the following:
+
+   rcu_read_lock_sched_notrace();
+   rcu_dereference_sched(...);
+   rcu_read_unlock_sched_notrace();
+
+If the tracepoint is enabled, it could trigger RCU issues if called in
+the wrong place. And this warning was only triggered if lockdep was
+enabled. If the tracepoint was never enabled with lockdep, the bug would
+not be caught. To handle this, the above sequence was done when lockdep
+was enabled regardless if the tracepoint was enabled or not (although the
+always enabled code really didn't do anything, it would still trigger a
+warning).
+
+But a lot has changed since that lockdep code was added. One is, that
+sequence no longer triggers any warning. Another is, the tracepoint when
+enabled doesn't even do that sequence anymore.
+
+The main check we care about today is whether RCU is "watching" or not.
+So if lockdep is enabled, always check if rcu_is_watching() which will
+trigger a warning if it is not (tracepoints require RCU to be watching).
+
+Note, that old sequence did add a bit of overhead when lockdep was enabled,
+and with the latest kernel updates, would cause the system to slow down
+enough to trigger kernel "stalled" warnings.
+
+Link: http://lore.kernel.org/lkml/20140806181801.GA4605@redhat.com
+Link: http://lore.kernel.org/lkml/20140807175204.C257CAC5@viggo.jf.intel.com
+Link: https://lore.kernel.org/lkml/20230307184645.521db5c9@gandalf.local.home/
+Link: https://lore.kernel.org/linux-trace-kernel/20230310172856.77406446@gandalf.local.home
+
+Cc: stable@vger.kernel.org
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Dave Hansen <dave.hansen@linux.intel.com>
+Cc: "Paul E. McKenney" <paulmck@kernel.org>
+Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Cc: Joel Fernandes <joel@joelfernandes.org>
+Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Acked-by: Paul E. McKenney <paulmck@kernel.org>
+Fixes: e6753f23d961 ("tracepoint: Make rcuidle tracepoint callers use SRCU")
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/tracepoint.h |   15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+--- a/include/linux/tracepoint.h
++++ b/include/linux/tracepoint.h
+@@ -234,12 +234,11 @@ static inline struct tracepoint *tracepo
+  * not add unwanted padding between the beginning of the section and the
+  * structure. Force alignment to the same alignment as the section start.
+  *
+- * When lockdep is enabled, we make sure to always do the RCU portions of
+- * the tracepoint code, regardless of whether tracing is on. However,
+- * don't check if the condition is false, due to interaction with idle
+- * instrumentation. This lets us find RCU issues triggered with tracepoints
+- * even when this tracepoint is off. This code has no purpose other than
+- * poking RCU a bit.
++ * When lockdep is enabled, we make sure to always test if RCU is
++ * "watching" regardless if the tracepoint is enabled or not. Tracepoints
++ * require RCU to be active, and it should always warn at the tracepoint
++ * site if it is not watching, as it will need to be active when the
++ * tracepoint is enabled.
+  */
+ #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
+       extern int __traceiter_##name(data_proto);                      \
+@@ -253,9 +252,7 @@ static inline struct tracepoint *tracepo
+                               TP_ARGS(data_args),                     \
+                               TP_CONDITION(cond), 0);                 \
+               if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) {             \
+-                      rcu_read_lock_sched_notrace();                  \
+-                      rcu_dereference_sched(__tracepoint_##name.funcs);\
+-                      rcu_read_unlock_sched_notrace();                \
++                      WARN_ON_ONCE(!rcu_is_watching());               \
+               }                                                       \
+       }                                                               \
+       __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args),          \