本文将介绍利用ftrace to verify the difference between posted interrupt and event injection.

1. Posted Interrupt scenarios

  • Enable Posted Interrupt
    • kernel parameter: kvm_intel.enable_apicv=1
    • rmmod kvm-intel kvm && modprobe kvm-intel enable_apicv=1
  • Need to ensure cat /sys/module/kvm_intel/parameters/enable_apicv is Y

2. Event Injection scenarios

  • Disable Posted Interrupt

    • kernel parameter: kvm_intel.enable_apicv=0
    • rmmod kvm-intel kvm && modprobe kvm-intel enable_apicv=0
  • Need to ensure cat /sys/module/kvm_intel/parameters/enable_apicv is N

3. Trace verification

  • sudo trace-cmd record -e kvm_inj_virq
  • sudo trace-cmd report

3.1 trace for Posted Interrupt

1
2
3
4
5
qemu-system-x86-930906 [173] 703091.577738: kvm_inj_virq:         irq 8
qemu-system-x86-930906 [173] 703091.577741: kvm_inj_virq: irq 8
qemu-system-x86-930906 [173] 703091.581667: kvm_inj_virq: irq 16
qemu-system-x86-930906 [173] 703091.582496: kvm_inj_virq: irq 16
qemu-system-x86-930906 [173] 703091.592551: kvm_inj_virq: irq 25

3.2 trace for Event Injection

1
2
3
4
5
6
7
8
9
qemu-system-x86-931437 [222] 703390.933279: kvm_inj_virq:         irq 8
qemu-system-x86-931437 [222] 703390.933282: kvm_inj_virq: irq 8
qemu-system-x86-931437 [222] 703390.940684: kvm_inj_virq: irq 16
qemu-system-x86-931437 [222] 703390.941541: kvm_inj_virq: irq 16
qemu-system-x86-931437 [222] 703390.951859: kvm_inj_virq: irq 25
qemu-system-x86-931438 [223] 703391.322195: kvm_inj_virq: irq 32
qemu-system-x86-931437 [222] 703391.330941: kvm_inj_virq: irq 236
qemu-system-x86-931437 [222] 703391.331953: kvm_inj_virq: irq 236
qemu-system-x86-931437 [222] 703392.385846: kvm_inj_virq: irq 236

3.3 summary

Interrupts 32 to 255—User Defined Interrupts

相对于Event Injection,当enable Posted Interrupt之后,trace中没有出现User Defined Interrupts的kvm_inj_virq事件!