• Arnd Bergmann's avatar
    scsi: fc: use get/put_unaligned64 for wwn access · ef3fb242
    Arnd Bergmann authored
    A bug in the gcc-6.0 prerelease version caused at least one
    driver (lpfc) to have excessive stack usage when dealing with
    wwn data, on the ARM architecture.
    
    lpfc_scsi.c: In function 'lpfc_find_next_oas_lun':
    lpfc_scsi.c:117:1: warning: the frame size of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=]
    
    I have reported this as a gcc regression in
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70232
    
    However, using a better implementation of wwn_to_u64() not only
    helps with the particular gcc problem but also leads to better
    object code for any version or architecture.
    
    The kernel already provides get_unaligned_be64() and
    put_unaligned_be64() helper functions that provide an
    optimized implementation with the desired semantics.
    
    The lpfc_find_next_oas_lun() function in the example that
    grew from 1146 bytes to 5144 bytes when moving from gcc-5.3
    to gcc-6.0 is now 804 bytes, as the optimized
    get_unaligned_be64() load can be done in three instructions.
    The stack usage is now down to 28 bytes from 128 bytes with
    gcc-5.3 before.
    Signed-off-by: 's avatarArnd Bergmann <arnd@arndb.de>
    Reviewed-by: 's avatarHannes Reinicke <hare@suse.de>
    Reviewed-by: 's avatarEwan Milne <emilne@redhat.com>
    Signed-off-by: 's avatarMartin K. Petersen <martin.petersen@oracle.com>
    ef3fb242
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
REPORTING-BUGS Loading commit data...