Skip to contentSkip to conversation

qemu-kvm.git uq/master queue

GIT PULL In review Marcelo Tosatti 4 participants 16 messages Oct 3, 2011 – Oct 10, 2011 KVM

lore
Share & tools
lore
#0 lore raw

The following changes since commit d11cf8cc80d946dfc9a23597cd9a0bb1c487cfa7:

etrax-dma: Remove bogus if statement (2011-10-03 10:20:13 +0200)

are available in the git repository at:
git://github.com/avikivity/qemu.git uq/master

Liu, Jinsong (1):
kvm: support TSC deadline MSR

 target-i386/cpu.h     |    4 +++-
 target-i386/kvm.c     |   14 ++++++++++++++
 target-i386/machine.c |    1 +
 3 files changed, 18 insertions(+), 1 deletions(-)
#1 lore raw

PATCH 1/1 kvm: support TSC deadline MSR

From: "Liu, Jinsong" <[email protected]>

KVM add emulation of lapic tsc deadline timer for guest. This patch is co-operation work at qemu side.

---
 target-i386/cpu.h     |    4 +++-
 target-i386/kvm.c     |   14 ++++++++++++++
 target-i386/machine.c |    1 +
 3 files changed, 18 insertions(+), 1 deletions(-)
target-i386/cpu.h +3 -1
index ae36489..a973f2e 100644
@@ -283,6 +283,7 @@
 #define MSR_IA32_APICBASE_BSP           (1<<8)
 #define MSR_IA32_APICBASE_ENABLE        (1<<11)
 #define MSR_IA32_APICBASE_BASE          (0xfffff<<12)
+#define MSR_IA32_TSCDEADLINE            0x6e0
 
 #define MSR_MTRRcap			0xfe
 #define MSR_MTRRcap_VCNT		8
@@ -687,6 +688,7 @@ typedef struct CPUX86State {
     uint64_t async_pf_en_msr;
 
     uint64_t tsc;
+    uint64_t tsc_deadline;
 
     uint64_t mcg_status;
 
@@ -947,7 +949,7 @@ uint64_t cpu_get_tsc(CPUX86State *env);
 #define cpu_list_id x86_cpu_list
 #define cpudef_setup	x86_cpudef_setup
 
-#define CPU_SAVE_VERSION 12
+#define CPU_SAVE_VERSION 13
 
 /* MMU modes definitions */
 #define MMU_MODE0_SUFFIX _kernel
target-i386/kvm.c +14 -0
index b6eef04..90a6ffb 100644
@@ -59,6 +59,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
 
 static bool has_msr_star;
 static bool has_msr_hsave_pa;
+static bool has_msr_tsc_deadline;
 static bool has_msr_async_pf_en;
 static int lm_capable_kernel;
 
@@ -568,6 +569,10 @@ static int kvm_get_supported_msrs(KVMState *s)
                     has_msr_hsave_pa = true;
                     continue;
                 }
+                if (kvm_msr_list->indices[i] == MSR_IA32_TSCDEADLINE) {
+                    has_msr_tsc_deadline = true;
+                    continue;
+                }
             }
         }
 
@@ -881,6 +886,9 @@ static int kvm_put_msrs(CPUState *env, int level)
     if (has_msr_hsave_pa) {
         kvm_msr_entry_set(&msrs[n++], MSR_VM_HSAVE_PA, env->vm_hsave);
     }
