summaryrefslogtreecommitdiffstats
path: root/sys/ofed
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2015-10-19 16:03:08 +0000
committerhselasky <hselasky@FreeBSD.org>2015-10-19 16:03:08 +0000
commit0f9392fd204257c9b5d0ca308159094c7cedd8dc (patch)
tree64d16d89f67db472db2d4bba724edd8e1896cc85 /sys/ofed
parentcc8822020fbe5f81b62d6712b56f4f667598022c (diff)
downloadFreeBSD-src-0f9392fd204257c9b5d0ca308159094c7cedd8dc.zip
FreeBSD-src-0f9392fd204257c9b5d0ca308159094c7cedd8dc.tar.gz
The returned value from vm_fault_disable_pagefaults() must be stored
and passed to vm_fault_enable_pagefaults(). Else possible recursion on the state can be lost. Sponsored by: Mellanox Technologies Suggested by: kib @
Diffstat (limited to 'sys/ofed')
-rw-r--r--sys/ofed/include/linux/uaccess.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/ofed/include/linux/uaccess.h b/sys/ofed/include/linux/uaccess.h
index bab848c..c2ceedc 100644
--- a/sys/ofed/include/linux/uaccess.h
+++ b/sys/ofed/include/linux/uaccess.h
@@ -30,17 +30,26 @@
#ifndef _LINUX_UACCESS_H_
#define _LINUX_UACCESS_H_
+#include <linux/compiler.h>
+
#define get_user(_x, _p) -copyin((_p), &(_x), sizeof(*(_p)))
#define put_user(_x, _p) -copyout(&(_x), (_p), sizeof(*(_p)))
-static inline void pagefault_disable(void)
+/*
+ * NOTE: The returned value from pagefault_disable() must be stored
+ * and passed to pagefault_enable(). Else possible recursion on the
+ * state can be lost.
+ */
+static inline int __must_check
+pagefault_disable(void)
{
- curthread_pflags_set(TDP_NOFAULTING | TDP_RESETSPUR);
+ return (vm_fault_disable_pagefaults());
}
-static inline void pagefault_enable(void)
+static inline void
+pagefault_enable(int save)
{
- curthread_pflags_restore(~(TDP_NOFAULTING | TDP_RESETSPUR));
+ vm_fault_enable_pagefaults(save);
}
#endif /* _LINUX_UACCESS_H_ */
OpenPOWER on IntegriCloud