Skip to contentSkip to conversation

qemu-kvm.git uq/master queue

GIT PULL In review Marcelo Tosatti 5 participants 13 messages Feb 22, 2010 – Mar 6, 2011 KVM

lore
Share & tools
lore
#0 lore raw

The following changes since commit bf76bafa5ade434ef2747ceeeeaa95510ecb7946:
Edgar E. Iglesias (1):
crisv10: Prettify.

are available in the git repository at:

git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git uq/master

Jan Kiszka (1):
kvm: Fix eflags corruption in kvm mode

Jes Sorensen (1):
kvm: Kill CR3_CACHE feature references

Marcelo Tosatti (5):
block SIGCHLD in vcpu thread(s)
kvm specific wait_io_event
kvm: consume internal signal with sigtimedwait
kvm: remove pre-entry exit_request check with iothread enabled kvm-all.c: define smp_wmb and use it for coalesced mmio

Paolo Bonzini (1):
use eventfd for iothread

 cpu-exec.c        |   12 +++--
 kvm-all.c         |   24 ++++++++++-
 kvm.h             |    1 +
 osdep.c           |   32 ++++++++++++++
 qemu-barrier.h    |    7 +++
 qemu-common.h     |    1 +
 target-i386/kvm.c |    3 -
 vl.c              |  123 ++++++++++++++++++++++++++++++++++++++++++++---------
 8 files changed, 173 insertions(+), 30 deletions(-)
 create mode 100644 qemu-barrier.h
#1 lore raw

PATCH 1/8 use eventfd for iothread

From: Paolo Bonzini <[email protected]>

---
 osdep.c       |   32 ++++++++++++++++++++++++++++++++
 qemu-common.h |    1 +
 vl.c          |    9 +++++----
 3 files changed, 38 insertions(+), 4 deletions(-)
osdep.c +32 -0
index 9059f01..9e4b17b 100644
@@ -37,6 +37,10 @@
 #include <sys/statvfs.h>
 #endif
 
+#ifdef CONFIG_EVENTFD
+#include <sys/eventfd.h>
+#endif
+
 #ifdef _WIN32
 #include <windows.h>
 #elif defined(CONFIG_BSD)
@@ -281,6 +285,34 @@ ssize_t qemu_write_full(int fd, const void *buf, size_t count)
 
 #ifndef _WIN32
 /*
+ * Creates an eventfd that looks like a pipe and has EFD_CLOEXEC set.
+ */
+int qemu_eventfd(int fds[2])
+{
+    int ret;
+
+#ifdef CONFIG_EVENTFD
+    ret = eventfd(0, 0);
+    if (ret >= 0) {
+        fds[0] = ret;
+        qemu_set_cloexec(ret);
+        if ((fds[1] = dup(ret)) == -1) {
+            close(ret);
+            return -1;
+        }
+        qemu_set_cloexec(fds[1]);
+        return 0;
+    }
+
+    if (errno != ENOSYS) {
+        return -1;
+    }
+#endif
+
+    return qemu_pipe(fds);
+}
+
+/*
  * Creates a pipe with FD_CLOEXEC set on both file descriptors
  */
 int qemu_pipe(int pipefd[2])
qemu-common.h +1 -0
index b09f717..c941006 100644
@@ -170,6 +170,7 @@ ssize_t qemu_write_full(int fd, const void *buf, size_t count)
 void qemu_set_cloexec(int fd);
 
 #ifndef _WIN32
+int qemu_eventfd(int pipefd[2]);
 int qemu_pipe(int pipefd[2]);
 #endif
 
