From: Michael Riepe <michael-0QoEqw4nQxo@public.gmane.org>
To: Carsten Emde <Carsten.Emde-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [ANNOUNCE] kvm-17 release
Date: Sat, 24 Mar 2007 13:29:26 +0100 [thread overview]
Message-ID: <460519A6.1020005@mr511.de> (raw)
In-Reply-To: <46049B0C.40501-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
Hi!
Carsten Emde wrote:
> Actually, the above line can be preserved, if we move the previous line
> down by 1: Was it a simple race?
>
> --- kvm_main-17.c 2007-03-24 02:09:00.000000000 +0100
> +++ kvm_main.c 2007-03-24 04:10:59.000000000 +0100
> @@ -1574,8 +1574,8 @@
>
> if (kvm_run->mmio_completed) {
> memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8);
> - vcpu->mmio_read_completed = 1;
> emulate_instruction(vcpu, kvm_run, vcpu->mmio_fault_cr2, 0);
> + vcpu->mmio_read_completed = 1;
> }
>
> vcpu->mmio_needed = 0;
>
As far as I understand, vcpu->mmio_read_completed indicates that read
data is present in vcpu->mmio_data. If the flag isn't set,
emulator_read_emulated() - which is called by emulate_instruction() -
will try to read the data *again*. While that's supposed to be okay for
ordinary memory, it might make memory mapped i/o devices fail.
On the other hand, emulator_read_emulated() clears the flag to indicate
that the emulated read has actually happened - which means that another
read may drop us into userspace for emulation again. There is, however,
no other place where the flag is reset, so setting it after
emulate_instruction() may affect the *next* emulated instruction. I
think that the flag should be cleared after the call, rather than set.
Besides that, vcpu->mmio_read_completed seems to guard a call to
do_interrupt_requests() in vmx_vcpu_run(). I guess the reason is that
interrupts must not be processed if the current instruction has already
been partially emulated.
Or did I get something wrong?
There's another point here that bothers me: The result of
emulate_instruction() isn't checked. Are you sure that it never fails,
and that it's safe to proceed to kvm_arch_ops->run(), aka vmx_vcpu_run()
in case it's an Intel CPU?
--
Michael "Tired" Riepe <michael-0QoEqw4nQxo@public.gmane.org>
X-Tired: Each morning I get up I die a little
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
next prev parent reply other threads:[~2007-03-24 12:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-20 13:27 [ANNOUNCE] kvm-17 release Avi Kivity
[not found] ` <45FFE14F.6020808-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-22 19:32 ` Michael Riepe
[not found] ` <4602D9D5.7060806-0QoEqw4nQxo@public.gmane.org>
2007-03-23 9:33 ` Avi Kivity
[not found] ` <46039EEA.4070504-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-24 2:25 ` Carsten Emde
[not found] ` <46048C34.4080300-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
2007-03-24 3:29 ` Carsten Emde
[not found] ` <46049B0C.40501-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
2007-03-24 12:29 ` Michael Riepe [this message]
[not found] ` <460519A6.1020005-0QoEqw4nQxo@public.gmane.org>
2007-03-24 13:25 ` Carsten Emde
2007-03-25 8:53 ` Avi Kivity
2007-03-25 8:47 ` Avi Kivity
2007-03-24 11:58 ` Michael Riepe
[not found] ` <46051251.1020401-0QoEqw4nQxo@public.gmane.org>
2007-03-24 13:06 ` Carsten Emde
2007-03-25 8:49 ` Avi Kivity
2007-03-25 8:46 ` Avi Kivity
2007-03-23 9:43 ` 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=460519A6.1020005@mr511.de \
--to=michael-0qoeqw4nqxo@public.gmane.org \
--cc=Carsten.Emde-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.