* [Qemu-devel] [v2][PATCH 1/1] cpus: use cpu_is_stopped efficiently
@ 2013-08-02 1:43 Tiejun Chen
2013-08-02 13:33 ` Andreas Färber
0 siblings, 1 reply; 3+ messages in thread
From: Tiejun Chen @ 2013-08-02 1:43 UTC (permalink / raw)
To: qemu-devel; +Cc: mtosatti, afaerber
It makes more sense and simple later.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
v1 -> v2:
To optimize performance slightly, we can reorder the two conditions to
avoid the non-inline function call if cpu->stopped.
cpus.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/cpus.c b/cpus.c
index c232265..7e76506 100644
--- a/cpus.c
+++ b/cpus.c
@@ -62,6 +62,11 @@
static CPUArchState *next_cpu;
+bool cpu_is_stopped(CPUState *cpu)
+{
+ return cpu->stopped || !runstate_is_running();
+}
+
static bool cpu_thread_is_idle(CPUArchState *env)
{
CPUState *cpu = ENV_GET_CPU(env);
@@ -69,7 +74,7 @@ static bool cpu_thread_is_idle(CPUArchState *env)
if (cpu->stop || cpu->queued_work_first) {
return false;
}
- if (cpu->stopped || !runstate_is_running()) {
+ if (cpu_is_stopped(cpu)) {
return true;
}
if (!cpu->halted || qemu_cpu_has_work(cpu) ||
@@ -432,11 +437,6 @@ void cpu_synchronize_all_post_init(void)
}
}
-bool cpu_is_stopped(CPUState *cpu)
-{
- return !runstate_is_running() || cpu->stopped;
-}
-
static void do_vm_stop(RunState state)
{
if (runstate_is_running()) {
@@ -455,7 +455,7 @@ static bool cpu_can_run(CPUState *cpu)
if (cpu->stop) {
return false;
}
- if (cpu->stopped || !runstate_is_running()) {
+ if (cpu_is_stopped(cpu)) {
return false;
}
return true;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [v2][PATCH 1/1] cpus: use cpu_is_stopped efficiently
2013-08-02 1:43 [Qemu-devel] [v2][PATCH 1/1] cpus: use cpu_is_stopped efficiently Tiejun Chen
@ 2013-08-02 13:33 ` Andreas Färber
2013-08-05 1:47 ` "“tiejun.chen”"
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Färber @ 2013-08-02 13:33 UTC (permalink / raw)
To: Tiejun Chen; +Cc: mtosatti, qemu-devel
Am 02.08.2013 03:43, schrieb Tiejun Chen:
> It makes more sense and simple later.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> ---
> v1 -> v2:
>
> To optimize performance slightly, we can reorder the two conditions to
> avoid the non-inline function call if cpu->stopped.
Patch doesn't apply to qemu.git: next_cpu and cpu_thread_is_idle() use
CPUState since a few weeks and do_vm_stop() changed from void to int.
Please remember to rebase before sending patches.
Thanks, applied to qom-cpu-next (with modified commit message):
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-next
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [v2][PATCH 1/1] cpus: use cpu_is_stopped efficiently
2013-08-02 13:33 ` Andreas Färber
@ 2013-08-05 1:47 ` "“tiejun.chen”"
0 siblings, 0 replies; 3+ messages in thread
From: "“tiejun.chen”" @ 2013-08-05 1:47 UTC (permalink / raw)
To: Andreas Färber; +Cc: mtosatti, qemu-devel
On 08/02/2013 09:33 PM, � wrote:
> Am 02.08.2013 03:43, schrieb Tiejun Chen:
>> It makes more sense and simple later.
>>
>> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
>> ---
>> v1 -> v2:
>>
>> To optimize performance slightly, we can reorder the two conditions to
>> avoid the non-inline function call if cpu->stopped.
>
> Patch doesn't apply to qemu.git: next_cpu and cpu_thread_is_idle() use
> CPUState since a few weeks and do_vm_stop() changed from void to int.
> Please remember to rebase before sending patches.
Okay, sorry for this inconvenience.
Tiejun
>
> Thanks, applied to qom-cpu-next (with modified commit message):
> https://github.com/afaerber/qemu-cpu/commits/qom-cpu-next
>
> Andreas
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-05 1:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-02 1:43 [Qemu-devel] [v2][PATCH 1/1] cpus: use cpu_is_stopped efficiently Tiejun Chen
2013-08-02 13:33 ` Andreas Färber
2013-08-05 1:47 ` "“tiejun.chen”"
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).