Re: svn commit: r334947 - head/sys/modules

2018-06-17 Thread Kurt Lidl

On 6/16/18 5:50 PM, Dimitry Andric wrote:

On 16 Jun 2018, at 16:57, Kurt Lidl  wrote:


On 6/11/18 4:42 AM, Dimitry Andric wrote:

Author: dim
Date: Mon Jun 11 08:42:03 2018
New Revision: 334947
URL: https://svnweb.freebsd.org/changeset/base/334947
Log:
   Disable building aesni with base gcc
  Because base gcc does not support the required intrinsics, do not
   attempt to compile the aesni module with it.
  Noticed by:   Dan Allen 
   MFC after:   3 days
Modified:
   head/sys/modules/Makefile
Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Jun 11 08:11:35 2018(r334946)
+++ head/sys/modules/Makefile   Mon Jun 11 08:42:03 2018(r334947)
@@ -627,7 +627,9 @@ _aac=   aac
  _aacraid= aacraid
  _acpi=acpi
  .if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
+.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} > 40201
  _aesni=   aesni
+.endif
  .endif
  _amd_ecc_inject=amd_ecc_inject
  _amdsbwd= amdsbwd


I thought that FreeBSD's base gcc (but not a stock 4.2.1 gcc) had support for 
this.  As documented in UPDATING:

20130903:
  AES-NI intrinsic support has been added to gcc.  The AES-NI module
  has been updated to use this support.  A new gcc is required to build
  the aesni module on both i386 and amd64.


It didn't work for the original reporter on freebsd-stable@ here:

https://lists.freebsd.org/pipermail/freebsd-stable/2018-May/089026.html

and for me it still gives:

$ make -C /usr/src/sys/modules/aesni
gcc -c -O3 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -I. 
-I/usr/src/sys -fno-common -mno-mmx -mno-sse -msoft-float -ffreestanding 
-fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs 
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual 
-Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs 
-fdiagnostics-show-option -Wno-unknown-pragmas -Wno-uninitialized 
-finline-limit=8000 -fms-extensions --param inline-unit-growth=100 --param 
large-function-growth=1000 -mno-align-long-strings -mpreferred-stack-boundary=2 
-std=iso9899:1999 -Werror   -mmmx -msse -msse4 -maes -mpclmul 
/usr/src/sys/crypto/aesni/aesni_ghash.c
cc1: error: unrecognized command line option "-msse4"
cc1: error: unrecognized command line option "-mpclmul"
*** Error code 1

Those unrecognized flags were added more than 3 years ago, in r275732,
so I assume this has been broken since that time.  Maybe nobody built
any kernels with gcc for 3 years? :)


Looking at the reported problem, I see that the user is attempting to 
make this work on a Pentium-4 (ie, 32bit) machine.  Which doesn't have 
any of the CPU support needed for the AES code to work anyway.  I'm 
pretty sure that the AES stuff didn't exist on any of the 32 bit CPUs.


So, whether or not the compiler could compile the code or not, that CPU 
isn't going to be able to execute it.


Thanks everyone for your comments and looking into the issue.

-Kurt
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334947 - head/sys/modules

2018-06-16 Thread Dimitry Andric
On 16 Jun 2018, at 16:57, Kurt Lidl  wrote:
> 
> On 6/11/18 4:42 AM, Dimitry Andric wrote:
>> Author: dim
>> Date: Mon Jun 11 08:42:03 2018
>> New Revision: 334947
>> URL: https://svnweb.freebsd.org/changeset/base/334947
>> Log:
>>   Disable building aesni with base gcc
>>  Because base gcc does not support the required intrinsics, do not
>>   attempt to compile the aesni module with it.
>>  Noticed by: Dan Allen 
>>   MFC after: 3 days
>> Modified:
>>   head/sys/modules/Makefile
>> Modified: head/sys/modules/Makefile
>> ==
>> --- head/sys/modules/MakefileMon Jun 11 08:11:35 2018
>> (r334946)
>> +++ head/sys/modules/MakefileMon Jun 11 08:42:03 2018
>> (r334947)
>> @@ -627,7 +627,9 @@ _aac=aac
>>  _aacraid=   aacraid
>>  _acpi=  acpi
>>  .if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
>> +.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} > 40201
>>  _aesni= aesni
>> +.endif
>>  .endif
>>  _amd_ecc_inject=amd_ecc_inject
>>  _amdsbwd=   amdsbwd
> 
> I thought that FreeBSD's base gcc (but not a stock 4.2.1 gcc) had support for 
> this.  As documented in UPDATING:
> 
> 20130903:
>  AES-NI intrinsic support has been added to gcc.  The AES-NI module
>  has been updated to use this support.  A new gcc is required to build
>  the aesni module on both i386 and amd64.

