From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dor Laor Subject: [Patch] Make kvm sleep if eflag is unset Date: Wed, 24 Oct 2007 18:10:43 +0200 Message-ID: <471F6E83.7000404@qumranet.com> Reply-To: dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060109050503070304000408" To: kvm-devel Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is a multi-part message in MIME format. --------------060109050503070304000408 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit [PATCH] Make kvm Sleep if eflag is unset. The main loop checks whether a sleep is needed (kvm_main_loop_wait). If there is a need to sleep it polls 10msec for signals and select input from the devices. Otherwise it enters guest mode. In case halt is on and there is pending irq we should also check if the eflags in set or not. This fixes spinning on the boot loader when the disk is damanged. Signed-off-by: Dor Laor --- qemu/qemu-kvm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c index d857d1c..a0eb43f 100644 --- a/qemu/qemu-kvm.c +++ b/qemu/qemu-kvm.c @@ -563,7 +563,8 @@ static int has_work(CPUState *env) return 0; if (!(env->hflags & HF_HALTED_MASK)) return 1; - if (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXIT)) + if ((env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXIT)) && + (env->eflags & IF_MASK)) return 1; return 0; } -- 1.5.2.2 --------------060109050503070304000408 Content-Type: text/plain; name="0001-Make-kvm-Sleep-if-eflag-is-unset.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-Make-kvm-Sleep-if-eflag-is-unset.patch" >>From 6daaaada124fde03b253161f2a9a647fde6f1a86 Mon Sep 17 00:00:00 2001 From: Dor Laor Date: Wed, 24 Oct 2007 17:03:44 +0200 Subject: [PATCH] Make kvm Sleep if eflag is unset. The main loop checks whether a sleep is needed (kvm_main_loop_wait). If there is a need to sleep it polls 10msec for signals and select input from the devices. Otherwise it enters guest mode. In case halt is on and there is pending irq we should also check if the eflags in set or not. This fixes spinning on the boot loader when the disk is damanged. Signed-off-by: Dor Laor --- qemu/qemu-kvm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c index d857d1c..a0eb43f 100644 --- a/qemu/qemu-kvm.c +++ b/qemu/qemu-kvm.c @@ -563,7 +563,8 @@ static int has_work(CPUState *env) return 0; if (!(env->hflags & HF_HALTED_MASK)) return 1; - if (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXIT)) + if ((env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXIT)) && + (env->eflags & IF_MASK)) return 1; return 0; } -- 1.5.2.2 --------------060109050503070304000408 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ --------------060109050503070304000408 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --------------060109050503070304000408--