[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 11/18] s390x/flic: optimize CPU wakeup for TCG
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v3 11/18] s390x/flic: optimize CPU wakeup for TCG |
Date: |
Mon, 29 Jan 2018 13:56:16 +0100 |
Kicking all CPUs on every floating interrupt is far from efficient.
Let's optimize it at least a little bit.
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/intc/s390_flic.c | 31 +++++++++++++++++++++++++++++--
target/s390x/cpu.h | 4 ++++
target/s390x/internal.h | 5 -----
3 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c
index cb216de9ba..5febde2d65 100644
--- a/hw/intc/s390_flic.c
+++ b/hw/intc/s390_flic.c
@@ -161,10 +161,37 @@ static void qemu_s390_flic_notify(uint32_t type)
/*
* We have to make all CPUs see CPU_INTERRUPT_HARD, so they might
- * consider it. TODO: don't kick/wakeup all VCPUs but try to be
- * smarter (using the interrupt type).
+ * consider it. We will kick all running CPUs and only relevant
+ * sleeping ones.
*/
CPU_FOREACH(cs) {
+ S390CPU *cpu = S390_CPU(cs);
+
+ cs->interrupt_request |= CPU_INTERRUPT_HARD;
+
+ /* ignore CPUs that are not sleeping */
+ if (s390_cpu_get_state(cpu) != CPU_STATE_OPERATING &&
+ s390_cpu_get_state(cpu) != CPU_STATE_LOAD) {
+ continue;
+ }
+
+ /* we always kick running CPUs for now, this is tricky */
+ if (cs->halted) {
+ /* don't check for subclasses, CPUs double check when waking up */
+ if (type & FLIC_PENDING_SERVICE) {
+ if (!(cpu->env.psw.mask & PSW_MASK_EXT)) {
+ continue;
+ }
+ } else if (type & FLIC_PENDING_IO) {
+ if (!(cpu->env.psw.mask & PSW_MASK_IO)) {
+ continue;
+ }
+ } else if (type & FLIC_PENDING_MCHK_CR) {
+ if (!(cpu->env.psw.mask & PSW_MASK_MCHECK)) {
+ continue;
+ }
+ }
+ }
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
}
}
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index ba6cf0cda5..76c31d970f 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -692,6 +692,10 @@ static inline unsigned int s390_cpu_set_state(uint8_t
cpu_state, S390CPU *cpu)
return 0;
}
#endif /* CONFIG_USER_ONLY */
+static inline uint8_t s390_cpu_get_state(S390CPU *cpu)
+{
+ return cpu->env.cpu_state;
+}
/* cpu_models.c */
diff --git a/target/s390x/internal.h b/target/s390x/internal.h
index fea165ffe4..d911e84958 100644
--- a/target/s390x/internal.h
+++ b/target/s390x/internal.h
@@ -278,11 +278,6 @@ static inline void s390_do_cpu_full_reset(CPUState *cs,
run_on_cpu_data arg)
cpu_reset(cs);
}
-static inline uint8_t s390_cpu_get_state(S390CPU *cpu)
-{
- return cpu->env.cpu_state;
-}
-
/* arch_dump.c */
int s390_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
--
2.14.3
- [qemu-s390x] [PATCH v3 01/18] s390x/tcg: deliver multiple interrupts in a row, (continued)
- [qemu-s390x] [PATCH v3 01/18] s390x/tcg: deliver multiple interrupts in a row, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 02/18] s390x/flic: simplify flic initialization, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 04/18] s390x/tcg: simplify machine check handling, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 03/18] s390x/tcg: simplify lookup of flic, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 05/18] s390x/flic: factor out injection of floating interrupts, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 06/18] s390x/flic: no need to call s390_io_interrupt() from flic, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 07/18] s390x/tcg: tolerate wrong wakeups due to floating interrupts, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 08/18] s390x/flic: make floating interrupts on TCG actually floating, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 09/18] s390x/tcg: implement TEST PENDING INTERRUPTION, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 10/18] s390x/flic: implement qemu_s390_clear_io_flic(), David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 11/18] s390x/flic: optimize CPU wakeup for TCG,
David Hildenbrand <=
- [qemu-s390x] [PATCH v3 12/18] s390x: fix size + content of STSI blocks, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 14/18] s390x/tcg: remove SMP warning, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 13/18] s390x/tcg: STSI overhaul, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 15/18] configure: s390x supports mttcg now, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 16/18] s390x/tcg: cache the qemu flic in a central function, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 17/18] s390x/kvm: cache the kvm flic in a central function, David Hildenbrand, 2018/01/29
- [qemu-s390x] [PATCH v3 18/18] s390x/flic: cache the common flic class in a central function, David Hildenbrand, 2018/01/29