aws-neuron / aws-neuron-driver

Linux kernel device driver supporting AWS Neuron SDK
GNU General Public License v2.0
8 stars 4 forks source link

Error 2 during apt install of aws-neuron-dkms 2.1.5.0 on Ubuntu 20.04 #2

Closed gabe-sorensen closed 3 years ago

gabe-sorensen commented 3 years ago

I'm seeing this error on an inf1.xlarge instance when trying to install the aws-neuron-dkms driver according to the docs:

DKMS make.log for aws-neuron-2.1.5.0 for kernel 5.11.0-1019-aws (x86_64)
Fri Oct  8 19:23:28 UTC 2021
make: Entering directory '/usr/src/linux-headers-5.11.0-1019-aws'
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_module.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_pci.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_mempool.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_dma.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_ring.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_ds.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_core.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_crwl.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_cdev.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_topsp.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_pid.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_reset.o
/var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_cdev.c: In function ‘ncdev_crwl_nc_range_mark’:
/var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_cdev.c:1131:3: error: ignoring return value of ‘copy_to_user’, declared with attribute warn_unused_result [-Werror=unused-result]
 1131 |   copy_to_user(param, &arg, sizeof(arg));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_cinit.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_mmap.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_p2p.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_nq.o
  CC [M]  /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_metrics.o
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:288: /var/lib/dkms/aws-neuron/2.1.5.0/build/neuron_cdev.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1849: /var/lib/dkms/aws-neuron/2.1.5.0/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.11.0-1019-aws'

Kernel info: Linux localhost.lan 5.11.0-1019-aws #20~20.04.1-Ubuntu SMP Tue Sep 21 10:40:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

I've also tried a previous version (2.0.450.0) and received a similar error:

DKMS make.log for aws-neuron-2.0.450.0 for kernel 5.11.0-1019-aws (x86_64)
Fri Oct  8 19:28:46 UTC 2021
make: Entering directory '/usr/src/linux-headers-5.11.0-1019-aws'
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_module.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_pci.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_mempool.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_dma.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_ring.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_ds.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_core.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_crwl.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_cdev.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_topsp.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_pid.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_reset.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_cinit.o
/var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_cdev.c: In function ‘ncdev_crwl_nc_range_mark’:
/var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_cdev.c:1128:3: error: ignoring return value of ‘copy_to_user’, declared with attribute warn_unused_result [-Werror=unused-result]
 1128 |   copy_to_user(param, &arg, sizeof(arg));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_mmap.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_p2p.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_nq.o
  CC [M]  /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_metrics.o
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:288: /var/lib/dkms/aws-neuron/2.0.450.0/build/neuron_cdev.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1849: /var/lib/dkms/aws-neuron/2.0.450.0/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.11.0-1019-aws'
mc-a commented 3 years ago

Thank you for the report!

Ubuntu 20 isn't officially supported yet. The error should not be happening on Ubuntu 18.

The fix is very simple, though, and the code in question can be changed like this to make the error go away:

-       copy_to_user(param, &arg, sizeof(arg));
+       int unused = copy_to_user(param, &arg, sizeof(arg));
+       unused = unused;

This is a known issue, and is scheduled for the next release.

gabe-sorensen commented 3 years ago

Oh ok, I will wait for the next release then, thank you!