mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Denys Vlasenko <vda.linux@googlemail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: lguest: bug in lg_irq_enable?
Date: Mon, 02 Mar 2015 10:44:55 +1030	[thread overview]
Message-ID: <874mq4l0g0.fsf@rustcorp.com.au> (raw)
In-Reply-To: <CAK1hOcMg328+Jd9cgnpToKknDUa47Sz-cwBaLVKiya33JwUXNw@mail.gmail.com>

Denys Vlasenko <vda.linux@googlemail.com> writes:
> ENTRY(lg_irq_enable)
>         /*
>          * The reverse of irq_disable, this sets lguest_data.irq_enabled to
>          * X86_EFLAGS_IF (ie. "Interrupts enabled").
>          */
>         movl $X86_EFLAGS_IF, lguest_data+LGUEST_DATA_irq_enabled
>         /*
>          * But now we need to check if the Host wants to know: there might have
>          * been interrupts waiting to be delivered, in which case it will have
>          * set lguest_data.irq_pending to X86_EFLAGS_IF.  If it's not zero, we
>          * jump to send_interrupts, otherwise we're done.
>          */
>         testl $0, lguest_data+LGUEST_DATA_irq_pending
> ^^^^^^^^^^^^^^^^^??????????

Heh, that should be cmpl!  Nice catch!

Cheers,
Rusty.

Subject: lguest: fix pending interrupt test.

Denys says:
  TEST with zero will always set ZF. Thus, "jnz send_interrupts" never jumps.

We get interrupts regularly enough that this didn't cause immediate problems.

Reported-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff --git a/arch/x86/lguest/head_32.S b/arch/x86/lguest/head_32.S
index 6ddfe4fc23c3..05b0a85507ce 100644
--- a/arch/x86/lguest/head_32.S
+++ b/arch/x86/lguest/head_32.S
@@ -84,7 +84,7 @@ ENTRY(lg_irq_enable)
 	 * set lguest_data.irq_pending to X86_EFLAGS_IF.  If it's not zero, we
 	 * jump to send_interrupts, otherwise we're done.
 	 */
-	testl $0, lguest_data+LGUEST_DATA_irq_pending
+	cmpl $0, lguest_data+LGUEST_DATA_irq_pending
 	jnz send_interrupts
 	/*
 	 * One cool thing about x86 is that you can do many things without using


      reply	other threads:[~2015-03-02 10:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26 15:39 Denys Vlasenko
2015-03-02  0:14 ` Rusty Russell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874mq4l0g0.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda.linux@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome