From: Gleb Natapov <gleb@redhat.com>
To: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 22/24] KVM: x86 emulator: restart string instruction without going back to a guest.
Date: Thu, 11 Mar 2010 12:07:59 +0200 [thread overview]
Message-ID: <20100311100759.GC16909@redhat.com> (raw)
In-Reply-To: <4B98BEB6.3030407@oss.ntt.co.jp>
On Thu, Mar 11, 2010 at 06:58:14PM +0900, Takuya Yoshikawa wrote:
> Gleb Natapov wrote:
> >On Wed, Mar 10, 2010 at 07:08:31PM +0900, Takuya Yoshikawa wrote:
> >>Gleb Natapov wrote:
> >>>>>Entering guest from time to time will not change semantics of the
> >>>>>processor (if code is not modified under processor's feet at least).
> >>>>>Currently we reenter guest mode after each iteration of string
> >>>>>instruction for all instruction but ins/outs.
> >>>>>
> >>>>E.g., is there no chance that during the repetitions, in the middle of the
> >>>>repetitions, page faults occur? If it can, without entering the guest, can
> >>>>we handle it?
> >>>>-- I lack some basic assumptions?
> >>>>
> >>>If page fault occurs we inject it to the guest.
> >>>
> >>Oh, I maight fail to tell what I worried about.
> >>Opposite, I mean, I worried about NOT reentering the guest case.
> >>
> >Are you thinking about something specific here? If we inject exceptions
> Yes.
>
> >when they occur and we inject interrupt when they arrive what problem do
> >you see? I guess this is how real CPU actually works. I doubt it
> >re-reads string instruction on each iteration.
>
> No problem if we detect and inject page faults like that.
>
Yes, that part is missing from my patch.
> I just didn't so certain that when we encounter a page fault in the middle
> of the repetitions(about rep specific case), if we can inject it, suspend the
> repetition and enter the guest immediately like SDM Vol.2B says:
>
> "A repeating string operation can be suspended by an exception or interrupt.
> When this happens, the state of the registers is preserved to allow the string
> operation to be resumed upon a return from the exception or interrupt handler.
> ...
> This mechanism allows long string operations to proceed without affecting the
> interrupt response time of the system."
>
> Ah, I might misunderstand that if we reenter the guest every time for rep,
> page fault detection, not injection, can be done by the other ways easily,
> by EXIT reason or something. Both ways may need the same thing, sorry.
When instruction is emulated page fault detection is done by the
emulator itself. During guest entry the exception is injected. So all we
need to do in the emulator is to enter guest immediately when exception
condition is detected.
>
> Another concern I wrote was just about the dependencies between your
> "time to time" criteria and SDM's "without affecting the interrupt response time".
> This is just the problem of how we can determine the criteria appropriately.
>
We can reenter guest immediately if there is pending interrupt (we can't
do that with ins read ahead, but this optimization is non architectural anyway).
> >>I know that current implementation with reentrance is OK.
> >Current implementation does not reenter guest on each iteration for pio
> >string, so currently we have both variants.
>
> I'm sorry, I was confused as if the current implementation already
> included some of your patches.
>
It's independent from my patches. This is how string pio always worked.
Otherwise certain workloads are too slow.
> >
> >>To inject a page fault without reentering the guest, we need to add
> >>some more hacks to the emulator IIUC.
> >>
> >No, we just need to enter guest if exception happens. I see that this in
> >handled incorrectly in my current patch series.
>
> I was just not certain if the following condition(from SDM Vol.2B) is satisfied
>
> "The source and destination registers point to the next string elements
> to be operated on, the EIP register points to the string instruction,
> and the ECX register has the value it held following the last successful
> iteration of the instruction."
It is satisfied. Writeback is done on each iteration.
>
> in the emulator's fault handling. I should have read your patch more closely.
>
> Thanks,
> Takuya
--
Gleb.
next prev parent reply other threads:[~2010-03-11 10:08 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 14:08 [PATCH 00/24] [RFC] emulator cleanup Gleb Natapov
2010-03-09 14:08 ` [PATCH 01/24] KVM: Remove pointer to rflags from realmode_set_cr parameters Gleb Natapov
2010-03-09 14:09 ` [PATCH 02/24] KVM: Provide callback to get/set control registers in emulator ops Gleb Natapov
2010-03-09 14:18 ` Avi Kivity
2010-03-09 14:24 ` Gleb Natapov
2010-03-09 14:09 ` [PATCH 03/24] KVM: remove realmode_lmsw function Gleb Natapov
2010-03-09 14:09 ` [PATCH 04/24] KVM: Provide current CPL as part of emulator context Gleb Natapov
2010-03-09 14:24 ` Avi Kivity
2010-03-09 14:27 ` Gleb Natapov
2010-03-09 14:09 ` [PATCH 05/24] KVM: Provide current eip " Gleb Natapov
2010-03-09 14:09 ` [PATCH 06/24] KVM: x86 emulator: fix mov r/m, sreg emulation Gleb Natapov
2010-03-09 14:09 ` [PATCH 07/24] KVM: x86 emulator: fix 0f 01 /5 emulation Gleb Natapov
2010-03-09 14:27 ` Avi Kivity
2010-03-09 14:33 ` Gleb Natapov
2010-03-09 14:34 ` Avi Kivity
2010-03-09 14:09 ` [PATCH 08/24] KVM: x86 emulator: 0f (20|21|22|23) ignore mod bits Gleb Natapov
2010-03-09 14:09 ` [PATCH 09/24] KVM: x86 emulator: inject #UD on access to non-existing CR Gleb Natapov
2010-03-09 14:09 ` [PATCH 10/24] KVM: x86 emulator: fix mov dr to inject #UD when needed Gleb Natapov
2010-03-09 14:09 ` [PATCH 11/24] KVM: x86 emulator: fix return values of syscall/sysenter/sysexit emulations Gleb Natapov
2010-03-09 14:09 ` [PATCH 12/24] KVM: x86 emulator: do not call writeback if msr access fails Gleb Natapov
2010-03-09 14:09 ` [PATCH 13/24] KVM: x86 emulator: If LOCK prefix is used dest arg should be memory Gleb Natapov
2010-03-09 14:09 ` [PATCH 14/24] KVM: x86 emulator: cleanup grp3 return value Gleb Natapov
2010-03-09 14:09 ` [PATCH 15/24] KVM: x86 emulator: Provide more callbacks for x86 emulator Gleb Natapov
2010-03-09 14:43 ` Avi Kivity
2010-03-09 16:25 ` Gleb Natapov
2010-03-09 17:22 ` Avi Kivity
2010-03-09 17:57 ` Gleb Natapov
2010-03-10 9:11 ` Avi Kivity
2010-03-09 14:09 ` [PATCH 16/24] KVM: x86 emulator: Emulate task switch in emulator.c Gleb Natapov
2010-03-09 14:09 ` [PATCH 17/24] KVM: x86 emulator: Use load_segment_descriptor() instead of kvm_load_segment_descriptor() Gleb Natapov
2010-03-09 14:09 ` [PATCH 18/24] KVM: Use task switch from emulator.c Gleb Natapov
2010-03-09 14:09 ` [PATCH 19/24] KVM: x86 emulator: fix in/out emulation Gleb Natapov
2010-03-09 14:47 ` Avi Kivity
2010-03-09 18:09 ` Gleb Natapov
2010-03-10 9:12 ` Avi Kivity
2010-03-10 14:41 ` Gleb Natapov
2010-03-09 14:09 ` [PATCH 20/24] KVM: x86 emulator: Move string pio emulation into emulator.c Gleb Natapov
2010-03-09 14:09 ` [PATCH 21/24] KVM: x86 emulator: remove saved_eip Gleb Natapov
2010-03-09 14:09 ` [PATCH 22/24] KVM: x86 emulator: restart string instruction without going back to a guest Gleb Natapov
2010-03-09 14:50 ` Avi Kivity
2010-03-09 18:11 ` Gleb Natapov
2010-03-10 2:30 ` Takuya Yoshikawa
2010-03-10 9:06 ` Gleb Natapov
2010-03-10 9:12 ` Takuya Yoshikawa
2010-03-10 9:14 ` Avi Kivity
2010-03-10 9:15 ` Gleb Natapov
2010-03-10 10:08 ` Takuya Yoshikawa
2010-03-10 13:48 ` Gleb Natapov
2010-03-11 9:58 ` Takuya Yoshikawa
2010-03-11 10:07 ` Gleb Natapov [this message]
2010-03-10 9:13 ` Avi Kivity
2010-03-09 14:09 ` [PATCH 23/24] KVM: x86 emulator: introduce pio in string read ahead Gleb Natapov
2010-03-09 14:09 ` [PATCH 24/24] KVM: small kvm_arch_vcpu_ioctl_run() cleanup Gleb Natapov
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=20100311100759.GC16909@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
/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