From: Paolo Bonzini <pbonzini@redhat.com>
To: Jian Zhou <jianjay.zhou@huawei.com>,
herongguang.he@huawei.com, zhang.zhanghailiang@huawei.com,
gleb@kernel.org, tglx@linutronix.de, mingo@redhat.com,
hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: weidong.huang@huawei.com, peter.huangpeng@huawei.com
Subject: Re: [PATCH] KVM: VMX: enable LBR virtualization
Date: Thu, 15 Oct 2015 17:03:04 +0200 [thread overview]
Message-ID: <561FC028.8000006@redhat.com> (raw)
In-Reply-To: <561FAF51.4090101@huawei.com>
On 15/10/2015 15:51, Jian Zhou wrote:
>
>
> On 2015/10/14 19:30, Paolo Bonzini wrote:
>>
>>
>> On 14/10/2015 13:26, Jian Zhou wrote:
>>> On 12/10/2015 20:44, Paolo Bonzini wrote:
>>>> In addition, the MSR numbers may differ between the guest and the host,
>>>> because it is possible to emulate e.g. a Core CPU on a Core 2 CPU.
>>>> So I
>>>> recommend against using the atomic switch mechanism for the from/to
>>>> MSRs.
>>>
>>> The vLBR feature depends on vPMU, and to enable vPMU, it needs to
>>> specify the "cpu mode" in the guest XML as host-passthrough. I think
>>> the MSR numbers between the guest and the host are the same in this
>>> senario.
>>
>> Does it depend on vPMU _for Linux guests_ or in general? My impression
>> is that LBR can be used by the guest independent of the PMU.
>
> I think only for Linux guests.
>
> I googled how to enable LBR on other guests(except Linux guests),
> e.g. Windows, and got no developer manuals about it.
>
> Here is an article about it:
> http://www.codeproject.com/Articles/517466/Last-branch-records-
> and-branch-tracing
> it says:
> "bit 8 of DR7 represents bit 0 of DebugCtl. This is the LBR bit."
Don't worry about the operating system in the guest: you are just
emulating a processor feature, you do not care about anything except
what is written in the Intel SDM.
You can use kvm-unit-tests
(https://git.kernel.org/cgit/virt/kvm/kvm-unit-tests.git/) to write a
test for your feature. There are existing tests for debugging features.
Thanks,
Paolo
next prev parent reply other threads:[~2015-10-15 15:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-10 10:11 [PATCH] KVM: VMX: enable LBR virtualization Jian Zhou
2015-10-12 12:10 ` Jian Zhou
2015-10-12 12:44 ` Paolo Bonzini
2015-10-14 11:26 ` Jian Zhou
2015-10-14 11:30 ` Paolo Bonzini
2015-10-15 13:51 ` Jian Zhou
2015-10-15 15:03 ` Paolo Bonzini [this message]
2015-10-16 0:54 ` Jian Zhou
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=561FC028.8000006@redhat.com \
--to=pbonzini@redhat.com \
--cc=gleb@kernel.org \
--cc=herongguang.he@huawei.com \
--cc=hpa@zytor.com \
--cc=jianjay.zhou@huawei.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=tglx@linutronix.de \
--cc=weidong.huang@huawei.com \
--cc=x86@kernel.org \
--cc=zhang.zhanghailiang@huawei.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 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.