Skip to contentSkip to conversation

6.13.6-rc1 review

PATCH In review Greg Kroah-Hartman 15 participants 179 messages Mar 5, 2025 – Mar 9, 2025 Page 2 of 2

Subsystems (2)
lore
Share & tools
lore
author maintainer
#158 lore raw

PATCH 148/157 riscv: cpufeature: use bitmap_equal() instead of memcmp()

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Clément Léger <[email protected]>

commit c6ec1e1b078d8e2ecd075e46db6197a14930a3fc upstream.

Comparison of bitmaps should be done using bitmap_equal(), not memcmp(), use the former one to compare isa bitmaps.

---
 arch/riscv/kernel/cpufeature.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/cpufeature.c +1 -1
@@ -475,7 +475,7 @@ static void __init riscv_resolve_isa(uns
 			if (bit < RISCV_ISA_EXT_BASE)
 				*this_hwcap |= isa2hwcap[bit];
 		}
-	} while (loop && memcmp(prev_resolved_isa, resolved_isa, sizeof(prev_resolved_isa)));
+	} while (loop && !bitmap_equal(prev_resolved_isa, resolved_isa, RISCV_ISA_EXT_MAX));
 }
 
 static void __init match_isa_ext(const char *name, const char *name_end, unsigned long *bitmap)
author maintainer
#159 lore raw

PATCH 149/157 efi: Dont map the entire mokvar table to determine its size

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Jones <[email protected]>

commit 2b90e7ace79774a3540ce569e000388f8d22c9e0 upstream.

Currently, when validating the mokvar table, we (re)map the entire table on each iteration of the loop, adding space as we discover new entries. If the table grows over a certain size, this fails due to limitations of early_memmap(), and we get a failure and traceback:

  ------------[ cut here ]------------
  WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:139 __early_ioremap+0xef/0x220
  ...
  Call Trace:
   <TASK>
   ? __early_ioremap+0xef/0x220
   ? __warn.cold+0x93/0xfa
   ? __early_ioremap+0xef/0x220
   ? report_bug+0xff/0x140
   ? early_fixup_exception+0x5d/0xb0
   ? early_idt_handler_common+0x2f/0x3a
   ? __early_ioremap+0xef/0x220
   ? efi_mokvar_table_init+0xce/0x1d0
   ? setup_arch+0x864/0xc10
   ? start_kernel+0x6b/0xa10
   ? x86_64_start_reservations+0x24/0x30
   ? x86_64_start_kernel+0xed/0xf0
   ? common_startup_64+0x13e/0x141
   </TASK>
  ---[ end trace 0000000000000000 ]---
  mokvar: Failed to map EFI MOKvar config table pa=0x7c4c3000, size=265187.

Mapping the entire structure isn't actually necessary, as we don't ever need more than one entry header mapped at once.

Changes efi_mokvar_table_init() to only map each entry header, not the entire table, when determining the table size. Since we're not mapping any data past the variable name, it also changes the code to enforce that each variable name is NUL terminated, rather than attempting to verify it in place.

---
 drivers/firmware/efi/mokvar-table.c |   42 +++++++++++-------------------------
 1 file changed, 13 insertions(+), 29 deletions(-)
drivers/firmware/efi/mokvar-table.c +13 -29
@@ -103,9 +103,7 @@ void __init efi_mokvar_table_init(void)
 	void *va = NULL;
 	unsigned long cur_offset = 0;
 	unsigned long offset_limit;
-	unsigned long map_size = 0;
 	unsigned long map_size_needed = 0;
-	unsigned long size;
 	struct efi_mokvar_table_entry *mokvar_entry;
 	int err;
 
