[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 04/11] cpu: Don't realize CPU from cpu_generi
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH v6 04/11] cpu: Don't realize CPU from cpu_generic_init() |
Date: |
Sat, 23 Jan 2016 11:31:44 -0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Fri, Jan 08, 2016 at 12:25:12PM +0530, Bharata B Rao wrote:
> Don't do CPU realization from cpu_generic_init(). With this
> cpu_generic_init() will be used to just create CPU threads and they
> should be realized separately from realizefn call.
>
> Convert the existing callers to do explicit realization.
>
> Signed-off-by: Bharata B Rao <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
Reviewed by comparing the patch with the results of the
following Coccinelle patch:
@@
typedef CPUState;
identifier cc, cpu, err;
@@
CPUState *cpu_generic_init(...)
{
...
- if (err != NULL) {
- goto out;
- }
-
- object_property_set_bool(OBJECT(cpu), true, "realized", &err);
-out:
if (err != NULL) {
...
}
...
}
@@
type XXXCPU;
identifier initfunc, cpu_model, TYPE_XXX_CPU, XXX_CPU;
@@
XXXCPU *initfunc(const char *cpu_model)
{
- return XXX_CPU(cpu_generic_init(TYPE_XXX_CPU, cpu_model));
+ CPUState *cpu = cpu_generic_init(TYPE_XXX_CPU, cpu_model);
+ Error *err = NULL;
+
+ if (!cpu) {
+ return NULL;
+ }
+
+ object_property_set_bool(OBJECT(cpu), true, "realized", &err);
+ if (err != NULL) {
+ error_report_err(err);
+ object_unref(OBJECT(cpu));
+ return NULL;
+ } else {
+ return XXX_CPU(cpu);
+ }
}
--
Eduardo
- [Qemu-devel] [PATCH v6 08/11] target-ppc: Introduce PowerPC specific CPU core device, (continued)
- [Qemu-devel] [PATCH v6 08/11] target-ppc: Introduce PowerPC specific CPU core device, Bharata B Rao, 2016/01/08
- [Qemu-devel] [PATCH v6 03/11] exec: Do vmstate unregistration from cpu_exec_exit(), Bharata B Rao, 2016/01/08
- [Qemu-devel] [PATCH v6 05/11] cpu: Reclaim vCPU objects, Bharata B Rao, 2016/01/08
- [Qemu-devel] [PATCH v6 04/11] cpu: Don't realize CPU from cpu_generic_init(), Bharata B Rao, 2016/01/08
- [Qemu-devel] [PATCH v6 02/11] exec: Remove cpu from cpus list during cpu_exec_exit(), Bharata B Rao, 2016/01/08
- [Qemu-devel] [PATCH v6 01/11] machine: Don't allow CPU toplogies with partially filled cores, Bharata B Rao, 2016/01/08
- [Qemu-devel] [PATCH v6 10/11] spapr: CPU hotplug support, Bharata B Rao, 2016/01/08