]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
The returned value from vm_fault_disable_pagefaults() must be stored
authorhselasky <hselasky@FreeBSD.org>
Mon, 19 Oct 2015 16:03:08 +0000 (16:03 +0000)
committerhselasky <hselasky@FreeBSD.org>
Mon, 19 Oct 2015 16:03:08 +0000 (16:03 +0000)
and passed to vm_fault_enable_pagefaults(). Else possible recursion on
the state can be lost.

Sponsored by: Mellanox Technologies
Suggested by: kib @

sys/ofed/include/linux/uaccess.h

index bab848c6ea091c509dea34a2bfbe989ed3f466ff..c2ceedc34b1483ec26a0ea55b0496953ebd8a534 100644 (file)
 #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_ */