@@ -134,48 +132,34 @@ void __init efi_mokvar_table_init(void)
 	 */
 	err = -EINVAL;
 	while (cur_offset + sizeof(*mokvar_entry) <= offset_limit) {
-		mokvar_entry = va + cur_offset;
-		map_size_needed = cur_offset + sizeof(*mokvar_entry);
-		if (map_size_needed > map_size) {
-			if (va)
-				early_memunmap(va, map_size);
-			/*
-			 * Map a little more than the fixed size entry
-			 * header, anticipating some data. It's safe to
-			 * do so as long as we stay within current memory
-			 * descriptor.
-			 */
-			map_size = min(map_size_needed + 2*EFI_PAGE_SIZE,
-				       offset_limit);
-			va = early_memremap(efi.mokvar_table, map_size);
-			if (!va) {
-				pr_err("Failed to map EFI MOKvar config table pa=0x%lx, size=%lu.\n",
-				       efi.mokvar_table, map_size);
-				return;
-			}
-			mokvar_entry = va + cur_offset;
+		if (va)
+			early_memunmap(va, sizeof(*mokvar_entry));
+		va = early_memremap(efi.mokvar_table + cur_offset, sizeof(*mokvar_entry));
+		if (!va) {
+			pr_err("Failed to map EFI MOKvar config table pa=0x%lx, size=%zu.\n",
+			       efi.mokvar_table + cur_offset, sizeof(*mokvar_entry));
+			return;
 		}
+		mokvar_entry = va;
 
 		/* Check for last sentinel entry */
 		if (mokvar_entry->name[0] == '\0') {
 			if (mokvar_entry->data_size != 0)
 				break;
 			err = 0;
+			map_size_needed = cur_offset + sizeof(*mokvar_entry);
 			break;
 		}
 
-		/* Sanity check that the name is null terminated */
-		size = strnlen(mokvar_entry->name,
-			       sizeof(mokvar_entry->name));
-		if (size >= sizeof(mokvar_entry->name))
-			break;
+		/* Enforce that the name is NUL terminated */
+		mokvar_entry->name[sizeof(mokvar_entry->name) - 1] = '\0';
 
 		/* Advance to the next entry */
-		cur_offset = map_size_needed + mokvar_entry->data_size;
+		cur_offset += sizeof(*mokvar_entry) + mokvar_entry->data_size;
 	}
 
 	if (va)
-		early_memunmap(va, map_size);
+		early_memunmap(va, sizeof(*mokvar_entry));
 	if (err) {
 		pr_err("EFI MOKvar config table is not valid\n");
 		return;
author maintainer
#160 lore raw

PATCH 150/157 x86/microcode/AMD: Return bool from find_blobs_in_containers()

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Nikolay Borisov <[email protected]>

commit a85c08aaa665b5436d325f6d7138732a0e1315ce upstream.

Instead of open-coding the check for size/data move it inside the function and make it return a boolean indicating whether data was found or not.

No functional changes.

[ bp: Write @ret in find_blobs_in_containers() only on success. ]

---
 arch/x86/kernel/cpu/microcode/amd.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +9 -6
@@ -569,14 +569,19 @@ static bool get_builtin_microcode(struct
 	return false;
 }
 
-static void __init find_blobs_in_containers(struct cpio_data *ret)
+static bool __init find_blobs_in_containers(struct cpio_data *ret)
 {
 	struct cpio_data cp;
+	bool found;
 
 	if (!get_builtin_microcode(&cp))
 		cp = find_microcode_in_initrd(ucode_path);
 
-	*ret = cp;
+	found = cp.data && cp.size;
+	if (found)
+		*ret = cp;
+
+	return found;
 }
 
 void __init load_ucode_amd_bsp(struct early_load_data *ed, unsigned int cpuid_1_eax)
@@ -591,8 +596,7 @@ void __init load_ucode_amd_bsp(struct ea
 	/* Needed in load_microcode_amd() */
 	ucode_cpu_info[0].cpu_sig.sig = cpuid_1_eax;
 
-	find_blobs_in_containers(&cp);
-	if (!(cp.data && cp.size))
+	if (!find_blobs_in_containers(&cp))
 		return;
 
 	if (early_apply_microcode(ed->old_rev, cp.data, cp.size))
@@ -612,8 +616,7 @@ static int __init save_microcode_in_init
 	if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)
 		return 0;
 
-	find_blobs_in_containers(&cp);
-	if (!(cp.data && cp.size))
+	if (!find_blobs_in_containers(&cp))
 		return -EINVAL;
 
 	scan_containers(cp.data, cp.size, &desc);
author maintainer
#161 lore raw

PATCH 151/157 x86/microcode/AMD: Have __apply_microcode_amd() return bool

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Borislav Petkov (AMD)" <[email protected]>

commit 78e0aadbd4c6807a06a9d25bc190fe515d3f3c42 upstream

This is the natural thing to do anyway.

No functional changes.

---
 arch/x86/kernel/cpu/microcode/amd.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +6 -6
@@ -484,7 +484,7 @@ static void scan_containers(u8 *ucode, s
 	}
 }
 
-static int __apply_microcode_amd(struct microcode_amd *mc, unsigned int psize)
+static bool __apply_microcode_amd(struct microcode_amd *mc, unsigned int psize)
 {
 	unsigned long p_addr = (unsigned long)&mc->hdr.data_code;
 	u32 rev, dummy;
@@ -508,9 +508,9 @@ static int __apply_microcode_amd(struct
 	native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
 
 	if (rev != mc->hdr.patch_id)
-		return -1;
+		return false;
 
-	return 0;
+	return true;
 }
 
 /*
@@ -544,7 +544,7 @@ static bool early_apply_microcode(u32 ol
 	if (old_rev > mc->hdr.patch_id)
 		return ret;
 
-	return !__apply_microcode_amd(mc, desc.psize);
+	return __apply_microcode_amd(mc, desc.psize);
 }
 
 static bool get_builtin_microcode(struct cpio_data *cp)
@@ -763,7 +763,7 @@ void reload_ucode_amd(unsigned int cpu)
 	rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
 
 	if (rev < mc->hdr.patch_id) {
-		if (!__apply_microcode_amd(mc, p->size))
+		if (__apply_microcode_amd(mc, p->size))
 			pr_info_once("reload revision: 0x%08x\n", mc->hdr.patch_id);
 	}
 }
@@ -816,7 +816,7 @@ static enum ucode_state apply_microcode_
 		goto out;
 	}
 
-	if (__apply_microcode_amd(mc_amd, p->size)) {
+	if (!__apply_microcode_amd(mc_amd, p->size)) {
 		pr_err("CPU%d: update failed for patch_level=0x%08x\n",
 			cpu, mc_amd->hdr.patch_id);
 		return UCODE_ERROR;
author maintainer
#162 lore raw

PATCH 152/157 x86/microcode/AMD: Remove ugly linebreak in __verify_patch_section() signature

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Borislav Petkov (AMD)" <[email protected]>

commit 7103f0589ac220eac3d2b1e8411494b31b883d06 upstream.

No functional changes.

---
 arch/x86/kernel/cpu/microcode/amd.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +1 -2
@@ -246,8 +246,7 @@ static bool verify_equivalence_table(con
  * On success, @sh_psize returns the patch size according to the section header,
  * to the caller.
  */
-static bool
-__verify_patch_section(const u8 *buf, size_t buf_size, u32 *sh_psize)
+static bool __verify_patch_section(const u8 *buf, size_t buf_size, u32 *sh_psize)
 {
 	u32 p_type, p_size;
 	const u32 *hdr;
author maintainer
#136 lore raw

PATCH 126/157 iommu/vt-d: Fix suspicious RCU usage

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lu Baolu <[email protected]>

commit b150654f74bf0df8e6a7936d5ec51400d9ec06d8 upstream.

Commit <d74169ceb0d2> ("iommu/vt-d: Allocate DMAR fault interrupts locally") moved the call to enable_drhd_fault_handling() to a code path that does not hold any lock while traversing the drhd list. Fix it by ensuring the dmar_global_lock lock is held when traversing the drhd list.

Without this fix, the following warning is triggered:
=============================
WARNING: suspicious RCU usage
6.14.0-rc3 #55 Not tainted
-----------------------------
drivers/iommu/intel/dmar.c:2046 RCU-list traversed in non-reader section!!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 1
2 locks held by cpuhp/1/23:
#0: ffffffff84a67c50 (cpu_hotplug_lock){++++}-{0:0}, at: cpuhp_thread_fun+0x87/0x2c0 #1: ffffffff84a6a380 (cpuhp_state-up){+.+.}-{0:0}, at: cpuhp_thread_fun+0x87/0x2c0

 stack backtrace:
 CPU: 1 UID: 0 PID: 23 Comm: cpuhp/1 Not tainted 6.14.0-rc3 #55
 Call Trace:
  <TASK>
  dump_stack_lvl+0xb7/0xd0
  lockdep_rcu_suspicious+0x159/0x1f0
  ? __pfx_enable_drhd_fault_handling+0x10/0x10
  enable_drhd_fault_handling+0x151/0x180
  cpuhp_invoke_callback+0x1df/0x990
  cpuhp_thread_fun+0x1ea/0x2c0
  smpboot_thread_fn+0x1f5/0x2e0
  ? __pfx_smpboot_thread_fn+0x10/0x10
  kthread+0x12a/0x2d0
  ? __pfx_kthread+0x10/0x10
  ret_from_fork+0x4a/0x60
  ? __pfx_kthread+0x10/0x10
  ret_from_fork_asm+0x1a/0x30
  </TASK>

Holding the lock in enable_drhd_fault_handling() triggers a lockdep splat about a possible deadlock between dmar_global_lock and cpu_hotplug_lock. This is avoided by not holding dmar_global_lock when calling iommu_device_register(), which initiates the device probe process.

---
 drivers/iommu/intel/dmar.c  |    1 +
 drivers/iommu/intel/iommu.c |    7 +++++++
 2 files changed, 8 insertions(+)
drivers/iommu/intel/dmar.c +1 -0
@@ -2043,6 +2043,7 @@ int enable_drhd_fault_handling(unsigned
 	/*
 	 * Enable fault control interrupt.
 	 */
+	guard(rwsem_read)(&dmar_global_lock);
 	for_each_iommu(iommu, drhd) {
 		u32 fault_status;
 		int ret;
drivers/iommu/intel/iommu.c +7 -0
@@ -3155,7 +3155,14 @@ int __init intel_iommu_init(void)
 		iommu_device_sysfs_add(&iommu->iommu, NULL,
 				       intel_iommu_groups,
 				       "%s", iommu->name);
+		/*
+		 * The iommu device probe is protected by the iommu_probe_device_lock.
+		 * Release the dmar_global_lock before entering the device probe path
+		 * to avoid unnecessary lock order splat.
+		 */
+		up_read(&dmar_global_lock);
 		iommu_device_register(&iommu->iommu, &intel_iommu_ops, NULL);
+		down_read(&dmar_global_lock);
 
 		iommu_pmu_register(iommu);
 	}
author maintainer
#163 lore raw

PATCH 153/157 x86/microcode/AMD: Remove unused save_microcode_in_initrd_amd() declarations

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Borislav Petkov (AMD)" <[email protected]>

commit 3ef0740d10b005a45e8ae5b4b7b5d37bfddf63c0 upstream.

Commit

a7939f016720 ("x86/microcode/amd: Cache builtin/initrd microcode early")

renamed it to save_microcode_in_initrd() and made it static. Zap the forgotten declarations.

No functional changes.

---
 arch/x86/kernel/cpu/microcode/amd.c      |    2 +-
 arch/x86/kernel/cpu/microcode/internal.h |    2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +1 -1
@@ -517,7 +517,7 @@ static bool __apply_microcode_amd(struct
  * patch container file in initrd, traverse equivalent cpu table, look for a
  * matching microcode patch, and update, all in initrd memory in place.
  * When vmalloc() is available for use later -- on 64-bit during first AP load,
- * and on 32-bit during save_microcode_in_initrd_amd() -- we can call
+ * and on 32-bit during save_microcode_in_initrd() -- we can call
  * load_microcode_amd() to save equivalent cpu table and microcode patches in
  * kernel heap memory.
  *
arch/x86/kernel/cpu/microcode/internal.h +0 -2
@@ -100,14 +100,12 @@ extern bool force_minrev;
 #ifdef CONFIG_CPU_SUP_AMD
 void load_ucode_amd_bsp(struct early_load_data *ed, unsigned int family);
 void load_ucode_amd_ap(unsigned int family);
-int save_microcode_in_initrd_amd(unsigned int family);
 void reload_ucode_amd(unsigned int cpu);
 struct microcode_ops *init_amd_microcode(void);
 void exit_amd_microcode(void);
 #else /* CONFIG_CPU_SUP_AMD */
 static inline void load_ucode_amd_bsp(struct early_load_data *ed, unsigned int family) { }
 static inline void load_ucode_amd_ap(unsigned int family) { }
-static inline int save_microcode_in_initrd_amd(unsigned int family) { return -EINVAL; }
 static inline void reload_ucode_amd(unsigned int cpu) { }
 static inline struct microcode_ops *init_amd_microcode(void) { return NULL; }
 static inline void exit_amd_microcode(void) { }
author maintainer
#164 lore raw

PATCH 154/157 x86/microcode/AMD: Merge early_apply_microcode() into its single callsite

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Borislav Petkov (AMD)" <[email protected]>

commit dc15675074dcfd79a2f10a6e39f96b0244961a01 upstream.

No functional changes.

---
 arch/x86/kernel/cpu/microcode/amd.c |   60 +++++++++++++++---------------------
 1 file changed, 26 insertions(+), 34 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +26 -34
@@ -512,39 +512,6 @@ static bool __apply_microcode_amd(struct
 	return true;
 }
 
-/*
- * Early load occurs before we can vmalloc(). So we look for the microcode
- * patch container file in initrd, traverse equivalent cpu table, look for a
- * matching microcode patch, and update, all in initrd memory in place.
- * When vmalloc() is available for use later -- on 64-bit during first AP load,
- * and on 32-bit during save_microcode_in_initrd() -- we can call
- * load_microcode_amd() to save equivalent cpu table and microcode patches in
- * kernel heap memory.
- *
- * Returns true if container found (sets @desc), false otherwise.
- */
-static bool early_apply_microcode(u32 old_rev, void *ucode, size_t size)
-{
-	struct cont_desc desc = { 0 };
-	struct microcode_amd *mc;
-	bool ret = false;
-
-	scan_containers(ucode, size, &desc);
-
-	mc = desc.mc;
-	if (!mc)
-		return ret;
-
-	/*
-	 * Allow application of the same revision to pick up SMT-specific
-	 * changes even if the revision of the other SMT thread is already
-	 * up-to-date.
-	 */
-	if (old_rev > mc->hdr.patch_id)
-		return ret;
-
-	return __apply_microcode_amd(mc, desc.psize);
-}
 
 static bool get_builtin_microcode(struct cpio_data *cp)
 {
@@ -583,8 +550,19 @@ static bool __init find_blobs_in_contain
 	return found;
 }
 
+/*
+ * Early load occurs before we can vmalloc(). So we look for the microcode
+ * patch container file in initrd, traverse equivalent cpu table, look for a
+ * matching microcode patch, and update, all in initrd memory in place.
+ * When vmalloc() is available for use later -- on 64-bit during first AP load,
+ * and on 32-bit during save_microcode_in_initrd() -- we can call
+ * load_microcode_amd() to save equivalent cpu table and microcode patches in
+ * kernel heap memory.
+ */
 void __init load_ucode_amd_bsp(struct early_load_data *ed, unsigned int cpuid_1_eax)
 {
+	struct cont_desc desc = { };
+	struct microcode_amd *mc;
 	struct cpio_data cp = { };
 	u32 dummy;
 
@@ -598,7 +576,21 @@ void __init load_ucode_amd_bsp(struct ea
 	if (!find_blobs_in_containers(&cp))
 		return;
 
-	if (early_apply_microcode(ed->old_rev, cp.data, cp.size))
+	scan_containers(cp.data, cp.size, &desc);
+
+	mc = desc.mc;
+	if (!mc)
+		return;
+
+	/*
+	 * Allow application of the same revision to pick up SMT-specific
+	 * changes even if the revision of the other SMT thread is already
+	 * up-to-date.
+	 */
+	if (ed->old_rev > mc->hdr.patch_id)
+		return;
+
+	if (__apply_microcode_amd(mc, desc.psize))
 		native_rdmsr(MSR_AMD64_PATCH_LEVEL, ed->new_rev, dummy);
 }
 
author maintainer
#165 lore raw

PATCH 155/157 x86/microcode/AMD: Get rid of the _load_microcode_amd() forward declaration

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Borislav Petkov (AMD)" <[email protected]>

commit b39c387164879eef71886fc93cee5ca7dd7bf500 upstream.

Simply move save_microcode_in_initrd() down.

No functional changes.

---
 arch/x86/kernel/cpu/microcode/amd.c |   54 +++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 28 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +26 -28
@@ -594,34 +594,6 @@ void __init load_ucode_amd_bsp(struct ea
 		native_rdmsr(MSR_AMD64_PATCH_LEVEL, ed->new_rev, dummy);
 }
 
-static enum ucode_state _load_microcode_amd(u8 family, const u8 *data, size_t size);
-
-static int __init save_microcode_in_initrd(void)
-{
-	unsigned int cpuid_1_eax = native_cpuid_eax(1);
-	struct cpuinfo_x86 *c = &boot_cpu_data;
-	struct cont_desc desc = { 0 };
-	enum ucode_state ret;
-	struct cpio_data cp;
-
-	if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)
-		return 0;
-
-	if (!find_blobs_in_containers(&cp))
-		return -EINVAL;
-
-	scan_containers(cp.data, cp.size, &desc);
-	if (!desc.mc)
-		return -EINVAL;
-
-	ret = _load_microcode_amd(x86_family(cpuid_1_eax), desc.data, desc.size);
-	if (ret > UCODE_UPDATED)
-		return -EINVAL;
-
-	return 0;
-}
-early_initcall(save_microcode_in_initrd);
-
 static inline bool patch_cpus_equivalent(struct ucode_patch *p,
 					 struct ucode_patch *n,
 					 bool ignore_stepping)
@@ -1005,6 +977,32 @@ static enum ucode_state load_microcode_a
 	return ret;
 }
 
+static int __init save_microcode_in_initrd(void)
+{
+	unsigned int cpuid_1_eax = native_cpuid_eax(1);
+	struct cpuinfo_x86 *c = &boot_cpu_data;
+	struct cont_desc desc = { 0 };
+	enum ucode_state ret;
+	struct cpio_data cp;
+
+	if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)
+		return 0;
+
+	if (!find_blobs_in_containers(&cp))
+		return -EINVAL;
+
+	scan_containers(cp.data, cp.size, &desc);
+	if (!desc.mc)
+		return -EINVAL;
+
+	ret = _load_microcode_amd(x86_family(cpuid_1_eax), desc.data, desc.size);
+	if (ret > UCODE_UPDATED)
+		return -EINVAL;
+
+	return 0;
+}
+early_initcall(save_microcode_in_initrd);
+
 /*
  * AMD microcode firmware naming convention, up to family 15h they are in
  * the legacy file:
author maintainer
#166 lore raw

PATCH 156/157 x86/microcode/AMD: Add get_patch_level()

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Borislav Petkov (AMD)" <[email protected]>

commit 037e81fb9d2dfe7b31fd97e5f578854e38f09887 upstream.

Put the MSR_AMD64_PATCH_LEVEL reading of the current microcode revision the hw has, into a separate function.

---
 arch/x86/kernel/cpu/microcode/amd.c |   46 ++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 22 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +24 -22
@@ -145,6 +145,15 @@ ucode_path[] __maybe_unused = "kernel/x8
  */
 static u32 bsp_cpuid_1_eax __ro_after_init;
 
+static u32 get_patch_level(void)
+{
+	u32 rev, dummy __always_unused;
+
+	native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
+
+	return rev;
+}
+
 static union cpuid_1_eax ucode_rev_to_cpuid(unsigned int val)
 {
 	union zen_patch_rev p;
@@ -483,10 +492,10 @@ static void scan_containers(u8 *ucode, s
 	}
 }
 
-static bool __apply_microcode_amd(struct microcode_amd *mc, unsigned int psize)
+static bool __apply_microcode_amd(struct microcode_amd *mc, u32 *cur_rev,
+				  unsigned int psize)
 {
 	unsigned long p_addr = (unsigned long)&mc->hdr.data_code;
-	u32 rev, dummy;
 
 	native_wrmsrl(MSR_AMD64_PATCH_LOADER, p_addr);
 
@@ -504,9 +513,8 @@ static bool __apply_microcode_amd(struct
 	}
 
 	/* verify patch application was successful */
-	native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
-
-	if (rev != mc->hdr.patch_id)
+	*cur_rev = get_patch_level();
+	if (*cur_rev != mc->hdr.patch_id)
 		return false;
 
 	return true;
@@ -564,11 +572,12 @@ void __init load_ucode_amd_bsp(struct ea
 	struct cont_desc desc = { };
 	struct microcode_amd *mc;
 	struct cpio_data cp = { };
-	u32 dummy;
+	u32 rev;
 
 	bsp_cpuid_1_eax = cpuid_1_eax;
 
-	native_rdmsr(MSR_AMD64_PATCH_LEVEL, ed->old_rev, dummy);
+	rev = get_patch_level();
+	ed->old_rev = rev;
 
 	/* Needed in load_microcode_amd() */
 	ucode_cpu_info[0].cpu_sig.sig = cpuid_1_eax;
@@ -590,8 +599,8 @@ void __init load_ucode_amd_bsp(struct ea
 	if (ed->old_rev > mc->hdr.patch_id)
 		return;
 
-	if (__apply_microcode_amd(mc, desc.psize))
-		native_rdmsr(MSR_AMD64_PATCH_LEVEL, ed->new_rev, dummy);
+	if (__apply_microcode_amd(mc, &rev, desc.psize))
+		ed->new_rev = rev;
 }
 
 static inline bool patch_cpus_equivalent(struct ucode_patch *p,
@@ -693,14 +702,9 @@ static void free_cache(void)
 static struct ucode_patch *find_patch(unsigned int cpu)
 {
 	struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
-	u32 rev, dummy __always_unused;
 	u16 equiv_id = 0;
 
-	/* fetch rev if not populated yet: */
-	if (!uci->cpu_sig.rev) {
-		rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
-		uci->cpu_sig.rev = rev;
-	}
+	uci->cpu_sig.rev = get_patch_level();
 
 	if (x86_family(bsp_cpuid_1_eax) < 0x17) {
 		equiv_id = find_equiv_id(&equiv_table, uci->cpu_sig.sig);
@@ -723,22 +727,20 @@ void reload_ucode_amd(unsigned int cpu)
 
 	mc = p->data;
 
-	rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
-
+	rev = get_patch_level();
 	if (rev < mc->hdr.patch_id) {
-		if (__apply_microcode_amd(mc, p->size))
-			pr_info_once("reload revision: 0x%08x\n", mc->hdr.patch_id);
+		if (__apply_microcode_amd(mc, &rev, p->size))
+			pr_info_once("reload revision: 0x%08x\n", rev);
 	}
 }
 
 static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
 {
-	struct cpuinfo_x86 *c = &cpu_data(cpu);
 	struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
 	struct ucode_patch *p;
 
 	csig->sig = cpuid_eax(0x00000001);
-	csig->rev = c->microcode;
+	csig->rev = get_patch_level();
 
 	/*
 	 * a patch could have been loaded early, set uci->mc so that
@@ -779,7 +781,7 @@ static enum ucode_state apply_microcode_
 		goto out;
 	}
 
-	if (!__apply_microcode_amd(mc_amd, p->size)) {
+	if (!__apply_microcode_amd(mc_amd, &rev, p->size)) {
 		pr_err("CPU%d: update failed for patch_level=0x%08x\n",
 			cpu, mc_amd->hdr.patch_id);
 		return UCODE_ERROR;
author maintainer
#167 lore raw

PATCH 157/157 x86/microcode/AMD: Load only SHA256-checksummed patches

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Borislav Petkov (AMD)" <[email protected]>

commit 50cef76d5cb0e199cda19f026842560f6eedc4f7 upstream.

Load patches for which the driver carries a SHA256 checksum of the patch blob.

This can be disabled by adding "microcode.amd_sha_check=off" on the kernel cmdline. But it is highly NOT recommended.

---
 arch/x86/Kconfig                         |    1 
 arch/x86/kernel/cpu/microcode/amd.c      |  111 +++++++
 arch/x86/kernel/cpu/microcode/amd_shas.c |  444 +++++++++++++++++++++++++++++++
 3 files changed, 554 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/kernel/cpu/microcode/amd_shas.c
arch/x86/Kconfig +1 -0
@@ -1336,6 +1336,7 @@ config X86_REBOOTFIXUPS
 config MICROCODE
 	def_bool y
 	depends on CPU_SUP_AMD || CPU_SUP_INTEL
+	select CRYPTO_LIB_SHA256 if CPU_SUP_AMD
 
 config MICROCODE_INITRD32
 	def_bool y
arch/x86/kernel/cpu/microcode/amd.c +109 -2

151 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/amd_shas.c new file +444 -0

444 lines not on this page · raw message

author maintainer
#137 lore raw

PATCH 127/157 amdgpu/pm/legacy: fix suspend/resume issues

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: chr[] <[email protected]>

commit 91dcc66b34beb72dde8412421bdc1b4cd40e4fb8 upstream.

resume and irq handler happily races in set_power_state()

* amdgpu_legacy_dpm_compute_clocks() needs lock
* protect irq work handler
* fix dpm_enabled usage

v2: fix clang build, integrate Lijo's comments (Alex)

Fixes 3712e7a49459 ("drm/amd/pm: unified lock protections in amdgpu_dpm.c")
(cherry picked from commit ee3dc9e204d271c9c7a8d4d38a0bce4745d33e71)
---
 drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c     |   25 ++++++++++++++++++------
 drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c |    8 +++++--
 drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c     |   26 +++++++++++++++++++------
 3 files changed, 45 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c +19 -6
@@ -3042,6 +3042,7 @@ static int kv_dpm_hw_init(struct amdgpu_
 	if (!amdgpu_dpm)
 		return 0;
 
+	mutex_lock(&adev->pm.mutex);
 	kv_dpm_setup_asic(adev);
 	ret = kv_dpm_enable(adev);
 	if (ret)
@@ -3049,6 +3050,8 @@ static int kv_dpm_hw_init(struct amdgpu_
 	else
 		adev->pm.dpm_enabled = true;
 	amdgpu_legacy_dpm_compute_clocks(adev);
+	mutex_unlock(&adev->pm.mutex);
+
 	return ret;
 }
 
@@ -3066,32 +3069,42 @@ static int kv_dpm_suspend(struct amdgpu_
 {
 	struct amdgpu_device *adev = ip_block->adev;
 
+	cancel_work_sync(&adev->pm.dpm.thermal.work);
+
 	if (adev->pm.dpm_enabled) {
+		mutex_lock(&adev->pm.mutex);
+		adev->pm.dpm_enabled = false;
 		/* disable dpm */
 		kv_dpm_disable(adev);
 		/* reset the power state */
 		adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps;
+		mutex_unlock(&adev->pm.mutex);
 	}
 	return 0;
 }
 
 static int kv_dpm_resume(struct amdgpu_ip_block *ip_block)
 {
-	int ret;
+	int ret = 0;
 	struct amdgpu_device *adev = ip_block->adev;
 
-	if (adev->pm.dpm_enabled) {
+	if (!amdgpu_dpm)
+		return 0;
+
+	if (!adev->pm.dpm_enabled) {
+		mutex_lock(&adev->pm.mutex);
 		/* asic init will reset to the boot state */
 		kv_dpm_setup_asic(adev);
 		ret = kv_dpm_enable(adev);
-		if (ret)
+		if (ret) {
 			adev->pm.dpm_enabled = false;
-		else
+		} else {
 			adev->pm.dpm_enabled = true;
-		if (adev->pm.dpm_enabled)
 			amdgpu_legacy_dpm_compute_clocks(adev);
+		}
+		mutex_unlock(&adev->pm.mutex);
 	}
-	return 0;
+	return ret;
 }
 
 static bool kv_dpm_is_idle(void *handle)
drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c +6 -2
@@ -1009,9 +1009,12 @@ void amdgpu_dpm_thermal_work_handler(str
 	enum amd_pm_state_type dpm_state = POWER_STATE_TYPE_INTERNAL_THERMAL;
 	int temp, size = sizeof(temp);
 
-	if (!adev->pm.dpm_enabled)
-		return;
+	mutex_lock(&adev->pm.mutex);
 
+	if (!adev->pm.dpm_enabled) {
+		mutex_unlock(&adev->pm.mutex);
+		return;
+	}
 	if (!pp_funcs->read_sensor(adev->powerplay.pp_handle,
 				   AMDGPU_PP_SENSOR_GPU_TEMP,
 				   (void *)&temp,
@@ -1033,4 +1036,5 @@ void amdgpu_dpm_thermal_work_handler(str
 	adev->pm.dpm.state = dpm_state;
 
 	amdgpu_legacy_dpm_compute_clocks(adev->powerplay.pp_handle);
+	mutex_unlock(&adev->pm.mutex);
 }
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +20 -6
@@ -7785,6 +7785,7 @@ static int si_dpm_hw_init(struct amdgpu_
 	if (!amdgpu_dpm)
 		return 0;
 
+	mutex_lock(&adev->pm.mutex);
 	si_dpm_setup_asic(adev);
 	ret = si_dpm_enable(adev);
 	if (ret)
@@ -7792,6 +7793,7 @@ static int si_dpm_hw_init(struct amdgpu_
 	else
 		adev->pm.dpm_enabled = true;
 	amdgpu_legacy_dpm_compute_clocks(adev);
+	mutex_unlock(&adev->pm.mutex);
 	return ret;
 }
 
@@ -7809,32 +7811,44 @@ static int si_dpm_suspend(struct amdgpu_
 {
 	struct amdgpu_device *adev = ip_block->adev;
 
+	cancel_work_sync(&adev->pm.dpm.thermal.work);
+
 	if (adev->pm.dpm_enabled) {
+		mutex_lock(&adev->pm.mutex);
+		adev->pm.dpm_enabled = false;
 		/* disable dpm */
 		si_dpm_disable(adev);
 		/* reset the power state */
 		adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps;
+		mutex_unlock(&adev->pm.mutex);
 	}
+
 	return 0;
 }
 
 static int si_dpm_resume(struct amdgpu_ip_block *ip_block)
 {
-	int ret;
+	int ret = 0;
 	struct amdgpu_device *adev = ip_block->adev;
 
-	if (adev->pm.dpm_enabled) {
+	if (!amdgpu_dpm)
+		return 0;
+
+	if (!adev->pm.dpm_enabled) {
 		/* asic init will reset to the boot state */
+		mutex_lock(&adev->pm.mutex);
 		si_dpm_setup_asic(adev);
 		ret = si_dpm_enable(adev);
-		if (ret)
+		if (ret) {
 			adev->pm.dpm_enabled = false;
-		else
+		} else {
 			adev->pm.dpm_enabled = true;
-		if (adev->pm.dpm_enabled)
 			amdgpu_legacy_dpm_compute_clocks(adev);
+		}
+		mutex_unlock(&adev->pm.mutex);
 	}
-	return 0;
+
+	return ret;
 }
 
 static bool si_dpm_is_idle(void *handle)
author maintainer
#138 lore raw

PATCH 128/157 intel_idle: Handle older CPUs, which stop the TSC in deeper C states, correctly

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <[email protected]>

commit c157d351460bcf202970e97e611cb6b54a3dd4a4 upstream.

The Intel idle driver is preferred over the ACPI processor idle driver, but fails to implement the work around for Core2 generation CPUs, where the TSC stops in C2 and deeper C-states. This causes stalls and boot delays, when the clocksource watchdog does not catch the unstable TSC before the CPU goes deep idle for the first time.

The ACPI driver marks the TSC unstable when it detects that the CPU supports C2 or deeper and the CPU does not have a non-stop TSC.

Add the equivivalent work around to the Intel idle driver to cure that.

---
 drivers/idle/intel_idle.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/idle/intel_idle.c +4 -0
@@ -55,6 +55,7 @@
 #include <asm/intel-family.h>
 #include <asm/mwait.h>
 #include <asm/spec-ctrl.h>
+#include <asm/tsc.h>
 #include <asm/fpu/api.h>
 
 #define INTEL_IDLE_VERSION "0.5.1"
@@ -1797,6 +1798,9 @@ static void __init intel_idle_init_cstat
 		if (intel_idle_state_needs_timer_stop(state))
 			state->flags |= CPUIDLE_FLAG_TIMER_STOP;
 
+		if (cx->type > ACPI_STATE_C1 && !boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
+			mark_tsc_unstable("TSC halts in idle");
+
 		state->enter = intel_idle;
 		state->enter_s2idle = intel_idle_s2idle;
 	}
author maintainer
#139 lore raw

PATCH 129/157 mptcp: always handle address removal under msk socket lock

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Paolo Abeni <[email protected]>

commit f865c24bc55158313d5779fc81116023a6940ca3 upstream.

Syzkaller reported a lockdep splat in the PM control path:

  WARNING: CPU: 0 PID: 6693 at ./include/net/sock.h:1711 sock_owned_by_me include/net/sock.h:1711 [inline]
  WARNING: CPU: 0 PID: 6693 at ./include/net/sock.h:1711 msk_owned_by_me net/mptcp/protocol.h:363 [inline]
  WARNING: CPU: 0 PID: 6693 at ./include/net/sock.h:1711 mptcp_pm_nl_addr_send_ack+0x57c/0x610 net/mptcp/pm_netlink.c:788
  Modules linked in:
  CPU: 0 UID: 0 PID: 6693 Comm: syz.0.205 Not tainted 6.14.0-rc2-syzkaller-00303-gad1b832bf1cf #0
  Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
  RIP: 0010:sock_owned_by_me include/net/sock.h:1711 [inline]
  RIP: 0010:msk_owned_by_me net/mptcp/protocol.h:363 [inline]
  RIP: 0010:mptcp_pm_nl_addr_send_ack+0x57c/0x610 net/mptcp/pm_netlink.c:788
  Code: 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 ca 7b d3 f5 eb b9 e8 c3 7b d3 f5 90 0f 0b 90 e9 dd fb ff ff e8 b5 7b d3 f5 90 <0f> 0b 90 e9 3e fb ff ff 44 89 f1 80 e1 07 38 c1 0f 8c eb fb ff ff
  RSP: 0000:ffffc900034f6f60 EFLAGS: 00010283
  RAX: ffffffff8bee3c2b RBX: 0000000000000001 RCX: 0000000000080000
  RDX: ffffc90004d42000 RSI: 000000000000a407 RDI: 000000000000a408
  RBP: ffffc900034f7030 R08: ffffffff8bee37f6 R09: 0100000000000000
  R10: dffffc0000000000 R11: ffffed100bcc62e4 R12: ffff88805e6316e0
  R13: ffff88805e630c00 R14: dffffc0000000000 R15: ffff88805e630c00
  FS:  00007f7e9a7e96c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000001b2fd18ff8 CR3: 0000000032c24000 CR4: 00000000003526f0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
   <TASK>
   mptcp_pm_remove_addr+0x103/0x1d0 net/mptcp/pm.c:59
   mptcp_pm_remove_anno_addr+0x1f4/0x2f0 net/mptcp/pm_netlink.c:1486
   mptcp_nl_remove_subflow_and_signal_addr net/mptcp/pm_netlink.c:1518 [inline]
   mptcp_pm_nl_del_addr_doit+0x118d/0x1af0 net/mptcp/pm_netlink.c:1629
   genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline]
   genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
   genl_rcv_msg+0xb1f/0xec0 net/netlink/genetlink.c:1210
   netlink_rcv_skb+0x206/0x480 net/netlink/af_netlink.c:2543
   genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
   netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
   netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1348
   netlink_sendmsg+0x8de/0xcb0 net/netlink/af_netlink.c:1892
   sock_sendmsg_nosec net/socket.c:718 [inline]
   __sock_sendmsg+0x221/0x270 net/socket.c:733
   ____sys_sendmsg+0x53a/0x860 net/socket.c:2573
   ___sys_sendmsg net/socket.c:2627 [inline]
   __sys_sendmsg+0x269/0x350 net/socket.c:2659
   do_syscall_x64 arch/x86/entry/common.c:52 [inline]
   do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
   entry_SYSCALL_64_after_hwframe+0x77/0x7f
  RIP: 0033:0x7f7e9998cde9
  Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
  RSP: 002b:00007f7e9a7e9038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
  RAX: ffffffffffffffda RBX: 00007f7e99ba5fa0 RCX: 00007f7e9998cde9
  RDX: 000000002000c094 RSI: 0000400000000000 RDI: 0000000000000007
  RBP: 00007f7e99a0e2a0 R08: 0000000000000000 R09: 0000000000000000
  R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
  R13: 0000000000000000 R14: 00007f7e99ba5fa0 R15: 00007fff49231088

Indeed the PM can try to send a RM_ADDR over a msk without acquiring first the msk socket lock.

The bugged code-path comes from an early optimization: when there are no subflows, the PM should (usually) not send RM_ADDR notifications.

The above statement is incorrect, as without locks another process could concurrent create a new subflow and cause the RM_ADDR generation.

Additionally the supposed optimization is not very effective even performance-wise, as most mptcp sockets should have at least one
subflow: the MPC one.

Address the issue removing the buggy code path, the existing "slow-path" will handle correctly even the edge case.

---
 net/mptcp/pm_netlink.c |    5 -----
 1 file changed, 5 deletions(-)
net/mptcp/pm_netlink.c +0 -5
@@ -1514,11 +1514,6 @@ static int mptcp_nl_remove_subflow_and_s
 		if (mptcp_pm_is_userspace(msk))
 			goto next;
 
-		if (list_empty(&msk->conn_list)) {
-			mptcp_pm_remove_anno_addr(msk, addr, false);
-			goto next;
-		}
-
 		lock_sock(sk);
 		remove_subflow = lookup_subflow_by_saddr(&msk->conn_list, addr);
 		mptcp_pm_remove_anno_addr(msk, addr, remove_subflow &&
author maintainer
#140 lore raw

PATCH 130/157 mptcp: reset when MPTCP opts are dropped after join

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Matthieu Baerts (NGI0) <[email protected]>

commit 8668860b0ad32a13fcd6c94a0995b7aa7638c9ef upstream.

Before this patch, if the checksum was not used, the subflow was only reset if map_data_len was != 0. If there were no MPTCP options or an invalid mapping, map_data_len was not set to the data len, and then the subflow was not reset as it should have been, leaving the MPTCP connection in a wrong fallback mode.

This map_data_len condition has been introduced to handle the reception of the infinite mapping. Instead, a new dedicated mapping error could have been returned and treated as a special case. However, the commit 31bf11de146c ("mptcp: introduce MAPPING_BAD_CSUM") has been introduced by Paolo Abeni soon after, and backported later on to stable. It better handle the csum case, and it means the exception for valid_csum_seen in subflow_can_fallback(), plus this one for the infinite mapping in subflow_check_data_avail(), are no longer needed.

In other words, the code can be simplified there: a fallback should only be done if msk->allow_infinite_fallback is set. This boolean is set to false once MPTCP-specific operations acting on the whole MPTCP connection vs the initial path have been done, e.g. a second path has been created, or an MPTCP re-injection -- yes, possible even with a single subflow. The subflow_can_fallback() helper can then be dropped, and replaced by this single condition.

This also makes the code clearer: a fallback should only be done if it is possible to do so.

While at it, no need to set map_data_len to 0 in get_mapping_status() for the infinite mapping case: it will be set to skb->len just after, at the end of subflow_check_data_avail(), and not read in between.

---
 net/mptcp/subflow.c |   15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
net/mptcp/subflow.c +1 -14
@@ -1142,7 +1142,6 @@ static enum mapping_status get_mapping_s
 	if (data_len == 0) {
 		pr_debug("infinite mapping received\n");
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX);
-		subflow->map_data_len = 0;
 		return MAPPING_INVALID;
 	}
 
@@ -1286,18 +1285,6 @@ static void subflow_sched_work_if_closed
 		mptcp_schedule_work(sk);
 }
 
-static bool subflow_can_fallback(struct mptcp_subflow_context *subflow)
-{
-	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
-
-	if (subflow->mp_join)
-		return false;
-	else if (READ_ONCE(msk->csum_enabled))
-		return !subflow->valid_csum_seen;
-	else
-		return READ_ONCE(msk->allow_infinite_fallback);
-}
-
 static void mptcp_subflow_fail(struct mptcp_sock *msk, struct sock *ssk)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
@@ -1393,7 +1380,7 @@ fallback:
 			return true;
 		}
 
-		if (!subflow_can_fallback(subflow) && subflow->map_data_len) {
+		if (!READ_ONCE(msk->allow_infinite_fallback)) {
 			/* fatal protocol error, close the socket.
 			 * subflow_error_report() will introduce the appropriate barriers
 			 */
author maintainer
#141 lore raw

PATCH 131/157 selftests/landlock: Test that MPTCP actions are not restricted

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Mikhail Ivanov <[email protected]>

commit 3d4033985ff508ef587ca11f1c8361ba57c7e09f upstream.

Extend protocol fixture with test suits for MPTCP protocol. Add CONFIG_MPTCP and CONFIG_MPTCP_IPV6 options in config.

---
 tools/testing/selftests/landlock/config     |    2 +
 tools/testing/selftests/landlock/net_test.c |   44 ++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
tools/testing/selftests/landlock/config +2 -0
@@ -3,6 +3,8 @@ CONFIG_CGROUP_SCHED=y
 CONFIG_INET=y
 CONFIG_IPV6=y
 CONFIG_KEYS=y
+CONFIG_MPTCP=y
+CONFIG_MPTCP_IPV6=y
 CONFIG_NET=y
 CONFIG_NET_NS=y
 CONFIG_OVERLAY_FS=y
tools/testing/selftests/landlock/net_test.c +44 -0

68 lines not on this page · raw message

author maintainer
#142 lore raw

PATCH 132/157 vmlinux.lds: Ensure that const vars with relocations are mapped R/O

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ard Biesheuvel <[email protected]>

commit 68f3ea7ee199ef77551e090dfef5a49046ea8443 upstream.

In the kernel, there are architectures (x86, arm64) that perform boot-time relocation (for KASLR) without relying on PIE codegen. In this case, all const global objects are emitted into .rodata, including const objects with fields that will be fixed up by the boot-time relocation code. This implies that .rodata (and .text in some cases) need to be writable at boot, but they will usually be mapped read-only as soon as the boot completes.

When using PIE codegen, the compiler will emit const global objects into .data.rel.ro rather than .rodata if the object contains fields that need such fixups at boot-time. This permits the linker to annotate such regions as requiring read-write access only at load time, but not at execution time (in user space), while keeping .rodata truly const (in user space, this is important for reducing the CoW footprint of dynamic executables).

This distinction does not matter for the kernel, but it does imply that const data will end up in writable memory if the .data.rel.ro sections are not treated in a special way, as they will end up in the writable .data segment by default.

So emit .data.rel.ro into the .rodata segment.

---
 include/asm-generic/vmlinux.lds.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/vmlinux.lds.h +1 -1
@@ -457,7 +457,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
 		__start_rodata = .;					\
-		*(.rodata) *(.rodata.*)					\
+		*(.rodata) *(.rodata.*) *(.data.rel.ro*)		\
 		SCHED_DATA						\
 		RO_AFTER_INIT_DATA	/* Read only after init */	\
 		. = ALIGN(8);						\
author maintainer
#133 lore raw

PATCH 123/157 phy: exynos5-usbdrd: gs101: ensure power is gated to SS phy in phy_exit()

In reply to Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: André Draszik <[email protected]>

commit 8789b4296aa796f658a19cac7d27365012893de1 upstream.

We currently don't gate the power to the SS phy in phy_exit().

Shuffle the code slightly to ensure the power is gated to the SS phy as well.

Fixes 32267c29bc7d ("phy: exynos5-usbdrd: support Exynos USBDRD 3.1 combo phy (HS & SS)")
---
 drivers/phy/samsung/phy-exynos5-usbdrd.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/phy/samsung/phy-exynos5-usbdrd.c +8 -5
@@ -1296,14 +1296,17 @@ static int exynos5_usbdrd_gs101_phy_exit
 	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
 	int ret;
 
+	if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) {
+		ret = exynos850_usbdrd_phy_exit(phy);
+		if (ret)
+			return ret;
+	}
+
+	exynos5_usbdrd_phy_isol(inst, true);
+
 	if (inst->phy_cfg->id != EXYNOS5_DRDPHY_UTMI)
 		return 0;
 
-	ret = exynos850_usbdrd_phy_exit(phy);
-	if (ret)
-		return ret;
-
-	exynos5_usbdrd_phy_isol(inst, true);
 	return regulator_bulk_disable(phy_drd->drv_data->n_regulators,
 				      phy_drd->regulators);
 }
#169 lore raw
Quoted 4 lines · Ronald Warsow

Hi Greg

no regressions here on x86_64 (RKL, Intel 11th Gen. CPU)

Quoted 8 lines

Thanks

P.S.

is it necessary to have all cc'ed user informed or should I leave them off ?

Normally, people leave the cc list. It is quite important to keep the cc list at least for failures, so we can debug them together :-).

BR,
Pavel

Signature · 2 lines
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#170 lore raw
In reply to Greg Kroah-Hartman
Quoted 4 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.13.6 release. There are 157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

The arm64 defconfig build is broken (KernelCI reported this initially):

/build/stage/linux/arch/arm64/mm/hugetlbpage.c: In function ‘huge_ptep_get_and_clear’:
/build/stage/linux/arch/arm64/mm/hugetlbpage.c:397:35: error: ‘sz’ undeclared (first use in this function); did you mean ‘s8’?

  397 |         ncontig = num_contig_ptes(sz, &pgsize);
      |                                   ^~
      |                                   s8

/build/stage/linux/arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in

The same issue affects 6.12.

maintainer Tested-by on the v1 series
#172 lore raw
In reply to Greg Kroah-Hartman

Hello,

Quoted 7 lines · On Wed, 5 Mar 2025 18:47:16 +0100 Greg Kroah-Hartman…

This is the start of the stable review cycle for the 6.13.6 release. There are 157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Fri, 07 Mar 2025 17:44:26 +0000. Anything received after that time might be too late.

This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].

[1] https://github.com/damonitor/damon-tests/tree/next/corr
[2] 30be4aa8b957 ("Linux 6.13.6-rc1")

Thanks,
SJ

[...]

---

ok 9 selftests: damon: damos_tried_regions.py
ok 10 selftests: damon: damon_nr_regions.py
ok 11 selftests: damon: reclaim.sh
ok 12 selftests: damon: lru_sort.sh
ok 13 selftests: damon: debugfs_empty_targets.sh
ok 14 selftests: damon: debugfs_huge_count_read_write.sh
ok 15 selftests: damon: debugfs_duplicate_context_creation.sh ok 16 selftests: damon: debugfs_rm_non_contexts.sh
ok 17 selftests: damon: debugfs_target_ids_read_before_terminate_race.sh ok 18 selftests: damon: debugfs_target_ids_pid_leak.sh
ok 19 selftests: damon: sysfs_update_removed_scheme_dir.sh
ok 20 selftests: damon: sysfs_update_schemes_tried_regions_hang.py ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_arm64.sh # SKIP
ok 12 selftests: damon-tests: build_m68k.sh # SKIP
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m

Tested-by on the v1 series
#173 lore raw
In reply to Greg Kroah-Hartman

Am 05.03.2025 um 18:47 schrieb Greg Kroah-Hartman:

Quoted 4 lines

This is the start of the stable review cycle for the 6.13.6 release. There are 157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.

Beste Grüße,
Peter Schneider

Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge,
enjoy the air and behold the view. Climb it so you can see the world,
not so the world can see you.                    -- David McCullough Jr.

OpenPGP:  0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244
Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc
https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
#53 lore raw

Re: [PATCH 6.13 052/157] drm/xe: cancel pending job timer before freeing scheduler

In reply to Greg Kroah-Hartman
Quoted 2 lines · Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

We just got CI report on this patch, can you please hold off on backporting this.

Thanks!

Matt

Quoted 46 lines

------------------

From: Tejas Upadhyay <[email protected]>

[ Upstream commit 12c2f962fe71f390951d9242725bc7e608f55927 ]

The async call to __guc_exec_queue_fini_async frees the scheduler while a submission may time out and restart. To prevent this race condition, the pending job timer should be canceled before freeing the scheduler.

V3(MattB):
- Adjust position of cancel pending job
- Remove gitlab issue# from commit message
V2(MattB):
- Cancel pending jobs before scheduler finish

Fixes a20c75dba192 ("drm/xe: Call __guc_exec_queue_fini_async direct for KERNEL exec_queues")
(cherry picked from commit 18fbd567e75f9b97b699b2ab4f1fa76b7cf268f6)
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/xe/xe_guc_submit.c +2 -0
index 6f4a9812b4f4a..fe17e9ba86725 100644
@@ -1238,6 +1238,8 @@ static void __guc_exec_queue_fini_async(struct work_struct *w)
 
 	if (xe_exec_queue_is_lr(q))
 		cancel_work_sync(&ge->lr_tdr);
+	/* Confirm no work left behind accessing device structures */
+	cancel_delayed_work_sync(&ge->sched.base.work_tdr);
 	release_guc_id(guc, q);
 	xe_sched_entity_fini(&ge->entity);
 	xe_sched_fini(&ge->sched);
Signature · 1 line
2.39.5
Tested-by on the v1 series
#174 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.13.6 release. There are 157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Fri, 07 Mar 2025 17:44:26 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.13.6-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.13.y
and the diffstat can be found below.

thanks,

greg k-h

Built and booted successfully on RISC-V RV64 (HiFive Unmatched).

#104 lore raw

Re: [PATCH 6.13 100/157] arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes

In reply to Greg Kroah-Hartman
Quoted 131 lines · Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ryan Roberts <[email protected]>

commit 49c87f7677746f3c5bd16c81b23700bb6b88bfd4 upstream.

arm64 supports multiple huge_pte sizes. Some of the sizes are covered by a single pte entry at a particular level (PMD_SIZE, PUD_SIZE), and some are covered by multiple ptes at a particular level (CONT_PTE_SIZE, CONT_PMD_SIZE). So the function has to figure out the size from the huge_pte pointer. This was previously done by walking the pgtable to determine the level and by using the PTE_CONT bit to determine the number of ptes at the level.

But the PTE_CONT bit is only valid when the pte is present. For non-present pte values (e.g. markers, migration entries), the previous implementation was therefore erroneously determining the size. There is at least one known caller in core-mm, move_huge_pte(), which may call huge_ptep_get_and_clear() for a non-present pte. So we must be robust to this case. Additionally the "regular" ptep_get_and_clear() is robust to being called for non-present ptes so it makes sense to follow the behavior.

Fix this by using the new sz parameter which is now provided to the function. Additionally when clearing each pte in a contig range, don't gather the access and dirty bits if the pte is not present.

An alternative approach that would not require API changes would be to store the PTE_CONT bit in a spare bit in the swap entry pte for the non-present case. But it felt cleaner to follow other APIs' lead and just pass in the size.

As an aside, PTE_CONT is bit 52, which corresponds to bit 40 in the swap entry offset field (layout of non-present pte). Since hugetlb is never swapped to disk, this field will only be populated for markers, which always set this bit to 0 and hwpoison swap entries, which set the offset field to a PFN; So it would only ever be 1 for a 52-bit PVA system where memory in that high half was poisoned (I think!). So in practice, this bit would almost always be zero for non-present ptes and we would only clear the first entry if it was actually a contiguous block. That's probably a less severe symptom than if it was always interpreted as 1 and cleared out potentially-present neighboring PTEs.

---
  arch/arm64/mm/hugetlbpage.c |   51 ++++++++++++++++----------------------------
  1 file changed, 19 insertions(+), 32 deletions(-)
arch/arm64/mm/hugetlbpage.c +18 -26
@@ -100,20 +100,11 @@ static int find_num_contig(struct mm_str
 
  static inline int num_contig_ptes(unsigned long size, size_t *pgsize)
  {
-	int contig_ptes = 0;
+	int contig_ptes = 1;
 
  	*pgsize = size;
 
  	switch (size) {
-#ifndef __PAGETABLE_PMD_FOLDED
-	case PUD_SIZE:
-		if (pud_sect_supported())
-			contig_ptes = 1;
-		break;
-#endif
-	case PMD_SIZE:
-		contig_ptes = 1;
-		break;
  	case CONT_PMD_SIZE:
  		*pgsize = PMD_SIZE;
  		contig_ptes = CONT_PMDS;
@@ -122,6 +113,8 @@ static inline int num_contig_ptes(unsign
  		*pgsize = PAGE_SIZE;
  		contig_ptes = CONT_PTES;
  		break;
+	default:
+		WARN_ON(!__hugetlb_valid_size(size));
  	}
 
  	return contig_ptes;
@@ -163,24 +156,23 @@ static pte_t get_clear_contig(struct mm_
  			     unsigned long pgsize,
  			     unsigned long ncontig)
  {
-	pte_t orig_pte = __ptep_get(ptep);
-	unsigned long i;
+	pte_t pte, tmp_pte;
+	bool present;
 
-	for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) {
-		pte_t pte = __ptep_get_and_clear(mm, addr, ptep);
-
-		/*
-		 * If HW_AFDBM is enabled, then the HW could turn on
-		 * the dirty or accessed bit for any page in the set,
-		 * so check them all.
-		 */
-		if (pte_dirty(pte))
-			orig_pte = pte_mkdirty(orig_pte);
-
-		if (pte_young(pte))
-			orig_pte = pte_mkyoung(orig_pte);
+	pte = __ptep_get_and_clear(mm, addr, ptep);
+	present = pte_present(pte);
+	while (--ncontig) {
+		ptep++;
+		addr += pgsize;
+		tmp_pte = __ptep_get_and_clear(mm, addr, ptep);
+		if (present) {
+			if (pte_dirty(tmp_pte))
+				pte = pte_mkdirty(pte);
+			if (pte_young(tmp_pte))
+				pte = pte_mkyoung(pte);
+		}
  	}
-	return orig_pte;
+	return pte;
  }
 
  static pte_t get_clear_contig_flush(struct mm_struct *mm,
@@ -401,13 +393,8 @@ pte_t huge_ptep_get_and_clear(struct mm_
  {

arch/arm64/mm/hugetlbpage.c pte_t huge_ptep_get_and_clear(struct mm_ · line 397

Quoted 10 lines
arch/arm64/mm/hugetlbpage.c +1 -6
  	int ncontig;
  	size_t pgsize;
-	pte_t orig_pte = __ptep_get(ptep);
-
-	if (!pte_cont(orig_pte))
-		return __ptep_get_and_clear(mm, addr, ptep);
-
-	ncontig = find_num_contig(mm, addr, ptep, &pgsize);
 
+	ncontig = num_contig_ptes(sz, &pgsize);

This fails to build:

/usr/bin/gcc-current/gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048] /usr/bin/aarch64-suse-linux-gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048] run_oldconfig.sh --check... PASS
Build... FAIL
+ make -j48 -s -C /dev/shm/kbuild/linux.34170/current ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-suse-linux- clean arch/arm64/mm/hugetlbpage.c:397:35: error: 'sz' undeclared (first use in this function); did you mean 's8'?
| s8
arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [scripts/Makefile.build:197: arch/arm64/mm/hugetlbpage.o] Error 1

Quoted 6 lines
arch/arm64/mm/hugetlbpage.c +0 -0
  	return get_clear_contig(mm, addr, ptep, pgsize, ncontig);
  }
 
Signature · 2 lines
js
suse labs
#105 lore raw

Re: [PATCH 6.13 100/157] arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes

Quoted 8 lines · Jiri Slaby
Quoted 7 lines · Greg Kroah-Hartman

6.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ryan Roberts <[email protected]>

commit 49c87f7677746f3c5bd16c81b23700bb6b88bfd4 upstream.

...

Quoted 15 lines

arch/arm64/mm/hugetlbpage.c pte_t huge_ptep_get_and_clear(struct mm_ · line 396

Quoted 11 lines
arch/arm64/mm/hugetlbpage.c +1 -6
@@ -401,13 +393,8 @@ pte_t huge_ptep_get_and_clear(struct mm_
   {
       int ncontig;
       size_t pgsize;
-    pte_t orig_pte = __ptep_get(ptep);
-
-    if (!pte_cont(orig_pte))
-        return __ptep_get_and_clear(mm, addr, ptep);
-
-    ncontig = find_num_contig(mm, addr, ptep, &pgsize);
+    ncontig = num_contig_ptes(sz, &pgsize);

This fails to build:

Quoted 10 lines

/usr/bin/gcc-current/gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048] /usr/bin/aarch64-suse-linux-gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048] run_oldconfig.sh --check... PASS
Build...                    FAIL
+ make -j48 -s -C /dev/shm/kbuild/linux.34170/current ARCH=arm64
HOSTCC=gcc CROSS_COMPILE=aarch64-suse-linux- clean
arch/arm64/mm/hugetlbpage.c:397:35: error: 'sz' undeclared (first use in this function); did you mean 's8'?
      |                                   s8
arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [scripts/Makefile.build:197: arch/arm64/mm/hugetlbpage.o] Error 1

It looks like the stable tree is missing this pre-req:
commit 02410ac72ac3707936c07ede66e94360d0d65319

Author: Ryan Roberts <[email protected]>
Date:   Wed Feb 26 12:06:51 2025 +0000

mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear()

Quoted 7 lines
Quoted 6 lines
arch/arm64/mm/hugetlbpage.c +0 -0
       return get_clear_contig(mm, addr, ptep, pgsize, ncontig);
   }
 
 
Signature · 2 lines
js
suse labs
#106 lore raw

Re: [PATCH 6.13 100/157] arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes

Quoted 40 lines · Jiri Slaby
Quoted 8 lines · Jiri Slaby
Quoted 7 lines · Greg Kroah-Hartman

6.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ryan Roberts <[email protected]>

commit 49c87f7677746f3c5bd16c81b23700bb6b88bfd4 upstream.

...

Quoted 15 lines

arch/arm64/mm/hugetlbpage.c pte_t huge_ptep_get_and_clear(struct mm_ · line 396

Quoted 11 lines
arch/arm64/mm/hugetlbpage.c +1 -6
@@ -401,13 +393,8 @@ pte_t huge_ptep_get_and_clear(struct mm_
   {
       int ncontig;
       size_t pgsize;
-    pte_t orig_pte = __ptep_get(ptep);
-
-    if (!pte_cont(orig_pte))
-        return __ptep_get_and_clear(mm, addr, ptep);
-
-    ncontig = find_num_contig(mm, addr, ptep, &pgsize);
+    ncontig = num_contig_ptes(sz, &pgsize);

This fails to build:

Quoted 14 lines

/usr/bin/gcc-current/gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048] /usr/bin/aarch64-suse-linux-gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048]
run_oldconfig.sh --check... PASS
Build...                    FAIL
+ make -j48 -s -C /dev/shm/kbuild/linux.34170/current ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-suse-linux- clean arch/arm64/mm/hugetlbpage.c:397:35: error: 'sz' undeclared (first use in this function); did you mean 's8'?
       |                                   s8 arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [scripts/Makefile.build:197: arch/arm64/mm/hugetlbpage.o] Error 1

Quoted 6 lines

It looks like the stable tree is missing this pre-req:
commit 02410ac72ac3707936c07ede66e94360d0d65319
Author: Ryan Roberts <[email protected]> Date:   Wed Feb 26 12:06:51 2025 +0000

    mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear()

Although this patch is marked for stable there was a conflict so it wasn't applied. I'll try to get the backport done in the next few days.

Thanks,
Ryan

Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
arch/arm64/mm/hugetlbpage.c +0 -0
       return get_clear_contig(mm, addr, ptep, pgsize, ncontig);
   }
 
 
author maintainer
#107 lore raw

Re: [PATCH 6.13 100/157] arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes

Quoted 46 lines · Ryan Roberts
Quoted 45 lines · Jiri Slaby
Quoted 8 lines · Jiri Slaby
Quoted 7 lines · Greg Kroah-Hartman

6.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ryan Roberts <[email protected]>

commit 49c87f7677746f3c5bd16c81b23700bb6b88bfd4 upstream.

...

Quoted 15 lines

arch/arm64/mm/hugetlbpage.c pte_t huge_ptep_get_and_clear(struct mm_ · line 396

Quoted 11 lines
arch/arm64/mm/hugetlbpage.c +1 -6
@@ -401,13 +393,8 @@ pte_t huge_ptep_get_and_clear(struct mm_
   {
       int ncontig;
       size_t pgsize;
-    pte_t orig_pte = __ptep_get(ptep);
-
-    if (!pte_cont(orig_pte))
-        return __ptep_get_and_clear(mm, addr, ptep);
-
-    ncontig = find_num_contig(mm, addr, ptep, &pgsize);
+    ncontig = num_contig_ptes(sz, &pgsize);

This fails to build:

Quoted 14 lines

/usr/bin/gcc-current/gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048] /usr/bin/aarch64-suse-linux-gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048]
run_oldconfig.sh --check... PASS
Build...                    FAIL
+ make -j48 -s -C /dev/shm/kbuild/linux.34170/current ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-suse-linux- clean arch/arm64/mm/hugetlbpage.c:397:35: error: 'sz' undeclared (first use in this function); did you mean 's8'?
       |                                   s8 arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [scripts/Makefile.build:197: arch/arm64/mm/hugetlbpage.o] Error 1

It looks like the stable tree is missing this pre-req:
commit 02410ac72ac3707936c07ede66e94360d0d65319
Author: Ryan Roberts <[email protected]> Date:   Wed Feb 26 12:06:51 2025 +0000

Quoted 4 lines
Quoted 1 line

    mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear()

Although this patch is marked for stable there was a conflict so it wasn't applied. I'll try to get the backport done in the next few days.

I'll just drop this one now, can you send me the backports for both of these when they are ready?

thanks,

greg k-h

#108 lore raw

Re: [PATCH 6.13 100/157] arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes

Quoted 47 lines · Greg Kroah-Hartman
Quoted 46 lines · Ryan Roberts
Quoted 45 lines · Jiri Slaby
Quoted 8 lines · Jiri Slaby
Quoted 7 lines · Greg Kroah-Hartman

6.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ryan Roberts <[email protected]>

commit 49c87f7677746f3c5bd16c81b23700bb6b88bfd4 upstream.

...

Quoted 15 lines

arch/arm64/mm/hugetlbpage.c pte_t huge_ptep_get_and_clear(struct mm_ · line 396

Quoted 11 lines
arch/arm64/mm/hugetlbpage.c +1 -6
@@ -401,13 +393,8 @@ pte_t huge_ptep_get_and_clear(struct mm_
   {
       int ncontig;
       size_t pgsize;
-    pte_t orig_pte = __ptep_get(ptep);
-
-    if (!pte_cont(orig_pte))
-        return __ptep_get_and_clear(mm, addr, ptep);
-
-    ncontig = find_num_contig(mm, addr, ptep, &pgsize);
+    ncontig = num_contig_ptes(sz, &pgsize);

This fails to build:

Quoted 14 lines

/usr/bin/gcc-current/gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048] /usr/bin/aarch64-suse-linux-gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048]
run_oldconfig.sh --check... PASS
Build...                    FAIL
+ make -j48 -s -C /dev/shm/kbuild/linux.34170/current ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-suse-linux- clean arch/arm64/mm/hugetlbpage.c:397:35: error: 'sz' undeclared (first use in this function); did you mean 's8'?
       |                                   s8
arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [scripts/Makefile.build:197: arch/arm64/mm/hugetlbpage.o] Error 1

It looks like the stable tree is missing this pre-req:
commit 02410ac72ac3707936c07ede66e94360d0d65319
Author: Ryan Roberts <[email protected]> Date:   Wed Feb 26 12:06:51 2025 +0000

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

    mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear()

Although this patch is marked for stable there was a conflict so it wasn't applied. I'll try to get the backport done in the next few days.

I'll just drop this one now, can you send me the backports for both of these when they are ready?

FWIW, the series were three patches, not sure if later "101/157] arm64: hugetlb: Fix flush_hugetlb_tlb_range() invalidation level" is affected when either of the two discussed here is not present...

So perhaps drop both 100+101/157 for now?

thanks,

Signature · 2 lines
js
suse labs
#175 lore raw
In reply to Greg Kroah-Hartman
Quoted 10 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.13.6 release. There are 157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Fri, 07 Mar 2025 17:44:26 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
        https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.13.6-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.13.y
and the diffstat can be found below.

thanks,

greg k-h

Regressions on arm64 the defconfig builds failed with clang-20 and gcc-13 the stable-rc d 6.13.6-rc1 and 6.12.18-rc1.

First seen on the 6.13.6-rc1
Good: v6.13.3
Bad: 6.13.6-rc1

* arm64, build
- clang-20-defconfig
- clang-nightly-defconfig
- gcc-13-defconfig
- gcc-8-defconfig

Regression Analysis:
- New regression? Yes
- Reproducibility? Yes

This commit is causing build regressions,
arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes commit 49c87f7677746f3c5bd16c81b23700bb6b88bfd4 upstream.

Build regression: arm64 hugetlbpage.c undeclared identifier 'sz'

## Build log
arch/arm64/mm/hugetlbpage.c:397:28: error: use of undeclared identifier 'sz'
397 | ncontig = num_contig_ptes(sz, &pgsize);
| ^
1 error generated.

## Source
* Kernel version: 6.13.6-rc1
* Git tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* Git sha: 30be4aa8b95762886fc27cf2a9931e14bce269d4
* Git describe: v6.13.3-555-g30be4aa8b957
* Project details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.13.y/build/v6.13.3-555-g30be4aa8b957

## Build
* Build log: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.13.y/build/v6.13.3-555-g30be4aa8b957/testrun/27516541/suite/build/test/clang-20-defconfig/log
* Build history:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.13.y/build/v6.13.3-555-g30be4aa8b957/testrun/27516541/suite/build/test/clang-20-defconfig/history/
* Build details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.13.y/build/v6.13.3-555-g30be4aa8b957/testrun/27516541/suite/build/test/clang-20-defconfig/details/
* Build link: https://storage.tuxsuite.com/public/linaro/lkft/builds/2tuRCFN4wc8W1MqNki1qddcwCF3/
* Kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2tuRCFN4wc8W1MqNki1qddcwCF3/config

## Steps to reproduce
- tuxmake --runtime podman --target-arch arm64 --toolchain clang-20
--kconfig defconfig LLVM=1 LLVM_IAS=1

--
Linaro LKFT
https://lkft.linaro.org

Tested-by on the v1 series
#176 lore raw
In reply to Greg Kroah-Hartman

Hi Greg

Quoted 10 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.13.6 release. There are 157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Fri, 07 Mar 2025 17:44:26 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 9 lines
        https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.13.6-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.13.y
and the diffstat can be found below.

thanks,

greg k-h

6.13.6-rc1 tested.

Build successfully completed.
Boot successfully completed.
No dmesg regressions.
Video output normal.
Sound output normal.

Lenovo ThinkPad X1 Carbon Gen10(Intel i7-1260P(x86_64) arch linux)

[    0.000000] Linux version 6.13.6-rc1rv-g30be4aa8b957

(takeshi@ThinkPadX1Gen10J0764) (gcc (GCC) 14.2.1 20250207, GNU ld (GNU Binutils) 2.44) #1 SMP PREEMPT_DYNAMIC Thu Mar 6 20:52:49 JST 2025

Thanks

#110 lore raw

Re: [PATCH 6.13 100/157] arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes

In reply to Greg Kroah-Hartman
Quoted 47 lines · Greg Kroah-Hartman
Quoted 46 lines · Ryan Roberts
Quoted 45 lines · Jiri Slaby
Quoted 8 lines · Jiri Slaby
Quoted 7 lines · Greg Kroah-Hartman

6.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ryan Roberts <[email protected]>

commit 49c87f7677746f3c5bd16c81b23700bb6b88bfd4 upstream.

...

Quoted 15 lines

arch/arm64/mm/hugetlbpage.c pte_t huge_ptep_get_and_clear(struct mm_ · line 396

Quoted 11 lines
arch/arm64/mm/hugetlbpage.c +1 -6
@@ -401,13 +393,8 @@ pte_t huge_ptep_get_and_clear(struct mm_
   {
       int ncontig;
       size_t pgsize;
-    pte_t orig_pte = __ptep_get(ptep);
-
-    if (!pte_cont(orig_pte))
-        return __ptep_get_and_clear(mm, addr, ptep);
-
-    ncontig = find_num_contig(mm, addr, ptep, &pgsize);
+    ncontig = num_contig_ptes(sz, &pgsize);

This fails to build:

Quoted 14 lines

/usr/bin/gcc-current/gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048] /usr/bin/aarch64-suse-linux-gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048]
run_oldconfig.sh --check... PASS
Build...                    FAIL
+ make -j48 -s -C /dev/shm/kbuild/linux.34170/current ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-suse-linux- clean arch/arm64/mm/hugetlbpage.c:397:35: error: 'sz' undeclared (first use in this function); did you mean 's8'?
       |                                   s8 arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [scripts/Makefile.build:197: arch/arm64/mm/hugetlbpage.o] Error 1

It looks like the stable tree is missing this pre-req:
commit 02410ac72ac3707936c07ede66e94360d0d65319
Author: Ryan Roberts <[email protected]> Date:   Wed Feb 26 12:06:51 2025 +0000

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

    mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear()

Although this patch is marked for stable there was a conflict so it wasn't applied. I'll try to get the backport done in the next few days.

I'll just drop this one now, can you send me the backports for both of these when they are ready?

Yep will do.

Quoted 4 lines

thanks,

greg k-h

#109 lore raw

Re: [PATCH 6.13 100/157] arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes

In reply to Jiri Slaby
Quoted 53 lines · Jiri Slaby
Quoted 52 lines · Greg Kroah-Hartman
Quoted 50 lines · Ryan Roberts
Quoted 40 lines · Jiri Slaby
Quoted 8 lines · Jiri Slaby
Quoted 7 lines · Greg Kroah-Hartman

6.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ryan Roberts <[email protected]>

commit 49c87f7677746f3c5bd16c81b23700bb6b88bfd4 upstream.

...

Quoted 15 lines

arch/arm64/mm/hugetlbpage.c pte_t huge_ptep_get_and_clear(struct mm_ · line 396

Quoted 11 lines
arch/arm64/mm/hugetlbpage.c +1 -6
@@ -401,13 +393,8 @@ pte_t huge_ptep_get_and_clear(struct mm_
    {
        int ncontig;
        size_t pgsize;
-    pte_t orig_pte = __ptep_get(ptep);
-
-    if (!pte_cont(orig_pte))
-        return __ptep_get_and_clear(mm, addr, ptep);
-
-    ncontig = find_num_contig(mm, addr, ptep, &pgsize);
+    ncontig = num_contig_ptes(sz, &pgsize);

This fails to build:

Quoted 14 lines

/usr/bin/gcc-current/gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048] /usr/bin/aarch64-suse-linux-gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048]
run_oldconfig.sh --check... PASS
Build...                    FAIL
+ make -j48 -s -C /dev/shm/kbuild/linux.34170/current ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-suse-linux- clean arch/arm64/mm/hugetlbpage.c:397:35: error: 'sz' undeclared (first use in this function); did you mean 's8'?
        |                                   s8 arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [scripts/Makefile.build:197: arch/arm64/mm/hugetlbpage.o] Error 1

Quoted 6 lines

It looks like the stable tree is missing this pre-req:
commit 02410ac72ac3707936c07ede66e94360d0d65319
Author: Ryan Roberts <[email protected]> Date:   Wed Feb 26 12:06:51 2025 +0000

     mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear()

Although this patch is marked for stable there was a conflict so it wasn't applied. I'll try to get the backport done in the next few days.

Quoted 6 lines
Quoted 2 lines

I'll just drop this one now, can you send me the backports for both of these when they are ready?

FWIW, the series were three patches, not sure if later "101/157] arm64: hugetlb:
Fix flush_hugetlb_tlb_range() invalidation level" is affected when either of the two discussed here is not present...

No, that one is independent and can remain.

Quoted 4 lines

So perhaps drop both 100+101/157 for now?

thanks,

author maintainer
#171 lore raw
In reply to Mark Brown
Quoted 8 lines · Mark Brown
Quoted 4 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.13.6 release. There are 157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

The arm64 defconfig build is broken (KernelCI reported this initially):

Quoted 8 lines

/build/stage/linux/arch/arm64/mm/hugetlbpage.c: In function ‘huge_ptep_get_and_clear’:
/build/stage/linux/arch/arm64/mm/hugetlbpage.c:397:35: error: ‘sz’ undeclared (first use in this function); did you mean ‘s8’?

  397 |         ncontig = num_contig_ptes(sz, &pgsize);
      |                                   ^~
      |                                   s8

/build/stage/linux/arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in

The same issue affects 6.12.

Thanks, I've now dropped the offending patch and will push out some -rc2 releases soon.

greg k-h

Tested-by on the v1 series
#177 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.13.6 release. There are 157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Fri, 07 Mar 2025 17:44:26 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 9 lines
	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.13.6-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.13.y
and the diffstat can be found below.

thanks,

greg k-h

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

Tested-by on the v1 series
#178 lore raw
In reply to Greg Kroah-Hartman

The kernel, bpf tool, perf tool, and kselftest builds fine for v6.13.6-rc1 on x86 Azure VM.

Kernel binary size for x86 build:

text      data      bss      dec       hex      filename
29936840  17836986  6320128  54093954  3396882  vmlinux

arm64 build on Azure VM fails with the following error:

CC security/keys/request_key_auth.o
arch/arm64/mm/hugetlbpage.c: In function 'huge_ptep_get_and_clear':
arch/arm64/mm/hugetlbpage.c:397:35: error: 'sz' undeclared (first use in this function); did you mean 's8'?

  397 |         ncontig = num_contig_ptes(sz, &pgsize);
      |                                   ^~
      |                                   s8

arch/arm64/mm/hugetlbpage.c:397:35: note: each undeclared identifier is reported only once for each function it appears in

Thanks,
Hardik

#72 lore raw

Re: [PATCH 6.13 070/157] objtool: Remove annotate_{,un}reachable()

In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <[email protected]>

[ Upstream commit 06e24745985c8dd0da18337503afcf2f2fdbdff1 ]

There are no users of annotate_reachable() left.

This is not true in 6.13.y because it was taken without upstream commit 624bde3465f6 ("loongarch: Use ASM_REACHABLE"), resulting in:

In file included from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/current.h:6,
from ./arch/loongarch/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from arch/loongarch/kernel/asm-offsets.c:8:
include/linux/thread_info.h: In function 'check_copy_size':
arch/loongarch/include/asm/bug.h:47:9: error: implicit declaration of function 'annotate_reachable' [-Wimplicit-function-declaration]

     47 |         annotate_reachable();                                   \
        |         ^~~~~~~~~~~~~~~~~~
  include/asm-generic/bug.h:113:17: note: in expansion of macro '__WARN_FLAGS'
    113 |                 __WARN_FLAGS(BUGFLAG_ONCE |                     \
        |                 ^~~~~~~~~~~~

include/linux/thread_info.h:262:13: note: in expansion of macro 'WARN_ON_ONCE'
262 | if (WARN_ON_ONCE(bytes > INT_MAX))
| ^~~~~~~~~~~~

when trying to build ARCH=loongarch now. That applies cleanly and resolves the build failure.

Quoted 2 lines

And the annotate_unreachable() usage in unreachable() is plain wrong; it will hide dangerous fall-through code-gen.

This may be reason enough to take this patch into stable... (but then why wasn't it Cc'd in the first place, the tip folks are usually good about that?)

Quoted 6 lines

Remove both.

Stable-dep-of: 73cfc53cc3b6 ("objtool: Fix C jump table annotations for Clang")

But I do not think avoiding the conflict generated by this patch is... With the "diff3" merge.conflictstyle setting in git, I only see this conflict in that change:

/* Annotate a C jump table to allow objtool to follow the code flow */ <<<<<<< HEAD
#define __annotate_jump_table __section(".rodata..c_jump_table,\"a\",@progbits #")

||||||| parent of 73cfc53cc3b6 (objtool: Fix C jump table annotations for Clang) #define __annotate_jump_table __section(".rodata..c_jump_table,\"a\",@progbits #")
=======
#define __annotate_jump_table __section(".data.rel.ro.c_jump_table")

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

73cfc53cc3b6 (objtool: Fix C jump table annotations for Clang)

which seems incredibly simple to resolve without dragging in two extra patches.

If we do want to keep this change in 6.13.y, maybe it would be worth dragging in

2190966fbc14 ("x86: Convert unreachable() to BUG()") 41a1e976623e ("x86/mm: Convert unreachable() to BUG()")

as well?

Cheers,
Nathan

author maintainer
#73 lore raw

Re: [PATCH 6.13 070/157] objtool: Remove annotate_{,un}reachable()

Quoted 65 lines · Nathan Chancellor
Quoted 9 lines · Greg Kroah-Hartman

6.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <[email protected]>

[ Upstream commit 06e24745985c8dd0da18337503afcf2f2fdbdff1 ]

There are no users of annotate_reachable() left.

This is not true in 6.13.y because it was taken without upstream commit 624bde3465f6 ("loongarch: Use ASM_REACHABLE"), resulting in:

In file included from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/current.h:6,
from ./arch/loongarch/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from arch/loongarch/kernel/asm-offsets.c:8:
include/linux/thread_info.h: In function 'check_copy_size':
arch/loongarch/include/asm/bug.h:47:9: error: implicit declaration of function 'annotate_reachable' [-Wimplicit-function-declaration]

     47 |         annotate_reachable();                                   \
        |         ^~~~~~~~~~~~~~~~~~
  include/asm-generic/bug.h:113:17: note: in expansion of macro '__WARN_FLAGS'
    113 |                 __WARN_FLAGS(BUGFLAG_ONCE |                     \
        |                 ^~~~~~~~~~~~

include/linux/thread_info.h:262:13: note: in expansion of macro 'WARN_ON_ONCE'
262 | if (WARN_ON_ONCE(bytes > INT_MAX))
| ^~~~~~~~~~~~

when trying to build ARCH=loongarch now. That applies cleanly and resolves the build failure.

Quoted 2 lines

And the annotate_unreachable() usage in unreachable() is plain wrong; it will hide dangerous fall-through code-gen.

This may be reason enough to take this patch into stable... (but then why wasn't it Cc'd in the first place, the tip folks are usually good about that?)

Quoted 6 lines

Remove both.

Stable-dep-of: 73cfc53cc3b6 ("objtool: Fix C jump table annotations for Clang")

But I do not think avoiding the conflict generated by this patch is... With the "diff3" merge.conflictstyle setting in git, I only see this conflict in that change:

/* Annotate a C jump table to allow objtool to follow the code flow */ <<<<<<< HEAD
#define __annotate_jump_table __section(".rodata..c_jump_table,\"a\",@progbits #")

||||||| parent of 73cfc53cc3b6 (objtool: Fix C jump table annotations for Clang) #define __annotate_jump_table __section(".rodata..c_jump_table,\"a\",@progbits #")
=======
#define __annotate_jump_table __section(".data.rel.ro.c_jump_table")

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

73cfc53cc3b6 (objtool: Fix C jump table annotations for Clang)

which seems incredibly simple to resolve without dragging in two extra patches.

Quoted 7 lines

If we do want to keep this change in 6.13.y, maybe it would be worth dragging in

2190966fbc14 ("x86: Convert unreachable() to BUG()") 41a1e976623e ("x86/mm: Convert unreachable() to BUG()")

as well?

Both are already in the release, thanks!

greg k-h