Skip to contentSkip to conversation

configure: enable --s390-pgste linker option

PATCH Applied Christian Borntraeger 3 participants 5 messages Aug 23, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 configure: enable --s390-pgste linker option

KVM guests on s390 need a different page table layout than normal processes (2kb page table + 2kb page status extensions vs 2kb page table only). As of today this has to be enabled via the vm.allocate_pgste sysctl.

Newer kernels (>= 4.12) on s390 check for an S390_PGSTE program header and enable the pgste page table extensions in that case. This makes the vm.allocate_pgste sysctl unnecessary. We enable this program header for the s390 system emulation (qemu-system-s390x) if we build on s390
- for s390 system emulation
- the linker supports --s390-pgste (binutils >= 2.29)
- KVM is enabled

This will allow distributions to disable the global vm.allocate_pgste sysctl, which will improve the page table allocation for non KVM processes as only 2kb chunks are necessary.

Cc Christian Ehrhardt <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Dan Horak <[email protected]>
Cc David Hildenbrand <[email protected]>

---
V1->V2:
- provide ld_has function
- use ld_has to replace some open coded variants
- check target arch and arch for s390
- check for s390x before calling the linker
V2->V3:
- fix typos

 configure | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
configure +20 -1
index dd73cce..fb7e34a 100755
@@ -240,6 +240,11 @@ supported_target() {
     return 1
 }
 
+
+ld_has() {
+    $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
+}
+
 # default parameters
 source_path=$(dirname "$0")
 cpu=""
@@ -5043,7 +5048,7 @@ fi
 # Use ASLR, no-SEH and DEP if available
 if test "$mingw32" = "yes" ; then
     for flag in --dynamicbase --no-seh --nxcompat; do
-        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
+        if ld_has $flag ; then
             LDFLAGS="-Wl,$flag $LDFLAGS"
         fi
     done
@@ -6522,6 +6527,20 @@ if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
   ldflags="$ldflags $textseg_ldflags"
 fi
 
+# Newer kernels on s390 check for an S390_PGSTE program header and
+# enable the pgste page table extensions in that case. This makes
+# the vm.allocate_pgste sysctl unnecessary. We enable this program
+# header if
+#  - we build on s390x
+#  - we build the system emulation for s390x (qemu-system-s390x)
+#  - KVM is enabled
+#  - the linker supports --s390-pgste
+if test "$TARGET_ARCH" = "s390x" -a "$target_softmmu" = "yes"  -a "$ARCH" = "s390x" -a "$kvm" = "yes"; then
+    if ld_has --s390-pgste ; then
+        ldflags="-Wl,--s390-pgste $ldflags"
+    fi
+fi
+
 echo "LDFLAGS+=$ldflags" >> $config_target_mak
 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 31 lines · On Wed, 23 Aug 2017 12:16:23 +0200 Christian Borntraeger…

KVM guests on s390 need a different page table layout than normal processes (2kb page table + 2kb page status extensions vs 2kb page table only). As of today this has to be enabled via the vm.allocate_pgste sysctl.

Newer kernels (>= 4.12) on s390 check for an S390_PGSTE program header and enable the pgste page table extensions in that case. This makes the vm.allocate_pgste sysctl unnecessary. We enable this program header for the s390 system emulation (qemu-system-s390x) if we build on s390
- for s390 system emulation
- the linker supports --s390-pgste (binutils >= 2.29)
- KVM is enabled

This will allow distributions to disable the global vm.allocate_pgste sysctl, which will improve the page table allocation for non KVM processes as only 2kb chunks are necessary.

Cc Christian Ehrhardt <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Dan Horak <[email protected]>
Cc David Hildenbrand <[email protected]>

---
V1->V2:
- provide ld_has function
- use ld_has to replace some open coded variants
- check target arch and arch for s390
- check for s390x before calling the linker
V2->V3:
- fix typos

Quoted 2 lines
 configure | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

Looks sane.

I guess I'll wait for some more Acks or R-bs and then queue it to s390-next.

