Heuristic to detect windows shutdown + power down domain.

Signed-off-by: Steven Hand <steven@xensource.com> 
Signed-off-by: George Dunlap <george.dunlap@xensource.com>
This commit is contained in:
shand@kneesaa.uk.xensource.com committed 2006-08-16 14:01:03 +01:00
1 parent 0512d8f50a
commit 942c2f964d
2 files changed
+46 -5

No files matched your search

+20 -2
View File
@@ -2150,8 +2150,9 @@ done:
static inline void svm_vmexit_do_hlt(struct vmcb_struct *vmcb)
{
struct vcpu *v = current;
struct periodic_time *pt=&v->domain->arch.hvm_domain.pl_time.periodic_tm;
s_time_t next_pit = -1, next_wakeup;
struct periodic_time *pt =
&(v->domain->arch.hvm_domain.pl_time.periodic_tm);
s_time_t next_pit = -1, next_wakeup;
__update_guest_eip(vmcb, 1);
@@ -2159,6 +2160,23 @@ static inline void svm_vmexit_do_hlt(struct vmcb_struct *vmcb)
if ( vmcb->vintr.fields.irq || cpu_has_pending_irq(v) )
return;
/* Detect machine shutdown. Only do this for vcpu 0, to avoid
potentially shutting down the domain early. */
if (v->vcpu_id == 0) {
unsigned long rflags = vmcb->rflags;
/* If we halt with interrupts disabled, that's a pretty sure
sign that we want to shut down. In a real processor, NMIs
are the only way to break out of this. Our SVM code won't
deliver interrupts, but will wake it up whenever one is
pending... */
if(!(rflags & X86_EFLAGS_IF)) {
printk("D%d: HLT with interrupts enabled @0x%lx Shutting down.\n",
current->domain->domain_id, (unsigned long)vmcb->rip);
domain_shutdown(current->domain, SHUTDOWN_poweroff);
return;
}
}
if ( !v->vcpu_id )
next_pit = get_scheduled(v, pt->irq, pt);
next_wakeup = get_apictime_scheduled(v);
+26 -3
View File
@@ -2054,9 +2054,32 @@ static inline void vmx_do_msr_write(struct cpu_user_regs *regs)
*/
void vmx_vmexit_do_hlt(void)
{
struct vcpu *v=current;
struct periodic_time *pt = &(v->domain->arch.hvm_domain.pl_time.periodic_tm);
s_time_t next_pit=-1,next_wakeup;
struct vcpu *v = current;
struct periodic_time *pt =
&(v->domain->arch.hvm_domain.pl_time.periodic_tm);
s_time_t next_pit = -1, next_wakeup;
/* Detect machine shutdown. Only do this for vcpu 0, to avoid
potentially shutting down the domain early. */
if (v->vcpu_id == 0) {
unsigned long rflags;
__vmread(GUEST_RFLAGS, &rflags);
/* If we halt with interrupts disabled, that's a pretty sure
sign that we want to shut down. In a real processor, NMIs
are the only way to break out of this. Our VMX code won't
deliver interrupts, but will wake it up whenever one is
pending... */
if(!(rflags & X86_EFLAGS_IF)) {
unsigned long rip;
__vmread(GUEST_RIP, &rip);
printk("D%d: HLT with interrupts enabled @0x%lx Shutting down.\n",
current->domain->domain_id, rip);
domain_shutdown(current->domain, SHUTDOWN_poweroff);
return;
}
}
if ( !v->vcpu_id )
next_pit = get_scheduled(v, pt->irq, pt);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.