[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH qemu 0/7] Many improvements to HVF memory-related codes
From: |
~ubzeme |
Subject: |
[PATCH qemu 0/7] Many improvements to HVF memory-related codes |
Date: |
Mon, 28 Feb 2022 06:45:45 +0000 |
I recently bought a Mac with M1 Pro chip, and use QEMU to setup a Linux
virtual machine. QEMU crashed when I started a VM with HVF accelerator
enabled and with the device, bochs-display, added.
After digging into the source code, I found that dirty-tracking in HVF
did not work properly, which made QEMU crashed. Therefore I made this
series of patches to fix the problem.
Followings are the summary of the changes that these patches make:
1. Move HVF memory-related functions and codes into a new file
hvf-mem.c
2. Simplify the logics of adding and removing memory regions in HVF
memory listener
3. Fix HVF dirty-tracking logics for both Intel and Apple Silicon Macs
4. Use GTree and dynamically-allocated structures to store HVF memory
slots instead of fixed-size arrays. This makes memory slots more
scalable. It is inspired by the recent changes in Linux kernel
(v5.17) that use red-black trees instead of arrays to store
in-kernel KVM memory slots.
5. Add a lock to protect the data structures of HVF memory slots
Patches have been tested on Apple Silicon Macs and Intel Macs.
Yan-Jie Wang (7):
hvf: move memory related functions from hvf-accel-ops.c to hvf-mem.c
hvf: simplify data structures and codes of memory related functions
hvf: use correct data types for addresses in memory related functions
hvf: rename struct hvf_slot to HVFSlot
hvf: fix memory dirty-tracking
hvf: add a lock for memory related functions
hvf: use GTree to store memory slots instead of fixed-size array
accel/hvf/hvf-accel-ops.c | 221 +-------------------------
accel/hvf/hvf-mem.c | 318 ++++++++++++++++++++++++++++++++++++++
accel/hvf/meson.build | 1 +
include/sysemu/hvf_int.h | 18 +--
target/arm/hvf/hvf.c | 5 +
target/i386/hvf/hvf.c | 25 +--
6 files changed, 334 insertions(+), 254 deletions(-)
create mode 100644 accel/hvf/hvf-mem.c
--
2.34.1
- [PATCH qemu 0/7] Many improvements to HVF memory-related codes,
~ubzeme <=
- [PATCH qemu 1/7] hvf: move memory related functions from hvf-accel-ops.c to hvf-mem.c, ~ubzeme, 2022/02/28
- [PATCH qemu 6/7] hvf: add a lock for memory related functions, ~ubzeme, 2022/02/28
- [PATCH qemu 2/7] hvf: simplify data structures and codes of memory related functions, ~ubzeme, 2022/02/28
- [PATCH qemu 5/7] hvf: fix memory dirty-tracking, ~ubzeme, 2022/02/28
- [PATCH qemu 4/7] hvf: rename struct hvf_slot to HVFSlot, ~ubzeme, 2022/02/28
- [PATCH qemu 3/7] hvf: use correct data types for addresses in memory related functions, ~ubzeme, 2022/02/28
- [PATCH qemu 7/7] hvf: use GTree to store memory slots instead of fixed-size array, ~ubzeme, 2022/02/28
- Re: [PATCH qemu 0/7] Many improvements to HVF memory-related codes, Peter Maydell, 2022/02/28