From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: emulator: do not needlesly sync registers from emulator ctxt to vcpu
Date: Wed, 30 Mar 2011 15:26:18 +0200 [thread overview]
Message-ID: <20110330132618.GY7766@redhat.com> (raw)
In-Reply-To: <20110330124828.GX7766@redhat.com>
On Wed, Mar 30, 2011 at 02:48:28PM +0200, Gleb Natapov wrote:
> On Wed, Mar 30, 2011 at 02:17:55PM +0200, Avi Kivity wrote:
> > On 03/30/2011 01:43 PM, Gleb Natapov wrote:
> > >After reboot perf started to work. I ran modified emulator.flat unit
> > >test. It was modified to run test_cmps() in an endless loop.
> > >
> > >Without patch:
> > >1.71% qemu-system-x86 [kvm] [k] x86_emulate_instruction
> > >1.51% qemu-system-x86 [kvm] [k] x86_emulate_instruction
> > >1.68% qemu-system-x86 [kvm] [k] x86_emulate_instruction
> > >
> > >With patch:
> > >0.84% qemu-system-x86 [kvm] [k] x86_emulate_instruction
> > >0.96% qemu-system-x86 [kvm] [k] x86_emulate_instruction
> > >0.89% qemu-system-x86 [kvm] [k] x86_emulate_instruction
> > >
> >
> > The cause might be kvm_rip_write() using vmwrite. Can you use perf
> > to see where the hits are in x86_emulate_instruction?
> >
> > If that's the case, we may be able to do local optimizations to
> > kvm_rip_write(), kvm_set_rflags(), and toggle_interruptiblity()
> > instead of this global change.
> >
> I can leave copying there and eliminate only kvm_rip_write and see
> perf data.
>
1.75% qemu-system-x86 [kvm] [k] x86_emulate_instruction
1.60% qemu-system-x86 [kvm] [k] x86_emulate_instruction
1.42% qemu-system-x86 [kvm] [k] x86_emulate_instruction
This is with copy in place, but those are under if (writeback):
toggle_interruptibility(vcpu,
vcpu->arch.emulate_ctxt.interruptibility);
kvm_set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
kvm_make_request(KVM_REQ_EVENT, vcpu);
vcpu->arch.emulate_regs_need_sync_to_vcpu = false;
kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip);
--
Gleb.
next prev parent reply other threads:[~2011-03-30 13:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-29 12:08 [PATCH] KVM: emulator: do not needlesly sync registers from emulator ctxt to vcpu Gleb Natapov
2011-03-30 10:38 ` Avi Kivity
2011-03-30 10:47 ` Gleb Natapov
2011-03-30 10:50 ` Avi Kivity
2011-03-30 11:22 ` Gleb Natapov
2011-03-30 11:43 ` Gleb Natapov
2011-03-30 12:12 ` Avi Kivity
2011-03-30 12:12 ` Avi Kivity
2011-03-30 12:17 ` Avi Kivity
2011-03-30 12:48 ` Gleb Natapov
2011-03-30 13:26 ` Gleb Natapov [this message]
2011-03-30 13:29 ` Avi Kivity
2011-03-30 13:36 ` Gleb Natapov
2011-03-30 13:41 ` Avi Kivity
2011-03-30 13:43 ` Gleb Natapov
2011-03-30 13:46 ` 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=20110330132618.GY7766@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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