qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest
@ 2012-07-02 11:08 Liu, Jinsong
  2012-07-02 11:56 ` Andreas Färber
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Liu, Jinsong @ 2012-07-02 11:08 UTC (permalink / raw)
  To: Eduardo Habkost, Jan Kiszka, Andreas Färber
  Cc: Marcelo Tosatti, Avi Kivity, kvm, qemu-devel@nongnu.org

[-- Attachment #1: Type: text/plain, Size: 2409 bytes --]

Eduardo, Jan, Andreas

As we sync 3 months ago, I wait until qemu1.1 done, then re-write patch based on qemu1.1.
Now it's time to re-write my patch based on qemu1.1.

Attached is a RFC patch for exposing tsc deadline timer to guest.
I have checked current qemu1.1 code, and read some emails regarding to cpuid exposing these days.
However, I think I may ignore something (so many discussion :-), so if you think anything wrong, please point out to me.

Thanks,
Jinsong

====================
>From 8b5b003f6f8834d2d5d71e18bb47b7f089bc4928 Mon Sep 17 00:00:00 2001
From: Liu, Jinsong <jinsong.liu@intel.com>
Date: Tue, 3 Jul 2012 02:35:10 +0800
Subject: [PATCH] Expose tsc deadline timer feature to guest

This patch exposes tsc deadline timer feature to guest if
1). in-kernel irqchip is used, and
2). kvm has emulated tsc deadline timer, and
3). user authorize the feature exposing via -cpu or +/- tsc-deadline

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
---
 target-i386/cpu.h |    1 +
 target-i386/kvm.c |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 79cc640..d1a4a04 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -400,6 +400,7 @@
 #define CPUID_EXT_X2APIC   (1 << 21)
 #define CPUID_EXT_MOVBE    (1 << 22)
 #define CPUID_EXT_POPCNT   (1 << 23)
+#define CPUID_EXT_TSC_DEADLINE_TIMER (1 << 24)
 #define CPUID_EXT_XSAVE    (1 << 26)
 #define CPUID_EXT_OSXSAVE  (1 << 27)
 #define CPUID_EXT_HYPERVISOR  (1 << 31)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 0d0d8f6..52b577f 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -361,8 +361,13 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     env->cpuid_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
 
     i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR;
+    j = env->cpuid_ext_features & CPUID_EXT_TSC_DEADLINE_TIMER;
     env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX);
     env->cpuid_ext_features |= i;
+    if (j && kvm_irqchip_in_kernel() &&
+        kvm_check_extension(s, KVM_CAP_TSC_DEADLINE_TIMER)) {
+        env->cpuid_ext_features |= CPUID_EXT_TSC_DEADLINE_TIMER;
+    }
 
     env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
                                                              0, R_EDX);
-- 
1.7.1

[-- Attachment #2: 0001-Expose-tsc-deadline-timer-feature-to-guest.patch --]
[-- Type: application/octet-stream, Size: 1857 bytes --]

From 8b5b003f6f8834d2d5d71e18bb47b7f089bc4928 Mon Sep 17 00:00:00 2001
From: Liu, Jinsong <jinsong.liu@intel.com>
Date: Tue, 3 Jul 2012 02:35:10 +0800
Subject: [PATCH] Expose tsc deadline timer feature to guest

This patch exposes tsc deadline timer feature to guest if
1). in-kernel irqchip is used, and
2). kvm has emulated tsc deadline timer, and
3). user authorize the feature exposing via -cpu or +/- tsc-deadline

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
---
 target-i386/cpu.h |    1 +
 target-i386/kvm.c |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 79cc640..d1a4a04 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -400,6 +400,7 @@
 #define CPUID_EXT_X2APIC   (1 << 21)
 #define CPUID_EXT_MOVBE    (1 << 22)
 #define CPUID_EXT_POPCNT   (1 << 23)
+#define CPUID_EXT_TSC_DEADLINE_TIMER (1 << 24)
 #define CPUID_EXT_XSAVE    (1 << 26)
 #define CPUID_EXT_OSXSAVE  (1 << 27)
 #define CPUID_EXT_HYPERVISOR  (1 << 31)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 0d0d8f6..52b577f 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -361,8 +361,13 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     env->cpuid_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
 
     i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR;
+    j = env->cpuid_ext_features & CPUID_EXT_TSC_DEADLINE_TIMER;
     env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX);
     env->cpuid_ext_features |= i;
+    if (j && kvm_irqchip_in_kernel() &&
+        kvm_check_extension(s, KVM_CAP_TSC_DEADLINE_TIMER)) {
+        env->cpuid_ext_features |= CPUID_EXT_TSC_DEADLINE_TIMER;
+    }
 
     env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
                                                              0, R_EDX);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest
  2012-07-02 11:08 [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest Liu, Jinsong
@ 2012-07-02 11:56 ` Andreas Färber
  2012-07-02 17:54 ` Eduardo Habkost
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2012-07-02 11:56 UTC (permalink / raw)
  To: Liu, Jinsong
  Cc: Eduardo Habkost, kvm, Jan Kiszka, Marcelo Tosatti,
	qemu-devel@nongnu.org, Avi Kivity

Am 02.07.2012 13:08, schrieb Liu, Jinsong:
> Eduardo, Jan, Andreas
> 
> As we sync 3 months ago, I wait until qemu1.1 done, then re-write patch based on qemu1.1.
> Now it's time to re-write my patch based on qemu1.1.
> 
> Attached is a RFC patch for exposing tsc deadline timer to guest.
> I have checked current qemu1.1 code, and read some emails regarding to cpuid exposing these days.
> However, I think I may ignore something (so many discussion :-), so if you think anything wrong, please point out to me.

No objections or nitpicks from my (CPU) side FWIW.

Regards,
Andreas

> 
> Thanks,
> Jinsong
> 
> ====================
> From 8b5b003f6f8834d2d5d71e18bb47b7f089bc4928 Mon Sep 17 00:00:00 2001
> From: Liu, Jinsong <jinsong.liu@intel.com>
> Date: Tue, 3 Jul 2012 02:35:10 +0800
> Subject: [PATCH] Expose tsc deadline timer feature to guest
> 
> This patch exposes tsc deadline timer feature to guest if
> 1). in-kernel irqchip is used, and
> 2). kvm has emulated tsc deadline timer, and
> 3). user authorize the feature exposing via -cpu or +/- tsc-deadline
> 
> Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
> ---
>  target-i386/cpu.h |    1 +
>  target-i386/kvm.c |    5 +++++
>  2 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index 79cc640..d1a4a04 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -400,6 +400,7 @@
>  #define CPUID_EXT_X2APIC   (1 << 21)
>  #define CPUID_EXT_MOVBE    (1 << 22)
>  #define CPUID_EXT_POPCNT   (1 << 23)
> +#define CPUID_EXT_TSC_DEADLINE_TIMER (1 << 24)
>  #define CPUID_EXT_XSAVE    (1 << 26)
>  #define CPUID_EXT_OSXSAVE  (1 << 27)
>  #define CPUID_EXT_HYPERVISOR  (1 << 31)
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 0d0d8f6..52b577f 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -361,8 +361,13 @@ int kvm_arch_init_vcpu(CPUX86State *env)
>      env->cpuid_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
>  
>      i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR;
> +    j = env->cpuid_ext_features & CPUID_EXT_TSC_DEADLINE_TIMER;
>      env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX);
>      env->cpuid_ext_features |= i;
> +    if (j && kvm_irqchip_in_kernel() &&
> +        kvm_check_extension(s, KVM_CAP_TSC_DEADLINE_TIMER)) {
> +        env->cpuid_ext_features |= CPUID_EXT_TSC_DEADLINE_TIMER;
> +    }
>  
>      env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
>                                                               0, R_EDX);


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest
  2012-07-02 11:08 [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest Liu, Jinsong
  2012-07-02 11:56 ` Andreas Färber
