qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: David Hildenbrand <david@redhat.com>,
	"Jason J. Herne" <jjherne@linux.vnet.ibm.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	qemu-devel@nongnu.org, Jiri Denemark <jdenemar@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Igor Mammedov <imammedo@redhat.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] i386: Support "-cpu host" on TCG too
Date: Thu, 19 Jan 2017 15:52:50 +0100	[thread overview]
Message-ID: <20170119155250.79a5f90c.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <0503ac26-e660-325c-8257-59227c41021d@redhat.com>

On Tue, 17 Jan 2017 18:43:40 +0100
David Hildenbrand <david@redhat.com> wrote:

> Uncompiled and untested.

@Jason: have you given this a try?

> @Conny and Christian, feel free to pick up and modify if this makes
> sense
> 
>  From 4a2af1ca47421b68eb7677cd91af350dd9be4e0e Mon Sep 17 00:00:00 2001
> From: David Hildenbrand <david@redhat.com>
> Date: Tue, 17 Jan 2017 18:34:45 +0100
> Subject: [PATCH] s390x/cpumodel: allow the "host" model also for tcg
> 
> Let's also allow the host model for tcg, therefore meaning
> "enable all features supported by the selected accelerator in the current
> host".
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>   qapi-schema.json          |  4 ++--
>   target/s390x/cpu-qom.h    |  1 -
>   target/s390x/cpu_models.c | 34 ++++++++--------------------------
>   3 files changed, 10 insertions(+), 29 deletions(-)

(...)

> -#ifdef CONFIG_KVM
>   static void s390_host_cpu_model_initfn(Object *obj)
>   {
> +    S390CPUModel *max_model;
>       S390CPU *cpu = S390_CPU(obj);
>       Error *err = NULL;
> 
> -    if (!kvm_enabled() || !kvm_s390_cpu_models_supported()) {
> +    if (kvm_enabled() && !kvm_s390_cpu_models_supported()) {
>           return;
>       }
> 
> -    cpu->model = g_malloc0(sizeof(*cpu->model));
> -    kvm_s390_get_host_cpu_model(cpu->model, &err);
> -    if (err) {
> +    max_model = get_max_cpu_model(&err);
> +    if (err || !max_model) {

I think checking for !max_model is enough.

>           error_report_err(err);
> -        g_free(cpu->model);
>           /* fallback to unsupported cpu models */
> -        cpu->model = NULL;
> +        return;
>       }
> +    /* copy the host model so it can be modified */
> +    cpu->model = g_memdup(max_model, sizeof(*cpu->model));
>   }
> -#endif

(...)

This gives us the same as before on kvm and z900 for tcg, so this seems
reasonable to me.

  reply	other threads:[~2017-01-19 14:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 19:54 [Qemu-devel] [PATCH] i386: Support "-cpu host" on TCG too Eduardo Habkost
2017-01-17 13:39 ` Richard W.M. Jones
2017-01-17 14:03   ` Eduardo Habkost
2017-01-17 13:42 ` Richard W.M. Jones
2017-01-17 13:44   ` Richard W.M. Jones
2017-01-17 13:57     ` Richard W.M. Jones
2017-01-17 14:05       ` Eduardo Habkost
2017-01-17 14:19         ` Richard W.M. Jones
2017-01-17 17:43 ` David Hildenbrand
2017-01-19 14:52   ` Cornelia Huck [this message]
2017-02-16 14:43   ` Christian Borntraeger
2017-02-16 14:44     ` Christian Borntraeger
2017-01-19 17:50 ` Daniel P. Berrange
2017-01-19 18:22   ` Peter Maydell
2017-01-19 18:31     ` Eduardo Habkost
2017-01-19 18:38       ` Daniel P. Berrange
2017-01-19 19:02         ` Eduardo Habkost

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=20170119155250.79a5f90c.cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=jjherne@linux.vnet.ibm.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 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).