KVM: Don't update PPR on any APIC read
authorAvi Kivity <avi@redhat.com>
Sun, 22 Jul 2012 14:41:00 +0000 (17:41 +0300)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 30 Jul 2012 23:47:32 +0000 (20:47 -0300)
The current code will update the PPR on almost any APIC read; however
that's only required if we read the PPR.

kvm_update_ppr() shows up in some profiles, albeit with a low usage (~1%).
This should reduce it further (it will still be called during interrupt
processing).

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/lapic.c

index fff7173f6a7100f793af3f53d851274bfa8f7137..ad7fff7ad13c35f4a16e0657bf219d3390d055e3 100644 (file)
@@ -696,12 +696,14 @@ static u32 __apic_read(struct kvm_lapic *apic, unsigned int offset)
 
                val = apic_get_tmcct(apic);
                break;
-
+       case APIC_PROCPRI:
+               apic_update_ppr(apic);
+               val = apic_get_reg(apic, offset);
+               break;
        case APIC_TASKPRI:
                report_tpr_access(apic, false);
                /* fall thru */
        default:
-               apic_update_ppr(apic);
                val = apic_get_reg(apic, offset);
                break;
        }