On 6/8/15 10:15 PM, Paolo Bonzini wrote:

On 08/06/2015 12:33, Wanpeng Li wrote:
+        if (kvm_check_request(KVM_REQ_SCAN_IOAPIC, vcpu)) {
+            if (irqchip_split(vcpu->kvm)) {
+                memset(vcpu->arch.eoi_exit_bitmaps, 0, 32);
+                kvm_scan_ioapic_routes(
+                    vcpu, vcpu->arch.eoi_exit_bitmaps);
+                kvm_x86_ops->load_eoi_exitmap(
+                    vcpu, vcpu->arch.eoi_exit_bitmaps);
How about introduce a handler to fold above just like vcpu_scan_ioapic() ?
Or just move the "if" inside the existing vcpu_scan_ioapic().  This is a
good suggestion because it raises more question:

1) should the

         if (!kvm_apic_hw_enabled(vcpu->arch.apic))
                 return;

of vcpu_scan_ioapic apply to the "split irqchip" case too?

2) the "non-split irqchip" can also use vcpu->arch.eoi_exit_bitmaps
instead of the local eoi_exit_bitmap variable of vcpu_scan_ioapic.

So in the end the patched vcpu_scan_ioapic becomes

        if (kvm_apic_hw_enabled(vcpu->arch.apic))

s/kvm_apic_hw_enabled(vcpu->arch.apic)/!kvm_apic_hw_enabled(vcpu->arch.apic)

Regards,
Wanpeng Li

                 return;

        memset(vcpu->arch.eoi_exit_bitmaps, 0, 32);
        if (irqchip_split)
                scan_ioapic_routes(...)
        else {
                memset(tmr, 0, 32)
                kvm_ioapic_scan_entry(...)
                kvm_apic_update_tmr(vcpu, tmr);
        }
        kvm_x86_ops->load_eoi_exitmap(vcpu,
                                      vcpu->arch.eoi_exit_bitmaps);

A FIXME/TODO comment about TMR in the split-irqchip case is probably in
order too.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to