+    if (has_msr_tsc_deadline) {
+        kvm_msr_entry_set(&msrs[n++], MSR_IA32_TSCDEADLINE, env->tsc_deadline);
+    }
 #ifdef TARGET_X86_64
     if (lm_capable_kernel) {
         kvm_msr_entry_set(&msrs[n++], MSR_CSTAR, env->cstar);
@@ -1127,6 +1135,9 @@ static int kvm_get_msrs(CPUState *env)
     if (has_msr_hsave_pa) {
         msrs[n++].index = MSR_VM_HSAVE_PA;
     }
+    if (has_msr_tsc_deadline) {
+        msrs[n++].index = MSR_IA32_TSCDEADLINE;
+    }
 
     if (!env->tsc_valid) {
         msrs[n++].index = MSR_IA32_TSC;
@@ -1195,6 +1206,9 @@ static int kvm_get_msrs(CPUState *env)
         case MSR_IA32_TSC:
             env->tsc = msrs[i].data;
             break;
+        case MSR_IA32_TSCDEADLINE:
+            env->tsc_deadline = msrs[i].data;
+            break;
         case MSR_VM_HSAVE_PA:
             env->vm_hsave = msrs[i].data;
             break;
target-i386/machine.c +1 -0
index 9aca8e0..25fa97d 100644
@@ -410,6 +410,7 @@ static const VMStateDescription vmstate_cpu = {
         VMSTATE_UINT64_V(xcr0, CPUState, 12),
         VMSTATE_UINT64_V(xstate_bv, CPUState, 12),
         VMSTATE_YMMH_REGS_VARS(ymmh_regs, CPUState, CPU_NB_REGS, 12),
+        VMSTATE_UINT64_V(tsc_deadline, CPUState, 13),
         VMSTATE_END_OF_LIST()
         /* The above list is not sorted /wrt version numbers, watch out! */
     },
Signature · 1 line
1.7.5.4
#2 lore raw

Re: [PATCH 1/1] kvm: support TSC deadline MSR

target-i386/cpu.h uint64_t cpu_get_tsc(CPUX86State *env); · line 952

Quoted 9 lines · Marcelo Tosatti

From: "Liu, Jinsong"<[email protected]>

KVM add emulation of lapic tsc deadline timer for guest. This patch is co-operation work at qemu side.

target-i386/cpu.h +1 -1
-#define CPU_SAVE_VERSION 12
+#define CPU_SAVE_VERSION 13

Unfortunate. Can't we use subsections?

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw

Re: [PATCH 1/1] kvm: support TSC deadline MSR

Quoted 6 lines · Avi Kivity
Quoted 5 lines · Marcelo Tosatti

From: "Liu, Jinsong"<[email protected]>

KVM add emulation of lapic tsc deadline timer for guest. This patch is co-operation work at qemu side.

Quoted 6 lines

target-i386/cpu.h uint64_t cpu_get_tsc(CPUX86State *env); · line 952

Quoted 4 lines
target-i386/cpu.h +1 -1
-#define CPU_SAVE_VERSION 12
+#define CPU_SAVE_VERSION 13

Unfortunate. Can't we use subsections?

Yes, i'll look into it tomorrow.

#4 lore raw

Re: [PATCH 1/1] kvm: support TSC deadline MSR

Quoted 7 lines · Marcelo Tosatti
Quoted 6 lines · Avi Kivity
Quoted 5 lines · Marcelo Tosatti

From: "Liu, Jinsong"<[email protected]>

KVM add emulation of lapic tsc deadline timer for guest. This patch is co-operation work at qemu side.

Quoted 8 lines
Quoted 6 lines

target-i386/cpu.h uint64_t cpu_get_tsc(CPUX86State *env); · line 952

Quoted 4 lines
target-i386/cpu.h +1 -1
-#define CPU_SAVE_VERSION 12
+#define CPU_SAVE_VERSION 13

Unfortunate. Can't we use subsections?

Yes, i'll look into it tomorrow.

Subsections are still broken at the moment although Juan has some patches. Bumping the version is the safe thing to do.

Regards,

Anthony Liguori

Quoted 3 lines
#5 lore raw

Re: [PATCH 1/1] kvm: support TSC deadline MSR

Quoted 15 lines · Anthony Liguori
Quoted 14 lines · Marcelo Tosatti
Quoted 12 lines · Avi Kivity

target-i386/cpu.h uint64_t cpu_get_tsc(CPUX86State *env); · line 952

Quoted 9 lines · Marcelo Tosatti

From: "Liu, Jinsong"<[email protected]>

KVM add emulation of lapic tsc deadline timer for guest. This patch is co-operation work at qemu side.

target-i386/cpu.h +1 -1
-#define CPU_SAVE_VERSION 12
+#define CPU_SAVE_VERSION 13

Unfortunate. Can't we use subsections?

Quoted 4 lines
Quoted 1 line

Yes, i'll look into it tomorrow.

Subsections are still broken at the moment although Juan has some patches. Bumping the version is the safe thing to do.

It's irreversible, once we release a version with a bumped ID we can't go back.

Signature · 1 line
error compiling committee.c: too many arguments to function
#6 lore raw

Re: [Qemu-devel] [PATCH 1/1] kvm: support TSC deadline MSR

Quoted 16 lines · Avi Kivity
Quoted 15 lines · Anthony Liguori
Quoted 14 lines · Marcelo Tosatti
Quoted 12 lines · Avi Kivity

target-i386/cpu.h uint64_t cpu_get_tsc(CPUX86State *env); · line 952

Quoted 9 lines · Marcelo Tosatti

From: "Liu, Jinsong"<[email protected]>

KVM add emulation of lapic tsc deadline timer for guest. This patch is co-operation work at qemu side.

target-i386/cpu.h +1 -1
-#define CPU_SAVE_VERSION 12
+#define CPU_SAVE_VERSION 13

Unfortunate. Can't we use subsections?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Yes, i'll look into it tomorrow.

Subsections are still broken at the moment although Juan has some patches. Bumping the version is the safe thing to do.

It's irreversible, once we release a version with a bumped ID we can't go back.

But the question is whether we've bumped *any* versions of common devices since 0.15 because if so, it's moot here. Once any device bumps a version id, migration is incompatible.

Subsections are nice for stable branches, but they don't solve inter-version compatibility. Most importantly, subsections are broken today so until we straighten things out there, we can't rely on them.

Regards,

Anthony Liguori

#7 lore raw

Re: [Qemu-devel] [PATCH 1/1] kvm: support TSC deadline MSR

Quoted 4 lines · Anthony Liguori
Quoted 1 line

It's irreversible, once we release a version with a bumped ID we can't go back.

But the question is whether we've bumped *any* versions of common devices since 0.15 because if so, it's moot here.

What's the answer? And if the answer is we did, why did we?

Quoted 3 lines

Once any device bumps a version id, migration is incompatible.

Subsections are nice for stable branches, but they don't solve inter-version compatibility.

Why not? Though I agree it's a long shot to get it to work, since there are so many changes and it's easy to get any one of them wrong.

You had an idea once to fingerprint the migration format and compare it across versions? I assume the almighty visitor can make this very simple?

Quoted 3 lines

Most importantly, subsections are broken today so until we
straighten things out there, we can't rely on them.

Let's not throw a permanent baby out with the temporary bath water.

Signature · 1 line
error compiling committee.c: too many arguments to function
#8 lore raw
In reply to Marcelo Tosatti
Quoted 6 lines · Marcelo Tosatti

The following changes since commit d11cf8cc80d946dfc9a23597cd9a0bb1c487cfa7:

   etrax-dma: Remove bogus if statement (2011-10-03 10:20:13 +0200)

are available in the git repository at:
git://github.com/avikivity/qemu.git uq/master

Pulled. Thanks.

Are ya'll planning on moving your repo back to kernel.org or sticking with github?

Regards,

Anthony Liguori

Quoted 10 lines

Liu, Jinsong (1):
kvm: support TSC deadline MSR

  target-i386/cpu.h     |    4 +++-
  target-i386/kvm.c     |   14 ++++++++++++++
  target-i386/machine.c |    1 +
  3 files changed, 18 insertions(+), 1 deletions(-)
#9 lore raw
Quoted 10 lines · Anthony Liguori
Quoted 6 lines · Marcelo Tosatti

The following changes since commit d11cf8cc80d946dfc9a23597cd9a0bb1c487cfa7:

   etrax-dma: Remove bogus if statement (2011-10-03 10:20:13 +0200)

are available in the git repository at:
git://github.com/avikivity/qemu.git uq/master

Pulled. Thanks.

Um, this had a comment about it regarding s/version bump/subsection/

Quoted 1 line

Are ya'll planning on moving your repo back to kernel.org or sticking with github?

We'll move back to kernel.org as soon as we sort around the keys.

Signature · 1 line
error compiling committee.c: too many arguments to function
#10 lore raw
Quoted 6 lines · Avi Kivity
Quoted 5 lines · Anthony Liguori
Quoted 4 lines · Marcelo Tosatti

The following changes since commit d11cf8cc80d946dfc9a23597cd9a0bb1c487cfa7:

etrax-dma: Remove bogus if statement (2011-10-03 10:20:13 +0200)

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

are available in the git repository at:
git://github.com/avikivity/qemu.git uq/master

Pulled. Thanks.

Um, this had a comment about it regarding s/version bump/subsection/

Hrm, sorry about that. In the future, it would be helpful to explicitly withdrawal a PULL request.

Do you want me to revert? FWIW, I think bumping the version is the right thing to do.

Regards,

Anthony Liguori

Quoted 6 lines
Quoted 3 lines

Are ya'll planning on moving your repo back to kernel.org or sticking with github?

We'll move back to kernel.org as soon as we sort around the keys.

#11 lore raw
Quoted 4 lines · Anthony Liguori

Hrm, sorry about that. In the future, it would be helpful to explicitly withdrawal a PULL request.

Do you want me to revert?

We'll send the revert together with the new patch.

Quoted 1 line

FWIW, I think bumping the version is the right thing to do.

Why?

Signature · 1 line
error compiling committee.c: too many arguments to function
#12 lore raw
Quoted 5 lines · Avi Kivity
Quoted 4 lines · Anthony Liguori

Hrm, sorry about that. In the future, it would be helpful to explicitly withdrawal a PULL request.

Quoted 7 lines
Quoted 1 line

Do you want me to revert?

We'll send the revert together with the new patch.

Quoted 1 line

FWIW, I think bumping the version is the right thing to do.

Why?

Because we still haven't fixed subsections. Juan's patches help but they can still result in sending bad data to and older QEMU that won't handle it properly.

We need to figure out a proper fix for subsections, either Paolo's protocol change or moving subsections out to a detected section.

Regards,

Anthony Liguori

Quoted 1 line
#13 lore raw
Quoted 10 lines · Anthony Liguori
Quoted 9 lines · Avi Kivity
Quoted 5 lines · Anthony Liguori

Hrm, sorry about that. In the future, it would be helpful to explicitly withdrawal a PULL request.

Do you want me to revert?

We'll send the revert together with the new patch.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

FWIW, I think bumping the version is the right thing to do.

Why?

Because we still haven't fixed subsections. Juan's patches help but they can still result in sending bad data to and older QEMU that won't handle it properly.

We need to figure out a proper fix for subsections, either Paolo's protocol change or moving subsections out to a detected section.

Ok. So bumping the version is only right if we don't fix subsections.

Signature · 1 line
error compiling committee.c: too many arguments to function
#14 lore raw
Quoted 15 lines · Avi Kivity
Quoted 14 lines · Anthony Liguori
Quoted 12 lines · Avi Kivity
Quoted 5 lines · Anthony Liguori

Hrm, sorry about that. In the future, it would be helpful to explicitly withdrawal a PULL request.

Do you want me to revert?

We'll send the revert together with the new patch.

Quoted 1 line

FWIW, I think bumping the version is the right thing to do.

Why?

Quoted 7 lines
Quoted 5 lines

Because we still haven't fixed subsections. Juan's patches help but they can still result in sending bad data to and older QEMU that won't handle it properly.

We need to figure out a proper fix for subsections, either Paolo's protocol change or moving subsections out to a detected section.

Ok. So bumping the version is only right if we don't fix subsections.

If we bump *any* version from 0.15 -> 1.0, then there's no point at all in having a subsection. If we break compatibility by using Paolo's new protocol, or doing subsections as sections, then there's no point in making it a subsection either.

Regards,

Anthony Liguori

Quoted 1 line
#15 lore raw
Quoted 4 lines · Anthony Liguori
Quoted 1 line

Ok. So bumping the version is only right if we don't fix subsections.

If we bump *any* version from 0.15 -> 1.0, then there's no point at all in having a subsection.

Did we bump versions of relevant devices?

Quoted 1 line

If we break compatibility by using Paolo's new protocol, or doing subsections as sections, then there's no point in making it a subsection either.

These are workaroundable. For example if you migrate 0.15 to 1.0 you start the destination with -old-subsection-format. Even if you don't, since subsections are rarely present, migration will succeed.

Signature · 1 line
error compiling committee.c: too many arguments to function