[Qemu-devel] [RFC][PATCH] cpu: implement CPEJ method for unpluging cpu

2013-08-28 Thread Chen Fan
After OS ejecting a vcpu successful, it will call CPEJ method, there communicate the masked vcpu bitmap to QEMU. Signed-off-by: Chen Fan --- src/acpi-dsdt-cpu-hotplug.dsl | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/acpi-dsdt-cpu-hotplug.dsl b/src/acpi-dsdt-cpu

[Qemu-devel] [RFC][PATCH 2/6] cpus: release allocated vcpu objects and exit vcpu thread

2013-08-28 Thread Chen Fan
After ACPI get a signal to eject a vcpu, then it will notify the vcpu thread of needing to exit, before the vcpu exiting, will release the vcpu related objects. Signed-off-by: Chen Fan --- cpus.c | 36 hw/acpi/piix4.c | 16

[Qemu-devel] [RFC][PATCH 3/6] qom cpu: rename variable 'cpu_added_notifier' to 'cpu_hotplug_notifier'

2013-08-28 Thread Chen Fan
Rename variable 'cpu_added_notifier' to 'cpu_hotplug_notifier', for adding vcpu-remove notifier support. Signed-off-by: Chen Fan --- hw/acpi/piix4.c | 10 +- hw/i386/pc.c| 2 +- include/sysemu/sysemu.h | 2 +- qom/cpu.c | 10

[Qemu-devel] [RFC][PATCH 4/6] qmp: add 'cpu-del' command support

2013-08-28 Thread Chen Fan
Signed-off-by: Chen Fan --- hw/i386/pc.c | 5 + hw/i386/pc_piix.c| 1 + include/hw/boards.h | 2 ++ include/hw/i386/pc.h | 1 + qapi-schema.json | 12 qmp-commands.hx | 23 +++ qmp.c| 9 + 7 files changed, 53

[Qemu-devel] [RFC][PATCH 1/6] piix4: implement function 'cpu_status_write' for vcpu ejection

2013-08-28 Thread Chen Fan
When OS eject a vcpu (like: echo 1 > /sys/bus/acpi/devices/LNXCPUXX/eject), it will call acpi EJ0 method, the firmware will write the new cpumap, QEMU will know which vcpu need to be ejected. Signed-off-by: Chen Fan --- hw/acpi/piix4.c | 35 ++- 1 file chan

[Qemu-devel] [RFC][PATCH 0/6] i386: add cpu hot remove support

2013-08-28 Thread Chen Fan
/gmane.comp.emulators.kvm.devel/114347 for seabios patches: http://comments.gmane.org/gmane.comp.emulators.qemu/230460 Chen Fan (6): piix4: implement function 'cpu_status_write' for vcpu ejection cpus: release allocated vcpu objects and exit vcpu thread qom cpu: rename variable 'cpu

[Qemu-devel] [RFC][PATCH 5/6] qom cpu: add struct CPUNotifier for supporting PLUG and UNPLUG cpu notifier

2013-08-28 Thread Chen Fan
Move struct HotplugEventType from file piix4.c to file qom/cpu.c, and add struct CPUNotifier for supporting PLUG and UNPLUG cpu notifier. Signed-off-by: Chen Fan --- hw/acpi/piix4.c | 8 ++-- include/qom/cpu.h | 10 ++ qom/cpu.c | 6 +- 3 files changed, 17 insertions

[Qemu-devel] [RFC][PATCH 6/6] i386: implement cpu interface 'cpu_common_unrealizefn'

2013-08-28 Thread Chen Fan
Implement cpu interface 'cpu_common_unrealizefn' for emiting vcpu-remove notifier to ACPI, then ACPI could send sci interrupt to OS for hot-remove vcpu. Signed-off-by: Chen Fan --- hw/i386/pc.c | 19 ++- qom/cpu.c| 13 + 2 files changed, 31 insert

Re: [Qemu-devel] [PATCH v2] pc-dimm/numa: Fix stat of memory size in node when hotplug memory

2014-09-18 Thread Chen, Fan
On Thu, 2014-09-18 at 20:07 +0800, zhanghailiang wrote: > When do memory hotplug, if there is numa node, we should add > the memory size to the corresponding node memory size. > > For now, it mainly affects the result of hmp command "info numa". > > Signed-off-by: zhanghailiang > --- > v2: > -

[Qemu-devel] [RESEND v2 1/3] query-memdev: fix potential memory leaks

2014-08-17 Thread Chen Fan
Signed-off-by: Chen Fan Reviewed-by: Peter Crosthwaite Reviewed-by: Hu Tao --- numa.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/numa.c b/numa.c index c78cec9..aa772aa 100644 --- a/numa.c +++ b/numa.c @@ -318,10 +318,11 @@ void

[Qemu-devel] [RESEND v2 0/3] Fix some memory leaks about query memdev

2014-08-17 Thread Chen Fan
9) ==15046==by 0x2BCDEF: fd_chr_read (qemu-char.c:213) Chen Fan (3): query-memdev: fix potential memory leaks qom/object.c: fix string_output_get_string() memory leak hmp: fix MemdevList memory leak hmp.c| 8 ++-- numa.c | 15 +++ qom/object.c | 12 +

[Qemu-devel] [RESEND v2 3/3] hmp: fix MemdevList memory leak

2014-08-17 Thread Chen Fan
the memdev_list in hmp_info_memdev() is never freed. so we use existent method qapi_free_MemdevList() to free it. and also we can use qapi_free_MemdevList() to replace list loops to clean up the memdev list in error path. Signed-off-by: Chen Fan Reviewed-by: Peter Crosthwaite Reviewed-by: Hu

[Qemu-devel] [RESEND v2 2/3] qom/object.c: fix string_output_get_string() memory leak

