From: Vitaliy Makkoveev Subject: Re: socket wait channels To: Claudio Jeker Cc: Alexander Bluhm , tech@openbsd.org Date: Thu, 25 Apr 2024 20:15:19 +0300 > On 25 Apr 2024, at 17:43, Claudio Jeker wrote: > > On Thu, Apr 25, 2024 at 03:58:32PM +0200, Alexander Bluhm wrote: >> Hi, >> >> Wait channel names should be unique for easier debugging. >> >> "netcon2" was copied from sys_connect() to sys_ypconnect(), better >> call it "ypcon". >> >> Calling the accept sleep "netcon" makes no sense. Better use >> "netacc" for accept(2) and "netcon" for connect(2). >> >> "netlck" for the socket buffer lock in bslock() can easily mixed >> with "netlock" for the global network lock. How about "sblock" for >> sblock()? > > Sounds good to me. I thought sblock was already used but that's sbwait. > So OK claudio@ > ok mvs. Unique names for connect/accept paths make sense. I intentionally introduced "sbwait" for unlocked sbwait(), but left well known original name for old sblock(). The per-buffers `sb_lock' rwlocks have unique names, so this renaming is not significant to me. >> ok? >> >> bluhm >> >> Index: kern/uipc_socket2.c >> =================================================================== >> RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_socket2.c,v >> diff -u -p -r1.149 uipc_socket2.c >> --- kern/uipc_socket2.c 11 Apr 2024 13:32:51 -0000 1.149 >> +++ kern/uipc_socket2.c 25 Apr 2024 13:45:23 -0000 >> @@ -559,7 +559,7 @@ sblock(struct socket *so, struct sockbuf >> while (sb->sb_flags & SB_LOCK) { >> sb->sb_flags |= SB_WANT; >> mtx_leave(&sb->sb_mtx); >> - error = sosleep_nsec(so, &sb->sb_flags, prio, "netlck", INFSLP); >> + error = sosleep_nsec(so, &sb->sb_flags, prio, "sblock", INFSLP); >> if (error) >> return (error); >> mtx_enter(&sb->sb_mtx); >> Index: kern/uipc_syscalls.c >> =================================================================== >> RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_syscalls.c,v >> diff -u -p -r1.218 uipc_syscalls.c >> --- kern/uipc_syscalls.c 1 Mar 2024 14:15:01 -0000 1.218 >> +++ kern/uipc_syscalls.c 25 Apr 2024 13:45:12 -0000 >> @@ -300,7 +300,7 @@ doaccept(struct proc *p, int sock, struc >> break; >> } >> error = sosleep_nsec(head, &head->so_timeo, PSOCK | PCATCH, >> - "netcon", INFSLP); >> + "netacc", INFSLP); >> if (error) >> goto out_unlock; >> } >> @@ -428,7 +428,7 @@ sys_connect(struct proc *p, void *v, reg >> } >> while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { >> error = sosleep_nsec(so, &so->so_timeo, PSOCK | PCATCH, >> - "netcon2", INFSLP); >> + "netcon", INFSLP); >> if (error) { >> if (error == EINTR || error == ERESTART) >> interrupted = 1; >> @@ -1651,7 +1651,7 @@ out: >> error = soconnect(so, nam); >> while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { >> error = sosleep_nsec(so, &so->so_timeo, PSOCK | PCATCH, >> - "netcon2", INFSLP); >> + "ypcon", INFSLP); >> if (error) >> break; >> } >> > > -- > :wq Claudio