From owner-svn-src-all@freebsd.org Sun Oct 4 17:23:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDA7C42DF51; Sun, 4 Oct 2020 17:23:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C49Ym5YSyz40pl; Sun, 4 Oct 2020 17:23:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1F3F27C54; Sun, 4 Oct 2020 17:23:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 094HNeAd075461; Sun, 4 Oct 2020 17:23:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 094HNeSi075459; Sun, 4 Oct 2020 17:23:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010041723.094HNeSi075459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 4 Oct 2020 17:23:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366432 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Commit-Revision: 366432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Oct 2020 17:23:40 -0000 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,