From: Eduardo Habkost <ehabkost@redhat.com>
To: "Kang, Luwei" <luwei.kang@intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"mtosatti@redhat.com" <mtosatti@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
Chao Peng <chao.p.peng@linux.intel.com>,
"rth@twiddle.net" <rth@twiddle.net>
Subject: Re: [PATCH v4 1/2] i386: Add Intel Processor Trace feature support
Date: Mon, 12 Mar 2018 13:45:17 -0300 [thread overview]
Message-ID: <20180312164517.GS3417@localhost.localdomain> (raw)
In-Reply-To: <82D7661F83C1A047AF7DC287873BF1E167EF4877@SHSMSX101.ccr.corp.intel.com>
On Mon, Mar 12, 2018 at 09:07:41AM +0000, Kang, Luwei wrote:
> > > +
> > > + if (!eax_0 ||
> > > + ((ebx_0 & INTEL_PT_MINIMAL_EBX) != INTEL_PT_MINIMAL_EBX) ||
> > > + ((ecx_0 & INTEL_PT_MINIMAL_ECX) != INTEL_PT_MINIMAL_ECX) ||
> > > + ((eax_1 & INTEL_PT_MTC_BITMAP) != INTEL_PT_MTC_BITMAP) ||
> > > + ((eax_1 & INTEL_PT_ADDR_RANGES_NUM_MASK) <
> > > + INTEL_PT_ADDR_RANGES_NUM) ||
> > > + ((ebx_1 & (INTEL_PT_PSB_BITMAP | INTEL_PT_CYCLE_BITMAP)) !=
> > > + (INTEL_PT_PSB_BITMAP | INTEL_PT_CYCLE_BITMAP))) {
> >
> > I still don't see a check to ensure the host has bit 31 on ecx_0 set to 0, as I mentioned when reviewing v3.
>
> Hi Eduardo,
> Thanks for the code review. I don't quite understand here why bit31 must same with host (meaning we must reject a host
> where ecx_0 & (1 << 31) is set).
If the guest sees the bit set to 0, it will expect IP payloads
with RIP values, but the host CPU will generate IP payloads with
LIP values. I assume KVM won't do RIP<->LIP translation on the
packets generated by the host before the guest sees them, will
it?
> Do you mean PT must be disabled in guest when host bit31 is set?
> Bit 31: If 1, generated packets which contain IP payloads have LIP values, which include the CS base component.
> I can't find any special on this bit. Could you help clarify?
As far as I understand, this bit is special because KVM can't
emulate a value that's different from the host.
--
Eduardo
WARNING: multiple messages have this Message-ID (diff)
From: Eduardo Habkost <ehabkost@redhat.com>
To: "Kang, Luwei" <luwei.kang@intel.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"mtosatti@redhat.com" <mtosatti@redhat.com>,
Chao Peng <chao.p.peng@linux.intel.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"rth@twiddle.net" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v4 1/2] i386: Add Intel Processor Trace feature support
Date: Mon, 12 Mar 2018 13:45:17 -0300 [thread overview]
Message-ID: <20180312164517.GS3417@localhost.localdomain> (raw)
In-Reply-To: <82D7661F83C1A047AF7DC287873BF1E167EF4877@SHSMSX101.ccr.corp.intel.com>
On Mon, Mar 12, 2018 at 09:07:41AM +0000, Kang, Luwei wrote:
> > > +
> > > + if (!eax_0 ||
> > > + ((ebx_0 & INTEL_PT_MINIMAL_EBX) != INTEL_PT_MINIMAL_EBX) ||
> > > + ((ecx_0 & INTEL_PT_MINIMAL_ECX) != INTEL_PT_MINIMAL_ECX) ||
> > > + ((eax_1 & INTEL_PT_MTC_BITMAP) != INTEL_PT_MTC_BITMAP) ||
> > > + ((eax_1 & INTEL_PT_ADDR_RANGES_NUM_MASK) <
> > > + INTEL_PT_ADDR_RANGES_NUM) ||
> > > + ((ebx_1 & (INTEL_PT_PSB_BITMAP | INTEL_PT_CYCLE_BITMAP)) !=
> > > + (INTEL_PT_PSB_BITMAP | INTEL_PT_CYCLE_BITMAP))) {
> >
> > I still don't see a check to ensure the host has bit 31 on ecx_0 set to 0, as I mentioned when reviewing v3.
>
> Hi Eduardo,
> Thanks for the code review. I don't quite understand here why bit31 must same with host (meaning we must reject a host
> where ecx_0 & (1 << 31) is set).
If the guest sees the bit set to 0, it will expect IP payloads
with RIP values, but the host CPU will generate IP payloads with
LIP values. I assume KVM won't do RIP<->LIP translation on the
packets generated by the host before the guest sees them, will
it?
> Do you mean PT must be disabled in guest when host bit31 is set?
> Bit 31: If 1, generated packets which contain IP payloads have LIP values, which include the CS base component.
> I can't find any special on this bit. Could you help clarify?
As far as I understand, this bit is special because KVM can't
emulate a value that's different from the host.
--
Eduardo
next prev parent reply other threads:[~2018-03-12 16:45 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-04 16:48 [PATCH v4 1/2] i386: Add Intel Processor Trace feature support Luwei Kang
2018-03-04 16:48 ` [Qemu-devel] " Luwei Kang
2018-03-04 16:48 ` [PATCH v4 2/2] i386: Add support to get/set/migrate Intel Processor Trace feature Luwei Kang
2018-03-04 16:48 ` [Qemu-devel] " Luwei Kang
2019-10-12 3:14 ` Eduardo Habkost
2019-10-12 3:14 ` Eduardo Habkost
2019-10-15 12:51 ` Kang, Luwei
2019-10-15 12:51 ` Kang, Luwei
2019-10-15 13:29 ` Eduardo Habkost
2019-10-15 13:29 ` Eduardo Habkost
2019-10-21 6:02 ` Kang, Luwei
2019-10-21 6:02 ` Kang, Luwei
2019-10-22 21:44 ` Eduardo Habkost
2019-10-22 21:44 ` Eduardo Habkost
2019-10-24 11:22 ` Kang, Luwei
2019-10-24 11:22 ` Kang, Luwei
2019-10-24 13:24 ` Eduardo Habkost
2019-10-24 13:24 ` Eduardo Habkost
2019-10-24 13:36 ` Kang, Luwei
2019-10-24 13:36 ` Kang, Luwei
2019-10-24 14:15 ` Eduardo Habkost
2019-10-24 14:15 ` Eduardo Habkost
2018-03-09 19:10 ` [PATCH v4 1/2] i386: Add Intel Processor Trace feature support Eduardo Habkost
2018-03-09 19:10 ` [Qemu-devel] " Eduardo Habkost
2018-03-12 9:07 ` Kang, Luwei
2018-03-12 9:07 ` [Qemu-devel] " Kang, Luwei
2018-03-12 16:45 ` Eduardo Habkost [this message]
2018-03-12 16:45 ` Eduardo Habkost
2018-03-13 11:16 ` Kang, Luwei
2018-03-13 11:16 ` [Qemu-devel] " Kang, Luwei
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=20180312164517.GS3417@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=chao.p.peng@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=luwei.kang@intel.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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.