vl.c +5 -4
index 98918ac..1957018 100644
@@ -3211,14 +3211,15 @@ static int io_thread_fd = -1;
 
 static void qemu_event_increment(void)
 {
-    static const char byte = 0;
+    /* Write 8 bytes to be compatible with eventfd.  */
+    static uint64_t val = 1;
     ssize_t ret;
 
     if (io_thread_fd == -1)
         return;
 
     do {
-        ret = write(io_thread_fd, &byte, sizeof(byte));
+        ret = write(io_thread_fd, &val, sizeof(val));
     } while (ret < 0 && errno == EINTR);
 
     /* EAGAIN is fine, a read must be pending.  */
@@ -3235,7 +3236,7 @@ static void qemu_event_read(void *opaque)
     ssize_t len;
     char buffer[512];
 
-    /* Drain the notify pipe */
+    /* Drain the notify pipe.  For eventfd, only 8 bytes will be read.  */
     do {
         len = read(fd, buffer, sizeof(buffer));
     } while ((len == -1 && errno == EINTR) || len == sizeof(buffer));
@@ -3246,7 +3247,7 @@ static int qemu_event_init(void)
     int err;
     int fds[2];
 
-    err = qemu_pipe(fds);
+    err = qemu_eventfd(fds);
     if (err == -1)
         return -errno;
 
Signature · 1 line
1.6.6
#2 lore raw

Re: [PATCH 1/8] use eventfd for iothread

When this was merged in qemu-kvm/master (commit 6249f61a891b6b003531ca4e459c3a553faa82bc) it removed Avi's compile fix when !CONFIG_EVENTFD (db311e8619d310bd7729637b702581d3d8565049). So current master fails to build:
CC osdep.o
cc1: warnings being treated as errors
osdep.c: In function 'qemu_eventfd':
osdep.c:296: error: unused variable 'ret'
make: *** [osdep.o] Error 1

Quoted 119 lines · Marcelo Tosatti

From: Paolo Bonzini <[email protected]>

---

osdep.c       |   32 ++++++++++++++++++++++++++++++++
qemu-common.h |    1 +
vl.c          |    9 +++++----
3 files changed, 38 insertions(+), 4 deletions(-)
osdep.c +32 -0
index 9059f01..9e4b17b 100644
@@ -37,6 +37,10 @@
 #include <sys/statvfs.h>
 #endif
 
+#ifdef CONFIG_EVENTFD
+#include <sys/eventfd.h>
+#endif
+
 #ifdef _WIN32
 #include <windows.h>
 #elif defined(CONFIG_BSD)
@@ -281,6 +285,34 @@ ssize_t qemu_write_full(int fd, const void *buf, size_t count)
 
 #ifndef _WIN32
 /*
+ * Creates an eventfd that looks like a pipe and has EFD_CLOEXEC set.
+ */
+int qemu_eventfd(int fds[2])
+{
+    int ret;
+
+#ifdef CONFIG_EVENTFD
+    ret = eventfd(0, 0);
+    if (ret >= 0) {
+        fds[0] = ret;
+        qemu_set_cloexec(ret);
+        if ((fds[1] = dup(ret)) == -1) {
+            close(ret);
+            return -1;
+        }
+        qemu_set_cloexec(fds[1]);
+        return 0;
+    }
+
+    if (errno != ENOSYS) {
+        return -1;
+    }
+#endif
+
+    return qemu_pipe(fds);
+}
+
+/*
 * Creates a pipe with FD_CLOEXEC set on both file descriptors
 */
 int qemu_pipe(int pipefd[2])
qemu-common.h +1 -0
index b09f717..c941006 100644
@@ -170,6 +170,7 @@ ssize_t qemu_write_full(int fd, const void *buf, size_t count)
 void qemu_set_cloexec(int fd);
 
 #ifndef _WIN32
+int qemu_eventfd(int pipefd[2]);
 int qemu_pipe(int pipefd[2]);
 #endif
 
vl.c +5 -4
index 98918ac..1957018 100644
@@ -3211,14 +3211,15 @@ static int io_thread_fd = -1;
 
 static void qemu_event_increment(void)
 {
-    static const char byte = 0;
+    /* Write 8 bytes to be compatible with eventfd.  */
+    static uint64_t val = 1;
    ssize_t ret;
 
    if (io_thread_fd == -1)
        return;
 
    do {
-        ret = write(io_thread_fd, &byte, sizeof(byte));
+        ret = write(io_thread_fd, &val, sizeof(val));
    } while (ret < 0 && errno == EINTR);
 
    /* EAGAIN is fine, a read must be pending.  */
@@ -3235,7 +3236,7 @@ static void qemu_event_read(void *opaque)
    ssize_t len;
    char buffer[512];
 
-    /* Drain the notify pipe */
+    /* Drain the notify pipe.  For eventfd, only 8 bytes will be read.  */
    do {
        len = read(fd, buffer, sizeof(buffer));
    } while ((len == -1 && errno == EINTR) || len == sizeof(buffer));
@@ -3246,7 +3247,7 @@ static int qemu_event_init(void)
    int err;
    int fds[2];
 
-    err = qemu_pipe(fds);
+    err = qemu_eventfd(fds);
    if (err == -1)
        return -errno;
 
Signature · 6 lines
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Pierre Riteau -- PhD student, Myriads team, IRISA, Rennes, France
http://perso.univ-rennes1.fr/pierre.riteau/
#3 lore raw

PATCH 2/8 kvm: Fix eflags corruption in kvm mode

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

This should explain a lot of the weird breakages of upstream KVM we've seen recently (actually we should have seen it much earlier):

Stop translating eflags into TCG format when in kvm mode as we never translate it back and rather sync this broken state into the kernel.

---
 cpu-exec.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
cpu-exec.c +7 -5
index 6a290fd..4029ea2 100644
@@ -228,11 +228,13 @@ int cpu_exec(CPUState *env1)
     env = env1;
 
 #if defined(TARGET_I386)
-    /* put eflags in CPU temporary format */
-    CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
-    DF = 1 - (2 * ((env->eflags >> 10) & 1));
-    CC_OP = CC_OP_EFLAGS;
-    env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
+    if (!kvm_enabled()) {
+        /* put eflags in CPU temporary format */
+        CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
+        DF = 1 - (2 * ((env->eflags >> 10) & 1));
+        CC_OP = CC_OP_EFLAGS;
+        env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
+    }
 #elif defined(TARGET_SPARC)
 #elif defined(TARGET_M68K)
     env->cc_op = CC_OP_FLAGS;
Signature · 1 line
1.6.6
#4 lore raw

PATCH 3/8 kvm: Kill CR3_CACHE feature references

In reply to Marcelo Tosatti

From: Jes Sorensen <[email protected]>

Remove all references to KVM_CR3_CACHE as it was never implemented.

---
 target-i386/kvm.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
target-i386/kvm.c +0 -3
index 0d08cd5..5d9aecc 100644
@@ -158,9 +158,6 @@ struct kvm_para_features {
 #ifdef KVM_CAP_PV_MMU
         { KVM_CAP_PV_MMU, KVM_FEATURE_MMU_OP },
 #endif
-#ifdef KVM_CAP_CR3_CACHE
-        { KVM_CAP_CR3_CACHE, KVM_FEATURE_CR3_CACHE },
-#endif
         { -1, -1 }
 };
 
Signature · 1 line
1.6.6
#5 lore raw

PATCH 4/8 block SIGCHLD in vcpu thread(s)

In reply to Marcelo Tosatti

Otherwise a vcpu thread can run the sigchild handler causing waitpid() from iothread to fail.

---
 vl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
vl.c +1 -0
index 1957018..3bc618d 100644
@@ -3515,6 +3515,7 @@ static void block_io_signals(void)
     sigaddset(&set, SIGUSR2);
     sigaddset(&set, SIGIO);
     sigaddset(&set, SIGALRM);
+    sigaddset(&set, SIGCHLD);
     pthread_sigmask(SIG_BLOCK, &set, NULL);
 
     sigemptyset(&set);
Signature · 1 line
1.6.6
#6 lore raw

PATCH 5/8 kvm specific wait_io_event

In reply to Marcelo Tosatti

In KVM mode the global mutex is released when vcpus are executing, which means acquiring the fairness mutex is not required.

Also for KVM there is one thread per vcpu, so tcg_has_work is meaningless.

Add a new qemu_wait_io_event_common function to hold common code between TCG/KVM.

---
 vl.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)
vl.c +20 -6
index 3bc618d..af198c1 100644
@@ -3383,6 +3383,7 @@ static QemuCond qemu_pause_cond;
 static void block_io_signals(void);
 static void unblock_io_signals(void);
 static int tcg_has_work(void);
+static int cpu_has_work(CPUState *env);
 
 static int qemu_init_main_loop(void)
 {
@@ -3403,6 +3404,15 @@ static int qemu_init_main_loop(void)
     return 0;
 }
 
+static void qemu_wait_io_event_common(CPUState *env)
+{
+    if (env->stop) {
+        env->stop = 0;
+        env->stopped = 1;
+        qemu_cond_signal(&qemu_pause_cond);
+    }
+}
+
 static void qemu_wait_io_event(CPUState *env)
 {
     while (!tcg_has_work())
@@ -3419,11 +3429,15 @@ static void qemu_wait_io_event(CPUState *env)
     qemu_mutex_unlock(&qemu_fair_mutex);
 
     qemu_mutex_lock(&qemu_global_mutex);
-    if (env->stop) {
-        env->stop = 0;
-        env->stopped = 1;
-        qemu_cond_signal(&qemu_pause_cond);
-    }
+    qemu_wait_io_event_common(env);
+}
+
+static void qemu_kvm_wait_io_event(CPUState *env)
+{
+    while (!cpu_has_work(env))
+        qemu_cond_timedwait(env->halt_cond, &qemu_global_mutex, 1000);
+
+    qemu_wait_io_event_common(env);
 }
 
 static int qemu_cpu_exec(CPUState *env);
@@ -3449,7 +3463,7 @@ static void *kvm_cpu_thread_fn(void *arg)
     while (1) {
         if (cpu_can_run(env))
             qemu_cpu_exec(env);
-        qemu_wait_io_event(env);
+        qemu_kvm_wait_io_event(env);
     }
 
     return NULL;
Signature · 1 line
1.6.6
#7 lore raw

PATCH 6/8 kvm: consume internal signal with sigtimedwait

In reply to Marcelo Tosatti

Change the way the internal qemu signal, used for communication between iothread and vcpus, is handled.

Block and consume it with sigtimedwait on the outer vcpu loop, which allows more precise timing control.

Change from standard signal (SIGUSR1) to real-time one, so multiple signals are not collapsed.

Set the signal number on KVM's in-kernel allowed sigmask.

---
 kvm-all.c |   19 +++++++++++++
 kvm.h     |    1 +
 vl.c      |   89 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------
 3 files changed, 97 insertions(+), 12 deletions(-)
kvm-all.c +19 -0
index 79345b2..38c372f 100644
@@ -771,6 +771,7 @@ int kvm_cpu_exec(CPUState *env)
         kvm_arch_post_run(env, run);
 
         if (ret == -EINTR || ret == -EAGAIN) {
+            cpu_exit(env);
             dprintf("io window exit\n");
             ret = 0;
             break;
@@ -1116,3 +1117,21 @@ void kvm_remove_all_breakpoints(CPUState *current_env)
 {
 }
 #endif /* !KVM_CAP_SET_GUEST_DEBUG */
+
+int kvm_set_signal_mask(CPUState *env, const sigset_t *sigset)
+{
+    struct kvm_signal_mask *sigmask;
+    int r;
+
+    if (!sigset)
+        return kvm_vcpu_ioctl(env, KVM_SET_SIGNAL_MASK, NULL);
+
+    sigmask = qemu_malloc(sizeof(*sigmask) + sizeof(*sigset));
+
+    sigmask->len = 8;
+    memcpy(sigmask->sigset, sigset, sizeof(*sigset));
+    r = kvm_vcpu_ioctl(env, KVM_SET_SIGNAL_MASK, sigmask);
+    free(sigmask);
+
+    return r;
+}
kvm.h +1 -0
index e24bbde..9a9cdd5 100644
@@ -53,6 +53,7 @@ int kvm_remove_breakpoint(CPUState *current_env, target_ulong addr,
                           target_ulong len, int type);
 void kvm_remove_all_breakpoints(CPUState *current_env);
 int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap);
+int kvm_set_signal_mask(CPUState *env, const sigset_t *sigset);
 
 int kvm_pit_in_kernel(void);
 int kvm_irqchip_in_kernel(void);
vl.c +77 -12

180 lines not on this page · raw message

Signature · 1 line
1.6.6
#8 lore raw

Re: [Qemu-devel] [PATCH 6/8] kvm: consume internal signal with sigtimedwait

Hello,

Am 22.02.2010 um 22:26 schrieb Marcelo Tosatti:

Quoted 6 lines

Change the way the internal qemu signal, used for communication between
iothread and vcpus, is handled.

Block and consume it with sigtimedwait on the outer vcpu loop, which allows more precise timing control.

Mac OS X v10.5 does not seem to support sigtimedwait():

CC arm-softmmu/cpus.o
/Users/andreas/QEMU/qemu/cpus.c: In function ‘qemu_kvm_eat_signals’:
/Users/andreas/QEMU/qemu/cpus.c:379: warning: implicit declaration of function ‘sigtimedwait’ /Users/andreas/QEMU/qemu/cpus.c:379: warning: nested extern declaration of ‘sigtimedwait’ /Users/andreas/QEMU/qemu/cpus.c:388: warning: implicit declaration of function ‘sigbus_reraise’ /Users/andreas/QEMU/qemu/cpus.c:388: warning: nested extern declaration of ‘sigbus_reraise’

Could you please add some #ifdef? It used to be an optional POSIX extension.

Thanks,
Andreas

Quoted 46 lines

Change from standard signal (SIGUSR1) to real-time one, so multiple signals are not collapsed.

Set the signal number on KVM's in-kernel allowed sigmask.

---

kvm-all.c |   19 +++++++++++++
kvm.h     |    1 +
vl.c      |   89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 
+--------
3 files changed, 97 insertions(+), 12 deletions(-)
vl.c +23 -0
index af198c1..dc05da3 100644
@@ -3432,11 +3439,36 @@ static void qemu_wait_io_event(CPUState *env)
    qemu_wait_io_event_common(env);
 }
 
