aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/spinlock.h
Commit message (Collapse)AuthorAgeFilesLines
* Revert "LinuxKPI: Allow spin_lock_irqsave to be called within a critical ↵Vladimir Kondratyev2022-01-261-23/+4
| | | | | | | | | | section" This change results in deadlocks on UP systems This reverts commit 7dea0c9e6eba4dc127cd67667c81fa2c250f1024. Requested by: kib, hselasky
* LinuxKPI: Allow spin_lock_irqsave to be called within a critical sectionVladimir Kondratyev2022-01-181-4/+23
| | | | | | | | | | | | | with spinning on spin_trylock. dma-buf part of drm-kmod depends on this property and absence of it support results in "mi_switch: switch in a critical section" assertions [1][2]. [1] https://github.com/freebsd/drm-kmod/issues/116 [2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261166 MFC after: 1 week Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D33887
* LinuxKPI: Constantly use _LINUXKPI_ prefix in include guardsVladimir Kondratyev2022-01-101-3/+3
| | | | | | MFC after: 1 week Reviewed by: bz, emaste, hselasky, manu Differential Revision: https://reviews.freebsd.org/D33562
* LinuxKPI: Add some typical header pollutionVladimir Kondratyev2022-01-101-0/+1
| | | | | | | | To reduce amount of drm-kmod patching MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33297
* linuxkpi: Add spin_trylock_irqsave() macroNeel Chauhan2021-07-151-0/+5
| | | | | | | | This is needed by the drm-kmod 5.6 update. Reviewed by: hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30706
* LinuxKPI: Change flags parameter type of atomic_dec_and_lock_irqsaveVladimir Kondratyev2021-07-051-6/+11
| | | | | | | | | | | | | On Linux atomic_dec_and_lock_irqsave is a wrapper macro which provides a reference to third parameter rather than parameter value itself to implementation routine called _atomic_dec_and_lock_irqsave [1]. While here, implement a fast path. [1] https://github.com/torvalds/linux/blob/master/include/linux/spinlock.h#L476 Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30781
* LinuxKPI: avoid userret: Returning with with pinned threadBjoern A. Zeeb2021-06-181-0/+2
| | | | | | | | | | | | | | | | | Some code manually calls local_bh_disable() and spin_lock() but then calls spin_unlock_bh() (or vice versa). Our code then calls local_bh_disable() again from spin_lock() which means we have the thread pin count increased twice and that means we get out of synch and are still pinned when returning to user space. Avoid this by adding the explicit local_bh_{enable,disable}() to the spin_[un]lock_bh() versions. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30711
* linuxkpi: Remove unneeded {} in atomic_dec_and_lock_irqsave()Neel Chauhan2021-04-261-2/+1
|
* linuxkpi: Elimiate brackets on return in spinlock.hNeel Chauhan2021-04-261-2/+2
|
* linuxkpi: Implement atomic_dec_and_lock_irqsave()Neel Chauhan2021-04-261-0/+13
| | | | | | | | This is needed by the drm-kmod 5.5 update. Reviewed by: hselasky, manu MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29988
* linuxkpi whitespace cleanupEd Maste2018-03-231-1/+1
| | | | | | | | | Reviewed by: hselasky, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14807 Notes: svn path=/head/; revision=331433
* Implement spin_trylock_irq() function macro in the LinuxKPI.Hans Petter Selasky2018-02-171-0/+3
| | | | | | | | | MFC after: 1 week Submitted by: Johannes Lundberg <johalun0@gmail.com> Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=329477
* Streamline the LinuxKPI spinlock wrappers.Hans Petter Selasky2017-02-211-19/+109
| | | | | | | | | | | | | | | | 1) Add better spinlock debug names when WITNESS_ALL is defined. 2) Make sure that the calling thread gets bound to the current CPU while a spinlock is locked. Some Linux kernel code depends on that the CPU ID doesn't change while a spinlock is locked. 3) Add support for using LinuxKPI spinlocks during a panic(). MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=314044
* Make the LinuxKPI task struct persistent accross system calls.Hans Petter Selasky2017-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | A set of helper functions have been added to manage the life of the LinuxKPI task struct. When an external system call or task is invoked, a check is made to create the task struct by demand. A thread destructor callback is registered to free the task struct when a thread exits to avoid memory leaks. This change lays the ground for emulating the Linux kernel more closely which is a dependency by the code using the LinuxKPI APIs. Add new dedicated td_lkpi_task field has been added to struct thread instead of abusing td_retval[1]. Fix some header file inclusions to make LINT kernel build properly after this change. Bump the __FreeBSD_version to force a rebuild of all kernel modules. MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=314040
* Finish process of moving the LinuxKPI module into the default kernel build.Hans Petter Selasky2015-10-291-0/+70
- Move all files related to the LinuxKPI into sys/compat/linuxkpi and its subfolders. - Update sys/conf/files and some Makefiles to use new file locations. - Added description of COMPAT_LINUXKPI to sys/conf/NOTES which in turn adds the LinuxKPI to all LINT builds. - The LinuxKPI can be added to the kernel by setting the COMPAT_LINUXKPI option. The OFED kernel option no longer builds the LinuxKPI into the kernel. This was done to keep the build rules for the LinuxKPI in sys/conf/files simple. - Extend the LinuxKPI module to include support for USB by moving the Linux USB compat from usb.ko to linuxkpi.ko. - Bump the FreeBSD_version. - A universe kernel build has been done. Reviewed by: np @ (cxgb and cxgbe related changes only) Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=290135