Re: [PATCH 10/22] kvm: Set up signal mask also for !CONFIG_IOTHREAD

2011-01-28 Thread Paolo Bonzini

On 01/27/2011 02:09 PM, Jan Kiszka wrote:

Block SIG_IPI, unblock it during KVM_RUN, just like in io-thread mode.
It's unused so far, but this infrastructure will be required for
self-IPIs and to process SIGBUS plus, in KVM mode, SIGIO and SIGALRM. As
Windows doesn't support signal services, we need to provide a stub for
the init function.

Signed-off-by: Jan Kiszkajan.kis...@siemens.com
---
  cpus.c |   13 +++--
  1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/cpus.c b/cpus.c
index 16bd8fa..03c89b4 100644
--- a/cpus.c
+++ b/cpus.c
@@ -231,7 +231,6 @@ fail:
  return err;
  }

-#ifdef CONFIG_IOTHREAD
  static void dummy_signal(int sig)
  {
  }
@@ -246,6 +245,12 @@ static void qemu_kvm_init_cpu_signals(CPUState *env)
  sigact.sa_handler = dummy_signal;
  sigaction(SIG_IPI,sigact, NULL);

+#ifndef CONFIG_IOTHREAD
+sigemptyset(set);
+sigaddset(set, SIG_IPI);
+pthread_sigmask(SIG_BLOCK,set, NULL);
+#endif
+
  pthread_sigmask(SIG_BLOCK, NULL,set);
  sigdelset(set, SIG_IPI);
  sigdelset(set, SIGBUS);
@@ -255,7 +260,6 @@ static void qemu_kvm_init_cpu_signals(CPUState *env)
  exit(1);
  }
  }
-#endif

  #else /* _WIN32 */

@@ -284,6 +288,10 @@ static void qemu_event_increment(void)
  exit (1);
  }
  }
+
+static void qemu_kvm_init_cpu_signals(CPUState *env)
+{
+}
  #endif /* _WIN32 */

  #ifndef CONFIG_IOTHREAD
@@ -312,6 +320,7 @@ void qemu_init_vcpu(void *_env)
  fprintf(stderr, kvm_init_vcpu failed: %s\n, strerror(-r));
  exit(1);
  }
+qemu_kvm_init_cpu_signals(env);
  }
  }



Reviewed-by: Paolo Bonzini pbonz...@redhat.com
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/22] kvm: Set up signal mask also for !CONFIG_IOTHREAD

2011-01-27 Thread Jan Kiszka
Block SIG_IPI, unblock it during KVM_RUN, just like in io-thread mode.
It's unused so far, but this infrastructure will be required for
self-IPIs and to process SIGBUS plus, in KVM mode, SIGIO and SIGALRM. As
Windows doesn't support signal services, we need to provide a stub for
the init function.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com
---
 cpus.c |   13 +++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/cpus.c b/cpus.c
index 16bd8fa..03c89b4 100644
--- a/cpus.c
+++ b/cpus.c
@@ -231,7 +231,6 @@ fail:
 return err;
 }
 
-#ifdef CONFIG_IOTHREAD
 static void dummy_signal(int sig)
 {
 }
@@ -246,6 +245,12 @@ static void qemu_kvm_init_cpu_signals(CPUState *env)
 sigact.sa_handler = dummy_signal;
 sigaction(SIG_IPI, sigact, NULL);
 
+#ifndef CONFIG_IOTHREAD
+sigemptyset(set);
+sigaddset(set, SIG_IPI);
+pthread_sigmask(SIG_BLOCK, set, NULL);
+#endif
+
 pthread_sigmask(SIG_BLOCK, NULL, set);
 sigdelset(set, SIG_IPI);
 sigdelset(set, SIGBUS);
@@ -255,7 +260,6 @@ static void qemu_kvm_init_cpu_signals(CPUState *env)
 exit(1);
 }
 }
-#endif
 
 #else /* _WIN32 */
 
@@ -284,6 +288,10 @@ static void qemu_event_increment(void)
 exit (1);
 }
 }
+
+static void qemu_kvm_init_cpu_signals(CPUState *env)
+{
+}
 #endif /* _WIN32 */
 
 #ifndef CONFIG_IOTHREAD
@@ -312,6 +320,7 @@ void qemu_init_vcpu(void *_env)
 fprintf(stderr, kvm_init_vcpu failed: %s\n, strerror(-r));
 exit(1);
 }
+qemu_kvm_init_cpu_signals(env);
 }
 }
 
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html