From df3d8e2f95e23cf64278795a1546e86064fdc7c1 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Wed, 31 May 2017 10:42:28 -0700 Subject: [PATCH] Enable the vDSO for arm LPAE The vDSO can be used on arm as well. The only supported platforms have LPAE enabled so only enable it there. --- kernel.spec | 121 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 52 deletions(-) diff --git a/kernel.spec b/kernel.spec index b34f118a5..a35414436 100644 --- a/kernel.spec +++ b/kernel.spec @@ -218,8 +218,7 @@ Summary: The Linux kernel %define all_x86 i386 i686 %if %{with_vdso_install} -# These arches install vdso/ directories. -%define vdso_arches %{all_x86} x86_64 %{power64} s390x aarch64 +%define use_vdso 1 %endif # Overrides for generic default options @@ -287,6 +286,7 @@ Summary: The Linux kernel %ifarch %{arm} %define all_arch_configs kernel-%{version}-arm*.config +%define skip_nonpae_vdso 1 %define asmarch arm %define hdrarch arm %define pae lpae @@ -348,6 +348,19 @@ Summary: The Linux kernel # Architectures we build tools/cpupower on %define cpupowerarchs %{ix86} x86_64 %{power64} %{arm} aarch64 +%if %{use_vdso} + +%if 0%{?skip_nonpae_vdso} +%define _use_vdso 0 +%else +%define _use_vdso 1 +%endif + +%else +%define _use_vdso 0 +%endif + + # # Packages that need to be installed before the kernel is, because the %%post # scripts use them. @@ -1283,9 +1296,10 @@ cp_vmlinux() BuildKernel() { MakeTarget=$1 KernelImage=$2 - Flavour=$3 + Flavour=$4 + DoVDSO=$3 Flav=${Flavour:++${Flavour}} - InstallName=${4:-vmlinuz} + InstallName=${5:-vmlinuz} # Pick the right config file for the kernel we're building Config=kernel-%{version}-%{_target_cpu}${Flavour:+-${Flavour}}.config @@ -1383,16 +1397,16 @@ BuildKernel() { # we'll get it from the linux-firmware package and we don't want conflicts %{make} -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw= -%ifarch %{vdso_arches} - %{make} -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer - if [ ! -s ldconfig-kernel.conf ]; then - echo > ldconfig-kernel.conf "\ -# Placeholder file, no vDSO hwcap entries used in this kernel." + if [ $DoVDSO -ne 0 ]; then + %{make} -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer + if [ ! -s ldconfig-kernel.conf ]; then + echo > ldconfig-kernel.conf "\ + # Placeholder file, no vDSO hwcap entries used in this kernel." + fi + %{__install} -D -m 444 ldconfig-kernel.conf \ + $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf + rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/vdso/.build-id fi - %{__install} -D -m 444 ldconfig-kernel.conf \ - $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf - rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/vdso/.build-id -%endif # And save the headers/makefiles etc for building modules against # @@ -1623,20 +1637,21 @@ mkdir -p $RPM_BUILD_ROOT%{_libexecdir} cd linux-%{KVERREL} + %if %{with_debug} -BuildKernel %make_target %kernel_image debug +BuildKernel %make_target %kernel_image %{_use_vdso} debug %endif %if %{with_pae_debug} -BuildKernel %make_target %kernel_image %{pae}debug +BuildKernel %make_target %kernel_image %{use_vdso} %{pae}debug %endif %if %{with_pae} -BuildKernel %make_target %kernel_image %{pae} +BuildKernel %make_target %kernel_image %{use_vdso} %{pae} %endif %if %{with_up} -BuildKernel %make_target %kernel_image +BuildKernel %make_target %kernel_image %{_use_vdso} %endif %global perf_make \ @@ -2088,68 +2103,70 @@ fi # %%kernel_variant_files [-k vmlinux] # %define kernel_variant_files(k:) \ -%if %{1}\ -%{expand:%%files -f kernel-%{?2:%{2}-}core.list %{?2:%{2}-}core}\ +%if %{2}\ +%{expand:%%files -f kernel-%{?3:%{3}-}core.list %{?3:%{3}-}core}\ %defattr(-,root,root)\ %{!?_licensedir:%global license %%doc}\ %license linux-%{KVERREL}/COPYING\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/%{?-k:%{-k*}}%{!?-k:vmlinuz}\ -%ghost /%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?2:+%{2}}\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/.vmlinuz.hmac \ -%ghost /%{image_install_path}/.vmlinuz-%{KVERREL}%{?2:+%{2}}.hmac \ +/lib/modules/%{KVERREL}%{?3:+%{3}}/%{?-k:%{-k*}}%{!?-k:vmlinuz}\ +%ghost /%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?3:+%{3}}\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/.vmlinuz.hmac \ +%ghost /%{image_install_path}/.vmlinuz-%{KVERREL}%{?3:+%{3}}.hmac \ %ifarch %{arm} aarch64\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/dtb \ -%ghost /%{image_install_path}/dtb-%{KVERREL}%{?2:+%{2}} \ +/lib/modules/%{KVERREL}%{?3:+%{3}}/dtb \ +%ghost /%{image_install_path}/dtb-%{KVERREL}%{?3:+%{3}} \ %endif\ -%attr(600,root,root) /lib/modules/%{KVERREL}%{?2:+%{2}}/System.map\ -%ghost /boot/System.map-%{KVERREL}%{?2:+%{2}}\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/config\ -%ghost /boot/config-%{KVERREL}%{?2:+%{2}}\ -%ghost /boot/initramfs-%{KVERREL}%{?2:+%{2}}.img\ +%attr(600,root,root) /lib/modules/%{KVERREL}%{?3:+%{3}}/System.map\ +%ghost /boot/System.map-%{KVERREL}%{?3:+%{3}}\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/config\ +%ghost /boot/config-%{KVERREL}%{?3:+%{3}}\ +%ghost /boot/initramfs-%{KVERREL}%{?3:+%{3}}.img\ %dir /lib/modules\ -%dir /lib/modules/%{KVERREL}%{?2:+%{2}}\ -%dir /lib/modules/%{KVERREL}%{?2:+%{2}}/kernel\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/build\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/source\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/updates\ -%ifarch %{vdso_arches}\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/vdso\ -/etc/ld.so.conf.d/kernel-%{KVERREL}%{?2:+%{2}}.conf\ +%dir /lib/modules/%{KVERREL}%{?3:+%{3}}\ +%dir /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/build\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/source\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/updates\ +%if %{1}\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/vdso\ +/etc/ld.so.conf.d/kernel-%{KVERREL}%{?3:+%{3}}.conf\ %endif\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/modules.*\ -%{expand:%%files -f kernel-%{?2:%{2}-}modules.list %{?2:%{2}-}modules}\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/modules.*\ +%{expand:%%files -f kernel-%{?3:%{3}-}modules.list %{?3:%{3}-}modules}\ %defattr(-,root,root)\ -%{expand:%%files %{?2:%{2}-}devel}\ +%{expand:%%files %{?3:%{3}-}devel}\ %defattr(-,root,root)\ %defverify(not mtime)\ -/usr/src/kernels/%{KVERREL}%{?2:+%{2}}\ -%{expand:%%files %{?2:%{2}-}modules-extra}\ +/usr/src/kernels/%{KVERREL}%{?3:+%{3}}\ +%{expand:%%files %{?3:%{3}-}modules-extra}\ %defattr(-,root,root)\ -/lib/modules/%{KVERREL}%{?2:+%{2}}/extra\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/extra\ %if %{with_debuginfo}\ %ifnarch noarch\ -%{expand:%%files -f debuginfo%{?2}.list %{?2:%{2}-}debuginfo}\ +%{expand:%%files -f debuginfo%{?3}.list %{?3:%{3}-}debuginfo}\ %defattr(-,root,root)\ %endif\ %endif\ -%if %{?2:1} %{!?2:0}\ -%{expand:%%files %{2}}\ +%if %{?3:1} %{!?3:0}\ +%{expand:%%files %{3}}\ %defattr(-,root,root)\ %endif\ %endif\ %{nil} - -%kernel_variant_files %{with_up} -%kernel_variant_files %{with_debug} debug -%kernel_variant_files %{with_pae} %{pae} -%kernel_variant_files %{with_pae_debug} %{pae}debug +%kernel_variant_files %{_use_vdso} %{with_up} +%kernel_variant_files %{_use_vdso} %{with_debug} debug +%kernel_variant_files %{use_vdso} %{with_pae} %{pae} +%kernel_variant_files %{use_vdso} %{with_pae_debug} %{pae}debug # plz don't put in a version string unless you're going to tag # and build. # # %changelog +* Tue Jun 06 2017 Laura Abbott +- Enable the vDSO for arm LPAE + * Tue Jun 06 2017 Laura Abbott - 4.12.0-0.rc4.git1.1 - Linux v4.12-rc4-13-gba7b238