All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 02/18] target-i386: Simplify reporting of unavailable features
Date: Thu, 15 May 2014 14:21:12 +0200	[thread overview]
Message-ID: <5374B138.80805@suse.de> (raw)
In-Reply-To: <1398876525-28831-3-git-send-email-ehabkost@redhat.com>

Am 30.04.2014 18:48, schrieb Eduardo Habkost:
> Instead of checking and calling unavailable_host_feature() once for each
> bit, simply call the function (now renamed to
> report_unavailable_features()) once for each feature word.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v1 -> v2:
>  * Rebase to latest qom-cpu (commit 90c5d39c)
> Changes v2 -> v3:
>  * Trivial rebase after QEMU 2.0 (onto commit 2d03b49)
> ---
>  target-i386/cpu.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 7ec706f..9cd0039 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1236,11 +1236,11 @@ static const TypeInfo host_x86_cpu_type_info = {
>  
>  #endif
>  
> -static int unavailable_host_feature(FeatureWordInfo *f, uint32_t mask)
> +static int report_unavailable_features(FeatureWordInfo *f, uint32_t mask)
>  {
>      int i;
>  
> -    for (i = 0; i < 32; ++i)
> +    for (i = 0; i < 32; ++i) {
>          if (1 << i & mask) {
>              const char *reg = get_register_name_32(f->cpuid_reg);
>              assert(reg);
> @@ -1249,8 +1249,8 @@ static int unavailable_host_feature(FeatureWordInfo *f, uint32_t mask)
>                  f->cpuid_eax, reg,
>                  f->feat_names[i] ? "." : "",
>                  f->feat_names[i] ? f->feat_names[i] : "", i);
> -            break;
>          }
> +    }
>      return 0;
>  }
>  
> @@ -1274,12 +1274,10 @@ static int kvm_check_features_against_host(KVMState *s, X86CPU *cpu)
>          uint32_t host_feat = kvm_arch_get_supported_cpuid(s, wi->cpuid_eax,
>                                                               wi->cpuid_ecx,
>                                                               wi->cpuid_reg);
> -        uint32_t mask;
> -        for (mask = 1; mask; mask <<= 1) {
> -            if (guest_feat & mask && !(host_feat & mask)) {
> -                unavailable_host_feature(wi, mask);
> -                rv = 1;
> -            }
> +        uint32_t unavailable_features = guest_feat & ~host_feat;
> +        if (unavailable_features) {
> +            report_unavailable_features(wi, unavailable_features);
> +            rv = 1;
>          }
>      }
>      return rv;

Both before and after your patch the return value is never checked.
Shall we/I change it to void?

Regards,
Andreas

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 3c4f327..d095c7d 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1236,7 +1236,7 @@ static const TypeInfo host_x86_cpu_type_info = {

 #endif

-static int report_unavailable_features(FeatureWordInfo *f, uint32_t mask)
+static void report_unavailable_features(FeatureWordInfo *f, uint32_t mask)
 {
     int i;

@@ -1251,7 +1251,6 @@ static int
report_unavailable_features(FeatureWordInfo *f, uint32_t mask)
                 f->feat_names[i] ? f->feat_names[i] : "", i);
         }
     }
-    return 0;
 }

 /* Check if all requested cpu flags are making their way to the guest

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

       reply	other threads:[~2014-05-15 12:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1398876525-28831-1-git-send-email-ehabkost@redhat.com>
     [not found] ` <1398876525-28831-3-git-send-email-ehabkost@redhat.com>
2014-05-15 12:21   ` Andreas Färber [this message]
2014-05-15 13:39     ` [Qemu-devel] [PATCH v4 02/18] target-i386: Simplify reporting of unavailable features Eduardo Habkost
2014-05-15 16:00       ` Andreas Färber
     [not found] ` <1398876525-28831-4-git-send-email-ehabkost@redhat.com>
2014-05-15 13:19   ` [Qemu-devel] [PATCH v4 03/18] target-i386: Merge feature filtering/checking functions Andreas Färber
     [not found] ` <1398876525-28831-8-git-send-email-ehabkost@redhat.com>
2014-05-15 18:10   ` [Qemu-devel] [PATCH v4 07/18] target-i386: Filter FEAT_7_0_EBX TCG features too Andreas Färber
2014-05-15 18:54     ` Eduardo Habkost
     [not found] ` <1398876525-28831-13-git-send-email-ehabkost@redhat.com>
2014-05-15 18:54   ` [Qemu-devel] [PATCH v4 12/18] target-i386: Support check/enforce flags in TCG mode, too Andreas Färber
2014-05-15 19:12     ` Eduardo Habkost
2014-06-18 15:50       ` Andreas Färber
2014-06-18 15:54         ` Paolo Bonzini
     [not found] ` <1398876525-28831-14-git-send-email-ehabkost@redhat.com>
2014-05-15 19:12   ` [Qemu-devel] [PATCH v4 13/18] target-i386: Support "-cpu host" in TCG mode Andreas Färber
2014-05-15 19:21     ` Eduardo Habkost
     [not found] ` <1398876525-28831-15-git-send-email-ehabkost@redhat.com>
2014-05-15 19:44   ` [Qemu-devel] [PATCH v4 14/18] target-i386: Add "migratable" property to "host" CPU model Andreas Färber
2014-05-15 20:26     ` Eduardo Habkost
2014-05-15 22:12       ` Andreas Färber
2014-05-16 16:13         ` Eduardo Habkost
2014-05-16 16:29           ` Andreas Färber
2014-05-16 17:18             ` Eduardo Habkost
     [not found] ` <1398876525-28831-18-git-send-email-ehabkost@redhat.com>
2014-05-15 20:22   ` [Qemu-devel] [PATCH v4 17/18] target-i386: block migration and savevm if invariant tsc is exposed Andreas Färber
2014-05-16  9:05     ` Andreas Färber
2014-05-16 13:15       ` Luiz Capitulino
2014-05-16 15:36       ` Eduardo Habkost
2014-05-16 17:51         ` Eduardo Habkost
     [not found] ` <1398876525-28831-16-git-send-email-ehabkost@redhat.com>
2014-05-15 20:07   ` [Qemu-devel] [PATCH v4 15/18] target-i386: Set migratable=yes by default Andreas Färber
2014-05-15 20:22     ` Eduardo Habkost
2014-05-16 11:14   ` 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=5374B138.80805@suse.de \
    --to=afaerber@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.