2014-08-17 Thread Chen Fan
string_output_get_string() uses g_string_free(str, false) to transfer the 'str' pointer to callers and never free it. Signed-off-by: Chen Fan Reviewed-by: Peter Crosthwaite Reviewed-by: Hu Tao --- hmp.c| 6 -- qom/object.c | 12 ++-- 2 files changed, 14 insert

[Qemu-devel] [PATCH 1/1] cpu: Correct cpu-hotplug failure

2013-07-24 Thread Chen Fan
When useing x86_64-softmmu --enable-kvm boot qemu, cpu-add command fails to add a vcpu, there show (KVM: setting VAPIC address failed). The reason is that we use an uninitialized cpu->kvm-fd to ioctl. so we move realizing apic to the back of qemu_init_vcpu. Signed-off-by: Chen Fan --- incl

[Qemu-devel] [PATCH v2] cpu: Correct cpu-hotplug failure

2013-07-25 Thread Chen Fan
of qemu_init_vcpu. Signed-off-by: Chen Fan --- include/qom/cpu.h | 2 ++ qom/cpu.c | 13 + target-i386/cpu.c | 10 -- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index daf1835..4b16385 100644 --- a/include/qom/cp

[Qemu-devel] [RESEND][PATCH v2] cpu: Correct cpu-hotplug failure

2013-07-25 Thread Chen Fan
uninitialized, kvmfd is zero, fail to ioctl). But in startup case system wide reset after vcpu was initialized. ->machine->init -> qdev_machine_creation_done -> qemu_system_reset -> cpu_synchronize_all_post_reset -> cpu_synchronize_post_reset. v1-v2: Change cpu_apic_realize t

[Qemu-devel] [RFC 1/3] using CPUMASK bitmaps to calculate cpu index

2014-05-13 Thread Chen Fan
instead of seeking the number of CPUs, using CPUMASK bitmaps to calculate the cpu index, also would be a gread benefit to remove cpu index. Signed-off-by: Chen Fan --- exec.c | 9 - include/qom/cpu.h | 9 + include/sysemu/sysemu.h | 7 --- 3 files

[Qemu-devel] [RFC 0/3] cpu: add device_add foo-x86_64-cpu support

2014-05-13 Thread Chen Fan
check of APIC ID after cpu object initialization that was different from 'cpu_add' command which check 'ids' at the beginning. Chen Fan (3): using CPUMASK bitmaps to calculate cpu index cpu: introduce CpuTopoInfo structure for argument simplification cpu: add device_add fo

[Qemu-devel] [RFC 2/3] cpu: introduce CpuTopoInfo structure for argument simplification

2014-05-13 Thread Chen Fan
Signed-off-by: Chen Fan Reviewed-by: Eduardo Habkost --- target-i386/topology.h | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/target-i386/topology.h b/target-i386/topology.h index 07a6c5f..e9ff89c 100644 --- a/target-i386/topology.h

[Qemu-devel] [RFC 3/3] cpu: add device_add foo-x86_64-cpu support

2014-05-13 Thread Chen Fan
apic-id property to add default APIC IDs. Signed-off-by: Chen Fan --- include/qom/cpu.h | 2 ++ qdev-monitor.c | 11 ++ target-i386/cpu.c | 91 +- target-i386/topology.h | 18 ++ 4 files changed, 121 insertions(+), 1

[Qemu-devel] [PATCH] gtk.c: Fix memory leak in gd_set_keycode_type()

2014-09-01 Thread Chen Fan
) ==14553==by 0x80DBFBC: XkbGetKeyboardByName (in /usr/lib64/libX11.so.6.3.0) ==14553==by 0x40C704: gtk_display_init (gtk.c:1798) ==14553==by 0x1AEDC1: main (vl.c:4480) Signed-off-by: Chen Fan --- ui/gtk.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c

[Qemu-devel] [PATCH] i386/helper: add cpu dump APIC information

2014-07-21 Thread Chen Fan
When KVM exit reason is KVM_EXIT_SHUTDOWN, there will cause guest to reset, but we can't get any information to fix. we knew KVM handle triple fault will set exit_reason to KVM_EXIT_SHUTDOWN, so we also should dump the APIC information to help to fix. Signed-off-by: Chen Fan --- includ

[Qemu-devel] [PATCH] target-i386/cpu.c: Fix two error output indentation

2014-07-28 Thread Chen Fan
Signed-off-by: Chen Fan --- target-i386/cpu.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 6d008ab..217500c 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1716,9 +1716,9 @@ static void x86_set_hv_spinlocks

[Qemu-devel] [PATCH 1/3] query-memdev: fix potential memory leaks

2014-08-01 Thread Chen Fan
Signed-off-by: Chen Fan --- numa.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/numa.c b/numa.c index 7bf7834..a2b4bca 100644 --- a/numa.c +++ b/numa.c @@ -318,10 +318,11 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, static int

[Qemu-devel] [PATCH 0/3] Fix some memory leaks about query memdev

2014-08-01 Thread Chen Fan
9) ==15046==by 0x2BCDEF: fd_chr_read (qemu-char.c:213) Chen Fan (3): query-memdev: fix potential memory leaks qom/object.c: fix string_output_get_string() memory leak hmp: fix MemdevList memory leak hmp.c| 15 ++- numa.c | 6 +- qom/object.c | 11 --

[Qemu-devel] [PATCH 2/3] qom/object.c: fix string_output_get_string() memory leak

2014-08-01 Thread Chen Fan
string_output_get_string() always return the data the sov->string point. and never free. Signed-off-by: Chen Fan --- hmp.c| 6 -- qom/object.c | 11 --- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hmp.c b/hmp.c index 4d1838e..2414cc7 100644 --- a/hm

