Il 26/08/2014 18:27, Wei Wang ha scritto: > kvm_ioapic_scan_entry() needs to update tmr. The previous lapic tmr value > (old_tmr) needs to sync with ioapic to get an accurate updated tmr > value before the updating work. > + u32 irr[8]; > + u32 isr[8]; > + u32 old_tmr[8]; These do not need to be arrays. You can use a single variable for each of irr, isr and old_tmr. > int i; > > - for (i = 0; i < 8; i++) > + for (i = 0; i < 8; i++) { > + irr[i] = kvm_apic_get_reg(apic, APIC_IRR + 0x10 * i); > + isr[i] = kvm_apic_get_reg(apic, APIC_ISR + 0x10 * i); > + old_tmr[i] = kvm_apic_get_reg(apic, APIC_TMR + 0x10 * i); > + tmr[i] = (~(irr[i] | isr[i]) & tmr[i]) > + | ((irr[i] | isr[i]) & old_tmr[i]); Please do not modify the tmr array. Instead, use kvm_apic_get_reg in the next patch to read the TMR. Also, please add a comment about how the code works and why the old TMR is used if IRR=1 || ISR=1. Paolo > apic_set_reg(apic, APIC_TMR + 0x10 * i, tmr[i]); -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html