From nobody Wed Oct 02 19:13:33 2024 X-Original-To: dev-commits-src-main@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 4XJkx94Rxgz5XxnZ; Wed, 02 Oct 2024 19:13:33 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XJkx93w3yz4Srq; Wed, 2 Oct 2024 19:13:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727896413; 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=UTTIKiapDAwMF9QKz5wNOTjQMPfIikCUmu8dd8W3jTc=; b=aimZ5fDymVWN5FX9Wrs4a5axKQMbbjxrFI7wvHa4qT3T5bxBC2FkHSLuJLWdR9L5dDoOXF klIfdOvAZrblnqY6l3oz4s+CUOuk068KaW9ZeS2FI+z+kL1fQpD/Ym1otOV/s9wNoS+NT+ wqOQXLS9mTQohMUn+GT9kShEgyX4LK+ktcgjmrYdqZuZD3EDDcl01xMv7JHQAgwXgSfLdv i3Dw1iEYe84W9YF08zzM+VDfCD6tvbfLetDyQAThkyAADCDNiwcI40oqxXqqW2gHy1u6Im EQB3dhkISFpHNX/qLU43B8nIWosNbU1Cy4g6+zIjIxUIV55uxQ+V9hAnATmLsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727896413; 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=UTTIKiapDAwMF9QKz5wNOTjQMPfIikCUmu8dd8W3jTc=; b=wtzM1EkOvrjWjX9e8TCLMgEkuK3nmP4armKFKp0EYq5I0xfcpgaz42Wu8xX2nJk3tFptm0 7Qv9IQrMZNFP7tkVLWgCxEJcs7UMyt2hRXb7TyLCM0/YT+O1nJLh1VYN4k4FFLCqLn/ORj cGjJMe7BtpYzO2FFIGQ4hoA+gGh/CORRLlrh0QYMOy444WToxWi32b5knvi1zotyTYvdB+ sJ0SAHIBvEJ1pSNoeSljJxNAcNhhRHVcC3V6QdM/v6L7cZwagXPp7NMSVNT9sjGOlrrd39 wEQwZQZM1bz3WJ0AaweAG/gKjQ8nLFkGXTFxcQE5XikwUkWvK5V/nMsZjMjzUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727896413; a=rsa-sha256; cv=none; b=Rrl4lJm5DUL73ZNq2yWKbDUQtGiSeay2yTg7UjyOJB/GjmdFfjEL6M0f1uGlkv6AWJTrtr fxxUr4/brwSeZOyPdpbsih0UODhB4DvJi6oMuwasVTUAle0eyuuuyCRxSsctq4fCMLnmqI KLtxP/2KRYaMfzBj44Mol+DdvQWoknukIfObP5ivWhVz7qYBxCXBJMJJa7GknqPmrgZtX8 LqZzkgDNa/cO96FZA8LaJ6YgOOhvpA3oNePWjY7jlxdR64/dLPznKEGP5ktF8kKCtLtwrc ufHr8f0/egNihiF360nhkfZHsfDmR1HYvjX4kyx54N4KptHqjIkF43ABZ/e5Xw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XJkx92wHHzJbd; Wed, 2 Oct 2024 19:13:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 492JDXnF092461; Wed, 2 Oct 2024 19:13:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 492JDXP9092458; Wed, 2 Oct 2024 19:13:33 GMT (envelope-from git) Date: Wed, 2 Oct 2024 19:13:33 GMT Message-Id: <202410021913.492JDXP9092458@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c08e016f000c - main - unix: Use a dedicated mtx pool for vnode name locks List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c08e016f000ce417a6fb413025ab81ad66cbdfff Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c08e016f000ce417a6fb413025ab81ad66cbdfff commit c08e016f000ce417a6fb413025ab81ad66cbdfff Author: John Baldwin AuthorDate: 2024-10-02 19:12:37 +0000 Commit: John Baldwin CommitDate: 2024-10-02 19:12:37 +0000 unix: Use a dedicated mtx pool for vnode name locks mtxpool_sleep should be used as a leaf lock since it is a general purpose pool shared across many consumers. Holding a pool lock while acquiring other locks (e.g. the socket buffer lock in soreserve()) can trigger LOR warnings for unrelated code. Reviewed by: glebius Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D46792 --- sys/kern/uipc_usrreq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 0f01afa97878..fc1559fb1fb1 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -112,6 +112,7 @@ static int unp_rights; /* (g) File descriptors in flight. */ static struct unp_head unp_shead; /* (l) List of stream sockets. */ static struct unp_head unp_dhead; /* (l) List of datagram sockets. */ static struct unp_head unp_sphead; /* (l) List of seqpacket sockets. */ +static struct mtx_pool *unp_vp_mtxpool; struct unp_defer { SLIST_ENTRY(unp_defer) ud_link; @@ -679,7 +680,7 @@ uipc_close(struct socket *so) vplock = NULL; if ((vp = unp->unp_vnode) != NULL) { - vplock = mtx_pool_find(mtxpool_sleep, vp); + vplock = mtx_pool_find(unp_vp_mtxpool, vp); mtx_lock(vplock); } UNP_PCB_LOCK(unp); @@ -748,7 +749,7 @@ uipc_detach(struct socket *so) UNP_PCB_UNLOCK_ASSERT(unp); restart: if ((vp = unp->unp_vnode) != NULL) { - vplock = mtx_pool_find(mtxpool_sleep, vp); + vplock = mtx_pool_find(unp_vp_mtxpool, vp); mtx_lock(vplock); } UNP_PCB_LOCK(unp); @@ -1953,7 +1954,7 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam, unp = sotounpcb(so); KASSERT(unp != NULL, ("unp_connect: unp == NULL")); - vplock = mtx_pool_find(mtxpool_sleep, vp); + vplock = mtx_pool_find(unp_vp_mtxpool, vp); mtx_lock(vplock); VOP_UNP_CONNECT(vp, &unp2); if (unp2 == NULL) { @@ -2561,6 +2562,7 @@ unp_init(void *arg __unused) TASK_INIT(&unp_defer_task, 0, unp_process_defers, NULL); UNP_LINK_LOCK_INIT(); UNP_DEFERRED_LOCK_INIT(); + unp_vp_mtxpool = mtx_pool_create("unp vp mtxpool", 32, MTX_DEF); } SYSINIT(unp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, unp_init, NULL); @@ -3441,7 +3443,7 @@ vfs_unp_reclaim(struct vnode *vp) ("vfs_unp_reclaim: vp->v_type != VSOCK")); active = 0; - vplock = mtx_pool_find(mtxpool_sleep, vp); + vplock = mtx_pool_find(unp_vp_mtxpool, vp); mtx_lock(vplock); VOP_UNP_CONNECT(vp, &unp); if (unp == NULL)