Skip to content

Fix "failed to parse numa bitmap" on systems with more than 512 CPUs#373

Open
wallezhang wants to merge 1 commit intoAtoptool:masterfrom
wallezhang:fix/cpumask-sz-for-large-cpu-systems
Open

Fix "failed to parse numa bitmap" on systems with more than 512 CPUs#373
wallezhang wants to merge 1 commit intoAtoptool:masterfrom
wallezhang:fix/cpumask-sz-for-large-cpu-systems

Conversation

@wallezhang
Copy link
Copy Markdown

@wallezhang wallezhang commented Apr 1, 2026

Summary

  • Increase CPUMASK_SZ from (64 * 8) (512) to (64 * 64) (4096) to match MAXCPU in photosyst.h
  • On systems with more than 512 CPUs, numa_parse_bitmap_v2() exceeded the bitmask array bounds and returned -1, causing a fatal "failed to parse numa bitmap" error

Root Cause

CPUMASK_SZ was hardcoded to 512 bits, but /sys/devices/system/node/nodeX/cpumap on a 768-CPU system contains 768 bits (24 x 32-bit hex groups). The parser merges adjacent 32-bit groups into 64-bit longs, requiring 12 longs, but the array only held 8 (CPU_LONGS(512)). This caused the bounds check if (i >= CPU_LONGS(ncpus)) to fail.

Test plan

  • Verified with unit test using actual 768-CPU cpumap data from a production system
  • Confirmed the old value (512) reproduces the failure
  • Confirmed the new value (4096) parses correctly and produces correct bitmask values
  • Verified backward compatibility with smaller systems (64, 128, 512 CPUs)

Fixes #372

Increase CPUMASK_SZ from 512 (64*8) to 4096 (64*64) to match MAXCPU.
On systems with more than 512 CPUs, numa_parse_bitmap_v2() exceeded
the bitmask array bounds and returned -1, causing a fatal error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

failed to parse numa bitmap on systems with more than 512 CPUs due to hardcoded CPUMASK_SZ

1 participant