[Qemu-devel] [PATCH 3/3] hmp: fix MemdevList memory leak

2014-08-01 Thread Chen Fan
Signed-off-by: Chen Fan --- hmp.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hmp.c b/hmp.c index 2414cc7..0b1c830 100644 --- a/hmp.c +++ b/hmp.c @@ -1685,13 +1685,14 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict) { Error *err = NULL

[Qemu-devel] [v2 1/3] query-memdev: fix potential memory leaks

2014-08-03 Thread Chen Fan
Signed-off-by: Chen Fan Reviewed-by: Peter Crosthwaite --- numa.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/numa.c b/numa.c index 7bf7834..a2b4bca 100644 --- a/numa.c +++ b/numa.c @@ -318,10 +318,11 @@ void memory_region_allocate_system_memory(MemoryRegion *mr

[Qemu-devel] [v2 2/3] qom/object.c: fix string_output_get_string() memory leak

2014-08-03 Thread Chen Fan
string_output_get_string() uses g_string_free(str, false) to transfer the 'str' pointer to callers and never free it. Signed-off-by: Chen Fan --- hmp.c| 6 -- qom/object.c | 12 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hmp.c b/hmp.c ind

[Qemu-devel] [v2 0/3] Fix some memory leaks about query memdev

2014-08-03 Thread Chen Fan
9) ==15046==by 0x2BCDEF: fd_chr_read (qemu-char.c:213) Chen Fan (3): query-memdev: fix potential memory leaks qom/object.c: fix string_output_get_string() memory leak hmp: fix MemdevList memory leak hmp.c| 15 ++- numa.c | 6 +- qom/object.c | 11 --

[Qemu-devel] [v2 3/3] hmp: fix MemdevList memory leak

2014-08-03 Thread Chen Fan
the memdev_list in hmp_info_memdev() is never freed. so we use existent method qapi_free_MemdevList() to free it. and also we can use qapi_free_MemdevList() to replace list loops to clean up the memdev list in error path. Signed-off-by: Chen Fan --- hmp.c | 2 ++ numa.c | 9 ++--- 2 files

[Qemu-devel] [RFC qom-next v5 2/8] x86: add x86_cpu_unrealizefn() for cpu apic remove

2013-12-23 Thread Chen Fan
Implement x86_cpu_unrealizefn() for corresponding x86_cpu_realizefn(), which is mostly used to clean the apic related allocation and vmstates at here. Signed-off-by: Chen Fan --- hw/i386/kvm/apic.c | 8 hw/intc/apic.c | 10 ++ hw/intc

[Qemu-devel] [RFC qom-next v5 1/8] x86: move apic_state field from CPUX86State to X86CPU

2013-12-23 Thread Chen Fan
This motion is preparing for refactoring vCPU apic subsequently. Signed-off-by: Chen Fan --- cpu-exec.c| 2 +- cpus.c| 5 ++--- hw/i386/kvmvapic.c| 8 +++- hw/i386/pc.c | 17 - target-i386/cpu-qom.h | 4

[Qemu-devel] [RFC qom-next v5 4/8] qom cpu: rename variable 'cpu_added_notifier' to 'cpu_hotplug_notifier'

2013-12-23 Thread Chen Fan
Rename variable 'cpu_added_notifier' to 'cpu_hotplug_notifier' for adding remove vcpu notifier support. Signed-off-by: Chen Fan --- hw/acpi/piix4.c | 10 +- hw/i386/pc.c| 2 +- include/sysemu/sysemu.h | 2 +- qom/cpu.c | 10 +--

[Qemu-devel] [RFC qom-next v5 0/8] i386: add cpu hot remove support

2013-12-23 Thread Chen Fan
ove cpu from the last one rather than specify vcpuid and fix migration bug. Chen Fan (8): x86: move apic_state field from CPUX86State to X86CPU x86: add x86_cpu_unrealizefn() for cpu apic remove qmp: add 'cpu-del' command support qom cpu: rename variable 'cpu_added_notif

[Qemu-devel] [RFC qom-next v5 3/8] qmp: add 'cpu-del' command support

2013-12-23 Thread Chen Fan
add cpu hot-remove interface pc_hot_del_cpu() for unrealizing vcpu device. when using 'cpu-del' command, not need to specify vcpuid, the last one cpu will be removed. Signed-off-by: Chen Fan --- hw/i386/pc.c | 19 +++ hw/i386/pc_piix.c| 3 ++- include/h

[Qemu-devel] [RFC qom-next v5 5/8] qom cpu: add UNPLUG cpu notifier support

2013-12-23 Thread Chen Fan
Move struct HotplugEventType from file piix4.c to file qom/cpu.c, and add struct CPUNotifier for supporting UNPLUG cpu notifier. Signed-off-by: Chen Fan --- hw/acpi/piix4.c | 8 ++-- include/qom/cpu.h | 10 ++ qom/cpu.c | 6 +- 3 files changed, 17 insertions(+), 7

[Qemu-devel] [RFC qom-next v5 8/8] cpus: reclaim allocated vCPU objects

2013-12-23 Thread Chen Fan
After ACPI get a signal to eject a vCPU, then it will notify the vCPU thread to exit in KVM, and the vCPU must be removed from CPU list, before the vCPU really removed, there will release the all related vCPU objects. Signed-off-by: Chen Fan --- cpus.c | 39

[Qemu-devel] [RFC qom-next v5 7/8] piix4: implement function cpu_status_write() for vcpu ejection

2013-12-23 Thread Chen Fan
in the further OS should reject vcpu arbitrarily. Signed-off-by: Chen Fan --- cpus.c| 7 ++ hw/acpi/piix4.c | 48 ++- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 6 - include/qom/cpu.h | 10

[Qemu-devel] [RFC qom-next v5 6/8] i386: implement pc interface cpu_common_unrealizefn() in qom/cpu.c

2013-12-23 Thread Chen Fan
add interface cpu_common_unrealizefn() for emiting vcpu unplug notifier to ACPI, then ACPI could send sci interrupt to OS for hot-remove vcpu. Signed-off-by: Chen Fan --- qom/cpu.c | 12 1 file changed, 12 insertions(+) diff --git a/qom/cpu.c b/qom/cpu.c index 728b83b..78038ab

Re: [Qemu-devel] [RFC qom-next v5 1/8] x86: move apic_state field from CPUX86State to X86CPU

2013-12-23 Thread Chen Fan
On Mon, 2013-12-23 at 16:36 +0100, Andreas Färber wrote: > Am 23.12.2013 10:04, schrieb Chen Fan: > > This motion is preparing for refactoring vCPU apic subsequently. > > > > Signed-off-by: Chen Fan > > --- > > cpu-exec.c| 2 +- > > cpus.

Re: [Qemu-devel] [PATCH qom-cpu] cpu-exec: Optimize X86CPU usage in cpu_exec()

2013-12-23 Thread Chen Fan
} else if ((interrupt_request & CPU_INTERRUPT_NMI) && > !(env->hflags2 & HF2_NMI_MASK)) { > @@ -685,6 +688,9 @@ int cpu_exec(CPUArchState *env) >(defined(TARGET_M68K) || defined(TARGET_PPC) || defined(TARGET_S390X))) > cc = CPU_GET_CLASS(cpu); > #endif > +#ifdef TARGET_I386 > +x86_cpu = X86_CPU(cpu); > +#endif > } > } /* for(;;) */ > Reviewed-by: Chen Fan Thanks. Chen

