]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 15:30:34 +0000 (17:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 15:30:34 +0000 (17:30 +0200)
added patches:
dm-bufio-use-the-acquire-memory-barrier-when-testing-for-b_reading.patch
platform-x86-amd-pmc-read-smu-version-during-suspend-on-cezanne-systems.patch
x86-kconfig-drop-check-for-mabi-ms-for-config_efi_stub.patch
x86-topology-fix-duplicated-core-id-within-a-package.patch
x86-topology-fix-multiple-packages-shown-on-a-single-package-system.patch

queue-6.0/dm-bufio-use-the-acquire-memory-barrier-when-testing-for-b_reading.patch [new file with mode: 0644]
queue-6.0/platform-x86-amd-pmc-read-smu-version-during-suspend-on-cezanne-systems.patch [new file with mode: 0644]
queue-6.0/series
queue-6.0/x86-kconfig-drop-check-for-mabi-ms-for-config_efi_stub.patch [new file with mode: 0644]
queue-6.0/x86-topology-fix-duplicated-core-id-within-a-package.patch [new file with mode: 0644]
queue-6.0/x86-topology-fix-multiple-packages-shown-on-a-single-package-system.patch [new file with mode: 0644]

diff --git a/queue-6.0/dm-bufio-use-the-acquire-memory-barrier-when-testing-for-b_reading.patch b/queue-6.0/dm-bufio-use-the-acquire-memory-barrier-when-testing-for-b_reading.patch
new file mode 100644 (file)
index 0000000..b0155c2
--- /dev/null
@@ -0,0 +1,85 @@
+From 141b3523e9be6f15577acf4bbc3bc1f82d81d6d1 Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Tue, 18 Oct 2022 10:06:45 -0400
+Subject: dm bufio: use the acquire memory barrier when testing for B_READING
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit 141b3523e9be6f15577acf4bbc3bc1f82d81d6d1 upstream.
+
+The function test_bit doesn't provide any memory barrier. It may be
+possible that the read requests that follow test_bit(B_READING, &b->state)
+are reordered before the test, reading invalid data that existed before
+B_READING was cleared.
+
+Fix this bug by changing test_bit to test_bit_acquire. This is
+particularly important on arches with weak(er) memory ordering
+(e.g. arm64).
+
+Depends-On: 8238b4579866 ("wait_on_bit: add an acquire memory barrier")
+Depends-On: d6ffe6067a54 ("provide arch_test_bit_acquire for architectures that define test_bit")
+Cc: stable@vger.kernel.org
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-bufio.c |   13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+--- a/drivers/md/dm-bufio.c
++++ b/drivers/md/dm-bufio.c
+@@ -795,7 +795,8 @@ static void __make_buffer_clean(struct d
+ {
+       BUG_ON(b->hold_count);
+-      if (!b->state)  /* fast case */
++      /* smp_load_acquire() pairs with read_endio()'s smp_mb__before_atomic() */
++      if (!smp_load_acquire(&b->state))       /* fast case */
+               return;
+       wait_on_bit_io(&b->state, B_READING, TASK_UNINTERRUPTIBLE);
+@@ -816,7 +817,7 @@ static struct dm_buffer *__get_unclaimed
+               BUG_ON(test_bit(B_DIRTY, &b->state));
+               if (static_branch_unlikely(&no_sleep_enabled) && c->no_sleep &&
+-                  unlikely(test_bit(B_READING, &b->state)))
++                  unlikely(test_bit_acquire(B_READING, &b->state)))
+                       continue;
+               if (!b->hold_count) {
+@@ -1058,7 +1059,7 @@ found_buffer:
+        * If the user called both dm_bufio_prefetch and dm_bufio_get on
+        * the same buffer, it would deadlock if we waited.
+        */
+-      if (nf == NF_GET && unlikely(test_bit(B_READING, &b->state)))
++      if (nf == NF_GET && unlikely(test_bit_acquire(B_READING, &b->state)))
+               return NULL;
+       b->hold_count++;
+@@ -1218,7 +1219,7 @@ void dm_bufio_release(struct dm_buffer *
+                * invalid buffer.
+                */
+               if ((b->read_error || b->write_error) &&
+-                  !test_bit(B_READING, &b->state) &&
++                  !test_bit_acquire(B_READING, &b->state) &&
+                   !test_bit(B_WRITING, &b->state) &&
+                   !test_bit(B_DIRTY, &b->state)) {
+                       __unlink_buffer(b);
+@@ -1479,7 +1480,7 @@ EXPORT_SYMBOL_GPL(dm_bufio_release_move)
+ static void forget_buffer_locked(struct dm_buffer *b)
+ {
+-      if (likely(!b->hold_count) && likely(!b->state)) {
++      if (likely(!b->hold_count) && likely(!smp_load_acquire(&b->state))) {
+               __unlink_buffer(b);
+               __free_buffer_wake(b);
+       }
+@@ -1639,7 +1640,7 @@ static bool __try_evict_buffer(struct dm
+ {
+       if (!(gfp & __GFP_FS) ||
+           (static_branch_unlikely(&no_sleep_enabled) && b->c->no_sleep)) {
+-              if (test_bit(B_READING, &b->state) ||
++              if (test_bit_acquire(B_READING, &b->state) ||
+                   test_bit(B_WRITING, &b->state) ||
+                   test_bit(B_DIRTY, &b->state))
+                       return false;
diff --git a/queue-6.0/platform-x86-amd-pmc-read-smu-version-during-suspend-on-cezanne-systems.patch b/queue-6.0/platform-x86-amd-pmc-read-smu-version-during-suspend-on-cezanne-systems.patch
new file mode 100644 (file)
index 0000000..2efff29
--- /dev/null
@@ -0,0 +1,50 @@
+From 0b6e6e149c136677f1cc859d4185b5a2db50ffbf Mon Sep 17 00:00:00 2001
+From: Mario Limonciello <mario.limonciello@amd.com>
+Date: Thu, 20 Oct 2022 06:37:49 -0500
+Subject: platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems
+
+From: Mario Limonciello <mario.limonciello@amd.com>
+
+commit 0b6e6e149c136677f1cc859d4185b5a2db50ffbf upstream.
+
+commit b0c07116c894 ("platform/x86: amd-pmc: Avoid reading SMU version at
+probe time") adjusted the behavior for amd-pmc to avoid reading the SMU
+version at startup but rather on first use to improve boot time.
+
+However the SMU version is also used to decide whether to place a timer
+based wakeup in the OS_HINT message. If the idlemask hasn't been read
+before this message was sent then the SMU version will not have been
+cached.
+
+Ensure the SMU version has been read before deciding whether or not to
+run this codepath.
+
+Cc: stable@vger.kernel.org # 6.0
+Reported-by: You-Sheng Yang <vicamo.yang@canonical.com>
+Tested-by: Anson Tsao <anson.tsao@amd.com>
+Fixes: b0c07116c894 ("platform/x86: amd-pmc: Avoid reading SMU version at probe time")
+Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
+Link: https://lore.kernel.org/r/20221020113749.6621-2-mario.limonciello@amd.com
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/platform/x86/amd/pmc.c |    7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/platform/x86/amd/pmc.c
++++ b/drivers/platform/x86/amd/pmc.c
+@@ -635,6 +635,13 @@ static int amd_pmc_verify_czn_rtc(struct
+       struct rtc_time tm;
+       int rc;
++      /* we haven't yet read SMU version */
++      if (!pdev->major) {
++              rc = amd_pmc_get_smu_version(pdev);
++              if (rc)
++                      return rc;
++      }
++
+       if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53))
+               return 0;
index a9cbd5b36418edcc229c429ce5c4eed399f46afa..281a626949eb7bae03e7dbc23da96af728adea6a 100644 (file)
@@ -22,3 +22,8 @@ media-ipu3-imgu-fix-null-pointer-dereference-in-active-selection-access.patch
 media-mceusb-set-timeout-to-at-least-timeout-provided.patch
 media-venus-dec-handle-the-case-where-find_format-fails.patch
 media-venus-fix-nv12-decoder-buffer-discovery-on-hfi_version_1xx.patch
+x86-kconfig-drop-check-for-mabi-ms-for-config_efi_stub.patch
+x86-topology-fix-multiple-packages-shown-on-a-single-package-system.patch
+x86-topology-fix-duplicated-core-id-within-a-package.patch
+platform-x86-amd-pmc-read-smu-version-during-suspend-on-cezanne-systems.patch
+dm-bufio-use-the-acquire-memory-barrier-when-testing-for-b_reading.patch
diff --git a/queue-6.0/x86-kconfig-drop-check-for-mabi-ms-for-config_efi_stub.patch b/queue-6.0/x86-kconfig-drop-check-for-mabi-ms-for-config_efi_stub.patch
new file mode 100644 (file)
index 0000000..6c091b8
--- /dev/null
@@ -0,0 +1,53 @@
+From 33806e7cb8d50379f55c3e8f335e91e1b359dc7b Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Thu, 29 Sep 2022 08:20:10 -0700
+Subject: x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 33806e7cb8d50379f55c3e8f335e91e1b359dc7b upstream.
+
+A recent change in LLVM made CONFIG_EFI_STUB unselectable because it no
+longer pretends to support -mabi=ms, breaking the dependency in
+Kconfig. Lack of CONFIG_EFI_STUB can prevent kernels from booting via
+EFI in certain circumstances.
+
+This check was added by
+
+  8f24f8c2fc82 ("efi/libstub: Annotate firmware routines as __efiapi")
+
+to ensure that __attribute__((ms_abi)) was available, as -mabi=ms is
+not actually used in any cflags.
+
+According to the GCC documentation, this attribute has been supported
+since GCC 4.4.7. The kernel currently requires GCC 5.1 so this check is
+not necessary; even when that change landed in 5.6, the kernel required
+GCC 4.9 so it was unnecessary then as well.
+
+Clang supports __attribute__((ms_abi)) for all versions that are
+supported for building the kernel so no additional check is needed.
+Remove the 'depends on' line altogether to allow CONFIG_EFI_STUB to be
+selected when CONFIG_EFI is enabled, regardless of compiler.
+
+Fixes: 8f24f8c2fc82 ("efi/libstub: Annotate firmware routines as __efiapi")
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Acked-by: Ard Biesheuvel <ardb@kernel.org>
+Cc: stable@vger.kernel.org
+Link: https://github.com/llvm/llvm-project/commit/d1ad006a8f64bdc17f618deffa9e7c91d82c444d
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/Kconfig |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -1961,7 +1961,6 @@ config EFI
+ config EFI_STUB
+       bool "EFI stub support"
+       depends on EFI
+-      depends on $(cc-option,-mabi=ms) || X86_32
+       select RELOCATABLE
+       help
+         This kernel feature allows a bzImage to be loaded directly
diff --git a/queue-6.0/x86-topology-fix-duplicated-core-id-within-a-package.patch b/queue-6.0/x86-topology-fix-duplicated-core-id-within-a-package.patch
new file mode 100644 (file)
index 0000000..d0c7379
--- /dev/null
@@ -0,0 +1,49 @@
+From 71eac7063698b7d7b8fafb1683ac24a034541141 Mon Sep 17 00:00:00 2001
+From: Zhang Rui <rui.zhang@intel.com>
+Date: Fri, 14 Oct 2022 17:01:47 +0800
+Subject: x86/topology: Fix duplicated core ID within a package
+
+From: Zhang Rui <rui.zhang@intel.com>
+
+commit 71eac7063698b7d7b8fafb1683ac24a034541141 upstream.
+
+Today, core ID is assumed to be unique within each package.
+
+But an AlderLake-N platform adds a Module level between core and package,
+Linux excludes the unknown modules bits from the core ID, resulting in
+duplicate core ID's.
+
+To keep core ID unique within a package, Linux must include all APIC-ID
+bits for known or unknown levels above the core and below the package
+in the core ID.
+
+It is important to understand that core ID's have always come directly
+from the APIC-ID encoding, which comes from the BIOS. Thus there is no
+guarantee that they start at 0, or that they are contiguous.
+As such, naively using them for array indexes can be problematic.
+
+[ dhansen: un-known -> unknown ]
+
+Fixes: 7745f03eb395 ("x86/topology: Add CPUID.1F multi-die/package support")
+Suggested-by: Len Brown <len.brown@intel.com>
+Signed-off-by: Zhang Rui <rui.zhang@intel.com>
+Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
+Reviewed-by: Len Brown <len.brown@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/20221014090147.1836-5-rui.zhang@intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/topology.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/cpu/topology.c
++++ b/arch/x86/kernel/cpu/topology.c
+@@ -141,7 +141,7 @@ int detect_extended_topology(struct cpui
+               sub_index++;
+       }
+-      core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
++      core_select_mask = (~(-1 << pkg_mask_width)) >> ht_mask_width;
+       die_select_mask = (~(-1 << die_plus_mask_width)) >>
+                               core_plus_mask_width;
diff --git a/queue-6.0/x86-topology-fix-multiple-packages-shown-on-a-single-package-system.patch b/queue-6.0/x86-topology-fix-multiple-packages-shown-on-a-single-package-system.patch
new file mode 100644 (file)
index 0000000..4caa7e9
--- /dev/null
@@ -0,0 +1,87 @@
+From 2b12a7a126d62bdbd81f4923c21bf6e9a7fbd069 Mon Sep 17 00:00:00 2001
+From: Zhang Rui <rui.zhang@intel.com>
+Date: Fri, 14 Oct 2022 17:01:46 +0800
+Subject: x86/topology: Fix multiple packages shown on a single-package system
+
+From: Zhang Rui <rui.zhang@intel.com>
+
+commit 2b12a7a126d62bdbd81f4923c21bf6e9a7fbd069 upstream.
+
+CPUID.1F/B does not enumerate Package level explicitly, instead, all the
+APIC-ID bits above the enumerated levels are assumed to be package ID
+bits.
+
+Current code gets package ID by shifting out all the APIC-ID bits that
+Linux supports, rather than shifting out all the APIC-ID bits that
+CPUID.1F enumerates. This introduces problems when CPUID.1F enumerates a
+level that Linux does not support.
+
+For example, on a single package AlderLake-N, there are 2 Ecore Modules
+with 4 atom cores in each module.  Linux does not support the Module
+level and interprets the Module ID bits as package ID and erroneously
+reports a multi module system as a multi-package system.
+
+Fix this by using APIC-ID bits above all the CPUID.1F enumerated levels
+as package ID.
+
+[ dhansen: spelling fix ]
+
+Fixes: 7745f03eb395 ("x86/topology: Add CPUID.1F multi-die/package support")
+Suggested-by: Len Brown <len.brown@intel.com>
+Signed-off-by: Zhang Rui <rui.zhang@intel.com>
+Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
+Reviewed-by: Len Brown <len.brown@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/20221014090147.1836-4-rui.zhang@intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/topology.c |   14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+--- a/arch/x86/kernel/cpu/topology.c
++++ b/arch/x86/kernel/cpu/topology.c
+@@ -96,6 +96,7 @@ int detect_extended_topology(struct cpui
+       unsigned int ht_mask_width, core_plus_mask_width, die_plus_mask_width;
+       unsigned int core_select_mask, core_level_siblings;
+       unsigned int die_select_mask, die_level_siblings;
++      unsigned int pkg_mask_width;
+       bool die_level_present = false;
+       int leaf;
+@@ -111,10 +112,10 @@ int detect_extended_topology(struct cpui
+       core_level_siblings = smp_num_siblings = LEVEL_MAX_SIBLINGS(ebx);
+       core_plus_mask_width = ht_mask_width = BITS_SHIFT_NEXT_LEVEL(eax);
+       die_level_siblings = LEVEL_MAX_SIBLINGS(ebx);
+-      die_plus_mask_width = BITS_SHIFT_NEXT_LEVEL(eax);
++      pkg_mask_width = die_plus_mask_width = BITS_SHIFT_NEXT_LEVEL(eax);
+       sub_index = 1;
+-      do {
++      while (true) {
+               cpuid_count(leaf, sub_index, &eax, &ebx, &ecx, &edx);
+               /*
+@@ -132,8 +133,13 @@ int detect_extended_topology(struct cpui
+                       die_plus_mask_width = BITS_SHIFT_NEXT_LEVEL(eax);
+               }
++              if (LEAFB_SUBTYPE(ecx) != INVALID_TYPE)
++                      pkg_mask_width = BITS_SHIFT_NEXT_LEVEL(eax);
++              else
++                      break;
++
+               sub_index++;
+-      } while (LEAFB_SUBTYPE(ecx) != INVALID_TYPE);
++      }
+       core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
+       die_select_mask = (~(-1 << die_plus_mask_width)) >>
+@@ -148,7 +154,7 @@ int detect_extended_topology(struct cpui
+       }
+       c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid,
+-                              die_plus_mask_width);
++                              pkg_mask_width);
+       /*
+        * Reinit the apicid, now that we have extended initial_apicid.
+        */