On 3/31/2026 5:24 AM, Zide Chen wrote:
> In snbep_pci2phy_map_init(), in the nr_node_ids > 8 path,
> uncore_device_to_die() may return -1 when all CPUs associated
> with the UBOX device are offline.
>
> Remove the WARN_ON_ONCE(die_id == -1) check for two reasons:
>
> - The current code breaks out of the loop. This is incorrect because
> pci_get_device() does not guarantee iteration in domain or bus order,
> so additional UBOX devices may be skipped during the scan.
>
> - Returning -EINVAL is incorrect, since marking offline buses with
> die_id == -1 is expected and should not be treated as an error.
>
> Fixes: 9a7832ce3d92 ("perf/x86/intel/uncore: With > 8 nodes, get pci bus die id from NUMA info")
> Signed-off-by: Zide Chen <zide.chen@intel.com>
> ---
> V2:
> - Fix the commit message to note that spr_update_device_location() is
> used by EMR, not GNR.
> - Rewrite the commit message for clarity.
> - Add a Tested-by tag.
>
> V5:
> - Removed unused die_id (Dapeng).
>
> V6:
> - Move the spr_update_device_location() change to a separate patch.
> - Update the comit message and title to reflect the reduced scope of
> this patch.
> - Remove Tested-by since the code has changed.
> ---
> arch/x86/events/intel/uncore_snbep.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
> index 9b51883fd6fd..8ee06d4659bb 100644
> --- a/arch/x86/events/intel/uncore_snbep.c
> +++ b/arch/x86/events/intel/uncore_snbep.c
> @@ -1413,7 +1413,7 @@ static int topology_gidnid_map(int nodeid, u32 gidnid)
> static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool reverse)
> {
> struct pci_dev *ubox_dev = NULL;
> - int i, bus, nodeid, segment, die_id;
> + int i, bus, nodeid, segment;
> struct pci2phy_map *map;
> int err = 0;
> u32 config = 0;
> @@ -1458,14 +1458,9 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool
> break;
> }
>
> - map->pbus_to_dieid[bus] = die_id = uncore_device_to_die(ubox_dev);
> + map->pbus_to_dieid[bus] = uncore_device_to_die(ubox_dev);
>
> raw_spin_unlock(&pci2phy_map_lock);
> -
> - if (WARN_ON_ONCE(die_id == -1)) {
> - err = -EINVAL;
> - break;
> - }
> }
> }
>
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>