public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM-USER: Fix for CPU interrupts in QEMU
@ 2007-07-12 15:12 Gregory Haskins
       [not found] ` <20070712151200.7060.91407.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Gregory Haskins @ 2007-07-12 15:12 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: ghaskins-Et1tbQHTxzrQT0dZR+AlfA

QEMU-KVM has a bug where the interruptibility of the CPU is predicated on
pending interrupts.  If the reason that a CPU is interrupted is because we
need to inject interrupts, the current code will just keep looping and miss
the event window.

This doesnt seem to cause problems with in-trunk KVM.  However, once we turn
on in-kernel HALTING, QEMU starts to have some serious problems that were
attributed to this bug.

Signed-off-by: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
---

 qemu/qemu-kvm.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 1849997..5b5c739 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -452,11 +452,8 @@ void kvm_save_registers(CPUState *env)
 int kvm_cpu_exec(CPUState *env)
 {
     int r;
-    int pending = (!env->ready_for_interrupt_injection ||
-                   ((env->interrupt_request & CPU_INTERRUPT_HARD) &&
-		   (env->eflags & IF_MASK)));
 
-    if (!pending && (env->interrupt_request & CPU_INTERRUPT_EXIT)) {
+    if (env->interrupt_request & CPU_INTERRUPT_EXIT) {
         env->interrupt_request &= ~CPU_INTERRUPT_EXIT;
         env->exception_index = EXCP_INTERRUPT;
         cpu_loop_exit();


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM-USER: Fix for CPU interrupts in QEMU
       [not found] ` <20070712151200.7060.91407.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
@ 2007-07-12 15:39   ` Dong, Eddie
  2007-07-15  7:39   ` Avi Kivity
  1 sibling, 0 replies; 7+ messages in thread
From: Dong, Eddie @ 2007-07-12 15:39 UTC (permalink / raw)
  To: Gregory Haskins, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Greg:
	I think you need to do the whole patch for this including kernel
side. Will u ?
eddie

