[PULL 0/8] configure deprecation, linux-user and test fix

Alex Bennée posted 8 patches 4 days ago
Only 2 patches received!
configure                | 33 ++++++++++++++++++---------------
linux-user/elfload.c     |  9 ++++-----
.gitlab-ci.yml           | 15 +++++++++++++--
.shippable.yml           |  2 +-
.travis.yml              |  3 +--
tests/qemu-iotests/check |  2 +-
6 files changed, 38 insertions(+), 26 deletions(-)

[PULL 0/8] configure deprecation, linux-user and test fix

Posted by Alex Bennée 4 days ago
The following changes since commit de39a045bd8d2b49e4f3d07976622c29d58e0bac:

  Merge remote-tracking branch 'remotes/kraxel/tags/vga-20200915-pull-request' into staging (2020-09-15 14:25:05 +0100)

are available in the Git repository at:

  https://github.com/stsquad/qemu.git tags/pull-configure-fixes-160920-1

for you to fetch changes up to 3ffc7f013763bf4fc50c3b403cbacca2bee68cfa:

  configure: add [lm32|unicore32]-softmmu to deprecation logic (2020-09-16 10:07:01 +0100)

----------------------------------------------------------------
configure tweaks for deprecation

  - iotest fix for readlink -f
  - linux-user, report rather than assert on mmap failure
  - clean-up and re-factor the logic
  - add tilegx-linux-user to deprecated_targets_list
  - add [lm32|unicore32]-softmmu deprecated_targets_list
  - add a gitlab deprecated builds test

----------------------------------------------------------------
Alex Bennée (7):
      linux-user: test, don't assert addr != test in pgb_reserved_va
      configure: move deprecated feature processing to supported_target
      configure: also skip deprecated targets with target-list-exclude
      configure: clean-up the target-list-exclude logic
      configure: include tilegx-linux-user in the deprecation logic
      gitlab: create a build-deprecated target
      configure: add [lm32|unicore32]-softmmu to deprecation logic

Max Reitz (1):
      iotests: Drop readlink -f

 configure                | 33 ++++++++++++++++++---------------
 linux-user/elfload.c     |  9 ++++-----
 .gitlab-ci.yml           | 15 +++++++++++++--
 .shippable.yml           |  2 +-
 .travis.yml              |  3 +--
 tests/qemu-iotests/check |  2 +-
 6 files changed, 38 insertions(+), 26 deletions(-)

-- 
2.20.1


Re: [PULL 0/8] configure deprecation, linux-user and test fix

Posted by Peter Maydell 3 days ago
On Wed, 16 Sep 2020 at 13:26, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> The following changes since commit de39a045bd8d2b49e4f3d07976622c29d58e0bac:
>
>   Merge remote-tracking branch 'remotes/kraxel/tags/vga-20200915-pull-request' into staging (2020-09-15 14:25:05 +0100)
>
> are available in the Git repository at:
>
>   https://github.com/stsquad/qemu.git tags/pull-configure-fixes-160920-1
>
> for you to fetch changes up to 3ffc7f013763bf4fc50c3b403cbacca2bee68cfa:
>
>   configure: add [lm32|unicore32]-softmmu to deprecation logic (2020-09-16 10:07:01 +0100)
>
> ----------------------------------------------------------------
> configure tweaks for deprecation
>
>   - iotest fix for readlink -f
>   - linux-user, report rather than assert on mmap failure
>   - clean-up and re-factor the logic
>   - add tilegx-linux-user to deprecated_targets_list
>   - add [lm32|unicore32]-softmmu deprecated_targets_list
>   - add a gitlab deprecated builds test
>
> ----------------------------------------------------------------
> Alex Bennée (7):
>       linux-user: test, don't assert addr != test in pgb_reserved_va
>       configure: move deprecated feature processing to supported_target
>       configure: also skip deprecated targets with target-list-exclude
>       configure: clean-up the target-list-exclude logic
>       configure: include tilegx-linux-user in the deprecation logic
>       gitlab: create a build-deprecated target
>       configure: add [lm32|unicore32]-softmmu to deprecation logic
>
> Max Reitz (1):
>       iotests: Drop readlink -f



Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM

[PULL 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va

Posted by Alex Bennée 4 days ago
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.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Ameliorates: ee94743034
Message-Id: <20200915134317.11110-2-alex.bennee@linaro.org>

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4961e6119e24..f6022fd70493 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -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,
-- 
2.20.1


[PULL 2/8] iotests: Drop readlink -f

Posted by Alex Bennée 4 days ago
From: Max Reitz <mreitz@redhat.com>

On macOS, (out of the box) readlink does not have -f.  We do not really
need readlink here, though, it was just a replacement for realpath
(which is not available on our BSD test systems), which we needed to
make the $(dirname) into an absolute path.

Instead of using either, just use "cd; pwd" like is done for
$source_iotests.

       ("iotests: Allow running from different directory")

Fixes: b1cbc33a3971b6bb005d5ac3569feae35a71de0f
Reported-by: Claudio Fontana <cfontana@suse.de>
Reported-by: Thomas Huth <thuth@redhat.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200914145606.94620-1-mreitz@redhat.com>
Message-Id: <20200915134317.11110-3-alex.bennee@linaro.org>

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index e14a1f354dd9..678b6e49103a 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -44,7 +44,7 @@ then
         _init_error "failed to obtain source tree name from check symlink"
     fi
     source_iotests=$(cd "$source_iotests"; pwd) || _init_error "failed to enter source tree"
-    build_iotests=$(readlink -f $(dirname "$0"))
+    build_iotests=$(cd "$(dirname "$0")"; pwd)
 else
     # called from the source tree
     source_iotests=$PWD
-- 
2.20.1


[PULL 3/8] configure: move deprecated feature processing to supported_target

Posted by Alex Bennée 4 days ago
This is the common point at which we validate targets so it makes
sense to add_to deprecated_features here. It will make future target
deprecation easier as we only need to tweak one list.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200915134317.11110-4-alex.bennee@linaro.org>

diff --git a/configure b/configure
index ce27eafb0a9e..51d03a8d340f 100755
--- a/configure
+++ b/configure
@@ -280,6 +280,9 @@ supported_whpx_target() {
     return 1
 }
 
+deprecated_targets_list=ppc64abi32-linux-user
+deprecated_features=""
+
 supported_target() {
     case "$1" in
         *-softmmu)
@@ -301,6 +304,12 @@ supported_target() {
             return 1
             ;;
     esac
+
+    # if a deprecated target is enabled we note it here
+    if echo "$deprecated_targets_list" | grep -q "$1"; then
+        add_to deprecated_features $1
+    fi
+
     test "$tcg" = "yes" && return 0
     supported_kvm_target "$1" && return 0
     supported_xen_target "$1" && return 0
@@ -542,8 +551,6 @@ gettext=""
 bogus_os="no"
 malloc_trim=""
 
-deprecated_features=""
-
 # parse CC options first
 for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
@@ -1724,7 +1731,7 @@ 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
+    target_list_exclude=$deprecated_targets_list
 fi
 
 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
@@ -7668,7 +7675,6 @@ 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}"
   ;;
   riscv32)
     TARGET_BASE_ARCH=riscv
-- 
2.20.1


[PULL 4/8] configure: also skip deprecated targets with target-list-exclude

Posted by Alex Bennée 4 days ago
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 <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200915134317.11110-5-alex.bennee@linaro.org>

diff --git a/configure b/configure
index 51d03a8d340f..f5fe48d6dd7b 100755
--- a/configure
+++ b/configure
@@ -1729,9 +1729,14 @@ 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=$deprecated_targets_list
+# If the user doesn't explicitly specify a deprecated target we will
+# skip it.
+if test -z "$target_list"; then
+    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')
-- 
2.20.1


[PULL 5/8] configure: clean-up the target-list-exclude logic

Posted by Alex Bennée 4 days ago
Rather than sed and loop just do a grep.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200915134317.11110-6-alex.bennee@linaro.org>

diff --git a/configure b/configure
index f5fe48d6dd7b..58be974065c8 100755
--- a/configure
+++ b/configure
@@ -1739,17 +1739,9 @@ if test -z "$target_list"; then
     fi
 fi
 
-exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
 for config in $mak_wilds; do
     target="$(basename "$config" .mak)"
-    exclude="no"
-    for excl in $exclude_list; do
-        if test "$excl" = "$target"; then
-            exclude="yes"
-            break;
-        fi
-    done
-    if test "$exclude" = "no"; then
+    if echo "$target_list_exclude" | grep -vq "$target"; then
         default_target_list="${default_target_list} $target"
     fi
 done
-- 
2.20.1


[PULL 6/8] configure: include tilegx-linux-user in the deprecation logic

Posted by Alex Bennée 4 days ago
The target is already marked as deprecated in the documentation.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200915134317.11110-7-alex.bennee@linaro.org>

diff --git a/configure b/configure
index 58be974065c8..dfd7f18dcb24 100755
--- a/configure
+++ b/configure
@@ -280,7 +280,7 @@ supported_whpx_target() {
     return 1
 }
 
-deprecated_targets_list=ppc64abi32-linux-user
+deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user
 deprecated_features=""
 
 supported_target() {
-- 
2.20.1