@ 2012-07-02 17:54 ` Eduardo Habkost
  2012-07-03  6:38 ` Jan Kiszka
  2012-07-03 20:36 ` Marcelo Tosatti
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2012-07-02 17:54 UTC (permalink / raw)
  To: Liu, Jinsong
  Cc: kvm, Jan Kiszka, Marcelo Tosatti, qemu-devel@nongnu.org,
	Avi Kivity, Andreas Färber

On Mon, Jul 02, 2012 at 11:08:14AM +0000, Liu, Jinsong wrote:
> Eduardo, Jan, Andreas
> 
> As we sync 3 months ago, I wait until qemu1.1 done, then re-write patch based on qemu1.1.
> Now it's time to re-write my patch based on qemu1.1.
> 
> Attached is a RFC patch for exposing tsc deadline timer to guest.
> I have checked current qemu1.1 code, and read some emails regarding to cpuid exposing these days.
> However, I think I may ignore something (so many discussion :-), so if you think anything wrong, please point out to me.

Looks good, considering that even if we change the GET_SUPPORTED_CPUID
behavior eventually, there are existing kernels that use
KVM_CAP_TSC_DEADLINE_TIMER to report TSC-deadline support. So:

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>


> 
> Thanks,
> Jinsong
> 
> ====================
> From 8b5b003f6f8834d2d5d71e18bb47b7f089bc4928 Mon Sep 17 00:00:00 2001
> From: Liu, Jinsong <jinsong.liu@intel.com>
> Date: Tue, 3 Jul 2012 02:35:10 +0800
> Subject: [PATCH] Expose tsc deadline timer feature to guest
> 
> This patch exposes tsc deadline timer feature to guest if
> 1). in-kernel irqchip is used, and
> 2). kvm has emulated tsc deadline timer, and
> 3). user authorize the feature exposing via -cpu or +/- tsc-deadline
> 
> Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
> ---
>  target-i386/cpu.h |    1 +
>  target-i386/kvm.c |    5 +++++
>  2 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index 79cc640..d1a4a04 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -400,6 +400,7 @@
>  #define CPUID_EXT_X2APIC   (1 << 21)
>  #define CPUID_EXT_MOVBE    (1 << 22)
>  #define CPUID_EXT_POPCNT   (1 << 23)
> +#define CPUID_EXT_TSC_DEADLINE_TIMER (1 << 24)
>  #define CPUID_EXT_XSAVE    (1 << 26)
>  #define CPUID_EXT_OSXSAVE  (1 << 27)
>  #define CPUID_EXT_HYPERVISOR  (1 << 31)
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 0d0d8f6..52b577f 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -361,8 +361,13 @@ int kvm_arch_init_vcpu(CPUX86State *env)
>      env->cpuid_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
>  
>      i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR;
> +    j = env->cpuid_ext_features & CPUID_EXT_TSC_DEADLINE_TIMER;
>      env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX);
>      env->cpuid_ext_features |= i;
> +    if (j && kvm_irqchip_in_kernel() &&
> +        kvm_check_extension(s, KVM_CAP_TSC_DEADLINE_TIMER)) {
> +        env->cpuid_ext_features |= CPUID_EXT_TSC_DEADLINE_TIMER;
> +    }
>  
>      env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
>                                                               0, R_EDX);
> -- 
> 1.7.1



-- 
Eduardo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest
  2012-07-02 11:08 [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest Liu, Jinsong
  2012-07-02 11:56 ` Andreas Färber
  2012-07-02 17:54 ` Eduardo Habkost
@ 2012-07-03  6:38 ` Jan Kiszka
  2012-07-03 20:36 ` Marcelo Tosatti
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2012-07-03  6:38 UTC (permalink / raw)
  To: Liu, Jinsong
  Cc: Eduardo Habkost, kvm, Marcelo Tosatti, qemu-devel@nongnu.org,
	Avi Kivity, Andreas Färber

On 2012-07-02 13:08, Liu, Jinsong wrote:
> Eduardo, Jan, Andreas
> 
> As we sync 3 months ago, I wait until qemu1.1 done, then re-write patch based on qemu1.1.
> Now it's time to re-write my patch based on qemu1.1.
> 
> Attached is a RFC patch for exposing tsc deadline timer to guest.
> I have checked current qemu1.1 code, and read some emails regarding to cpuid exposing these days.
> However, I think I may ignore something (so many discussion :-), so if you think anything wrong, please point out to me.
> 
> Thanks,
> Jinsong
> 
> ====================
>>From 8b5b003f6f8834d2d5d71e18bb47b7f089bc4928 Mon Sep 17 00:00:00 2001
> From: Liu, Jinsong <jinsong.liu@intel.com>
> Date: Tue, 3 Jul 2012 02:35:10 +0800
> Subject: [PATCH] Expose tsc deadline timer feature to guest
> 
> This patch exposes tsc deadline timer feature to guest if
> 1). in-kernel irqchip is used, and
> 2). kvm has emulated tsc deadline timer, and
> 3). user authorize the feature exposing via -cpu or +/- tsc-deadline
> 
> Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
> ---
>  target-i386/cpu.h |    1 +
>  target-i386/kvm.c |    5 +++++
>  2 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index 79cc640..d1a4a04 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -400,6 +400,7 @@
>  #define CPUID_EXT_X2APIC   (1 << 21)
>  #define CPUID_EXT_MOVBE    (1 << 22)
>  #define CPUID_EXT_POPCNT   (1 << 23)
> +#define CPUID_EXT_TSC_DEADLINE_TIMER (1 << 24)
>  #define CPUID_EXT_XSAVE    (1 << 26)
>  #define CPUID_EXT_OSXSAVE  (1 << 27)
>  #define CPUID_EXT_HYPERVISOR  (1 << 31)
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 0d0d8f6..52b577f 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -361,8 +361,13 @@ int kvm_arch_init_vcpu(CPUX86State *env)
>      env->cpuid_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
>  
>      i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR;
> +    j = env->cpuid_ext_features & CPUID_EXT_TSC_DEADLINE_TIMER;
>      env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX);
>      env->cpuid_ext_features |= i;
> +    if (j && kvm_irqchip_in_kernel() &&
> +        kvm_check_extension(s, KVM_CAP_TSC_DEADLINE_TIMER)) {
> +        env->cpuid_ext_features |= CPUID_EXT_TSC_DEADLINE_TIMER;
> +    }
>  
>      env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
>                                                               0, R_EDX);
> 

Fine with me.

Acked-by: Jan Kiszka <jan.kiszka@siemens.com>

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest
  2012-07-02 11:08 [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest Liu, Jinsong
                   ` (2 preceding siblings ...)
  2012-07-03  6:38 ` Jan Kiszka
@ 2012-07-03 20:36 ` Marcelo Tosatti
  3 siblings, 0 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2012-07-03 20:36 UTC (permalink / raw)
  To: Liu, Jinsong
  Cc: Eduardo Habkost, kvm, Jan Kiszka, qemu-devel@nongnu.org,
	Avi Kivity, Andreas Färber

On Mon, Jul 02, 2012 at 11:08:14AM +0000, Liu, Jinsong wrote:
> Eduardo, Jan, Andreas
> 
> As we sync 3 months ago, I wait until qemu1.1 done, then re-write patch based on qemu1.1.
> Now it's time to re-write my patch based on qemu1.1.
> 
> Attached is a RFC patch for exposing tsc deadline timer to guest.
> I have checked current qemu1.1 code, and read some emails regarding to cpuid exposing these days.
> However, I think I may ignore something (so many discussion :-), so if you think anything wrong, please point out to me.
> 
> Thanks,
> Jinsong

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-03 20:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02 11:08 [Qemu-devel] [RFC PATCH] Expose tsc deadline timer feature to guest Liu, Jinsong
2012-07-02 11:56 ` Andreas Färber
2012-07-02 17:54 ` Eduardo Habkost
2012-07-03  6:38 ` Jan Kiszka
2012-07-03 20:36 ` Marcelo Tosatti

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).