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

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