opnsense-src/sys/compat/linuxkpi/common/include/linux
Konstantin Belousov f823a36e83 Fix linux_destroy_dev() behaviour when there are still files open from
the destroying cdev.

Currently linux_destroy_dev() waits for the reference count on the
linux cdev to drain, and each open file hold the reference.
Practically it means that linux_destroy_dev() is blocked until all
userspace processes that have the cdev open, exit.  FreeBSD devfs does
not have such problem, because device refcount only prevents freeing
of the cdev memory, and separate 'active methods' counter blocks
destroy_dev() until all threads leave the cdevsw methods.  After that,
attempts to enter cdevsw methods are refused with an error.

Implement somewhat similar mechanism for LinuxKPI cdevs.  Demote cdev
refcount to only mean a hold on the linux cdev memory.  Add sirefs
count to track both number of threads inside the cdev methods, and for
single-bit indicator that cdev is being destroyed.  In the later case,
the call is redirected to the dummy cdev.

Reviewed by:	markj
Discussed with:	hselasky
Tested by:	zeising
MFC after:	1 week
Sponsored by:	Mellanox Technologies
Differential revision:	https://reviews.freebsd.org/D18606
2018-12-30 15:46:45 +00:00
..
atomic.h Add a couple of trivial headers to the LinuxKPI. 2017-08-20 01:40:24 +00:00
bitmap.h Implement bitmap_complement() in the LinuxKPI. 2018-05-31 12:48:24 +00:00
bitops.h Use atomic_fcmpset_XXX() instead of atomic_cmpset_XXX() when possible 2018-08-09 09:39:32 +00:00
bottom_half.h Add support for LinuxKPI tasklets. 2017-02-21 13:23:53 +00:00
cache.h
cdev.h Fix linux_destroy_dev() behaviour when there are still files open from 2018-12-30 15:46:45 +00:00
clocksource.h Remove cycle_t type from the LinuxKPI similar to Linux upstream. 2017-07-31 09:17:54 +00:00
compat.h Make the LinuxKPI task struct persistent accross system calls. 2017-02-21 12:43:02 +00:00
compiler.h Define __initconst in the LinuxKPI. 2018-05-31 12:50:42 +00:00
completion.h Correct macroname in the LinuxKPI. 2018-05-31 12:55:38 +00:00
dcache.h Refactor dentry structure into its own header file in the LinuxKPI similary 2018-02-18 08:29:25 +00:00
delay.h Use mstosbt() instead of SBT_1MS in the LinuxKPI to get the last few bits 2018-03-03 19:26:40 +00:00
device.h Implement the dev_pm_set_driver_flags() function macro in the LinuxKPI. 2018-06-07 11:29:07 +00:00
dma-attrs.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
dma-mapping.h Eliminate the arena parameter to kmem_free(). Implicitly this corrects an 2018-08-25 19:38:08 +00:00
dmapool.h Implement dma_pool_zalloc() in the LinuxKPI. 2018-10-29 19:02:36 +00:00
err.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
errno.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
etherdevice.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
export.h Move the EXPORT_SYMBOL_XXX() function macros into own header file. 2018-06-07 11:34:59 +00:00
file.h Eliminate the overhead of gratuitous repeated reinitialization of cap_rights 2018-05-09 18:47:24 +00:00
fs.h linuxkpi: Fix for use-after-free when tearing down character devices. 2018-12-05 13:16:39 +00:00
gfp.h linuxkpi: Add GFP flags needed for ttm drivers 2018-11-01 15:30:01 +00:00
hardirq.h
hrtimer.h Improve high resolution timer support in the LinuxKPI. 2018-06-01 11:33:14 +00:00
idr.h Remove redundant declaration after r341517. 2018-12-05 15:56:44 +00:00
if_arp.h
if_ether.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
if_vlan.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
in.h Add support for more IPv4 and IPv6 related macros in the LinuxKPI. 2017-03-22 15:44:00 +00:00
in6.h Unconditionally include "opt_inet6.h" in the LinuxKPI. 2017-11-01 12:21:28 +00:00
inetdevice.h ibcore: ip6_dev_find() needs to know the scope ID. 2018-12-05 13:24:43 +00:00
interrupt.h Move the IRQ_RETVAL() and irqreturn definitions to irqreturn.h in the 2018-02-17 20:37:21 +00:00
io-mapping.h Let io_mapping_init_wc() fall back to an uncacheable mapping. 2017-07-03 02:01:16 +00:00
io.h Define linuxkpi readq for 64-bit architectures. It is used by drm-kmod. 2018-10-22 20:55:35 +00:00
ioctl.h Define _IOC_SIZE() in the LinuxKPI. 2016-05-13 11:42:36 +00:00
irqreturn.h Move the IRQ_RETVAL() and irqreturn definitions to irqreturn.h in the 2018-02-17 20:37:21 +00:00
jhash.h
jiffies.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
kdev_t.h Fix LinuxKPI regression after r321920. The mda_unit and si_drv0 fields are not 2017-08-02 14:27:27 +00:00
kernel.h Define asm macro in the LinuxKPI. 2018-11-16 16:23:45 +00:00
kmod.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
kobject.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
kref.h Add support for kref_read() function in the LinuxKPI. 2018-02-17 20:56:35 +00:00
kthread.h Add kthread parking support to the LinuxKPI. 2017-06-18 19:22:05 +00:00
ktime.h Implement ktime_get_ts64() function macro in the LinuxKPI. 2018-11-16 16:19:16 +00:00
list.h Make some list functions RCU safe in the LinuxKPI. 2018-06-06 15:49:01 +00:00
lockdep.h Implement more lockdep stubs in the LinuxKPI. 2018-03-02 08:59:53 +00:00
log2.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
math64.h Implement mul_u32_u32() function in the LinuxKPI. 2018-06-05 15:30:36 +00:00
miscdevice.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
mm.h Implement zap_vma_ptes() for managed device objects. 2018-12-30 15:38:07 +00:00
mm_types.h Add support for mmgrab() function in the LinuxKPI. 2018-02-17 20:52:54 +00:00
module.h Move the EXPORT_SYMBOL_XXX() function macros into own header file. 2018-06-07 11:34:59 +00:00
moduleparam.h Stub kernel_param_lock() and kernel_param_unlock() in the LinuxKPI. 2018-03-04 19:10:30 +00:00
mutex.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
net.h
netdevice.h linuxkpi: properly implement netif_carrier_ok(). 2018-12-05 13:17:15 +00:00
notifier.h Add definition for the NETDEV_CHANGE event and tidy up the LinuxKPI 2016-01-26 14:27:00 +00:00
page.h Make sure the "vm_flags" and "vm_page_prot" fields get set correctly 2017-08-11 10:44:40 +00:00
pci.h linuxkpi: Really check if PCI is offline 2018-12-05 13:17:45 +00:00
pfn.h Implement a series of physical page management related functions in 2017-03-27 17:04:11 +00:00
pfn_t.h Implement a series of physical page management related functions in 2017-03-27 17:04:11 +00:00
pid.h Implement get_task_pid() function macro in the LinuxKPI. 2018-02-17 22:33:26 +00:00
poll.h Properly implement poll_wait() in the LinuxKPI. This prevents direct 2017-09-09 06:29:29 +00:00
preempt.h Add some miscellaneous definitions to support DRM drivers. 2017-05-30 17:16:08 +00:00
printk.h Implement pr_err_ratelimited() function macro in the LinuxKPI. 2018-03-04 18:27:50 +00:00
radix-tree.h Implement radix_tree_iter_delete() in the LinuxKPI. 2018-06-01 11:42:09 +00:00
random.h Add get_random_{int,long} to the LinuxKPI. 2017-10-04 17:29:08 +00:00
rbtree.h
rculist.h Replace dummy implementation of RCU in the LinuxKPI with one based on 2017-02-21 18:04:21 +00:00
rcupdate.h Implement the rcu_dereference_raw() function macro. 2018-02-18 09:10:14 +00:00
rwlock.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
rwsem.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
scatterlist.h Implement the __sg_alloc_table_from_pages() function based on the existing 2018-06-01 12:09:07 +00:00
sched.h Implement current_work() function in the LinuxKPI. 2018-08-06 10:48:20 +00:00
semaphore.h Make the LinuxKPI task struct persistent accross system calls. 2017-02-21 12:43:02 +00:00
slab.h Define ARCH_KMALLOC_MINALIGN in the LinuxKPI. 2018-06-07 11:44:11 +00:00
smp.h Add on_each_cpu() and wbinvd_on_all_cpus(). 2017-05-01 16:32:28 +00:00
socket.h
spinlock.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
srcu.h Fix problem regarding priority inversion when using the concurrency 2017-04-19 13:03:29 +00:00
string.h Implement memdup_user_nul() in the LinuxKPI. 2018-02-16 15:52:28 +00:00
swap.h linuxkpi: Use pageproc instead of vmproc 2018-11-21 04:34:18 +00:00
sysfs.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
time.h Make timespecadd(3) and friends public 2018-07-30 15:46:40 +00:00
timer.h Implement timer_setup() and from_timer() function macros in the LinuxKPI. 2018-06-05 15:20:20 +00:00
types.h Define __poll_t type in the LinuxKPI. 2018-08-06 08:35:16 +00:00
uaccess.h Allow the put_user() function macro to put constant values by using the 2018-02-17 21:47:15 +00:00
usb.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
vmalloc.h
wait.h Implement the __add_wait_queue_entry_tail() function in the LinuxKPI. 2018-06-06 15:19:30 +00:00
workqueue.h Implement current_work() function in the LinuxKPI. 2018-08-06 10:48:20 +00:00
ww_mutex.h Implement support for mutexes with deadlock avoidance in the LinuxKPI. 2017-03-09 18:33:40 +00:00