Home | History | Annotate | Download | only in netbsd32
History log of /src/sys/compat/netbsd32/netbsd32_lwp.c
RevisionDateAuthorComments
 1.23  14-Jan-2021  simonb Handle rev 1.62 of kern/sys_lwp.c
make _lwp_park return the remaining time to sleep in the "ts" argument
if it is a relative timestamp, as discussed in tech-kern.
for compat32. Thanks skrll@ for some cleanup tips.
 1.22  29-Jan-2020  ad branches: 1.22.6;
- Track LWPs in a per-process radixtree. It uses no extra memory in the
single threaded case. Replace scans of p->p_lwps with lookups in the
tree. Find free LIDs for new LWPs in the tree. Replace the hashed sleep
queues for park/unpark with lookups in the tree under cover of a RW lock.

- lwp_wait(): if waiting on a specific LWP, find the LWP via tree lookup and
return EINVAL if it's detached, not ESRCH.

- Group the locks in struct proc at the end of the struct in their own cache
line.

- Add some comments.
 1.21  26-Jan-2020  ad Correction to previous: don't leak newuc if copyout() fails.
 1.20  25-Jan-2020  ad - Fix a race between the kernel and libpthread, where a new thread can start
life without its self->pt_lid being filled in.

- Fix an error path in _lwp_create(). If the new LID can't be copied out,
then get rid of the new LWP (i.e. either succeed or fail, not both).

- Mark l_dopreempt and l_nopreempt volatile in struct lwp.
 1.19  21-Apr-2017  christos branches: 1.19.12; 1.19.18;
- Propagate the signal mask from the ucontext_t to the newly created thread
as specified by _lwp_create(2)
- Reset the signal stack for threads created with _lwp_create(2)
 1.18  15-May-2015  matt branches: 1.18.2; 1.18.4;
Simplify a tiny bit.
 1.17  15-May-2015  matt In lwp_ctl, convert ptr to 32 bits before copyout.
 1.16  15-May-2015  matt Fix _lwp_ctl for big endian 64-bit platforms. (little-endian too but not
as noticable).
 1.15  29-Mar-2013  christos branches: 1.15.10; 1.15.12;
compat glue for new lwp_park
 1.14  20-Jul-2012  christos branches: 1.14.2;
always allocate a full ucontext structure so that we don't corrupt memory.
XXX: needs pullup to 6?
 1.13  21-May-2012  martin Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.
 1.12  05-Feb-2011  yamt branches: 1.12.4; 1.12.8; 1.12.10;
netbsd32__lwp_create: add a comment and CTASSERT.
 1.11  11-Jan-2009  christos branches: 1.11.6; 1.11.8; 1.11.10;
merge christos-time_t
 1.10  29-Apr-2008  martin branches: 1.10.8; 1.10.14;
Convert to new 2 clause license
 1.9  20-Dec-2007  dsl branches: 1.9.6; 1.9.8; 1.9.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.8  07-Dec-2007  ad branches: 1.8.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.
 1.7  10-Sep-2007  cube branches: 1.7.6; 1.7.8;
Some more licence clean up.
 1.6  07-Aug-2007  ad branches: 1.6.2;
- Fix a bug with _lwp_park() where if the computed wakeup time was under
1 microsecond into the future, the thread could enter an untimed sleep.
- Change the signature of _lwp_park() to accept an lwpid_t and second
hint pointer, but do so in a way that remains compatible with older
pthread libraries. This can be used to wake another thread before the
calling thread goes asleep, saving at least one syscall + involuntary
context switch. This turns out to be a fairly large win on the condvar
benchmarks that I have tried.
- Mark some more syscalls MP safe.
 1.5  03-Jun-2007  dsl branches: 1.5.2; 1.5.6;
Split sys__lwp_park() so that the compat/netbsd32 code can copyin and convert
its timeout then call the standard function.
 1.4  18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.3  16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.2  04-Mar-2007  christos branches: 1.2.2; 1.2.4; 1.2.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.1  18-Feb-2007  cube branches: 1.1.2; 1.1.6;
Add missing lwp syscalls. Put them all together into a new file,
netbsd32_lwp.c, and remove remaining traces of SA.

