Hans Petter Selasky
8f368d485d
Implement DEFINE_WAIT_FUNC() function macro and default_wake_function()
...
in the LinuxKPI.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-04 18:51:43 +00:00
Hans Petter Selasky
ab7da72090
Implement pr_err_ratelimited() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-04 18:27:50 +00:00
Hans Petter Selasky
8961c48323
Implement __MODULE_STRING() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-04 18:21:21 +00:00
Hans Petter Selasky
20c8d8270c
Implement BUILD_BUG() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-04 18:19:44 +00:00
Hans Petter Selasky
6c51dfb060
Implement writel_relaxed() in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-04 18:17:54 +00:00
Hans Petter Selasky
dc354b1551
Define noinline and __maybe_unused macros in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-04 18:13:31 +00:00
Hans Petter Selasky
9bce524efa
Implement for_each_clear_bit() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-04 18:10:18 +00:00
Hans Petter Selasky
5d503e30ad
Implement GENMASK_ULL() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-04 18:08:21 +00:00
Hans Petter Selasky
782a90d16a
Rename the SLAB_DESTROY_BY_RCU flag into SLAB_TYPESAFE_BY_RCU in the LinuxKPI
...
to be compatible with Linux.
MFC after: 1 week
Requested by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-03-04 18:04:37 +00:00
Hans Petter Selasky
ccae7bb851
Use mstosbt() instead of SBT_1MS in the LinuxKPI to get the last few bits
...
of precision.
MFC after: 1 week
Suggested by: ian@
Sponsored by: Mellanox Technologies
2018-03-03 19:26:40 +00:00
Hans Petter Selasky
7cf1c51588
Implement msleep_interruptible() in the LinuxKPI. While at it use pause_sbt()
...
instead of pause() in the msleep() function to avoid rounding errors when
converting delay values forth and back. Add a guard for a delay value
of zero milliseconds which is undefined.
MFC after: 1 week
Requested by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-03-03 18:54:16 +00:00
Hans Petter Selasky
86ba49a722
Implement more lockdep stubs in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-02 08:59:53 +00:00
Hans Petter Selasky
8554bc585b
Implement ktime_get_raw() function in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-02 08:58:32 +00:00
Hans Petter Selasky
d901abf167
Implement wait_on_bit() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-02 08:56:15 +00:00
Hans Petter Selasky
9555cfd2b2
Rename callout member in struct timer_list to match the one in struct
...
delayed_work in the LinuxKPI. This allows the timer_pending() function
macro to be used with delayed work structures.
No functional nor structural change.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-03-02 08:52:27 +00:00
Hans Petter Selasky
949440623b
Return correct error code to user-space when a system call receives a
...
signal in the LinuxKPI.
The read(), write() and mmap() system calls can return either EINTR or
ERESTART upon receiving a signal. Add code to figure out the correct
return value by temporarily storing the return code from the relevant
FreeBSD kernel APIs in the Linux task structure.
MFC after: 3 days
Sponsored by: Mellanox Technologies
2018-02-22 15:29:19 +00:00
Hans Petter Selasky
e44fa94c09
Implement list_safe_reset_next() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-02-19 16:31:19 +00:00
Hans Petter Selasky
ead15282ae
Implement support for radix_tree_for_each_slot() and radix_tree_exception()
...
in the LinuxKPI and use unsigned long type for the radix tree index.
MFC after: 1 week
Sponsored by: Mellanox Technologies
2018-02-18 12:54:21 +00:00
Hans Petter Selasky
78d7441913
Implement the KMEM_CACHE() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-02-18 09:52:30 +00:00
Hans Petter Selasky
0628fc903e
Make the vm_fault structure in the LinuxKPI compatible with
...
newer versions of the Linux kernel. No functional change.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-02-18 09:31:01 +00:00
Hans Petter Selasky
0597ffb0b5
Implement the rcu_dereference_raw() function macro.
...
Make sure all RCU dereferencing use the READ_ONCE() function macro.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-02-18 09:10:14 +00:00
Hans Petter Selasky
7c86047355
Implement __GFP_BITS_SHIFT and __GFP_BITS_MASK macros in the LinuxKPI.
...
Add compile time asserts to catch conflicts with native defines.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-02-18 08:58:20 +00:00
Hans Petter Selasky
15052dc861
Implement __list_del_entry() helper functions in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-02-18 08:47:15 +00:00
Hans Petter Selasky
d51be3591a
Implement file_inode() and call_mmap() helper functions in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-02-18 08:40:07 +00:00
Hans Petter Selasky
b15a13af6b
Refactor dentry structure into its own header file in the LinuxKPI similary
...
to Linux. No functional change. Implement d_inode() helper function.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-02-18 08:29:25 +00:00
Hans Petter Selasky
0424e413e7
Update the ktime type in the LinuxKPI to be a signed 64-bit integer similarly
...
to Linux, to avoid compilation issues. Implement ktime_get_real_seconds().
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks
2018-02-18 08:05:40 +00:00
Hans Petter Selasky
9a323f25ab
Implement spin_trylock_irq() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 22:45:15 +00:00
Hans Petter Selasky
1169b94c7b
Stub more lockdep function macros in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 22:41:20 +00:00
Hans Petter Selasky
94b9710bc7
Implement get_task_pid() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 22:33:26 +00:00
Hans Petter Selasky
314d034088
Allow the put_user() function macro to put constant values by using the
...
existing __put_user() macro.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 21:47:15 +00:00
Hans Petter Selasky
2460cbb4a6
Implement BUILD_BUG_ON_INVALID() function macro in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 21:40:19 +00:00
Hans Petter Selasky
03f8ddedf0
Add support for printk_ratelimit() function macro and improve the existing
...
printk_ratelimited() function macro to return a boolean stating if there
was a printout, true, or not, false.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 21:25:19 +00:00
Hans Petter Selasky
e35dc5149d
Add support for kref_read() function in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 20:56:35 +00:00
Hans Petter Selasky
13a27c3b43
Add support for mmgrab() function in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 20:52:54 +00:00
Hans Petter Selasky
2060ca654e
Add support for __percpu and __weak macros in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 20:50:18 +00:00
Hans Petter Selasky
7353335d1c
Move the IRQ_RETVAL() and irqreturn definitions to irqreturn.h in the
...
LinuxKPI to be compatible with Linux. No functional change.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 20:37:21 +00:00
Hans Petter Selasky
1249c589b6
Add checks for valid IRQ tag before setting up or tearing down an interrupt
...
handler in the LinuxKPI. This is needed when the interrupt handler is disabled
before freeing the interrupt.
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-17 20:09:43 +00:00
Hans Petter Selasky
f4824a028d
Implement mutex_trylock_recursive() in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-16 16:01:39 +00:00
Hans Petter Selasky
10ee3d3016
Implement memdup_user_nul() in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-16 15:52:28 +00:00
Hans Petter Selasky
f1f7e04a29
Implement tasklet_enable() and tasklet_disable() in the LinuxKPI.
...
MFC after: 1 week
Requested by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-16 15:41:16 +00:00
Hans Petter Selasky
219ff59ce2
Implement enable_irq() and disable_irq() in the LinuxKPI.
...
MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
2018-02-16 15:37:33 +00:00
Konstantin Belousov
67dcd64ab8
linuxkpi: Do not leak pages on put.
...
When the owner of the wire reference releases the last reference, it
might be that the page was already attempted to be freed (but free
cannot be performed at that time due to wire). Check that the page
was removed from the object as the indicator of the free attempt and
finish the free operation if so.
Reported and tested by: Slava Shwartsman
Reviewed by: hselasky
Sponsored by: Mellanox Technologies
MFC after: 1 week
2018-02-13 15:44:35 +00:00
Hans Petter Selasky
5b7cc89266
Fix implementation of ktime_add_ns() and ktime_sub_ns() in the LinuxKPI to
...
actually return the computed result instead of the input value.
This is a regression issue after r289572.
Found by: gcc6
MFC after: 3 days
Sponsored by: Mellanox Technologies
2018-02-07 12:12:06 +00:00
Hans Petter Selasky
cb57d1dd30
Properly implement the cond_resched() function macro in the LinuxKPI.
...
MFC after: 1 week
Sponsored by: Mellanox Technologies
2018-01-31 13:40:36 +00:00
Pedro F. Giffuni
ed595433c6
linuxkpi: Simplify kmalloc_array.
...
kmalloc_array seems what we call mallocarray(9).
2018-01-10 20:50:06 +00:00
Kristof Provost
e70c77ca17
linuxkpi: Implement kcalloc() based on mallocarray()
...
This means we now get integer overflow protection, which Linux code
might expect as it is also provided by kcalloc() in Linux.
2018-01-07 13:39:12 +00:00
Hans Petter Selasky
ef9257491d
Remove release and acquire semantics when accessing the "state" field of the
...
LinuxKPI task struct. Change type of "state" variable from "int" to
"atomic_t" to simplify code and avoid unneccessary casting.
MFC after: 1 week
Sponsored by: Mellanox Technologies
2017-11-11 11:01:50 +00:00
Hans Petter Selasky
e0390735d3
Mask away return codes from del_timer() and del_timer_sync() because
...
they are not the same like in Linux.
MFC after: 1 week
Sponsored by: Mellanox Technologies
2017-11-11 10:46:12 +00:00
Hans Petter Selasky
076f7ce6f6
Remove some not needed comments in the LinuxKPI. Use the Linux source tree
...
to lookup documentation for the functions implemented in the LinuxKPI
instead.
MFC after: 1 week
Sponsored by: Mellanox Technologies
2017-11-10 08:31:40 +00:00
Hans Petter Selasky
a7a3d0d170
Make the dma_alloc_coherent() function in the LinuxKPI NULL safe with regard
...
to the "dev" argument.
Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications
MFC after: 1 week
2017-11-08 08:37:05 +00:00