mirror_zfs/include/os/linux/kernel/linux
Fabian-Gruenbichler b119e2c6f1 SIMD: Use alloc_pages_node to force alignment
fxsave and xsave require the target address to be 16-/64-byte aligned.

kmalloc(_node) does not (yet) offer such fine-grained control over
alignment[0,1], even though it does "the right thing" most of the time
for power-of-2 sizes. unfortunately, alignment is completely off when
using certain debugging or hardening features/configs, such as KASAN,
slub_debug=Z or the not-yet-upstream SLAB_CANARY.

Use alloc_pages_node() instead which allows us to allocate page-aligned
memory. Since fpregs_state is padded to a full page anyway, and this
code is only relevant for x86 which has 4k pages, this approach should
not allocate any unnecessary memory but still guarantee the needed
alignment.

0: https://lwn.net/Articles/787740/
1: https://lore.kernel.org/linux-block/20190826111627.7505-1-vbabka@suse.cz/

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9608 
Closes #9674
2019-12-10 12:53:25 -08:00
..
blkdev_compat.h Remove zfs_vdev_elevator module option 2019-11-27 10:35:49 -08:00
compiler_compat.h OpenZFS restructuring - move platform specific headers 2019-09-05 09:34:54 -07:00
dcache_compat.h Linux compat: Minimum kernel version 3.10 2019-11-12 08:59:06 -08:00
kmap_compat.h Linux compat: Minimum kernel version 3.10 2019-11-12 08:59:06 -08:00
Makefile.am OpenZFS restructuring - move platform specific headers 2019-09-05 09:34:54 -07:00
mod_compat.h Wrap Linux module macros 2019-11-01 10:41:03 -07:00
page_compat.h OpenZFS restructuring - move platform specific headers 2019-09-05 09:34:54 -07:00
simd_aarch64.h Linux 4.14, 4.19, 5.0+ compat: SIMD save/restore 2019-10-24 10:17:33 -07:00
simd_x86.h SIMD: Use alloc_pages_node to force alignment 2019-12-10 12:53:25 -08:00
simd.h Linux 4.14, 4.19, 5.0+ compat: SIMD save/restore 2019-10-24 10:17:33 -07:00
utsname_compat.h OpenZFS restructuring - move platform specific headers 2019-09-05 09:34:54 -07:00
vfs_compat.h Linux compat: Minimum kernel version 3.10 2019-11-12 08:59:06 -08:00
xattr_compat.h Linux compat: Minimum kernel version 3.10 2019-11-12 08:59:06 -08:00