qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: TeLeMan <geleman@gmail.com>
To: Sam King <kingst@uiuc.edu>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] debugging apic
Date: Wed, 29 Sep 2010 08:53:14 +0800	[thread overview]
Message-ID: <AANLkTikuoRjROGCer0aMg-Qt7oYvFVJYofc5CB-5RBcF@mail.gmail.com> (raw)
In-Reply-To: <4CA2069D.9040104@uiuc.edu>

I reported this bug two year ago, but nobody cared.
http://www.mail-archive.com/qemu-devel@nongnu.org/msg15330.html
--
SUN OF A BEACH



On Tue, Sep 28, 2010 at 23:15, Sam King <kingst@uiuc.edu> wrote:
> Hello,
>
> I am seeing a weird crash in my system and I am trying to figure out if it
> is a software bug or a qemu emulation bug.  From the software perspective I
> am getting a GP fault at a time where it looks like everything should be
> running normally.  After digging into the Qemu source code I found out where
> the GPF was coming from.  It looks like intno = -1 when it was being passed
> into do_interrupt64, which was triggering one of the GPF checks.  From what
> I can tell, intno was being set to -1 by an interrupt_request in cpu-exec.c,
> which was going down the following if statement around line 409 of that
> file:
>
> else if ((interrupt_request & CPU_INTERRUPT_HARD) &&
>                                    (((env->hflags2 & HF2_VINTR_MASK) &&
>                                      (env->hflags2 & HF2_HIF_MASK)) ||
>                                     (!(env->hflags2 & HF2_VINTR_MASK) &&
>                                      (env->eflags & IF_MASK &&
>                                       !(env->hflags &
> HF_INHIBIT_IRQ_MASK)))))
>
> and from within that else if statement, env has the following state:
>
> hflags2 = 0x00000001
> eflags = 0x00003202
> hflags = 0x0040c0b7
> interrupt request = 0x00000002
>
> But intno is being set equal to -1 by the call to cpu_get_pic_interrupt,
> from the call to apic_accept_pic_intr returning 0.  If I change the
> cpu_get_pic_interrupt code to this:
>
> int cpu_get_pic_interrupt(CPUState *env)
> {
>     int intno;
>
>     intno = apic_get_interrupt(env);
>     if (intno >= 0) {
>         /* set irq request if a PIC irq is still pending */
>         /* XXX: improve that */
>         pic_update_irq(isa_pic);
>         return intno;
>     }
>     /* read the irq from the PIC */
>     if (!apic_accept_pic_intr(env)) {
>         //return -1;
>     }
>
>     intno = pic_read_irq(isa_pic);
>
>     return intno;
> }
>
> Then the issue manifests as a spurious interrupt and the software ignores
> it, avoiding the GPF.  Does anyone have any ideas as to what is going wrong
> here?  Should I look more closely at the Qemu emulation code or my software?
> Any help is appreciated.
>
> Thanks!
>
> --Sam
>

      parent reply	other threads:[~2010-09-29  0:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28 15:15 [Qemu-devel] debugging apic Sam King
2010-09-28 19:57 ` [Qemu-devel] PATCH: " Sam King
2010-09-29  6:44   ` [Qemu-devel] " Jan Kiszka
2010-09-29 16:47     ` Sam King
2010-09-29  0:53 ` TeLeMan [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=AANLkTikuoRjROGCer0aMg-Qt7oYvFVJYofc5CB-5RBcF@mail.gmail.com \
    --to=geleman@gmail.com \
    --cc=kingst@uiuc.edu \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).