0a122b
From 5763ad32288d76433b01ce87f75cbf886f6f0e20 Mon Sep 17 00:00:00 2001
0a122b
From: Andrew Jones <drjones@redhat.com>
0a122b
Date: Tue, 14 Jan 2014 09:26:23 +0100
0a122b
Subject: [PATCH 14/16] enable pvticketlocks by default
0a122b
0a122b
RH-Author: Andrew Jones <drjones@redhat.com>
0a122b
Message-id: <1389691583-3060-1-git-send-email-drjones@redhat.com>
0a122b
Patchwork-id: 56650
0a122b
O-Subject: [RHEL7.0 qemu-kvm PATCH] enable pvticketlocks by default
0a122b
Bugzilla: 1052340
0a122b
RH-Acked-by: Rik van Riel <riel@redhat.com>
0a122b
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
RHEL-only
0a122b
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1052340
0a122b
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6860390
0a122b
0a122b
Let's turn pvticketlocks on by default. We need to get them more exposed
0a122b
if we're ever going to make a final decision about them being on/off.
0a122b
So we turn them on now, and if we'll have any issues during our
0a122b
pre-release testing, then we'll just revert this patch. Since this is
0a122b
something of a test patch, we leave it as RHEL only for now. We can post
0a122b
an upstream patch later when we're sure it's the right way to go.
0a122b
0a122b
We only enable by default on rhel7 for now, not rhel6 and earlier,
0a122b
although rhel6 kernels wouldn't enable it anyway, as they don't have
0a122b
pvticketlocks. Tested by me.
0a122b
0a122b
Signed-off-by: Andrew Jones <drjones@redhat.com>
0a122b
---
0a122b
 hw/i386/pc_piix.c | 2 ++
0a122b
 target-i386/cpu.c | 6 ++++++
0a122b
 target-i386/cpu.h | 1 +
0a122b
 3 files changed, 9 insertions(+)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/i386/pc_piix.c |    2 ++
0a122b
 target-i386/cpu.c |    6 ++++++
0a122b
 target-i386/cpu.h |    1 +
0a122b
 3 files changed, 9 insertions(+), 0 deletions(-)
0a122b
0a122b
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
0a122b
index 76d6e93..2961bc8 100644
0a122b
--- a/hw/i386/pc_piix.c
0a122b
+++ b/hw/i386/pc_piix.c
0a122b
@@ -902,6 +902,8 @@ static void pc_init_rhel650(QEMUMachineInitArgs *args)
0a122b
     x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX,
0a122b
                                 0, CPUID_EXT2_RDTSCP);
0a122b
 
0a122b
+    disable_kvm_pv_unhalt();
0a122b
+
0a122b
     rom_file_in_ram = false; 
0a122b
     has_acpi_build = false;
0a122b
     pc_init_rhel700(args);
0a122b
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
0a122b
index 42105aa..2959915 100644
0a122b
--- a/target-i386/cpu.c
0a122b
+++ b/target-i386/cpu.c
0a122b
@@ -253,6 +253,7 @@ static uint32_t kvm_default_features = (1 << KVM_FEATURE_CLOCKSOURCE) |
0a122b
         (1 << KVM_FEATURE_ASYNC_PF) |
0a122b
         (1 << KVM_FEATURE_STEAL_TIME) |
0a122b
         (1 << KVM_FEATURE_PV_EOI) |
0a122b
+        (1 << KVM_FEATURE_PV_UNHALT) |
0a122b
         (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT);
0a122b
 
0a122b
 void disable_kvm_pv_eoi(void)
0a122b
@@ -260,6 +261,11 @@ void disable_kvm_pv_eoi(void)
0a122b
     kvm_default_features &= ~(1UL << KVM_FEATURE_PV_EOI);
0a122b
 }
0a122b
 
0a122b
+void disable_kvm_pv_unhalt(void)
0a122b
+{
0a122b
+    kvm_default_features &= ~(1UL << KVM_FEATURE_PV_UNHALT);
0a122b
+}
0a122b
+
0a122b
 void host_cpuid(uint32_t function, uint32_t count,
0a122b
                 uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
0a122b
 {
0a122b
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
0a122b
index 9c55953..37ff264 100644
0a122b
--- a/target-i386/cpu.h
0a122b
+++ b/target-i386/cpu.h
0a122b
@@ -1281,6 +1281,7 @@ void do_smm_enter(CPUX86State *env1);
0a122b
 void cpu_report_tpr_access(CPUX86State *env, TPRAccess access);
0a122b
 
0a122b
 void disable_kvm_pv_eoi(void);
0a122b
+void disable_kvm_pv_unhalt(void);
0a122b
 
0a122b
 void x86_cpu_compat_set_features(const char *cpu_model, FeatureWord w,
0a122b
                                  uint32_t feat_add, uint32_t feat_remove);
0a122b
-- 
0a122b
1.7.1
0a122b