svn commit: r366878 - in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

Hans Petter Selasky hselasky at FreeBSD.org
Tue Oct 20 08:17:48 UTC 2020


Author: hselasky
Date: Tue Oct 20 08:17:47 2020
New Revision: 366878
URL: https://svnweb.freebsd.org/changeset/base/366878

Log:
  MFC r366432:
  Populate the acquire context field of a ww_mutex in the LinuxKPI.
  Bump the FreeBSD version to force recompilation of external kernel modules.
  
  Differential Revision:	https://reviews.freebsd.org/D26657
  Submitted by:		greg_unrelenting.technology (Greg V)
  Sponsored by:		Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/ww_mutex.h
  stable/12/sys/compat/linuxkpi/common/src/linux_lock.c
  stable/12/sys/sys/param.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/ww_mutex.h
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/include/linux/ww_mutex.h	Tue Oct 20 08:15:12 2020	(r366877)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/ww_mutex.h	Tue Oct 20 08:17:47 2020	(r366878)
@@ -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: stable/12/sys/compat/linuxkpi/common/src/linux_lock.c
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/src/linux_lock.c	Tue Oct 20 08:15:12 2020	(r366877)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_lock.c	Tue Oct 20 08:17:47 2020	(r366878)
@@ -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: stable/12/sys/sys/param.h
==============================================================================
--- stable/12/sys/sys/param.h	Tue Oct 20 08:15:12 2020	(r366877)
+++ stable/12/sys/sys/param.h	Tue Oct 20 08:17:47 2020	(r366878)
@@ -60,7 +60,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1202502	/* Master, propagated to newvers */
+#define __FreeBSD_version 1202503	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,


More information about the svn-src-all mailing list