]> Pileus Git - ~andy/linux/commitdiff
x86/apic: Implement EIO micro-optimization
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 16 May 2012 16:03:58 +0000 (19:03 +0300)
committerIngo Molnar <mingo@kernel.org>
Fri, 18 May 2012 07:46:09 +0000 (09:46 +0200)
We know both register and value for eoi beforehand,
so there's no need to check it and no need to do math
to calculate the msr. Saves instructions/branches
on each EOI when using x2apic.

I looked at the objdump output to verify that the
generated code looks right and actually is shorter.

The real improvemements will be on the KVM guest side
though, those come in a later patch.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: gleb@redhat.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/e019d1a125316f10d3e3a4b2f6bda41473f4fb72.1337184153.git.mst@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/x2apic_cluster.c
arch/x86/kernel/apic/x2apic_phys.c
arch/x86/kernel/apic/x2apic_uv_x.c

index bf8d065dd9776f41d897d3672bd2bb2b1473b941..eaff4790ed96c207d2ac51e0c89901707b5285ec 100644 (file)
@@ -138,6 +138,11 @@ static inline void native_apic_msr_write(u32 reg, u32 v)
        wrmsr(APIC_BASE_MSR + (reg >> 4), v, 0);
 }
 
+static inline void native_apic_msr_eoi_write(u32 reg, u32 v)
+{
+       wrmsr(APIC_BASE_MSR + (APIC_EOI >> 4), APIC_EOI_ACK, 0);
+}
+
 static inline u32 native_apic_msr_read(u32 reg)
 {
        u64 msr;
index a5baa785a25136075509347bc2bc9983b668eac8..ff35cff0e1a7e6f4f16b628504c821c5e544bacf 100644 (file)
@@ -260,7 +260,7 @@ static struct apic apic_x2apic_cluster = {
 
        .read                           = native_apic_msr_read,
        .write                          = native_apic_msr_write,
-       .eoi_write                      = native_apic_msr_write,
+       .eoi_write                      = native_apic_msr_eoi_write,
        .icr_read                       = native_x2apic_icr_read,
        .icr_write                      = native_x2apic_icr_write,
        .wait_icr_idle                  = native_x2apic_wait_icr_idle,
index 834035666b8dbb02eb079b49521f400a2f2c8b14..c17e982db2759ad5913e8c586a7100267f014c32 100644 (file)
@@ -172,7 +172,7 @@ static struct apic apic_x2apic_phys = {
 
        .read                           = native_apic_msr_read,
        .write                          = native_apic_msr_write,
-       .eoi_write                      = native_apic_msr_write,
+       .eoi_write                      = native_apic_msr_eoi_write,
        .icr_read                       = native_x2apic_icr_read,
        .icr_write                      = native_x2apic_icr_write,
        .wait_icr_idle                  = native_x2apic_wait_icr_idle,
index 5b0e3d0a3d2d3d826755ec4654f296914bdd7b58..c6d03f7a4401324444d33c0adf201ec13fbb7aea 100644 (file)
@@ -404,7 +404,7 @@ static struct apic __refdata apic_x2apic_uv_x = {
 
        .read                           = native_apic_msr_read,
        .write                          = native_apic_msr_write,
-       .eoi_write                      = native_apic_msr_write,
+       .eoi_write                      = native_apic_msr_eoi_write,
        .icr_read                       = native_x2apic_icr_read,
        .icr_write                      = native_x2apic_icr_write,
        .wait_icr_idle                  = native_x2apic_wait_icr_idle,