It didn't work for the original reporter on freebsd-stable@ here:

https://lists.freebsd.org/pipermail/freebsd-stable/2018-May/089026.html

and for me it still gives:

$ make -C /usr/src/sys/modules/aesni
gcc -c -O3 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -I. 
-I/usr/src/sys -fno-common -mno-mmx -mno-sse -msoft-float -ffreestanding 
-fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs 
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual 
-Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs 
-fdiagnostics-show-option -Wno-unknown-pragmas -Wno-uninitialized 
-finline-limit=8000 -fms-extensions --param inline-unit-growth=100 --param 
large-function-growth=1000 -mno-align-long-strings -mpreferred-stack-boundary=2 
-std=iso9899:1999 -Werror   -mmmx -msse -msse4 -maes -mpclmul 
/usr/src/sys/crypto/aesni/aesni_ghash.c
cc1: error: unrecognized command line option "-msse4"
cc1: error: unrecognized command line option "-mpclmul"
*** Error code 1

Those unrecognized flags were added more than 3 years ago, in r275732,
so I assume this has been broken since that time.  Maybe nobody built
any kernels with gcc for 3 years? :)

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r334947 - head/sys/modules

2018-06-16 Thread Bruce Evans

On Sat, 16 Jun 2018, Kurt Lidl wrote:


On 6/11/18 4:42 AM, Dimitry Andric wrote:

///
Log:
   Disable building aesni with base gcc
  Because base gcc does not support the required intrinsics, do not
   attempt to compile the aesni module with it.
...
Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Jun 11 08:11:35 2018(r334946)
+++ head/sys/modules/Makefile   Mon Jun 11 08:42:03 2018(r334947)
@@ -627,7 +627,9 @@ _aac=   aac
  _aacraid= aacraid
  _acpi=acpi
  .if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
+.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} > 40201
  _aesni=   aesni
+.endif
  .endif
  _amd_ecc_inject=amd_ecc_inject
  _amdsbwd= amdsbwd


LINT is still broken.  LINT would be even more broken if aesni were removed
from it, since its purpose is to detect uncompilable code.

I thought that FreeBSD's base gcc (but not a stock 4.2.1 gcc) had support for 
this.  As documented in UPDATING:


20130903:
 AES-NI intrinsic support has been added to gcc.  The AES-NI module
 has been updated to use this support.  A new gcc is required to build
 the aesni module on both i386 and amd64.


-maes is accepted by the version of gcc-4.2.1 that I used (buuilt under
-current a year or 2 ago), aesni also hard-codes -msse4 and -mpclmul and
-msha in CFLAGS.  gcc-4.2.1 has no chance of supporting the large changes
needed for at least SSE4 (it does accept -msse3).  aesni wasn't broken to
use -msse4 until 2014/12/12.

Not much else is broken in LINT except this: on i386:
- LINT doesn't even config cleanly, since it duplicates (or tries to vary)
  options in DEFAULTS.  It even duplicates one of its own options by
  placing it in the undocumented section as well as in a documented
  section.  Bitrot in the undocumented section has filled it with many
  documented options.  These errors is not fatal.
- the UKBD_DFLT_KEYMAP option is broken by referencing a file outside of
  the sys tree where it doesn't always exist
- handling of the previous bug is broken.  An empty header file is created
  so the creation error is not detected again.  Compiling ukbd.c fails
  because the empty header doesn't contain the declarations needed.
- a few more files have conversions between pointers and integers of
  different sizes.

On amd64:
- fpu.c fails to compile in all kernels, not just LINT, since it uses
  ifuncs
- efirt.c fails to compile since it dereferences a pointer to an incomplete
  type.  It is "optional efirt", so this doesn't break most kernels.  It
  is not configured by GENERIC either.
- tcp_hpts.c fails to compile because uses a line with a syntax error in
  sys/kern/prefetch.h (an colon to start a clobber list in an asm statement,
  and then no clobber list)).  The same line has about 10 style bugs.
- no files fail to compile due to conversions between pointers and integers
  of different sizes.

