From owner-svn-src-head@freebsd.org Wed May 31 15:05:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89739B7C724; Wed, 31 May 2017 15:05:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 572627F2EF; Wed, 31 May 2017 15:05:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4VF5ij4089205; Wed, 31 May 2017 15:05:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4VF5i1I089203; Wed, 31 May 2017 15:05:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201705311505.v4VF5i1I089203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 31 May 2017 15:05:44 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 May 2017 15:05:45 -0000 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 #include #include -#include #include +#include +#include #include #include #include @@ -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 *