Gregory Haskins wrote:
> QEMU-KVM has a bug where the interruptibility of the CPU is
> predicated on pending interrupts.  If the reason that a CPU is
> interrupted 
> is because we
> need to inject interrupts, the current code will just keep
> looping and miss
> the event window.
> 
> This doesnt seem to cause problems with in-trunk KVM.
> However, once we turn
> on in-kernel HALTING, QEMU starts to have some serious
> problems that were
> attributed to this bug.
> 
> Signed-off-by: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org> ---
> 
> qemu/qemu-kvm.c |    5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
> index 1849997..5b5c739 100644
> --- a/qemu/qemu-kvm.c
> +++ b/qemu/qemu-kvm.c
> @@ -452,11 +452,8 @@ void kvm_save_registers(CPUState *env)
> int kvm_cpu_exec(CPUState *env)
> {
>     int r;
> -    int pending = (!env->ready_for_interrupt_injection ||
> -                   ((env->interrupt_request & CPU_INTERRUPT_HARD) &&
> -		   (env->eflags & IF_MASK)));
> 
> -    if (!pending && (env->interrupt_request & CPU_INTERRUPT_EXIT)) {
> +    if (env->interrupt_request & CPU_INTERRUPT_EXIT) {
>         env->interrupt_request &= ~CPU_INTERRUPT_EXIT;
>         env->exception_index = EXCP_INTERRUPT;
>         cpu_loop_exit();

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM-USER: Fix for CPU interrupts in QEMU
@ 2007-07-12 15:48 Gregory Haskins
       [not found] ` <469615120200005A0002769E-Igcdv/6uVdMHoYOw/+koYqIwWpluYiW7@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Gregory Haskins @ 2007-07-12 15:48 UTC (permalink / raw)
  To: eddie.dong-ral2JQCrhuEAvxtiuMwx3w
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, 2007-07-12 at 23:39 +0800, Dong, Eddie wrote:
> Greg:
> 	I think you need to do the whole patch for this including kernel
> side. Will u ?

Ya, I can do that.  But I probably wont be able to look at it until this
RT stuff I am working on is done.

-Greg





-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM-USER: Fix for CPU interrupts in QEMU
       [not found] ` <469615120200005A0002769E-Igcdv/6uVdMHoYOw/+koYqIwWpluYiW7@public.gmane.org>
@ 2007-07-12 16:04   ` Dong, Eddie
       [not found]     ` <10EA09EFD8728347A513008B6B0DA77A01C24C4A-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Dong, Eddie @ 2007-07-12 16:04 UTC (permalink / raw)
  To: Gregory Haskins; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Gregory Haskins wrote:
> On Thu, 2007-07-12 at 23:39 +0800, Dong, Eddie wrote:
>> Greg:
>> 	I think you need to do the whole patch for this including kernel
>> side. Will u ?
> 
> Ya, I can do that.  But I probably wont be able to look at it until
> this RT stuff I am working on is done.
> 
Then, Avi:
	Will u check that into lapic2 now, or wait for Greg back to do
more regresstion test and then check in more aggressive approach to
kvm.git? i.e. kernel hlt emulation even for user level irq.
thx,eddie

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM-USER: Fix for CPU interrupts in QEMU
       [not found]     ` <10EA09EFD8728347A513008B6B0DA77A01C24C4A-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-07-14  6:43       ` Avi Kivity
  0 siblings, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2007-07-14  6:43 UTC (permalink / raw)
  To: Dong, Eddie; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dong, Eddie wrote:
> Gregory Haskins wrote:
>   
>> On Thu, 2007-07-12 at 23:39 +0800, Dong, Eddie wrote:
>>     
>>> Greg:
>>> 	I think you need to do the whole patch for this including kernel
>>> side. Will u ?
>>>       
>> Ya, I can do that.  But I probably wont be able to look at it until
>> this RT stuff I am working on is done.
>>
>>     
> Then, Avi:
> 	Will u check that into lapic2 now, or wait for Greg back to do
> more regresstion test and then check in more aggressive approach to
> kvm.git? i.e. kernel hlt emulation even for user level irq.
> thx,eddie
>   

I'll merge it into mainline and rebase lapic2 on top of that, on Sunday.


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM-USER: Fix for CPU interrupts in QEMU
       [not found] ` <20070712151200.7060.91407.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
  2007-07-12 15:39   ` Dong, Eddie
@ 2007-07-15  7:39   ` Avi Kivity
  1 sibling, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2007-07-15  7:39 UTC (permalink / raw)
  To: Gregory Haskins; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Gregory Haskins wrote:
> QEMU-KVM has a bug where the interruptibility of the CPU is predicated on
> pending interrupts.  If the reason that a CPU is interrupted is because we
> need to inject interrupts, the current code will just keep looping and miss
> the event window.
>
> This doesnt seem to cause problems with in-trunk KVM.  However, once we turn
> on in-kernel HALTING, QEMU starts to have some serious problems that were
> attributed to this bug.
>
> Signed-off-by: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
> ---
>
>  qemu/qemu-kvm.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
> index 1849997..5b5c739 100644
> --- a/qemu/qemu-kvm.c
> +++ b/qemu/qemu-kvm.c
> @@ -452,11 +452,8 @@ void kvm_save_registers(CPUState *env)
>  int kvm_cpu_exec(CPUState *env)
>  {
>      int r;
> -    int pending = (!env->ready_for_interrupt_injection ||
> -                   ((env->interrupt_request & CPU_INTERRUPT_HARD) &&
> -		   (env->eflags & IF_MASK)));
>  
> -    if (!pending && (env->interrupt_request & CPU_INTERRUPT_EXIT)) {
> +    if (env->interrupt_request & CPU_INTERRUPT_EXIT) {
>          env->interrupt_request &= ~CPU_INTERRUPT_EXIT;
>          env->exception_index = EXCP_INTERRUPT;
>          cpu_loop_exit();
>
>   

When applied to current HEAD, this doesn't work.  Booting windows or 
Linux, quite soon during boot everything freezes.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM-USER: Fix for CPU interrupts in QEMU
@ 2007-07-16 18:07 Gregory Haskins
  0 siblings, 0 replies; 7+ messages in thread
From: Gregory Haskins @ 2007-07-16 18:07 UTC (permalink / raw)
  To: avi-atKUWr5tajBWk0Htik3J/w; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Sun, 2007-07-15 at 10:39 +0300, Avi Kivity wrote:

> When applied to current HEAD, this doesn't work.  Booting windows or 
> Linux, quite soon during boot everything freezes.


Crap.  Not sure whats happening as I definitely tested that during
development.  Ill have to take a look.

-Greg


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-07-16 18:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-12 15:12 [PATCH] KVM-USER: Fix for CPU interrupts in QEMU Gregory Haskins
     [not found] ` <20070712151200.7060.91407.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-07-12 15:39   ` Dong, Eddie
2007-07-15  7:39   ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2007-07-12 15:48 Gregory Haskins
     [not found] ` <469615120200005A0002769E-Igcdv/6uVdMHoYOw/+koYqIwWpluYiW7@public.gmane.org>
2007-07-12 16:04   ` Dong, Eddie
     [not found]     ` <10EA09EFD8728347A513008B6B0DA77A01C24C4A-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-07-14  6:43       ` Avi Kivity
2007-07-16 18:07 Gregory Haskins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox