Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 5.16 fpu xgetbv/xsetbv now in asm/fpu/xcr.h #6

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions config/kernel-fpu.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ dnl #
dnl # Handle differences in kernel FPU code.
dnl #
dnl # Kernel
dnl # 5.16: XCR code put into asm/fpu/xcr.h
dnl # HAVE_KERNEL_FPU_XCR_HEADER
dnl #
dnl # 5.0: Wrappers have been introduced to save/restore the FPU state.
dnl # This change was made to the 4.19.38 and 4.14.120 LTS kernels.
dnl # HAVE_KERNEL_FPU_INTERNAL
Expand All @@ -25,6 +28,18 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU_HEADER], [
AC_DEFINE(HAVE_KERNEL_FPU_API_HEADER, 1,
[kernel has asm/fpu/api.h])
AC_MSG_RESULT(asm/fpu/api.h)
AC_MSG_CHECKING([whether fpu/xcr header is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/module.h>
#include <asm/fpu/xcr.h>
],[
],[
AC_DEFINE(HAVE_KERNEL_FPU_XCR_HEADER, 1,
[kernel has asm/fpu/xcr.h])
AC_MSG_RESULT(asm/fpu/xcr.h)
],[
AC_MSG_RESULT(no asm/fpu/xcr.h)
])
],[
AC_MSG_RESULT(i387.h & xcr.h)
])
Expand Down
26 changes: 26 additions & 0 deletions config/kernel-pagemap-wait_on_page_writeback.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
dnl #
dnl # Linux 5.16 no longer allows directly calling wait_on_page_bit, and
dnl # instead requires you to call bit-specific functions. In this case,
dnl # wait_on_page_bit(pg, PG_writeback) becomes
dnl # wait_on_page_writeback(pg)
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_PAGEMAP_WAIT_ON_PAGE_WRITEBACK], [
ZFS_LINUX_TEST_SRC([pagemap_has_wait_on_page_writeback], [
#include <linux/pagemap.h>
],[
static struct page *p = NULL;

wait_on_page_writeback(p);
])
])

AC_DEFUN([ZFS_AC_KERNEL_PAGEMAP_WAIT_ON_PAGE_WRITEBACK], [
AC_MSG_CHECKING([wait_on_page_writeback() exists])
ZFS_LINUX_TEST_RESULT([pagemap_has_wait_on_page_writeback], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_PAGEMAP_WAIT_ON_PAGE_WRITEBACK, 1,
[wait_on_page_writeback() exists])
],[
AC_MSG_RESULT([no])
])
])
2 changes: 2 additions & 0 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE
ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS
ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG
ZFS_AC_KERNEL_SRC_PAGEMAP_WAIT_ON_PAGE_WRITEBACK

AC_MSG_CHECKING([for available kernel interfaces])
ZFS_LINUX_TEST_COMPILE_ALL([kabi])
Expand Down Expand Up @@ -241,6 +242,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_SET_SPECIAL_STATE
ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS
ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG
ZFS_AC_KERNEL_PAGEMAP_WAIT_ON_PAGE_WRITEBACK
])

dnl #
Expand Down
3 changes: 3 additions & 0 deletions include/os/linux/kernel/linux/simd_x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
#if defined(HAVE_KERNEL_FPU_API_HEADER)
#include <asm/fpu/api.h>
#include <asm/fpu/internal.h>
#if defined(HAVE_KERNEL_FPU_XCR_HEADER)
#include <asm/fpu/xcr.h>
#endif
#else
#include <asm/i387.h>
#include <asm/xcr.h>
Expand Down
4 changes: 4 additions & 0 deletions module/os/linux/zfs/zfs_vnops_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -3531,7 +3531,11 @@ zfs_putpage(struct inode *ip, struct page *pp, struct writeback_control *wbc)

if (wbc->sync_mode != WB_SYNC_NONE) {
if (PageWriteback(pp))
#ifdef HAVE_PAGEMAP_WAIT_ON_PAGE_WRITEBACK
wait_on_page_writeback(pp);
#else
wait_on_page_bit(pp, PG_writeback);
#endif
}

ZFS_EXIT(zfsvfs);
Expand Down