Skip to content

[kernel] E: Add XapicOnly interrupt mode (skip PIC init on microvm)#14

Draft
esaurez wants to merge 1 commit into
devfrom
enhancement-whp-pic-skip-zero-opt
Draft

[kernel] E: Add XapicOnly interrupt mode (skip PIC init on microvm)#14
esaurez wants to merge 1 commit into
devfrom
enhancement-whp-pic-skip-zero-opt

Conversation

@esaurez

@esaurez esaurez commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Replica of nanvix#1982.

Add XapicOnly interrupt controller variant for WHP+microvm that skips legacy 8259 PIC initialization entirely, eliminating ~47 VM exits per cold-start.

New XapicOnly(Xapic) variant in InterruptControllerType enum with dispatch logic for ack(), unmask(), start_core(), set_handler/get_handler.

Activation condition: cfg(feature = microvm, target_arch = x86) AND eoi_xapic is Some.

Benchmark (50 iterations, high-perf tuned, p50)

Config total guest_exec exit_handling
baseline (dev) 60,762us 46,384us 7,492us
XapicOnly 60,773us 46,405us 7,203us
delta +11us +21us -289us
delta % +0.0% +0.0% -3.9%

Add XapicOnly interrupt controller variant for WHP+microvm that
skips legacy 8259 PIC initialization entirely. When the xAPIC
timer has been successfully initialized via try_init_xapic_timer(),
the WHP LAPIC emulator handles timer delivery and EOI via MMIO
without VM exits. PIC I/O ports (0x20/0x21/0xA0/0xA1) are never
accessed, eliminating ~47 VM exits per cold-start.

Changes:
- New XapicOnly(Xapic) variant in InterruptControllerType enum
- Early-return in InterruptController::new() when eoi_xapic is Some
  under cfg(feature = "microvm", target_arch = "x86")
- ack(): delegates to xapic.ack()
- unmask(): no-op (LAPIC timer already unmasked during calibration)
- start_core(): returns OperationNotSupported (microvm is single-core)
- set_handler/get_handler: identity mapping (no IOAPIC routing)

Benchmark (20 iterations, high-perf power mode, p50):

  Config             total      guest_exec   exit_handling
  baseline (dev)     60,483us   46,238us     7,208us
  + XapicOnly        TBD        TBD          TBD

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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