Received: from eggs.gnu.org ([2001:4830:134:3::10]:41275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkQq9-0001Cl-9f for qemu-devel@nongnu.org; Wed, 23 Aug 2017 04:16:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dkQq4-0003Io-B6 for qemu-devel@nongnu.org; Wed, 23 Aug 2017 04:16:41 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:36189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dkQq4-0003GS-3d for qemu-devel@nongnu.org; Wed, 23 Aug 2017 04:16:36 -0400 Received: by mail-wm0-f53.google.com with SMTP id z132so9971197wmg.1 for ; Wed, 23 Aug 2017 01:16:36 -0700 (PDT) References: <1503471212-109371-1-git-send-email-borntraeger@de.ibm.com> From: Paolo Bonzini Message-ID: <4e463848-3be4-1b31-c2d9-04ef32d79925@redhat.com> Date: Wed, 23 Aug 2017 10:16:27 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] configure: enable --s390-pgste linker option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , David Hildenbrand , Christian Borntraeger , Cornelia Huck Cc: Janosch Frank , Dan Horak , qemu-devel , Christian Ehrhardt , Alexander Graf On 23/08/2017 10:06, Thomas Huth wrote: > On 23.08.2017 10:00, David Hildenbrand wrote: >> On 23.08.2017 08:53, 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 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 >>> Cc: Alexander Graf >>> Cc: Dan Horak >>> Cc: David Hildenbrand >>> Signed-off-by: Christian Borntraeger >>> Acked-by: Janosch Frank >>> --- >>> 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 >>> >>> configure | 21 ++++++++++++++++++++- >>> 1 file changed, 20 insertions(+), 1 deletion(-) >>> >>> diff --git a/configure b/configure >>> index dd73cce..0b68b37 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -240,6 +240,11 @@ supported_target() { >>> return 1 >>> } >>> >>> + >> >> I'd drop this new line >> >>> +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_had $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 support --s390-pgste >>> +if test "$TARGET_ARCH" = "s390x" -a "$target_softmmu" = "yes" -a "$ARCH" = "s390x" -a "$kvm" = "yes"; then >> >> Wonder if the "$ARCH" check is really necessary: TARGET_ARCH=s390x with >> kvm=yes should only build on s390x. > > Isn't kvm=yes and TARGET_ARCH=s390x also possible on a x86 host, where > only the x86_64 target is built with CONFIG_KVM=y, but the s390x target > with CONFIG_KVM=n ? Yes. You could use if test "$ARCH" = "s390x" && supported_kvm_target $target; then ... fi Or, in the existing "if supported_kvm_target $target" conditional, add if test "$ARCH" = s390x && ld_has --s390-pgste; then ... fi Paolo