git: 44276cb4146c - stable/15 - acpica: Fix SRAT memory region insertion sort

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Thu, 26 Nov 2026 18:17:33 UTC
The branch stable/15 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=44276cb4146c4500aa33e0388fa4905c8686c4d0

commit 44276cb4146c4500aa33e0388fa4905c8686c4d0
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-11-25 04:16:31 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-11-26 18:16:57 +0000

    acpica: Fix SRAT memory region insertion sort
    
    The SRAT table can list memory regions in any order, but we need them
    sorted.  There is an insertion sort to accomplish this when building
    the mem_info array, but instead of inserting the new region before
    the *first* higher-base-address region, it was inserting the new
    region before the *last* higher-base-address region; i.e. if the array
    already held "1 3 4" then inserting "2" would produce "1 3 2 4".
    
    Break out of the insertion-location-finding loop when we find the right
    spot to insert the new memory region into the list, rather than looking
    further.
    
    Reviewed by:    jhb
    Fixes:  dd540b46236b ("Add a parser for the ACPI SRAT table...")
    MFC after:      1 day
    Sponsored by:   Amazon
    Tested on:      c5n.9xlarge, c6a.24xlarge, c6a.metal, c7a.metal-48xl
                    c7i.metal-24xl, c7i.metal-48xl, c8a.metal-24xl
                    c8i.metal-48xl, c8i.metal-96xl, c8in.96xlarge
                    c8in.metal-48xl, c8in.metal-96xl, m8azn.metal-24xl
    Differential Revision:  https://reviews.freebsd.org/D62059
    
    (cherry picked from commit 276085c192993e68aca41e2402f94436f99aa33b)
---
 sys/dev/acpica/acpi_pxm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/dev/acpica/acpi_pxm.c b/sys/dev/acpica/acpi_pxm.c
index 9eb95996eca0..3bce5b77ef08 100644
--- a/sys/dev/acpica/acpi_pxm.c
+++ b/sys/dev/acpica/acpi_pxm.c
@@ -370,6 +370,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg)
 				return;
 			}
 			slot = i;
+			break;
 		}
 		for (i = num_mem; i > slot; i--)
 			mem_info[i] = mem_info[i - 1];