ia64/xen-unstable

changeset 7009:76f4c7ea7602

This patch fixes a bug where raise_softirq(SCHEDULE_SOFTIRQ) is called
upon a hlt instruction from a VMX guest, causing repeated VMExits when
the guest is idle. At the same time, it disables the monitor/mwait
feature as it's not feasible to implement for vcpu.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
Signed-off-by: Asit Mallick <asit.k.mallick@intel.com>
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Sep 21 16:58:55 2005 +0000 (2005-09-21)
parents f71bb61e0500
children a32ee93b3b33
files xen/arch/x86/vmx.c xen/arch/x86/vmx_intercept.c xen/include/asm-x86/vmx_virpit.h
line diff
     1.1 --- a/xen/arch/x86/vmx.c	Wed Sep 21 16:36:46 2005 +0000
     1.2 +++ b/xen/arch/x86/vmx.c	Wed Sep 21 16:58:55 2005 +0000
     1.3 @@ -471,6 +471,8 @@ static void vmx_vmexit_do_cpuid(unsigned
     1.4          }
     1.5  #endif
     1.6  
     1.7 +        /* Unsupportable for virtualised CPUs. */
     1.8 +        clear_bit(X86_FEATURE_MWAIT & 31, &ecx);
     1.9      }
    1.10  
    1.11      regs->eax = (unsigned long) eax;
    1.12 @@ -1461,7 +1463,7 @@ volatile unsigned long do_hlt_count;
    1.13   */
    1.14  void vmx_vmexit_do_hlt(void)
    1.15  {
    1.16 -    raise_softirq(SCHEDULE_SOFTIRQ);
    1.17 +    do_block();
    1.18  }
    1.19  
    1.20  static inline void vmx_vmexit_do_extint(struct cpu_user_regs *regs)
    1.21 @@ -1511,12 +1513,6 @@ static inline void vmx_vmexit_do_extint(
    1.22      }
    1.23  }
    1.24  
    1.25 -volatile unsigned long do_mwait_count;
    1.26 -static inline void vmx_vmexit_do_mwait(void)
    1.27 -{
    1.28 -    raise_softirq(SCHEDULE_SOFTIRQ);
    1.29 -}
    1.30 -
    1.31  #define BUF_SIZ     256
    1.32  #define MAX_LINE    80
    1.33  char print_buf[BUF_SIZ];
    1.34 @@ -1798,9 +1794,7 @@ asmlinkage void vmx_vmexit_handler(struc
    1.35          __update_guest_eip(inst_len);
    1.36          break;
    1.37      case EXIT_REASON_MWAIT_INSTRUCTION:
    1.38 -        __get_instruction_length(inst_len);
    1.39 -        __update_guest_eip(inst_len);
    1.40 -        vmx_vmexit_do_mwait();
    1.41 +        __vmx_bug(&regs);
    1.42          break;
    1.43      default:
    1.44          __vmx_bug(&regs);       /* should not happen */
     2.1 --- a/xen/arch/x86/vmx_intercept.c	Wed Sep 21 16:36:46 2005 +0000
     2.2 +++ b/xen/arch/x86/vmx_intercept.c	Wed Sep 21 16:58:55 2005 +0000
     2.3 @@ -28,6 +28,7 @@
     2.4  #include <xen/sched.h>
     2.5  #include <asm/current.h>
     2.6  #include <io_ports.h>
     2.7 +#include <xen/event.h>
     2.8  
     2.9  #ifdef CONFIG_VMX
    2.10  
    2.11 @@ -205,6 +206,7 @@ static void pit_timer_fn(void *data)
    2.12      /* Set the pending intr bit, and send evtchn notification to myself. */
    2.13      if (test_and_set_bit(vpit->vector, vpit->intr_bitmap))
    2.14          vpit->pending_intr_nr++; /* already set, then count the pending intr */
    2.15 +    evtchn_set_pending(vpit->v, iopacket_port(vpit->v->domain));
    2.16  
    2.17      /* pick up missed timer tick */
    2.18      if ( missed_ticks > 0 ) {
    2.19 @@ -281,6 +283,7 @@ void vmx_hooks_assist(struct vcpu *d)
    2.20          }
    2.21  
    2.22          vpit->intr_bitmap = intr;
    2.23 +        vpit->v = d;
    2.24  
    2.25          vpit->scheduled = NOW() + vpit->period;
    2.26          set_ac_timer(&vpit->pit_timer, vpit->scheduled);
     3.1 --- a/xen/include/asm-x86/vmx_virpit.h	Wed Sep 21 16:36:46 2005 +0000
     3.2 +++ b/xen/include/asm-x86/vmx_virpit.h	Wed Sep 21 16:58:55 2005 +0000
     3.3 @@ -35,8 +35,8 @@ struct vmx_virpit_t {
     3.4  
     3.5      unsigned int count;  /* the 16 bit channel count */
     3.6      unsigned int init_val; /* the init value for the counter */
     3.7 -
     3.8 -} ;
     3.9 +    struct vcpu *v;
    3.10 +};
    3.11  
    3.12  /* to hook the ioreq packet to get the PIT initializaiton info */
    3.13  extern void vmx_hooks_assist(struct vcpu *d);