svn commit: r366432 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys
Hans Petter Selasky
hselasky at FreeBSD.org
Sun Oct 4 17:23:40 UTC 2020
Author: hselasky
Date: Sun Oct 4 17:23:39 2020
New Revision: 366432
URL: https://svnweb.freebsd.org/changeset/base/366432
Log:
Populate the acquire context field of a ww_mutex in the LinuxKPI.
Bump the FreeBSD version to force recompilation of external kernel modules.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26657
Submitted by: greg_unrelenting.technology (Greg V)
Sponsored by: Mellanox Technologies // NVIDIA Networking
Modified:
head/sys/compat/linuxkpi/common/include/linux/ww_mutex.h
head/sys/compat/linuxkpi/common/src/linux_lock.c
head/sys/sys/param.h
Modified: head/sys/compat/linuxkpi/common/include/linux/ww_mutex.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/ww_mutex.h Sun Oct 4 17:17:16 2020 (r366431)
+++ head/sys/compat/linuxkpi/common/include/linux/ww_mutex.h Sun Oct 4 17:23:39 2020 (r366432)
@@ -76,7 +76,8 @@ ww_mutex_trylock(struct ww_mutex *lock)
return (mutex_trylock(&lock->base));
}
-extern int linux_ww_mutex_lock_sub(struct ww_mutex *, int catch_signal);
+extern int linux_ww_mutex_lock_sub(struct ww_mutex *,
+ struct ww_acquire_ctx *, int catch_signal);
static inline int
ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
@@ -86,7 +87,7 @@ ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire
else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread)
return (-EALREADY);
else
- return (linux_ww_mutex_lock_sub(lock, 0));
+ return (linux_ww_mutex_lock_sub(lock, ctx, 0));
}
static inline int
@@ -97,7 +98,7 @@ ww_mutex_lock_interruptible(struct ww_mutex *lock, str
else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread)
return (-EALREADY);
else
- return (linux_ww_mutex_lock_sub(lock, 1));
+ return (linux_ww_mutex_lock_sub(lock, ctx, 1));
}
extern void linux_ww_mutex_unlock_sub(struct ww_mutex *);
Modified: head/sys/compat/linuxkpi/common/src/linux_lock.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_lock.c Sun Oct 4 17:17:16 2020 (r366431)
+++ head/sys/compat/linuxkpi/common/src/linux_lock.c Sun Oct 4 17:23:39 2020 (r366432)
@@ -71,7 +71,8 @@ linux_ww_unlock(void)
/* lock a mutex with deadlock avoidance */
int
-linux_ww_mutex_lock_sub(struct ww_mutex *lock, int catch_signal)
+linux_ww_mutex_lock_sub(struct ww_mutex *lock,
+ struct ww_acquire_ctx *ctx, int catch_signal)
{
struct task_struct *task;
struct ww_mutex_thread entry;
@@ -126,6 +127,9 @@ done:
if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == NULL)
cv_signal(&lock->condvar);
}
+
+ if (retval == 0)
+ lock->ctx = ctx;
linux_ww_unlock();
return (retval);
}
@@ -135,6 +139,7 @@ linux_ww_mutex_unlock_sub(struct ww_mutex *lock)
{
/* protect ww_mutex ownership change */
linux_ww_lock();
+ lock->ctx = NULL;
sx_xunlock(&lock->base.sx);
/* wakeup a lock waiter, if any */
cv_signal(&lock->condvar);
Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h Sun Oct 4 17:17:16 2020 (r366431)
+++ head/sys/sys/param.h Sun Oct 4 17:23:39 2020 (r366432)
@@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1300118 /* Master, propagated to newvers */
+#define __FreeBSD_version 1300119 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
More information about the svn-src-all
mailing list