All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH/RFC] configure: enable --s390-pgste linker option
@ 2017-08-22 14:47 Christian Borntraeger
  2017-08-22 15:02 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Borntraeger @ 2017-08-22 14:47 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: qemu-devel, Alexander Graf, Thomas Huth, David Hildenbrand,
	Christian Borntraeger, Christian Ehrhardt, Dan Horak

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
- 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 <christian.ehrhardt@canonical.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Dan Horak <dhorak@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Janosch Frank <frankja@linux.vnet.ibm.com>
---
 configure | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/configure b/configure
index dd73cce..4c9084b 100755
--- a/configure
+++ b/configure
@@ -6522,6 +6522,19 @@ 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
+#  - the linker support --s390-pgste
+#  - we build the system emulation (qemu-system-s390x)
+#  - KVM is enabled
+if $ld --help 2>/dev/null | grep ".--s390-pgste" >/dev/null 2>/dev/null ; then
+    if test "$target_softmmu" = "yes"  -a "$ARCH" = "s390x" -a "$kvm" = "yes" ; then
+        ldflags="-Wl,--s390-pgste $ldflags"
+    fi
+fi
+
 echo "LDFLAGS+=$ldflags" >> $config_target_mak
 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH/RFC] configure: enable --s390-pgste linker option
  2017-08-22 14:47 [Qemu-devel] [PATCH/RFC] configure: enable --s390-pgste linker option Christian Borntraeger
@ 2017-08-22 15:02 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2017-08-22 15:02 UTC (permalink / raw)
  To: Christian Borntraeger, Cornelia Huck
  Cc: qemu-devel, Alexander Graf, Thomas Huth, Christian Ehrhardt, Dan Horak

On 22.08.2017 16:47, Christian Borntraeger wrote:
> 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
> - 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 <christian.ehrhardt@canonical.com>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Dan Horak <dhorak@redhat.com>
> Cc: David Hildenbrand <david@redhat.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Acked-by: Janosch Frank <frankja@linux.vnet.ibm.com>
> ---
>  configure | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/configure b/configure
> index dd73cce..4c9084b 100755
> --- a/configure
> +++ b/configure
> @@ -6522,6 +6522,19 @@ 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
> +#  - the linker support --s390-pgste
> +#  - we build the system emulation (qemu-system-s390x)
> +#  - KVM is enabled
> +if $ld --help 2>/dev/null | grep ".--s390-pgste" >/dev/null 2>/dev/null ; then

>/dev/null 2>&1
(from has(){} definiton)

maybe even introduce

ld_has() {
    $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
}

I guess it also makes sense to test for s390x first, before checking for
ld support.

> +    if test "$target_softmmu" = "yes"  -a "$ARCH" = "s390x" -a "$kvm" = "yes" ; then
> +        ldflags="-Wl,--s390-pgste $ldflags"
> +    fi
> +fi
> +
>  echo "LDFLAGS+=$ldflags" >> $config_target_mak
>  echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
>  
> 

Happy to see this change :)

-- 

Thanks,

David

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-22 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-22 14:47 [Qemu-devel] [PATCH/RFC] configure: enable --s390-pgste linker option Christian Borntraeger
2017-08-22 15:02 ` David Hildenbrand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.