From: Avi Kivity <avi@qumranet.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: kvm-devel@lists.sourceforge.net
Subject: Re: [PATCH] x86: handle double and triple faults for every exception
Date: Wed, 30 Apr 2008 13:52:02 +0300 [thread overview]
Message-ID: <48184F52.4050002@qumranet.com> (raw)
In-Reply-To: <48184D07.2090409@siemens.com>
Jan Kiszka wrote:
>>> Clear the pending original exception when raising a triple fault. This
>>> allows to re-use the vcpu instance, e.g. after a reset which is
>>> typically issued as reaction on the triple fault.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>>> ---
>>> arch/x86/kvm/x86.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> Index: b/arch/x86/kvm/x86.c
>>> ===================================================================
>>> --- a/arch/x86/kvm/x86.c
>>> +++ b/arch/x86/kvm/x86.c
>>> @@ -149,8 +149,10 @@ static void handle_multiple_faults(struc
>>> if (vcpu->arch.exception.nr != DF_VECTOR) {
>>> vcpu->arch.exception.nr = DF_VECTOR;
>>> vcpu->arch.exception.error_code = 0;
>>> - } else
>>> + } else {
>>> set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests);
>>> + vcpu->arch.exception.pending = false;
>>> + }
>>> }
>>>
>>> void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr)
>>>
>>>
>>>
>> There's a bigger problem here. The exception queue is hidden state that
>> qemu and load and save.
>>
>
> Could you elaborate a bit on what the problematic scenario precisely is
> (that pending triple faults would not be saved/restored while pending
> exceptions are?), and if I/we can do anything to resolve it?
>
Two scenarios:
savevm (no pending exception)
guest runs...
loadvm (with a pending exception in the current state)
spurious exception injected
savevm (pending exception, lost)
new qemu instance (or live migration)
loadvm (exception not delivered)
The second scenario is not too bad, I guess: for fault-like exceptions,
the first instruction would fault again and the exception would be
regenerated. The first scenario is bad, but I guess very unlikely.
One fix would be to expose the exception queue to userspace. I don't
like it since this is not x86 architectural state but a kvm artifact.
Maybe we should clear the exception queue on kvm_set_sregs() (that
should fix the reset case as well).
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
next prev parent reply other threads:[~2008-04-30 10:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-29 15:02 [PATCH] x86: handle double and triple faults for every exception Joerg Roedel
2008-04-30 8:45 ` Jan Kiszka
2008-04-30 9:48 ` Joerg Roedel
2008-04-30 9:51 ` Avi Kivity
2008-04-30 10:42 ` Jan Kiszka
2008-04-30 10:52 ` Avi Kivity [this message]
2008-04-30 15:59 ` Jan Kiszka
2008-04-30 17:09 ` Avi Kivity
2008-05-02 11:07 ` Avi Kivity
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=48184F52.4050002@qumranet.com \
--to=avi@qumranet.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm-devel@lists.sourceforge.net \
/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