Skip to content

exec: drop BQL from interrupt handling

Emilio G. Cota kvm qemu-arm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 of 35 patches 12 repliesIn review

6 of 35 patches are in this archive. The cover letter announces 35.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
2/35target/i386: use cpu_reset_interrupttarget/i386/hax-all.c target/i386/hvf/x86hvf.c target/i386/kvm.c +3 more+25 -261 reply
8/35target/arm: access cpu->interrupt_request with atomicstarget/arm/cpu.c target/arm/helper.c+6 -80 replies
11/35target/i386: access cpu->interrupt_request with atomicstarget/i386/cpu.c target/i386/helper.c target/i386/kvm.c +1 more+33 -262 replies
32/35target/i386/kvm: do not acquire the BQL to call cpu_reset_interrupttarget/i386/kvm.c+0 -42 replies
34/35exec: push BQL down to cpu->do_interruptaccel/tcg/cpu-exec.c target/arm/helper.c target/ppc/excp_helper.c +3 more+73 -93 replies
35/35exec: push BQL down to cpu->cpu_exec_interruptaccel/tcg/cpu-exec.c docs/devel/multi-thread-tcg.txt target/arm/cpu.c +3 more+28 -112 replies

Reviews trailers per patch

4 of 6 patches have a Reviewed-by or Acked-by.

PatchDavid GibsonDavid HildenbrandRichard HendersonCornelia HuckPhilippe Mathieu-DaudéMark Cave-Ayland
SeriesT-b
2/35R-b
8/35
11/35
32/35R-b R-b
34/35A-b R-b R-b
35/35A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.

Read the v1 thread

Cover letter [PATCH 00/35] exec: drop BQL from interrupt handling

This series comes originally from a series of patches that Paolo sent to me a long time ago. I have kept most of his S-o-b tags, but I have done the forward port of the patches to the current QEMU code base, so please blame all possible bugs on me, not him.

The goal of this series is to push the BQL out of interrupt handling wherever possible. Many targets do not need the BQL to handle interrupts, so for those targets we get rid of the BQL in interrupt handling. In TCG mode, this by itself does not yield measurable performance gains. However, it is a necessary first step before tackling BQL contention when managing CPU states (i.e. exiting the exec loop always involves taking the BQL, which does not scale).

The patches:

- Patch 0 accesses icount_decr.u16 consistently with atomics. This is important because we use it across threads to signal that an interrupt is pending.

- 2-28: convert direct callers of cpu->interrupt_request to use atomic accesses or CPU helper functions that use atomics. I have broken these up into individual patches to ease review. Note that in some cases I have added many atomic_reads, most of which are probably unnecessary. However, I'd leave this up to the maintainers, since I do not want to break things by doing a single atomic_read(&cpu->interrupt_request) at the beginning of a function and then miss subsequent updates to cpu->interrupt_request.

- 29-31: drop the BQL requirement when handling cpu->interrupt_request

- 32-33: drop now unnecessary BQL acquisitions in i386 and ppc

- 34-35: push down the BQL acquisition to cpu->do_interrupt and cpu->cpu_exec_interrupt. Here I am Cc'ing everyone so that we can make sure I am not missing any target that requires the BQL on either do_interrupt or cpu_exec_interrupt.

This series is checkpatch-clean, and can be fetched from:
https://github.com/cota/qemu/tree/cpu-lock

Note that the series applies on top of patches that are already on the qemu-devel list and will hopefully soon be upstream. This series begins after commit 4ece0cbd74 ("cpus: access .qemu_icount_bias with atomic64") in that tree.

Thanks,

Emilio