static inline int qht_trylock(struct qht *ht) { if (ht->mode & QHT_MODE_RAW_MUTEXES) { return qemu_mutex_trylock__raw(&(ht)->lock); } return qemu_mutex_trylock(&(ht)->lock); }
static void qemu_signal_lock(unsigned int msecs) { qemu_mutex_lock(&qemu_fair_mutex); while (qemu_mutex_trylock(&qemu_global_mutex)) { qemu_thread_signal(tcg_cpu_thread, SIGUSR1); if (!qemu_mutex_timedlock(&qemu_global_mutex, msecs)) break; } qemu_mutex_unlock(&qemu_fair_mutex); }
void qemu_mutex_lock_iothread(struct uc_struct* uc) { if (!uc->tcg_enabled(uc)) { // arch-dependent qemu_mutex_lock(&uc->qemu_global_mutex); } else { if (qemu_mutex_trylock(&uc->qemu_global_mutex)) { qemu_cpu_kick_thread(first_cpu); qemu_mutex_lock(&uc->qemu_global_mutex); } } }
void qemu_mutex_lock_iothread(void) { if (kvm_enabled()) { qemu_mutex_lock(&qemu_global_mutex); } else { qemu_mutex_lock(&qemu_fair_mutex); if (qemu_mutex_trylock(&qemu_global_mutex)) { qemu_cpu_kick_thread(first_cpu); qemu_mutex_lock(&qemu_global_mutex); } qemu_mutex_unlock(&qemu_fair_mutex); } }
void qemu_mutex_lock_iothread(void) { if (kvm_enabled()) { qemu_mutex_lock(&qemu_global_mutex); } else { qemu_mutex_lock(&qemu_fair_mutex); if (qemu_mutex_trylock(&qemu_global_mutex)) { qemu_thread_signal(tcg_cpu_thread, SIG_IPI); qemu_mutex_lock(&qemu_global_mutex); } qemu_mutex_unlock(&qemu_fair_mutex); } }
void qemu_mutex_lock_iothread(void) { if (!tcg_enabled()) { qemu_mutex_lock(&qemu_global_mutex); } else { iothread_requesting_mutex = true; if (qemu_mutex_trylock(&qemu_global_mutex)) { qemu_cpu_kick_thread(ENV_GET_CPU(first_cpu)); qemu_mutex_lock(&qemu_global_mutex); } iothread_requesting_mutex = false; qemu_cond_broadcast(&qemu_io_proceeded_cond); } }
void qemu_mutex_lock_iothread(void) { LOGD_CPUS("%s1\n", __func__); if (!tcg_enabled()) { LOGD_CPUS("%s2\n", __func__); qemu_mutex_lock(&qemu_global_mutex); LOGD_CPUS("%s3\n", __func__); } else { LOGD_CPUS("%s4\n", __func__); iothread_requesting_mutex = true; if (qemu_mutex_trylock(&qemu_global_mutex)) { LOGD_CPUS("%s5\n", __func__); qemu_cpu_kick_thread(first_cpu); LOGD_CPUS("%s6\n", __func__); qemu_mutex_lock(&qemu_global_mutex); LOGD_CPUS("%s7\n", __func__); } LOGD_CPUS("%s8\n", __func__); iothread_requesting_mutex = false; LOGD_CPUS("%s9\n", __func__); qemu_cond_broadcast(&qemu_io_proceeded_cond); LOGD_CPUS("%s10\n", __func__); } }