From: Liu Ping Fan <kernelfans@gmail.com>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, ryanh@us.ibm.com, jan.kiszka@web.de,
linux-kernel@vger.kernel.org, avi@redhat.com
Subject: [PATCH 2/5] QEMU Add cpu_free() to support arch related CPUState release
Date: Sun, 27 Nov 2011 10:45:34 +0800 [thread overview]
Message-ID: <1322361937-22438-2-git-send-email-kernelfans@gmail.com> (raw)
In-Reply-To: <1322188529-11609-1-git-send-email-kernelfans@gmail.com>
From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
When exiting from vcpu thread, the CPUState must be freed firstly.
And the handling process is an arch related.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
hw/apic.c | 4 ++++
target-i386/cpu.h | 3 +++
target-i386/helper.c | 8 ++++++++
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/hw/apic.c b/hw/apic.c
index 34fa1dd..6472045 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -511,6 +511,10 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask,
}
}
}
+void apic_free(DeviceState *d)
+{
+ qdev_free(d);
+}
void apic_init_reset(DeviceState *d)
{
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 251e63b..da07781 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -767,6 +767,7 @@ typedef struct CPUX86State {
} CPUX86State;
CPUX86State *cpu_x86_init(const char *cpu_model);
+void cpu_x86_free(CPUState *env);
CPUX86State *x86_phyid_to_cpu(int phy_id);
int cpu_x86_exec(CPUX86State *s);
void cpu_x86_close(CPUX86State *s);
@@ -950,6 +951,7 @@ CPUState *pc_new_cpu(const char *cpu_model);
#define cpu_list_id x86_cpu_list
#define cpudef_setup x86_cpudef_setup
+#define cpu_free cpu_x86_free
#define CPU_SAVE_VERSION 12
/* MMU modes definitions */
@@ -1064,5 +1066,6 @@ void svm_check_intercept(CPUState *env1, uint32_t type);
uint32_t cpu_cc_compute_all(CPUState *env1, int op);
+void apic_free(DeviceState *d);
#define cpu_phyid_to_cpu x86_phyid_to_cpu
#endif /* CPU_I386_H */
diff --git a/target-i386/helper.c b/target-i386/helper.c
index e35a75e..c9fadc3 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1263,6 +1263,14 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
return env;
}
+void cpu_x86_free(CPUState *env)
+{
+ if (env->apic_state != NULL) {
+ apic_free(env->apic_state);
+ }
+ g_free(env);
+}
+
CPUX86State *x86_phyid_to_cpu(int phy_id)
{
CPUX86State *env = first_cpu;
--
1.7.4.4
WARNING: multiple messages have this Message-ID (diff)
From: Liu Ping Fan <kernelfans@gmail.com>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Cc: linux-kernel@vger.kernel.org, avi@redhat.com,
aliguori@us.ibm.com, jan.kiszka@web.de, ryanh@us.ibm.com
Subject: [PATCH 2/5] QEMU Add cpu_free() to support arch related CPUState release
Date: Sun, 27 Nov 2011 10:45:34 +0800 [thread overview]
Message-ID: <1322361937-22438-2-git-send-email-kernelfans@gmail.com> (raw)
In-Reply-To: <1322188529-11609-1-git-send-email-kernelfans@gmail.com>
From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
When exiting from vcpu thread, the CPUState must be freed firstly.
And the handling process is an arch related.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
hw/apic.c | 4 ++++
target-i386/cpu.h | 3 +++
target-i386/helper.c | 8 ++++++++
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/hw/apic.c b/hw/apic.c
index 34fa1dd..6472045 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -511,6 +511,10 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask,
}
}
}
+void apic_free(DeviceState *d)
+{
+ qdev_free(d);
+}
void apic_init_reset(DeviceState *d)
{
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 251e63b..da07781 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -767,6 +767,7 @@ typedef struct CPUX86State {
} CPUX86State;
CPUX86State *cpu_x86_init(const char *cpu_model);
+void cpu_x86_free(CPUState *env);
CPUX86State *x86_phyid_to_cpu(int phy_id);
int cpu_x86_exec(CPUX86State *s);
void cpu_x86_close(CPUX86State *s);
@@ -950,6 +951,7 @@ CPUState *pc_new_cpu(const char *cpu_model);
#define cpu_list_id x86_cpu_list
#define cpudef_setup x86_cpudef_setup
+#define cpu_free cpu_x86_free
#define CPU_SAVE_VERSION 12
/* MMU modes definitions */
@@ -1064,5 +1066,6 @@ void svm_check_intercept(CPUState *env1, uint32_t type);
uint32_t cpu_cc_compute_all(CPUState *env1, int op);
+void apic_free(DeviceState *d);
#define cpu_phyid_to_cpu x86_phyid_to_cpu
#endif /* CPU_I386_H */
diff --git a/target-i386/helper.c b/target-i386/helper.c
index e35a75e..c9fadc3 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1263,6 +1263,14 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
return env;
}
+void cpu_x86_free(CPUState *env)
+{
+ if (env->apic_state != NULL) {
+ apic_free(env->apic_state);
+ }
+ g_free(env);
+}
+
CPUX86State *x86_phyid_to_cpu(int phy_id)
{
CPUX86State *env = first_cpu;
--
1.7.4.4
WARNING: multiple messages have this Message-ID (diff)
From: Liu Ping Fan <kernelfans@gmail.com>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, ryanh@us.ibm.com, jan.kiszka@web.de,
linux-kernel@vger.kernel.org, avi@redhat.com
Subject: [Qemu-devel] [PATCH 2/5] QEMU Add cpu_free() to support arch related CPUState release
Date: Sun, 27 Nov 2011 10:45:34 +0800 [thread overview]
Message-ID: <1322361937-22438-2-git-send-email-kernelfans@gmail.com> (raw)
In-Reply-To: <1322188529-11609-1-git-send-email-kernelfans@gmail.com>
From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
When exiting from vcpu thread, the CPUState must be freed firstly.
And the handling process is an arch related.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
hw/apic.c | 4 ++++
target-i386/cpu.h | 3 +++
target-i386/helper.c | 8 ++++++++
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/hw/apic.c b/hw/apic.c
index 34fa1dd..6472045 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -511,6 +511,10 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask,
}
}
}
+void apic_free(DeviceState *d)
+{
+ qdev_free(d);
+}
void apic_init_reset(DeviceState *d)
{
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 251e63b..da07781 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -767,6 +767,7 @@ typedef struct CPUX86State {
} CPUX86State;
CPUX86State *cpu_x86_init(const char *cpu_model);
+void cpu_x86_free(CPUState *env);
CPUX86State *x86_phyid_to_cpu(int phy_id);
int cpu_x86_exec(CPUX86State *s);
void cpu_x86_close(CPUX86State *s);
@@ -950,6 +951,7 @@ CPUState *pc_new_cpu(const char *cpu_model);
#define cpu_list_id x86_cpu_list
#define cpudef_setup x86_cpudef_setup
+#define cpu_free cpu_x86_free
#define CPU_SAVE_VERSION 12
/* MMU modes definitions */
@@ -1064,5 +1066,6 @@ void svm_check_intercept(CPUState *env1, uint32_t type);
uint32_t cpu_cc_compute_all(CPUState *env1, int op);
+void apic_free(DeviceState *d);
#define cpu_phyid_to_cpu x86_phyid_to_cpu
#endif /* CPU_I386_H */
diff --git a/target-i386/helper.c b/target-i386/helper.c
index e35a75e..c9fadc3 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1263,6 +1263,14 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
return env;
}
+void cpu_x86_free(CPUState *env)
+{
+ if (env->apic_state != NULL) {
+ apic_free(env->apic_state);
+ }
+ g_free(env);
+}
+
CPUX86State *x86_phyid_to_cpu(int phy_id)
{
CPUX86State *env = first_cpu;
--
1.7.4.4
next prev parent reply other threads:[~2011-11-27 2:45 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-25 2:35 [PATCH 0] A series patches for kvm&qemu to enable vcpu destruction in kvm Liu Ping Fan
2011-11-25 2:35 ` [Qemu-devel] " Liu Ping Fan
2011-11-25 2:35 ` Liu Ping Fan
2011-11-25 2:35 ` [PATCH 1/2] kvm: make vcpu life cycle separated from kvm instance Liu Ping Fan
2011-11-25 2:35 ` [Qemu-devel] " Liu Ping Fan
2011-11-25 2:35 ` Liu Ping Fan
2011-11-27 10:36 ` Avi Kivity
2011-11-27 10:36 ` [Qemu-devel] " Avi Kivity
2011-11-27 10:36 ` Avi Kivity
2011-12-02 6:26 ` [PATCH] " Liu Ping Fan
2011-12-02 18:26 ` Jan Kiszka
2011-12-04 11:53 ` Liu ping fan
2011-12-04 12:10 ` Gleb Natapov
2011-12-05 5:39 ` Liu ping fan
2011-12-05 8:41 ` Gleb Natapov
2011-12-06 6:54 ` Liu ping fan
2011-12-06 8:14 ` Gleb Natapov
2011-12-04 10:23 ` Avi Kivity
2011-12-05 5:29 ` Liu ping fan
2011-12-05 5:29 ` Liu ping fan
2011-12-05 9:30 ` Avi Kivity
2011-12-05 9:42 ` Gleb Natapov
2011-12-05 9:58 ` Avi Kivity
2011-12-05 10:18 ` Gleb Natapov
2011-12-05 10:22 ` Avi Kivity
2011-12-05 10:40 ` Gleb Natapov
2011-12-09 5:23 ` [PATCH V2] " Liu Ping Fan
2011-12-09 14:23 ` Gleb Natapov
2011-12-12 2:41 ` [PATCH v3] " Liu Ping Fan
2011-12-12 12:54 ` Gleb Natapov
2011-12-13 9:29 ` Liu ping fan
2011-12-13 9:47 ` Gleb Natapov
2011-12-13 11:36 ` Marcelo Tosatti
2011-12-13 11:54 ` Gleb Natapov
2011-12-15 3:21 ` Liu ping fan
2011-12-15 4:28 ` [PATCH v4] " Liu Ping Fan
2011-12-15 5:33 ` Xiao Guangrong
2011-12-15 6:53 ` Liu ping fan
2011-12-15 8:25 ` Xiao Guangrong
2011-12-15 8:57 ` Xiao Guangrong
2011-12-15 6:48 ` Takuya Yoshikawa
2011-12-16 9:38 ` Marcelo Tosatti
2011-12-17 3:57 ` Liu ping fan
2011-12-19 1:16 ` Takuya Yoshikawa
2011-12-15 9:10 ` Gleb Natapov
2011-12-16 7:50 ` Liu ping fan
2011-12-16 7:50 ` Liu ping fan
2011-12-15 8:33 ` [PATCH v3] " Gleb Natapov
2011-12-15 9:06 ` Liu ping fan
2011-12-15 9:08 ` Gleb Natapov
2011-12-17 3:19 ` [PATCH v5] " Liu Ping Fan
2011-12-26 11:09 ` Gleb Natapov
2011-12-26 11:17 ` Avi Kivity
2011-12-26 11:21 ` Gleb Natapov
2011-12-27 7:53 ` Liu ping fan
2011-12-27 8:38 ` [PATCH v6] " Liu Ping Fan
2011-12-27 11:22 ` Takuya Yoshikawa
2011-12-28 6:54 ` Liu ping fan
2011-12-28 9:53 ` Avi Kivity
2011-12-29 14:03 ` Liu ping fan
2011-12-29 14:31 ` Avi Kivity
2012-01-05 9:35 ` Liu ping fan
2011-12-28 10:29 ` Takuya Yoshikawa
2011-12-28 9:53 ` Avi Kivity
2011-12-28 9:54 ` Avi Kivity
2011-12-28 10:19 ` Takuya Yoshikawa
2011-12-28 10:28 ` Avi Kivity
2012-01-07 2:55 ` [PATCH v7] " Liu Ping Fan
2012-01-12 12:37 ` Avi Kivity
2012-01-15 13:17 ` Liu ping fan
2012-01-15 13:37 ` Avi Kivity
2011-11-25 17:54 ` [PATCH 0] A series patches for kvm&qemu to enable vcpu destruction in kvm Jan Kiszka
2011-11-25 17:54 ` [Qemu-devel] " Jan Kiszka
2011-11-25 17:54 ` Jan Kiszka
2011-11-27 3:07 ` Liu ping fan
2011-11-27 3:07 ` [Qemu-devel] " Liu ping fan
2011-11-27 3:07 ` Liu ping fan
2011-11-27 2:42 ` [PATCH 2/2] kvm: exit to userspace with reason KVM_EXIT_VCPU_DEAD Liu Ping Fan
2011-11-27 2:42 ` [Qemu-devel] " Liu Ping Fan
2011-11-27 2:42 ` Liu Ping Fan
2011-11-27 10:36 ` Avi Kivity
2011-11-27 10:36 ` [Qemu-devel] " Avi Kivity
2011-11-27 10:36 ` Avi Kivity
2011-11-27 10:50 ` Gleb Natapov
2011-11-27 10:50 ` [Qemu-devel] " Gleb Natapov
2011-11-27 10:50 ` Gleb Natapov
2011-11-28 7:16 ` Liu ping fan
2011-11-28 8:46 ` Gleb Natapov
2011-11-28 8:46 ` Gleb Natapov
2011-11-27 2:45 ` [PATCH 1/5] QEMU Add cpu_phyid_to_cpu() to map cpu phyid to CPUState Liu Ping Fan
2011-11-27 2:45 ` [Qemu-devel] " Liu Ping Fan
2011-11-27 2:45 ` Liu Ping Fan
2011-11-27 2:45 ` Liu Ping Fan [this message]
2011-11-27 2:45 ` [Qemu-devel] [PATCH 2/5] QEMU Add cpu_free() to support arch related CPUState release Liu Ping Fan
2011-11-27 2:45 ` Liu Ping Fan
2011-11-27 2:45 ` [PATCH 3/5] QEMU Introduce a pci device "cpustate" to get CPU_DEAD event in guest Liu Ping Fan
2011-11-27 2:45 ` [Qemu-devel] " Liu Ping Fan
2011-11-27 2:45 ` Liu Ping Fan
2011-11-27 10:56 ` Gleb Natapov
2011-11-27 10:56 ` [Qemu-devel] " Gleb Natapov
2011-11-27 10:56 ` Gleb Natapov
2011-11-27 2:45 ` [PATCH 4/5] QEMU Release vcpu and finally exit vcpu thread safely Liu Ping Fan
2011-11-27 2:45 ` [Qemu-devel] " Liu Ping Fan
2011-11-29 5:37 ` ShaoHe Feng
2011-11-27 2:45 ` [PATCH 5/5] QEMU tmp patches for linux-header files Liu Ping Fan
2011-11-27 2:45 ` [Qemu-devel] " Liu Ping Fan
2011-11-27 2:45 ` Liu Ping Fan
2011-11-27 2:47 ` [PATCH] virtio: add a pci driver to notify host the CPU_DEAD event Liu Ping Fan
2011-11-27 2:47 ` [Qemu-devel] " Liu Ping Fan
2011-11-27 2:47 ` Liu Ping Fan
2011-11-27 11:10 ` Gleb Natapov
2011-11-27 11:10 ` [Qemu-devel] " Gleb Natapov
2011-11-27 11:10 ` Gleb Natapov
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=1322361937-22438-2-git-send-email-kernelfans@gmail.com \
--to=kernelfans@gmail.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=ryanh@us.ibm.com \
/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.