Reviewed-by
#2 lore raw
Quoted 37 lines · Cornelia Huck
Quoted 31 lines · On Wed, 23 Aug 2017 12:16:23 +0200 Christian Borntraeger…

KVM guests on s390 need a different page table layout than normal processes (2kb page table + 2kb page status extensions vs 2kb page table only). As of today this has to be enabled via the vm.allocate_pgste sysctl.

Newer kernels (>= 4.12) on s390 check for an S390_PGSTE program header and enable the pgste page table extensions in that case. This makes the vm.allocate_pgste sysctl unnecessary. We enable this program header for the s390 system emulation (qemu-system-s390x) if we build on s390
- for s390 system emulation
- the linker supports --s390-pgste (binutils >= 2.29)
- KVM is enabled

This will allow distributions to disable the global vm.allocate_pgste sysctl, which will improve the page table allocation for non KVM processes as only 2kb chunks are necessary.

Cc Christian Ehrhardt <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Dan Horak <[email protected]>
Cc David Hildenbrand <[email protected]>

---
V1->V2:
- provide ld_has function
- use ld_has to replace some open coded variants
- check target arch and arch for s390
- check for s390x before calling the linker
V2->V3:
- fix typos

Quoted 2 lines
 configure | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
Quoted 5 lines

Looks sane.

I guess I'll wait for some more Acks or R-bs and then queue it to s390-next.

My r-b still holds

Signature · 3 lines
Thanks,

David
#3 lore raw
In reply to Cornelia Huck
Quoted 37 lines · Cornelia Huck
Quoted 31 lines · On Wed, 23 Aug 2017 12:16:23 +0200 Christian Borntraeger…

KVM guests on s390 need a different page table layout than normal processes (2kb page table + 2kb page status extensions vs 2kb page table only). As of today this has to be enabled via the vm.allocate_pgste sysctl.

Newer kernels (>= 4.12) on s390 check for an S390_PGSTE program header and enable the pgste page table extensions in that case. This makes the vm.allocate_pgste sysctl unnecessary. We enable this program header for the s390 system emulation (qemu-system-s390x) if we build on s390
- for s390 system emulation
- the linker supports --s390-pgste (binutils >= 2.29)
- KVM is enabled

This will allow distributions to disable the global vm.allocate_pgste sysctl, which will improve the page table allocation for non KVM processes as only 2kb chunks are necessary.

Cc Christian Ehrhardt <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Dan Horak <[email protected]>
Cc David Hildenbrand <[email protected]>

---
V1->V2:
- provide ld_has function
- use ld_has to replace some open coded variants
- check target arch and arch for s390
- check for s390x before calling the linker
V2->V3:
- fix typos

Quoted 2 lines
 configure | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
Quoted 4 lines

Looks sane.

I guess I'll wait for some more Acks or R-bs and then queue it to s390-next.

Sure. Looks like I forgot to add Thomas/Davids R-bs, so please add those.

#4 lore raw
In reply to Christian Borntraeger
Quoted 31 lines · On Wed, 23 Aug 2017 12:16:23 +0200 Christian Borntraeger…

KVM guests on s390 need a different page table layout than normal processes (2kb page table + 2kb page status extensions vs 2kb page table only). As of today this has to be enabled via the vm.allocate_pgste sysctl.

Newer kernels (>= 4.12) on s390 check for an S390_PGSTE program header and enable the pgste page table extensions in that case. This makes the vm.allocate_pgste sysctl unnecessary. We enable this program header for the s390 system emulation (qemu-system-s390x) if we build on s390
- for s390 system emulation
- the linker supports --s390-pgste (binutils >= 2.29)
- KVM is enabled

This will allow distributions to disable the global vm.allocate_pgste sysctl, which will improve the page table allocation for non KVM processes as only 2kb chunks are necessary.

Cc Christian Ehrhardt <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Dan Horak <[email protected]>
Cc David Hildenbrand <[email protected]>

---
V1->V2:
- provide ld_has function
- use ld_has to replace some open coded variants
- check target arch and arch for s390
- check for s390x before calling the linker
V2->V3:
- fix typos

Quoted 2 lines
 configure | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

Thanks, applied.