+static void qemu_kvm_eat_signal(CPUState *env, int timeout)
+{
+    struct timespec ts;
+    int r, e;
+    siginfo_t siginfo;
+    sigset_t waitset;
+
+    ts.tv_sec = timeout / 1000;
+    ts.tv_nsec = (timeout % 1000) * 1000000;
+
+    sigemptyset(&waitset);
+    sigaddset(&waitset, SIG_IPI);
+
+    qemu_mutex_unlock(&qemu_global_mutex);
+    r = sigtimedwait(&waitset, &siginfo, &ts);
+    e = errno;
+    qemu_mutex_lock(&qemu_global_mutex);
+
+    if (r == -1 && !(e == EAGAIN || e == EINTR)) {
+        fprintf(stderr, "sigtimedwait: %s\n", strerror(e));
+        exit(1);
+    }
+}
#9 lore raw

PATCH 1/1 Implement qemu_kvm_eat_signals only for CONFIG_LINUX

Quoted 23 lines · Andreas Färber

Hello,

Am 22.02.2010 um 22:26 schrieb Marcelo Tosatti:

Quoted 5 lines

Change the way the internal qemu signal, used for communication between iothread and vcpus, is handled.

Block and consume it with sigtimedwait on the outer vcpu loop, which allows more precise timing control.

Mac OS X v10.5 does not seem to support sigtimedwait():

CC arm-softmmu/cpus.o
/Users/andreas/QEMU/qemu/cpus.c: In function ‘qemu_kvm_eat_signals’:
/Users/andreas/QEMU/qemu/cpus.c:379: warning: implicit declaration of function ‘sigtimedwait’
/Users/andreas/QEMU/qemu/cpus.c:379: warning: nested extern declaration of ‘sigtimedwait’
/Users/andreas/QEMU/qemu/cpus.c:388: warning: implicit declaration of function ‘sigbus_reraise’ /Users/andreas/QEMU/qemu/cpus.c:388: warning: nested extern declaration of ‘sigbus_reraise’

Quoted 2 lines

Could you please add some #ifdef? It used to be an optional POSIX extension.

This should fix it.

Jan

------8<-------

From: Jan Kiszka <[email protected]>

qemu_kvm_eat_signals requires POSIX support with realtime extensions for sigtimedwait. Not all our target platforms provide this.

---
 cpus.c |   94 ++++++++++++++++++++++++++++++++--------------------------------
 1 files changed, 47 insertions(+), 47 deletions(-)
cpus.c +47 -47
index 94af696..a10559d 100644
@@ -235,11 +235,58 @@ static void qemu_init_sigbus(void)
     prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0);
 }
 
+static void qemu_kvm_eat_signals(CPUState *env)
+{
+    struct timespec ts = { 0, 0 };
+    siginfo_t siginfo;
+    sigset_t waitset;
+    sigset_t chkset;
+    int r;
+
+    sigemptyset(&waitset);
+    sigaddset(&waitset, SIG_IPI);
+    sigaddset(&waitset, SIGBUS);
+
+    do {
+        r = sigtimedwait(&waitset, &siginfo, &ts);
+        if (r == -1 && !(errno == EAGAIN || errno == EINTR)) {
+            perror("sigtimedwait");
+            exit(1);
+        }
+
+        switch (r) {
+        case SIGBUS:
+            if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) {
+                sigbus_reraise();
+            }
+            break;
+        default:
+            break;
+        }
+
+        r = sigpending(&chkset);
+        if (r == -1) {
+            perror("sigpending");
+            exit(1);
+        }
+    } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS));
+
+#ifndef CONFIG_IOTHREAD
+    if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) {
+        qemu_notify_event();
+    }
+#endif
+}
+
 #else /* !CONFIG_LINUX */
 
 static void qemu_init_sigbus(void)
 {
 }
+
+static void qemu_kvm_eat_signals(CPUState *env)
+{
+}
 #endif /* !CONFIG_LINUX */
 
 #ifndef _WIN32
@@ -364,49 +411,6 @@ static int qemu_signalfd_init(sigset_t mask)
     return 0;
 }
 
-static void qemu_kvm_eat_signals(CPUState *env)
-{
-    struct timespec ts = { 0, 0 };
-    siginfo_t siginfo;
-    sigset_t waitset;
-    sigset_t chkset;
-    int r;
-
-    sigemptyset(&waitset);
-    sigaddset(&waitset, SIG_IPI);
-    sigaddset(&waitset, SIGBUS);
-
-    do {
-        r = sigtimedwait(&waitset, &siginfo, &ts);
-        if (r == -1 && !(errno == EAGAIN || errno == EINTR)) {
-            perror("sigtimedwait");
-            exit(1);
-        }
-
-        switch (r) {
-        case SIGBUS:
-            if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) {
-                sigbus_reraise();
-            }
-            break;
-        default:
-            break;
-        }
-
-        r = sigpending(&chkset);
-        if (r == -1) {
-            perror("sigpending");
-            exit(1);
-        }
-    } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS));
-
-#ifndef CONFIG_IOTHREAD
-    if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) {
-        qemu_notify_event();
-    }
-#endif
-}
-
 #else /* _WIN32 */
 
 HANDLE qemu_event_handle;
@@ -434,10 +438,6 @@ static void qemu_event_increment(void)
         exit (1);
     }
 }
-
-static void qemu_kvm_eat_signals(CPUState *env)
-{
-}
 #endif /* _WIN32 */
 
 #ifndef CONFIG_IOTHREAD
#10 lore raw

PATCH 7/8 kvm: remove pre-entry exit_request check with iothread enabled

In reply to Marcelo Tosatti

With SIG_IPI blocked vcpu loop exit notification happens via -EAGAIN from KVM_RUN.

---
 kvm-all.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
kvm-all.c +2 -0
index 38c372f..91d3cbd 100644
@@ -753,11 +753,13 @@ int kvm_cpu_exec(CPUState *env)
     dprintf("kvm_cpu_exec()\n");
 
     do {
+#ifndef CONFIG_IOTHREAD
         if (env->exit_request) {
             dprintf("interrupt exit requested\n");
             ret = 0;
             break;
         }
+#endif
 
         if (env->kvm_vcpu_dirty) {
             kvm_arch_put_registers(env);
Signature · 1 line
1.6.6
#11 lore raw

PATCH 8/8 kvm-all.c: define smp_wmb and use it for coalesced mmio

In reply to Marcelo Tosatti
---
 kvm-all.c      |    3 ++-
 qemu-barrier.h |    7 +++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
 create mode 100644 qemu-barrier.h
kvm-all.c +2 -1
index 91d3cbd..1a02076 100644
@@ -21,6 +21,7 @@
 #include <linux/kvm.h>
 
 #include "qemu-common.h"
+#include "qemu-barrier.h"
 #include "sysemu.h"
 #include "hw/hw.h"
 #include "gdbstub.h"
@@ -730,7 +731,7 @@ void kvm_flush_coalesced_mmio_buffer(void)
             ent = &ring->coalesced_mmio[ring->first];
 
             cpu_physical_memory_write(ent->phys_addr, ent->data, ent->len);
-            /* FIXME smp_wmb() */
+            smp_wmb();
             ring->first = (ring->first + 1) % KVM_COALESCED_MMIO_MAX;
         }
     }
qemu-barrier.h new file +7 -0
new file mode 100644
index 0000000..3bd1075
@@ -0,0 +1,7 @@
+#ifndef __QEMU_BARRIER_H
+#define __QEMU_BARRIER_H 1
+
+/* FIXME: arch dependant, x86 version */
+#define smp_wmb()   asm volatile("" ::: "memory")
+
+#endif
Signature · 1 line
1.6.6
#12 lore raw
In reply to Marcelo Tosatti
Quoted 21 lines · Marcelo Tosatti

The following changes since commit bf76bafa5ade434ef2747ceeeeaa95510ecb7946:
Edgar E. Iglesias (1):
crisv10: Prettify.

are available in the git repository at:

git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git uq/master

Jan Kiszka (1):
kvm: Fix eflags corruption in kvm mode

Jes Sorensen (1):
kvm: Kill CR3_CACHE feature references

Marcelo Tosatti (5):
block SIGCHLD in vcpu thread(s)
kvm specific wait_io_event
kvm: consume internal signal with sigtimedwait
kvm: remove pre-entry exit_request check with iothread enabled kvm-all.c: define smp_wmb and use it for coalesced mmio

Quoted 3 lines

Paolo Bonzini (1):
use eventfd for iothread

Pulled, thanks.

In the future, could you just use a [PULL] tag? That's what others are using.

Regards,

Anthony Liguori

Quoted 11 lines
  cpu-exec.c        |   12 +++--
  kvm-all.c         |   24 ++++++++++-
  kvm.h             |    1 +
  osdep.c           |   32 ++++++++++++++
  qemu-barrier.h    |    7 +++
  qemu-common.h     |    1 +
  target-i386/kvm.c |    3 -
  vl.c              |  123 ++++++++++++++++++++++++++++++++++++++++++++---------
  8 files changed, 173 insertions(+), 30 deletions(-)

create mode 100644 qemu-barrier.h