All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Stefan Fritsch <sf@sfritsch.de>
Cc: kvm@vger.kernel.org
Subject: Re: How to do fast accesses to LAPIC TPR under kvm?
Date: Mon, 22 Oct 2012 16:10:30 +0200	[thread overview]
Message-ID: <508553D6.8030709@redhat.com> (raw)
In-Reply-To: <201210200039.16412.sf@sfritsch.de>

On 10/20/2012 12:39 AM, Stefan Fritsch wrote:
> On Thursday 18 October 2012, Avi Kivity wrote:
>> On 10/18/2012 11:35 AM, Gleb Natapov wrote:
>> > You misunderstood the description. V_INTR_MASKING=1 means that
>> > CR8 writes are not propagated to real HW APIC.
>> > 
>> > But KVM does not trap access to CR8 unconditionally. It enables
>> > CR8 intercept only when there is pending interrupt in IRR that
>> > cannot be immediately delivered due to current TPR value. This
>> > should eliminate 99% of CR8 intercepts.
>> 
>> Right.  You will need to expose the alternate encoding of cr8 (IIRC
>> lock mov reg, cr0) on AMD via cpuid, but otherwise it should just
>> work.  Be aware that this will break cross-vendor migration.
> 
> I get an exception and I am not sure why:
> 
> kvm_entry: vcpu 0
> kvm_exit: reason write_cr8 rip 0xd0203788 info 0 0
> kvm_emulate_insn: 0:d0203788: f0 0f 22 c0 (prot32)
> kvm_inj_exception: #UD (0x0)
> 
> This is qemu-kvm 1.1.2 on Linux 3.2.
> 
> When I look at arch/x86/kvm/emulate.c (both the current and the v3.2 
> version), I don't see any special case handling for "lock mov reg, 
> cr0" to mean "mov reg, cr8".

emulate.c will #UD is the Lock flag is missing in the instruction decode
table.

> Before I spend lots of time on debugging my code, can you verify if 
> the alternate encoding of cr8 is actually supported in kvm or if it is 
> maybe missing? Thanks in advance.

With the decode table fix I think it should work.


-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2012-10-22 14:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 19:24 How to do fast accesses to LAPIC TPR under kvm? Stefan Fritsch
2012-10-18  6:13 ` Jan Kiszka
2012-10-18  7:43   ` Stefan Fritsch
2012-10-18  9:35     ` Gleb Natapov
2012-10-18 12:27       ` Avi Kivity
2012-10-18 17:25         ` Stefan Fritsch
2012-10-19 22:39         ` Stefan Fritsch
2012-10-22 14:10           ` Avi Kivity [this message]
2012-10-24  9:19             ` Stefan Fritsch
2012-10-25 13:34               ` 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=508553D6.8030709@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=sf@sfritsch.de \
    /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.