From nobody Thu Sep 28 22:28:16 2023 X-Original-To: dev-commits-src-branches@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 4RxSmd0Njhz4vhbj; Thu, 28 Sep 2023 22:28:17 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RxSmc628Tz3Qgj; Thu, 28 Sep 2023 22:28:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695940097; 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=cnt/Zt9hMDslVZ7okw1EgXqT6M8s5aoT4do6NhDu8cs=; b=gVa6kyk9gji6G9w/lq42X7SC9V6vcNWbipkjlQEyIAAfly3pnM1GsR4qyFmpgKHixC/LFa /UI2gI2OpdDEjq9JudX7Jx66fYb8c5kJv7elHkXEFOAU5AxGGBjSjzr2cioipbpMniph6A n/B3fHvkl6mOvkjaxqgGW3RwQ635bMznhIR0/noBAqcBteyYHox2Tn8R40UFPCLVJEZoC3 /bBAK4di1fLvXu++pCSVC1trKdIA+engfIIOotI23NKsC2tmZgT4v75K/uiK2elm4rj1rY /kf/TPQPhUVwgAjf5RlXCTpYzZLom1/7iOn/v6UcUGkvnaTIKZqA11qDeLqfhA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695940097; a=rsa-sha256; cv=none; b=XAglkmUMvCrShwEhT2pO8VX7ahwlv9dFdqQHqD3H7qGuLF28oymi50Gd/srGv2CiyZY4+N kTn0DoARNE1Atiqqfx4MEnorSWC+QUNSiitfRmBETtp6i0cmFv5A3ZJpAKlevj2/0bAH10 41c2cYaVEoRovxxPYDeIV4F9rA3S2lARY/a8wn+4tG5n2KgbUdAwX9P1aianGMWwO925kL VVFNmOe788J4kuSVz1UdCValBKMPjnxt10KYaSP9HnUfdTdXhmmpw6yOZJaVE0yLU/WzxW JDSpgDWYxz0U2UZxiXARyLwJdj9ahWr3uMF7SPVIzND4h9ct9tl2ejvNTsaixA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695940097; 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=cnt/Zt9hMDslVZ7okw1EgXqT6M8s5aoT4do6NhDu8cs=; b=V+eVpLsqUtgJ05eErSCz1wsZbTlHdQTm9sA14HyGPHCCF8F6dBJLVUQWkbABKo+WMei22J aBvPCiiDR1IDMZdEIvP1ch0x+t/rWoHNjIL8erPQ8kJ0ox5ZhZaCXVJnqphjIspb5/EVCQ K7VGgCPfo/gWkaubQp8WxnVJjY2DjThpkhJKkuI0qIrkP1Q25bDj647jdkfDGwTcT4J7ai xi8Qh8HHdil0QBICgo4APBk/eHWfvhTSPXQ+vyT0VRm/klp2YLP6sAz8VeCnmOIaO3Q82f TWhoZYtYqBa/a218iUFc+sjVWF8A0YEs+yg9xHxx/73fU4jXRX1WIbkbWRdtQQ== 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 4RxSmc55ZfzgF2; Thu, 28 Sep 2023 22:28:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38SMSGof074002; Thu, 28 Sep 2023 22:28:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38SMSGSc073999; Thu, 28 Sep 2023 22:28:16 GMT (envelope-from git) Date: Thu, 28 Sep 2023 22:28:16 GMT Message-Id: <202309282228.38SMSGSc073999@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d850e957e937 - releng/14.0 - timerfd: convert timerfd_list_lock from sx to mtx List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.0 X-Git-Reftype: branch X-Git-Commit: d850e957e9370ba068e8a05099f0fb6fa84f6b52 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d850e957e9370ba068e8a05099f0fb6fa84f6b52 commit d850e957e9370ba068e8a05099f0fb6fa84f6b52 Author: Mateusz Guzik AuthorDate: 2023-09-17 15:01:33 +0000 Commit: Warner Losh CommitDate: 2023-09-28 22:26:22 +0000 timerfd: convert timerfd_list_lock from sx to mtx There was no good reason to use the former. This should prevent some head-scratching by an interested and qualified reader. (cherry picked from commit f4296cfb409a48de00bfa60e76f686c2b031876f) (cherry picked from commit a87dddf39e866015341003eeac76d736d993514a) Approved-by: re (cperciva) --- sys/kern/sys_timerfd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c index c8b45a926b02..e4d2f10f28ef 100644 --- a/sys/kern/sys_timerfd.c +++ b/sys/kern/sys_timerfd.c @@ -61,9 +61,9 @@ static MALLOC_DEFINE(M_TIMERFD, "timerfd", "timerfd structures"); -static struct sx timerfd_list_lock; +static struct mtx timerfd_list_lock; static LIST_HEAD(, timerfd) timerfd_list; -SX_SYSINIT(timerfd, &timerfd_list_lock, "timerfd_list_lock"); +MTX_SYSINIT(timerfd, &timerfd_list_lock, "timerfd_list_lock", MTX_DEF); static struct unrhdr64 tfdino_unr; @@ -133,7 +133,7 @@ timerfd_jumped(void) return; timerfd_getboottime(&boottime); - sx_xlock(&timerfd_list_lock); + mtx_lock(&timerfd_list_lock); LIST_FOREACH(tfd, &timerfd_list, entry) { mtx_lock(&tfd->tfd_lock); if (tfd->tfd_clockid != CLOCK_REALTIME || @@ -169,7 +169,7 @@ timerfd_jumped(void) tfd->tfd_boottim = boottime; mtx_unlock(&tfd->tfd_lock); } - sx_xunlock(&timerfd_list_lock); + mtx_unlock(&timerfd_list_lock); } static int @@ -324,9 +324,9 @@ timerfd_close(struct file *fp, struct thread *td) { struct timerfd *tfd = fp->f_data; - sx_xlock(&timerfd_list_lock); + mtx_lock(&timerfd_list_lock); LIST_REMOVE(tfd, entry); - sx_xunlock(&timerfd_list_lock); + mtx_unlock(&timerfd_list_lock); callout_drain(&tfd->tfd_callout); seldrain(&tfd->tfd_sel); @@ -450,9 +450,9 @@ kern_timerfd_create(struct thread *td, int clockid, int flags) knlist_init_mtx(&tfd->tfd_sel.si_note, &tfd->tfd_lock); timerfd_getboottime(&tfd->tfd_boottim); getnanotime(&tfd->tfd_birthtim); - sx_xlock(&timerfd_list_lock); + mtx_lock(&timerfd_list_lock); LIST_INSERT_HEAD(&timerfd_list, tfd, entry); - sx_xunlock(&timerfd_list_lock); + mtx_unlock(&timerfd_list_lock); finit(fp, fflags, DTYPE_TIMERFD, tfd, &timerfdops);