ia64/xen-unstable

changeset 12718:2801a14d169a

[HVM][VMX] Fix for CR8 acceleration on 64bit guest.

For current CR8 acceleration, we do not call update_tpr_threshold() at
every VMEXIT. But at some situations, we cannot inject guest
interrupts in time. And at some critical time, it will bring up a blue
screen to 64bit Windows guest.

Now, we select to call update_tpr_threshold() at very VMEXIT
time. It's safe, and we do not see clear performance downgrade so
far.

Signed-off-by: Xiaohui Xin xiaohui.xin@intel.com
author kfraser@localhost.localdomain
date Fri Dec 01 09:48:18 2006 +0000 (2006-12-01)
parents 697b0203e68f
children a3aab403ec21
files xen/arch/x86/hvm/vlapic.c xen/arch/x86/hvm/vmx/io.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/vlapic.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vlapic.c	Fri Dec 01 09:28:14 2006 +0000
     1.2 +++ b/xen/arch/x86/hvm/vlapic.c	Fri Dec 01 09:48:18 2006 +0000
     1.3 @@ -119,19 +119,16 @@ static int vlapic_find_highest_vector(u3
     1.4  
     1.5  static int vlapic_test_and_set_irr(int vector, struct vlapic *vlapic)
     1.6  {
     1.7 -    vlapic->flush_tpr_threshold = 1;
     1.8      return vlapic_test_and_set_vector(vector, vlapic->regs + APIC_IRR);
     1.9  }
    1.10  
    1.11  static void vlapic_set_irr(int vector, struct vlapic *vlapic)
    1.12  {
    1.13 -    vlapic->flush_tpr_threshold = 1;
    1.14      vlapic_set_vector(vector, vlapic->regs + APIC_IRR);
    1.15  }
    1.16  
    1.17  static void vlapic_clear_irr(int vector, struct vlapic *vlapic)
    1.18  {
    1.19 -    vlapic->flush_tpr_threshold = 1;
    1.20      vlapic_clear_vector(vector, vlapic->regs + APIC_IRR);
    1.21  }
    1.22  
    1.23 @@ -634,7 +631,6 @@ static void vlapic_write(struct vcpu *v,
    1.24      {
    1.25      case APIC_TASKPRI:
    1.26          vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
    1.27 -        vlapic->flush_tpr_threshold = 1;
    1.28          break;
    1.29  
    1.30      case APIC_EOI:
    1.31 @@ -667,10 +663,7 @@ static void vlapic_write(struct vcpu *v,
    1.32              }
    1.33          }
    1.34          else
    1.35 -        {
    1.36              vlapic->disabled &= ~VLAPIC_SW_DISABLED;
    1.37 -            vlapic->flush_tpr_threshold = 1;
    1.38 -        }
    1.39          break;
    1.40  
    1.41      case APIC_ESR:
    1.42 @@ -925,8 +918,6 @@ static int vlapic_reset(struct vlapic *v
    1.43      vlapic_set_reg(vlapic, APIC_SPIV, 0xff);
    1.44      vlapic->disabled |= VLAPIC_SW_DISABLED;
    1.45  
    1.46 -    vlapic->flush_tpr_threshold = 1;
    1.47 -
    1.48      return 1;
    1.49  }
    1.50  
     2.1 --- a/xen/arch/x86/hvm/vmx/io.c	Fri Dec 01 09:28:14 2006 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmx/io.c	Fri Dec 01 09:48:18 2006 +0000
     2.3 @@ -71,10 +71,6 @@ static void update_tpr_threshold(struct 
     2.4  {
     2.5      int max_irr, tpr;
     2.6  
     2.7 -    /* Clear the work-to-do flag /then/ do the work. */
     2.8 -    vlapic->flush_tpr_threshold = 0;
     2.9 -    mb();
    2.10 -
    2.11      if ( !vlapic_enabled(vlapic) || 
    2.12           ((max_irr = vlapic_find_highest_irr(vlapic)) == -1) )
    2.13      {
    2.14 @@ -95,7 +91,6 @@ asmlinkage void vmx_intr_assist(void)
    2.15      int highest_vector;
    2.16      unsigned long eflags;
    2.17      struct vcpu *v = current;
    2.18 -    struct vlapic *vlapic = vcpu_vlapic(v);
    2.19      struct hvm_domain *plat=&v->domain->arch.hvm_domain;
    2.20      struct periodic_time *pt = &plat->pl_time.periodic_tm;
    2.21      unsigned int idtv_info_field;
    2.22 @@ -110,8 +105,7 @@ asmlinkage void vmx_intr_assist(void)
    2.23  
    2.24      hvm_set_callback_irq_level();
    2.25  
    2.26 -    if ( vlapic->flush_tpr_threshold )
    2.27 -        update_tpr_threshold(vlapic);
    2.28 +    update_tpr_threshold(vcpu_vlapic(v));
    2.29  
    2.30      has_ext_irq = cpu_has_pending_irq(v);
    2.31  
     3.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Fri Dec 01 09:28:14 2006 +0000
     3.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Fri Dec 01 09:48:18 2006 +0000
     3.3 @@ -2500,7 +2500,6 @@ asmlinkage void vmx_vmexit_handler(struc
     3.4          break;
     3.5  
     3.6      case EXIT_REASON_TPR_BELOW_THRESHOLD:
     3.7 -        vcpu_vlapic(v)->flush_tpr_threshold = 1;
     3.8          break;
     3.9  
    3.10      default:
     4.1 --- a/xen/include/asm-x86/hvm/vlapic.h	Fri Dec 01 09:28:14 2006 +0000
     4.2 +++ b/xen/include/asm-x86/hvm/vlapic.h	Fri Dec 01 09:48:18 2006 +0000
     4.3 @@ -54,7 +54,6 @@ struct vlapic {
     4.4      uint32_t           timer_divisor;
     4.5      struct timer       vlapic_timer;
     4.6      int                timer_pending_count;
     4.7 -    int                flush_tpr_threshold;
     4.8      s_time_t           timer_last_update;
     4.9      struct page_info   *regs_page;
    4.10      void               *regs;