Search code examples
assemblyintelqemukvminterrupt-handling

Geting multiple performance monitoring interrupt on qemu - kvm


I followed steps and indications given here and can get now counter overflow interrupt one time. But I cannot get it multple times. Whatever I managed, the Iterrupt does note fires up any more. Despite I take care of clearing the interrupt mask.


Solution

  • This question is discussed in this forum where they discovered that it is a bug in the kernel. However, your can circumvent it doing this: At any place where you need to reprogram the msr MSR_PERF_FIXED_CTR0 (0x38d), place these lines:

    Msr::write(Msr::MSR_PERF_FIXED_CTR0, 0xfffffffffff0ull);
    Msr::write(Msr::MSR_PERF_FIXED_CTRL, 0x0);
    Msr::write(Msr::MSR_PERF_FIXED_CTR0, 0xfffffffffff0ull);
    Msr::write(Msr::MSR_PERF_FIXED_CTRL, 0xa);
    

    The switching between the values 0x0 and 0xa causes the kernel to reprogram the counter.