Building of modules is completely broken, but I usually turn them off.
I use makeoptious to set CC to gcc-4.2.1, and COMPILER_TYPE to gcc,
and also to put gcc-specific flags in CONF_CFLAGS.  CC is not inherited
in subdirs, but CONF_CFLAGS is, so when the wrong cc is used for modules
it always fails if it uses CFLAGS.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334947 - head/sys/modules

2018-06-16 Thread Conrad Meyer
r255185 added _mm_aesenc(), etc, but not _mm_sha*().  That's probably
where the report comes from.

(If you feel it is worth your while adding sha intrinsics to a
decade-old GCC, go ahead, but I think gcc 4.2 on x86 is pretty dead.)

Best,
Conrad

On Sat, Jun 16, 2018 at 7:57 AM, Kurt Lidl  wrote:
> On 6/11/18 4:42 AM, Dimitry Andric wrote:
>>
>> Author: dim
>> Date: Mon Jun 11 08:42:03 2018
>> New Revision: 334947
>> URL: https://svnweb.freebsd.org/changeset/base/334947
>>
>> Log:
>>Disable building aesni with base gcc
>>   Because base gcc does not support the required intrinsics, do not
>>attempt to compile the aesni module with it.
>>   Noticed by:   Dan Allen 
>>MFC after:   3 days
>>
>> Modified:
>>head/sys/modules/Makefile
>>
>> Modified: head/sys/modules/Makefile
>>
>> ==
>> --- head/sys/modules/Makefile   Mon Jun 11 08:11:35 2018(r334946)
>> +++ head/sys/modules/Makefile   Mon Jun 11 08:42:03 2018(r334947)
>> @@ -627,7 +627,9 @@ _aac=   aac
>>   _aacraid= aacraid
>>   _acpi=acpi
>>   .if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
>> +.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} > 40201
>>   _aesni=   aesni
>> +.endif
>>   .endif
>>   _amd_ecc_inject=amd_ecc_inject
>>   _amdsbwd= amdsbwd
>>
>
> I thought that FreeBSD's base gcc (but not a stock 4.2.1 gcc) had support
> for this.  As documented in UPDATING:
>
> 20130903:
>   AES-NI intrinsic support has been added to gcc.  The AES-NI module
>   has been updated to use this support.  A new gcc is required to build
>   the aesni module on both i386 and amd64.
>
> -Kurt
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334947 - head/sys/modules

2018-06-16 Thread Kurt Lidl

On 6/11/18 4:42 AM, Dimitry Andric wrote:

Author: dim
Date: Mon Jun 11 08:42:03 2018
New Revision: 334947
URL: https://svnweb.freebsd.org/changeset/base/334947

Log:
   Disable building aesni with base gcc
   
   Because base gcc does not support the required intrinsics, do not

   attempt to compile the aesni module with it.
   
   Noticed by:	Dan Allen 

   MFC after:   3 days

Modified:
   head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Jun 11 08:11:35 2018(r334946)
+++ head/sys/modules/Makefile   Mon Jun 11 08:42:03 2018(r334947)
@@ -627,7 +627,9 @@ _aac=   aac
  _aacraid= aacraid
  _acpi=acpi
  .if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
+.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} > 40201
  _aesni=   aesni
+.endif
  .endif
  _amd_ecc_inject=amd_ecc_inject
  _amdsbwd= amdsbwd



I thought that FreeBSD's base gcc (but not a stock 4.2.1 gcc) had 
support for this.  As documented in UPDATING:


20130903:
  AES-NI intrinsic support has been added to gcc.  The AES-NI module
  has been updated to use this support.  A new gcc is required to build
  the aesni module on both i386 and amd64.

-Kurt
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334947 - head/sys/modules

2018-06-11 Thread Dimitry Andric
Author: dim
Date: Mon Jun 11 08:42:03 2018
New Revision: 334947
URL: https://svnweb.freebsd.org/changeset/base/334947

Log:
  Disable building aesni with base gcc
  
  Because base gcc does not support the required intrinsics, do not
  attempt to compile the aesni module with it.
  
  Noticed by:   Dan Allen 
  MFC after:3 days

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Jun 11 08:11:35 2018(r334946)
+++ head/sys/modules/Makefile   Mon Jun 11 08:42:03 2018(r334947)
@@ -627,7 +627,9 @@ _aac=   aac
 _aacraid=  aacraid
 _acpi= acpi
 .if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
+.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} > 40201
 _aesni=aesni
+.endif
 .endif
 _amd_ecc_inject=amd_ecc_inject
 _amdsbwd=  amdsbwd
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"