All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH for-next] pc: Ensure non-zero CPU ref count after attaching to ICC bus
Date: Tue, 17 Mar 2015 18:09:17 +0100	[thread overview]
Message-ID: <55085FBD.5060003@suse.de> (raw)
In-Reply-To: <20150317170435.GN3513@thinpad.lan.raisama.net>

Am 17.03.2015 um 18:04 schrieb Eduardo Habkost:
> On Tue, Mar 17, 2015 at 05:46:36PM +0100, Andreas Färber wrote:
> [...]
>> @@ -1054,7 +1055,12 @@ void pc_hot_add_cpu(const int64_t id, Error **errp)
>>  
>>      icc_bridge = DEVICE(object_resolve_path_type("icc-bridge",
>>                                                   TYPE_ICC_BRIDGE, NULL));
>> -    pc_new_cpu(current_cpu_model, apic_id, icc_bridge, errp);
>> +    cpu = pc_new_cpu(current_cpu_model, apic_id, icc_bridge, &local_err);
>> +    if (local_err) {
>> +        error_propagate(errp, local_err);
>> +        return;
>> +    }
>> +    object_unref(OBJECT(cpu));
> 
> Calling object_unref(NULL) is valid, so you can still keep it simple and
> do this:
> 
> -    pc_new_cpu(current_cpu_model, apic_id, icc_bridge, errp);
> +    cpu = pc_new_cpu(current_cpu_model, apic_id, icc_bridge, errp);
> +    object_unref(OBJECT(cpu));

Valid yes, but I have a follow-up doing:

         error_propagate(errp, local_err);
         return;
     }
+    object_property_set_bool(OBJECT(cpu), true, "realized", errp);
     object_unref(OBJECT(cpu));
 }


So it's handier to keep it last.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)

  reply	other threads:[~2015-03-17 17:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 21:57 [Qemu-devel] [PATCH v2 0/1] target-i386: Move icc_bridge code to PC Eduardo Habkost
2015-03-10 21:57 ` [Qemu-devel] [PATCH v2 1/1] target-i386: Remove icc_bridge parameter from cpu_x86_create() Eduardo Habkost
2015-03-10 22:43   ` Andreas Färber
2015-03-11 11:11     ` Eduardo Habkost
2015-03-11 11:59       ` Andreas Färber
2015-03-11 13:20         ` Eduardo Habkost
2015-03-11 13:36   ` Igor Mammedov
2015-03-11 13:49     ` Eduardo Habkost
2015-03-11 14:34       ` Igor Mammedov
2015-03-17 16:46   ` [Qemu-devel] [PATCH for-next] pc: Ensure non-zero CPU ref count after attaching to ICC bus Andreas Färber
2015-03-17 17:04     ` Eduardo Habkost
2015-03-17 17:09       ` Andreas Färber [this message]
2015-04-27 19:03     ` Michael S. Tsirkin
2015-04-27 19:27     ` Eduardo Habkost
2015-04-27 19:35     ` 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=55085FBD.5060003@suse.de \
    --to=afaerber@suse.de \
    --cc=ehabkost@redhat.com \
    --cc=mst@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.