qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Marcel Apfelbaum <marcel@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Luwei Kang <luwei.kang@intel.com>
Subject: [Qemu-devel] [PULL v3 7/7] i386: Disable Intel PT if packets IP payloads have LIP values
Date: Mon, 19 Mar 2018 17:12:55 -0300	[thread overview]
Message-ID: <20180319201255.9317-8-ehabkost@redhat.com> (raw)
In-Reply-To: <20180319201255.9317-1-ehabkost@redhat.com>

From: Luwei Kang <luwei.kang@intel.com>

Intel processor trace should be disabled when
CPUID.(EAX=14H,ECX=0H).ECX.[bit31] is set.
Generated packets which contain IP payloads will have LIP
values when this bit is set, or IP payloads will have RIP
values.
Currently, The information of CPUID 14H is constant to make
live migration safty and this bit is always 0 in guest even
if host support LIP values.
Guest sees the bit is 0 will expect IP payloads with RIP
values, but the host CPU will generate IP payloads with
LIP values if this bit is set in HW.
To make sure the value of IP payloads correctly, Intel PT
should be disabled when bit[31] is set.

Signed-off-by: Luwei Kang <luwei.kang@intel.com>
Message-Id: <1520969191-18162-1-git-send-email-luwei.kang@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 30b4af897b..4f62fe776d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -195,6 +195,8 @@
  * bit[02]: Support Single-Range Output scheme;
  */
 #define INTEL_PT_MINIMAL_ECX     0x7
+/* generated packets which contain IP payloads have LIP values */
+#define INTEL_PT_IP_LIP          (1 << 31)
 #define INTEL_PT_ADDR_RANGES_NUM 0x2 /* Number of configurable address ranges */
 #define INTEL_PT_ADDR_RANGES_NUM_MASK 0x3
 #define INTEL_PT_MTC_BITMAP      (0x0249 << 16) /* Support ART(0,3,6,9) */
@@ -4167,7 +4169,8 @@ static int x86_cpu_filter_features(X86CPU *cpu)
            ((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))) {
+                (INTEL_PT_PSB_BITMAP | INTEL_PT_CYCLE_BITMAP)) ||
+           (ecx_0 & INTEL_PT_IP_LIP)) {
             /*
              * Processor Trace capabilities aren't configurable, so if the
              * host can't emulate the capabilities we report on
-- 
2.14.3

  parent reply	other threads:[~2018-03-19 20:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 20:12 [Qemu-devel] [PULL v3 0/7] Machine and x86 queue, 2018-03-19 Eduardo Habkost
2018-03-19 20:12 ` [Qemu-devel] [PULL v3 1/7] nios2: 10m50_devboard: replace cpu_model with cpu_type Eduardo Habkost
2018-03-19 20:12 ` [Qemu-devel] [PULL v3 2/7] tests: add machine 'none' with -cpu test Eduardo Habkost
2018-03-19 20:12 ` [Qemu-devel] [PULL v3 3/7] cpu: add CPU_RESOLVING_TYPE macro Eduardo Habkost
2018-03-19 20:12 ` [Qemu-devel] [PULL v3 4/7] Use cpu_create(type) instead of cpu_init(cpu_model) Eduardo Habkost
2018-03-19 20:12 ` [Qemu-devel] [PULL v3 5/7] cpu: get rid of unused cpu_init() defines Eduardo Habkost
2018-03-19 20:12 ` [Qemu-devel] [PULL v3 6/7] cpu: drop unnecessary NULL check and cpu_common_class_by_name() Eduardo Habkost
2018-03-19 20:12 ` Eduardo Habkost [this message]
2018-03-20 13:53 ` [Qemu-devel] [PULL v3 0/7] Machine and x86 queue, 2018-03-19 Peter Maydell

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=20180319201255.9317-8-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=luwei.kang@intel.com \
    --cc=marcel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 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).