Re: 4.17-ad1: -march=native support or Kernel Ricers wanted

2018-06-08 Thread Alexey Dobriyan
On Fri, Jun 08, 2018 at 02:34:36PM +0800, kbuild test robot wrote:
> url:
> https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/4-17-ad1-march-native-support-or-Kernel-Ricers-wanted/20180605-090623

>execvp: scripts/march-native.sh: Permission denied

You patch application scripts ignore +x


Re: 4.17-ad1: -march=native support or Kernel Ricers wanted

2018-06-08 Thread Alexey Dobriyan
On Fri, Jun 08, 2018 at 02:34:36PM +0800, kbuild test robot wrote:
> url:
> https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/4-17-ad1-march-native-support-or-Kernel-Ricers-wanted/20180605-090623

>execvp: scripts/march-native.sh: Permission denied

You patch application scripts ignore +x


Re: 4.17-ad1: -march=native support or Kernel Ricers wanted

2018-06-08 Thread kbuild test robot
Hi Alexey,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17]
[cannot apply to tip/x86/core next-20180607]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/4-17-ad1-march-native-support-or-Kernel-Ricers-wanted/20180605-090623
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k 

All errors (new ones prefixed by >>):

   WARNING: unmet direct dependencies detected for PREEMPT_COUNT
   Depends on COLDFIRE
   Selected by
   - DEBUG_ATOMIC_SLEEP && DEBUG_KERNEL
   execvp: scripts/march-native.sh: Permission denied
   Makefile arch include scripts source Error 127
   Makefile arch include scripts source Error 2
>> Makefile arch include scripts source No rule to make target 
>> 'include/config/auto.conf', needed by 'include/config/kernel.release'.
   Target 'prepare' not remade because of errors.
   make: Makefile arch include scripts source Error 2

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: 4.17-ad1: -march=native support or Kernel Ricers wanted

2018-06-08 Thread kbuild test robot
Hi Alexey,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17]
[cannot apply to tip/x86/core next-20180607]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/4-17-ad1-march-native-support-or-Kernel-Ricers-wanted/20180605-090623
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k 

All errors (new ones prefixed by >>):

   WARNING: unmet direct dependencies detected for PREEMPT_COUNT
   Depends on COLDFIRE
   Selected by
   - DEBUG_ATOMIC_SLEEP && DEBUG_KERNEL
   execvp: scripts/march-native.sh: Permission denied
   Makefile arch include scripts source Error 127
   Makefile arch include scripts source Error 2
>> Makefile arch include scripts source No rule to make target 
>> 'include/config/auto.conf', needed by 'include/config/kernel.release'.
   Target 'prepare' not remade because of errors.
   make: Makefile arch include scripts source Error 2

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: 4.17-ad1: -march=native support or Kernel Ricers wanted

2018-06-07 Thread kbuild test robot
Hi Alexey,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17]
[cannot apply to tip/x86/core next-20180607]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/4-17-ad1-march-native-support-or-Kernel-Ricers-wanted/20180605-090623
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   make[3]: execvp: scripts/march-native.sh: Permission denied
   make[3]: *** [syncconfig] Error 127
   make[2]: *** [syncconfig] Error 2
>> make[1]: *** No rule to make target 'include/config/auto.conf', needed by 
>> 'include/config/kernel.release'.
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: 4.17-ad1: -march=native support or Kernel Ricers wanted

2018-06-07 Thread kbuild test robot
Hi Alexey,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17]
[cannot apply to tip/x86/core next-20180607]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/4-17-ad1-march-native-support-or-Kernel-Ricers-wanted/20180605-090623
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   make[3]: execvp: scripts/march-native.sh: Permission denied
   make[3]: *** [syncconfig] Error 127
   make[2]: *** [syncconfig] Error 2
>> make[1]: *** No rule to make target 'include/config/auto.conf', needed by 
>> 'include/config/kernel.release'.
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


4.17-ad1: -march=native support or Kernel Ricers wanted

2018-06-04 Thread Alexey Dobriyan
Original announcement:
https://marc.info/?l=linux-kernel=151268659328024=4

TLDR: this patchset adds kernel compilation with "-march=native"
for x86_64 which was available for a long time in userspace.

Run "make oldconfig", select "-march=native" support, recompile,
reboot on the same machine(!).

Changes since v0:

* REP STOSB/MOVSB harder for both aligned and unaligned cases
  (still not enough)
* disable MMX/SSE/AVX/AVX-512 (needs double checking re F16C etc)
* use __builtin_popcount() (kudos to hpa)
* fail hard in verify_cpu()
* REP STOSB clear_user() support
* inject "-march=native" detection line into /proc/config.gz

