From nobody Thu Sep 17 00:02:39 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hlbYC6MJkz6sX8X for ; Thu, 17 Sep 2026 00:02:39 +0000 (UTC) (envelope-from git@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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hlbYC5ZWwz4KsQ for ; Thu, 17 Sep 2026 00:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789603359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UA5rUnaZD9KEoxsFZBMUAG/YtmzRTcATOERBUe9no4E=; b=PG8IeFtmuBMTQGqwmx++o9Qkbz1AlSJY62OCYKvoI0qf0Qq9sN5A7tyR7TLcbMowIhosCG 7bWBaz3YUzDC/vv2oEbpdhqWzyGO+Lj2ZEihnh8+bk6G5q7QCNMBehAuKHk1H7FdT4wRrW sLnLxA7E/xxZj6ygtUOkbSCO1NpP7+svTXB9ekq8lKVvCnNiBxEkRXYzzdjQvpSZQWY2tD AmO9FGWtHGxqEVs19hiCKz7JgHmhFlhvnPVS0ukrq+aNm3bwDR2xkSgHrBzgWI1EJBZeiJ pVqdKV7EDZwxMvv0yih8UH4CrEgwHBh2WrqD32Cl+5QMLFHt4cdkNbaparC0Qg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789603359; b=uXABj1vAhMKOSk/uVdZ7GT0IUeaxqgbKzzuFyPh1nYy007GliBIo0WgG0aMOH5zPq6gp49 M6D1+pZS7Yd9N//eaLghe1aesWLZ5DC1cgDhK38dFjaEac6BGrSHh56jebVLLRWpt55WtG M9uMtxmpbNXsAcc1Lo1lsbXic9WtdSd7PUytmVh83Z86HJ0HUJ0Wxf9gmf87xyuGxbnOUe AMbyQ+fPb+uUkjzYFgV8RzArTm/DCz8zmZZ8vOoA+y6HdT2WS9Jwc56oQRWOG1lciJpysU NASKHIq9jXRUnTETKKSNeBz2QZrUKhoiVjmgns/9fWlRwiRtXLPp+kW7WVzGXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789603359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UA5rUnaZD9KEoxsFZBMUAG/YtmzRTcATOERBUe9no4E=; b=V48Sn6oCaqxQyt4OoDLLRE39b6xrSDmx9xUXBnEMl4yJQviYXiAuyHK6WFMZcr3X05TZsa tMqExdVWo6PP/KTdBaRw9UTF988mO9Hkluf4wH29AsI7GaQQeluGZtnwVaj4waVN0rt1PW WHZ2OaLTFsGFEdpJ6sw1kkCUNbVUM6NsHaWfAU7hp8PbUi/aYV0pFd5s0ocojHy8TNrHYd V0Ps6TqmzsqU4WfJFk7aMAliGJ9f4dlaKBG/yoqn0PA6tQJ2f8IMHv4BrYdV1hMTQAPvV5 APfloSkbGIxTPXp9f3VGoc3cLXusCZ4GRYBDHL4zFRgIHb3Sqvk5hluPgNAIEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hlbYC4f6bz17dH for ; Thu, 17 Sep 2026 00:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25c43 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 17 Sep 2026 00:02:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: b272b2a94d98 - main - ice: Use sleepable locks in shared code List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b272b2a94d983900c94168c5f41256869b0371b1 Auto-Submitted: auto-generated Date: Thu, 17 Sep 2026 00:02:39 +0000 Message-Id: <6aab2e1f.25c43.5080ac0e@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=b272b2a94d983900c94168c5f41256869b0371b1 commit b272b2a94d983900c94168c5f41256869b0371b1 Author: Kevin Bowling AuthorDate: 2026-09-03 11:31:42 +0000 Commit: Kevin Bowling CommitDate: 2026-09-17 00:01:22 +0000 ice: Use sleepable locks in shared code The Intel shared code can wait for firmware resources while holding its OS abstraction locks. FreeBSD mapped these locks to mutexes, which cannot be held across a voluntary sleep. Concurrent PF rebuilds therefore trigger WITNESS when RSS profile updates contend for the firmware change lock. Map the shared-code lock abstraction to exclusive sx locks. This also covers tunnel and flow-profile operations which can reach the same firmware wait while serialized. Validated with WITNESS on a dual port Intel E835. Sixteen CORE resets rebuilt both PFs without lock warnings, reset failures, or watchdogs. Ten interface down/up cycles and twenty promiscuous-filter cycles also completed cleanly. Reviewed by: erj MFC after: 2 weeks Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59339 --- sys/dev/ice/ice_osdep.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sys/dev/ice/ice_osdep.h b/sys/dev/ice/ice_osdep.h index ea355ddb31f4..a428defb14bd 100644 --- a/sys/dev/ice/ice_osdep.h +++ b/sys/dev/ice/ice_osdep.h @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -408,7 +409,7 @@ void ice_free_dma_mem(struct ice_hw __unused *hw, struct ice_dma_mem *mem); * Contains a simple lock implementation used to lock various resources. */ struct ice_lock { - struct mtx mutex; + struct sx sx; char name[ICE_STR_BUF_LEN]; }; @@ -418,8 +419,9 @@ extern u16 ice_lock_count; * ice_init_lock - Initialize a lock for use * @lock: the lock memory to initialize * - * OS compatibility layer to provide a simple locking mechanism. We use - * a mutex for this purpose. + * OS compatibility layer to provide a simple locking mechanism. Shared-code + * operations can wait for firmware while holding these locks, so use a + * sleepable exclusive lock. */ static inline void ice_init_lock(struct ice_lock *lock) @@ -431,45 +433,45 @@ ice_init_lock(struct ice_lock *lock) */ memset(lock->name, 0, sizeof(lock->name)); snprintf(lock->name, ICE_STR_BUF_LEN, "ice_lock_%u", ice_lock_count++); - mtx_init(&lock->mutex, lock->name, NULL, MTX_DEF); + sx_init(&lock->sx, lock->name); } /** * ice_acquire_lock - Acquire the lock * @lock: the lock to acquire * - * Acquires the mutex specified by the lock pointer. + * Acquires the exclusive lock specified by the lock pointer. */ static inline void ice_acquire_lock(struct ice_lock *lock) { - mtx_lock(&lock->mutex); + sx_xlock(&lock->sx); } /** * ice_release_lock - Release the lock * @lock: the lock to release * - * Releases the mutex specified by the lock pointer. + * Releases the exclusive lock specified by the lock pointer. */ static inline void ice_release_lock(struct ice_lock *lock) { - mtx_unlock(&lock->mutex); + sx_xunlock(&lock->sx); } /** * ice_destroy_lock - Destroy the lock to de-allocate it * @lock: the lock to destroy * - * Destroys a previously initialized lock. We only do this if the mutex was + * Destroys a previously initialized lock. We only do this if the lock was * previously initialized. */ static inline void ice_destroy_lock(struct ice_lock *lock) { - if (mtx_initialized(&lock->mutex)) - mtx_destroy(&lock->mutex); + if (lock_initialized(&lock->sx.lock_object)) + sx_destroy(&lock->sx); memset(lock->name, 0, sizeof(lock->name)); }