From: visa Date: Tue, 5 Jul 2022 15:06:16 +0000 (+0000) Subject: Remove old poll/select wakeup mechanism. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d164f4a185c506513bb1b11c962ecc4a88b49cb3;p=openbsd Remove old poll/select wakeup mechanism. Also remove unneeded seltrue() and selfalse(). OK mpi@ jsg@ --- diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index 7328d30fd73..d70cb4db6ce 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ps.1,v 1.125 2022/03/31 17:27:14 naddy Exp $ +.\" $OpenBSD: ps.1,v 1.126 2022/07/05 15:06:16 visa Exp $ .\" $NetBSD: ps.1,v 1.16 1996/03/21 01:36:28 jtc Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993, 1994 @@ -30,7 +30,7 @@ .\" .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" -.Dd $Mdocdate: March 31 2022 $ +.Dd $Mdocdate: July 5 2022 $ .Dt PS 1 .Os .Sh NAME @@ -222,7 +222,6 @@ P_PROFPEND 0x2 this thread needs SIGPROF P_ALRMPEND 0x4 this thread needs SIGVTALRM P_SIGSUSPEND 0x8 need to restore before-suspend mask P_CANTSLEEP 0x10 this thread is not permitted to sleep -P_SELECT 0x40 selecting; wakeup/waiting danger P_SINTR 0x80 sleep is interruptible P_SYSTEM 0x200 system process: no sigs, stats, or swapping diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 4bbbe38b5d1..4a3afb10399 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.146 2022/07/02 08:50:42 visa Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.147 2022/07/05 15:06:16 visa Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -1441,7 +1441,7 @@ wsdisplaystart(struct tty *tp) splx(s); return; } - if (tp->t_outq.c_cc == 0 && tp->t_wsel.si_seltid == 0) + if (tp->t_outq.c_cc == 0) goto low; if ((scr = sc->sc_scr[WSDISPLAYSCREEN(tp->t_dev)]) == NULL) { diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 326265d56f2..f9d1f04a845 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.402 2022/03/21 09:12:34 bluhm Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.403 2022/07/05 15:06:16 visa Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -120,7 +120,7 @@ extern struct forkstat forkstat; extern struct nchstats nchstats; -extern int nselcoll, fscale; +extern int fscale; extern fixpt_t ccpu; extern long numvnodes; extern int allowdt; @@ -298,7 +298,7 @@ const struct sysctl_bounded_args kern_vars[] = { {KERN_NFILES, &numfiles, SYSCTL_INT_READONLY}, {KERN_TTYCOUNT, &tty_count, SYSCTL_INT_READONLY}, {KERN_ARGMAX, &arg_max, SYSCTL_INT_READONLY}, - {KERN_NSELCOLL, &nselcoll, SYSCTL_INT_READONLY}, + {KERN_NSELCOLL, &int_zero, SYSCTL_INT_READONLY}, {KERN_POSIX1, &posix_version, SYSCTL_INT_READONLY}, {KERN_NGROUPS, &ngroups_max, SYSCTL_INT_READONLY}, {KERN_JOB_CONTROL, &int_one, SYSCTL_INT_READONLY}, diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index d65ab2d3ff6..3beaac8f82a 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.147 2022/02/08 08:56:41 visa Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.148 2022/07/05 15:06:16 visa Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -89,7 +89,6 @@ int dopselect(struct proc *, int, fd_set *, fd_set *, fd_set *, struct timespec *, const sigset_t *, register_t *); int doppoll(struct proc *, struct pollfd *, u_int, struct timespec *, const sigset_t *, register_t *); -void doselwakeup(struct selinfo *); int iovec_copyin(const struct iovec *uiov, struct iovec **iovp, struct iovec *aiov, @@ -522,8 +521,6 @@ out: return (error); } -int selwait, nselcoll; - /* * Select system call. */ @@ -840,41 +837,6 @@ pselcollect(struct proc *p, struct kevent *kevp, fd_set *pobits[3], return (0); } -int -seltrue(dev_t dev, int events, struct proc *p) -{ - - return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); -} - -int -selfalse(dev_t dev, int events, struct proc *p) -{ - - return (0); -} - -/* - * Record a select request. - */ -void -selrecord(struct proc *selector, struct selinfo *sip) -{ - struct proc *p; - pid_t mytid; - - KERNEL_ASSERT_LOCKED(); - - mytid = selector->p_tid; - if (sip->si_seltid == mytid) - return; - if (sip->si_seltid && (p = tfind(sip->si_seltid)) && - p->p_wchan == (caddr_t)&selwait) - sip->si_flags |= SI_COLL; - else - sip->si_seltid = mytid; -} - /* * Do a wakeup when a selectable event occurs. */ @@ -883,34 +845,9 @@ selwakeup(struct selinfo *sip) { KERNEL_LOCK(); KNOTE(&sip->si_note, NOTE_SUBMIT); - doselwakeup(sip); KERNEL_UNLOCK(); } -void -doselwakeup(struct selinfo *sip) -{ - struct proc *p; - - KERNEL_ASSERT_LOCKED(); - - if (sip->si_seltid == 0) - return; - if (sip->si_flags & SI_COLL) { - nselcoll++; - sip->si_flags &= ~SI_COLL; - wakeup(&selwait); - } - p = tfind(sip->si_seltid); - sip->si_seltid = 0; - if (p != NULL) { - if (wakeup_proc(p, &selwait)) { - /* nothing else to do */ - } else if (p->p_flag & P_SELECT) - atomic_clearbits_int(&p->p_flag, P_SELECT); - } -} - /* * Only copyout the revents field. */ diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 5f7479532b4..091fb0895cc 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.217 2022/07/02 08:50:42 visa Exp $ */ +/* $OpenBSD: bpf.c,v 1.218 2022/07/05 15:06:16 visa Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -588,11 +588,11 @@ bpf_wakeup(struct bpf_d *d) KNOTE(&d->bd_sel.si_note, 0); /* - * As long as pgsigio() and selwakeup() need to be protected + * As long as pgsigio() needs to be protected * by the KERNEL_LOCK() we have to delay the wakeup to * another context to keep the hot path KERNEL_LOCK()-free. */ - if ((d->bd_async && d->bd_sig) || d->bd_sel.si_seltid != 0) { + if (d->bd_async && d->bd_sig) { bpf_get(d); if (!task_add(systq, &d->bd_wake_task)) bpf_put(d); @@ -607,9 +607,6 @@ bpf_wakeup_cb(void *xd) if (d->bd_async && d->bd_sig) pgsigio(&d->bd_sigio, d->bd_sig, 0); - mtx_enter(&d->bd_mtx); - selwakeup(&d->bd_sel); - mtx_leave(&d->bd_mtx); bpf_put(d); } @@ -1192,9 +1189,6 @@ filt_bpfread(struct knote *kn, long hint) { struct bpf_d *d = kn->kn_hook; - if (hint == NOTE_SUBMIT) /* ignore activation from selwakeup */ - return (0); - MUTEX_ASSERT_LOCKED(&d->bd_mtx); kn->kn_data = d->bd_hlen; diff --git a/sys/sys/proc.h b/sys/sys/proc.h index c5e9a228f21..ec2fd803476 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.332 2022/06/29 12:17:31 jca Exp $ */ +/* $OpenBSD: proc.h,v 1.333 2022/07/05 15:06:16 visa Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -409,7 +409,6 @@ struct proc { #define P_ALRMPEND 0x00000004 /* SIGVTALRM needs to be posted */ #define P_SIGSUSPEND 0x00000008 /* Need to restore before-suspend mask*/ #define P_CANTSLEEP 0x00000010 /* insomniac thread */ -#define P_SELECT 0x00000040 /* Selecting; wakeup/waiting danger. */ #define P_SINTR 0x00000080 /* Sleep is interruptible. */ #define P_SYSTEM 0x00000200 /* No sigs, stats or swapping. */ #define P_TIMEOUT 0x00000400 /* Timing out during sleep. */ @@ -424,7 +423,7 @@ struct proc { #define P_BITS \ ("\20" "\01INKTR" "\02PROFPEND" "\03ALRMPEND" "\04SIGSUSPEND" \ - "\05CANTSLEEP" "\07SELECT" "\010SINTR" "\012SYSTEM" "\013TIMEOUT" \ + "\05CANTSLEEP" "\010SINTR" "\012SYSTEM" "\013TIMEOUT" \ "\016WEXIT" "\020OWEUPC" "\024SUSPSINGLE" "\027XX" \ "\030CONTINUED" "\033THREAD" "\034SUSPSIG" "\035SOFTDEP" "\037CPUPEG") diff --git a/sys/sys/selinfo.h b/sys/sys/selinfo.h index 1d9431b3988..cd5342cc504 100644 --- a/sys/sys/selinfo.h +++ b/sys/sys/selinfo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: selinfo.h,v 1.5 2017/07/18 19:20:26 sf Exp $ */ +/* $OpenBSD: selinfo.h,v 1.6 2022/07/05 15:06:16 visa Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -42,15 +42,9 @@ */ struct selinfo { struct klist si_note; /* kernel note list */ - pid_t si_seltid; /* thread to be notified */ - short si_flags; /* see below */ }; -#define SI_COLL 0x0001 /* collision occurred */ #ifdef _KERNEL -struct proc; - -void selrecord(struct proc *selector, struct selinfo *); void selwakeup(struct selinfo *); #endif diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 6124c6ce2cc..7afec86714b 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.155 2021/12/09 00:26:10 guenther Exp $ */ +/* $OpenBSD: systm.h,v 1.156 2022/07/05 15:06:16 visa Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -91,7 +91,6 @@ extern int ncpusfound; /* number of CPUs found */ extern int nblkdev; /* number of entries in bdevsw */ extern int nchrdev; /* number of entries in cdevsw */ -extern int selwait; /* select timeout address */ extern int maxmem; /* max memory per process */ extern int physmem; /* physical memory */ @@ -151,8 +150,6 @@ int enoioctl(void); int enxio(void); int eopnotsupp(void *); -int seltrue(dev_t dev, int which, struct proc *); -int selfalse(dev_t dev, int which, struct proc *); void *hashinit(int, int, int, u_long *); void hashfree(void *, int, int); int sys_nosys(struct proc *, void *, register_t *);