Signed-off-by: Alexey Dobriyan 
---

 Makefile  |   17 +++-
 arch/x86/Kconfig.cpu  |8 +
 arch/x86/Makefile |   27 +-
 arch/x86/boot/compressed/head_64.S|4 
 arch/x86/crypto/des3_ede-asm_64.S |   28 ++
 arch/x86/crypto/sha1_ssse3_asm.S  |7 +
 arch/x86/include/asm/arch_hweight.h   |   28 ++
 arch/x86/include/asm/page_64.h|   26 ++
 arch/x86/kernel/relocate_kernel_64.S  |   15 +++
 arch/x86/kernel/verify_cpu.S  |   27 ++
 arch/x86/lib/Makefile |   12 ++
 arch/x86/lib/memcpy_64.S  |   13 +++
 arch/x86/lib/memset_64.S  |   15 +++
 arch/x86/lib/usercopy_64.c|   15 +++
 arch/x86/net/bpf_jit.S|   12 ++
 arch/x86/xen/xen-pvh.S|4 
 drivers/net/wireless/mediatek/mt76/mac80211.c |2 
 include/linux/bitops.h|2 
 lib/Makefile  |2 
 scripts/kconfig/.gitignore|1 
 scripts/kconfig/Makefile  |   19 +++-
 scripts/kconfig/cpuid.c   |  100 +++
 scripts/march-native.sh   |  109 ++
 23 files changed, 473 insertions(+), 20 deletions(-)

--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 4
 PATCHLEVEL = 17
 SUBLEVEL = 0
-EXTRAVERSION =
+EXTRAVERSION = -ad1
 NAME = Merciless Moray
 
 # *DOCUMENTATION*
@@ -362,9 +362,8 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS)
 
 HOSTCC   = gcc
 HOSTCXX  = g++
-HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \
-   -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS)
-HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS)
+HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -march=native 
-O2 -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS)
+HOSTCXXFLAGS := -march=native -O2 $(HOST_LFS_CFLAGS)
 HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS)
 HOST_LOADLIBES := $(HOST_LFS_LIBS)
 
@@ -584,6 +583,16 @@ ifeq ($(dot-config),1)
 # Read in config
 -include include/config/auto.conf
 
+ifdef CONFIG_MARCH_NATIVE
+KBUILD_CFLAGS += -march=native
+endif
+ifdef CONFIG_MARCH_NATIVE_REP_MOVSB
+KBUILD_CFLAGS += -mmemcpy-strategy=rep_byte:-1:align,rep_byte:-1:noalign
+endif
+ifdef CONFIG_MARCH_NATIVE_REP_STOSB
+KBUILD_CFLAGS += -mmemset-strategy=rep_byte:-1:align,rep_byte:-1:noalign
+endif
+
 ifeq ($(KBUILD_EXTMOD),)
 # Read in dependencies to all Kconfig* files, make sure to run
 # oldconfig if changes are detected.
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -287,6 +287,12 @@ config GENERIC_CPU
  Generic x86-64 CPU.
  Run equally well on all x86-64 CPUs.
 
+config MARCH_NATIVE
+   bool "-march=native"
+   depends on X86_64
+   ---help---
+ -march=native support.
+
 endchoice
 
 config X86_GENERIC
@@ -307,6 +313,7 @@ config X86_INTERNODE_CACHE_SHIFT
int
default "12" if X86_VSMP
default X86_L1_CACHE_SHIFT
+   depends on !MARCH_NATIVE
 
 config X86_L1_CACHE_SHIFT
int
@@ -314,6 +321,7 @@ config X86_L1_CACHE_SHIFT
default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || 
X86_GENERIC || GENERIC_CPU
default "4" if MELAN || M486 || MGEODEGX1
default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || 
MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || 
M586 || MVIAC3_2 || MGEODE_LX
+   depends on !MARCH_NATIVE
 
 config X86_F00F_BUG
def_bool y
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -12,6 +12,28 @@ else
 KBUILD_DEFCONFIG := $(ARCH)_defconfig
 endif
 
