Skip to content

zone: track guest-to-physical CPU mappings - #371

Open
li041 wants to merge 1 commit into
syswonder:devfrom
li041:zone-map
Open

zone: track guest-to-physical CPU mappings#371
li041 wants to merge 1 commit into
syswonder:devfrom
li041:zone-map

Conversation

@li041

@li041 li041 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add bidirectional per-zone mappings between guest-visible CPU IDs and physical CPU IDs
  • keep CpuSet responsible for physical CPU ownership
  • initialize CPU mappings when a zone is created
  • assign dense guest CPU IDs according to the physical CPUs listed by the current bitmap-based configuration
  • return None for unmapped or out-of-range CPU ID lookups

Motivation

HvZoneConfig::cpus currently describes physical CPUs as a bitmap, while
CpuSet only records physical CPU ownership.

Architecture code that exposes logical CPU IDs to a guest or routes guest CPU
operations needs an explicit translation between guest CPU IDs and physical CPU
IDs. This is especially important for zones assigned sparse physical CPUs. For
example, physical CPUs 1 and 3 are exposed as guest CPUs 0 and 1.

This PR adds the zone-level mapping infrastructure. It does not change interrupt
delivery or CPU startup behavior by itself; architecture-specific consumers can
use these mappings in follow-up changes.

@li041
li041 requested a review from ZhongkaiXu July 30, 2026 06:44
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.

1 participant