From nobody Sat Aug 20 09:45:10 2022 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 4M8tyZ6vjzz4Zq5X; Sat, 20 Aug 2022 09:45:10 +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 4M8tyZ6Slyz3xSg; Sat, 20 Aug 2022 09:45:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660988710; 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=R3cHPuTB0TOuBRNZXMI42FM6IGxK2g1bEtkcb4jhmS8=; b=PicHXqCmWvaEt/Puu0+YlRooRauI4NNIa8af+feiaqrzBghZZrn70ohAeLO+S0pGXMUm7h 3YTQW6V+juk9eePzqh1ELFtjFHUwjXrtpkabStM6felr6wKEONYVMcJw4bKfp7nSqNEMiT UZz7394HG1rxohX5vhlXVqfUbLSeJ45vmFSXieE/+hBvAlfUN0V6xvtlcHfWGpTkowmugk qr3+AmZgBFlMKiL9Nr7SY+9pj9t9ZqKduEqBs+/HUrewKXGJMz0ugzNZebFbVo61xJX3aH pa1vTHR06QJx9z9nSjoti//kRDg8LZxVa4sNkgbvmodeKJq5nvjRAPu+HaCbXg== 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 4M8tyZ5XxdzRY3; Sat, 20 Aug 2022 09:45:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27K9jAl7031669; Sat, 20 Aug 2022 09:45:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27K9jAeR031668; Sat, 20 Aug 2022 09:45:10 GMT (envelope-from git) Date: Sat, 20 Aug 2022 09:45:10 GMT Message-Id: <202208200945.27K9jAeR031668@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 497240def87c - main - Retire clone_drain_lock 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 497240def87cf93a6420ff4dd5396ae9ae569dfb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660988710; 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=R3cHPuTB0TOuBRNZXMI42FM6IGxK2g1bEtkcb4jhmS8=; b=JSBVptqVDzSjEs/JprXkmGsCzfR75wT0QsjU8axNBeGBTY3cDN3Rq/t61+XVRJMUci737+ PIuEzXb+uQV7zJwxKmS5Zepst1kahkHFkxDVRGVxvHcBb//17tYjsVo3hC0NMzwcG9BjVm gJfEG1UEUOEs2f116n/akncc/dZJ+QUHu8gs+moo9sKJDXHVShfSCh8ZDuZLiF8WaMF9es CdEl9MGmKei80xzsZf/1u2/Svhk8VpKhwQQGN1fPVf3opb28j5+vG0o7cMuMsxM8+dckgK 0wo3I0DgPVtAM4bm5XU9ytgSNXrqVN266o0EJLemvN9w1bEoqjTntVmjk4AR4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660988710; a=rsa-sha256; cv=none; b=g0v83OTec1i0IWZBlkkJCBQJnv5k5W6agfkAJZtkF5huBi34e2Yb+iOmoNwZ++i7GuYU9Z EV3pLOHGjv03FChhqFGXWZbs/rSXJ3oAiETYZvGi6MXq8cXGNfWdqV1g4fDyuDJWyZbweW e8L+ZFQmsSCBr9IQCjzl2AjS94dsxTkiFOURo9pts6PvIb6tD20dZNofHsdALNmgA45Eeh YGvPuFtRg5VIYU/7BE703iHIguK9KgdHrzmqpxh2JG53/bLXpD18/JC2hXXHtooVlSY1WQ LhqtlxpxYTRgBcCjfPJN40nrEqbDj41xtL7sUvn5kDIGwJKq1BFpO8sBokAUrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=497240def87cf93a6420ff4dd5396ae9ae569dfb commit 497240def87cf93a6420ff4dd5396ae9ae569dfb Author: Mateusz Guzik AuthorDate: 2022-08-19 21:20:51 +0000 Commit: Mateusz Guzik CommitDate: 2022-08-20 09:44:05 +0000 Retire clone_drain_lock It is only ever xlocked in drain_dev_clone_events and the only consumer of that routine does not need it -- eventhandler code already makes sure the relevant callback is no longer running. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D36268 --- sys/fs/devfs/devfs_int.h | 1 - sys/fs/devfs/devfs_vnops.c | 4 ---- sys/kern/kern_conf.c | 8 -------- sys/kern/tty_tty.c | 2 -- sys/net/if_tuntap.c | 1 - sys/sys/conf.h | 1 - 6 files changed, 17 deletions(-) diff --git a/sys/fs/devfs/devfs_int.h b/sys/fs/devfs/devfs_int.h index e5afa311cbfd..ddd3c82bac3a 100644 --- a/sys/fs/devfs/devfs_int.h +++ b/sys/fs/devfs/devfs_int.h @@ -91,7 +91,6 @@ int devfs_pathpath(const char *, const char *); extern struct unrhdr *devfs_inos; extern struct mtx devmtx; extern struct mtx devfs_de_interlock; -extern struct sx clone_drain_lock; extern struct mtx cdevpriv_mtx; extern TAILQ_HEAD(cdev_priv_list, cdev_priv) cdevp_list; diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 7b571a6821b7..13619d318cfc 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -85,8 +85,6 @@ static MALLOC_DEFINE(M_CDEVPDATA, "DEVFSP", "Metainfo for cdev-fp data"); struct mtx devfs_de_interlock; MTX_SYSINIT(devfs_de_interlock, &devfs_de_interlock, "devfs interlock", MTX_DEF); -struct sx clone_drain_lock; -SX_SYSINIT(clone_drain_lock, &clone_drain_lock, "clone events drain lock"); struct mtx cdevpriv_mtx; MTX_SYSINIT(cdevpriv_mtx, &cdevpriv_mtx, "cdevpriv lock", MTX_DEF); @@ -1102,10 +1100,8 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock) cdev = NULL; DEVFS_DMP_HOLD(dmp); sx_xunlock(&dmp->dm_lock); - sx_slock(&clone_drain_lock); EVENTHANDLER_INVOKE(dev_clone, td->td_ucred, pname, strlen(pname), &cdev); - sx_sunlock(&clone_drain_lock); if (cdev == NULL) sx_xlock(&dmp->dm_lock); diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 1cd5bc2635c1..374aafc91005 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -1523,14 +1523,6 @@ destroy_dev_drain(struct cdevsw *csw) dev_unlock(); } -void -drain_dev_clone_events(void) -{ - - sx_xlock(&clone_drain_lock); - sx_xunlock(&clone_drain_lock); -} - #include "opt_ddb.h" #ifdef DDB #include diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index c10dac907498..8490a4421f5f 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -68,9 +68,7 @@ ctty_clone(void *arg, struct ucred *cred, char *name, int namelen, if (strcmp(name, "tty")) return; p = curproc; - sx_sunlock(&clone_drain_lock); sx_slock(&proctree_lock); - sx_slock(&clone_drain_lock); dev_lock(); if (!(p->p_flag & P_CONTROLT)) *dev = ctty; diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c index bd9fc811d19f..5e1e60933caa 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -707,7 +707,6 @@ tun_uninit(const void *unused __unused) EVENTHANDLER_DEREGISTER(ifnet_arrival_event, arrival_tag); EVENTHANDLER_DEREGISTER(dev_clone, clone_tag); - drain_dev_clone_events(); mtx_lock(&tunmtx); while ((tp = TAILQ_FIRST(&tunhead)) != NULL) { diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 9f60dcaf62fa..ad6ffc31dc2a 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -279,7 +279,6 @@ void destroy_dev(struct cdev *_dev); int destroy_dev_sched(struct cdev *dev); int destroy_dev_sched_cb(struct cdev *dev, void (*cb)(void *), void *arg); void destroy_dev_drain(struct cdevsw *csw); -void drain_dev_clone_events(void); struct cdevsw *dev_refthread(struct cdev *_dev, int *_ref); struct cdevsw *devvn_refthread(struct vnode *vp, struct cdev **devp, int *_ref); void dev_relthread(struct cdev *_dev, int _ref);