[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qom-cpu 35/59] linux-user: Simplify start_exclusive(
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH qom-cpu 35/59] linux-user: Simplify start_exclusive() |
Date: |
Sun, 9 Jun 2013 21:13:02 +0200 |
Use new qemu_for_each_cpu().
Signed-off-by: Andreas Färber <address@hidden>
---
linux-user/main.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 95e17cf..5ced658 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -144,25 +144,24 @@ static inline void exclusive_idle(void)
}
}
+static void start_exclusive_stop_one(CPUState *cpu, void *data)
+{
+ if (cpu->running) {
+ pending_cpus++;
+ cpu_exit(cpu);
+ }
+}
+
/* Start an exclusive operation.
Must only be called from outside cpu_arm_exec. */
static inline void start_exclusive(void)
{
- CPUArchState *other;
- CPUState *other_cpu;
-
pthread_mutex_lock(&exclusive_lock);
exclusive_idle();
pending_cpus = 1;
/* Make all other cpus stop executing. */
- for (other = first_cpu; other; other = other->next_cpu) {
- other_cpu = ENV_GET_CPU(other);
- if (other_cpu->running) {
- pending_cpus++;
- cpu_exit(other_cpu);
- }
- }
+ qemu_for_each_cpu(start_exclusive_stop_one, NULL);
if (pending_cpus > 1) {
pthread_cond_wait(&exclusive_cond, &exclusive_lock);
}
--
1.8.1.4
- [Qemu-devel] [PATCH qom-cpu 31/59] monitor: Simplify do_info_numa(), (continued)
- [Qemu-devel] [PATCH qom-cpu 31/59] monitor: Simplify do_info_numa(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 28/59] cpu: Replace cpu_single_env with CPUState cpu_single_cpu, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 32/59] kvm: Simplify kvm_{insert, remove, remove_all}_breakpoint[s](), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 33/59] kvm: Simplify kvm_remove_all_breakpoints() further, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 34/59] kvm: Change kvm_remove_all_breakpoints() argument to CPUState, Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 35/59] linux-user: Simplify start_exclusive(),
Andreas Färber <=
- [Qemu-devel] [PATCH qom-cpu 36/59] linux-user/elfload: Abstract fill_note_info() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 38/59] translate-all: Abstract tb_flush() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 37/59] target-i386: Abstract cpu_x86_inject_mce() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 39/59] translate-all: Abstract tb_phys_invalidate() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 40/59] target-ppc: Abstract helper_msgsnd() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 42/59] target-mips: Abstract helper_evpe() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 41/59] target-mips: Abstract helper_dvpe() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 43/59] kvmclock: Abstract kvmclock_vm_state_change() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 45/59] pc: Abstract pic_irq_request() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09
- [Qemu-devel] [PATCH qom-cpu 44/59] kvmvapic: Abstract vapic_enable_tpr_reporting() with qemu_for_each_cpu(), Andreas Färber, 2013/06/09