From: Avi Kivity <avi@redhat.com>
To: Mathias Krause <minipli@googlemail.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/8] KVM: x86 emulator: use aligned variants of SSE register ops
Date: Tue, 04 Sep 2012 15:09:42 +0300 [thread overview]
Message-ID: <5045EF86.4080600@redhat.com> (raw)
In-Reply-To: <1346283020-22385-3-git-send-email-minipli@googlemail.com>
On 08/30/2012 02:30 AM, Mathias Krause wrote:
> As the the compiler ensures that the memory operand is always aligned
> to a 16 byte memory location,
I'm not sure it does. Is V4SI aligned? Do we use alignof() to
propagate the alignment to the vcpu allocation code?
> use the aligned variant of MOVDQ for
> read_sse_reg() and write_sse_reg().
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 1451cff..5a0fee1 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -909,23 +909,23 @@ static void read_sse_reg(struct x86_emulate_ctxt *ctxt, sse128_t *data, int reg)
> {
> ctxt->ops->get_fpu(ctxt);
> switch (reg) {
> - case 0: asm("movdqu %%xmm0, %0" : "=m"(*data)); break;
> - case 1: asm("movdqu %%xmm1, %0" : "=m"(*data)); break;
> - case 2: asm("movdqu %%xmm2, %0" : "=m"(*data)); break;
> - case 3: asm("movdqu %%xmm3, %0" : "=m"(*data)); break;
> - case 4: asm("movdqu %%xmm4, %0" : "=m"(*data)); break;
> - case 5: asm("movdqu %%xmm5, %0" : "=m"(*data)); break;
> - case 6: asm("movdqu %%xmm6, %0" : "=m"(*data)); break;
> - case 7: asm("movdqu %%xmm7, %0" : "=m"(*data)); break;
> + case 0: asm("movdqa %%xmm0, %0" : "=m"(*data)); break;
> + case 1: asm("movdqa %%xmm1, %0" : "=m"(*data)); break;
> + case 2: asm("movdqa %%xmm2, %0" : "=m"(*data)); break;
> + case 3: asm("movdqa %%xmm3, %0" : "=m"(*data)); break;
> + case 4: asm("movdqa %%xmm4, %0" : "=m"(*data)); break;
> + case 5: asm("movdqa %%xmm5, %0" : "=m"(*data)); break;
> + case 6: asm("movdqa %%xmm6, %0" : "=m"(*data)); break;
> + case 7: asm("movdqa %%xmm7, %0" : "=m"(*data)); break;
> #ifdef CONFIG_X86_64
> - case 8: asm("movdqu %%xmm8, %0" : "=m"(*data)); break;
> - case 9: asm("movdqu %%xmm9, %0" : "=m"(*data)); break;
> - case 10: asm("movdqu %%xmm10, %0" : "=m"(*data)); break;
> - case 11: asm("movdqu %%xmm11, %0" : "=m"(*data)); break;
> - case 12: asm("movdqu %%xmm12, %0" : "=m"(*data)); break;
> - case 13: asm("movdqu %%xmm13, %0" : "=m"(*data)); break;
> - case 14: asm("movdqu %%xmm14, %0" : "=m"(*data)); break;
> - case 15: asm("movdqu %%xmm15, %0" : "=m"(*data)); break;
> + case 8: asm("movdqa %%xmm8, %0" : "=m"(*data)); break;
> + case 9: asm("movdqa %%xmm9, %0" : "=m"(*data)); break;
> + case 10: asm("movdqa %%xmm10, %0" : "=m"(*data)); break;
> + case 11: asm("movdqa %%xmm11, %0" : "=m"(*data)); break;
> + case 12: asm("movdqa %%xmm12, %0" : "=m"(*data)); break;
> + case 13: asm("movdqa %%xmm13, %0" : "=m"(*data)); break;
> + case 14: asm("movdqa %%xmm14, %0" : "=m"(*data)); break;
> + case 15: asm("movdqa %%xmm15, %0" : "=m"(*data)); break;
> #endif
> default: BUG();
The vmexit costs dominates any win here by several orders of magnitude.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-09-04 12:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-29 23:30 [PATCH 0/8] KVM: minor cleanups and optimizations Mathias Krause
2012-08-29 23:30 ` [PATCH 1/8] KVM: x86: minor size optimization Mathias Krause
2012-08-29 23:30 ` [PATCH 2/8] KVM: x86 emulator: use aligned variants of SSE register ops Mathias Krause
2012-09-04 12:09 ` Avi Kivity [this message]
2012-09-04 12:13 ` Avi Kivity
2012-09-04 12:51 ` Mathias Krause
2012-09-05 9:43 ` Avi Kivity
2012-08-29 23:30 ` [PATCH 3/8] KVM: x86: mark opcode tables const Mathias Krause
2012-08-29 23:30 ` [PATCH 4/8] KVM: x86: constify emulate_ops Mathias Krause
2012-08-29 23:30 ` [PATCH 5/8] KVM: x86: constify read_write_emulator_ops Mathias Krause
2012-08-29 23:30 ` [PATCH 6/8] KVM: x86: more constification Mathias Krause
2012-08-29 23:30 ` [PATCH 7/8] KVM: VMX: constify lookup tables Mathias Krause
2012-08-29 23:30 ` [PATCH 8/8] KVM: SVM: " Mathias Krause
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=5045EF86.4080600@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minipli@googlemail.com \
--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;
as well as URLs for NNTP newsgroup(s).