Blob Blame History Raw
From 5763ad32288d76433b01ce87f75cbf886f6f0e20 Mon Sep 17 00:00:00 2001
From: Andrew Jones <drjones@redhat.com>
Date: Tue, 14 Jan 2014 09:26:23 +0100
Subject: [PATCH 14/16] enable pvticketlocks by default

RH-Author: Andrew Jones <drjones@redhat.com>
Message-id: <1389691583-3060-1-git-send-email-drjones@redhat.com>
Patchwork-id: 56650
O-Subject: [RHEL7.0 qemu-kvm PATCH] enable pvticketlocks by default
Bugzilla: 1052340
RH-Acked-by: Rik van Riel <riel@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

RHEL-only
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1052340
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6860390

Let's turn pvticketlocks on by default. We need to get them more exposed
if we're ever going to make a final decision about them being on/off.
So we turn them on now, and if we'll have any issues during our
pre-release testing, then we'll just revert this patch. Since this is
something of a test patch, we leave it as RHEL only for now. We can post
an upstream patch later when we're sure it's the right way to go.

We only enable by default on rhel7 for now, not rhel6 and earlier,
although rhel6 kernels wouldn't enable it anyway, as they don't have
pvticketlocks. Tested by me.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 hw/i386/pc_piix.c | 2 ++
 target-i386/cpu.c | 6 ++++++
 target-i386/cpu.h | 1 +
 3 files changed, 9 insertions(+)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 hw/i386/pc_piix.c |    2 ++
 target-i386/cpu.c |    6 ++++++
 target-i386/cpu.h |    1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 76d6e93..2961bc8 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -902,6 +902,8 @@ static void pc_init_rhel650(QEMUMachineInitArgs *args)
     x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX,
                                 0, CPUID_EXT2_RDTSCP);
 
+    disable_kvm_pv_unhalt();
+
     rom_file_in_ram = false; 
     has_acpi_build = false;
     pc_init_rhel700(args);
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 42105aa..2959915 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -253,6 +253,7 @@ static uint32_t kvm_default_features = (1 << KVM_FEATURE_CLOCKSOURCE) |
         (1 << KVM_FEATURE_ASYNC_PF) |
         (1 << KVM_FEATURE_STEAL_TIME) |
         (1 << KVM_FEATURE_PV_EOI) |
+        (1 << KVM_FEATURE_PV_UNHALT) |
         (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT);
 
 void disable_kvm_pv_eoi(void)
@@ -260,6 +261,11 @@ void disable_kvm_pv_eoi(void)
     kvm_default_features &= ~(1UL << KVM_FEATURE_PV_EOI);
 }
 
+void disable_kvm_pv_unhalt(void)
+{
+    kvm_default_features &= ~(1UL << KVM_FEATURE_PV_UNHALT);
+}
+
 void host_cpuid(uint32_t function, uint32_t count,
                 uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
 {
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 9c55953..37ff264 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1281,6 +1281,7 @@ void do_smm_enter(CPUX86State *env1);
 void cpu_report_tpr_access(CPUX86State *env, TPRAccess access);
 
 void disable_kvm_pv_eoi(void);
+void disable_kvm_pv_unhalt(void);
 
 void x86_cpu_compat_set_features(const char *cpu_model, FeatureWord w,
                                  uint32_t feat_add, uint32_t feat_remove);
-- 
1.7.1