This still needs some MD (and possibly MI, depending on the chosen
solution) changes to actually work.
 1.1.6.4  24-Mar-2007  yamt sync with head.
 1.1.6.3  12-Mar-2007  rmind Sync with HEAD.
 1.1.6.2  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.1.6.1  18-Feb-2007  yamt file netbsd32_lwp.c was added on branch yamt-idlelwp on 2007-02-27 16:53:38 +0000
 1.1.2.5  21-Jan-2008  yamt sync with head
 1.1.2.4  27-Oct-2007  yamt sync with head.
 1.1.2.3  03-Sep-2007  yamt sync with head.
 1.1.2.2  26-Feb-2007  yamt sync with head.
 1.1.2.1  18-Feb-2007  yamt file netbsd32_lwp.c was added on branch yamt-lazymbuf on 2007-02-26 09:09:31 +0000
 1.2.6.3  09-Dec-2007  reinoud Pullup to HEAD
 1.2.6.2  29-Mar-2007  reinoud Pullup to -current
 1.2.6.1  18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.2.4.1  11-Jul-2007  mjf Sync with head.
 1.2.2.4  09-Oct-2007  ad Sync with head.
 1.2.2.3  20-Aug-2007  ad Sync with HEAD.
 1.2.2.2  09-Jun-2007  ad Sync with head.
 1.2.2.1  10-Apr-2007  ad Sync with head.
 1.5.6.3  09-Dec-2007  jmcneill Sync with HEAD.
 1.5.6.2  02-Oct-2007  joerg Sync with HEAD.
 1.5.6.1  09-Aug-2007  jmcneill Sync with HEAD.
 1.5.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.6.2.2  09-Jan-2008  matt sync with HEAD
 1.6.2.1  06-Nov-2007  matt sync with HEAD
 1.7.8.2  26-Dec-2007  ad Sync with head.
 1.7.8.1  08-Dec-2007  ad Sync with head.
 1.7.6.2  27-Dec-2007  mjf Sync with HEAD.
 1.7.6.1  08-Dec-2007  mjf Sync with HEAD.
 1.8.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.9.10.2  04-May-2009  yamt sync with head.
 1.9.10.1  16-May-2008  yamt sync with head.
 1.9.8.1  18-May-2008  yamt sync with head.
 1.9.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.9.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.10.14.2  04-Jan-2009  christos add new syscalls.
 1.10.14.1  29-Apr-2008  christos file netbsd32_lwp.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.10.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.11.10.1  08-Feb-2011  bouyer Sync with HEAD
 1.11.8.1  06-Jun-2011  jruoho Sync with HEAD.
 1.11.6.1  05-Mar-2011  rmind sync with head
 1.12.10.2  21-Jul-2012  riz Pull up following revision(s) (requested by christos in ticket #431):
sys/compat/netbsd32/netbsd32_lwp.c: revision 1.14
always allocate a full ucontext structure so that we don't corrupt memory.
XXX: needs pullup to 6?
 1.12.10.1  21-May-2012  riz Pull up following revision(s) (requested by martin in ticket #274):
sys/arch/amd64/amd64/process_machdep.c: revision 1.20
sys/kern/sys_lwp.c: revision 1.54
sys/arch/sparc64/sparc64/machdep.c: revision 1.267
sys/arch/mips/mips/cpu_subr.c: revision 1.16
sys/arch/vax/vax/machdep.c: revision 1.188
sys/sys/lwp.h: revision 1.161
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.98
sys/arch/alpha/alpha/machdep.c: revision 1.339
sys/compat/sys/ucontext.h: revision 1.6
sys/arch/hppa/hppa/hppa_machdep.c: revision 1.28
distrib/sets/lists/tests/mi: revision 1.469
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.42
tests/lib/libc/sys/t_lwp_create.c: revision 1.1
tests/lib/libc/sys/Makefile: revision 1.23
sys/arch/arm/arm/sig_machdep.c: revision 1.42
sys/arch/amd64/include/mcontext.h: revision 1.15
sys/arch/amd64/amd64/machdep.c: revision 1.183
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.99
sys/arch/i386/i386/machdep.c: revision 1.727
sys/compat/netbsd32/netbsd32_lwp.c: revision 1.13
sys/arch/sparc/sparc/machdep.c: revision 1.319
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.76
sys/arch/m68k/m68k/sig_machdep.c: revision 1.49
sys/sys/ucontext.h: revision 1.16
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.9
lib/libc/sys/_lwp_create.2: revision 1.5
Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.
To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.
Add an exhaustive atf test case, based partly on code from Joel Sing.
Should finally fix the remaining open part of PR kern/43903.
 1.12.8.1  02-Jun-2012  mrg sync to latest -current.
 1.12.4.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12.4.2  30-Oct-2012  yamt sync with head
 1.12.4.1  23-May-2012  yamt sync with head.
 1.14.2.2  03-Dec-2017  jdolecek update from HEAD
 1.14.2.1  23-Jun-2013  tls resync from head
 1.15.12.2  28-Aug-2017  skrll Sync with HEAD
 1.15.12.1  06-Jun-2015  skrll Sync with HEAD
 1.15.10.1  16-May-2015  martin Pull up the following revisions, requested by matt in ticket #776:

src/sys/compat/netbsd32/netbsd32_lwp.c 1.15-1.18

Fix _lwp_ctl for big endian 64-bit platforms. (Little-endian too but not
as noticable).
 1.18.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.18.2.1  26-Apr-2017  pgoyette Sync with HEAD
 1.19.18.2  29-Feb-2020  ad Sync with head.
 1.19.18.1  25-Jan-2020  ad Sync with head.
 1.19.12.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.22.6.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed