Skip to contentSkip to conversation

Revert "hvf: Actually set SIG_IPI mask"

PATCH New Peter Collingbourne via 4 participants 5 messages Dec 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 Revert "hvf: Actually set SIG_IPI mask"

From: Alexander Graf <[email protected]>

This reverts commit 926a35700f0c14d6b95cbf8c3c3cce55ec7ffc3e.

You can just drop patch 3 of your v2 instead of taking this commit.

---
 accel/hvf/hvf-cpus.c | 1 -
 1 file changed, 1 deletion(-)
accel/hvf/hvf-cpus.c +0 -1
index 4360f64671..e613c22ad0 100644
@@ -346,7 +346,6 @@ static int hvf_init_vcpu(CPUState *cpu)
 
     pthread_sigmask(SIG_BLOCK, NULL, &set);
     sigdelset(&set, SIG_IPI);
-    pthread_sigmask(SIG_SETMASK, &set, NULL);
 
 #ifdef __aarch64__
     r = hv_vcpu_create(&cpu->hvf->fd, (hv_vcpu_exit_t **)&cpu->hvf->exit, NULL);
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
#1 lore raw

PATCH v3 2/3 arm/hvf: Do some cleanups

- Stop setting current_cpu
- Remove the previous WFx handler
- Simplify locking
- Remove the unused ret variable in hvf_vcpu_exec

---
 include/sysemu/hvf_int.h |   2 -
 target/arm/hvf/hvf.c     | 106 ++-------------------------------------
 2 files changed, 5 insertions(+), 103 deletions(-)
include/sysemu/hvf_int.h +0 -2
index c56baa3ae8..5f15119184 100644
@@ -62,8 +62,6 @@ extern HVFState *hvf_state;
 struct hvf_vcpu_state {
     uint64_t fd;
     void *exit;
-    struct timespec ts;
-    bool sleeping;
 };
 
 void assert_hvf_ok(hv_return_t ret);
target/arm/hvf/hvf.c +5 -101

189 lines not on this page · raw message

Signature · 1 line
2.29.2.454.gaff20da3a2-goog
#2 lore raw

PATCH v3 3/3 arm/hvf: Add a WFI handler

In reply to Peter Collingbourne via

Sleep on WFI until the VTIMER is due but allow ourselves to be woken up on IPI.

---
v3:
- move the simplified locking to a separate patch
- spin on sleep <2ms

v2:
- simplify locking further
- wait indefinitely on disabled or masked timers

 accel/hvf/hvf-cpus.c     |  4 +--
 include/sysemu/hvf_int.h |  1 +
 target/arm/hvf/hvf.c     | 56 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 2 deletions(-)
accel/hvf/hvf-cpus.c +2 -2
index e613c22ad0..b2c8fb57f6 100644
@@ -344,8 +344,8 @@ static int hvf_init_vcpu(CPUState *cpu)
     sigact.sa_handler = dummy_signal;
     sigaction(SIG_IPI, &sigact, NULL);
 
-    pthread_sigmask(SIG_BLOCK, NULL, &set);
-    sigdelset(&set, SIG_IPI);
+    pthread_sigmask(SIG_BLOCK, NULL, &cpu->hvf->unblock_ipi_mask);
+    sigdelset(&cpu->hvf->unblock_ipi_mask, SIG_IPI);
 
 #ifdef __aarch64__
     r = hv_vcpu_create(&cpu->hvf->fd, (hv_vcpu_exit_t **)&cpu->hvf->exit, NULL);
include/sysemu/hvf_int.h +1 -0
index 5f15119184..13adf6ea77 100644
@@ -62,6 +62,7 @@ extern HVFState *hvf_state;
 struct hvf_vcpu_state {
     uint64_t fd;
     void *exit;
+    sigset_t unblock_ipi_mask;
 };
 
 void assert_hvf_ok(hv_return_t ret);
target/arm/hvf/hvf.c +56 -0

86 lines not on this page · raw message

Signature · 1 line
2.29.2.454.gaff20da3a2-goog
#3 lore raw

Re: [PATCH v3 3/3] arm/hvf: Add a WFI handler

Quoted 23 lines · Peter Collingbourne

Sleep on WFI until the VTIMER is due but allow ourselves to be woken up on IPI.

---
v3:
- move the simplified locking to a separate patch
- spin on sleep <2ms

v2:
- simplify locking further
- wait indefinitely on disabled or masked timers

  accel/hvf/hvf-cpus.c     |  4 +--
  include/sysemu/hvf_int.h |  1 +
  target/arm/hvf/hvf.c     | 56 ++++++++++++++++++++++++++++++++++++++++
  3 files changed, 59 insertions(+), 2 deletions(-)
accel/hvf/hvf-cpus.c +0 -0
index e613c22ad0..b2c8fb57f6 100644

accel/hvf/hvf-cpus.c static int hvf_init_vcpu(CPUState *cpu) · line 348

Quoted 7 lines
accel/hvf/hvf-cpus.c +2 -2
@@ -344,8 +344,8 @@ static int hvf_init_vcpu(CPUState *cpu)
      sigact.sa_handler = dummy_signal;
      sigaction(SIG_IPI, &sigact, NULL);
 
-    pthread_sigmask(SIG_BLOCK, NULL, &set);
-    sigdelset(&set, SIG_IPI);
+    pthread_sigmask(SIG_BLOCK, NULL, &cpu->hvf->unblock_ipi_mask);
+    sigdelset(&cpu->hvf->unblock_ipi_mask, SIG_IPI);

That turns set into an unused variable, no? I'll fix it up while applying though. The rest looks great, I'll push it as part of my next patch set.

Alex

#4 lore raw

Re: [PATCH v3 3/3] arm/hvf: Add a WFI handler

Quoted 29 lines · Alexander Graf
Quoted 26 lines · Peter Collingbourne

Sleep on WFI until the VTIMER is due but allow ourselves to be woken up on IPI.

---
v3:
- move the simplified locking to a separate patch
- spin on sleep <2ms

v2:
- simplify locking further
- wait indefinitely on disabled or masked timers

  accel/hvf/hvf-cpus.c     |  4 +--
  include/sysemu/hvf_int.h |  1 +
  target/arm/hvf/hvf.c     | 56 ++++++++++++++++++++++++++++++++++++++++
  3 files changed, 59 insertions(+), 2 deletions(-)
accel/hvf/hvf-cpus.c +0 -0
index e613c22ad0..b2c8fb57f6 100644
@@ -344,8 +344,8 @@ static int hvf_init_vcpu(CPUState *cpu)
      sigact.sa_handler = dummy_signal;
      sigaction(SIG_IPI, &sigact, NULL);
 
Quoted 9 lines

accel/hvf/hvf-cpus.c static int hvf_init_vcpu(CPUState *cpu) · line 348

Quoted 4 lines
accel/hvf/hvf-cpus.c +2 -2
-    pthread_sigmask(SIG_BLOCK, NULL, &set);
-    sigdelset(&set, SIG_IPI);
+    pthread_sigmask(SIG_BLOCK, NULL, &cpu->hvf->unblock_ipi_mask);
+    sigdelset(&cpu->hvf->unblock_ipi_mask, SIG_IPI);

That turns set into an unused variable, no? I'll fix it up while applying though. The rest looks great, I'll push it as part of my next patch set.

Yes, thanks for spotting that, your fixup looks good.

Peter