Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 May 2017 15:05:44 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319338 - in head/sys/compat/linuxkpi/common: include/linux src
Message-ID:  <201705311505.v4VF5i1I089203@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed May 31 15:05:44 2017
New Revision: 319338
URL: https://svnweb.freebsd.org/changeset/base/319338

Log:
  Implement in_atomic() function in the LinuxKPI.
  
  Obtained from:		kmacy @
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kthread.h
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/include/linux/kthread.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/kthread.h	Wed May 31 14:59:03 2017	(r319337)
+++ head/sys/compat/linuxkpi/common/include/linux/kthread.h	Wed May 31 15:05:44 2017	(r319338)
@@ -48,10 +48,15 @@
 	__task;								\
 })
 
+#define	in_atomic() ({				\
+	linux_in_atomic();			\
+})
+
 extern int kthread_stop(struct task_struct *);
 extern bool kthread_should_stop_task(struct task_struct *);
 extern bool kthread_should_stop(void);
 extern void linux_kthread_fn(void *);
 extern struct task_struct *linux_kthread_setup_and_run(struct thread *, linux_task_fn_t *, void *arg);
+extern int linux_in_atomic(void);
 
 #endif	/* _LINUX_KTHREAD_H_ */

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_compat.c	Wed May 31 14:59:03 2017	(r319337)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c	Wed May 31 15:05:44 2017	(r319338)
@@ -73,8 +73,9 @@ __FBSDID("$FreeBSD$");
 #include <linux/timer.h>
 #include <linux/interrupt.h>
 #include <linux/uaccess.h>
-#include <linux/kernel.h>
 #include <linux/list.h>
+#include <linux/kthread.h>
+#include <linux/kernel.h>
 #include <linux/compat.h>
 #include <linux/poll.h>
 #include <linux/smp.h>
@@ -1677,6 +1678,13 @@ linux_on_each_cpu(void callback(void *), void *data)
 	smp_rendezvous(smp_no_rendezvous_barrier, callback,
 	    smp_no_rendezvous_barrier, data);
 	return (0);
+}
+
+int
+linux_in_atomic(void)
+{
+
+	return ((curthread->td_pflags & TDP_NOFAULTING) != 0);
 }
 
 struct linux_cdev *



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705311505.v4VF5i1I089203>