+CFLAGS_NO_FP :=
+CFLAGS_NO_FP += $(call cc-option,-mno-mmx,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse2,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse3,)
+CFLAGS_NO_FP += $(call cc-option,-mno-ssse3,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse4,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse4a,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse4.1,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse4.2,)
+CFLAGS_NO_FP += $(call cc-option,-mno-avx,)
+CFLAGS_NO_FP += $(call 

4.17-ad1: -march=native support or Kernel Ricers wanted

2018-06-04 Thread Alexey Dobriyan
Original announcement:
https://marc.info/?l=linux-kernel=151268659328024=4

TLDR: this patchset adds kernel compilation with "-march=native"
for x86_64 which was available for a long time in userspace.

Run "make oldconfig", select "-march=native" support, recompile,
reboot on the same machine(!).

Changes since v0:

* REP STOSB/MOVSB harder for both aligned and unaligned cases
  (still not enough)
* disable MMX/SSE/AVX/AVX-512 (needs double checking re F16C etc)
* use __builtin_popcount() (kudos to hpa)
* fail hard in verify_cpu()
* REP STOSB clear_user() support
* inject "-march=native" detection line into /proc/config.gz

Signed-off-by: Alexey Dobriyan 
---

 Makefile  |   17 +++-
 arch/x86/Kconfig.cpu  |8 +
 arch/x86/Makefile |   27 +-
 arch/x86/boot/compressed/head_64.S|4 
 arch/x86/crypto/des3_ede-asm_64.S |   28 ++
 arch/x86/crypto/sha1_ssse3_asm.S  |7 +
 arch/x86/include/asm/arch_hweight.h   |   28 ++
 arch/x86/include/asm/page_64.h|   26 ++
 arch/x86/kernel/relocate_kernel_64.S  |   15 +++
 arch/x86/kernel/verify_cpu.S  |   27 ++
 arch/x86/lib/Makefile |   12 ++
 arch/x86/lib/memcpy_64.S  |   13 +++
 arch/x86/lib/memset_64.S  |   15 +++
 arch/x86/lib/usercopy_64.c|   15 +++
 arch/x86/net/bpf_jit.S|   12 ++
 arch/x86/xen/xen-pvh.S|4 
 drivers/net/wireless/mediatek/mt76/mac80211.c |2 
 include/linux/bitops.h|2 
 lib/Makefile  |2 
 scripts/kconfig/.gitignore|1 
 scripts/kconfig/Makefile  |   19 +++-
 scripts/kconfig/cpuid.c   |  100 +++
 scripts/march-native.sh   |  109 ++
 23 files changed, 473 insertions(+), 20 deletions(-)

--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 4
 PATCHLEVEL = 17
 SUBLEVEL = 0
-EXTRAVERSION =
+EXTRAVERSION = -ad1
 NAME = Merciless Moray
 
 # *DOCUMENTATION*
@@ -362,9 +362,8 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS)
 
 HOSTCC   = gcc
 HOSTCXX  = g++
-HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \
-   -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS)
-HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS)
+HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -march=native 
-O2 -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS)
+HOSTCXXFLAGS := -march=native -O2 $(HOST_LFS_CFLAGS)
 HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS)
 HOST_LOADLIBES := $(HOST_LFS_LIBS)
 
@@ -584,6 +583,16 @@ ifeq ($(dot-config),1)
 # Read in config
 -include include/config/auto.conf
 
+ifdef CONFIG_MARCH_NATIVE
+KBUILD_CFLAGS += -march=native
+endif
+ifdef CONFIG_MARCH_NATIVE_REP_MOVSB
+KBUILD_CFLAGS += -mmemcpy-strategy=rep_byte:-1:align,rep_byte:-1:noalign
+endif
+ifdef CONFIG_MARCH_NATIVE_REP_STOSB
+KBUILD_CFLAGS += -mmemset-strategy=rep_byte:-1:align,rep_byte:-1:noalign
+endif
+
 ifeq ($(KBUILD_EXTMOD),)
 # Read in dependencies to all Kconfig* files, make sure to run
 # oldconfig if changes are detected.
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -287,6 +287,12 @@ config GENERIC_CPU
  Generic x86-64 CPU.
  Run equally well on all x86-64 CPUs.
 
+config MARCH_NATIVE
+   bool "-march=native"
+   depends on X86_64
+   ---help---
+ -march=native support.
+
 endchoice
 
 config X86_GENERIC
@@ -307,6 +313,7 @@ config X86_INTERNODE_CACHE_SHIFT
int
default "12" if X86_VSMP
default X86_L1_CACHE_SHIFT
+   depends on !MARCH_NATIVE
 
 config X86_L1_CACHE_SHIFT
int
@@ -314,6 +321,7 @@ config X86_L1_CACHE_SHIFT
default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || 
X86_GENERIC || GENERIC_CPU
default "4" if MELAN || M486 || MGEODEGX1
default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || 
MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || 
M586 || MVIAC3_2 || MGEODE_LX
+   depends on !MARCH_NATIVE
 
 config X86_F00F_BUG
def_bool y
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -12,6 +12,28 @@ else
 KBUILD_DEFCONFIG := $(ARCH)_defconfig
 endif
 
+CFLAGS_NO_FP :=
+CFLAGS_NO_FP += $(call cc-option,-mno-mmx,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse2,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse3,)
+CFLAGS_NO_FP += $(call cc-option,-mno-ssse3,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse4,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse4a,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse4.1,)
+CFLAGS_NO_FP += $(call cc-option,-mno-sse4.2,)
+CFLAGS_NO_FP += $(call cc-option,-mno-avx,)
+CFLAGS_NO_FP += $(call