Blame SOURCES/kvm-configure-enable-s390-pgste-linker-option.patch

4a2fec
From 487aafe7bfede37118f4664b473b9a3960a5b89d Mon Sep 17 00:00:00 2001
4a2fec
From: Cornelia Huck <cohuck@redhat.com>
4a2fec
Date: Fri, 13 Oct 2017 14:13:00 +0200
4a2fec
Subject: [PATCH 19/69] configure: enable --s390-pgste linker option
4a2fec
4a2fec
RH-Author: Cornelia Huck <cohuck@redhat.com>
4a2fec
Message-id: <20171013141301.23131-2-cohuck@redhat.com>
4a2fec
Patchwork-id: 77285
4a2fec
O-Subject: [RHV7.5 qemu-kvm-ma PATCH v3 1/2] configure: enable --s390-pgste linker option
4a2fec
Bugzilla: 1485399
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
RH-Acked-by: David Hildenbrand <david@redhat.com>
4a2fec
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
4a2fec
4a2fec
From: Christian Borntraeger <borntraeger@de.ibm.com>
4a2fec
4a2fec
KVM guests on s390 need a different page table layout than normal
4a2fec
processes (2kb page table + 2kb page status extensions vs 2kb page table
4a2fec
only). As of today this has to be enabled via the vm.allocate_pgste
4a2fec
sysctl.
4a2fec
4a2fec
Newer kernels (>= 4.12) on s390 check for an S390_PGSTE program header
4a2fec
and enable the pgste page table extensions in that case. This makes the
4a2fec
vm.allocate_pgste sysctl unnecessary. We enable this program header for
4a2fec
the s390 system emulation (qemu-system-s390x) if we build on s390
4a2fec
- for s390 system emulation
4a2fec
- the linker supports --s390-pgste (binutils >= 2.29)
4a2fec
- KVM is enabled
4a2fec
4a2fec
This will allow distributions to disable the global vm.allocate_pgste
4a2fec
sysctl, which will improve the page table allocation for non KVM
4a2fec
processes as only 2kb chunks are necessary.
4a2fec
4a2fec
Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4a2fec
Cc: Alexander Graf <agraf@suse.de>
4a2fec
Cc: Dan Horak <dhorak@redhat.com>
4a2fec
Cc: David Hildenbrand <david@redhat.com>
4a2fec
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4a2fec
Acked-by: Janosch Frank <frankja@linux.vnet.ibm.com>
4a2fec
Reviewed-by: Thomas Huth <thuth@redhat.com>
4a2fec
Message-Id: <1503483383-199649-1-git-send-email-borntraeger@de.ibm.com>
4a2fec
Reviewed-by: David Hildenbrand <david@redhat.com>
4a2fec
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
4a2fec
(cherry picked from commit e9a3591fa09f273592451f8b9f83692bcbedb60c)
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 configure | 21 ++++++++++++++++++++-
4a2fec
 1 file changed, 20 insertions(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/configure b/configure
4a2fec
index 0da6821..644e52d 100755
4a2fec
--- a/configure
4a2fec
+++ b/configure
4a2fec
@@ -240,6 +240,11 @@ supported_target() {
4a2fec
     return 1
4a2fec
 }
4a2fec
 
4a2fec
+
4a2fec
+ld_has() {
4a2fec
+    $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
4a2fec
+}
4a2fec
+
4a2fec
 # default parameters
4a2fec
 source_path=$(dirname "$0")
4a2fec
 cpu=""
4a2fec
@@ -5033,7 +5038,7 @@ fi
4a2fec
 # Use ASLR, no-SEH and DEP if available
4a2fec
 if test "$mingw32" = "yes" ; then
4a2fec
     for flag in --dynamicbase --no-seh --nxcompat; do
4a2fec
-        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
4a2fec
+        if ld_has $flag ; then
4a2fec
             LDFLAGS="-Wl,$flag $LDFLAGS"
4a2fec
         fi
4a2fec
     done
4a2fec
@@ -6520,6 +6525,20 @@ if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
4a2fec
   ldflags="$ldflags $textseg_ldflags"
4a2fec
 fi
4a2fec
 
4a2fec
+# Newer kernels on s390 check for an S390_PGSTE program header and
4a2fec
+# enable the pgste page table extensions in that case. This makes
4a2fec
+# the vm.allocate_pgste sysctl unnecessary. We enable this program
4a2fec
+# header if
4a2fec
+#  - we build on s390x
4a2fec
+#  - we build the system emulation for s390x (qemu-system-s390x)
4a2fec
+#  - KVM is enabled
4a2fec
+#  - the linker supports --s390-pgste
4a2fec
+if test "$TARGET_ARCH" = "s390x" -a "$target_softmmu" = "yes"  -a "$ARCH" = "s390x" -a "$kvm" = "yes"; then
4a2fec
+    if ld_has --s390-pgste ; then
4a2fec
+        ldflags="-Wl,--s390-pgste $ldflags"
4a2fec
+    fi
4a2fec
+fi
4a2fec
+
4a2fec
 echo "LDFLAGS+=$ldflags" >> $config_target_mak
4a2fec
 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
4a2fec
 
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec