deprecation and linux-user tweaks (+test fix)
cover deprecation and linux-user tweaks (+test fix)
Hi,
This series contains the previously posted linux-user fix for dealing with weird mmap semantics as well as some tweaks to configure as suggested in a late review of my last PR. It includes tilegx in the modified configure logic for handling deprecated fixes. There is also a fix from Max for iotests although I suspect there will be a v2 of the patch soon.
Most need review:
- gitlab: create a build-deprecated target
- configure: include tilegx-linux-user in the auto-exclude logic
- configure: also skip deprecated targets with target-list-exclude
- configure: use add_to for tweaking deprecated_features
- linux-user: test, don't assert addr != test in pgb_reserved_va
Alex Bennée (5):
linux-user: test, don't assert addr != test in pgb_reserved_va
configure: use add_to for tweaking deprecated_features
configure: also skip deprecated targets with target-list-exclude
configure: include tilegx-linux-user in the auto-exclude logic
gitlab: create a build-deprecated target
Max Reitz (1):
iotests: Work around failing readlink -f
configure | 15 +++++++++++---- linux-user/elfload.c | 9 ++++----- .gitlab-ci.yml | 10 ++++++++++ .travis.yml | 3 +-- tests/qemu-iotests/check | 4 ++++ 5 files changed, 30 insertions(+), 11 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/6 linux-user: test, don't assert addr != test in pgb_reserved_va
On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel may still fail to give us the address we asked for despite having already probed the map for a valid hole. Asserting isn't particularly useful to the user so let us move the check up and expand the error_report a little to give them a fighting chance of working around the problem.
Ameliorates: ee94743034
--- linux-user/elfload.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
linux-user/elfload.c +4 -5
@@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,assert (guest_base !=0 ); test =g2h (0 ); addr =mmap (test, reserved_va,PROT_NONE , flags,-1 ,0 ); -if (addr ==MAP_FAILED ) { +if (addr ==MAP_FAILED || addr != test) {error_report ("Unable to reserve 0x%lx bytes of virtual address " -"space (%s) for use as guest address space (check your " -"virtual memory ulimit setting or reserve less " -"using -R option)" , reserved_va,strerror (errno)); +"space at %p (%s) for use as guest address space (check your" +"virtual memory ulimit setting, min_mmap_addr or reserve less " +"using -R option)" , reserved_va, test,strerror (errno));exit (EXIT_FAILURE ); } -assert (addr == test); } void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
Signature · 1 line
2.20.1
PATCH 2/6 configure: use add_to for tweaking deprecated_features
In reply to Alex Bennée--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -7668,7 +7668,7 @@ case "$target_name" in TARGET_SYSTBL_ABI=common,nospu,32 echo "TARGET_ABI32=y" >> $config_target_mak gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" - deprecated_features="ppc64abi32 ${deprecated_features}" + add_to deprecated_features ppc64abi32 ;; riscv32) TARGET_BASE_ARCH=riscv
Signature · 1 line
2.20.1
Re: [PATCH v1 2/6] configure: use add_to for tweaking deprecated_features
Quoted 11 lines · Alex Bennée
Signed-off-by Alex Bennée <[email protected]>--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure +0
-0
configure case "$target_name" in · line 7674
Quoted 8 lines
configure +1
-1@@ -7668,7 +7668,7 @@ case "$target_name" in TARGET_SYSTBL_ABI=common,nospu,32 echo "TARGET_ABI32=y" >> $config_target_mak gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" - deprecated_features="ppc64abi32 ${deprecated_features}" + add_to deprecated_features ppc64abi32 ;; riscv32) TARGET_BASE_ARCH=riscv
PATCH 3/6 configure: also skip deprecated targets with target-list-exclude
In reply to Alex BennéeNow the user has to make an even more deliberate decision to enable a deprecated target rather than getting it as a side effect of using --target-exclude-list.
--- configure | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
configure +9 -3
@@ -1722,9 +1722,15 @@ if [ "$bsd_user" = "yes" ]; then mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" fi -if test -z "$target_list_exclude" -a -z "$target_list"; then - # if the user doesn't specify anything lets skip deprecating stuff - target_list_exclude=ppc64abi32-linux-user +# If the user doesn't explicitly specify a deprecated target we will +# skip it. +if test -z "$target_list"; then + deprecated_targets_list=ppc64abi32-linux-user + if test -z "$target_list_exclude"; then + target_list_exclude="$deprecated_targets_list" + else + target_list_exclude="$target_list_exclude,$deprecated_targets_list" + fi fi exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
Signature · 1 line
2.20.1
Re: [PATCH v1 3/6] configure: also skip deprecated targets with target-list-exclude
Quoted 15 lines · Alex Bennée
Now the user has to make an even more deliberate decision to enable a deprecated target rather than getting it as a side effect of using --target-exclude-list.
Signed-off-by Alex Bennée <[email protected]>--- configure | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)configure +0
-0
configure if [ "$bsd_user" = "yes" ]; then · line 1728
Quoted 10 lines
configure +4
-3@@ -1722,9 +1722,15 @@ if [ "$bsd_user" = "yes" ]; then mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" fi -if test -z "$target_list_exclude" -a -z "$target_list"; then - # if the user doesn't specify anything lets skip deprecating stuff - target_list_exclude=ppc64abi32-linux-user +# If the user doesn't explicitly specify a deprecated target we will +# skip it. +if test -z "$target_list"; then + deprecated_targets_list=ppc64abi32-linux-user
If you put this variable setting outside the if...
configure if [ "$bsd_user" = "yes" ]; then · line 1736
Quoted 8 lines
configure +5
-0+ if test -z "$target_list_exclude"; then + target_list_exclude="$deprecated_targets_list" + else + target_list_exclude="$target_list_exclude,$deprecated_targets_list" + fi fi exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
then later on once we've parsed the exclude list and set default_target_list we can say something like (untested!)
for dep_target in $(echo "$deprecated_targets_list" | sed -e 's/,/ /g'); do
for target in $default_target_list; do
if "$dep_target" = "target"; then
add_to deprecated_features $target
break
fi
done
done
and then the only thing necessary to add another deprecated target will be to add it to the variable (ie we can just delete the add_to line your patch 2 puts in as we don't need to modify that code at all any more).
(Side note: I just followed the code we have currently for doing the "is the target in the exclude list" but this seems tremendously clunky given we're really just trying to ask "is string X in set Y"...)
thanks
-- PMM
Re: [PATCH v1 3/6] configure: also skip deprecated targets with target-list-exclude
Quoted 50 lines · Peter Maydell
Quoted 15 lines · Alex Bennée
Now the user has to make an even more deliberate decision to enable a deprecated target rather than getting it as a side effect of using --target-exclude-list.
Signed-off-by Alex Bennée <[email protected]>--- configure | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)configure +0
-0configure if [ "$bsd_user" = "yes" ]; then · line 1728
Quoted 10 lines
configure +4
-3@@ -1722,9 +1722,15 @@ if [ "$bsd_user" = "yes" ]; then mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" fi -if test -z "$target_list_exclude" -a -z "$target_list"; then - # if the user doesn't specify anything lets skip deprecating stuff - target_list_exclude=ppc64abi32-linux-user +# If the user doesn't explicitly specify a deprecated target we will +# skip it. +if test -z "$target_list"; then + deprecated_targets_list=ppc64abi32-linux-userIf you put this variable setting outside the if...
configure if [ "$bsd_user" = "yes" ]; then · line 1736
Quoted 8 lines
configure +5
-0+ if test -z "$target_list_exclude"; then + target_list_exclude="$deprecated_targets_list" + else + target_list_exclude="$target_list_exclude,$deprecated_targets_list" + fi fi exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')then later on once we've parsed the exclude list and set
default_target_listwe can say something like (untested!)for
dep_targetin $(echo "$deprecated_targets_list" | sed -e 's/,/ /g'); do
for target in $default_target_list; do
if "$dep_target" = "target"; then
add_todeprecated_features$target
break
fi
done
done
Quoted 4 lines
and then the only thing necessary to add another deprecated target will be to add it to the variable (ie we can just delete the
add_toline your patch 2 puts in as we don't need to modify that code at all any more).
That makes sense - actually I think we can do:
# if a deprecated target is enabled we note it here
if echo "$deprecated_targets_list" | grep -q "$1"; then
add_to deprecated_features $1
fijust before test "$tcg" = "yes" && return 0 in supported_target.
Quoted 5 lines
(Side note: I just followed the code we have currently for doing the "is the target in the exclude list" but this seems tremendously clunky given we're really just trying to ask "is string X in set Y"...)
Yeah that can be cleaned up.
Quoted 3 lines
thanks
-- PMM
Signature · 1 line
Alex Bennée
PATCH 4/6 configure: include tilegx-linux-user in the auto-exclude logic
In reply to Alex BennéeThe target is already marked as deprecated in the documentation.
--- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
configure +2 -1
@@ -1725,7 +1725,7 @@ fi # If the user doesn't explicitly specify a deprecated target we will # skip it. if test -z "$target_list"; then - deprecated_targets_list=ppc64abi32-linux-user + deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user if test -z "$target_list_exclude"; then target_list_exclude="$deprecated_targets_list" else
@@ -7719,6 +7719,7 @@ case "$target_name" in gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml" ;; tilegx) + add_to deprecated_features tilegx ;; tricore) ;;
Signature · 1 line
2.20.1
Re: [PATCH v1 4/6] configure: include tilegx-linux-user in the auto-exclude logic
Quoted 22 lines · Alex Bennée
The target is already marked as deprecated in the documentation.
Signed-off-by Alex Bennée <[email protected]>--- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)configure +1
-1@@ -1725,7 +1725,7 @@ fi # If the user doesn't explicitly specify a deprecated target we will # skip it. if test -z "$target_list"; then - deprecated_targets_list=ppc64abi32-linux-user + deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user if test -z "$target_list_exclude"; then target_list_exclude="$deprecated_targets_list" else
configure case "$target_name" in · line 7725
Quoted 7 lines
configure +1
-0@@ -7719,6 +7719,7 @@ case "$target_name" in gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml" ;; tilegx) + add_to deprecated_features tilegx ;; tricore) ;;
PATCH 5/6 gitlab: create a build-deprecated target
In reply to Alex BennéeThese targets might be deprecated but we should keep them building before the final axe comes down. Lets keep them all in one place and don't hold up the CI if they do fail. They are either poorly tested or already flaky anyway,
--- .gitlab-ci.yml | 10 ++++++++++ .travis.yml | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-)
.gitlab-ci.yml +10 -0
@@ -254,6 +254,16 @@ build-clang: ppc-softmmu s390x-softmmu arm-linux-user MAKE_CHECK_ARGS: check +# These targets are on the way out +build-deprecated: + <<: *native_build_job_definition + variables: + IMAGE: debian-all-test-cross + CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system + MAKE_CHECK_ARGS: check-tcg + TARGETS: ppc64abi32-linux-user tilegx-linux-user + allow_failure: true + build-oss-fuzz: <<: *native_build_job_definition variables:
.travis.yml +1 -2
@@ -344,10 +344,9 @@ jobs: # Run check-tcg against linux-user (with plugins) # we skip sparc64-linux-user until it has been fixed somewhat # we skip cris-linux-user as it doesn't use the common run loop - # we skip ppc64abi32-linux-user as it seems to have a broken libc - name: "GCC plugins check-tcg (user)" env: - - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user,ppc64abi32-linux-user" + - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user" - TEST_BUILD_CMD="make build-tcg" - TEST_CMD="make check-tcg" - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg"
Signature · 1 line
2.20.1
Re: [PATCH v1 5/6] gitlab: create a build-deprecated target
Quoted 37 lines · Alex Bennée
These targets might be deprecated but we should keep them building before the final axe comes down. Lets keep them all in one place and don't hold up the CI if they do fail. They are either poorly tested or already flaky anyway,
Signed-off-by Alex Bennée <[email protected]>--- .gitlab-ci.yml | 10 ++++++++++ .travis.yml | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-).gitlab-ci.yml +10
-0@@ -254,6 +254,16 @@ build-clang: ppc-softmmu s390x-softmmu arm-linux-user MAKE_CHECK_ARGS: check +# These targets are on the way out +build-deprecated: + <<: *native_build_job_definition + variables: + IMAGE: debian-all-test-cross + CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system + MAKE_CHECK_ARGS: check-tcg + TARGETS: ppc64abi32-linux-user tilegx-linux-user + allow_failure: true + build-oss-fuzz: <<: *native_build_job_definition variables:.travis.yml +0
-0
.travis.yml jobs: · line 350
Quoted 7 lines
.travis.yml +0
-2@@ -344,10 +344,9 @@ jobs: # Run check-tcg against linux-user (with plugins) # we skip sparc64-linux-user until it has been fixed somewhat # we skip cris-linux-user as it doesn't use the common run loop - # we skip ppc64abi32-linux-user as it seems to have a broken libc - name: "GCC plugins check-tcg (user)" env: - - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user,ppc64abi32-linux-user"
Maybe split the patch in 2, first the Travis-CI removal, mentioning commit c609274b853 ("docs/system/deprecated: mark ppc64abi32-linux-user for deprecation"), then adding the build-deprecated to GitLab-CI in a different patch.
Preferably split:
Quoted 5 lines
.travis.yml +1
-0+ - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user" - TEST_BUILD_CMD="make build-tcg" - TEST_CMD="make check-tcg" - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg"
Re: [PATCH v1 5/6] gitlab: create a build-deprecated target
In reply to Alex BennéeQuoted 39 lines · Alex Bennée
These targets might be deprecated but we should keep them building before the final axe comes down. Lets keep them all in one place and don't hold up the CI if they do fail. They are either poorly tested or already flaky anyway,
Signed-off-by Alex Bennée <[email protected]>--- .gitlab-ci.yml | 10 ++++++++++ .travis.yml | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-).gitlab-ci.yml +10
-0@@ -254,6 +254,16 @@ build-clang: ppc-softmmu s390x-softmmu arm-linux-user MAKE_CHECK_ARGS: check +# These targets are on the way out +build-deprecated: + <<: *native_build_job_definition + variables: + IMAGE: debian-all-test-cross + CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system + MAKE_CHECK_ARGS: check-tcg + TARGETS: ppc64abi32-linux-user tilegx-linux-user + allow_failure: true + build-oss-fuzz: <<: *native_build_job_definition variables:.travis.yml +0
-0@@ -344,10 +344,9 @@ jobs: # Run check-tcg against linux-user (with plugins)
.travis.yml jobs: · line 352
Quoted 10 lines
.travis.yml +1
-2# we skip sparc64-linux-user until it has been fixed somewhat # we skip cris-linux-user as it doesn't use the common run loop - # we skip ppc64abi32-linux-user as it seems to have a broken libc - name: "GCC plugins check-tcg (user)" env: - - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user,ppc64abi32-linux-user" + - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user" - TEST_BUILD_CMD="make build-tcg" - TEST_CMD="make check-tcg" - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg"
PATCH 6/6 iotests: Work around failing readlink -f
In reply to Alex BennéeFrom: Max Reitz <[email protected]>
On macOS, (out of the box) readlink does not have -f. If the recent "readlink -f" call introduced by b1cbc33a397 fails, just fall back to the old behavior (which means you can run the iotests only from the build tree, but that worked fine for six years, so it should be fine still).
Keep any potential error message on stderr. If users want to run the iotests from outside the build tree, this may point them to what's wrong (with their system).
("iotests: Allow running from different directory")
Message-Id: <[email protected]>
--- tests/qemu-iotests/check | 4 ++++ 1 file changed, 4 insertions(+)
tests/qemu-iotests/check +4 -0
@@ -45,6 +45,10 @@ then fi source_iotests=$(cd "$source_iotests"; pwd) || _init_error "failed to enter source tree" build_iotests=$(readlink -f $(dirname "$0")) + if [ "$?" -ne 0 ]; then + # Perhaps -f is unsupported, revert to pre-b1cbc33a397 behavior + build_iotests=$PWD + fi else # called from the source tree source_iotests=$PWD
Signature · 1 line
2.20.1