mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e6d5135df | ||
|
|
f2a227b6d5 | ||
|
|
709daeafab | ||
|
|
622c8770d0 | ||
|
|
ffd87c4819 |
No files matched your search
@@ -69,6 +69,10 @@ variables:
|
||||
- if: '$QEMU_CI != "1" && $QEMU_CI != "2" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: never
|
||||
|
||||
# Avocado jobs don't run in forks unless $QEMU_CI_AVOCADO_TESTING is set
|
||||
- if: '$QEMU_JOB_AVOCADO && $QEMU_CI_AVOCADO_TESTING != "1" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: never
|
||||
|
||||
|
||||
#############################################################
|
||||
# Stage 2: fine tune execution of jobs in specific scenarios
|
||||
@@ -97,8 +101,8 @@ variables:
|
||||
when: manual
|
||||
allow_failure: true
|
||||
|
||||
# Functional jobs can be manually started in forks
|
||||
- if: '$QEMU_JOB_FUNCTIONAL && $QEMU_CI_FUNCTIONAL != "1" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
# Avocado jobs can be manually start in forks if $QEMU_CI_AVOCADO_TESTING is unset
|
||||
- if: '$QEMU_JOB_AVOCADO && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: manual
|
||||
allow_failure: true
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
stage: test
|
||||
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
|
||||
script:
|
||||
- export RUST_BACKTRACE=1
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start buildenv "Setting up to run tests"
|
||||
- scripts/git-submodule.sh update roms/SLOF
|
||||
@@ -95,6 +96,7 @@
|
||||
cache:
|
||||
key: "${CI_JOB_NAME}-cache"
|
||||
paths:
|
||||
- ${CI_PROJECT_DIR}/avocado-cache
|
||||
- ${CI_PROJECT_DIR}/functional-cache
|
||||
policy: pull-push
|
||||
artifacts:
|
||||
@@ -108,10 +110,20 @@
|
||||
reports:
|
||||
junit: build/tests/results/latest/results.xml
|
||||
before_script:
|
||||
- mkdir -p ~/.config/avocado
|
||||
- echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
|
||||
- echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
|
||||
>> ~/.config/avocado/avocado.conf
|
||||
- echo -e '[job.output.testlogs]\nstatuses = ["FAIL", "INTERRUPT"]'
|
||||
>> ~/.config/avocado/avocado.conf
|
||||
- if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
|
||||
du -chs ${CI_PROJECT_DIR}/*-cache ;
|
||||
fi
|
||||
- export AVOCADO_ALLOW_UNTRUSTED_CODE=1
|
||||
- export QEMU_TEST_ALLOW_UNTRUSTED_CODE=1
|
||||
- export QEMU_TEST_CACHE_DIR=${CI_PROJECT_DIR}/functional-cache
|
||||
after_script:
|
||||
- cd build
|
||||
- du -chs ${CI_PROJECT_DIR}/*-cache
|
||||
variables:
|
||||
QEMU_JOB_FUNCTIONAL: 1
|
||||
QEMU_JOB_AVOCADO: 1
|
||||
+22
-19
@@ -29,7 +29,8 @@ functional-system-alpine:
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: alpine
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
AVOCADO_TAGS: arch:avr arch:loongarch64 arch:mips64 arch:mipsel
|
||||
|
||||
build-system-ubuntu:
|
||||
extends:
|
||||
@@ -59,7 +60,8 @@ functional-system-ubuntu:
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: ubuntu2204
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
AVOCADO_TAGS: arch:alpha arch:microblazeel arch:mips64el
|
||||
|
||||
build-system-debian:
|
||||
extends:
|
||||
@@ -90,7 +92,8 @@ functional-system-debian:
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: debian
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
AVOCADO_TAGS: arch:arm arch:i386 arch:riscv64 arch:sh4 arch:sparc arch:xtensa
|
||||
|
||||
crash-test-debian:
|
||||
extends: .native_test_job_template
|
||||
@@ -128,12 +131,6 @@ build-system-fedora-rust-nightly:
|
||||
CONFIGURE_ARGS: --disable-docs --enable-rust --enable-strict-rust-lints
|
||||
TARGETS: aarch64-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
after_script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start test "Running Rust doctests"
|
||||
- cd build
|
||||
- pyvenv/bin/meson devenv -w ../rust ${CARGO-cargo} test --doc -p qemu_api
|
||||
|
||||
allow_failure: true
|
||||
|
||||
check-system-fedora:
|
||||
@@ -152,7 +149,9 @@ functional-system-fedora:
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
AVOCADO_TAGS: arch:microblaze arch:mips arch:xtensa arch:m68k
|
||||
arch:riscv32 arch:ppc arch:sparc64
|
||||
|
||||
crash-test-fedora:
|
||||
extends: .native_test_job_template
|
||||
@@ -273,7 +272,9 @@ functional-system-centos:
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: centos9
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx
|
||||
arch:sh4
|
||||
|
||||
build-system-opensuse:
|
||||
extends:
|
||||
@@ -302,7 +303,8 @@ functional-system-opensuse:
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: opensuse-leap
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
AVOCADO_TAGS: arch:s390x arch:x86_64 arch:aarch64
|
||||
|
||||
#
|
||||
# Flaky tests. We don't run these by default and they are allow fail
|
||||
@@ -330,9 +332,10 @@ functional-system-flaky:
|
||||
allow_failure: true
|
||||
variables:
|
||||
IMAGE: debian
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
QEMU_JOB_OPTIONAL: 1
|
||||
QEMU_TEST_FLAKY_TESTS: 1
|
||||
AVOCADO_TAGS: flaky
|
||||
|
||||
# This jobs explicitly disable TCG (--disable-tcg), KVM is detected by
|
||||
# the configure script. The container doesn't contain Xen headers so
|
||||
@@ -473,8 +476,8 @@ clang-user:
|
||||
# Since slirp callbacks are used in QEMU Timers, we cannot use libslirp with
|
||||
# CFI builds, and thus have to disable it here.
|
||||
#
|
||||
# Split in three sets of build/check/functional to limit the execution time
|
||||
# of each job
|
||||
# Split in three sets of build/check/avocado to limit the execution time of each
|
||||
# job
|
||||
build-cfi-aarch64:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
@@ -511,7 +514,7 @@ functional-cfi-aarch64:
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
|
||||
build-cfi-ppc64-s390x:
|
||||
extends:
|
||||
@@ -549,7 +552,7 @@ functional-cfi-ppc64-s390x:
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
|
||||
build-cfi-x86_64:
|
||||
extends:
|
||||
@@ -583,7 +586,7 @@ functional-cfi-x86_64:
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
MAKE_CHECK_ARGS: check-avocado check-functional
|
||||
|
||||
tsan-build:
|
||||
extends: .native_build_job_template
|
||||
@@ -742,7 +745,7 @@ pages:
|
||||
- make gtags
|
||||
# We unset variables to work around a bug in some htags versions
|
||||
# which causes it to fail when the environment is large
|
||||
- CI_COMMIT_MESSAGE= CI_COMMIT_TAG_MESSAGE= CI_COMMIT_DESCRIPTION= htags
|
||||
- CI_COMMIT_MESSAGE= CI_COMMIT_TAG_MESSAGE= htags
|
||||
-anT --tree-view=filetree -m qemu_init
|
||||
-t "Welcome to the QEMU sourcecode"
|
||||
- mv HTML public/src
|
||||
|
||||
@@ -21,7 +21,7 @@ repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)
|
||||
|
||||
print(f"adding upstream git repo @ {repourl}")
|
||||
subprocess.check_call(["git", "remote", "add", "check-dco", repourl])
|
||||
subprocess.check_call(["git", "fetch", "--refetch", "check-dco", "master"])
|
||||
subprocess.check_call(["git", "fetch", "check-dco", "master"])
|
||||
|
||||
ancestor = subprocess.check_output(["git", "merge-base",
|
||||
"check-dco/master", "HEAD"],
|
||||
|
||||
@@ -24,7 +24,7 @@ print(f"adding upstream git repo @ {repourl}")
|
||||
# base for the user's branch. We thus need to figure out a common
|
||||
# ancestor between the user's branch and current git master.
|
||||
subprocess.check_call(["git", "remote", "add", "check-patch", repourl])
|
||||
subprocess.check_call(["git", "fetch", "--refetch", "check-patch", "master"])
|
||||
subprocess.check_call(["git", "fetch", "check-patch", "master"])
|
||||
|
||||
ancestor = subprocess.check_output(["git", "merge-base",
|
||||
"check-patch/master", "HEAD"],
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# check-units.py: check the number of compilation units and identify
|
||||
# those that are rebuilt multiple times
|
||||
#
|
||||
# Copyright (C) 2025 Linaro Ltd.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from os import access, R_OK, path
|
||||
from sys import argv, exit
|
||||
import json
|
||||
from collections import Counter
|
||||
|
||||
|
||||
def extract_build_units(cc_path):
|
||||
"""
|
||||
Extract the build units and their counds from compile_commands.json file.
|
||||
|
||||
Returns:
|
||||
Hash table of ["unit"] = count
|
||||
"""
|
||||
|
||||
j = json.load(open(cc_path, 'r'))
|
||||
files = [f['file'] for f in j]
|
||||
build_units = Counter(files)
|
||||
|
||||
return build_units
|
||||
|
||||
|
||||
def analyse_units(build_units):
|
||||
"""
|
||||
Analyse the build units and report stats and the top 10 rebuilds
|
||||
"""
|
||||
|
||||
print(f"Total source files: {len(build_units.keys())}")
|
||||
print(f"Total build units: {sum(units.values())}")
|
||||
|
||||
# Create a sorted list by number of rebuilds
|
||||
sorted_build_units = sorted(build_units.items(),
|
||||
key=lambda item: item[1],
|
||||
reverse=True)
|
||||
|
||||
print("Most rebuilt units:")
|
||||
for unit, count in sorted_build_units[:20]:
|
||||
print(f" {unit} built {count} times")
|
||||
|
||||
print("Least rebuilt units:")
|
||||
for unit, count in sorted_build_units[-10:]:
|
||||
print(f" {unit} built {count} times")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(argv) != 2:
|
||||
script_name = path.basename(argv[0])
|
||||
print(f"Usage: {script_name} <path_to_compile_commands.json>")
|
||||
exit(1)
|
||||
|
||||
cc_path = argv[1]
|
||||
if path.isfile(cc_path) and access(cc_path, R_OK):
|
||||
units = extract_build_units(cc_path)
|
||||
analyse_units(units)
|
||||
exit(0)
|
||||
else:
|
||||
print(f"{cc_path} doesn't exist or isn't readable")
|
||||
exit(1)
|
||||
+21
-6
@@ -15,17 +15,32 @@
|
||||
stage: build
|
||||
image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:latest
|
||||
needs: []
|
||||
allow_failure:
|
||||
exit_codes: 3
|
||||
# 20 mins larger than "timeout_in" in cirrus/build.yml
|
||||
# as there's often a 5-10 minute delay before Cirrus CI
|
||||
# actually starts the task
|
||||
timeout: 80m
|
||||
script:
|
||||
- set -o allexport
|
||||
- source .gitlab-ci.d/cirrus/$NAME.vars
|
||||
- set +o allexport
|
||||
- cirrus-vars <.gitlab-ci.d/cirrus/build.yml >.gitlab-ci.d/cirrus/$NAME.yml
|
||||
- sed -e "s|[@]CI_REPOSITORY_URL@|$CI_REPOSITORY_URL|g"
|
||||
-e "s|[@]CI_COMMIT_REF_NAME@|$CI_COMMIT_REF_NAME|g"
|
||||
-e "s|[@]CI_COMMIT_SHA@|$CI_COMMIT_SHA|g"
|
||||
-e "s|[@]CIRRUS_VM_INSTANCE_TYPE@|$CIRRUS_VM_INSTANCE_TYPE|g"
|
||||
-e "s|[@]CIRRUS_VM_IMAGE_SELECTOR@|$CIRRUS_VM_IMAGE_SELECTOR|g"
|
||||
-e "s|[@]CIRRUS_VM_IMAGE_NAME@|$CIRRUS_VM_IMAGE_NAME|g"
|
||||
-e "s|[@]CIRRUS_VM_CPUS@|$CIRRUS_VM_CPUS|g"
|
||||
-e "s|[@]CIRRUS_VM_RAM@|$CIRRUS_VM_RAM|g"
|
||||
-e "s|[@]UPDATE_COMMAND@|$UPDATE_COMMAND|g"
|
||||
-e "s|[@]INSTALL_COMMAND@|$INSTALL_COMMAND|g"
|
||||
-e "s|[@]PATH@|$PATH_EXTRA${PATH_EXTRA:+:}\$PATH|g"
|
||||
-e "s|[@]PKG_CONFIG_PATH@|$PKG_CONFIG_PATH|g"
|
||||
-e "s|[@]PKGS@|$PKGS|g"
|
||||
-e "s|[@]MAKE@|$MAKE|g"
|
||||
-e "s|[@]PYTHON@|$PYTHON|g"
|
||||
-e "s|[@]PIP3@|$PIP3|g"
|
||||
-e "s|[@]PYPI_PKGS@|$PYPI_PKGS|g"
|
||||
-e "s|[@]CONFIGURE_ARGS@|$CONFIGURE_ARGS|g"
|
||||
-e "s|[@]TEST_TARGETS@|$TEST_TARGETS|g"
|
||||
<.gitlab-ci.d/cirrus/build.yml >.gitlab-ci.d/cirrus/$NAME.yml
|
||||
- cat .gitlab-ci.d/cirrus/$NAME.yml
|
||||
- cirrus-run -v --show-build-log always .gitlab-ci.d/cirrus/$NAME.yml
|
||||
variables:
|
||||
@@ -37,7 +52,7 @@ x64-freebsd-14-build:
|
||||
NAME: freebsd-14
|
||||
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
|
||||
CIRRUS_VM_IMAGE_SELECTOR: image_family
|
||||
CIRRUS_VM_IMAGE_NAME: freebsd-14-3
|
||||
CIRRUS_VM_IMAGE_NAME: freebsd-14-1
|
||||
CIRRUS_VM_CPUS: 8
|
||||
CIRRUS_VM_RAM: 8G
|
||||
UPDATE_COMMAND: pkg update; pkg upgrade -y
|
||||
|
||||
@@ -8,7 +8,7 @@ env:
|
||||
CI_REPOSITORY_URL: "@CI_REPOSITORY_URL@"
|
||||
CI_COMMIT_REF_NAME: "@CI_COMMIT_REF_NAME@"
|
||||
CI_COMMIT_SHA: "@CI_COMMIT_SHA@"
|
||||
PATH: "@PATH_EXTRA@:$PATH"
|
||||
PATH: "@PATH@"
|
||||
PKG_CONFIG_PATH: "@PKG_CONFIG_PATH@"
|
||||
PYTHON: "@PYTHON@"
|
||||
MAKE: "@MAKE@"
|
||||
|
||||
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
|
||||
NINJA='/usr/local/bin/ninja'
|
||||
PACKAGING_COMMAND='pkg'
|
||||
PIP3='/usr/local/bin/pip'
|
||||
PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-sphinx py311-sphinx_rtd_theme py311-tomli python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 vulkan-tools xorriso zstd'
|
||||
PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-sphinx py311-sphinx_rtd_theme py311-tomli python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 xorriso zstd'
|
||||
PYPI_PKGS=''
|
||||
PYTHON='/usr/local/bin/python3'
|
||||
@@ -11,6 +11,6 @@ MAKE='/opt/homebrew/bin/gmake'
|
||||
NINJA='/opt/homebrew/bin/ninja'
|
||||
PACKAGING_COMMAND='brew'
|
||||
PIP3='/opt/homebrew/bin/pip3'
|
||||
PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd'
|
||||
PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 xorriso zlib zstd'
|
||||
PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli'
|
||||
PYTHON='/opt/homebrew/bin/python3'
|
||||
@@ -67,8 +67,11 @@ ppc64el-debian-cross-container:
|
||||
riscv64-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
# as we are currently based on 'sid/unstable' we may break so...
|
||||
allow_failure: true
|
||||
variables:
|
||||
NAME: debian-riscv64-cross
|
||||
QEMU_JOB_OPTIONAL: 1
|
||||
|
||||
s390x-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
|
||||
@@ -61,7 +61,7 @@ cross-i686-tci:
|
||||
variables:
|
||||
IMAGE: debian-i686-cross
|
||||
ACCEL: tcg-interpreter
|
||||
EXTRA_CONFIGURE_OPTS: --target-list=i386-softmmu,i386-linux-user,arm-softmmu,arm-linux-user,ppc-softmmu,ppc-linux-user --disable-plugins --disable-kvm
|
||||
EXTRA_CONFIGURE_OPTS: --target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user --disable-plugins --disable-kvm
|
||||
# Force tests to run with reduced parallelism, to see whether this
|
||||
# reduces the flakiness of this CI job. The CI
|
||||
# environment by default shows us 8 CPUs and so we
|
||||
@@ -118,8 +118,12 @@ cross-ppc64el-kvm-only:
|
||||
IMAGE: debian-ppc64el-cross
|
||||
EXTRA_CONFIGURE_OPTS: --disable-tcg --without-default-devices
|
||||
|
||||
# The riscv64 cross-builds currently use a 'sid' container to get
|
||||
# compilers and libraries. Until something more stable is found we
|
||||
# allow_failure so as not to block CI.
|
||||
cross-riscv64-system:
|
||||
extends: .cross_system_build_job
|
||||
allow_failure: true
|
||||
needs:
|
||||
job: riscv64-debian-cross-container
|
||||
variables:
|
||||
@@ -127,6 +131,7 @@ cross-riscv64-system:
|
||||
|
||||
cross-riscv64-user:
|
||||
extends: .cross_user_build_job
|
||||
allow_failure: true
|
||||
needs:
|
||||
job: riscv64-debian-cross-container
|
||||
variables:
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
junit: build/meson-logs/testlog.junit.xml
|
||||
|
||||
include:
|
||||
- local: '/.gitlab-ci.d/custom-runners/ubuntu-24.04-s390x.yml'
|
||||
- local: '/.gitlab-ci.d/custom-runners/ubuntu-24.04-aarch64.yml'
|
||||
- local: '/.gitlab-ci.d/custom-runners/ubuntu-24.04-aarch32.yml'
|
||||
- local: '/.gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml'
|
||||
- local: '/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml'
|
||||
- local: '/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch32.yml'
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
# All ubuntu-24.04 jobs should run successfully in an environment
|
||||
# All ubuntu-22.04 jobs should run successfully in an environment
|
||||
# setup by the scripts/ci/setup/ubuntu/build-environment.yml task
|
||||
# "Install basic packages to build QEMU on Ubuntu 24.04"
|
||||
# "Install basic packages to build QEMU on Ubuntu 22.04"
|
||||
|
||||
ubuntu-24.04-aarch32-all:
|
||||
ubuntu-22.04-aarch32-all:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- aarch32
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
+16
-16
@@ -1,13 +1,13 @@
|
||||
# All ubuntu-24.04 jobs should run successfully in an environment
|
||||
# All ubuntu-22.04 jobs should run successfully in an environment
|
||||
# setup by the scripts/ci/setup/ubuntu/build-environment.yml task
|
||||
# "Install basic packages to build QEMU on Ubuntu 24.04"
|
||||
# "Install basic packages to build QEMU on Ubuntu 22.04"
|
||||
|
||||
ubuntu-24.04-aarch64-all-linux-static:
|
||||
ubuntu-22.04-aarch64-all-linux-static:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- aarch64
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -23,12 +23,12 @@ ubuntu-24.04-aarch64-all-linux-static:
|
||||
- make check-tcg
|
||||
- make --output-sync -j`nproc --ignore=40` check
|
||||
|
||||
ubuntu-24.04-aarch64-all:
|
||||
ubuntu-22.04-aarch64-all:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- aarch64
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -45,12 +45,12 @@ ubuntu-24.04-aarch64-all:
|
||||
- make --output-sync -j`nproc --ignore=40`
|
||||
- make --output-sync -j`nproc --ignore=40` check
|
||||
|
||||
ubuntu-24.04-aarch64-without-defaults:
|
||||
ubuntu-22.04-aarch64-without-defaults:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- aarch64
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -67,12 +67,12 @@ ubuntu-24.04-aarch64-without-defaults:
|
||||
- make --output-sync -j`nproc --ignore=40`
|
||||
- make --output-sync -j`nproc --ignore=40` check
|
||||
|
||||
ubuntu-24.04-aarch64-alldbg:
|
||||
ubuntu-22.04-aarch64-alldbg:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- aarch64
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -86,12 +86,12 @@ ubuntu-24.04-aarch64-alldbg:
|
||||
- make --output-sync -j`nproc --ignore=40`
|
||||
- make --output-sync -j`nproc --ignore=40` check
|
||||
|
||||
ubuntu-24.04-aarch64-clang:
|
||||
ubuntu-22.04-aarch64-clang:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- aarch64
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -108,11 +108,11 @@ ubuntu-24.04-aarch64-clang:
|
||||
- make --output-sync -j`nproc --ignore=40`
|
||||
- make --output-sync -j`nproc --ignore=40` check
|
||||
|
||||
ubuntu-24.04-aarch64-tci:
|
||||
ubuntu-22.04-aarch64-tci:
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- aarch64
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -128,12 +128,12 @@ ubuntu-24.04-aarch64-tci:
|
||||
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
|
||||
- make --output-sync -j`nproc --ignore=40`
|
||||
|
||||
ubuntu-24.04-aarch64-notcg:
|
||||
ubuntu-22.04-aarch64-notcg:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- aarch64
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
+14
-14
@@ -1,13 +1,13 @@
|
||||
# All ubuntu-24.04 jobs should run successfully in an environment
|
||||
# All ubuntu-22.04 jobs should run successfully in an environment
|
||||
# setup by the scripts/ci/setup/ubuntu/build-environment.yml task
|
||||
# "Install basic packages to build QEMU on Ubuntu 24.04"
|
||||
# "Install basic packages to build QEMU on Ubuntu 22.04"
|
||||
|
||||
ubuntu-24.04-s390x-all-linux:
|
||||
ubuntu-22.04-s390x-all-linux:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- s390x
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -21,12 +21,12 @@ ubuntu-24.04-s390x-all-linux:
|
||||
- make --output-sync check-tcg
|
||||
- make --output-sync -j`nproc` check
|
||||
|
||||
ubuntu-24.04-s390x-all-system:
|
||||
ubuntu-22.04-s390x-all-system:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- s390x
|
||||
timeout: 75m
|
||||
rules:
|
||||
@@ -40,12 +40,12 @@ ubuntu-24.04-s390x-all-system:
|
||||
- make --output-sync -j`nproc`
|
||||
- make --output-sync -j`nproc` check
|
||||
|
||||
ubuntu-24.04-s390x-alldbg:
|
||||
ubuntu-22.04-s390x-alldbg:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- s390x
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -63,12 +63,12 @@ ubuntu-24.04-s390x-alldbg:
|
||||
- make --output-sync -j`nproc`
|
||||
- make --output-sync -j`nproc` check
|
||||
|
||||
ubuntu-24.04-s390x-clang:
|
||||
ubuntu-22.04-s390x-clang:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- s390x
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -85,11 +85,11 @@ ubuntu-24.04-s390x-clang:
|
||||
- make --output-sync -j`nproc`
|
||||
- make --output-sync -j`nproc` check
|
||||
|
||||
ubuntu-24.04-s390x-tci:
|
||||
ubuntu-22.04-s390x-tci:
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- s390x
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -105,12 +105,12 @@ ubuntu-24.04-s390x-tci:
|
||||
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
|
||||
- make --output-sync -j`nproc`
|
||||
|
||||
ubuntu-24.04-s390x-notcg:
|
||||
ubuntu-22.04-s390x-notcg:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- ubuntu_22.04
|
||||
- s390x
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
@@ -70,25 +70,3 @@ check-rust-tools-nightly:
|
||||
expire_in: 2 days
|
||||
paths:
|
||||
- rust/target/doc
|
||||
|
||||
check-build-units:
|
||||
extends: .base_job_template
|
||||
stage: build
|
||||
image: $CI_REGISTRY_IMAGE/qemu/debian:$QEMU_CI_CONTAINER_TAG
|
||||
needs:
|
||||
job: amd64-debian-container
|
||||
before_script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start setup "Install Tools"
|
||||
- apt install --assume-yes --no-install-recommends jq
|
||||
- section_end setup
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure
|
||||
- cd ..
|
||||
- section_end configure
|
||||
- section_start analyse "Analyse"
|
||||
- .gitlab-ci.d/check-units.py build/compile_commands.json
|
||||
- section_end analyse
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
url = https://gitlab.com/qemu-project/qemu-palcode.git
|
||||
[submodule "roms/u-boot"]
|
||||
path = roms/u-boot
|
||||
url = https://gitlab.com/qemu-project-mirrors/u-boot.git
|
||||
url = https://gitlab.com/qemu-project/u-boot.git
|
||||
[submodule "roms/skiboot"]
|
||||
path = roms/skiboot
|
||||
url = https://gitlab.com/qemu-project/skiboot.git
|
||||
@@ -27,7 +27,7 @@
|
||||
url = https://gitlab.com/qemu-project/seabios-hppa.git
|
||||
[submodule "roms/u-boot-sam460ex"]
|
||||
path = roms/u-boot-sam460ex
|
||||
url = https://gitlab.com/qemu-project-mirrors/u-boot-sam460ex.git
|
||||
url = https://gitlab.com/qemu-project/u-boot-sam460ex.git
|
||||
[submodule "roms/edk2"]
|
||||
path = roms/edk2
|
||||
url = https://gitlab.com/qemu-project/edk2.git
|
||||
|
||||
@@ -67,7 +67,6 @@ Andrey Drobyshev <[email protected]> Andrey Drobyshev via <qemu-blo
|
||||
BALATON Zoltan <[email protected]> BALATON Zoltan via <[email protected]>
|
||||
|
||||
# Next, replace old addresses by a more recent one.
|
||||
Akihiko Odaki <[email protected]> <[email protected]>
|
||||
Aleksandar Markovic <[email protected]> <[email protected]>
|
||||
Aleksandar Markovic <[email protected]> <[email protected]>
|
||||
Aleksandar Markovic <[email protected]> <[email protected]>
|
||||
|
||||
@@ -61,6 +61,3 @@ config HV_BALLOON_POSSIBLE
|
||||
|
||||
config HAVE_RUST
|
||||
bool
|
||||
|
||||
config MAC_PVG
|
||||
bool
|
||||
+53
-93
@@ -152,7 +152,10 @@ Overall TCG CPUs
|
||||
M: Richard Henderson <[email protected]>
|
||||
R: Paolo Bonzini <[email protected]>
|
||||
S: Maintained
|
||||
F: system/cpus.c
|
||||
F: system/watchpoint.c
|
||||
F: cpu-common.c
|
||||
F: cpu-target.c
|
||||
F: page-vary-target.c
|
||||
F: page-vary-common.c
|
||||
F: accel/tcg/
|
||||
@@ -162,13 +165,17 @@ F: util/cacheflush.c
|
||||
F: scripts/decodetree.py
|
||||
F: docs/devel/decodetree.rst
|
||||
F: docs/devel/tcg*
|
||||
F: include/exec/cpu*.h
|
||||
F: include/exec/exec-all.h
|
||||
F: include/exec/tb-flush.h
|
||||
F: include/exec/target_long.h
|
||||
F: include/exec/helper*.h
|
||||
F: include/exec/helper*.h.inc
|
||||
F: include/exec/helper-info.c.inc
|
||||
F: include/exec/page-protection.h
|
||||
F: include/system/cpus.h
|
||||
F: include/system/tcg.h
|
||||
F: include/accel/tcg/cpu-ops.h
|
||||
F: include/hw/core/tcg-cpu-ops.h
|
||||
F: host/include/*/host/cpuinfo.h
|
||||
F: util/cpuinfo-*.c
|
||||
F: include/tcg/
|
||||
@@ -211,7 +218,7 @@ L: [email protected]
|
||||
S: Maintained
|
||||
F: hw/arm/smmu*
|
||||
F: include/hw/arm/smmu*
|
||||
F: tests/functional/test_aarch64_smmu.py
|
||||
F: tests/avocado/smmu.py
|
||||
|
||||
AVR TCG CPUs
|
||||
M: Michael Rolnik <[email protected]>
|
||||
@@ -312,6 +319,7 @@ F: tests/functional/test_ppc_74xx.py
|
||||
RISC-V TCG CPUs
|
||||
M: Palmer Dabbelt <[email protected]>
|
||||
M: Alistair Francis <[email protected]>
|
||||
M: Bin Meng <[email protected]>
|
||||
R: Weiwei Li <[email protected]>
|
||||
R: Daniel Henrique Barboza <[email protected]>
|
||||
R: Liu Zhiwei <[email protected]>
|
||||
@@ -319,7 +327,6 @@ L: [email protected]
|
||||
S: Supported
|
||||
F: configs/targets/riscv*
|
||||
F: docs/system/target-riscv.rst
|
||||
F: docs/specs/riscv-iommu.rst
|
||||
F: target/riscv/
|
||||
F: hw/char/riscv_htif.c
|
||||
F: hw/riscv/
|
||||
@@ -475,7 +482,6 @@ F: docs/system/i386/sgx.rst
|
||||
F: target/i386/kvm/
|
||||
F: target/i386/sev*
|
||||
F: scripts/kvm/vmxcap
|
||||
F: tests/functional/test_x86_64_hotplug_cpu.py
|
||||
|
||||
Xen emulation on X86 KVM CPUs
|
||||
M: David Woodhouse <[email protected]>
|
||||
@@ -492,19 +498,12 @@ Overall
|
||||
M: Richard Henderson <[email protected]>
|
||||
R: Paolo Bonzini <[email protected]>
|
||||
S: Maintained
|
||||
F: include/exec/cpu*.h
|
||||
F: include/exec/exec-all.h
|
||||
F: include/exec/target_long.h
|
||||
F: include/qemu/accel.h
|
||||
F: include/system/accel-*.h
|
||||
F: include/system/cpus.h
|
||||
F: include/accel/accel-cpu-target.h
|
||||
F: include/hw/core/accel-cpu.h
|
||||
F: accel/accel-*.c
|
||||
F: accel/Makefile.objs
|
||||
F: accel/stubs/Makefile.objs
|
||||
F: cpu-common.c
|
||||
F: cpu-target.c
|
||||
F: system/cpus.c
|
||||
|
||||
Apple Silicon HVF CPUs
|
||||
M: Alexander Graf <[email protected]>
|
||||
@@ -627,7 +626,6 @@ S: Maintained
|
||||
F: hw/alpha/
|
||||
F: hw/isa/smc37c669-superio.c
|
||||
F: tests/tcg/alpha/system/
|
||||
F: tests/functional/test_alpha_clipper.py
|
||||
|
||||
ARM Machines
|
||||
------------
|
||||
@@ -789,7 +787,7 @@ F: docs/system/arm/kzm.rst
|
||||
Integrator CP
|
||||
M: Peter Maydell <[email protected]>
|
||||
L: [email protected]
|
||||
S: Odd Fixes
|
||||
S: Maintained
|
||||
F: hw/arm/integratorcp.c
|
||||
F: hw/misc/arm_integrator_debug.c
|
||||
F: include/hw/misc/arm_integrator_debug.h
|
||||
@@ -822,21 +820,6 @@ F: hw/pci-host/designware.c
|
||||
F: include/hw/pci-host/designware.h
|
||||
F: docs/system/arm/mcimx7d-sabre.rst
|
||||
|
||||
MCIMX8MP-EVK / i.MX8MP
|
||||
M: Bernhard Beschow <[email protected]>
|
||||
L: [email protected]
|
||||
S: Maintained
|
||||
F: hw/arm/imx8mp-evk.c
|
||||
F: hw/arm/fsl-imx8mp.c
|
||||
F: hw/misc/imx8mp_*.c
|
||||
F: hw/pci-host/fsl_imx8m_phy.c
|
||||
F: hw/rtc/rs5c372.c
|
||||
F: include/hw/arm/fsl-imx8mp.h
|
||||
F: include/hw/misc/imx8mp_*.h
|
||||
F: include/hw/pci-host/fsl_imx8m_phy.h
|
||||
F: docs/system/arm/imx8mp-evk.rst
|
||||
F: tests/qtest/rs5c372-test.c
|
||||
|
||||
MPS2 / MPS3
|
||||
M: Peter Maydell <[email protected]>
|
||||
L: [email protected]
|
||||
@@ -870,7 +853,7 @@ F: docs/system/arm/mps2.rst
|
||||
Musca
|
||||
M: Peter Maydell <[email protected]>
|
||||
L: [email protected]
|
||||
S: Odd Fixes
|
||||
S: Maintained
|
||||
F: hw/arm/musca.c
|
||||
F: docs/system/arm/musca.rst
|
||||
|
||||
@@ -895,7 +878,6 @@ F: include/hw/*/npcm*
|
||||
F: tests/qtest/npcm*
|
||||
F: tests/qtest/adm1266-test.c
|
||||
F: pc-bios/npcm7xx_bootrom.bin
|
||||
F: pc-bios/npcm8xx_bootrom.bin
|
||||
F: roms/vbootrom
|
||||
F: docs/system/arm/nuvoton.rst
|
||||
F: tests/functional/test_arm_quanta_gsj.py
|
||||
@@ -918,7 +900,7 @@ F: tests/functional/test_aarch64_raspi4.py
|
||||
Real View
|
||||
M: Peter Maydell <[email protected]>
|
||||
L: [email protected]
|
||||
S: Odd Fixes
|
||||
S: Maintained
|
||||
F: hw/arm/realview*
|
||||
F: hw/cpu/realview_mpcore.c
|
||||
F: hw/intc/realview_gic.c
|
||||
@@ -952,7 +934,7 @@ F: hw/misc/sbsa_ec.c
|
||||
F: hw/watchdog/sbsa_gwdt.c
|
||||
F: include/hw/watchdog/sbsa_gwdt.h
|
||||
F: docs/system/arm/sbsa.rst
|
||||
F: tests/functional/test_aarch64_*sbsaref*.py
|
||||
F: tests/functional/test_aarch64_sbsaref*.py
|
||||
|
||||
Sharp SL-5500 (Collie) PDA
|
||||
M: Peter Maydell <[email protected]>
|
||||
@@ -968,7 +950,7 @@ F: tests/functional/test_arm_collie.py
|
||||
Stellaris
|
||||
M: Peter Maydell <[email protected]>
|
||||
L: [email protected]
|
||||
S: Odd Fixes
|
||||
S: Maintained
|
||||
F: hw/*/stellaris*
|
||||
F: hw/display/ssd03*
|
||||
F: include/hw/input/gamepad.h
|
||||
@@ -998,7 +980,7 @@ F: docs/system/arm/stm32.rst
|
||||
Versatile Express
|
||||
M: Peter Maydell <[email protected]>
|
||||
L: [email protected]
|
||||
S: Odd Fixes
|
||||
S: Maintained
|
||||
F: hw/arm/vexpress.c
|
||||
F: hw/display/sii9022.c
|
||||
F: docs/system/arm/vexpress.rst
|
||||
@@ -1007,7 +989,7 @@ F: tests/functional/test_arm_vexpress.py
|
||||
Versatile PB
|
||||
M: Peter Maydell <[email protected]>
|
||||
L: [email protected]
|
||||
S: Odd Fixes
|
||||
S: Maintained
|
||||
F: hw/*/versatile*
|
||||
F: hw/i2c/arm_sbcon_i2c.c
|
||||
F: include/hw/i2c/arm_sbcon_i2c.h
|
||||
@@ -1021,10 +1003,9 @@ S: Maintained
|
||||
F: hw/arm/virt*
|
||||
F: include/hw/arm/virt.h
|
||||
F: docs/system/arm/virt.rst
|
||||
F: tests/functional/test_aarch64_*virt*.py
|
||||
F: tests/functional/test_aarch64_virt.py
|
||||
F: tests/functional/test_aarch64_tuxrun.py
|
||||
F: tests/functional/test_arm_tuxrun.py
|
||||
F: tests/functional/test_arm_virt.py
|
||||
|
||||
Xilinx Zynq
|
||||
M: Edgar E. Iglesias <[email protected]>
|
||||
@@ -1265,7 +1246,6 @@ F: hw/m68k/mcf_intc.c
|
||||
F: hw/char/mcf_uart.c
|
||||
F: hw/net/mcf_fec.c
|
||||
F: include/hw/m68k/mcf*.h
|
||||
F: tests/functional/test_m68k_mcf5208evb.py
|
||||
|
||||
NeXTcube
|
||||
M: Thomas Huth <[email protected]>
|
||||
@@ -1359,6 +1339,7 @@ F: hw/acpi/piix4.c
|
||||
F: hw/mips/malta.c
|
||||
F: hw/pci-host/gt64120.c
|
||||
F: include/hw/southbridge/piix.h
|
||||
F: tests/avocado/linux_ssh_mips_malta.py
|
||||
F: tests/functional/test_mips*_malta.py
|
||||
F: tests/functional/test_mips*_tuxrun.py
|
||||
|
||||
@@ -1410,10 +1391,15 @@ S: Maintained
|
||||
F: docs/system/openrisc/or1k-sim.rst
|
||||
F: hw/intc/ompic.c
|
||||
F: hw/openrisc/openrisc_sim.c
|
||||
F: tests/functional/test_or1k_sim.py
|
||||
|
||||
PowerPC Machines
|
||||
----------------
|
||||
405 (ref405ep)
|
||||
L: [email protected]
|
||||
S: Orphan
|
||||
F: hw/ppc/ppc405*
|
||||
F: tests/functional/test_ppc_405.py
|
||||
|
||||
Bamboo
|
||||
L: [email protected]
|
||||
S: Orphan
|
||||
@@ -1544,7 +1530,6 @@ F: include/hw/ppc/pnv*
|
||||
F: include/hw/pci-host/pnv*
|
||||
F: include/hw/ssi/pnv_spi*
|
||||
F: pc-bios/skiboot.lid
|
||||
F: pc-bios/pnv-pnor.bin
|
||||
F: tests/qtest/pnv*
|
||||
F: tests/functional/test_ppc64_powernv.py
|
||||
|
||||
@@ -1577,7 +1562,6 @@ F: pc-bios/canyonlands.dt[sb]
|
||||
F: pc-bios/u-boot-sam460ex-20100605.bin
|
||||
F: roms/u-boot-sam460ex
|
||||
F: docs/system/ppc/amigang.rst
|
||||
F: tests/functional/test_ppc_sam460ex.py
|
||||
|
||||
pegasos2
|
||||
M: BALATON Zoltan <[email protected]>
|
||||
@@ -1619,6 +1603,7 @@ F: include/hw/riscv/opentitan.h
|
||||
F: include/hw/*/ibex_*.h
|
||||
|
||||
Microchip PolarFire SoC Icicle Kit
|
||||
M: Bin Meng <[email protected]>
|
||||
L: [email protected]
|
||||
S: Supported
|
||||
F: docs/system/riscv/microchip-icicle-kit.rst
|
||||
@@ -1645,6 +1630,7 @@ F: include/hw/char/shakti_uart.h
|
||||
|
||||
SiFive Machines
|
||||
M: Alistair Francis <[email protected]>
|
||||
M: Bin Meng <[email protected]>
|
||||
M: Palmer Dabbelt <[email protected]>
|
||||
L: [email protected]
|
||||
S: Supported
|
||||
@@ -1832,7 +1818,6 @@ F: include/hw/isa/apm.h
|
||||
F: tests/unit/test-x86-topo.c
|
||||
F: tests/qtest/test-x86-cpuid-compat.c
|
||||
F: tests/functional/test_i386_tuxrun.py
|
||||
F: tests/functional/test_linux_initrd.py
|
||||
F: tests/functional/test_mem_addr_space.py
|
||||
F: tests/functional/test_pc_cpu_hotplug_props.py
|
||||
F: tests/functional/test_x86_64_tuxrun.py
|
||||
@@ -2009,11 +1994,10 @@ F: include/hw/hyperv/vmbus*.h
|
||||
OMAP
|
||||
M: Peter Maydell <[email protected]>
|
||||
L: [email protected]
|
||||
S: Odd Fixes
|
||||
S: Maintained
|
||||
F: hw/*/omap*
|
||||
F: include/hw/arm/omap.h
|
||||
F: docs/system/arm/sx1.rst
|
||||
F: tests/functional/test_arm_sx1.py
|
||||
|
||||
IPack
|
||||
M: Alberto Garcia <[email protected]>
|
||||
@@ -2079,7 +2063,7 @@ S: Supported
|
||||
F: hw/acpi/viot.c
|
||||
F: hw/acpi/viot.h
|
||||
|
||||
ACPI/FUNCTIONAL/BIOSBITS
|
||||
ACPI/AVOCADO/BIOSBITS
|
||||
M: Ani Sinha <[email protected]>
|
||||
M: Michael S. Tsirkin <[email protected]>
|
||||
S: Supported
|
||||
@@ -2190,17 +2174,10 @@ M: Cédric Le Goater <[email protected]>
|
||||
S: Supported
|
||||
F: hw/vfio/*
|
||||
F: include/hw/vfio/
|
||||
F: docs/igd-assign.txt
|
||||
F: docs/devel/migration/vfio.rst
|
||||
F: qapi/vfio.json
|
||||
|
||||
vfio-igd
|
||||
M: Alex Williamson <[email protected]>
|
||||
M: Cédric Le Goater <[email protected]>
|
||||
M: Tomita Moeko <[email protected]>
|
||||
S: Supported
|
||||
F: hw/vfio/igd.c
|
||||
F: docs/igd-assign.txt
|
||||
|
||||
vfio-ccw
|
||||
M: Eric Farman <[email protected]>
|
||||
M: Matthew Rosato <[email protected]>
|
||||
@@ -2242,16 +2219,12 @@ M: Michael S. Tsirkin <[email protected]>
|
||||
R: Stefano Garzarella <[email protected]>
|
||||
S: Supported
|
||||
F: hw/*/*vhost*
|
||||
F: docs/interop/vhost-user*
|
||||
F: docs/system/devices/vhost-user*
|
||||
F: docs/interop/vhost-user.json
|
||||
F: docs/interop/vhost-user.rst
|
||||
F: contrib/vhost-user-*/
|
||||
F: backends/*vhost*
|
||||
F: backends/vhost-user.c
|
||||
F: include/system/vhost-user-backend.h
|
||||
F: include/hw/virtio/vhost*
|
||||
F: include/*/vhost*
|
||||
F: subprojects/libvhost-user/
|
||||
F: block/export/vhost-user*
|
||||
F: util/vhost-user-server.c
|
||||
|
||||
vhost-shadow-virtqueue
|
||||
R: Eugenio Pérez <[email protected]>
|
||||
@@ -2280,7 +2253,6 @@ F: include/hw/virtio/virtio-balloon.h
|
||||
F: system/balloon.c
|
||||
F: include/system/balloon.h
|
||||
F: tests/qtest/virtio-balloon-test.c
|
||||
F: tests/functional/test_virtio_balloon.py
|
||||
|
||||
virtio-9p
|
||||
M: Christian Schoenebeck <[email protected]>
|
||||
@@ -2303,7 +2275,6 @@ F: hw/block/virtio-blk.c
|
||||
F: hw/block/dataplane/*
|
||||
F: include/hw/virtio/virtio-blk-common.h
|
||||
F: tests/qtest/virtio-blk-test.c
|
||||
F: tests/functional/test_x86_64_hotplug_blk.py
|
||||
T: git https://github.com/stefanha/qemu.git block
|
||||
|
||||
virtio-ccw
|
||||
@@ -2550,7 +2521,8 @@ F: hw/i2c/i2c_mux_pca954x.c
|
||||
F: include/hw/i2c/i2c_mux_pca954x.h
|
||||
|
||||
pcf8574
|
||||
S: Orphaned
|
||||
M: Dmitrii Sharikhin <[email protected]>
|
||||
S: Maintained
|
||||
F: hw/gpio/pcf8574.c
|
||||
F: include/gpio/pcf8574.h
|
||||
|
||||
@@ -2567,7 +2539,7 @@ M: Alex Bennée <[email protected]>
|
||||
S: Maintained
|
||||
F: hw/core/guest-loader.c
|
||||
F: docs/system/guest-loader.rst
|
||||
F: tests/functional/test_aarch64_xen.py
|
||||
F: tests/avocado/boot_xen.py
|
||||
|
||||
Intel Hexadecimal Object File Loader
|
||||
M: Su Hang <[email protected]>
|
||||
@@ -2633,7 +2605,6 @@ F: hw/display/virtio-gpu*
|
||||
F: hw/display/virtio-vga.*
|
||||
F: include/hw/virtio/virtio-gpu.h
|
||||
F: docs/system/devices/virtio-gpu.rst
|
||||
F: tests/functional/test_aarch64_virt_gpu.py
|
||||
|
||||
vhost-user-blk
|
||||
M: Raphael Norwitz <[email protected]>
|
||||
@@ -2828,20 +2799,6 @@ F: hw/misc/ivshmem-flat.c
|
||||
F: include/hw/misc/ivshmem-flat.h
|
||||
F: docs/system/devices/ivshmem-flat.rst
|
||||
|
||||
UEFI variable service
|
||||
M: Gerd Hoffmann <[email protected]>
|
||||
S: Maintained
|
||||
F: hw/uefi/
|
||||
F: include/hw/uefi/
|
||||
|
||||
VMapple
|
||||
M: Alexander Graf <[email protected]>
|
||||
M: Phil Dennis-Jordan <[email protected]>
|
||||
S: Maintained
|
||||
F: hw/vmapple/*
|
||||
F: include/hw/vmapple/*
|
||||
F: docs/system/arm/vmapple.rst
|
||||
|
||||
Subsystems
|
||||
----------
|
||||
Overall Audio backends
|
||||
@@ -3156,7 +3113,6 @@ F: include/ui/
|
||||
F: qapi/ui.json
|
||||
F: util/drm.c
|
||||
F: docs/devel/ui.rst
|
||||
F: tests/functional/test_vnc.py
|
||||
|
||||
Cocoa graphics
|
||||
M: Peter Maydell <[email protected]>
|
||||
@@ -3279,6 +3235,8 @@ S: Supported
|
||||
F: qapi/
|
||||
X: qapi/*.json
|
||||
F: include/qapi/
|
||||
X: include/qapi/qmp/
|
||||
F: include/qapi/qmp/dispatch.h
|
||||
F: tests/qapi-schema/
|
||||
F: tests/unit/test-*-visitor.c
|
||||
F: tests/unit/test-qapi-*.c
|
||||
@@ -3302,7 +3260,8 @@ QObject
|
||||
M: Markus Armbruster <[email protected]>
|
||||
S: Supported
|
||||
F: qobject/
|
||||
F: include/qobject/
|
||||
F: include/qapi/qmp/
|
||||
X: include/qapi/qmp/dispatch.h
|
||||
F: scripts/coccinelle/qobject.cocci
|
||||
F: tests/unit/check-qdict.c
|
||||
F: tests/unit/check-qjson.c
|
||||
@@ -3427,7 +3386,6 @@ F: rust/rustfmt.toml
|
||||
|
||||
Rust-related patches CC here
|
||||
L: [email protected]
|
||||
F: tests/docker/test-rust
|
||||
F: rust/
|
||||
|
||||
SLIRP
|
||||
@@ -3663,10 +3621,10 @@ F: net/filter-mirror.c
|
||||
F: tests/qtest/test-filter*
|
||||
|
||||
Record/replay
|
||||
M: Pavel Dovgalyuk <[email protected]>
|
||||
R: Paolo Bonzini <[email protected]>
|
||||
R: Alex Bennée <[email protected]>
|
||||
W: https://wiki.qemu.org/Features/record-replay
|
||||
S: Odd Fixes
|
||||
S: Supported
|
||||
F: replay/*
|
||||
F: block/blkreplay.c
|
||||
F: net/filter-replay.c
|
||||
@@ -3675,7 +3633,9 @@ F: include/system/replay.h
|
||||
F: docs/devel/replay.rst
|
||||
F: docs/system/replay.rst
|
||||
F: stubs/replay.c
|
||||
F: tests/functional/*reverse_debug*.py
|
||||
F: tests/avocado/replay_kernel.py
|
||||
F: tests/avocado/replay_linux.py
|
||||
F: tests/avocado/reverse_debugging.py
|
||||
F: tests/functional/*replay*.py
|
||||
F: qapi/replay.json
|
||||
|
||||
@@ -3766,10 +3726,9 @@ F: tests/qtest/intel-iommu-test.c
|
||||
AMD-Vi Emulation
|
||||
S: Orphan
|
||||
F: hw/i386/amd_iommu.?
|
||||
F: tests/qtest/amd-iommu-test.c
|
||||
|
||||
OpenSBI Firmware
|
||||
L: [email protected]
|
||||
M: Bin Meng <[email protected]>
|
||||
S: Supported
|
||||
F: pc-bios/opensbi-*
|
||||
F: .gitlab-ci.d/opensbi.yml
|
||||
@@ -3802,7 +3761,6 @@ Overall usermode emulation
|
||||
M: Riku Voipio <[email protected]>
|
||||
S: Maintained
|
||||
F: accel/tcg/user-exec*.c
|
||||
F: hw/core/cpu-user.c
|
||||
F: include/user/
|
||||
F: common-user/
|
||||
|
||||
@@ -3823,7 +3781,6 @@ F: configs/targets/*linux-user.mak
|
||||
F: scripts/qemu-binfmt-conf.sh
|
||||
F: scripts/update-syscalltbl.sh
|
||||
F: scripts/update-mips-syscall-args.sh
|
||||
F: tests/functional/test_arm_bflt.py
|
||||
|
||||
Tiny Code Generator (TCG)
|
||||
-------------------------
|
||||
@@ -4196,7 +4153,6 @@ F: hw/remote/vfio-user-obj.c
|
||||
F: include/hw/remote/vfio-user-obj.h
|
||||
F: hw/remote/iommu.c
|
||||
F: include/hw/remote/iommu.h
|
||||
F: tests/functional/test_multiprocess.py
|
||||
|
||||
EBPF:
|
||||
M: Jason Wang <[email protected]>
|
||||
@@ -4242,7 +4198,6 @@ Functional testing framework
|
||||
M: Thomas Huth <[email protected]>
|
||||
R: Philippe Mathieu-Daudé <[email protected]>
|
||||
R: Daniel P. Berrange <[email protected]>
|
||||
F: docs/devel/testing/functional.rst
|
||||
F: tests/functional/qemu_test/
|
||||
|
||||
Windows Hosted Continuous Integration
|
||||
@@ -4256,6 +4211,12 @@ R: Philippe Mathieu-Daudé <[email protected]>
|
||||
S: Maintained
|
||||
F: tests/tcg/Makefile.target
|
||||
|
||||
Integration Testing with the Avocado framework
|
||||
W: https://trello.com/b/6Qi1pxVn/avocado-qemu
|
||||
R: Cleber Rosa <[email protected]>
|
||||
S: Odd Fixes
|
||||
F: tests/avocado/
|
||||
|
||||
GitLab custom runner (Works On Arm Sponsored)
|
||||
M: Alex Bennée <[email protected]>
|
||||
M: Philippe Mathieu-Daudé <[email protected]>
|
||||
@@ -4324,7 +4285,6 @@ S: Orphan
|
||||
F: po/*.po
|
||||
|
||||
Sphinx documentation configuration and build machinery
|
||||
M: John Snow <[email protected]>
|
||||
M: Peter Maydell <[email protected]>
|
||||
S: Maintained
|
||||
F: docs/conf.py
|
||||
|
||||
@@ -207,10 +207,10 @@ clean: recurse-clean
|
||||
|
||||
VERSION = $(shell cat $(SRC_PATH)/VERSION)
|
||||
|
||||
dist: qemu-$(VERSION).tar.xz
|
||||
dist: qemu-$(VERSION).tar.bz2
|
||||
|
||||
qemu-%.tar.xz:
|
||||
$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.xz,%,$@)"
|
||||
qemu-%.tar.bz2:
|
||||
$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
|
||||
|
||||
distclean: clean recurse-distclean
|
||||
-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || :
|
||||
|
||||
@@ -16,5 +16,4 @@ config KVM
|
||||
config XEN
|
||||
bool
|
||||
select FSDEV_9P if VIRTFS
|
||||
select PCI_EXPRESS_GENERIC_BRIDGE
|
||||
select XEN_BUS
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "hw/boards.h"
|
||||
#include "system/accel-ops.h"
|
||||
#include "system/cpus.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "accel-system.h"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "qemu/accel.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "accel/accel-cpu-target.h"
|
||||
#include "hw/core/accel-cpu.h"
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#include "accel-system.h"
|
||||
@@ -38,7 +38,6 @@ static const TypeInfo accel_type = {
|
||||
.parent = TYPE_OBJECT,
|
||||
.class_size = sizeof(AccelClass),
|
||||
.instance_size = sizeof(AccelState),
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
/* Lookup AccelClass from opt_name. Returns NULL if not found */
|
||||
@@ -113,20 +112,22 @@ void accel_init_interfaces(AccelClass *ac)
|
||||
|
||||
void accel_cpu_instance_init(CPUState *cpu)
|
||||
{
|
||||
if (cpu->cc->accel_cpu && cpu->cc->accel_cpu->cpu_instance_init) {
|
||||
cpu->cc->accel_cpu->cpu_instance_init(cpu);
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
|
||||
if (cc->accel_cpu && cc->accel_cpu->cpu_instance_init) {
|
||||
cc->accel_cpu->cpu_instance_init(cpu);
|
||||
}
|
||||
}
|
||||
|
||||
bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
|
||||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
AccelState *accel = current_accel();
|
||||
AccelClass *acc = ACCEL_GET_CLASS(accel);
|
||||
|
||||
/* target specific realization */
|
||||
if (cpu->cc->accel_cpu
|
||||
&& cpu->cc->accel_cpu->cpu_target_realize
|
||||
&& !cpu->cc->accel_cpu->cpu_target_realize(cpu, errp)) {
|
||||
if (cc->accel_cpu && cc->accel_cpu->cpu_target_realize
|
||||
&& !cc->accel_cpu->cpu_target_realize(cpu, errp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include "exec/exec-all.h"
|
||||
#include "gdbstub/enums.h"
|
||||
#include "hw/boards.h"
|
||||
#include "system/accel-ops.h"
|
||||
#include "system/cpus.h"
|
||||
#include "system/hvf.h"
|
||||
#include "system/hvf_int.h"
|
||||
@@ -347,7 +346,7 @@ static int hvf_accel_init(MachineState *ms)
|
||||
hvf_state = s;
|
||||
memory_listener_register(&hvf_memory_listener, &address_space_memory);
|
||||
|
||||
return hvf_arch_init();
|
||||
return hvf_arch_init(ms);
|
||||
}
|
||||
|
||||
static inline int hvf_gdbstub_sstep_flags(void)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "system/accel-ops.h"
|
||||
#include "system/kvm.h"
|
||||
#include "system/kvm_int.h"
|
||||
#include "system/runstate.h"
|
||||
|
||||
+8
-9
@@ -437,8 +437,9 @@ int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
|
||||
return kvm_fd;
|
||||
}
|
||||
|
||||
static void kvm_reset_parked_vcpus(KVMState *s)
|
||||
static void kvm_reset_parked_vcpus(void *param)
|
||||
{
|
||||
KVMState *s = param;
|
||||
struct KVMParkedVcpu *cpu;
|
||||
|
||||
QLIST_FOREACH(cpu, &s->kvm_parked_vcpus, node) {
|
||||
@@ -1287,7 +1288,7 @@ static void kvm_unpoison_all(void *param)
|
||||
|
||||
QLIST_FOREACH_SAFE(page, &hwpoison_page_list, list, next_page) {
|
||||
QLIST_REMOVE(page, list);
|
||||
qemu_ram_remap(page->ram_addr);
|
||||
qemu_ram_remap(page->ram_addr, TARGET_PAGE_SIZE);
|
||||
g_free(page);
|
||||
}
|
||||
}
|
||||
@@ -2556,7 +2557,8 @@ static int kvm_init(MachineState *ms)
|
||||
{
|
||||
MachineClass *mc = MACHINE_GET_CLASS(ms);
|
||||
static const char upgrade_note[] =
|
||||
"Please upgrade to at least kernel 4.5.\n";
|
||||
"Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n"
|
||||
"(see http://sourceforge.net/projects/kvm).\n";
|
||||
const struct {
|
||||
const char *name;
|
||||
int num;
|
||||
@@ -2736,6 +2738,7 @@ static int kvm_init(MachineState *ms)
|
||||
}
|
||||
|
||||
qemu_register_reset(kvm_unpoison_all, NULL);
|
||||
qemu_register_reset(kvm_reset_parked_vcpus, s);
|
||||
|
||||
if (s->kernel_irqchip_allowed) {
|
||||
kvm_irqchip_create(s);
|
||||
@@ -2905,10 +2908,6 @@ static void do_kvm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg
|
||||
void kvm_cpu_synchronize_post_reset(CPUState *cpu)
|
||||
{
|
||||
run_on_cpu(cpu, do_kvm_cpu_synchronize_post_reset, RUN_ON_CPU_NULL);
|
||||
|
||||
if (cpu == first_cpu) {
|
||||
kvm_reset_parked_vcpus(kvm_state);
|
||||
}
|
||||
}
|
||||
|
||||
static void do_kvm_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg)
|
||||
@@ -3322,10 +3321,10 @@ int kvm_vm_ioctl(KVMState *s, unsigned long type, ...)
|
||||
trace_kvm_vm_ioctl(type, arg);
|
||||
accel_ioctl_begin();
|
||||
ret = ioctl(s->vmfd, type, arg);
|
||||
accel_ioctl_end();
|
||||
if (ret == -1) {
|
||||
ret = -errno;
|
||||
}
|
||||
accel_ioctl_end();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3362,10 +3361,10 @@ int kvm_device_ioctl(int fd, unsigned long type, ...)
|
||||
trace_kvm_device_ioctl(fd, type, arg);
|
||||
accel_ioctl_begin();
|
||||
ret = ioctl(fd, type, arg);
|
||||
accel_ioctl_end();
|
||||
if (ret == -1) {
|
||||
ret = -errno;
|
||||
}
|
||||
accel_ioctl_end();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#ifndef KVM_CPUS_H
|
||||
#define KVM_CPUS_H
|
||||
|
||||
#include "system/cpus.h"
|
||||
|
||||
int kvm_init_vcpu(CPUState *cpu, Error **errp);
|
||||
int kvm_cpu_exec(CPUState *cpu);
|
||||
void kvm_destroy_vcpu(CPUState *cpu);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "system/accel-ops.h"
|
||||
#include "system/qtest.h"
|
||||
#include "system/cpus.h"
|
||||
#include "qemu/guest-random.h"
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
#include "exec/tb-flush.h"
|
||||
#include "exec/exec-all.h"
|
||||
|
||||
void tb_flush(CPUState *cpu)
|
||||
{
|
||||
}
|
||||
|
||||
G_NORETURN void cpu_loop_exit(CPUState *cpu)
|
||||
{
|
||||
g_assert_not_reached();
|
||||
|
||||
@@ -18,45 +18,13 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "exec/log.h"
|
||||
#include "system/cpus.h"
|
||||
#include "system/tcg.h"
|
||||
#include "qemu/plugin.h"
|
||||
#include "internal-common.h"
|
||||
|
||||
bool tcg_allowed;
|
||||
|
||||
bool tcg_cflags_has(CPUState *cpu, uint32_t flags)
|
||||
{
|
||||
return cpu->tcg_cflags & flags;
|
||||
}
|
||||
|
||||
void tcg_cflags_set(CPUState *cpu, uint32_t flags)
|
||||
{
|
||||
cpu->tcg_cflags |= flags;
|
||||
}
|
||||
|
||||
uint32_t curr_cflags(CPUState *cpu)
|
||||
{
|
||||
uint32_t cflags = cpu->tcg_cflags;
|
||||
|
||||
/*
|
||||
* Record gdb single-step. We should be exiting the TB by raising
|
||||
* EXCP_DEBUG, but to simplify other tests, disable chaining too.
|
||||
*
|
||||
* For singlestep and -d nochain, suppress goto_tb so that
|
||||
* we can log -d cpu,exec after every TB.
|
||||
*/
|
||||
if (unlikely(cpu->singlestep_enabled)) {
|
||||
cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
|
||||
} else if (qatomic_read(&one_insn_per_tb)) {
|
||||
cflags |= CF_NO_GOTO_TB | 1;
|
||||
} else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
|
||||
cflags |= CF_NO_GOTO_TB;
|
||||
}
|
||||
|
||||
return cflags;
|
||||
}
|
||||
|
||||
/* exit the current TB, but without causing any exception to be raised */
|
||||
void cpu_loop_exit_noexc(CPUState *cpu)
|
||||
{
|
||||
|
||||
+59
-11
@@ -22,7 +22,7 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/type-helpers.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "accel/tcg/cpu-ops.h"
|
||||
#include "hw/core/tcg-cpu-ops.h"
|
||||
#include "trace.h"
|
||||
#include "disas/disas.h"
|
||||
#include "exec/cpu-common.h"
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "qemu/rcu.h"
|
||||
#include "exec/log.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "system/cpus.h"
|
||||
#include "exec/cpu-all.h"
|
||||
#include "system/cpu-timers.h"
|
||||
#include "exec/replay-core.h"
|
||||
@@ -147,6 +148,38 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu)
|
||||
}
|
||||
#endif /* CONFIG USER ONLY */
|
||||
|
||||
bool tcg_cflags_has(CPUState *cpu, uint32_t flags)
|
||||
{
|
||||
return cpu->tcg_cflags & flags;
|
||||
}
|
||||
|
||||
void tcg_cflags_set(CPUState *cpu, uint32_t flags)
|
||||
{
|
||||
cpu->tcg_cflags |= flags;
|
||||
}
|
||||
|
||||
uint32_t curr_cflags(CPUState *cpu)
|
||||
{
|
||||
uint32_t cflags = cpu->tcg_cflags;
|
||||
|
||||
/*
|
||||
* Record gdb single-step. We should be exiting the TB by raising
|
||||
* EXCP_DEBUG, but to simplify other tests, disable chaining too.
|
||||
*
|
||||
* For singlestep and -d nochain, suppress goto_tb so that
|
||||
* we can log -d cpu,exec after every TB.
|
||||
*/
|
||||
if (unlikely(cpu->singlestep_enabled)) {
|
||||
cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
|
||||
} else if (qatomic_read(&one_insn_per_tb)) {
|
||||
cflags |= CF_NO_GOTO_TB | 1;
|
||||
} else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
|
||||
cflags |= CF_NO_GOTO_TB;
|
||||
}
|
||||
|
||||
return cflags;
|
||||
}
|
||||
|
||||
struct tb_desc {
|
||||
vaddr pc;
|
||||
uint64_t cs_base;
|
||||
@@ -316,7 +349,7 @@ static bool check_for_breakpoints_slow(CPUState *cpu, vaddr pc,
|
||||
* so that one could (gdb) singlestep into the guest kernel's
|
||||
* architectural breakpoint handler.
|
||||
*/
|
||||
if (cpu->singlestep_enabled) {
|
||||
if (cpu->singlestep_enabled && !(cpu->singlestep_enabled & SSTEP_NODEBUG)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -496,7 +529,11 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
|
||||
* is handled in cpu_handle_exception.
|
||||
*/
|
||||
if (unlikely(cpu->singlestep_enabled) && cpu->exception_index == -1) {
|
||||
cpu->exception_index = EXCP_DEBUG;
|
||||
if (!(cpu->singlestep_enabled & SSTEP_NODEBUG)) {
|
||||
cpu->exception_index = EXCP_DEBUG;
|
||||
} else {
|
||||
cpu->exception_index = EXCP_SINGLESTEP;
|
||||
}
|
||||
cpu_loop_exit(cpu);
|
||||
}
|
||||
|
||||
@@ -748,13 +785,20 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
|
||||
cpu->exception_index = -1;
|
||||
|
||||
if (unlikely(cpu->singlestep_enabled)) {
|
||||
/*
|
||||
* After processing the exception, ensure an EXCP_DEBUG is
|
||||
* raised when single-stepping so that GDB doesn't miss the
|
||||
* next instruction.
|
||||
*/
|
||||
*ret = EXCP_DEBUG;
|
||||
cpu_handle_debug_exception(cpu);
|
||||
if (!(cpu->singlestep_enabled & SSTEP_NODEBUG)) {
|
||||
/*
|
||||
* After processing the exception, ensure an EXCP_DEBUG is
|
||||
* raised when single-stepping so that GDB doesn't miss the
|
||||
* next instruction.
|
||||
*/
|
||||
*ret = EXCP_DEBUG;
|
||||
cpu_handle_debug_exception(cpu);
|
||||
} else {
|
||||
/*
|
||||
* In case of non-debug single step, just return
|
||||
*/
|
||||
*ret = EXCP_SINGLESTEP;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if (!replay_has_interrupt()) {
|
||||
@@ -859,7 +903,11 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
|
||||
* next instruction.
|
||||
*/
|
||||
if (unlikely(cpu->singlestep_enabled)) {
|
||||
cpu->exception_index = EXCP_DEBUG;
|
||||
if (!(cpu->singlestep_enabled & SSTEP_NODEBUG)) {
|
||||
cpu->exception_index = EXCP_DEBUG;
|
||||
} else {
|
||||
cpu->exception_index = EXCP_SINGLESTEP;
|
||||
}
|
||||
bql_unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
+27
-30
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "accel/tcg/cpu-ops.h"
|
||||
#include "hw/core/tcg-cpu-ops.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/page-protection.h"
|
||||
#include "exec/memory.h"
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "qemu/plugin-memory.h"
|
||||
#endif
|
||||
#include "tcg/tcg-ldst.h"
|
||||
#include "tcg/oversized-guest.h"
|
||||
|
||||
/* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */
|
||||
/* #define DEBUG_TLB */
|
||||
@@ -104,15 +105,26 @@ static inline uint64_t tlb_read_idx(const CPUTLBEntry *entry,
|
||||
{
|
||||
/* Do not rearrange the CPUTLBEntry structure members. */
|
||||
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_read) !=
|
||||
MMU_DATA_LOAD * sizeof(uintptr_t));
|
||||
MMU_DATA_LOAD * sizeof(uint64_t));
|
||||
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_write) !=
|
||||
MMU_DATA_STORE * sizeof(uintptr_t));
|
||||
MMU_DATA_STORE * sizeof(uint64_t));
|
||||
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_code) !=
|
||||
MMU_INST_FETCH * sizeof(uintptr_t));
|
||||
MMU_INST_FETCH * sizeof(uint64_t));
|
||||
|
||||
const uintptr_t *ptr = &entry->addr_idx[access_type];
|
||||
#if TARGET_LONG_BITS == 32
|
||||
/* Use qatomic_read, in case of addr_write; only care about low bits. */
|
||||
const uint32_t *ptr = (uint32_t *)&entry->addr_idx[access_type];
|
||||
ptr += HOST_BIG_ENDIAN;
|
||||
return qatomic_read(ptr);
|
||||
#else
|
||||
const uint64_t *ptr = &entry->addr_idx[access_type];
|
||||
# if TCG_OVERSIZED_GUEST
|
||||
return *ptr;
|
||||
# else
|
||||
/* ofs might correspond to .addr_write, so use qatomic_read */
|
||||
return qatomic_read(ptr);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline uint64_t tlb_addr_write(const CPUTLBEntry *entry)
|
||||
@@ -892,8 +904,16 @@ static void tlb_reset_dirty_range_locked(CPUTLBEntry *tlb_entry,
|
||||
addr &= TARGET_PAGE_MASK;
|
||||
addr += tlb_entry->addend;
|
||||
if ((addr - start) < length) {
|
||||
#if TARGET_LONG_BITS == 32
|
||||
uint32_t *ptr_write = (uint32_t *)&tlb_entry->addr_write;
|
||||
ptr_write += HOST_BIG_ENDIAN;
|
||||
qatomic_set(ptr_write, *ptr_write | TLB_NOTDIRTY);
|
||||
#elif TCG_OVERSIZED_GUEST
|
||||
tlb_entry->addr_write |= TLB_NOTDIRTY;
|
||||
#else
|
||||
qatomic_set(&tlb_entry->addr_write,
|
||||
tlb_entry->addr_write | TLB_NOTDIRTY);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1180,7 +1200,7 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx,
|
||||
|
||||
void tlb_set_page_with_attrs(CPUState *cpu, vaddr addr,
|
||||
hwaddr paddr, MemTxAttrs attrs, int prot,
|
||||
int mmu_idx, vaddr size)
|
||||
int mmu_idx, uint64_t size)
|
||||
{
|
||||
CPUTLBEntryFull full = {
|
||||
.phys_addr = paddr,
|
||||
@@ -1195,35 +1215,12 @@ void tlb_set_page_with_attrs(CPUState *cpu, vaddr addr,
|
||||
|
||||
void tlb_set_page(CPUState *cpu, vaddr addr,
|
||||
hwaddr paddr, int prot,
|
||||
int mmu_idx, vaddr size)
|
||||
int mmu_idx, uint64_t size)
|
||||
{
|
||||
tlb_set_page_with_attrs(cpu, addr, paddr, MEMTXATTRS_UNSPECIFIED,
|
||||
prot, mmu_idx, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* tlb_hit_page: return true if page aligned @addr is a hit against the
|
||||
* TLB entry @tlb_addr
|
||||
*
|
||||
* @addr: virtual address to test (must be page aligned)
|
||||
* @tlb_addr: TLB entry address (a CPUTLBEntry addr_read/write/code value)
|
||||
*/
|
||||
static inline bool tlb_hit_page(uint64_t tlb_addr, vaddr addr)
|
||||
{
|
||||
return addr == (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK));
|
||||
}
|
||||
|
||||
/**
|
||||
* tlb_hit: return true if @addr is a hit against the TLB entry @tlb_addr
|
||||
*
|
||||
* @addr: virtual address to test (need not be page aligned)
|
||||
* @tlb_addr: TLB entry address (a CPUTLBEntry addr_read/write/code value)
|
||||
*/
|
||||
static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr)
|
||||
{
|
||||
return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: tlb_fill_align() can trigger a resize of the TLB.
|
||||
* This means that all of the caller's prior references to the TLB table
|
||||
|
||||
@@ -48,8 +48,6 @@ static bool icount_sleep = true;
|
||||
/* Arbitrarily pick 1MIPS as the minimum allowable speed. */
|
||||
#define MAX_ICOUNT_SHIFT 10
|
||||
|
||||
bool icount_align_option;
|
||||
|
||||
/* Do not count executed instructions */
|
||||
ICountMode use_icount = ICOUNT_DISABLED;
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@ extern int64_t max_advance;
|
||||
|
||||
extern bool one_insn_per_tb;
|
||||
|
||||
extern bool icount_align_option;
|
||||
|
||||
/*
|
||||
* Return true if CS is not running in parallel with other cpus, either
|
||||
* because there are no other cpus or we are within an exclusive context.
|
||||
@@ -55,23 +53,10 @@ TranslationBlock *tb_link_page(TranslationBlock *tb);
|
||||
void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb,
|
||||
uintptr_t host_pc);
|
||||
|
||||
/**
|
||||
* tlb_init - initialize a CPU's TLB
|
||||
* @cpu: CPU whose TLB should be initialized
|
||||
*/
|
||||
void tlb_init(CPUState *cpu);
|
||||
/**
|
||||
* tlb_destroy - destroy a CPU's TLB
|
||||
* @cpu: CPU whose TLB should be destroyed
|
||||
*/
|
||||
void tlb_destroy(CPUState *cpu);
|
||||
|
||||
bool tcg_exec_realizefn(CPUState *cpu, Error **errp);
|
||||
void tcg_exec_unrealizefn(CPUState *cpu);
|
||||
|
||||
/* current cflags for hashing/comparison */
|
||||
uint32_t curr_cflags(CPUState *cpu);
|
||||
|
||||
void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr);
|
||||
|
||||
#endif
|
||||
@@ -1,13 +1,13 @@
|
||||
common_ss.add(when: 'CONFIG_TCG', if_true: files(
|
||||
'cpu-exec-common.c',
|
||||
'tcg-runtime.c',
|
||||
'tcg-runtime-gvec.c',
|
||||
))
|
||||
tcg_specific_ss = ss.source_set()
|
||||
tcg_specific_ss.add(files(
|
||||
'tcg-all.c',
|
||||
'cpu-exec.c',
|
||||
'tb-maint.c',
|
||||
'tcg-runtime-gvec.c',
|
||||
'tcg-runtime.c',
|
||||
'translate-all.c',
|
||||
'translator.c',
|
||||
))
|
||||
@@ -20,14 +20,17 @@ specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_specific_ss)
|
||||
|
||||
specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files(
|
||||
'cputlb.c',
|
||||
'watchpoint.c',
|
||||
))
|
||||
|
||||
system_ss.add(when: ['CONFIG_TCG'], if_true: files(
|
||||
'icount-common.c',
|
||||
'monitor.c',
|
||||
))
|
||||
|
||||
tcg_module_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files(
|
||||
'tcg-accel-ops.c',
|
||||
'tcg-accel-ops-mttcg.c',
|
||||
'tcg-accel-ops-icount.c',
|
||||
'tcg-accel-ops-mttcg.c',
|
||||
'tcg-accel-ops-rr.c',
|
||||
'watchpoint.c',
|
||||
))
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "qapi/type-helpers.h"
|
||||
#include "qapi/qapi-commands-machine.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "system/cpus.h"
|
||||
#include "system/cpu-timers.h"
|
||||
#include "system/tcg.h"
|
||||
#include "tcg/tcg.h"
|
||||
|
||||
@@ -388,6 +388,10 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db)
|
||||
{
|
||||
struct qemu_plugin_tb *ptb;
|
||||
|
||||
if (cpu->emulation_enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS,
|
||||
cpu->plugin_state->event_mask)) {
|
||||
return false;
|
||||
|
||||
+2
-38
@@ -13,44 +13,6 @@
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/translation-block.h"
|
||||
|
||||
/*
|
||||
* The true return address will often point to a host insn that is part of
|
||||
* the next translated guest insn. Adjust the address backward to point to
|
||||
* the middle of the call insn. Subtracting one would do the job except for
|
||||
* several compressed mode architectures (arm, mips) which set the low bit
|
||||
* to indicate the compressed mode; subtracting two works around that. It
|
||||
* is also the case that there are no host isas that contain a call insn
|
||||
* smaller than 4 bytes, so we don't worry about special-casing this.
|
||||
*/
|
||||
#define GETPC_ADJ 2
|
||||
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
|
||||
#define CPU_TLB_DYN_MIN_BITS 6
|
||||
#define CPU_TLB_DYN_DEFAULT_BITS 8
|
||||
|
||||
# if HOST_LONG_BITS == 32
|
||||
/* Make sure we do not require a double-word shift for the TLB load */
|
||||
# define CPU_TLB_DYN_MAX_BITS (32 - TARGET_PAGE_BITS)
|
||||
# else /* HOST_LONG_BITS == 64 */
|
||||
/*
|
||||
* Assuming TARGET_PAGE_BITS==12, with 2**22 entries we can cover 2**(22+12) ==
|
||||
* 2**34 == 16G of address space. This is roughly what one would expect a
|
||||
* TLB to cover in a modern (as of 2018) x86_64 CPU. For instance, Intel
|
||||
* Skylake's Level-2 STLB has 16 1G entries.
|
||||
* Also, make sure we do not size the TLB past the guest's address space.
|
||||
*/
|
||||
# ifdef TARGET_PAGE_BITS_VARY
|
||||
# define CPU_TLB_DYN_MAX_BITS \
|
||||
MIN(22, TARGET_VIRT_ADDR_SPACE_BITS - TARGET_PAGE_BITS)
|
||||
# else
|
||||
# define CPU_TLB_DYN_MAX_BITS \
|
||||
MIN_CONST(22, TARGET_VIRT_ADDR_SPACE_BITS - TARGET_PAGE_BITS)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* CONFIG_SOFTMMU */
|
||||
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
#include "user/page-protection.h"
|
||||
/*
|
||||
@@ -86,4 +48,6 @@ void tb_invalidate_phys_range_fast(ram_addr_t ram_addr,
|
||||
|
||||
bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc);
|
||||
|
||||
void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr);
|
||||
|
||||
#endif
|
||||
+29
-32
@@ -791,7 +791,7 @@ done:
|
||||
|
||||
void tb_flush(CPUState *cpu)
|
||||
{
|
||||
if (tcg_enabled()) {
|
||||
if (tcg_enabled() || unlikely(cpu->emulation_enabled)) {
|
||||
unsigned tb_flush_count = qatomic_read(&tb_ctx.tb_flush_count);
|
||||
|
||||
if (cpu_in_serial_context(cpu)) {
|
||||
@@ -839,14 +839,6 @@ static inline void tb_remove_from_jmp_list(TranslationBlock *orig, int n_orig)
|
||||
* We first acquired the lock, and since the destination pointer matches,
|
||||
* we know for sure that @orig is in the jmp list.
|
||||
*/
|
||||
if (dest == orig) {
|
||||
/*
|
||||
* In the case of a TB that links to itself, removing the entry
|
||||
* from the list means that it won't be present later during
|
||||
* tb_jmp_unlink -- unlink now.
|
||||
*/
|
||||
tb_reset_jump(orig, n_orig);
|
||||
}
|
||||
pprev = &dest->jmp_list_head;
|
||||
TB_FOR_EACH_JMP(dest, tb, n) {
|
||||
if (tb == orig && n == n_orig) {
|
||||
@@ -921,7 +913,6 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
|
||||
uint32_t orig_cflags = tb_cflags(tb);
|
||||
|
||||
assert_memory_lock();
|
||||
qemu_thread_jit_write();
|
||||
|
||||
/* make sure no further incoming jumps will be chained to this TB */
|
||||
qemu_spin_lock(&tb->jmp_lock);
|
||||
@@ -932,27 +923,33 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
|
||||
phys_pc = tb_page_addr0(tb);
|
||||
h = tb_hash_func(phys_pc, (orig_cflags & CF_PCREL ? 0 : tb->pc),
|
||||
tb->flags, tb->cs_base, orig_cflags);
|
||||
if (qht_remove(&tb_ctx.htable, tb, h)) {
|
||||
|
||||
/* remove the TB from the page list */
|
||||
if (rm_from_page_list) {
|
||||
tb_remove(tb);
|
||||
}
|
||||
|
||||
/* remove the TB from the hash list */
|
||||
tb_jmp_cache_inval_tb(tb);
|
||||
|
||||
/* suppress this TB from the two jump lists */
|
||||
tb_remove_from_jmp_list(tb, 0);
|
||||
tb_remove_from_jmp_list(tb, 1);
|
||||
|
||||
/* suppress any remaining jumps to this TB */
|
||||
tb_jmp_unlink(tb);
|
||||
|
||||
qatomic_set(&tb_ctx.tb_phys_invalidate_count,
|
||||
tb_ctx.tb_phys_invalidate_count + 1);
|
||||
if (!qht_remove(&tb_ctx.htable, tb, h)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* remove the TB from the page list */
|
||||
if (rm_from_page_list) {
|
||||
tb_remove(tb);
|
||||
}
|
||||
|
||||
/* remove the TB from the hash list */
|
||||
tb_jmp_cache_inval_tb(tb);
|
||||
|
||||
/* suppress this TB from the two jump lists */
|
||||
tb_remove_from_jmp_list(tb, 0);
|
||||
tb_remove_from_jmp_list(tb, 1);
|
||||
|
||||
/* suppress any remaining jumps to this TB */
|
||||
tb_jmp_unlink(tb);
|
||||
|
||||
qatomic_set(&tb_ctx.tb_phys_invalidate_count,
|
||||
tb_ctx.tb_phys_invalidate_count + 1);
|
||||
}
|
||||
|
||||
static void tb_phys_invalidate__locked(TranslationBlock *tb)
|
||||
{
|
||||
qemu_thread_jit_write();
|
||||
do_tb_phys_invalidate(tb, true);
|
||||
qemu_thread_jit_execute();
|
||||
}
|
||||
|
||||
@@ -1020,7 +1017,7 @@ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t last)
|
||||
assert_memory_lock();
|
||||
|
||||
PAGE_FOR_EACH_TB(start, last, unused, tb, n) {
|
||||
do_tb_phys_invalidate(tb, true);
|
||||
tb_phys_invalidate__locked(tb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,7 +1082,7 @@ bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc)
|
||||
current_tb_modified = true;
|
||||
cpu_restore_state_from_tb(current_cpu, current_tb, pc);
|
||||
}
|
||||
do_tb_phys_invalidate(tb, true);
|
||||
tb_phys_invalidate__locked(tb);
|
||||
}
|
||||
|
||||
if (current_tb_modified) {
|
||||
@@ -1148,7 +1145,7 @@ tb_invalidate_phys_page_range__locked(struct page_collection *pages,
|
||||
cpu_restore_state_from_tb(current_cpu, current_tb, retaddr);
|
||||
}
|
||||
#endif /* TARGET_HAS_PRECISE_SMC */
|
||||
do_tb_phys_invalidate(tb, true);
|
||||
tb_phys_invalidate__locked(tb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "system/cpu-timers.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "exec/exec-all.h"
|
||||
|
||||
#include "tcg-accel-ops.h"
|
||||
#include "tcg-accel-ops-icount.h"
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/notify.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "hw/boards.h"
|
||||
#include "tcg/startup.h"
|
||||
#include "tcg-accel-ops.h"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/notify.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "tcg/startup.h"
|
||||
#include "tcg-accel-ops.h"
|
||||
#include "tcg-accel-ops-rr.h"
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "system/accel-ops.h"
|
||||
#include "system/tcg.h"
|
||||
#include "system/replay.h"
|
||||
#include "system/cpu-timers.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "exec/cputlb.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/hwaddr.h"
|
||||
#include "exec/tb-flush.h"
|
||||
#include "exec/translation-block.h"
|
||||
@@ -75,7 +75,7 @@ void tcg_cpu_destroy(CPUState *cpu)
|
||||
int tcg_cpu_exec(CPUState *cpu)
|
||||
{
|
||||
int ret;
|
||||
assert(tcg_enabled());
|
||||
assert(tcg_enabled() || cpu->emulation_enabled);
|
||||
cpu_exec_start(cpu);
|
||||
ret = cpu_exec(cpu);
|
||||
cpu_exec_end(cpu);
|
||||
@@ -121,9 +121,10 @@ static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)
|
||||
[GDB_WATCHPOINT_ACCESS] = BP_GDB | BP_MEM_ACCESS,
|
||||
};
|
||||
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
int cputype = xlat[gdbtype];
|
||||
|
||||
if (cpu->cc->gdb_stop_before_watchpoint) {
|
||||
if (cc->gdb_stop_before_watchpoint) {
|
||||
cputype |= BP_STOP_BEFORE_ACCESS;
|
||||
}
|
||||
return cputype;
|
||||
|
||||
+5
-4
@@ -28,6 +28,7 @@
|
||||
#include "exec/replay-core.h"
|
||||
#include "system/cpu-timers.h"
|
||||
#include "tcg/startup.h"
|
||||
#include "tcg/oversized-guest.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/accel.h"
|
||||
@@ -40,8 +41,6 @@
|
||||
#include "hw/boards.h"
|
||||
#endif
|
||||
#include "internal-common.h"
|
||||
#include "cpu-param.h"
|
||||
|
||||
|
||||
struct TCGState {
|
||||
AccelState parent_obj;
|
||||
@@ -73,7 +72,7 @@ DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE,
|
||||
|
||||
static bool default_mttcg_enabled(void)
|
||||
{
|
||||
if (icount_enabled()) {
|
||||
if (icount_enabled() || TCG_OVERSIZED_GUEST) {
|
||||
return false;
|
||||
}
|
||||
#ifdef TARGET_SUPPORTS_MTTCG
|
||||
@@ -146,7 +145,9 @@ static void tcg_set_thread(Object *obj, const char *value, Error **errp)
|
||||
TCGState *s = TCG_STATE(obj);
|
||||
|
||||
if (strcmp(value, "multi") == 0) {
|
||||
if (icount_enabled()) {
|
||||
if (TCG_OVERSIZED_GUEST) {
|
||||
error_setg(errp, "No MTTCG when guest word size > hosts");
|
||||
} else if (icount_enabled()) {
|
||||
error_setg(errp, "No MTTCG when icount is enabled");
|
||||
} else {
|
||||
#ifndef TARGET_SUPPORTS_MTTCG
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/host-utils.h"
|
||||
#include "cpu.h"
|
||||
#include "exec/helper-proto-common.h"
|
||||
#include "tcg/tcg-gvec-desc.h"
|
||||
|
||||
|
||||
@@ -23,9 +23,13 @@
|
||||
*/
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/host-utils.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "cpu.h"
|
||||
#include "exec/helper-proto-common.h"
|
||||
#include "accel/tcg/getpc.h"
|
||||
#include "exec/cpu_ldst.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "disas/disas.h"
|
||||
#include "exec/log.h"
|
||||
#include "tcg/tcg.h"
|
||||
|
||||
#define HELPER_H "accel/tcg/tcg-runtime.h"
|
||||
#include "exec/helper-info.c.inc"
|
||||
|
||||
@@ -54,10 +54,11 @@
|
||||
#include "qemu/cacheinfo.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "exec/log.h"
|
||||
#include "system/cpus.h"
|
||||
#include "system/cpu-timers.h"
|
||||
#include "system/tcg.h"
|
||||
#include "qapi/error.h"
|
||||
#include "accel/tcg/cpu-ops.h"
|
||||
#include "hw/core/tcg-cpu-ops.h"
|
||||
#include "tb-jmp-cache.h"
|
||||
#include "tb-hash.h"
|
||||
#include "tb-context.h"
|
||||
@@ -106,7 +107,7 @@ static int64_t decode_sleb128(const uint8_t **pp)
|
||||
val |= (int64_t)(byte & 0x7f) << shift;
|
||||
shift += 7;
|
||||
} while (byte & 0x80);
|
||||
if (shift < 64 && (byte & 0x40)) {
|
||||
if (shift < TARGET_LONG_BITS && (byte & 0x40)) {
|
||||
val |= -(int64_t)1 << shift;
|
||||
}
|
||||
|
||||
@@ -630,7 +631,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
|
||||
* to account for the re-execution of the branch.
|
||||
*/
|
||||
n = 1;
|
||||
cc = cpu->cc;
|
||||
cc = CPU_GET_CLASS(cpu);
|
||||
if (cc->tcg_ops->io_recompile_replay_branch &&
|
||||
cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) {
|
||||
cpu->neg.icount_decr.u16.low++;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "exec/replay-core.h"
|
||||
#include "internal-common.h"
|
||||
|
||||
void cpu_resume(CPUState *cpu)
|
||||
{
|
||||
@@ -19,16 +18,6 @@ void cpu_exec_reset_hold(CPUState *cpu)
|
||||
{
|
||||
}
|
||||
|
||||
/* User mode emulation does not support softmmu yet. */
|
||||
|
||||
void tlb_init(CPUState *cpu)
|
||||
{
|
||||
}
|
||||
|
||||
void tlb_destroy(CPUState *cpu)
|
||||
{
|
||||
}
|
||||
|
||||
/* User mode emulation does not support record/replay yet. */
|
||||
|
||||
bool replay_exception(void)
|
||||
|
||||
+19
-106
@@ -17,9 +17,8 @@
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "qemu/osdep.h"
|
||||
#include "accel/tcg/cpu-ops.h"
|
||||
#include "hw/core/tcg-cpu-ops.h"
|
||||
#include "disas/disas.h"
|
||||
#include "exec/vaddr.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "tcg/tcg.h"
|
||||
#include "qemu/bitops.h"
|
||||
@@ -31,8 +30,6 @@
|
||||
#include "exec/page-protection.h"
|
||||
#include "exec/helper-proto.h"
|
||||
#include "qemu/atomic128.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "qemu/int128.h"
|
||||
#include "trace.h"
|
||||
#include "tcg/tcg-ldst.h"
|
||||
#include "internal-common.h"
|
||||
@@ -222,16 +219,13 @@ void page_dump(FILE *f)
|
||||
|
||||
int page_get_flags(target_ulong address)
|
||||
{
|
||||
PageFlagsNode *p;
|
||||
|
||||
RCU_READ_LOCK_GUARD();
|
||||
PageFlagsNode *p = pageflags_find(address, address);
|
||||
|
||||
/*
|
||||
* See util/interval-tree.c re lockless lookups: no false positives but
|
||||
* there are false negatives. If we find nothing, retry with the mmap
|
||||
* lock acquired.
|
||||
*/
|
||||
p = pageflags_find(address, address);
|
||||
if (p) {
|
||||
return p->flags;
|
||||
}
|
||||
@@ -330,15 +324,15 @@ static void pageflags_create_merge(target_ulong start, target_ulong last,
|
||||
|
||||
if (prev) {
|
||||
if (next) {
|
||||
pageflags_create(prev->itree.start, next->itree.last, flags);
|
||||
prev->itree.last = next->itree.last;
|
||||
g_free_rcu(next, rcu);
|
||||
} else {
|
||||
pageflags_create(prev->itree.start, last, flags);
|
||||
prev->itree.last = last;
|
||||
}
|
||||
g_free_rcu(prev, rcu);
|
||||
interval_tree_insert(&prev->itree, &pageflags_root);
|
||||
} else if (next) {
|
||||
pageflags_create(start, next->itree.last, flags);
|
||||
g_free_rcu(next, rcu);
|
||||
next->itree.start = start;
|
||||
interval_tree_insert(&next->itree, &pageflags_root);
|
||||
} else {
|
||||
pageflags_create(start, last, flags);
|
||||
}
|
||||
@@ -408,8 +402,8 @@ static bool pageflags_set_clear(target_ulong start, target_ulong last,
|
||||
if (set_flags != merge_flags) {
|
||||
if (p_start < start) {
|
||||
interval_tree_remove(&p->itree, &pageflags_root);
|
||||
pageflags_create(p_start, start - 1, p_flags);
|
||||
g_free_rcu(p, rcu);
|
||||
p->itree.last = start - 1;
|
||||
interval_tree_insert(&p->itree, &pageflags_root);
|
||||
|
||||
if (last < p_last) {
|
||||
if (merge_flags) {
|
||||
@@ -431,11 +425,11 @@ static bool pageflags_set_clear(target_ulong start, target_ulong last,
|
||||
}
|
||||
if (last < p_last) {
|
||||
interval_tree_remove(&p->itree, &pageflags_root);
|
||||
pageflags_create(last + 1, p_last, p_flags);
|
||||
p->itree.start = last + 1;
|
||||
interval_tree_insert(&p->itree, &pageflags_root);
|
||||
if (merge_flags) {
|
||||
pageflags_create(start, last, merge_flags);
|
||||
}
|
||||
g_free_rcu(p, rcu);
|
||||
} else {
|
||||
if (merge_flags) {
|
||||
p->flags = merge_flags;
|
||||
@@ -456,8 +450,8 @@ static bool pageflags_set_clear(target_ulong start, target_ulong last,
|
||||
if (set_flags == p_flags) {
|
||||
if (start < p_start) {
|
||||
interval_tree_remove(&p->itree, &pageflags_root);
|
||||
pageflags_create(start, p_last, p_flags);
|
||||
g_free_rcu(p, rcu);
|
||||
p->itree.start = start;
|
||||
interval_tree_insert(&p->itree, &pageflags_root);
|
||||
}
|
||||
if (p_last < last) {
|
||||
start = p_last + 1;
|
||||
@@ -469,8 +463,8 @@ static bool pageflags_set_clear(target_ulong start, target_ulong last,
|
||||
/* Maybe split out head and/or tail ranges with the original flags. */
|
||||
interval_tree_remove(&p->itree, &pageflags_root);
|
||||
if (p_start < start) {
|
||||
pageflags_create(p_start, start - 1, p_flags);
|
||||
g_free_rcu(p, rcu);
|
||||
p->itree.last = start - 1;
|
||||
interval_tree_insert(&p->itree, &pageflags_root);
|
||||
|
||||
if (p_last < last) {
|
||||
goto restart;
|
||||
@@ -479,8 +473,8 @@ static bool pageflags_set_clear(target_ulong start, target_ulong last,
|
||||
pageflags_create(last + 1, p_last, p_flags);
|
||||
}
|
||||
} else if (last < p_last) {
|
||||
pageflags_create(last + 1, p_last, p_flags);
|
||||
g_free_rcu(p, rcu);
|
||||
p->itree.start = last + 1;
|
||||
interval_tree_insert(&p->itree, &pageflags_root);
|
||||
} else {
|
||||
g_free_rcu(p, rcu);
|
||||
goto restart;
|
||||
@@ -548,8 +542,6 @@ bool page_check_range(target_ulong start, target_ulong len, int flags)
|
||||
return false; /* wrap around */
|
||||
}
|
||||
|
||||
RCU_READ_LOCK_GUARD();
|
||||
|
||||
locked = have_mmap_lock();
|
||||
while (true) {
|
||||
PageFlagsNode *p = pageflags_find(start, last);
|
||||
@@ -812,7 +804,7 @@ static int probe_access_internal(CPUArchState *env, vaddr addr,
|
||||
if (page_flags & acc_flag) {
|
||||
if (access_type != MMU_INST_FETCH
|
||||
&& cpu_plugin_mem_cbs_enabled(env_cpu(env))) {
|
||||
return TLB_FORCE_SLOW;
|
||||
return TLB_MMIO;
|
||||
}
|
||||
return 0; /* success */
|
||||
}
|
||||
@@ -847,7 +839,7 @@ void *probe_access(CPUArchState *env, vaddr addr, int size,
|
||||
|
||||
g_assert(-(addr | TARGET_PAGE_MASK) >= size);
|
||||
flags = probe_access_internal(env, addr, size, access_type, false, ra);
|
||||
g_assert((flags & ~TLB_FORCE_SLOW) == 0);
|
||||
g_assert((flags & ~TLB_MMIO) == 0);
|
||||
|
||||
return size ? g2h(env_cpu(env), addr) : NULL;
|
||||
}
|
||||
@@ -977,85 +969,6 @@ static void *cpu_mmu_lookup(CPUState *cpu, vaddr addr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* physical memory access (slow version, mainly for debug) */
|
||||
int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
|
||||
void *ptr, size_t len, bool is_write)
|
||||
{
|
||||
int flags;
|
||||
vaddr l, page;
|
||||
uint8_t *buf = ptr;
|
||||
ssize_t written;
|
||||
int ret = -1;
|
||||
int fd = -1;
|
||||
|
||||
mmap_lock();
|
||||
|
||||
while (len > 0) {
|
||||
page = addr & TARGET_PAGE_MASK;
|
||||
l = (page + TARGET_PAGE_SIZE) - addr;
|
||||
if (l > len) {
|
||||
l = len;
|
||||
}
|
||||
flags = page_get_flags(page);
|
||||
if (!(flags & PAGE_VALID)) {
|
||||
goto out_close;
|
||||
}
|
||||
if (is_write) {
|
||||
if (flags & PAGE_WRITE) {
|
||||
memcpy(g2h(cpu, addr), buf, l);
|
||||
} else {
|
||||
/* Bypass the host page protection using ptrace. */
|
||||
if (fd == -1) {
|
||||
fd = open("/proc/self/mem", O_WRONLY);
|
||||
if (fd == -1) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If there is a TranslationBlock and we weren't bypassing the
|
||||
* host page protection, the memcpy() above would SEGV,
|
||||
* ultimately leading to page_unprotect(). So invalidate the
|
||||
* translations manually. Both invalidation and pwrite() must
|
||||
* be under mmap_lock() in order to prevent the creation of
|
||||
* another TranslationBlock in between.
|
||||
*/
|
||||
tb_invalidate_phys_range(addr, addr + l - 1);
|
||||
written = pwrite(fd, buf, l,
|
||||
(off_t)(uintptr_t)g2h_untagged(addr));
|
||||
if (written != l) {
|
||||
goto out_close;
|
||||
}
|
||||
}
|
||||
} else if (flags & PAGE_READ) {
|
||||
memcpy(buf, g2h(cpu, addr), l);
|
||||
} else {
|
||||
/* Bypass the host page protection using ptrace. */
|
||||
if (fd == -1) {
|
||||
fd = open("/proc/self/mem", O_RDONLY);
|
||||
if (fd == -1) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
if (pread(fd, buf, l,
|
||||
(off_t)(uintptr_t)g2h_untagged(addr)) != l) {
|
||||
goto out_close;
|
||||
}
|
||||
}
|
||||
len -= l;
|
||||
buf += l;
|
||||
addr += l;
|
||||
}
|
||||
ret = 0;
|
||||
out_close:
|
||||
if (fd != -1) {
|
||||
close(fd);
|
||||
}
|
||||
out:
|
||||
mmap_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "ldst_atomicity.c.inc"
|
||||
|
||||
static uint8_t do_ld1_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "exec/breakpoint.h"
|
||||
#include "exec/cpu-interrupt.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/page-protection.h"
|
||||
#include "exec/translation-block.h"
|
||||
#include "tb-internal.h"
|
||||
#include "system/tcg.h"
|
||||
#include "system/replay.h"
|
||||
#include "accel/tcg/cpu-ops.h"
|
||||
#include "hw/core/tcg-cpu-ops.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "internal-common.h"
|
||||
|
||||
@@ -68,6 +69,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
|
||||
void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
|
||||
MemTxAttrs attrs, int flags, uintptr_t ra)
|
||||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
CPUWatchpoint *wp;
|
||||
|
||||
assert(tcg_enabled());
|
||||
@@ -83,9 +85,9 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpu->cc->tcg_ops->adjust_watchpoint_address) {
|
||||
if (cc->tcg_ops->adjust_watchpoint_address) {
|
||||
/* this is currently used only by ARM BE32 */
|
||||
addr = cpu->cc->tcg_ops->adjust_watchpoint_address(cpu, addr, len);
|
||||
addr = cc->tcg_ops->adjust_watchpoint_address(cpu, addr, len);
|
||||
}
|
||||
|
||||
assert((flags & ~BP_MEM_ACCESS) == 0);
|
||||
@@ -117,8 +119,8 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
|
||||
wp->hitattrs = attrs;
|
||||
|
||||
if (wp->flags & BP_CPU
|
||||
&& cpu->cc->tcg_ops->debug_check_watchpoint
|
||||
&& !cpu->cc->tcg_ops->debug_check_watchpoint(cpu, wp)) {
|
||||
&& cc->tcg_ops->debug_check_watchpoint
|
||||
&& !cc->tcg_ops->debug_check_watchpoint(cpu, wp)) {
|
||||
wp->flags &= ~BP_WATCHPOINT_HIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "hw/xen/xen_igd.h"
|
||||
#include "chardev/char.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "system/accel-ops.h"
|
||||
#include "system/cpus.h"
|
||||
#include "system/xen.h"
|
||||
#include "system/runstate.h"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "monitor/hmp.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
|
||||
static QLIST_HEAD (capture_list_head, CaptureState) capture_head;
|
||||
|
||||
|
||||
+1
-9
@@ -32,7 +32,7 @@
|
||||
#include "qapi/qobject-input-visitor.h"
|
||||
#include "qapi/qapi-visit-audio.h"
|
||||
#include "qapi/qapi-commands-audio.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/log.h"
|
||||
@@ -905,14 +905,6 @@ size_t AUD_read(SWVoiceIn *sw, void *buf, size_t size)
|
||||
|
||||
int AUD_get_buffer_size_out(SWVoiceOut *sw)
|
||||
{
|
||||
if (!sw) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (audio_get_pdo_out(sw->s->dev)->mixing_engine) {
|
||||
return sw->resample_buf.size * sw->info.bytes_per_frame;
|
||||
}
|
||||
|
||||
return sw->hw->samples * sw->hw->info.bytes_per_frame;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@
|
||||
#include "qemu/filemonitor.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
#include "qapi/qapi-visit-authz.h"
|
||||
#include "qobject/qjson.h"
|
||||
#include "qobject/qobject.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "qapi/qmp/qobject.h"
|
||||
#include "qapi/qobject-input-visitor.h"
|
||||
|
||||
|
||||
|
||||
@@ -53,8 +53,6 @@ typedef struct CryptoDevBackendBuiltinSession {
|
||||
|
||||
#define CRYPTODEV_BUITLIN_MAX_AUTH_KEY_LEN 512
|
||||
#define CRYPTODEV_BUITLIN_MAX_CIPHER_KEY_LEN 64
|
||||
/* demonstration purposes only, use a limited size to avoid QEMU OOM */
|
||||
#define CRYPTODEV_BUITLIN_MAX_REQUEST_SIZE (1024 * 1024)
|
||||
|
||||
struct CryptoDevBackendBuiltin {
|
||||
CryptoDevBackend parent_obj;
|
||||
@@ -100,7 +98,12 @@ static void cryptodev_builtin_init(
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_MAC;
|
||||
backend->conf.cipher_algo_l = 1u << VIRTIO_CRYPTO_CIPHER_AES_CBC;
|
||||
backend->conf.hash_algo = 1u << VIRTIO_CRYPTO_HASH_SHA1;
|
||||
backend->conf.max_size = CRYPTODEV_BUITLIN_MAX_REQUEST_SIZE;
|
||||
/*
|
||||
* Set the Maximum length of crypto request.
|
||||
* Why this value? Just avoid to overflow when
|
||||
* memory allocation for each crypto request.
|
||||
*/
|
||||
backend->conf.max_size = LONG_MAX - sizeof(CryptoDevBackendOpInfo);
|
||||
backend->conf.max_cipher_key_len = CRYPTODEV_BUITLIN_MAX_CIPHER_KEY_LEN;
|
||||
backend->conf.max_auth_key_len = CRYPTODEV_BUITLIN_MAX_AUTH_KEY_LEN;
|
||||
cryptodev_builtin_init_akcipher(backend);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "monitor/hmp.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qapi/qapi-commands-cryptodev.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
|
||||
|
||||
void hmp_info_cryptodev(Monitor *mon, const QDict *qdict)
|
||||
|
||||
@@ -330,8 +330,6 @@ static void cryptodev_lkcf_execute_task(CryptoDevLKCFTask *task)
|
||||
cryptodev_lkcf_set_op_desc(&session->akcipher_opts, op_desc,
|
||||
sizeof(op_desc), &local_error) != 0) {
|
||||
error_report_err(local_error);
|
||||
status = -VIRTIO_CRYPTO_ERR;
|
||||
goto out;
|
||||
} else {
|
||||
key_id = add_key(KCTL_KEY_TYPE_PKEY, "lkcf-backend-priv-key",
|
||||
p8info, p8info_len, KCTL_KEY_RING);
|
||||
@@ -348,7 +346,6 @@ static void cryptodev_lkcf_execute_task(CryptoDevLKCFTask *task)
|
||||
session->key, session->keylen,
|
||||
&local_error);
|
||||
if (!akcipher) {
|
||||
error_report_err(local_error);
|
||||
status = -VIRTIO_CRYPTO_ERR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ cryptodev_vhost_init(
|
||||
CryptoDevBackendVhost *crypto;
|
||||
Error *local_err = NULL;
|
||||
|
||||
crypto = g_new0(CryptoDevBackendVhost, 1);
|
||||
crypto = g_new(CryptoDevBackendVhost, 1);
|
||||
crypto->dev.max_queues = 1;
|
||||
crypto->dev.nvqs = 1;
|
||||
crypto->dev.vqs = crypto->vqs;
|
||||
|
||||
@@ -54,7 +54,6 @@ have_fd:
|
||||
/* Let's do the same as memory-backend-ram,share=on would do. */
|
||||
ram_flags = RAM_SHARED;
|
||||
ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
|
||||
ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0;
|
||||
|
||||
return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend),
|
||||
backend_name, backend->size,
|
||||
|
||||
@@ -167,6 +167,8 @@ int iommufd_backend_map_dma(IOMMUFDBackend *be, uint32_t ioas_id, hwaddr iova,
|
||||
/* TODO: Not support mapping hardware PCI BAR region for now. */
|
||||
if (errno == EFAULT) {
|
||||
warn_report("IOMMU_IOAS_MAP failed: %m, PCI BAR?");
|
||||
} else {
|
||||
error_report("IOMMU_IOAS_MAP failed: %m");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -201,6 +203,7 @@ int iommufd_backend_unmap_dma(IOMMUFDBackend *be, uint32_t ioas_id,
|
||||
|
||||
if (ret) {
|
||||
ret = -errno;
|
||||
error_report("IOMMU_IOAS_UNMAP failed: %m");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ static size_t tpm_passthrough_get_buffer_size(TPMBackend *tb)
|
||||
static int tpm_passthrough_open_sysfs_cancel(TPMPassthruState *tpm_pt)
|
||||
{
|
||||
int fd = -1;
|
||||
const char *dev;
|
||||
char *dev;
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (tpm_pt->options->cancel_path) {
|
||||
|
||||
+17
-13
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "tpm_int.h"
|
||||
@@ -76,7 +75,7 @@ static void release_tpm(Object *obj, const char *name, void *opaque)
|
||||
}
|
||||
|
||||
const PropertyInfo qdev_prop_tpm = {
|
||||
.type = "str",
|
||||
.name = "str",
|
||||
.description = "ID of a tpm to use as a backend",
|
||||
.get = get_tpm,
|
||||
.set = set_tpm,
|
||||
@@ -337,8 +336,8 @@ void tpm_sized_buffer_reset(TPMSizedBuffer *tsb)
|
||||
void tpm_util_show_buffer(const unsigned char *buffer,
|
||||
size_t buffer_size, const char *string)
|
||||
{
|
||||
g_autoptr(GString) str = NULL;
|
||||
size_t len, i, l;
|
||||
size_t len, i;
|
||||
char *line_buffer, *p;
|
||||
|
||||
if (!trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER_CONTENT)) {
|
||||
return;
|
||||
@@ -346,14 +345,19 @@ void tpm_util_show_buffer(const unsigned char *buffer,
|
||||
len = MIN(tpm_cmd_get_size(buffer), buffer_size);
|
||||
trace_tpm_util_show_buffer_header(string, len);
|
||||
|
||||
for (i = 0; i < len; i += l) {
|
||||
if (str) {
|
||||
g_string_append_c(str, '\n');
|
||||
}
|
||||
l = MIN(len, 16);
|
||||
str = qemu_hexdump_line(str, buffer, l, 1, 0);
|
||||
}
|
||||
/*
|
||||
* allocate enough room for 3 chars per buffer entry plus a
|
||||
* newline after every 16 chars and a final null terminator.
|
||||
*/
|
||||
line_buffer = g_malloc(len * 3 + (len / 16) + 1);
|
||||
|
||||
g_string_ascii_up(str);
|
||||
trace_tpm_util_show_buffer_content(str->str);
|
||||
for (i = 0, p = line_buffer; i < len; i++) {
|
||||
if (i && !(i % 16)) {
|
||||
p += sprintf(p, "\n");
|
||||
}
|
||||
p += sprintf(p, "%.2X ", buffer[i]);
|
||||
}
|
||||
trace_tpm_util_show_buffer_content(line_buffer);
|
||||
|
||||
g_free(line_buffer);
|
||||
}
|
||||
@@ -36,10 +36,10 @@
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qjson.h"
|
||||
#include "qobject/qnull.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "qapi/qmp/qnull.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qobject-output-visitor.h"
|
||||
#include "qapi/qapi-visit-block-core.h"
|
||||
#include "system/block-backend.h"
|
||||
@@ -1573,10 +1573,6 @@ static void update_flags_from_options(int *flags, QemuOpts *opts)
|
||||
if (qemu_opt_get_bool_del(opts, BDRV_OPT_AUTO_READ_ONLY, false)) {
|
||||
*flags |= BDRV_O_AUTO_RDONLY;
|
||||
}
|
||||
|
||||
if (!qemu_opt_get_bool_del(opts, BDRV_OPT_ACTIVE, true)) {
|
||||
*flags |= BDRV_O_INACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
static void update_options_from_flags(QDict *options, int flags)
|
||||
@@ -1803,11 +1799,6 @@ QemuOptsList bdrv_runtime_opts = {
|
||||
.type = QEMU_OPT_BOOL,
|
||||
.help = "Ignore flush requests",
|
||||
},
|
||||
{
|
||||
.name = BDRV_OPT_ACTIVE,
|
||||
.type = QEMU_OPT_BOOL,
|
||||
.help = "Node is activated",
|
||||
},
|
||||
{
|
||||
.name = BDRV_OPT_READ_ONLY,
|
||||
.type = QEMU_OPT_BOOL,
|
||||
@@ -3086,13 +3077,6 @@ bdrv_attach_child_common(BlockDriverState *child_bs,
|
||||
assert(child_class->get_parent_desc);
|
||||
GLOBAL_STATE_CODE();
|
||||
|
||||
if (bdrv_is_inactive(child_bs) && (perm & ~BLK_PERM_CONSISTENT_READ)) {
|
||||
g_autofree char *perm_names = bdrv_perm_names(perm);
|
||||
error_setg(errp, "Permission '%s' unavailable on inactive node",
|
||||
perm_names);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new_child = g_new(BdrvChild, 1);
|
||||
*new_child = (BdrvChild) {
|
||||
.bs = NULL,
|
||||
@@ -3199,11 +3183,6 @@ bdrv_attach_child_noperm(BlockDriverState *parent_bs,
|
||||
child_bs->node_name, child_name, parent_bs->node_name);
|
||||
return NULL;
|
||||
}
|
||||
if (bdrv_is_inactive(child_bs) && !bdrv_is_inactive(parent_bs)) {
|
||||
error_setg(errp, "Inactive '%s' can't be a %s child of active '%s'",
|
||||
child_bs->node_name, child_name, parent_bs->node_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bdrv_get_cumulative_perm(parent_bs, &perm, &shared_perm);
|
||||
bdrv_child_perm(parent_bs, child_bs, NULL, child_role, NULL,
|
||||
@@ -5377,13 +5356,17 @@ bdrv_replace_node_noperm(BlockDriverState *from,
|
||||
*
|
||||
* With auto_skip=false the error is returned if from has a parent which should
|
||||
* not be updated.
|
||||
*
|
||||
* With @detach_subchain=true @to must be in a backing chain of @from. In this
|
||||
* case backing link of the cow-parent of @to is removed.
|
||||
*/
|
||||
static int GRAPH_WRLOCK
|
||||
bdrv_replace_node_common(BlockDriverState *from, BlockDriverState *to,
|
||||
bool auto_skip, Error **errp)
|
||||
bool auto_skip, bool detach_subchain, Error **errp)
|
||||
{
|
||||
Transaction *tran = tran_new();
|
||||
g_autoptr(GSList) refresh_list = NULL;
|
||||
BlockDriverState *to_cow_parent = NULL;
|
||||
int ret;
|
||||
|
||||
GLOBAL_STATE_CODE();
|
||||
@@ -5392,6 +5375,17 @@ bdrv_replace_node_common(BlockDriverState *from, BlockDriverState *to,
|
||||
assert(to->quiesce_counter);
|
||||
assert(bdrv_get_aio_context(from) == bdrv_get_aio_context(to));
|
||||
|
||||
if (detach_subchain) {
|
||||
assert(bdrv_chain_contains(from, to));
|
||||
assert(from != to);
|
||||
for (to_cow_parent = from;
|
||||
bdrv_filter_or_cow_bs(to_cow_parent) != to;
|
||||
to_cow_parent = bdrv_filter_or_cow_bs(to_cow_parent))
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Do the replacement without permission update.
|
||||
* Replacement may influence the permissions, we should calculate new
|
||||
@@ -5403,6 +5397,11 @@ bdrv_replace_node_common(BlockDriverState *from, BlockDriverState *to,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (detach_subchain) {
|
||||
/* to_cow_parent is already drained because from is drained */
|
||||
bdrv_remove_child(bdrv_filter_or_cow_child(to_cow_parent), tran);
|
||||
}
|
||||
|
||||
refresh_list = g_slist_prepend(refresh_list, to);
|
||||
refresh_list = g_slist_prepend(refresh_list, from);
|
||||
|
||||
@@ -5421,7 +5420,7 @@ out:
|
||||
int bdrv_replace_node(BlockDriverState *from, BlockDriverState *to,
|
||||
Error **errp)
|
||||
{
|
||||
return bdrv_replace_node_common(from, to, true, errp);
|
||||
return bdrv_replace_node_common(from, to, true, false, errp);
|
||||
}
|
||||
|
||||
int bdrv_drop_filter(BlockDriverState *bs, Error **errp)
|
||||
@@ -5437,7 +5436,7 @@ int bdrv_drop_filter(BlockDriverState *bs, Error **errp)
|
||||
|
||||
bdrv_drained_begin(child_bs);
|
||||
bdrv_graph_wrlock();
|
||||
ret = bdrv_replace_node_common(bs, child_bs, true, errp);
|
||||
ret = bdrv_replace_node_common(bs, child_bs, true, true, errp);
|
||||
bdrv_graph_wrunlock();
|
||||
bdrv_drained_end(child_bs);
|
||||
|
||||
@@ -5894,7 +5893,17 @@ int bdrv_drop_intermediate(BlockDriverState *top, BlockDriverState *base,
|
||||
updated_children = g_slist_prepend(updated_children, c);
|
||||
}
|
||||
|
||||
bdrv_replace_node_common(top, base, false, &local_err);
|
||||
/*
|
||||
* It seems correct to pass detach_subchain=true here, but it triggers
|
||||
* one more yet not fixed bug, when due to nested aio_poll loop we switch to
|
||||
* another drained section, which modify the graph (for example, removing
|
||||
* the child, which we keep in updated_children list). So, it's a TODO.
|
||||
*
|
||||
* Note, bug triggered if pass detach_subchain=true here and run
|
||||
* test-bdrv-drain. test_drop_intermediate_poll() test-case will crash.
|
||||
* That's a FIXME.
|
||||
*/
|
||||
bdrv_replace_node_common(top, base, false, false, &local_err);
|
||||
bdrv_graph_wrunlock();
|
||||
|
||||
if (local_err) {
|
||||
@@ -6815,10 +6824,6 @@ void bdrv_init_with_whitelist(void)
|
||||
bdrv_init();
|
||||
}
|
||||
|
||||
bool bdrv_is_inactive(BlockDriverState *bs) {
|
||||
return bs->open_flags & BDRV_O_INACTIVE;
|
||||
}
|
||||
|
||||
int bdrv_activate(BlockDriverState *bs, Error **errp)
|
||||
{
|
||||
BdrvChild *child, *parent;
|
||||
@@ -6950,8 +6955,7 @@ bdrv_has_bds_parent(BlockDriverState *bs, bool only_active)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int GRAPH_RDLOCK
|
||||
bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
|
||||
static int GRAPH_RDLOCK bdrv_inactivate_recurse(BlockDriverState *bs)
|
||||
{
|
||||
BdrvChild *child, *parent;
|
||||
int ret;
|
||||
@@ -6969,14 +6973,7 @@ bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Inactivating an already inactive node on user request is harmless, but if
|
||||
* a child is already inactive before its parent, that's bad.
|
||||
*/
|
||||
if (bs->open_flags & BDRV_O_INACTIVE) {
|
||||
assert(top_level);
|
||||
return 0;
|
||||
}
|
||||
assert(!(bs->open_flags & BDRV_O_INACTIVE));
|
||||
|
||||
/* Inactivate this node */
|
||||
if (bs->drv->bdrv_inactivate) {
|
||||
@@ -7002,9 +6999,7 @@ bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
bdrv_drained_begin(bs);
|
||||
bs->open_flags |= BDRV_O_INACTIVE;
|
||||
bdrv_drained_end(bs);
|
||||
|
||||
/*
|
||||
* Update permissions, they may differ for inactive nodes.
|
||||
@@ -7015,7 +7010,7 @@ bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
|
||||
|
||||
/* Recursively inactivate children */
|
||||
QLIST_FOREACH(child, &bs->children, next) {
|
||||
ret = bdrv_inactivate_recurse(child->bs, false);
|
||||
ret = bdrv_inactivate_recurse(child->bs);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
@@ -7024,27 +7019,6 @@ bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bdrv_inactivate(BlockDriverState *bs, Error **errp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
GLOBAL_STATE_CODE();
|
||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||
|
||||
if (bdrv_has_bds_parent(bs, true)) {
|
||||
error_setg(errp, "Node has active parent node");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
ret = bdrv_inactivate_recurse(bs, true);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Failed to inactivate node");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bdrv_inactivate_all(void)
|
||||
{
|
||||
BlockDriverState *bs = NULL;
|
||||
@@ -7061,7 +7035,7 @@ int bdrv_inactivate_all(void)
|
||||
if (bdrv_has_bds_parent(bs, false)) {
|
||||
continue;
|
||||
}
|
||||
ret = bdrv_inactivate_recurse(bs, true);
|
||||
ret = bdrv_inactivate_recurse(bs);
|
||||
if (ret < 0) {
|
||||
bdrv_next_cleanup(&it);
|
||||
break;
|
||||
|
||||
+4
-17
@@ -33,9 +33,9 @@
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qapi/qapi-visit-block-core.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qlist.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qlist.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qobject-input-visitor.h"
|
||||
#include "system/qtest.h"
|
||||
|
||||
@@ -95,7 +95,6 @@ typedef struct BlkdebugRule {
|
||||
int immediately;
|
||||
int once;
|
||||
int64_t offset;
|
||||
int64_t delay_ns;
|
||||
} inject;
|
||||
struct {
|
||||
int new_state;
|
||||
@@ -145,10 +144,6 @@ static QemuOptsList inject_error_opts = {
|
||||
.name = "immediately",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
},
|
||||
{
|
||||
.name = "delay-ns",
|
||||
.type = QEMU_OPT_NUMBER,
|
||||
},
|
||||
{ /* end of list */ }
|
||||
},
|
||||
};
|
||||
@@ -221,8 +216,6 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
|
||||
rule->options.inject.once = qemu_opt_get_bool(opts, "once", 0);
|
||||
rule->options.inject.immediately =
|
||||
qemu_opt_get_bool(opts, "immediately", 0);
|
||||
rule->options.inject.delay_ns =
|
||||
qemu_opt_get_number(opts, "delay-ns", 0);
|
||||
sector = qemu_opt_get_number(opts, "sector", -1);
|
||||
rule->options.inject.offset =
|
||||
sector == -1 ? -1 : sector * BDRV_SECTOR_SIZE;
|
||||
@@ -601,7 +594,6 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
|
||||
BlkdebugRule *rule = NULL;
|
||||
int error;
|
||||
bool immediately;
|
||||
int64_t delay_ns;
|
||||
|
||||
qemu_mutex_lock(&s->lock);
|
||||
QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
|
||||
@@ -616,14 +608,13 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
|
||||
}
|
||||
}
|
||||
|
||||
if (!rule) {
|
||||
if (!rule || !rule->options.inject.error) {
|
||||
qemu_mutex_unlock(&s->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
immediately = rule->options.inject.immediately;
|
||||
error = rule->options.inject.error;
|
||||
delay_ns = rule->options.inject.delay_ns;
|
||||
|
||||
if (rule->options.inject.once) {
|
||||
QSIMPLEQ_REMOVE(&s->active_rules, rule, BlkdebugRule, active_next);
|
||||
@@ -631,10 +622,6 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
|
||||
}
|
||||
|
||||
qemu_mutex_unlock(&s->lock);
|
||||
|
||||
if (delay_ns) {
|
||||
qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, delay_ns);
|
||||
}
|
||||
if (!immediately) {
|
||||
aio_co_schedule(qemu_get_current_aio_context(), qemu_coroutine_self());
|
||||
qemu_coroutine_yield();
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
#include "qemu/defer-call.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qemu/module.h"
|
||||
#include "system/block-backend.h"
|
||||
#include "exec/memory.h" /* for ram_block_discard_disable() */
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
|
||||
#include "block/block-io.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
|
||||
#include "block/block-io.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
|
||||
+37
-62
@@ -82,7 +82,6 @@ struct BlockBackend {
|
||||
QemuMutex queued_requests_lock; /* protects queued_requests */
|
||||
CoQueue queued_requests;
|
||||
bool disable_request_queuing; /* atomic */
|
||||
int start_request_count; /* atomic */
|
||||
|
||||
VMChangeStateEntry *vmsh;
|
||||
bool force_allow_inactivate;
|
||||
@@ -254,7 +253,7 @@ static bool blk_can_inactivate(BlockBackend *blk)
|
||||
* guest. For block job BBs that satisfy this, we can just allow
|
||||
* it. This is the case for mirror job source, which is required
|
||||
* by libvirt non-shared block migration. */
|
||||
if (!(blk->perm & ~BLK_PERM_CONSISTENT_READ)) {
|
||||
if (!(blk->perm & (BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -901,24 +900,14 @@ void blk_remove_bs(BlockBackend *blk)
|
||||
int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp)
|
||||
{
|
||||
ThrottleGroupMember *tgm = &blk->public.throttle_group_member;
|
||||
uint64_t perm, shared_perm;
|
||||
|
||||
GLOBAL_STATE_CODE();
|
||||
bdrv_ref(bs);
|
||||
bdrv_graph_wrlock();
|
||||
|
||||
if ((bs->open_flags & BDRV_O_INACTIVE) && blk_can_inactivate(blk)) {
|
||||
blk->disable_perm = true;
|
||||
perm = 0;
|
||||
shared_perm = BLK_PERM_ALL;
|
||||
} else {
|
||||
perm = blk->perm;
|
||||
shared_perm = blk->shared_perm;
|
||||
}
|
||||
|
||||
blk->root = bdrv_root_attach_child(bs, "root", &child_root,
|
||||
BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY,
|
||||
perm, shared_perm, blk, errp);
|
||||
blk->perm, blk->shared_perm,
|
||||
blk, errp);
|
||||
bdrv_graph_wrunlock();
|
||||
if (blk->root == NULL) {
|
||||
return -EPERM;
|
||||
@@ -1030,10 +1019,6 @@ DeviceState *blk_get_attached_dev(BlockBackend *blk)
|
||||
return blk->dev;
|
||||
}
|
||||
|
||||
/*
|
||||
* The caller is responsible for releasing the value returned
|
||||
* with g_free() after use.
|
||||
*/
|
||||
static char *blk_get_attached_dev_id_or_path(BlockBackend *blk, bool want_id)
|
||||
{
|
||||
DeviceState *dev = blk->dev;
|
||||
@@ -1048,15 +1033,15 @@ static char *blk_get_attached_dev_id_or_path(BlockBackend *blk, bool want_id)
|
||||
return object_get_canonical_path(OBJECT(dev)) ?: g_strdup("");
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the qdev ID, or if no ID is assigned the QOM path, of the block
|
||||
* device attached to the BlockBackend.
|
||||
*/
|
||||
char *blk_get_attached_dev_id(BlockBackend *blk)
|
||||
{
|
||||
return blk_get_attached_dev_id_or_path(blk, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* The caller is responsible for releasing the value returned
|
||||
* with g_free() after use.
|
||||
*/
|
||||
static char *blk_get_attached_dev_path(BlockBackend *blk)
|
||||
{
|
||||
return blk_get_attached_dev_id_or_path(blk, false);
|
||||
@@ -1307,16 +1292,10 @@ bool blk_in_drain(BlockBackend *blk)
|
||||
}
|
||||
|
||||
/* To be called between exactly one pair of blk_inc/dec_in_flight() */
|
||||
static void coroutine_fn blk_wait_while_drained(BlockBackend *blk,
|
||||
BdrvRequestFlags flags)
|
||||
static void coroutine_fn blk_wait_while_drained(BlockBackend *blk)
|
||||
{
|
||||
assert(blk->in_flight > 0);
|
||||
|
||||
if (flags & BDRV_REQ_NO_QUEUE) {
|
||||
assert(qatomic_read(&blk->start_request_count));
|
||||
return;
|
||||
}
|
||||
|
||||
if (qatomic_read(&blk->quiesce_counter) &&
|
||||
!qatomic_read(&blk->disable_request_queuing)) {
|
||||
/*
|
||||
@@ -1325,9 +1304,9 @@ static void coroutine_fn blk_wait_while_drained(BlockBackend *blk,
|
||||
* section.
|
||||
*/
|
||||
qemu_mutex_lock(&blk->queued_requests_lock);
|
||||
/* blk_root_drained_end() has the corresponding blk_inc_in_flight() */
|
||||
blk_dec_in_flight(blk);
|
||||
qemu_co_queue_wait(&blk->queued_requests, &blk->queued_requests_lock);
|
||||
blk_inc_in_flight(blk);
|
||||
qemu_mutex_unlock(&blk->queued_requests_lock);
|
||||
}
|
||||
}
|
||||
@@ -1342,7 +1321,7 @@ blk_co_do_preadv_part(BlockBackend *blk, int64_t offset, int64_t bytes,
|
||||
BlockDriverState *bs;
|
||||
IO_CODE();
|
||||
|
||||
blk_wait_while_drained(blk, flags);
|
||||
blk_wait_while_drained(blk);
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
|
||||
/* Call blk_bs() only after waiting, the graph may have changed */
|
||||
@@ -1417,7 +1396,7 @@ blk_co_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes,
|
||||
BlockDriverState *bs;
|
||||
IO_CODE();
|
||||
|
||||
blk_wait_while_drained(blk, flags);
|
||||
blk_wait_while_drained(blk);
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
|
||||
/* Call blk_bs() only after waiting, the graph may have changed */
|
||||
@@ -1530,19 +1509,6 @@ void blk_dec_in_flight(BlockBackend *blk)
|
||||
aio_wait_kick();
|
||||
}
|
||||
|
||||
void coroutine_fn blk_co_start_request(BlockBackend *blk)
|
||||
{
|
||||
blk_inc_in_flight(blk);
|
||||
blk_wait_while_drained(blk, 0);
|
||||
qatomic_inc(&blk->start_request_count);
|
||||
}
|
||||
|
||||
void blk_end_request(BlockBackend *blk)
|
||||
{
|
||||
qatomic_dec(&blk->start_request_count);
|
||||
blk_dec_in_flight(blk);
|
||||
}
|
||||
|
||||
static void error_callback_bh(void *opaque)
|
||||
{
|
||||
struct BlockBackendAIOCB *acb = opaque;
|
||||
@@ -1761,7 +1727,7 @@ blk_co_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
|
||||
{
|
||||
IO_CODE();
|
||||
|
||||
blk_wait_while_drained(blk, 0);
|
||||
blk_wait_while_drained(blk);
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
|
||||
if (!blk_co_is_available(blk)) {
|
||||
@@ -1803,13 +1769,12 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
|
||||
|
||||
/* To be called between exactly one pair of blk_inc/dec_in_flight() */
|
||||
static int coroutine_fn
|
||||
blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes,
|
||||
BdrvRequestFlags flags)
|
||||
blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes)
|
||||
{
|
||||
int ret;
|
||||
IO_CODE();
|
||||
|
||||
blk_wait_while_drained(blk, flags);
|
||||
blk_wait_while_drained(blk);
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
|
||||
ret = blk_check_byte_request(blk, offset, bytes);
|
||||
@@ -1825,7 +1790,7 @@ static void coroutine_fn blk_aio_pdiscard_entry(void *opaque)
|
||||
BlkAioEmAIOCB *acb = opaque;
|
||||
BlkRwCo *rwco = &acb->rwco;
|
||||
|
||||
rwco->ret = blk_co_do_pdiscard(rwco->blk, rwco->offset, acb->bytes, 0);
|
||||
rwco->ret = blk_co_do_pdiscard(rwco->blk, rwco->offset, acb->bytes);
|
||||
blk_aio_complete(acb);
|
||||
}
|
||||
|
||||
@@ -1839,13 +1804,13 @@ BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
|
||||
}
|
||||
|
||||
int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset,
|
||||
int64_t bytes, BdrvRequestFlags flags)
|
||||
int64_t bytes)
|
||||
{
|
||||
int ret;
|
||||
IO_OR_GS_CODE();
|
||||
|
||||
blk_inc_in_flight(blk);
|
||||
ret = blk_co_do_pdiscard(blk, offset, bytes, flags);
|
||||
ret = blk_co_do_pdiscard(blk, offset, bytes);
|
||||
blk_dec_in_flight(blk);
|
||||
|
||||
return ret;
|
||||
@@ -1855,7 +1820,7 @@ int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset,
|
||||
static int coroutine_fn blk_co_do_flush(BlockBackend *blk)
|
||||
{
|
||||
IO_CODE();
|
||||
blk_wait_while_drained(blk, 0);
|
||||
blk_wait_while_drained(blk);
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
|
||||
if (!blk_co_is_available(blk)) {
|
||||
@@ -2030,7 +1995,7 @@ int coroutine_fn blk_co_zone_report(BlockBackend *blk, int64_t offset,
|
||||
IO_CODE();
|
||||
|
||||
blk_inc_in_flight(blk); /* increase before waiting */
|
||||
blk_wait_while_drained(blk, 0);
|
||||
blk_wait_while_drained(blk);
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
if (!blk_is_available(blk)) {
|
||||
blk_dec_in_flight(blk);
|
||||
@@ -2055,7 +2020,7 @@ int coroutine_fn blk_co_zone_mgmt(BlockBackend *blk, BlockZoneOp op,
|
||||
IO_CODE();
|
||||
|
||||
blk_inc_in_flight(blk);
|
||||
blk_wait_while_drained(blk, 0);
|
||||
blk_wait_while_drained(blk);
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
|
||||
ret = blk_check_byte_request(blk, offset, len);
|
||||
@@ -2079,7 +2044,7 @@ int coroutine_fn blk_co_zone_append(BlockBackend *blk, int64_t *offset,
|
||||
IO_CODE();
|
||||
|
||||
blk_inc_in_flight(blk);
|
||||
blk_wait_while_drained(blk, flags);
|
||||
blk_wait_while_drained(blk);
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
if (!blk_is_available(blk)) {
|
||||
blk_dec_in_flight(blk);
|
||||
@@ -2169,10 +2134,10 @@ static void send_qmp_error_event(BlockBackend *blk,
|
||||
{
|
||||
IoOperationType optype;
|
||||
BlockDriverState *bs = blk_bs(blk);
|
||||
g_autofree char *path = blk_get_attached_dev_path(blk);
|
||||
|
||||
optype = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
|
||||
qapi_event_send_block_io_error(path, blk_name(blk),
|
||||
qapi_event_send_block_io_error(blk_name(blk),
|
||||
blk_get_attached_dev_path(blk),
|
||||
bs ? bdrv_get_node_name(bs) : NULL, optype,
|
||||
action, blk_iostatus_is_enabled(blk),
|
||||
error == ENOSPC, strerror(error));
|
||||
@@ -2378,6 +2343,18 @@ void *blk_blockalign(BlockBackend *blk, size_t size)
|
||||
return qemu_blockalign(blk ? blk_bs(blk) : NULL, size);
|
||||
}
|
||||
|
||||
bool blk_op_is_blocked(BlockBackend *blk, BlockOpType op, Error **errp)
|
||||
{
|
||||
BlockDriverState *bs = blk_bs(blk);
|
||||
GLOBAL_STATE_CODE();
|
||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||
|
||||
if (!bs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return bdrv_op_is_blocked(bs, op, errp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return BB's current AioContext. Note that this context may change
|
||||
@@ -2788,11 +2765,9 @@ static void blk_root_drained_end(BdrvChild *child)
|
||||
blk->dev_ops->drained_end(blk->dev_opaque);
|
||||
}
|
||||
qemu_mutex_lock(&blk->queued_requests_lock);
|
||||
while (!qemu_co_queue_empty(&blk->queued_requests)) {
|
||||
while (qemu_co_enter_next(&blk->queued_requests,
|
||||
&blk->queued_requests_lock)) {
|
||||
/* Resume all queued requests */
|
||||
blk_inc_in_flight(blk);
|
||||
qemu_co_enter_next(&blk->queued_requests,
|
||||
&blk->queued_requests_lock);
|
||||
}
|
||||
qemu_mutex_unlock(&blk->queued_requests_lock);
|
||||
}
|
||||
|
||||
+33
-83
@@ -15,8 +15,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "trace.h"
|
||||
#include "block/block-common.h"
|
||||
#include "block/coroutines.h"
|
||||
#include "block/block_int.h"
|
||||
#include "block/blockjob_int.h"
|
||||
#include "qapi/error.h"
|
||||
@@ -128,84 +126,6 @@ static void commit_clean(Job *job)
|
||||
blk_unref(s->top);
|
||||
}
|
||||
|
||||
static int commit_iteration(CommitBlockJob *s, int64_t offset,
|
||||
int64_t *requested_bytes, void *buf)
|
||||
{
|
||||
BlockErrorAction action;
|
||||
int64_t bytes = *requested_bytes;
|
||||
int ret = 0;
|
||||
bool error_in_source = true;
|
||||
|
||||
/* Copy if allocated above the base */
|
||||
WITH_GRAPH_RDLOCK_GUARD() {
|
||||
ret = bdrv_co_common_block_status_above(blk_bs(s->top),
|
||||
s->base_overlay, true, true, offset, COMMIT_BUFFER_SIZE,
|
||||
&bytes, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
trace_commit_one_iteration(s, offset, bytes, ret);
|
||||
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (ret & BDRV_BLOCK_ALLOCATED) {
|
||||
if (ret & BDRV_BLOCK_ZERO) {
|
||||
/*
|
||||
* If the top (sub)clusters are smaller than the base
|
||||
* (sub)clusters, this will not unmap unless the underlying device
|
||||
* does some tracking of these requests. Ideally, we would find
|
||||
* the maximal extent of the zero clusters.
|
||||
*/
|
||||
ret = blk_co_pwrite_zeroes(s->base, offset, bytes,
|
||||
BDRV_REQ_MAY_UNMAP);
|
||||
if (ret < 0) {
|
||||
error_in_source = false;
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
assert(bytes < SIZE_MAX);
|
||||
|
||||
ret = blk_co_pread(s->top, offset, bytes, buf, 0);
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = blk_co_pwrite(s->base, offset, bytes, buf, 0);
|
||||
if (ret < 0) {
|
||||
error_in_source = false;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Whether zeroes actually end up on disk depends on the details of
|
||||
* the underlying driver. Therefore, this might rate limit more than
|
||||
* is necessary.
|
||||
*/
|
||||
block_job_ratelimit_processed_bytes(&s->common, bytes);
|
||||
}
|
||||
|
||||
/* Publish progress */
|
||||
|
||||
job_progress_update(&s->common.job, bytes);
|
||||
|
||||
*requested_bytes = bytes;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
action = block_job_error_action(&s->common, s->on_error,
|
||||
error_in_source, -ret);
|
||||
if (action == BLOCK_ERROR_ACTION_REPORT) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
*requested_bytes = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int coroutine_fn commit_run(Job *job, Error **errp)
|
||||
{
|
||||
CommitBlockJob *s = container_of(job, CommitBlockJob, common.job);
|
||||
@@ -236,6 +156,9 @@ static int coroutine_fn commit_run(Job *job, Error **errp)
|
||||
buf = blk_blockalign(s->top, COMMIT_BUFFER_SIZE);
|
||||
|
||||
for (offset = 0; offset < len; offset += n) {
|
||||
bool copy;
|
||||
bool error_in_source = true;
|
||||
|
||||
/* Note that even when no rate limit is applied we need to yield
|
||||
* with no pending I/O here so that bdrv_drain_all() returns.
|
||||
*/
|
||||
@@ -243,11 +166,38 @@ static int coroutine_fn commit_run(Job *job, Error **errp)
|
||||
if (job_is_cancelled(&s->common.job)) {
|
||||
break;
|
||||
}
|
||||
/* Copy if allocated above the base */
|
||||
ret = blk_co_is_allocated_above(s->top, s->base_overlay, true,
|
||||
offset, COMMIT_BUFFER_SIZE, &n);
|
||||
copy = (ret > 0);
|
||||
trace_commit_one_iteration(s, offset, n, ret);
|
||||
if (copy) {
|
||||
assert(n < SIZE_MAX);
|
||||
|
||||
ret = commit_iteration(s, offset, &n, buf);
|
||||
|
||||
ret = blk_co_pread(s->top, offset, n, buf, 0);
|
||||
if (ret >= 0) {
|
||||
ret = blk_co_pwrite(s->base, offset, n, buf, 0);
|
||||
if (ret < 0) {
|
||||
error_in_source = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
BlockErrorAction action =
|
||||
block_job_error_action(&s->common, s->on_error,
|
||||
error_in_source, -ret);
|
||||
if (action == BLOCK_ERROR_ACTION_REPORT) {
|
||||
return ret;
|
||||
} else {
|
||||
n = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* Publish progress */
|
||||
job_progress_update(&s->common.job, n);
|
||||
|
||||
if (copy) {
|
||||
block_job_ratelimit_processed_bytes(&s->common, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qobject/qjson.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
|
||||
#include "system/block-backend.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "block/copy-on-read.h"
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/clang-tsa.h"
|
||||
#include "qemu/job.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qapi/qapi-commands-block-core.h"
|
||||
|
||||
+9
-23
@@ -67,18 +67,11 @@ static int block_crypto_read_func(QCryptoBlock *block,
|
||||
BlockCrypto *crypto = bs->opaque;
|
||||
ssize_t ret;
|
||||
|
||||
if (qemu_in_coroutine()) {
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
GLOBAL_STATE_CODE();
|
||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||
|
||||
ret = bdrv_co_pread(crypto->header ? crypto->header : bs->file,
|
||||
offset, buflen, buf, 0);
|
||||
} else {
|
||||
GLOBAL_STATE_CODE();
|
||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||
|
||||
ret = bdrv_pread(crypto->header ? crypto->header : bs->file,
|
||||
offset, buflen, buf, 0);
|
||||
}
|
||||
ret = bdrv_pread(crypto->header ? crypto->header : bs->file,
|
||||
offset, buflen, buf, 0);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Could not read encryption header");
|
||||
return ret;
|
||||
@@ -97,18 +90,11 @@ static int block_crypto_write_func(QCryptoBlock *block,
|
||||
BlockCrypto *crypto = bs->opaque;
|
||||
ssize_t ret;
|
||||
|
||||
if (qemu_in_coroutine()) {
|
||||
GRAPH_RDLOCK_GUARD();
|
||||
GLOBAL_STATE_CODE();
|
||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||
|
||||
ret = bdrv_co_pwrite(crypto->header ? crypto->header : bs->file,
|
||||
offset, buflen, buf, 0);
|
||||
} else {
|
||||
GLOBAL_STATE_CODE();
|
||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||
|
||||
ret = bdrv_pwrite(crypto->header ? crypto->header : bs->file,
|
||||
offset, buflen, buf, 0);
|
||||
}
|
||||
ret = bdrv_pwrite(crypto->header ? crypto->header : bs->file,
|
||||
offset, buflen, buf, 0);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Could not write encryption header");
|
||||
return ret;
|
||||
@@ -806,7 +792,7 @@ block_crypto_co_create_opts_luks(BlockDriver *drv, const char *filename,
|
||||
char *buf = NULL;
|
||||
int64_t size;
|
||||
bool detached_hdr =
|
||||
qemu_opt_get_bool_del(opts, "detached-header", false);
|
||||
qemu_opt_get_bool(opts, "detached-header", false);
|
||||
unsigned int cflags = 0;
|
||||
int ret;
|
||||
Error *local_err = NULL;
|
||||
|
||||
+36
-45
@@ -29,8 +29,8 @@
|
||||
#include "qemu/option.h"
|
||||
#include "block/block-io.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "crypto/secret.h"
|
||||
#include <curl/curl.h>
|
||||
#include "qemu/cutils.h"
|
||||
@@ -162,9 +162,13 @@ static int curl_timer_cb(CURLM *multi, long timeout_ms, void *opaque)
|
||||
static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
||||
void *userp, void *sp)
|
||||
{
|
||||
BDRVCURLState *s = userp;
|
||||
BDRVCURLState *s;
|
||||
CURLState *state = NULL;
|
||||
CURLSocket *socket;
|
||||
|
||||
curl_easy_getinfo(curl, CURLINFO_PRIVATE, (char **)&state);
|
||||
s = state->s;
|
||||
|
||||
socket = g_hash_table_lookup(s->sockets, GINT_TO_POINTER(fd));
|
||||
if (!socket) {
|
||||
socket = g_new0(CURLSocket, 1);
|
||||
@@ -258,8 +262,8 @@ read_end:
|
||||
}
|
||||
|
||||
/* Called with s->mutex held. */
|
||||
static bool coroutine_fn
|
||||
curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, CURLAIOCB *acb)
|
||||
static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len,
|
||||
CURLAIOCB *acb)
|
||||
{
|
||||
int i;
|
||||
uint64_t end = start + len;
|
||||
@@ -307,10 +311,6 @@ curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, CURLAIOCB *acb)
|
||||
for (j=0; j<CURL_NUM_ACB; j++) {
|
||||
if (!state->acb[j]) {
|
||||
state->acb[j] = acb;
|
||||
/* Await ongoing request */
|
||||
qemu_mutex_unlock(&s->mutex);
|
||||
qemu_coroutine_yield();
|
||||
qemu_mutex_lock(&s->mutex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -324,11 +324,17 @@ curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, CURLAIOCB *acb)
|
||||
static void curl_multi_check_completion(BDRVCURLState *s)
|
||||
{
|
||||
int msgs_in_queue;
|
||||
CURLMsg *msg;
|
||||
|
||||
/* Try to find done transfers, so we can free the easy
|
||||
* handle again. */
|
||||
while ((msg = curl_multi_info_read(s->multi, &msgs_in_queue))) {
|
||||
for (;;) {
|
||||
CURLMsg *msg;
|
||||
msg = curl_multi_info_read(s->multi, &msgs_in_queue);
|
||||
|
||||
/* Quit when there are no more completions */
|
||||
if (!msg)
|
||||
break;
|
||||
|
||||
if (msg->msg == CURLMSG_DONE) {
|
||||
int i;
|
||||
CURLState *state = NULL;
|
||||
@@ -376,21 +382,12 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
||||
acb->ret = error ? -EIO : 0;
|
||||
state->acb[i] = NULL;
|
||||
qemu_mutex_unlock(&s->mutex);
|
||||
/*
|
||||
* Current AioContext is the BDS context, which may or may not
|
||||
* be the request (coroutine) context.
|
||||
* - If it is, the coroutine must have yielded or the FD handler
|
||||
* (curl_multi_do()/curl_multi_timeout_do()) could not have
|
||||
* been called and we would not be here
|
||||
* - If it is not, it doesn't matter whether it has already
|
||||
* yielded or not; it will be scheduled once it does yield
|
||||
* So aio_co_wake() is safe to call.
|
||||
*/
|
||||
aio_co_wake(acb->co);
|
||||
qemu_mutex_lock(&s->mutex);
|
||||
}
|
||||
|
||||
curl_clean_state(state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -478,11 +475,11 @@ static int curl_init_state(BDRVCURLState *s, CURLState *state)
|
||||
(void *)curl_read_cb) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1L) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1L) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1L) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1L)) {
|
||||
curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1)) {
|
||||
goto err;
|
||||
}
|
||||
if (s->username) {
|
||||
@@ -531,7 +528,7 @@ static int curl_init_state(BDRVCURLState *s, CURLState *state)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_VERBOSE
|
||||
if (curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1L)) {
|
||||
if (curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1)) {
|
||||
goto err;
|
||||
}
|
||||
#endif
|
||||
@@ -608,7 +605,6 @@ static void curl_attach_aio_context(BlockDriverState *bs,
|
||||
assert(!s->multi);
|
||||
s->multi = curl_multi_init();
|
||||
s->aio_context = new_context;
|
||||
curl_multi_setopt(s->multi, CURLMOPT_SOCKETDATA, s);
|
||||
curl_multi_setopt(s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb);
|
||||
curl_multi_setopt(s->multi, CURLMOPT_TIMERDATA, s);
|
||||
curl_multi_setopt(s->multi, CURLMOPT_TIMERFUNCTION, curl_timer_cb);
|
||||
@@ -807,7 +803,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
}
|
||||
|
||||
s->accept_range = false;
|
||||
if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1L) ||
|
||||
if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb) ||
|
||||
curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s)) {
|
||||
pstrcpy(state->errmsg, CURL_ERROR_SIZE,
|
||||
@@ -876,7 +872,6 @@ out_noclean:
|
||||
g_free(s->cookie);
|
||||
g_free(s->url);
|
||||
g_free(s->username);
|
||||
g_free(s->password);
|
||||
g_free(s->proxyusername);
|
||||
g_free(s->proxypassword);
|
||||
if (s->sockets) {
|
||||
@@ -887,7 +882,7 @@ out_noclean:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static void coroutine_fn curl_do_preadv(BlockDriverState *bs, CURLAIOCB *acb)
|
||||
static void coroutine_fn curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb)
|
||||
{
|
||||
CURLState *state;
|
||||
int running;
|
||||
@@ -899,13 +894,10 @@ static void coroutine_fn curl_do_preadv(BlockDriverState *bs, CURLAIOCB *acb)
|
||||
|
||||
qemu_mutex_lock(&s->mutex);
|
||||
|
||||
/*
|
||||
* In case we have the requested data already (e.g. read-ahead),
|
||||
* we can just call the callback and be done. This may have to
|
||||
* await an ongoing request, in which case it itself will yield.
|
||||
*/
|
||||
// In case we have the requested data already (e.g. read-ahead),
|
||||
// we can just call the callback and be done.
|
||||
if (curl_find_buf(s, start, acb->bytes, acb)) {
|
||||
goto dont_yield;
|
||||
goto out;
|
||||
}
|
||||
|
||||
// No cache found, so let's start a new request
|
||||
@@ -920,7 +912,7 @@ static void coroutine_fn curl_do_preadv(BlockDriverState *bs, CURLAIOCB *acb)
|
||||
if (curl_init_state(s, state) < 0) {
|
||||
curl_clean_state(state);
|
||||
acb->ret = -EIO;
|
||||
goto dont_yield;
|
||||
goto out;
|
||||
}
|
||||
|
||||
acb->start = 0;
|
||||
@@ -935,7 +927,7 @@ static void coroutine_fn curl_do_preadv(BlockDriverState *bs, CURLAIOCB *acb)
|
||||
if (state->buf_len && state->orig_buf == NULL) {
|
||||
curl_clean_state(state);
|
||||
acb->ret = -ENOMEM;
|
||||
goto dont_yield;
|
||||
goto out;
|
||||
}
|
||||
state->acb[0] = acb;
|
||||
|
||||
@@ -947,16 +939,13 @@ static void coroutine_fn curl_do_preadv(BlockDriverState *bs, CURLAIOCB *acb)
|
||||
acb->ret = -EIO;
|
||||
|
||||
curl_clean_state(state);
|
||||
goto dont_yield;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Tell curl it needs to kick things off */
|
||||
curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running);
|
||||
qemu_mutex_unlock(&s->mutex);
|
||||
qemu_coroutine_yield();
|
||||
return;
|
||||
|
||||
dont_yield:
|
||||
out:
|
||||
qemu_mutex_unlock(&s->mutex);
|
||||
}
|
||||
|
||||
@@ -972,7 +961,10 @@ static int coroutine_fn curl_co_preadv(BlockDriverState *bs,
|
||||
.bytes = bytes
|
||||
};
|
||||
|
||||
curl_do_preadv(bs, &acb);
|
||||
curl_setup_preadv(bs, &acb);
|
||||
while (acb.ret == -EINPROGRESS) {
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
return acb.ret;
|
||||
}
|
||||
|
||||
@@ -988,7 +980,6 @@ static void curl_close(BlockDriverState *bs)
|
||||
g_free(s->cookie);
|
||||
g_free(s->url);
|
||||
g_free(s->username);
|
||||
g_free(s->password);
|
||||
g_free(s->proxyusername);
|
||||
g_free(s->proxypassword);
|
||||
}
|
||||
|
||||
+7
-22
@@ -75,7 +75,6 @@ static const BlockExportDriver *blk_exp_find_driver(BlockExportType type)
|
||||
BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp)
|
||||
{
|
||||
bool fixed_iothread = export->has_fixed_iothread && export->fixed_iothread;
|
||||
bool allow_inactive = export->has_allow_inactive && export->allow_inactive;
|
||||
const BlockExportDriver *drv;
|
||||
BlockExport *exp = NULL;
|
||||
BlockDriverState *bs;
|
||||
@@ -139,25 +138,14 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Block exports are used for non-shared storage migration. Make sure
|
||||
* that BDRV_O_INACTIVE is cleared and the image is ready for write
|
||||
* access since the export could be available before migration handover.
|
||||
* ctx was acquired in the caller.
|
||||
*/
|
||||
bdrv_graph_rdlock_main_loop();
|
||||
if (allow_inactive) {
|
||||
if (!drv->supports_inactive) {
|
||||
error_setg(errp, "Export type does not support inactive exports");
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Block exports are used for non-shared storage migration. Make sure
|
||||
* that BDRV_O_INACTIVE is cleared and the image is ready for write
|
||||
* access since the export could be available before migration handover.
|
||||
*/
|
||||
ret = bdrv_activate(bs, errp);
|
||||
if (ret < 0) {
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
bdrv_activate(bs, NULL);
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
|
||||
perm = BLK_PERM_CONSISTENT_READ;
|
||||
@@ -170,9 +158,6 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp)
|
||||
if (!fixed_iothread) {
|
||||
blk_set_allow_aio_context_change(blk, true);
|
||||
}
|
||||
if (allow_inactive) {
|
||||
blk_set_force_allow_inactivate(blk);
|
||||
}
|
||||
|
||||
ret = blk_insert_bs(blk, bs, errp);
|
||||
if (ret < 0) {
|
||||
|
||||
+1
-16
@@ -301,12 +301,6 @@ static void read_from_fuse_export(void *opaque)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that aio_poll() in any request-processing function can lead to a
|
||||
* nested read_from_fuse_export() call, which will overwrite the contents of
|
||||
* exp->fuse_buf. Anything that takes a buffer needs to take care that the
|
||||
* content is copied before potentially polling via aio_poll().
|
||||
*/
|
||||
fuse_session_process_buf(exp->fuse_session, &exp->fuse_buf);
|
||||
|
||||
out:
|
||||
@@ -630,7 +624,6 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
|
||||
size_t size, off_t offset, struct fuse_file_info *fi)
|
||||
{
|
||||
FuseExport *exp = fuse_req_userdata(req);
|
||||
QEMU_AUTO_VFREE void *copied = NULL;
|
||||
int64_t length;
|
||||
int ret;
|
||||
|
||||
@@ -645,14 +638,6 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Heed the note on read_from_fuse_export(): If we call aio_poll() (which
|
||||
* any blk_*() I/O function may do), read_from_fuse_export() may be nested,
|
||||
* overwriting the request buffer content. Therefore, we must copy it here.
|
||||
*/
|
||||
copied = blk_blockalign(exp->common.blk, size);
|
||||
memcpy(copied, buf, size);
|
||||
|
||||
/**
|
||||
* Clients will expect short writes at EOF, so we have to limit
|
||||
* offset+size to the image length.
|
||||
@@ -675,7 +660,7 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
|
||||
}
|
||||
}
|
||||
|
||||
ret = blk_pwrite(exp->common.blk, offset, size, copied, 0);
|
||||
ret = blk_pwrite(exp->common.blk, offset, size, buf, 0);
|
||||
if (ret >= 0) {
|
||||
fuse_reply_write(req, size);
|
||||
} else {
|
||||
|
||||
@@ -121,7 +121,7 @@ virtio_blk_discard_write_zeroes(VirtioBlkHandler *handler, struct iovec *iov,
|
||||
}
|
||||
|
||||
if (blk_co_pdiscard(blk, sector << VIRTIO_BLK_SECTOR_BITS,
|
||||
bytes, 0) == 0) {
|
||||
bytes) == 0) {
|
||||
return VIRTIO_BLK_S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
+21
-35
@@ -36,8 +36,8 @@
|
||||
#include "block/thread-pool.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "block/raw-aio.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
|
||||
#include "scsi/pr-manager.h"
|
||||
#include "scsi/constants.h"
|
||||
@@ -194,7 +194,6 @@ static int fd_open(BlockDriverState *bs)
|
||||
}
|
||||
|
||||
static int64_t raw_getlength(BlockDriverState *bs);
|
||||
static int coroutine_fn raw_co_flush_to_disk(BlockDriverState *bs);
|
||||
|
||||
typedef struct RawPosixAIOData {
|
||||
BlockDriverState *bs;
|
||||
@@ -805,13 +804,6 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
|
||||
#endif
|
||||
s->needs_alignment = raw_needs_alignment(bs);
|
||||
|
||||
bs->supported_write_flags = BDRV_REQ_FUA;
|
||||
if (s->use_linux_aio && !laio_has_fua()) {
|
||||
bs->supported_write_flags &= ~BDRV_REQ_FUA;
|
||||
} else if (s->use_linux_io_uring && !luring_has_fua()) {
|
||||
bs->supported_write_flags &= ~BDRV_REQ_FUA;
|
||||
}
|
||||
|
||||
bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK;
|
||||
if (S_ISREG(st.st_mode)) {
|
||||
/* When extending regular files, we get zeros from the OS */
|
||||
@@ -2484,9 +2476,8 @@ static inline bool raw_check_linux_aio(BDRVRawState *s)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int coroutine_fn GRAPH_RDLOCK
|
||||
raw_co_prw(BlockDriverState *bs, int64_t *offset_ptr, uint64_t bytes,
|
||||
QEMUIOVector *qiov, int type, int flags)
|
||||
static int coroutine_fn raw_co_prw(BlockDriverState *bs, int64_t *offset_ptr,
|
||||
uint64_t bytes, QEMUIOVector *qiov, int type)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
RawPosixAIOData acb;
|
||||
@@ -2517,13 +2508,13 @@ raw_co_prw(BlockDriverState *bs, int64_t *offset_ptr, uint64_t bytes,
|
||||
#ifdef CONFIG_LINUX_IO_URING
|
||||
} else if (raw_check_linux_io_uring(s)) {
|
||||
assert(qiov->size == bytes);
|
||||
ret = luring_co_submit(bs, s->fd, offset, qiov, type, flags);
|
||||
ret = luring_co_submit(bs, s->fd, offset, qiov, type);
|
||||
goto out;
|
||||
#endif
|
||||
#ifdef CONFIG_LINUX_AIO
|
||||
} else if (raw_check_linux_aio(s)) {
|
||||
assert(qiov->size == bytes);
|
||||
ret = laio_co_submit(s->fd, offset, qiov, type, flags,
|
||||
ret = laio_co_submit(s->fd, offset, qiov, type,
|
||||
s->aio_max_batch);
|
||||
goto out;
|
||||
#endif
|
||||
@@ -2543,10 +2534,6 @@ raw_co_prw(BlockDriverState *bs, int64_t *offset_ptr, uint64_t bytes,
|
||||
|
||||
assert(qiov->size == bytes);
|
||||
ret = raw_thread_pool_submit(handle_aiocb_rw, &acb);
|
||||
if (ret == 0 && (flags & BDRV_REQ_FUA)) {
|
||||
/* TODO Use pwritev2() instead if it's available */
|
||||
ret = bdrv_co_flush(bs);
|
||||
}
|
||||
goto out; /* Avoid the compiler err of unused label */
|
||||
|
||||
out:
|
||||
@@ -2580,18 +2567,18 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn GRAPH_RDLOCK
|
||||
raw_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||
QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||
static int coroutine_fn raw_co_preadv(BlockDriverState *bs, int64_t offset,
|
||||
int64_t bytes, QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags)
|
||||
{
|
||||
return raw_co_prw(bs, &offset, bytes, qiov, QEMU_AIO_READ, flags);
|
||||
return raw_co_prw(bs, &offset, bytes, qiov, QEMU_AIO_READ);
|
||||
}
|
||||
|
||||
static int coroutine_fn GRAPH_RDLOCK
|
||||
raw_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||
QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||
static int coroutine_fn raw_co_pwritev(BlockDriverState *bs, int64_t offset,
|
||||
int64_t bytes, QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags)
|
||||
{
|
||||
return raw_co_prw(bs, &offset, bytes, qiov, QEMU_AIO_WRITE, flags);
|
||||
return raw_co_prw(bs, &offset, bytes, qiov, QEMU_AIO_WRITE);
|
||||
}
|
||||
|
||||
static int coroutine_fn raw_co_flush_to_disk(BlockDriverState *bs)
|
||||
@@ -2613,12 +2600,12 @@ static int coroutine_fn raw_co_flush_to_disk(BlockDriverState *bs)
|
||||
|
||||
#ifdef CONFIG_LINUX_IO_URING
|
||||
if (raw_check_linux_io_uring(s)) {
|
||||
return luring_co_submit(bs, s->fd, 0, NULL, QEMU_AIO_FLUSH, 0);
|
||||
return luring_co_submit(bs, s->fd, 0, NULL, QEMU_AIO_FLUSH);
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_LINUX_AIO
|
||||
if (s->has_laio_fdsync && raw_check_linux_aio(s)) {
|
||||
return laio_co_submit(s->fd, 0, NULL, QEMU_AIO_FLUSH, 0, 0);
|
||||
return laio_co_submit(s->fd, 0, NULL, QEMU_AIO_FLUSH, 0);
|
||||
}
|
||||
#endif
|
||||
return raw_thread_pool_submit(handle_aiocb_flush, &acb);
|
||||
@@ -3525,11 +3512,10 @@ static int coroutine_fn raw_co_zone_mgmt(BlockDriverState *bs, BlockZoneOp op,
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BLKZONED)
|
||||
static int coroutine_fn GRAPH_RDLOCK
|
||||
raw_co_zone_append(BlockDriverState *bs,
|
||||
int64_t *offset,
|
||||
QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags) {
|
||||
static int coroutine_fn raw_co_zone_append(BlockDriverState *bs,
|
||||
int64_t *offset,
|
||||
QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags) {
|
||||
assert(flags == 0);
|
||||
int64_t zone_size_mask = bs->bl.zone_size - 1;
|
||||
int64_t iov_len = 0;
|
||||
@@ -3554,7 +3540,7 @@ raw_co_zone_append(BlockDriverState *bs,
|
||||
}
|
||||
|
||||
trace_zbd_zone_append(bs, *offset >> BDRV_SECTOR_BITS);
|
||||
return raw_co_prw(bs, offset, len, qiov, QEMU_AIO_ZONE_APPEND, 0);
|
||||
return raw_co_prw(bs, offset, len, qiov, QEMU_AIO_ZONE_APPEND);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@
|
||||
#include "trace.h"
|
||||
#include "block/thread-pool.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "block/qdict.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/module.h"
|
||||
|
||||
+7
-5
@@ -244,12 +244,14 @@ void coroutine_fn bdrv_graph_co_rdunlock(void)
|
||||
smp_mb();
|
||||
|
||||
/*
|
||||
* Always kick: bdrv_graph_wrlock() zeroes has_writer while polling (to
|
||||
* let callbacks take the reader lock via the fast path), so we cannot
|
||||
* rely on has_writer to detect a waiting writer. aio_wait_kick() is a
|
||||
* no-op when no one is waiting, so it is cheap in the common case.
|
||||
* has_writer == 0: this means reader will read reader_count decreased
|
||||
* has_writer == 1: we don't know if writer read reader_count old or
|
||||
* new. Therefore, kick again so on next iteration
|
||||
* writer will for sure read the updated value.
|
||||
*/
|
||||
aio_wait_kick();
|
||||
if (qatomic_read(&has_writer)) {
|
||||
aio_wait_kick();
|
||||
}
|
||||
}
|
||||
|
||||
void bdrv_graph_rdlock_main_loop(void)
|
||||
|
||||
+1
-19
@@ -721,14 +721,11 @@ BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState *bs)
|
||||
Coroutine *self = qemu_coroutine_self();
|
||||
IO_CODE();
|
||||
|
||||
qemu_mutex_lock(&bs->reqs_lock);
|
||||
QLIST_FOREACH(req, &bs->tracked_requests, list) {
|
||||
if (req->co == self) {
|
||||
qemu_mutex_unlock(&bs->reqs_lock);
|
||||
return req;
|
||||
}
|
||||
}
|
||||
qemu_mutex_unlock(&bs->reqs_lock);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1061,10 +1058,6 @@ bdrv_driver_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
|
||||
if (bs->open_flags & BDRV_O_NO_FLUSH) {
|
||||
flags &= ~BDRV_REQ_FUA;
|
||||
}
|
||||
|
||||
if ((flags & BDRV_REQ_FUA) &&
|
||||
(~bs->supported_write_flags & BDRV_REQ_FUA)) {
|
||||
flags &= ~BDRV_REQ_FUA;
|
||||
@@ -1920,18 +1913,7 @@ bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||
assert(!bs->supported_zero_flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO The ret == -EINVAL && num < alignment case is a workaround for
|
||||
* when request_alignment is 1 on files with cache=writeback. The Linux
|
||||
* ioctl(BLKZEROOUT) requires block alignment and will fail with
|
||||
* EINVAL. The block layer should align the request to
|
||||
* write_zeroes_alignment instead of trying the syscall, failing, and
|
||||
* falling back to a bounce buffer. Doing that is not easy so for now
|
||||
* we use a bounce buffer:
|
||||
* https://lore.kernel.org/qemu-devel/[email protected]/
|
||||
*/
|
||||
if ((ret == -ENOTSUP || (ret == -EINVAL && num < alignment)) &&
|
||||
!(flags & BDRV_REQ_NO_FALLBACK)) {
|
||||
if (ret == -ENOTSUP && !(flags & BDRV_REQ_NO_FALLBACK)) {
|
||||
/* Fall back to bounce buffer if write zeroes is unsupported */
|
||||
BdrvRequestFlags write_flags = flags & ~BDRV_REQ_ZERO_WRITE;
|
||||
|
||||
|
||||
+6
-35
@@ -120,14 +120,11 @@ static void luring_resubmit_short_read(LuringState *s, LuringAIOCB *luringcb,
|
||||
* event loop. When there are no events left to complete the BH is being
|
||||
* canceled.
|
||||
*
|
||||
* Returns whether ioq_submit() must be called again afterwards since requests
|
||||
* were resubmitted via luring_resubmit().
|
||||
*/
|
||||
static bool luring_process_completions(LuringState *s)
|
||||
static void luring_process_completions(LuringState *s)
|
||||
{
|
||||
struct io_uring_cqe *cqes;
|
||||
int total_bytes;
|
||||
bool resubmit = false;
|
||||
|
||||
defer_call_begin();
|
||||
|
||||
@@ -185,7 +182,6 @@ static bool luring_process_completions(LuringState *s)
|
||||
*/
|
||||
if (ret == -EINTR || ret == -EAGAIN) {
|
||||
luring_resubmit(s, luringcb);
|
||||
resubmit = true;
|
||||
continue;
|
||||
}
|
||||
} else if (!luringcb->qiov) {
|
||||
@@ -198,7 +194,6 @@ static bool luring_process_completions(LuringState *s)
|
||||
if (luringcb->is_read) {
|
||||
if (ret > 0) {
|
||||
luring_resubmit_short_read(s, luringcb, ret);
|
||||
resubmit = true;
|
||||
continue;
|
||||
} else {
|
||||
/* Pad with zeroes */
|
||||
@@ -229,8 +224,6 @@ end:
|
||||
qemu_bh_cancel(s->completion_bh);
|
||||
|
||||
defer_call_end();
|
||||
|
||||
return resubmit;
|
||||
}
|
||||
|
||||
static int ioq_submit(LuringState *s)
|
||||
@@ -238,7 +231,6 @@ static int ioq_submit(LuringState *s)
|
||||
int ret = 0;
|
||||
LuringAIOCB *luringcb, *luringcb_next;
|
||||
|
||||
resubmit:
|
||||
while (s->io_q.in_queue > 0) {
|
||||
/*
|
||||
* Try to fetch sqes from the ring for requests waiting in
|
||||
@@ -268,14 +260,12 @@ resubmit:
|
||||
}
|
||||
s->io_q.blocked = (s->io_q.in_queue > 0);
|
||||
|
||||
if (ret >= 0 && s->io_q.in_flight) {
|
||||
if (s->io_q.in_flight) {
|
||||
/*
|
||||
* We can try to complete something just right away if there are
|
||||
* still requests in-flight.
|
||||
*/
|
||||
if (luring_process_completions(s)) {
|
||||
goto resubmit;
|
||||
}
|
||||
luring_process_completions(s);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -345,24 +335,15 @@ static void luring_deferred_fn(void *opaque)
|
||||
*
|
||||
*/
|
||||
static int luring_do_submit(int fd, LuringAIOCB *luringcb, LuringState *s,
|
||||
uint64_t offset, int type, BdrvRequestFlags flags)
|
||||
uint64_t offset, int type)
|
||||
{
|
||||
int ret;
|
||||
struct io_uring_sqe *sqes = &luringcb->sqeq;
|
||||
|
||||
switch (type) {
|
||||
case QEMU_AIO_WRITE:
|
||||
#ifdef HAVE_IO_URING_PREP_WRITEV2
|
||||
{
|
||||
int luring_flags = (flags & BDRV_REQ_FUA) ? RWF_DSYNC : 0;
|
||||
io_uring_prep_writev2(sqes, fd, luringcb->qiov->iov,
|
||||
luringcb->qiov->niov, offset, luring_flags);
|
||||
}
|
||||
#else
|
||||
assert(flags == 0);
|
||||
io_uring_prep_writev(sqes, fd, luringcb->qiov->iov,
|
||||
luringcb->qiov->niov, offset);
|
||||
#endif
|
||||
break;
|
||||
case QEMU_AIO_ZONE_APPEND:
|
||||
io_uring_prep_writev(sqes, fd, luringcb->qiov->iov,
|
||||
@@ -399,8 +380,7 @@ static int luring_do_submit(int fd, LuringAIOCB *luringcb, LuringState *s,
|
||||
}
|
||||
|
||||
int coroutine_fn luring_co_submit(BlockDriverState *bs, int fd, uint64_t offset,
|
||||
QEMUIOVector *qiov, int type,
|
||||
BdrvRequestFlags flags)
|
||||
QEMUIOVector *qiov, int type)
|
||||
{
|
||||
int ret;
|
||||
AioContext *ctx = qemu_get_current_aio_context();
|
||||
@@ -413,7 +393,7 @@ int coroutine_fn luring_co_submit(BlockDriverState *bs, int fd, uint64_t offset,
|
||||
};
|
||||
trace_luring_co_submit(bs, s, &luringcb, fd, offset, qiov ? qiov->size : 0,
|
||||
type);
|
||||
ret = luring_do_submit(fd, &luringcb, s, offset, type, flags);
|
||||
ret = luring_do_submit(fd, &luringcb, s, offset, type);
|
||||
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
@@ -468,12 +448,3 @@ void luring_cleanup(LuringState *s)
|
||||
trace_luring_cleanup_state(s);
|
||||
g_free(s);
|
||||
}
|
||||
|
||||
bool luring_has_fua(void)
|
||||
{
|
||||
#ifdef HAVE_IO_URING_PREP_WRITEV2
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
+2
-2
@@ -44,8 +44,8 @@
|
||||
#include "system/replay.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-machine.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "crypto/secret.h"
|
||||
#include "scsi/utils.h"
|
||||
#include "trace.h"
|
||||
|
||||
+15
-110
@@ -36,37 +36,14 @@
|
||||
/* Maximum number of requests in a batch. (default value) */
|
||||
#define DEFAULT_MAX_BATCH 32
|
||||
|
||||
/*
|
||||
* Bound on how deep ioq_submit() may recurse on a single LaioQueue via the
|
||||
* ioq_submit -> qemu_laio_process_completions -> defer_call_end ->
|
||||
* laio_deferred_fn -> ioq_submit cycle. The cycle terminates naturally
|
||||
* when io_submit(2) returns asynchronously (O_DIRECT), but can grow
|
||||
* without bound when submissions complete synchronously. On overflow
|
||||
* the caller returns without submitting; the outermost
|
||||
* qemu_laio_process_completions() has already scheduled s->completion_bh
|
||||
* (via qemu_bh_schedule() at the top of that function), which resumes
|
||||
* submission from the next event-loop dispatch.
|
||||
*/
|
||||
#define IOQ_SUBMIT_MAX_DEPTH 8
|
||||
|
||||
struct qemu_laiocb {
|
||||
Coroutine *co;
|
||||
LinuxAioState *ctx;
|
||||
struct iocb iocb;
|
||||
ssize_t ret;
|
||||
off_t offset;
|
||||
size_t nbytes;
|
||||
QEMUIOVector *qiov;
|
||||
|
||||
/* For handling short reads/writes */
|
||||
size_t total_done;
|
||||
QEMUIOVector resubmit_qiov;
|
||||
|
||||
int fd;
|
||||
int type;
|
||||
BdrvRequestFlags flags;
|
||||
|
||||
uint64_t dev_max_batch;
|
||||
bool is_read;
|
||||
QSIMPLEQ_ENTRY(qemu_laiocb) next;
|
||||
};
|
||||
|
||||
@@ -74,7 +51,6 @@ typedef struct {
|
||||
unsigned int in_queue;
|
||||
unsigned int in_flight;
|
||||
bool blocked;
|
||||
unsigned int submit_depth;
|
||||
QSIMPLEQ_HEAD(, qemu_laiocb) pending;
|
||||
} LaioQueue;
|
||||
|
||||
@@ -92,61 +68,28 @@ struct LinuxAioState {
|
||||
};
|
||||
|
||||
static void ioq_submit(LinuxAioState *s);
|
||||
static int laio_do_submit(struct qemu_laiocb *laiocb);
|
||||
|
||||
static inline ssize_t io_event_ret(struct io_event *ev)
|
||||
{
|
||||
return (ssize_t)(((uint64_t)ev->res2 << 32) | ev->res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retry tail of short requests.
|
||||
*/
|
||||
static int laio_resubmit_short_io(struct qemu_laiocb *laiocb, size_t done)
|
||||
{
|
||||
QEMUIOVector *resubmit_qiov = &laiocb->resubmit_qiov;
|
||||
|
||||
laiocb->total_done += done;
|
||||
|
||||
if (!resubmit_qiov->iov) {
|
||||
qemu_iovec_init(resubmit_qiov, laiocb->qiov->niov);
|
||||
} else {
|
||||
qemu_iovec_reset(resubmit_qiov);
|
||||
}
|
||||
qemu_iovec_concat(resubmit_qiov, laiocb->qiov,
|
||||
laiocb->total_done, laiocb->nbytes - laiocb->total_done);
|
||||
|
||||
return laio_do_submit(laiocb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Completes an AIO request.
|
||||
*/
|
||||
static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
|
||||
{
|
||||
ssize_t ret;
|
||||
int ret;
|
||||
|
||||
ret = laiocb->ret;
|
||||
if (ret != -ECANCELED) {
|
||||
if (ret == laiocb->nbytes - laiocb->total_done) {
|
||||
if (ret == laiocb->nbytes) {
|
||||
ret = 0;
|
||||
} else if (ret > 0 && (laiocb->type == QEMU_AIO_READ ||
|
||||
laiocb->type == QEMU_AIO_WRITE)) {
|
||||
ret = laio_resubmit_short_io(laiocb, ret);
|
||||
if (!ret) {
|
||||
return;
|
||||
}
|
||||
} else if (ret >= 0) {
|
||||
/*
|
||||
* For normal reads and writes, we only get here if ret == 0, which
|
||||
* means EOF for reads and ENOSPC for writes.
|
||||
* For zone-append, we get here with any ret >= 0, which we just
|
||||
* treat as ENOSPC, too (safer than resubmitting, probably, but not
|
||||
* 100 % clear).
|
||||
*/
|
||||
if (laiocb->type == QEMU_AIO_READ) {
|
||||
qemu_iovec_memset(laiocb->qiov, laiocb->total_done, 0,
|
||||
laiocb->qiov->size - laiocb->total_done);
|
||||
/* Short reads mean EOF, pad with zeros. */
|
||||
if (laiocb->is_read) {
|
||||
qemu_iovec_memset(laiocb->qiov, ret, 0,
|
||||
laiocb->qiov->size - ret);
|
||||
} else {
|
||||
ret = -ENOSPC;
|
||||
}
|
||||
@@ -154,9 +97,6 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
|
||||
}
|
||||
|
||||
laiocb->ret = ret;
|
||||
if (laiocb->resubmit_qiov.iov) {
|
||||
qemu_iovec_destroy(&laiocb->resubmit_qiov);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the coroutine is already entered it must be in ioq_submit() and
|
||||
@@ -345,7 +285,6 @@ static void ioq_init(LaioQueue *io_q)
|
||||
io_q->in_queue = 0;
|
||||
io_q->in_flight = 0;
|
||||
io_q->blocked = false;
|
||||
io_q->submit_depth = 0;
|
||||
}
|
||||
|
||||
static void ioq_submit(LinuxAioState *s)
|
||||
@@ -355,11 +294,6 @@ static void ioq_submit(LinuxAioState *s)
|
||||
struct iocb *iocbs[MAX_EVENTS];
|
||||
QSIMPLEQ_HEAD(, qemu_laiocb) completed;
|
||||
|
||||
if (s->io_q.submit_depth >= IOQ_SUBMIT_MAX_DEPTH) {
|
||||
return;
|
||||
}
|
||||
s->io_q.submit_depth++;
|
||||
|
||||
do {
|
||||
if (s->io_q.in_flight >= MAX_EVENTS) {
|
||||
break;
|
||||
@@ -405,8 +339,6 @@ static void ioq_submit(LinuxAioState *s)
|
||||
* pended requests will be submitted from there.
|
||||
*/
|
||||
}
|
||||
|
||||
s->io_q.submit_depth--;
|
||||
}
|
||||
|
||||
static uint64_t laio_max_batch(LinuxAioState *s, uint64_t dev_max_batch)
|
||||
@@ -435,29 +367,16 @@ static void laio_deferred_fn(void *opaque)
|
||||
}
|
||||
}
|
||||
|
||||
static int laio_do_submit(struct qemu_laiocb *laiocb)
|
||||
static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
|
||||
int type, uint64_t dev_max_batch)
|
||||
{
|
||||
LinuxAioState *s = laiocb->ctx;
|
||||
struct iocb *iocbs = &laiocb->iocb;
|
||||
QEMUIOVector *qiov = laiocb->qiov;
|
||||
int fd = laiocb->fd;
|
||||
off_t offset = laiocb->offset + laiocb->total_done;
|
||||
|
||||
if (laiocb->resubmit_qiov.iov) {
|
||||
qiov = &laiocb->resubmit_qiov;
|
||||
}
|
||||
|
||||
switch (laiocb->type) {
|
||||
switch (type) {
|
||||
case QEMU_AIO_WRITE:
|
||||
#ifdef HAVE_IO_PREP_PWRITEV2
|
||||
{
|
||||
int laio_flags = (laiocb->flags & BDRV_REQ_FUA) ? RWF_DSYNC : 0;
|
||||
io_prep_pwritev2(iocbs, fd, qiov->iov, qiov->niov, offset, laio_flags);
|
||||
}
|
||||
#else
|
||||
assert(laiocb->flags == 0);
|
||||
io_prep_pwritev(iocbs, fd, qiov->iov, qiov->niov, offset);
|
||||
#endif
|
||||
break;
|
||||
case QEMU_AIO_ZONE_APPEND:
|
||||
io_prep_pwritev(iocbs, fd, qiov->iov, qiov->niov, offset);
|
||||
@@ -471,7 +390,7 @@ static int laio_do_submit(struct qemu_laiocb *laiocb)
|
||||
/* Currently Linux kernel does not support other operations */
|
||||
default:
|
||||
fprintf(stderr, "%s: invalid AIO request type 0x%x.\n",
|
||||
__func__, laiocb->type);
|
||||
__func__, type);
|
||||
return -EIO;
|
||||
}
|
||||
io_set_eventfd(&laiocb->iocb, event_notifier_get_fd(&s->e));
|
||||
@@ -479,7 +398,7 @@ static int laio_do_submit(struct qemu_laiocb *laiocb)
|
||||
QSIMPLEQ_INSERT_TAIL(&s->io_q.pending, laiocb, next);
|
||||
s->io_q.in_queue++;
|
||||
if (!s->io_q.blocked) {
|
||||
if (s->io_q.in_queue >= laio_max_batch(s, laiocb->dev_max_batch)) {
|
||||
if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch)) {
|
||||
ioq_submit(s);
|
||||
} else {
|
||||
defer_call(laio_deferred_fn, s);
|
||||
@@ -490,25 +409,20 @@ static int laio_do_submit(struct qemu_laiocb *laiocb)
|
||||
}
|
||||
|
||||
int coroutine_fn laio_co_submit(int fd, uint64_t offset, QEMUIOVector *qiov,
|
||||
int type, BdrvRequestFlags flags,
|
||||
uint64_t dev_max_batch)
|
||||
int type, uint64_t dev_max_batch)
|
||||
{
|
||||
int ret;
|
||||
AioContext *ctx = qemu_get_current_aio_context();
|
||||
struct qemu_laiocb laiocb = {
|
||||
.co = qemu_coroutine_self(),
|
||||
.offset = offset,
|
||||
.nbytes = qiov ? qiov->size : 0,
|
||||
.ctx = aio_get_linux_aio(ctx),
|
||||
.ret = -EINPROGRESS,
|
||||
.is_read = (type == QEMU_AIO_READ),
|
||||
.qiov = qiov,
|
||||
.fd = fd,
|
||||
.type = type,
|
||||
.flags = flags,
|
||||
.dev_max_batch = dev_max_batch,
|
||||
};
|
||||
|
||||
ret = laio_do_submit(&laiocb);
|
||||
ret = laio_do_submit(fd, &laiocb, offset, type, dev_max_batch);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
@@ -591,12 +505,3 @@ bool laio_has_fdsync(int fd)
|
||||
io_destroy(ctx);
|
||||
return (ret == -EINVAL) ? false : true;
|
||||
}
|
||||
|
||||
bool laio_has_fua(void)
|
||||
{
|
||||
#ifdef HAVE_IO_PREP_PWRITEV2
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
+38
-52
@@ -98,7 +98,6 @@ typedef struct MirrorBlockJob {
|
||||
|
||||
typedef struct MirrorBDSOpaque {
|
||||
MirrorBlockJob *job;
|
||||
BdrvDirtyBitmap *dirty_bitmap;
|
||||
bool stop;
|
||||
bool is_commit;
|
||||
} MirrorBDSOpaque;
|
||||
@@ -431,7 +430,7 @@ static void coroutine_fn mirror_co_discard(void *opaque)
|
||||
*op->bytes_handled = op->bytes;
|
||||
op->is_in_flight = true;
|
||||
|
||||
ret = blk_co_pdiscard(op->s->target, op->offset, op->bytes, 0);
|
||||
ret = blk_co_pdiscard(op->s->target, op->offset, op->bytes);
|
||||
mirror_write_complete(op, ret);
|
||||
}
|
||||
|
||||
@@ -1185,25 +1184,23 @@ static void mirror_complete(Job *job, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!s->should_complete) {
|
||||
/* block all operations on to_replace bs */
|
||||
if (s->replaces) {
|
||||
s->to_replace = bdrv_find_node(s->replaces);
|
||||
if (!s->to_replace) {
|
||||
error_setg(errp, "Node name '%s' not found", s->replaces);
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO Translate this into child freeze system. */
|
||||
error_setg(&s->replace_blocker,
|
||||
"block device is in use by block-job-complete");
|
||||
bdrv_op_block_all(s->to_replace, s->replace_blocker);
|
||||
bdrv_ref(s->to_replace);
|
||||
/* block all operations on to_replace bs */
|
||||
if (s->replaces) {
|
||||
s->to_replace = bdrv_find_node(s->replaces);
|
||||
if (!s->to_replace) {
|
||||
error_setg(errp, "Node name '%s' not found", s->replaces);
|
||||
return;
|
||||
}
|
||||
|
||||
s->should_complete = true;
|
||||
/* TODO Translate this into child freeze system. */
|
||||
error_setg(&s->replace_blocker,
|
||||
"block device is in use by block-job-complete");
|
||||
bdrv_op_block_all(s->to_replace, s->replace_blocker);
|
||||
bdrv_ref(s->to_replace);
|
||||
}
|
||||
|
||||
s->should_complete = true;
|
||||
|
||||
/* If the job is paused, it will be re-entered when it is resumed */
|
||||
WITH_JOB_LOCK_GUARD() {
|
||||
if (!job->paused) {
|
||||
@@ -1414,7 +1411,7 @@ do_sync_target_write(MirrorBlockJob *job, MirrorMethod method,
|
||||
|
||||
case MIRROR_METHOD_DISCARD:
|
||||
assert(!qiov);
|
||||
ret = blk_co_pdiscard(job->target, offset, bytes, 0);
|
||||
ret = blk_co_pdiscard(job->target, offset, bytes);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1560,11 +1557,9 @@ bdrv_mirror_top_do_write(BlockDriverState *bs, MirrorMethod method,
|
||||
abort();
|
||||
}
|
||||
|
||||
if (!copy_to_target) {
|
||||
if (s->job) {
|
||||
qatomic_set(&s->job->actively_synced, false);
|
||||
}
|
||||
bdrv_set_dirty_bitmap(s->dirty_bitmap, offset, bytes);
|
||||
if (!copy_to_target && s->job && s->job->dirty_bitmap) {
|
||||
qatomic_set(&s->job->actively_synced, false);
|
||||
bdrv_set_dirty_bitmap(s->job->dirty_bitmap, offset, bytes);
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
@@ -1790,35 +1785,13 @@ static BlockJob *mirror_start_job(
|
||||
|
||||
bdrv_drained_begin(bs);
|
||||
ret = bdrv_append(mirror_top_bs, bs, errp);
|
||||
if (ret < 0) {
|
||||
bdrv_drained_end(bs);
|
||||
bdrv_unref(mirror_top_bs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bs_opaque->dirty_bitmap = bdrv_create_dirty_bitmap(mirror_top_bs,
|
||||
granularity,
|
||||
NULL, errp);
|
||||
if (!bs_opaque->dirty_bitmap) {
|
||||
bdrv_drained_end(bs);
|
||||
bdrv_unref(mirror_top_bs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* The mirror job doesn't use the block layer's dirty tracking because it
|
||||
* needs to be able to switch seemlessly between background copy mode (which
|
||||
* does need dirty tracking) and write blocking mode (which doesn't) and
|
||||
* doing that would require draining the node. Instead, mirror_top_bs takes
|
||||
* care of updating the dirty bitmap as appropriate.
|
||||
*
|
||||
* Note that write blocking mode only becomes effective after mirror_run()
|
||||
* sets mirror_top_opaque->job (see should_copy_to_target()). Until then,
|
||||
* we're still in background copy mode irrespective of @copy_mode.
|
||||
*/
|
||||
bdrv_disable_dirty_bitmap(bs_opaque->dirty_bitmap);
|
||||
bdrv_drained_end(bs);
|
||||
|
||||
if (ret < 0) {
|
||||
bdrv_unref(mirror_top_bs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Make sure that the source is not resized while the job is running */
|
||||
s = block_job_create(job_id, driver, NULL, mirror_top_bs,
|
||||
BLK_PERM_CONSISTENT_READ,
|
||||
@@ -1913,13 +1886,24 @@ static BlockJob *mirror_start_job(
|
||||
s->base_overlay = bdrv_find_overlay(bs, base);
|
||||
s->granularity = granularity;
|
||||
s->buf_size = ROUND_UP(buf_size, granularity);
|
||||
s->dirty_bitmap = bs_opaque->dirty_bitmap;
|
||||
s->unmap = unmap;
|
||||
if (auto_complete) {
|
||||
s->should_complete = true;
|
||||
}
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
|
||||
s->dirty_bitmap = bdrv_create_dirty_bitmap(s->mirror_top_bs, granularity,
|
||||
NULL, errp);
|
||||
if (!s->dirty_bitmap) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/*
|
||||
* The dirty bitmap is set by bdrv_mirror_top_do_write() when not in active
|
||||
* mode.
|
||||
*/
|
||||
bdrv_disable_dirty_bitmap(s->dirty_bitmap);
|
||||
|
||||
bdrv_graph_wrlock();
|
||||
ret = block_job_add_bdrv(&s->common, "source", bs, 0,
|
||||
BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
|
||||
@@ -1999,6 +1983,9 @@ fail:
|
||||
g_free(s->replaces);
|
||||
blk_unref(s->target);
|
||||
bs_opaque->job = NULL;
|
||||
if (s->dirty_bitmap) {
|
||||
bdrv_release_dirty_bitmap(s->dirty_bitmap);
|
||||
}
|
||||
job_early_fail(&s->common.job);
|
||||
}
|
||||
|
||||
@@ -2012,7 +1999,6 @@ fail:
|
||||
bdrv_graph_wrunlock();
|
||||
bdrv_drained_end(bs);
|
||||
|
||||
bdrv_release_dirty_bitmap(bs_opaque->dirty_bitmap);
|
||||
bdrv_unref(mirror_top_bs);
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "system/blockdev.h"
|
||||
#include "qapi/qapi-commands-block.h"
|
||||
#include "qapi/qapi-commands-block-export.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/config-file.h"
|
||||
@@ -402,8 +402,8 @@ void hmp_nbd_server_start(Monitor *mon, const QDict *qdict)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
nbd_server_start(addr, NBD_DEFAULT_HANDSHAKE_MAX_SECS, NULL, NULL,
|
||||
NBD_DEFAULT_MAX_CONNECTIONS, &local_err);
|
||||
nbd_server_start(addr, NULL, NULL, NBD_DEFAULT_MAX_CONNECTIONS,
|
||||
&local_err);
|
||||
qapi_free_SocketAddress(addr);
|
||||
if (local_err != NULL) {
|
||||
goto exit;
|
||||
@@ -630,12 +630,11 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
|
||||
}
|
||||
|
||||
if (inserted) {
|
||||
monitor_printf(mon, ": %s (%s%s%s%s)\n",
|
||||
monitor_printf(mon, ": %s (%s%s%s)\n",
|
||||
inserted->file,
|
||||
inserted->drv,
|
||||
inserted->ro ? ", read-only" : "",
|
||||
inserted->encrypted ? ", encrypted" : "",
|
||||
inserted->active ? "" : ", inactive");
|
||||
inserted->encrypted ? ", encrypted" : "");
|
||||
} else {
|
||||
monitor_printf(mon, ": [not inserted]\n");
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
#include "qemu/main-loop.h"
|
||||
|
||||
#include "qapi/qapi-visit-sockets.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/clone-visitor.h"
|
||||
|
||||
#include "block/qdict.h"
|
||||
|
||||
+27
-19
@@ -41,8 +41,8 @@
|
||||
#include "qemu/cutils.h"
|
||||
#include "system/replay.h"
|
||||
#include "qapi/qapi-visit-block-core.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qobject-input-visitor.h"
|
||||
#include "qapi/qobject-output-visitor.h"
|
||||
#include <nfsc/libnfs.h>
|
||||
@@ -69,6 +69,7 @@ typedef struct NFSClient {
|
||||
typedef struct NFSRPC {
|
||||
BlockDriverState *bs;
|
||||
int ret;
|
||||
int complete;
|
||||
QEMUIOVector *iov;
|
||||
struct stat *st;
|
||||
Coroutine *co;
|
||||
@@ -229,6 +230,14 @@ static void coroutine_fn nfs_co_init_task(BlockDriverState *bs, NFSRPC *task)
|
||||
};
|
||||
}
|
||||
|
||||
static void nfs_co_generic_bh_cb(void *opaque)
|
||||
{
|
||||
NFSRPC *task = opaque;
|
||||
|
||||
task->complete = 1;
|
||||
aio_co_wake(task->co);
|
||||
}
|
||||
|
||||
/* Called (via nfs_service) with QemuMutex held. */
|
||||
static void
|
||||
nfs_co_generic_cb(int ret, struct nfs_context *nfs, void *data,
|
||||
@@ -247,17 +256,8 @@ nfs_co_generic_cb(int ret, struct nfs_context *nfs, void *data,
|
||||
if (task->ret < 0) {
|
||||
error_report("NFS Error: %s", nfs_get_error(nfs));
|
||||
}
|
||||
|
||||
/*
|
||||
* Using aio_co_wake() here could re-enter the coroutine directly, while we
|
||||
* still hold the mutex. The current request will not attempt to re-take
|
||||
* the mutex, so that is fine; but if the same coroutine then goes on to
|
||||
* submit another request, that new request will try to re-take the mutex,
|
||||
* resulting in a deadlock.
|
||||
* To prevent that, only schedule the coroutine so it will be entered later,
|
||||
* with the mutex released.
|
||||
*/
|
||||
aio_co_schedule(qemu_coroutine_get_aio_context(task->co), task->co);
|
||||
replay_bh_schedule_oneshot_event(task->client->aio_context,
|
||||
nfs_co_generic_bh_cb, task);
|
||||
}
|
||||
|
||||
static int coroutine_fn nfs_co_preadv(BlockDriverState *bs, int64_t offset,
|
||||
@@ -278,7 +278,9 @@ static int coroutine_fn nfs_co_preadv(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
nfs_set_events(client);
|
||||
}
|
||||
qemu_coroutine_yield();
|
||||
while (!task.complete) {
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
|
||||
if (task.ret < 0) {
|
||||
return task.ret;
|
||||
@@ -326,7 +328,9 @@ static int coroutine_fn nfs_co_pwritev(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
nfs_set_events(client);
|
||||
}
|
||||
qemu_coroutine_yield();
|
||||
while (!task.complete) {
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
|
||||
if (my_buffer) {
|
||||
g_free(buf);
|
||||
@@ -354,7 +358,9 @@ static int coroutine_fn nfs_co_flush(BlockDriverState *bs)
|
||||
|
||||
nfs_set_events(client);
|
||||
}
|
||||
qemu_coroutine_yield();
|
||||
while (!task.complete) {
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
|
||||
return task.ret;
|
||||
}
|
||||
@@ -717,8 +723,8 @@ nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *data,
|
||||
if (task->ret < 0) {
|
||||
error_report("NFS Error: %s", nfs_get_error(nfs));
|
||||
}
|
||||
/* Must not use aio_co_wake(), see nfs_co_generic_cb() */
|
||||
aio_co_schedule(qemu_coroutine_get_aio_context(task->co), task->co);
|
||||
replay_bh_schedule_oneshot_event(task->client->aio_context,
|
||||
nfs_co_generic_bh_cb, task);
|
||||
}
|
||||
|
||||
static int64_t coroutine_fn nfs_co_get_allocated_file_size(BlockDriverState *bs)
|
||||
@@ -742,7 +748,9 @@ static int64_t coroutine_fn nfs_co_get_allocated_file_size(BlockDriverState *bs)
|
||||
|
||||
nfs_set_events(client);
|
||||
}
|
||||
qemu_coroutine_yield();
|
||||
while (!task.complete) {
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
|
||||
return (task.ret < 0 ? task.ret : st.st_blocks * 512);
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
#include "block/block-io.h"
|
||||
|
||||
+12
-49
@@ -14,8 +14,8 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include <linux/vfio.h>
|
||||
#include "qapi/error.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qemu/defer-call.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/main-loop.h"
|
||||
@@ -64,7 +64,6 @@ typedef struct {
|
||||
} NVMeQueue;
|
||||
|
||||
typedef struct {
|
||||
/* Called from nvme_process_completion() in the BDS's main AioContext */
|
||||
BlockCompletionFunc *cb;
|
||||
void *opaque;
|
||||
int cid;
|
||||
@@ -84,7 +83,6 @@ typedef struct {
|
||||
uint8_t *prp_list_pages;
|
||||
|
||||
/* Fields protected by @lock */
|
||||
/* Coroutines in this queue are woken in their own context */
|
||||
CoQueue free_req_queue;
|
||||
NVMeQueue sq, cq;
|
||||
int cq_phase;
|
||||
@@ -93,7 +91,7 @@ typedef struct {
|
||||
int need_kick;
|
||||
int inflight;
|
||||
|
||||
/* Thread-safe, no lock necessary; runs in the BDS's main context */
|
||||
/* Thread-safe, no lock necessary */
|
||||
QEMUBH *completion_bh;
|
||||
} NVMeQueuePair;
|
||||
|
||||
@@ -207,13 +205,11 @@ static void nvme_free_queue_pair(NVMeQueuePair *q)
|
||||
g_free(q);
|
||||
}
|
||||
|
||||
/* Runs in the BDS's main AioContext */
|
||||
static void nvme_free_req_queue_cb(void *opaque)
|
||||
{
|
||||
NVMeQueuePair *q = opaque;
|
||||
|
||||
qemu_mutex_lock(&q->lock);
|
||||
/* qemu_co_enter_next() wakes the coroutine in its own AioContext */
|
||||
while (q->free_req_head != -1 &&
|
||||
qemu_co_enter_next(&q->free_req_queue, &q->lock)) {
|
||||
/* Retry waiting requests */
|
||||
@@ -284,7 +280,7 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* With q->lock, must be run in the BDS's main AioContext */
|
||||
/* With q->lock */
|
||||
static void nvme_kick(NVMeQueuePair *q)
|
||||
{
|
||||
BDRVNVMeState *s = q->s;
|
||||
@@ -311,10 +307,7 @@ static NVMeRequest *nvme_get_free_req_nofail_locked(NVMeQueuePair *q)
|
||||
return req;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a free request element if any, otherwise return NULL.
|
||||
* May be run from any AioContext.
|
||||
*/
|
||||
/* Return a free request element if any, otherwise return NULL. */
|
||||
static NVMeRequest *nvme_get_free_req_nowait(NVMeQueuePair *q)
|
||||
{
|
||||
QEMU_LOCK_GUARD(&q->lock);
|
||||
@@ -327,7 +320,6 @@ static NVMeRequest *nvme_get_free_req_nowait(NVMeQueuePair *q)
|
||||
/*
|
||||
* Wait for a free request to become available if necessary, then
|
||||
* return it.
|
||||
* May be called in any AioContext.
|
||||
*/
|
||||
static coroutine_fn NVMeRequest *nvme_get_free_req(NVMeQueuePair *q)
|
||||
{
|
||||
@@ -335,21 +327,20 @@ static coroutine_fn NVMeRequest *nvme_get_free_req(NVMeQueuePair *q)
|
||||
|
||||
while (q->free_req_head == -1) {
|
||||
trace_nvme_free_req_queue_wait(q->s, q->index);
|
||||
/* nvme_free_req_queue_cb() wakes us in our own AioContext */
|
||||
qemu_co_queue_wait(&q->free_req_queue, &q->lock);
|
||||
}
|
||||
|
||||
return nvme_get_free_req_nofail_locked(q);
|
||||
}
|
||||
|
||||
/* With q->lock, may be called in any AioContext */
|
||||
/* With q->lock */
|
||||
static void nvme_put_free_req_locked(NVMeQueuePair *q, NVMeRequest *req)
|
||||
{
|
||||
req->free_req_next = q->free_req_head;
|
||||
q->free_req_head = req - q->reqs;
|
||||
}
|
||||
|
||||
/* With q->lock, may be called in any AioContext */
|
||||
/* With q->lock */
|
||||
static void nvme_wake_free_req_locked(NVMeQueuePair *q)
|
||||
{
|
||||
if (!qemu_co_queue_empty(&q->free_req_queue)) {
|
||||
@@ -358,7 +349,7 @@ static void nvme_wake_free_req_locked(NVMeQueuePair *q)
|
||||
}
|
||||
}
|
||||
|
||||
/* Insert a request in the freelist and wake waiters (from any AioContext) */
|
||||
/* Insert a request in the freelist and wake waiters */
|
||||
static void nvme_put_free_req_and_wake(NVMeQueuePair *q, NVMeRequest *req)
|
||||
{
|
||||
qemu_mutex_lock(&q->lock);
|
||||
@@ -389,7 +380,7 @@ static inline int nvme_translate_error(const NvmeCqe *c)
|
||||
}
|
||||
}
|
||||
|
||||
/* With q->lock, must be run in the BDS's main AioContext */
|
||||
/* With q->lock */
|
||||
static bool nvme_process_completion(NVMeQueuePair *q)
|
||||
{
|
||||
BDRVNVMeState *s = q->s;
|
||||
@@ -459,7 +450,6 @@ static bool nvme_process_completion(NVMeQueuePair *q)
|
||||
return progress;
|
||||
}
|
||||
|
||||
/* As q->completion_bh, runs in the BDS's main AioContext */
|
||||
static void nvme_process_completion_bh(void *opaque)
|
||||
{
|
||||
NVMeQueuePair *q = opaque;
|
||||
@@ -490,8 +480,7 @@ static void nvme_trace_command(const NvmeCmd *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
/* Must be run in the BDS's main AioContext */
|
||||
static void nvme_kick_and_check_completions(void *opaque)
|
||||
static void nvme_deferred_fn(void *opaque)
|
||||
{
|
||||
NVMeQueuePair *q = opaque;
|
||||
|
||||
@@ -500,20 +489,6 @@ static void nvme_kick_and_check_completions(void *opaque)
|
||||
nvme_process_completion(q);
|
||||
}
|
||||
|
||||
/* Runs in nvme_submit_command()'s AioContext */
|
||||
static void nvme_deferred_fn(void *opaque)
|
||||
{
|
||||
NVMeQueuePair *q = opaque;
|
||||
|
||||
if (qemu_get_current_aio_context() == q->s->aio_context) {
|
||||
nvme_kick_and_check_completions(q);
|
||||
} else {
|
||||
aio_bh_schedule_oneshot(q->s->aio_context,
|
||||
nvme_kick_and_check_completions, q);
|
||||
}
|
||||
}
|
||||
|
||||
/* May be run in any AioContext */
|
||||
static void nvme_submit_command(NVMeQueuePair *q, NVMeRequest *req,
|
||||
NvmeCmd *cmd, BlockCompletionFunc cb,
|
||||
void *opaque)
|
||||
@@ -535,7 +510,6 @@ static void nvme_submit_command(NVMeQueuePair *q, NVMeRequest *req,
|
||||
defer_call(nvme_deferred_fn, q);
|
||||
}
|
||||
|
||||
/* Put into NVMeRequest.cb, so runs in the BDS's main AioContext */
|
||||
static void nvme_admin_cmd_sync_cb(void *opaque, int ret)
|
||||
{
|
||||
int *pret = opaque;
|
||||
@@ -543,7 +517,6 @@ static void nvme_admin_cmd_sync_cb(void *opaque, int ret)
|
||||
aio_wait_kick();
|
||||
}
|
||||
|
||||
/* Must be run in the BDS's or qemu's main AioContext */
|
||||
static int nvme_admin_cmd_sync(BlockDriverState *bs, NvmeCmd *cmd)
|
||||
{
|
||||
BDRVNVMeState *s = bs->opaque;
|
||||
@@ -652,7 +625,6 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Must be run in the BDS's main AioContext */
|
||||
static void nvme_poll_queue(NVMeQueuePair *q)
|
||||
{
|
||||
const size_t cqe_offset = q->cq.head * NVME_CQ_ENTRY_BYTES;
|
||||
@@ -675,7 +647,6 @@ static void nvme_poll_queue(NVMeQueuePair *q)
|
||||
qemu_mutex_unlock(&q->lock);
|
||||
}
|
||||
|
||||
/* Must be run in the BDS's main AioContext */
|
||||
static void nvme_poll_queues(BDRVNVMeState *s)
|
||||
{
|
||||
int i;
|
||||
@@ -685,7 +656,6 @@ static void nvme_poll_queues(BDRVNVMeState *s)
|
||||
}
|
||||
}
|
||||
|
||||
/* Run as an event notifier in the BDS's main AioContext */
|
||||
static void nvme_handle_event(EventNotifier *n)
|
||||
{
|
||||
BDRVNVMeState *s = container_of(n, BDRVNVMeState,
|
||||
@@ -739,7 +709,6 @@ out_error:
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Run as an event notifier in the BDS's main AioContext */
|
||||
static bool nvme_poll_cb(void *opaque)
|
||||
{
|
||||
EventNotifier *e = opaque;
|
||||
@@ -763,7 +732,6 @@ static bool nvme_poll_cb(void *opaque)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Run as an event notifier in the BDS's main AioContext */
|
||||
static void nvme_poll_ready(EventNotifier *e)
|
||||
{
|
||||
BDRVNVMeState *s = container_of(e, BDRVNVMeState,
|
||||
@@ -1065,7 +1033,7 @@ static int nvme_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Called with s->dma_map_lock, may be run in any AioContext */
|
||||
/* Called with s->dma_map_lock */
|
||||
static coroutine_fn int nvme_cmd_unmap_qiov(BlockDriverState *bs,
|
||||
QEMUIOVector *qiov)
|
||||
{
|
||||
@@ -1076,17 +1044,13 @@ static coroutine_fn int nvme_cmd_unmap_qiov(BlockDriverState *bs,
|
||||
if (!s->dma_map_count && !qemu_co_queue_empty(&s->dma_flush_queue)) {
|
||||
r = qemu_vfio_dma_reset_temporary(s->vfio);
|
||||
if (!r) {
|
||||
/*
|
||||
* Queue access is protected by the dma_map_lock, and all
|
||||
* coroutines are woken in their own AioContext
|
||||
*/
|
||||
qemu_co_queue_restart_all(&s->dma_flush_queue);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Called with s->dma_map_lock, may be run in any AioContext */
|
||||
/* Called with s->dma_map_lock */
|
||||
static coroutine_fn int nvme_cmd_map_qiov(BlockDriverState *bs, NvmeCmd *cmd,
|
||||
NVMeRequest *req, QEMUIOVector *qiov)
|
||||
{
|
||||
@@ -1205,7 +1169,6 @@ static void nvme_rw_cb_bh(void *opaque)
|
||||
qemu_coroutine_enter(data->co);
|
||||
}
|
||||
|
||||
/* Put into NVMeRequest.cb, so runs in the BDS's main AioContext */
|
||||
static void nvme_rw_cb(void *opaque, int ret)
|
||||
{
|
||||
NVMeCoData *data = opaque;
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
#include "system/block-backend.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qobject-input-visitor.h"
|
||||
#include "qapi/qapi-visit-block-core.h"
|
||||
#include "qemu/bswap.h"
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-block.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "system/block-backend.h"
|
||||
#include "system/blockdev.h"
|
||||
|
||||
|
||||
+5
-6
@@ -33,11 +33,11 @@
|
||||
#include "qapi/qapi-commands-block-core.h"
|
||||
#include "qapi/qobject-output-visitor.h"
|
||||
#include "qapi/qapi-visit-block-core.h"
|
||||
#include "qobject/qbool.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qlist.h"
|
||||
#include "qobject/qnum.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qbool.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qlist.h"
|
||||
#include "qapi/qmp/qnum.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "system/block-backend.h"
|
||||
|
||||
@@ -63,7 +63,6 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
|
||||
info->file = g_strdup(bs->filename);
|
||||
info->ro = bdrv_is_read_only(bs);
|
||||
info->drv = g_strdup(bs->drv->format_name);
|
||||
info->active = !bdrv_is_inactive(bs);
|
||||
info->encrypted = bs->encrypted;
|
||||
|
||||
info->cache = g_new(BlockdevCacheInfo, 1);
|
||||
|
||||
+2
-2
@@ -34,8 +34,8 @@
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/memalign.h"
|
||||
#include <zlib.h>
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qobject-input-visitor.h"
|
||||
#include "qapi/qapi-visit-block-core.h"
|
||||
#include "crypto/block.h"
|
||||
|
||||
+3
-49
@@ -1392,9 +1392,6 @@ count_single_write_clusters(BlockDriverState *bs, int nb_clusters,
|
||||
* the same cluster. In this case we need to wait until the previous
|
||||
* request has completed and updated the L2 table accordingly.
|
||||
*
|
||||
* If allow_shortening == true, instead of waiting for a dependency, *cur_bytes
|
||||
* can be shortened so that the cluster allocations don't overlap.
|
||||
*
|
||||
* Returns:
|
||||
* 0 if there was no dependency. *cur_bytes indicates the number of
|
||||
* bytes from guest_offset that can be read before the next
|
||||
@@ -1406,9 +1403,7 @@ count_single_write_clusters(BlockDriverState *bs, int nb_clusters,
|
||||
*/
|
||||
static int coroutine_fn handle_dependencies(BlockDriverState *bs,
|
||||
uint64_t guest_offset,
|
||||
uint64_t *cur_bytes,
|
||||
bool allow_shortening,
|
||||
QCowL2Meta **m)
|
||||
uint64_t *cur_bytes, QCowL2Meta **m)
|
||||
{
|
||||
BDRVQcow2State *s = bs->opaque;
|
||||
QCowL2Meta *old_alloc;
|
||||
@@ -1439,7 +1434,7 @@ static int coroutine_fn handle_dependencies(BlockDriverState *bs,
|
||||
|
||||
/* Conflict */
|
||||
|
||||
if (start < old_start && allow_shortening) {
|
||||
if (start < old_start) {
|
||||
/* Stop at the start of a running allocation */
|
||||
bytes = old_start - start;
|
||||
} else {
|
||||
@@ -1474,29 +1469,6 @@ static int coroutine_fn handle_dependencies(BlockDriverState *bs,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void coroutine_mixed_fn qcow2_wait_for_dependencies(BlockDriverState *bs,
|
||||
uint64_t guest_offset,
|
||||
uint64_t bytes)
|
||||
{
|
||||
BDRVQcow2State *s = bs->opaque;
|
||||
QCowL2Meta *m = NULL;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Discard has some non-coroutine callers (creating internal snapshots and
|
||||
* make empty). They are calling from qemu-img or in a drained section, so
|
||||
* we know that no writes can be in progress.
|
||||
*/
|
||||
if (!qemu_in_coroutine()) {
|
||||
assert(QLIST_EMPTY(&s->cluster_allocs));
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
ret = handle_dependencies(bs, guest_offset, &bytes, false, &m);
|
||||
} while (ret == -EAGAIN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks how many already allocated clusters that don't require a new
|
||||
* allocation there are at the given guest_offset (up to *bytes).
|
||||
@@ -1868,7 +1840,7 @@ again:
|
||||
* the right synchronisation between the in-flight request and
|
||||
* the new one.
|
||||
*/
|
||||
ret = handle_dependencies(bs, start, &cur_bytes, true, m);
|
||||
ret = handle_dependencies(bs, start, &cur_bytes, m);
|
||||
if (ret == -EAGAIN) {
|
||||
/* Currently handle_dependencies() doesn't yield if we already had
|
||||
* an allocation. If it did, we would have to clean up the L2Meta
|
||||
@@ -2030,15 +2002,6 @@ int qcow2_cluster_discard(BlockDriverState *bs, uint64_t offset,
|
||||
int64_t cleared;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* If we're touching a cluster for which allocating writes are in flight,
|
||||
* wait for them to complete to avoid conflicting metadata updates.
|
||||
*
|
||||
* We don't need to allocate a QCowL2Meta for the discard operation because
|
||||
* s->lock is held for the duration of the whole operation.
|
||||
*/
|
||||
qcow2_wait_for_dependencies(bs, offset, bytes);
|
||||
|
||||
/* Caller must pass aligned values, except at image end */
|
||||
assert(QEMU_IS_ALIGNED(offset, s->cluster_size));
|
||||
assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) ||
|
||||
@@ -2201,15 +2164,6 @@ int coroutine_fn qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset,
|
||||
int64_t cleared;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* If we're touching a cluster for which allocating writes are in flight,
|
||||
* wait for them to complete to avoid conflicting metadata updates.
|
||||
*
|
||||
* We don't need to allocate a QCowL2Meta for the zeroize operation because
|
||||
* s->lock is held for the duration of the whole operation.
|
||||
*/
|
||||
qcow2_wait_for_dependencies(bs, offset, bytes);
|
||||
|
||||
/* If we have to stay in sync with an external data file, zero out
|
||||
* s->data_file first. */
|
||||
if (data_file_is_raw(bs)) {
|
||||
|
||||
+5
-11
@@ -32,8 +32,8 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-events-block-core.h"
|
||||
#include "qobject/qdict.h"
|
||||
#include "qobject/qstring.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "trace.h"
|
||||
#include "qemu/option_int.h"
|
||||
#include "qemu/cutils.h"
|
||||
@@ -1721,7 +1721,7 @@ qcow2_do_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
} else if (!(flags & BDRV_O_NO_IO)) {
|
||||
error_setg(errp, "Missing CRYPTO header for crypt method %d",
|
||||
s->crypt_method_header);
|
||||
ret = -EINVAL;
|
||||
@@ -1976,7 +1976,7 @@ static void qcow2_refresh_limits(BlockDriverState *bs, Error **errp)
|
||||
{
|
||||
BDRVQcow2State *s = bs->opaque;
|
||||
|
||||
if (s->crypto) {
|
||||
if (bs->encrypted) {
|
||||
/* Encryption works on a sector granularity */
|
||||
bs->bl.request_alignment = qcrypto_block_get_sector_size(s->crypto);
|
||||
}
|
||||
@@ -4088,16 +4088,10 @@ qcow2_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||
}
|
||||
|
||||
qemu_co_mutex_lock(&s->lock);
|
||||
/* We can have new write after previous check */
|
||||
offset -= head;
|
||||
bytes = s->subcluster_size;
|
||||
nr = s->subcluster_size;
|
||||
/*
|
||||
* Wait for in-flight allocating writes first: otherwise the type
|
||||
* check below could pass on UNALLOCATED while a yet-to-link_l2 write
|
||||
* completes during qcow2_subcluster_zeroize()'s own wait, letting the
|
||||
* resumed MAY_UNMAP discard the just-written data.
|
||||
*/
|
||||
qcow2_wait_for_dependencies(bs, offset, bytes);
|
||||
ret = qcow2_get_host_offset(bs, offset, &nr, &off, &type);
|
||||
if (ret < 0 ||
|
||||
(type != QCOW2_SUBCLUSTER_UNALLOCATED_PLAIN &&
|
||||
|
||||
Loaded 100 of 2013 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user