[Qemu-devel] [RFC 2/3] target-i386: add -smp X,apics=0x option

2014-01-14 Thread Chen Fan
This option provides the infrastructure for specifying apicids when boot VM, For example: #boot with apicid 0 and 2: -smp 2,apics=0xA,maxcpus=4 /* 1010 */ #boot with apicid 1 and 7: -smp 2,apics=0x41,maxcpus=8 /* 0100 0001 */ Signed-off-by: Chen Fan --- hw/i386/pc.c| 9

[Qemu-devel] [RFC 0/3] fix migration issues after hotplug a discontinuous cpuid

2014-01-14 Thread Chen Fan
arbitrary CPU hot-remove as well. Chen Fan (3): target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn() target-i386: add -smp X,apics=0x option target-i386: add qmp command 'query-cpus' to display apic_id cpus.c | 1

[Qemu-devel] [RFC 3/3] target-i386: add qmp command 'query-cpus' to display apic_id

2014-01-14 Thread Chen Fan
this patch provided the apic_id display as using command 'query-cpus'. Signed-off-by: Chen Fan --- cpus.c | 1 + qapi-schema.json | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index ca4c59f..e6ed098 100644 --- a/cpus.c +++ b/cpus.c

[Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()

2014-01-14 Thread Chen Fan
-by: Chen Fan --- exec.c| 5 + target-i386/cpu.c | 9 + 2 files changed, 14 insertions(+) diff --git a/exec.c b/exec.c index 7e49e8e..9be5855 100644 --- a/exec.c +++ b/exec.c @@ -438,7 +438,9 @@ CPUState *qemu_get_cpu(int index) void cpu_exec_init(CPUArchState *env

Re: [Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()

2014-01-15 Thread Chen Fan
On Tue, 2014-01-14 at 11:40 +0100, Igor Mammedov wrote: > On Tue, 14 Jan 2014 17:27:20 +0800 > Chen Fan wrote: > > > the intend of this patch is to register cpu vmstates with apic id instead > > of cpu > > index, due to the property setting of apic_id is behind the

Re: [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn())

2014-01-20 Thread Chen Fan
On Mon, 2014-01-20 at 13:29 +0100, Igor Mammedov wrote: > On Fri, 17 Jan 2014 17:13:55 -0200 > Eduardo Habkost wrote: > > > On Wed, Jan 15, 2014 at 03:37:04PM +0100, Igor Mammedov wrote: > > > On Wed, 15 Jan 2014 20:24:01 +0800 > > > Chen Fan wrote: > >

Re: [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn())

2014-01-21 Thread Chen Fan
On Tue, 2014-01-21 at 10:31 +0100, Igor Mammedov wrote: > On Tue, 21 Jan 2014 15:12:45 +0800 > Chen Fan wrote: > > > On Mon, 2014-01-20 at 13:29 +0100, Igor Mammedov wrote: > > > On Fri, 17 Jan 2014 17:13:55 -0200 > > > Eduardo Habkost wrote: > > >

Re: [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn())

2014-02-12 Thread Chen Fan
On Tue, 2014-01-21 at 11:10 +0100, Andreas Färber wrote: > Am 21.01.2014 10:51, schrieb Chen Fan: > > On Tue, 2014-01-21 at 10:31 +0100, Igor Mammedov wrote: > >> On Tue, 21 Jan 2014 15:12:45 +0800 > >> Chen Fan wrote: > >>> On Mon, 2014-01-20 at 13:29 +0

Re: [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn())

2014-02-17 Thread Chen Fan
On Thu, 2014-02-13 at 10:44 +0100, Igor Mammedov wrote: > On Thu, 13 Feb 2014 14:14:08 +0800 > Chen Fan wrote: > > > On Tue, 2014-01-21 at 11:10 +0100, Andreas Färber wrote: > > > Am 21.01.2014 10:51, schrieb Chen Fan: > > > > On Tue, 2014-01-21 at 10:31 +01

Re: [Qemu-devel] [RFC 2/3] target-i386: add -smp X,apics=0x option

2014-02-17 Thread Chen Fan
On Mon, 2014-02-17 at 11:37 -0700, Eric Blake wrote: > On 01/14/2014 02:27 AM, Chen Fan wrote: > > This option provides the infrastructure for specifying apicids when > > boot VM, For example: > > > > #boot with apicid 0 and 2: > > -smp 2,apics=0xA,maxcpus=4 /*

[Qemu-devel] [PATCH 1/2][RFC] qom: introduce cpu QOM hierarchy tree /machine/node/socket/core/thread/cpu.

2014-02-25 Thread Chen Fan
Signed-off-by: Chen Fan --- include/qom/node.h | 66 +++ qom/Makefile.objs | 2 +- qom/node.c | 156 + 3 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 include/qom/node.h create mode 100644

[Qemu-devel] [PATCH 2/2][RFC] cpu: link each new cpu to QOM tree /machine/node/socket/core/thread/cpu respectively.

2014-02-25 Thread Chen Fan
Signed-off-by: Chen Fan --- hw/i386/pc.c | 40 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 348b15f..4e07ef9 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -57,6 +57,7 @@ #include "hw/boa

[Qemu-devel] [PATCH 0/2][RFC] prebuild cpu QOM tree /machine/node/socket/core/thread/..

2014-02-25 Thread Chen Fan
2. add -device cpu-foo.path supported. 3. then we could introduce hot-remove cpu probably. I don't know wether this way is right or not. pls tell me. :) Thanks, Chen Chen Fan (2): qom: introduce cpu QOM hierarchy tree /machine/node/socket/core/thread/cpu. cpu: link each new

Re: [Qemu-devel] [PATCH 1/2][RFC] qom: introduce cpu QOM hierarchy tree /machine/node/socket/core/thread/cpu.

2014-02-25 Thread Chen Fan
On Tue, 2014-02-25 at 06:35 -0700, Eric Blake wrote: > On 02/25/2014 02:07 AM, Chen Fan wrote: > > Signed-off-by: Chen Fan > > --- > > include/qom/node.h | 66 +++ > > qom/Makefile.objs | 2 +- &g

Re: [Qemu-devel] [PATCH 1/2][RFC] qom: introduce cpu QOM hierarchy tree /machine/node/socket/core/thread/cpu.

2014-02-27 Thread Chen Fan
On Wed, 2014-02-26 at 15:52 -0300, Eduardo Habkost wrote: > On Tue, Feb 25, 2014 at 05:07:31PM +0800, Chen Fan wrote: > [...] > > +Object *object_get_thread_from_index(int64_t cpu_index) > > Probably the code that is going to call this function already knows what > will be

[Qemu-devel] [RFC v2 0/2] prebuild cpu QOM tree /machine/node/socket/core/thread/..

2014-03-04 Thread Chen Fan
3. then we could introduce hot-remove cpu probably. I don't know wether this way is right or not. pls tell me. :) Chen Fan (2): i386: introduce "struct X86TopoInfo" for saving cpu topology information i386: introduce cpu QOM hierarchy tree hw/i386/pc.c

[Qemu-devel] [RFC v2 1/2] i386: introduce "struct X86TopoInfo" for saving cpu topology information

2014-03-04 Thread Chen Fan
Signed-off-by: Chen Fan --- hw/i386/pc.c | 13 + target-i386/cpu.c | 16 target-i386/cpu.h | 4 target-i386/topology.h | 7 +++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 348b15f

[Qemu-devel] [RFC v2 2/2] i386: introduce cpu QOM hierarchy tree

2014-03-04 Thread Chen Fan
add cpu-topology.h cpu-topology.c files for prebuild cpu qom tree "/machine/node[X]/socket[Y]/core[Z]/thread[N]/cpu" Signed-off-by: Chen Fan --- hw/i386/pc.c | 6 +- target-i386/Makefile.objs | 2 +- target-i386/cpu-qom.h | 1 + target-i386/cpu-topolo

Re: [Qemu-devel] [RFC qom-cpu v4 00/10] i386: add cpu hot remove support

2013-12-03 Thread Chen Fan
On Thu, 2013-11-28 at 15:41 +0100, Igor Mammedov wrote: > On Wed, 9 Oct 2013 17:43:08 +0800 > Chen Fan wrote: > > > Via implementing ACPI standard methods _EJ0 in bios, after Guest OS hot > > remove > > one vCPU, it is able to send a signal to QEMU, then QEMU could n

Re: [Qemu-devel] [RFC qom-cpu v4 10/10] cpus: reclaim allocated vCPU objects

2013-12-03 Thread Chen Fan
On Thu, 2013-11-28 at 15:48 +0100, Igor Mammedov wrote: > On Wed, 9 Oct 2013 17:43:18 +0800 > Chen Fan wrote: > > > After ACPI get a signal to eject a vCPU, then it will notify > > the vCPU thread to exit in KVM, and the vCPU must be removed from CPU list, > > bef

Re: [Qemu-devel] [RFC qom-cpu v4 00/10] i386: add cpu hot remove support

2013-12-04 Thread Chen Fan
On Wed, 2013-12-04 at 16:42 +0100, Igor Mammedov wrote: > On Wed, 04 Dec 2013 10:15:16 +0800 > Chen Fan wrote: > > > On Thu, 2013-11-28 at 15:41 +0100, Igor Mammedov wrote: > > > On Wed, 9 Oct 2013 17:43:08 +0800 > > > Chen Fan wrote: > > > > >

Re: [Qemu-devel] [PATCH v3 4/4] ioapic: QOM'ify ioapic

2013-12-18 Thread Chen Fan
On Wed, 2013-12-18 at 19:03 +0100, Andreas Färber wrote: > Am 05.11.2013 11:16, schrieb xiaoqiang zhao: > > changes: > > 1. use type constant for kvm_ioapic and ioapic > > 2. convert 'init' to QOM's 'realize' for ioapic and kvm_ioapic > > For QOM'ify, I move variable 'ioapic_no' from static to glob

Re: [Qemu-devel] [RFC qom-cpu v4 00/10] i386: add cpu hot remove support

2013-12-19 Thread Chen Fan
On Thu, 2013-11-28 at 15:41 +0100, Igor Mammedov wrote: > On Wed, 9 Oct 2013 17:43:08 +0800 > Chen Fan wrote: > > > Via implementing ACPI standard methods _EJ0 in bios, after Guest OS hot > > remove > > one vCPU, it is able to send a signal to QEMU, then QEMU could n

Re: [Qemu-devel] [PATCH v2 2/4] apic: QOM'ify apic & icc_bus

2013-11-05 Thread Chen Fan
On Tue, 2013-11-05 at 15:55 +0800, xiaoqiang zhao wrote: > changes includes: > 1. use type constant for apic and kvm_apic > 2. convert function 'init' to QOM's 'realize' for apic/kvm_apic > 3. for consistency, also QOM'ify apic's parent bus 'icc_bus' > --- > hw/cpu/icc_bus.c| 14

Re: [Qemu-devel] [PATCH v2 2/4] apic: QOM'ify apic & icc_bus

2013-11-11 Thread Chen Fan
On Mon, 2013-11-11 at 11:58 +0800, 赵小强 wrote: > 于 11/05/2013 04:51 PM, 赵小强 写道: > > 于 2013年11月05日 16:25, Chen Fan 写道: > >> On Tue, 2013-11-05 at 15:55 +0800, xiaoqiang zhao wrote: > >>> changes includes: > >>> 1. use type constant for apic and kvm_apic

Re: [Qemu-devel] [PATCH v2 2/4] apic: QOM'ify apic & icc_bus

2013-11-11 Thread Chen Fan
On Tue, 2013-11-12 at 09:54 +0800, 赵小强 wrote: > 于 11/12/2013 09:28 AM, Chen Fan 写道: > > > On Mon, 2013-11-11 at 11:58 +0800, 赵小强 wrote: > > > 于 11/05/2013 04:51 PM, 赵小强 写道: > > > > 于 2013年11月05日 16:25, Chen Fan 写道: > > > > > On Tue,

Re: [Qemu-devel] [PATCH v2 2/4] apic: QOM'ify apic & icc_bus

2013-11-13 Thread Chen Fan
On Tue, 2013-11-12 at 17:41 +0100, Andreas Färber wrote: > Am 12.11.2013 04:02, schrieb Chen Fan: > > On Tue, 2013-11-12 at 09:54 +0800, 赵小强 wrote: > >> He asked me to drop the parent_realize. so in v2, I just replace the > >> 'init' with 'realize'. &

Re: [Qemu-devel] [RFC qom-cpu v4 09/10] piix4: implement function cpu_status_write() for vcpu ejection

2013-11-27 Thread Chen Fan
On Mon, 2013-11-25 at 19:38 +0100, Vasilis Liaskovitis wrote: > On Fri, Nov 22, 2013 at 09:02:27AM +0100, Vasilis Liaskovitis wrote: > > Hi, > > > > On Wed, Oct 09, 2013 at 05:43:17PM +0800, Chen Fan wrote: > > > When OS eject a vcpu (like: echo 1 > > >

Re: [Qemu-devel] [RFC qom-cpu v4 05/10] qmp: add 'cpu-del' command support

2013-11-27 Thread Chen Fan
On Wed, 2013-11-27 at 07:00 -0700, Eric Blake wrote: > On 10/09/2013 03:43 AM, Chen Fan wrote: > > Signed-off-by: Chen Fan > > --- > > hw/i386/pc.c | 6 ++ > > hw/i386/pc_piix.c| 3 ++- > > include/hw/boards.h | 2 ++ > > include/hw

[Qemu-devel] [RFC qom-cpu v4 03/10] apic: remove local_apics array and using CPU_FOREACH instead

2013-10-09 Thread Chen Fan
Using CPU_FOREACH() marco instead of scaning the entire local_apics array for fast searching apic. Signed-off-by: Chen Fan --- hw/intc/apic.c | 73 ++--- include/hw/i386/apic_internal.h | 2 -- 2 files changed, 32 insertions(+), 43 deletions

[Qemu-devel] [RFC qom-cpu v4 06/10] qom cpu: rename variable 'cpu_added_notifier' to 'cpu_hotplug_notifier'

2013-10-09 Thread Chen Fan
Rename variable 'cpu_added_notifier' to 'cpu_hotplug_notifier', for adding vcpu-remove notifier support. Signed-off-by: Chen Fan --- hw/acpi/piix4.c | 10 +- hw/i386/pc.c| 2 +- include/sysemu/sysemu.h | 2 +- qom/cpu.c | 10

[Qemu-devel] [RFC qom-cpu v4 02/10] apic: remove redundant variable 'apic_no' from apic_init_common()

2013-10-09 Thread Chen Fan
In struct APICCommonState, there is an id field yet, which was set earlier, qdev_prop_set_uint8(env->apic_state, "id", env->cpuid_apic_id); so we use the id field instead of the variable 'apic_no' to represent the unique apic index. Signed-off-by: Chen Fan ---

[Qemu-devel] [RFC qom-cpu v4 04/10] x86: add x86_cpu_unrealizefn() for cpu apic remove

2013-10-09 Thread Chen Fan
Implement x86_cpu_unrealizefn() for corresponding x86_cpu_realizefn(), which is mostly used to clear the apic related information at here. and refactor apic initialization, use QOM realizefn. Signed-off-by: Chen Fan --- hw/i386/kvm/apic.c | 18 -- hw/intc/apic.c

[Qemu-devel] [RFC qom-cpu v4 01/10] x86: move apic_state field from CPUX86State to X86CPU

2013-10-09 Thread Chen Fan
This motion is preparing for refactoring vCPU apic subsequently. Signed-off-by: Chen Fan --- cpu-exec.c| 2 +- cpus.c| 5 ++--- hw/i386/kvmvapic.c| 8 +++- hw/i386/pc.c | 17 - target-i386/cpu-qom.h | 4

[Qemu-devel] [RFC qom-cpu v4 08/10] i386: implement pc interface pc_hot_del_cpu()

2013-10-09 Thread Chen Fan
Implement cpu interface pc_hot_del_cpu() for unrealizing device vCPU. emiting vcpu-remove notifier to ACPI, then ACPI could send sci interrupt to OS for hot-remove vcpu. Signed-off-by: Chen Fan --- hw/i386/pc.c | 30 -- qom/cpu.c| 12 2 files changed

[Qemu-devel] [RFC qom-cpu v4 00/10] i386: add cpu hot remove support

2013-10-09 Thread Chen Fan
ments.gmane.org/gmane.comp.emulators.qemu/230460 Chen Fan (10): x86: move apic_state field from CPUX86State to X86CPU apic: remove redundant variable 'apic_no' from apic_init_common() apic: remove local_apics array and using CPU_FOREACH instead x86: add x86_cpu_unrealizefn() for cpu apic r

[Qemu-devel] [RFC qom-cpu v4 09/10] piix4: implement function cpu_status_write() for vcpu ejection

2013-10-09 Thread Chen Fan
When OS eject a vcpu (like: echo 1 > /sys/bus/acpi/devices/LNXCPUXX/eject), it will call acpi EJ0 method, the firmware will write the new cpumap, QEMU will know which vcpu need to be ejected. Signed-off-by: Chen Fan --- hw/acpi/piix4.c | 37 - 1 file chan

[Qemu-devel] [RFC qom-cpu v4 05/10] qmp: add 'cpu-del' command support

2013-10-09 Thread Chen Fan
Signed-off-by: Chen Fan --- hw/i386/pc.c | 6 ++ hw/i386/pc_piix.c| 3 ++- include/hw/boards.h | 2 ++ include/hw/i386/pc.h | 1 + qapi-schema.json | 12 qmp-commands.hx | 23 +++ qmp.c| 9 + 7 files changed

[Qemu-devel] [RFC qom-cpu v4 10/10] cpus: reclaim allocated vCPU objects

2013-10-09 Thread Chen Fan
After ACPI get a signal to eject a vCPU, then it will notify the vCPU thread to exit in KVM, and the vCPU must be removed from CPU list, before the vCPU really removed, there will release the all related vCPU objects. Signed-off-by: Chen Fan --- cpus.c | 46

[Qemu-devel] [RFC qom-cpu v4 07/10] qom cpu: add UNPLUG cpu notifier support

2013-10-09 Thread Chen Fan
Move struct HotplugEventType from file piix4.c to file qom/cpu.c, and add struct CPUNotifier for supporting UNPLUG cpu notifier. Signed-off-by: Chen Fan --- hw/acpi/piix4.c | 8 ++-- include/qom/cpu.h | 10 ++ qom/cpu.c | 6 +- 3 files changed, 17 insertions(+), 7

[Qemu-devel] [PATCH v1 3/3] x86: move apic_state field from CPUX86State to X86CPU

2013-10-22 Thread Chen Fan
Signed-off-by: Chen Fan --- cpu-exec.c| 2 +- cpus.c| 5 ++--- hw/i386/kvmvapic.c| 8 +++- hw/i386/pc.c | 17 - hw/intc/apic.c| 8 target-i386/cpu-qom.h | 4 target-i386/cpu.c

[Qemu-devel] [PATCH v1 1/3] Change apic/kvm/xen to use QOM typing

2013-10-22 Thread Chen Fan
Get rid of unused icc_device_realize() Signed-off-by: Chen Fan --- hw/cpu/icc_bus.c| 17 - hw/i386/kvm/apic.c | 10 -- hw/intc/apic.c | 18 -- hw/intc/apic_common.c | 17 +++-- hw/xen

[Qemu-devel] [PATCH v1 2/3] Using CPU_FOREACH() instead of scanning local_apics

2013-10-22 Thread Chen Fan
And dropping MAX_APICS cast macro altogether. Signed-off-by: Chen Fan --- hw/intc/apic.c | 82 + include/hw/i386/apic_internal.h | 2 - 2 files changed, 33 insertions(+), 51 deletions(-) diff --git a/hw/intc/apic.c b/hw/intc/apic.c

[Qemu-devel] [PATCH v1 0/3] refactor x86 apic to QOM typing

2013-10-22 Thread Chen Fan
In order to implement 'cpu-del' in the furture. at first, needing to refactor x86 apic codes. this converts apic/kvm/xen 's init() callbacks to realize() and dropping local_apics[] from file hw/intc/apic.c. moving apic_state field from CPUX86State to X86CPU. Chen Fan (3): Chan

Re: [Qemu-devel] [RFC v2 1/2] i386: introduce "struct X86TopoInfo" for saving cpu topology information

2014-03-04 Thread Chen Fan
On Tue, 2014-03-04 at 16:35 -0300, Eduardo Habkost wrote: > On Tue, Mar 04, 2014 at 06:50:24PM +0800, Chen Fan wrote: > > Signed-off-by: Chen Fan > > --- > > hw/i386/pc.c | 13 + > > target-i386/cpu.c | 16 >

Re: [Qemu-devel] [RFC v3 2/3] i386: use CpuTopoInfo instead apic_id as argument for pc_new_cpu()

2014-03-11 Thread Chen Fan
On Tue, 2014-03-11 at 15:00 -0300, Eduardo Habkost wrote: > On Tue, Mar 11, 2014 at 06:58:53PM +0800, chen.fan.fnst wrote: > > From: "chen.fan.fnst" > > > > Signed-off-by: Chen Fan > > --- > > hw/i386/pc.c | 12 > > targ

[Qemu-devel] [RFC v4 1/3] cpu: introduce CpuTopoInfo structure for argument simplification

2014-03-12 Thread Chen Fan
Signed-off-by: Chen Fan --- target-i386/topology.h | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/target-i386/topology.h b/target-i386/topology.h index 07a6c5f..9b811c1 100644 --- a/target-i386/topology.h +++ b/target-i386/topology.h

[Qemu-devel] [RFC v4 0/3] prebuild cpu QOM tree /machine/node/socket/core ->link-cpu

2014-03-12 Thread Chen Fan
h used for specifying the QOM path. 2. add -device cpu-foo.path supported. 3. then we could introduce hot-remove cpu probably. I don't know wether this way is right or not. pls tell me. :) Chen Fan (3): i386: introduce cpu QOM hierarchy tree cpu: introduce X86CPUTopoInfo structu

[Qemu-devel] [RFC v4 2/3] i386: use CpuTopoInfo instead apic_id as argument for pc_new_cpu()

2014-03-12 Thread Chen Fan
Signed-off-by: Chen Fan --- hw/i386/pc.c | 25 ++--- target-i386/cpu.c | 28 +++- target-i386/cpu.h | 5 + target-i386/topology.h | 18 ++ 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/hw/i386

[Qemu-devel] [RFC v4 3/3] i386: introduce cpu QOM hierarchy tree

2014-03-12 Thread Chen Fan
add cpu-topology.h cpu-topology.c files for prebuilding cpu qom tree "/machine/node[X]/socket[Y]/core[Z]->link cpu" Signed-off-by: Chen Fan --- hw/i386/pc.c | 3 + target-i386/Makefile.objs | 2 +- target-i386/cpu-top

[Qemu-devel] [PATCH v1 2/4] i386: use CpuTopoInfo instead apic_id as argument for pc_new_cpu()

2014-03-19 Thread Chen Fan
introduce x86_cpu_topo_ids_from_index() to calculate the cpu topology information, and the compat old mode mechanism moved into there. remove unused funciton x86_apicid_from_cpu_idx(). Signed-off-by: Chen Fan --- hw/i386/pc.c | 22 -- target-i386/cpu.c | 33

[Qemu-devel] [PATCH v1 4/4] i386: introduce cpu QOM hierarchy tree

2014-03-19 Thread Chen Fan
add cpu-topology.h cpu-topology.c files for prebuilding cpu qom tree "/machine/node[X]/socket[Y]/core[Z]->link cpu" Signed-off-by: Chen Fan --- hw/i386/pc.c | 3 + target-i386/Makefile.objs | 2 +- target-i386/cpu-top

[Qemu-devel] [PATCH v1 3/4] topo unit-test: update Unit tests to test-x86-cpuid.c

2014-03-19 Thread Chen Fan
remove redundant x86_apicid_from_cpu_idx() tests. add tests to check x86_topo_ids_from_apic_id() and x86_topo_ids_from_apic_id() output. Signed-off-by: Chen Fan --- tests/test-x86-cpuid.c | 165 ++--- 1 file changed, 129 insertions(+), 36 deletions

[Qemu-devel] [PATCH v1 0/4] prebuild cpu QOM tree /machine/node/socket/core ->link-cpu

2014-03-19 Thread Chen Fan
erty which used for specifying the QOM path. 2. add -device cpu-foo.path supported. 3. then we could introduce hot-remove cpu probably. I don't know wether this way is right or not. pls tell me. :) Chen Fan (4): cpu: introduce CpuTopoInfo structure for argument simplification i386:

[Qemu-devel] [PATCH v1 1/4] cpu: introduce CpuTopoInfo structure for argument simplification

2014-03-19 Thread Chen Fan
Signed-off-by: Chen Fan Reviewed-by: Eduardo Habkost --- target-i386/topology.h | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/target-i386/topology.h b/target-i386/topology.h index 07a6c5f..e9ff89c 100644 --- a/target-i386/topology.h

Re: [Qemu-devel] [PATCH v1 0/4] prebuild cpu QOM tree /machine/node/socket/core ->link-cpu

2014-03-19 Thread Chen Fan
On Wed, 2014-03-19 at 06:00 -0600, Eric Blake wrote: > On 03/19/2014 02:53 AM, Chen Fan wrote: > > at present, after hotplug a discontinuous cpu id on source, then done > > migration, > > on target, it will fail to add the unoccupied cpu id which was skipped at > > s

Re: [Qemu-devel] [PATCH v1 2/4] i386: use CpuTopoInfo instead apic_id as argument for pc_new_cpu()

2014-03-19 Thread Chen Fan
On Wed, 2014-03-19 at 16:27 -0300, Eduardo Habkost wrote: > On Wed, Mar 19, 2014 at 04:53:41PM +0800, Chen Fan wrote: > > introduce x86_cpu_topo_ids_from_index() to calculate the cpu topology > > information, and the compat old mode mechanism moved into there. > > r

[Qemu-devel] [PATCH v2 1/3] cpu: introduce CpuTopoInfo structure for argument simplification

2014-03-19 Thread Chen Fan
Signed-off-by: Chen Fan Reviewed-by: Eduardo Habkost --- target-i386/topology.h | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/target-i386/topology.h b/target-i386/topology.h index 07a6c5f..e9ff89c 100644 --- a/target-i386/topology.h

  1   2   3   4   5   >