From: Erik van der Kouwe <vdkouwe@cs.vu.nl>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] SVM emulation: EVENTINJ marked valid when a pagefault happens while issuing a software interrupt
Date: Thu, 27 May 2010 17:26:11 +0200 [thread overview]
Message-ID: <4BFE8F13.2000009@cs.vu.nl> (raw)
Dear all,
I have been experiencing problems with duplicate delivery of software
interrupts when running a VMM inside QEMU with SVM emulation. I believe
QEMU's behaviour deviates from the SVM specification in "AMD64
Architecture Programmer’s Manual Volume 2 System Programming" but I am
not entirely certain because this specification isn't very clear. I
would like to hear your views on this.
My set-up is as follows:
Host: Linux 2.6.31-21-generic-pae (Ubuntu 9.10)
VMM running on host: QEMU 0.12.3 (compiled from source)
Outer guest: MINIX 3.1.7 (from SVN, see http://www.minix3.org/)
VMM running on outer guest: Palacios 1.2.0 32-bit (from git, see
http://www.v3vee.org/palacios/)
Inner guest: MINIX 3.1.7 (from SVN, see http://www.minix3.org/)
The issue is the following: whenever an software interrupt instruction
(INT n, used in this case to perform a system call) in the inner guest
triggers a page fault (used for shadow paging by Palacios, not a real
guest page fault), QEMU sets the EVENTINV field of the guest VMCB to the
exit information that the software interrupt would produce and marks it
as valid. Palacios does not overwrite the EVENTINJ field, so after the
page fault is handled a software interrupt event is injected. After the
IRET of the interrupt handler, control returns to the original INT n
instruction which once again triggers the interrupt.
This issue is easy to work around by clearing the EVENTINJ field on each
#VMEXIT (and I have submitted a patch to that effect to the Palacios
people) and this approach is also found in KVM.
However, I haven't been able to find information in the AMD
documentation that mentions that the CPU sets the valid bit in the
EVENTINJ field so, unless I am mistaken here, I believe this behaviour
is incorrect. QEMU stores interrupt information in both EVENTINJ and
EXITINTINFO while I believe it should be only in the latter.
Unfortunately I don't have a physical AMD available to verify its behaviour.
The relevant code is in target-i386/op_helper.c. The "handle_even_inj"
function sets the EVENTINJ field (called event_inf in the QEMU code) and
the helper_vmexit function copies that field into EXITINTINFO
(exit_int_info in the QEMU code). I believe (but once again, am not
certain) that the SVM documentation only says that this information
should be stored in EXITINTINFO.
Thanks in advance for any information,
Erik van der Kouwe
next reply other threads:[~2010-05-27 15:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-27 15:26 Erik van der Kouwe [this message]
2010-05-27 18:53 ` [Qemu-devel] Re: SVM emulation: EVENTINJ marked valid when a pagefault happens while issuing a software interrupt Jan Kiszka
2010-05-27 19:49 ` Erik van der Kouwe
2010-05-27 22:20 ` Jan Kiszka
2010-05-28 5:13 ` Erik van der Kouwe
2010-05-28 6:10 ` Jan Kiszka
2010-05-28 7:35 ` Roedel, Joerg
2010-05-28 13:20 ` Jamie Lokier
2010-05-28 13:30 ` Erik van der Kouwe
2010-05-28 13:44 ` Roedel, Joerg
2010-05-28 13:52 ` Erik van der Kouwe
2010-05-28 13:32 ` Roedel, Joerg
2010-05-28 7:33 ` Roedel, Joerg
2010-05-28 7:47 ` Jan Kiszka
2010-05-28 7:24 ` Roedel, Joerg
2010-05-28 7:45 ` Erik van der Kouwe
2010-05-28 9:12 ` Roedel, Joerg
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=4BFE8F13.2000009@cs.vu.nl \
--to=vdkouwe@cs.vu.nl \
--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).