All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Joerg Roedel <joerg.roedel@amd.com>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu
Date: Tue, 19 Jul 2011 08:46:58 -0300	[thread overview]
Message-ID: <20110719114658.GA28500@amt.cnet> (raw)
In-Reply-To: <1310047993-7649-3-git-send-email-joerg.roedel@amd.com>

On Thu, Jul 07, 2011 at 04:13:12PM +0200, Joerg Roedel wrote:
> To let the user configure the desired tsc frequency for the
> guest if running in KVM.
> 
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
>  target-i386/cpu.h   |    1 +
>  target-i386/cpuid.c |   13 +++++++++++++
>  2 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index cdf68ff..399e124 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -743,6 +743,7 @@ typedef struct CPUX86State {
>      uint32_t cpuid_kvm_features;
>      uint32_t cpuid_svm_features;
>      bool tsc_valid;
> +    int tsc_khz;

This should be saved/restore in migration data (missing VMSTATE entry).

>      /* in order to simplify APIC support, we leave this pointer to the
>         user */
> diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
> index e1ae3af..89e9623 100644
> --- a/target-i386/cpuid.c
> +++ b/target-i386/cpuid.c
> @@ -224,6 +224,7 @@ typedef struct x86_def_t {
>      int family;
>      int model;
>      int stepping;
> +    int tsc_khz;
>      uint32_t features, ext_features, ext2_features, ext3_features;
>      uint32_t kvm_features, svm_features;
>      uint32_t xlevel;
> @@ -704,6 +705,17 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
>              } else if (!strcmp(featurestr, "model_id")) {
>                  pstrcpy(x86_cpu_def->model_id, sizeof(x86_cpu_def->model_id),
>                          val);
> +            } else if (!strcmp(featurestr, "tsc_freq")) {
> +                int64_t tsc_freq;
> +                char *err;
> +
> +                tsc_freq = strtosz_suffix_unit(val, &err,
> +                                               STRTOSZ_DEFSUFFIX_B, 1000);
> +                if (!*val || *err) {
> +                    fprintf(stderr, "bad numerical value %s\n", val);
> +                    goto error;
> +                }
> +                x86_cpu_def->tsc_khz = tsc_freq / 1000;
>              } else {
>                  fprintf(stderr, "unrecognized feature %s\n", featurestr);
>                  goto error;
> @@ -872,6 +884,7 @@ int cpu_x86_register (CPUX86State *env, const char *cpu_model)
>      env->cpuid_svm_features = def->svm_features;
>      env->cpuid_ext4_features = def->ext4_features;
>      env->cpuid_xlevel2 = def->xlevel2;
> +    env->tsc_khz = def->tsc_khz;
>      if (!kvm_enabled()) {
>          env->cpuid_features &= TCG_FEATURES;
>          env->cpuid_ext_features &= TCG_EXT_FEATURES;
> -- 
> 1.7.4.1
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Joerg Roedel <joerg.roedel@amd.com>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu
Date: Tue, 19 Jul 2011 08:46:58 -0300	[thread overview]
Message-ID: <20110719114658.GA28500@amt.cnet> (raw)
In-Reply-To: <1310047993-7649-3-git-send-email-joerg.roedel@amd.com>

On Thu, Jul 07, 2011 at 04:13:12PM +0200, Joerg Roedel wrote:
> To let the user configure the desired tsc frequency for the
> guest if running in KVM.
> 
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
>  target-i386/cpu.h   |    1 +
>  target-i386/cpuid.c |   13 +++++++++++++
>  2 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index cdf68ff..399e124 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -743,6 +743,7 @@ typedef struct CPUX86State {
>      uint32_t cpuid_kvm_features;
>      uint32_t cpuid_svm_features;
>      bool tsc_valid;
> +    int tsc_khz;

This should be saved/restore in migration data (missing VMSTATE entry).

>      /* in order to simplify APIC support, we leave this pointer to the
>         user */
> diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
> index e1ae3af..89e9623 100644
> --- a/target-i386/cpuid.c
> +++ b/target-i386/cpuid.c
> @@ -224,6 +224,7 @@ typedef struct x86_def_t {
>      int family;
>      int model;
>      int stepping;
> +    int tsc_khz;
>      uint32_t features, ext_features, ext2_features, ext3_features;
>      uint32_t kvm_features, svm_features;
>      uint32_t xlevel;
> @@ -704,6 +705,17 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
>              } else if (!strcmp(featurestr, "model_id")) {
>                  pstrcpy(x86_cpu_def->model_id, sizeof(x86_cpu_def->model_id),
>                          val);
> +            } else if (!strcmp(featurestr, "tsc_freq")) {
> +                int64_t tsc_freq;
> +                char *err;
> +
> +                tsc_freq = strtosz_suffix_unit(val, &err,
> +                                               STRTOSZ_DEFSUFFIX_B, 1000);
> +                if (!*val || *err) {
> +                    fprintf(stderr, "bad numerical value %s\n", val);
> +                    goto error;
> +                }
> +                x86_cpu_def->tsc_khz = tsc_freq / 1000;
>              } else {
>                  fprintf(stderr, "unrecognized feature %s\n", featurestr);
>                  goto error;
> @@ -872,6 +884,7 @@ int cpu_x86_register (CPUX86State *env, const char *cpu_model)
>      env->cpuid_svm_features = def->svm_features;
>      env->cpuid_ext4_features = def->ext4_features;
>      env->cpuid_xlevel2 = def->xlevel2;
> +    env->tsc_khz = def->tsc_khz;
>      if (!kvm_enabled()) {
>          env->cpuid_features &= TCG_FEATURES;
>          env->cpuid_ext_features &= TCG_EXT_FEATURES;
> -- 
> 1.7.4.1
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-07-19 11:49 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07 14:13 [PATCH 0/3][uq/master] Basic TSC-Scaling support v2 Joerg Roedel
2011-07-07 14:13 ` [Qemu-devel] " Joerg Roedel
2011-07-07 14:13 ` [PATCH 1/3] qemu: Add strtosz_suffix_unit function Joerg Roedel
2011-07-07 14:13   ` [Qemu-devel] " Joerg Roedel
2011-07-08  8:00   ` Markus Armbruster
2011-07-08  8:00     ` [Qemu-devel] " Markus Armbruster
2011-07-07 14:13 ` [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu Joerg Roedel
2011-07-07 14:13   ` [Qemu-devel] " Joerg Roedel
2011-07-19 11:46   ` Marcelo Tosatti [this message]
2011-07-19 11:46     ` Marcelo Tosatti
2011-07-19 12:20     ` Avi Kivity
2011-07-19 12:20       ` [Qemu-devel] " Avi Kivity
2011-07-19 12:56       ` Marcelo Tosatti
2011-07-19 12:56         ` [Qemu-devel] " Marcelo Tosatti
2011-07-19 13:30       ` Joerg Roedel
2011-07-19 13:30         ` [Qemu-devel] " Joerg Roedel
2011-07-19 13:54         ` Avi Kivity
2011-07-19 13:54           ` [Qemu-devel] " Avi Kivity
2011-07-19 13:55           ` Avi Kivity
2011-07-19 13:55             ` [Qemu-devel] " Avi Kivity
2011-07-19 14:14             ` Joerg Roedel
2011-07-19 14:14               ` [Qemu-devel] " Joerg Roedel
2011-07-19 15:55               ` Avi Kivity
2011-07-19 15:55                 ` [Qemu-devel] " Avi Kivity
2011-07-07 14:13 ` [PATCH 3/3] qemu-x86: Set tsc_khz in kvm when supported Joerg Roedel
2011-07-07 14:13   ` [Qemu-devel] " Joerg Roedel
2011-07-19 11:48   ` Marcelo Tosatti
2011-07-19 11:48     ` [Qemu-devel] " Marcelo Tosatti
2011-07-19 17:03     ` Jan Kiszka
2011-07-19 17:03       ` [Qemu-devel] " Jan Kiszka
2011-07-19 13:04 ` [PATCH 0/3][uq/master] Basic TSC-Scaling support v2 Marcelo Tosatti
2011-07-19 13:04   ` [Qemu-devel] " Marcelo Tosatti

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=20110719114658.GA28500@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.