The NetBSD Project

CVS log for src/sys/sys/lwp.h

[BACK] Up to [cvs.NetBSD.org] / src / sys / sys

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.217 / (download) - annotate - [select for diffs], Sat Jul 23 19:15:29 2022 UTC (6 months, 2 weeks ago) by mrg
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, bouyer-sunxi-drm-base, bouyer-sunxi-drm, HEAD
Changes since 1.216: +2 -1 lines
Diff to previous 1.216 (colored)

make MAXLWP a real option that triggers rebuilds properly.

Revision 1.216 / (download) - annotate - [select for diffs], Sat May 7 19:44:40 2022 UTC (9 months ago) by mrg
Branch: MAIN
Changes since 1.215: +4 -4 lines
Diff to previous 1.215 (colored)

bump maxthreads default.

bump the default MAXLWP to 4096 from 2048, and adjust the default
limits seen to be 2048 cur / 4096 max.  remove the linkage to
maxuprc entirely.

remove cpu_maxlwp() that isn't implemented anywhere.  instead,
grow the maxlwp for larger memory systems, picking 1 lwp per 1MiB
of ram, limited to 65535 like the system limit.

remove some magic numbers.


i've been having weird firefox issues for a few months now and
it turns out i was having pthread_create() failures and since
bumping the defaults i've had none of the recent issues.

Revision 1.215 / (download) - annotate - [select for diffs], Sat Apr 9 23:45:37 2022 UTC (10 months ago) by riastradh
Branch: MAIN
Changes since 1.214: +5 -4 lines
Diff to previous 1.214 (colored)

kern: Handle l_mutex with atomic_store_release, atomic_load_consume.

- Where the lock is held and known to be correct, no atomic.
- In loops to acquire the lock, use atomic_load_relaxed before we
  restart with atomic_load_consume.

Nix membar_exit.

(Who knows, using atomic_load_consume here might fix bugs on Alpha!)

Revision 1.214 / (download) - annotate - [select for diffs], Sat Apr 9 13:38:15 2022 UTC (10 months ago) by riastradh
Branch: MAIN
Changes since 1.213: +3 -3 lines
Diff to previous 1.213 (colored)

sys/lwp.h: Nix trailing whitespace.

Revision 1.213 / (download) - annotate - [select for diffs], Sun Feb 27 01:03:14 2022 UTC (11 months, 1 week ago) by gutteridge
Branch: MAIN
Changes since 1.212: +2 -2 lines
Diff to previous 1.212 (colored)

lwp.h: correct grammar in a comment

Revision 1.212.14.1 / (download) - annotate - [select for diffs], Thu Aug 5 23:14:21 2021 UTC (18 months ago) by thorpej
Branch: thorpej-futex2
Changes since 1.212: +15 -3 lines
Diff to previous 1.212 (colored) next main 1.213 (colored)

Bring over just the futex sleepq infrastructure changes from thorpej-futex
to a new branch based on current HEAD.  This contains only the fixes for
the priority problems, and is intended to finish debugging those changes
(without the new extensions).

Revision 1.212.2.1 / (download) - annotate - [select for diffs], Sun Nov 1 15:16:43 2020 UTC (2 years, 3 months ago) by thorpej
Branch: thorpej-futex
Changes since 1.212: +15 -3 lines
Diff to previous 1.212 (colored) next main 1.213 (colored)

Major overfaul of futex implemention:
- Use sleepqs directly, rather than using condition variables and
  separate wait queues / strutures.  By doing this, and using the
  standard mechanism for keeping sleepqs sorted by priority, we
  acn ensure that the highest priority waiters will be awakened,
  rather than naively awakening in FIFO order.
- As part of the data structure re-organization, struct lwp gains
  "l_futex" (the futex an LWP is blocked on) and "l_futex_wakesel"
  (the futex wake selector bitset) fields (and loses l___rsvd1).
  Plese note the special locking considerations for these fields
  documented in the comments.
- Add the notion of a "futex class".  This is prep work for eventually
  supporting the FUTEX_*_PI operations, as well as some future NetBSD
  extensions to the futex interface.
- Add a preliminary implementation of the first of those NetBSD extensions,
  FUTEX_NETBSD_RW_WAIT and FUTEX_NETBSD_RW_HANDOFF.  These are designed
  to implement reader/writer locks with direct-handoff to the correct
  priority thread(s) (real-time read-waiters need to have priority over
  non-real-time write-waiters).  NOTE: this is currently disabled due to
  a mysterious panic that haasn't yet been tracked down.
- Add some SDT probes to aid in debugging.

Revision 1.212 / (download) - annotate - [select for diffs], Fri Oct 23 00:25:45 2020 UTC (2 years, 3 months ago) by thorpej
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex-base, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Branch point for: thorpej-futex2, thorpej-futex
Changes since 1.211: +2 -1 lines
Diff to previous 1.211 (colored)

- sleepq_block(): Add a new LWP flag, LW_CATCHINTR, that is used to track
  the intent to catch signals while sleeping.  Initialize this flag based
  on the catch_p argument to sleepq_block(), and rather than test catch_p
  when awakened, test LW_CATCHINTR.  This allows the intent to change
  (based on whatever criteria the owner of the sleepq wishes) while the
  LWP is asleep.  This is separate from LW_SINTR in order to leave all
  other logic around LW_SINTR unaffected.
- In sleepq_transfer(), adjust also LW_CATCHINTR based on the catch_p
  argument.  Also allow the new LWP lock argument to be NULL, which
  will cause the lwp_setlock() call to be skipped; this allows transfer
  to another sleepq that is known to be protected by the same lock.
- Add a new function, sleepq_uncatch(), that will transition an LWP
  from "interruptible sleep" to "uninterruptible sleep" on its current
  sleepq.

Revision 1.211 / (download) - annotate - [select for diffs], Sat Aug 1 02:04:55 2020 UTC (2 years, 6 months ago) by riastradh
Branch: MAIN
Changes since 1.210: +2 -1 lines
Diff to previous 1.210 (colored)

New functions kthread_fpu_enter/exit.

The MI definitions don't do anything but maintain a flag, but MD code
can define kthread_fpu_enter/exit_md to actually enable/disable the
FPU.  (These are almost pcu_load/discard on systems that use pcu(9),
except they apply to all PCUs.)

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2020/06/20/msg026524.html

The proposed kthread flag KTHREAD_FPU is not included because I
couldn't find any particular need for it that would not be covered by
just calling kthread_fpu_enter/exit in the kthread function.

Revision 1.210 / (download) - annotate - [select for diffs], Sat May 23 20:45:11 2020 UTC (2 years, 8 months ago) by ad
Branch: MAIN
Changes since 1.209: +10 -7 lines
Diff to previous 1.209 (colored)

- Replace pid_table_lock with a lockless lookup covered by pserialize, with
  the "writer" side being pid_table expansion.  The basic idea is that when
  doing an LWP lookup there is usually already a lock held (p->p_lock), or a
  spin mutex that needs to be taken (l->l_mutex), and either can be used to
  get the found LWP stable and confidently determine that all is correct.

- For user processes LSLARVAL implies the same thing as LSIDL ("not visible
  by ID"), and lookup by ID in proc0 doesn't really happen.  In-tree the new
  state should be understood by top(1), the tty subsystem and so on, and
  would attract the attention of 3rd party kernel grovellers in time, so
  remove it and just rely on LSIDL.

Revision 1.209 / (download) - annotate - [select for diffs], Wed Apr 29 01:52:26 2020 UTC (2 years, 9 months ago) by thorpej
Branch: MAIN
Changes since 1.208: +1 -2 lines
Diff to previous 1.208 (colored)

- proc_find() retains traditional semantics of requiring the canonical
  PID to look up a proc.  Add a separate proc_find_lwpid() to look up a
  proc by the ID of any of its LWPs.
- Add proc_find_lwp_acquire_proc(), which enables looking up the LWP
  *and* a proc given the ID of any LWP.  Returns with the proc::p_lock
  held.
- Rewrite lwp_find2() in terms of proc_find_lwp_acquire_proc(), and add
  allow the proc to be wildcarded, rather than just curproc or specific
  proc.
- lwp_find2() now subsumes the original intent of lwp_getref_lwpid(), but
  in a much nicer way, so garbage-collect the remnants of that recently
  added mechanism.

Revision 1.208 / (download) - annotate - [select for diffs], Sun Apr 26 18:53:33 2020 UTC (2 years, 9 months ago) by thorpej
Branch: MAIN
Changes since 1.207: +2 -2 lines
Diff to previous 1.207 (colored)

Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.

Revision 1.205.2.2 / (download) - annotate - [select for diffs], Sat Apr 25 11:24:07 2020 UTC (2 years, 9 months ago) by bouyer
Branch: bouyer-xenpvh
Changes since 1.205.2.1: +7 -22 lines
Diff to previous 1.205.2.1 (colored) to branchpoint 1.205 (colored) next main 1.206 (colored)

Sync with bouyer-xenpvh-base2 (HEAD)

Revision 1.207 / (download) - annotate - [select for diffs], Fri Apr 24 03:22:06 2020 UTC (2 years, 9 months ago) by thorpej
Branch: MAIN
CVS Tags: bouyer-xenpvh-base2
Changes since 1.206: +7 -22 lines
Diff to previous 1.206 (colored)

Overhaul the way LWP IDs are allocated.  Instead of each LWP having it's
own LWP ID space, LWP IDs came from the same number space as PIDs.  The
lead LWP of a process gets the PID as its LID.  If a multi-LWP process's
lead LWP exits, the PID persists for the process.

In addition to providing system-wide unique thread IDs, this also lets us
eliminate the per-process LWP radix tree, and some associated locks.

Remove the separate "global thread ID" map added previously; it is no longer
needed to provide this functionality.

Nudged in this direction by ad@ and chs@.

Revision 1.205.2.1 / (download) - annotate - [select for diffs], Mon Apr 20 11:29:13 2020 UTC (2 years, 9 months ago) by bouyer
Branch: bouyer-xenpvh
Changes since 1.205: +2 -2 lines
Diff to previous 1.205 (colored)

Sync with HEAD

Revision 1.179.2.2 / (download) - annotate - [select for diffs], Mon Apr 13 08:05:20 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.179.2.1: +81 -35 lines
Diff to previous 1.179.2.1 (colored) to branchpoint 1.179 (colored) next main 1.180 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.206 / (download) - annotate - [select for diffs], Fri Apr 10 17:16:21 2020 UTC (2 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, bouyer-xenpvh-base1
Changes since 1.205: +2 -2 lines
Diff to previous 1.205 (colored)

- Make this needed sequence always work for condvars, by not touching the CV
  again after wakeup.  Previously it could panic because cv_signal() could
  be called by cv_wait_sig() + others:

	cv_broadcast(cv);
	cv_destroy(cv);

- In support of the above, if an LWP doing a timed wait is awoken by
  cv_broadcast() or cv_signal(), don't return an error if the timer
  fires after the fact, i.e. either succeed or fail, not both.

- Remove LOCKDEBUG code for CVs which never worked properly and is of
  questionable use.

Revision 1.205 / (download) - annotate - [select for diffs], Sat Apr 4 20:20:12 2020 UTC (2 years, 10 months ago) by thorpej
Branch: MAIN
CVS Tags: phil-wifi-20200406, bouyer-xenpvh-base
Branch point for: bouyer-xenpvh
Changes since 1.204: +25 -2 lines
Diff to previous 1.204 (colored)

Add support for lazily generating a "global thread ID" for a LWP.  This
identifier uniquely identifies an LWP across the entire system, and will
be used in future improvements in user-space synchronization primitives.

(Test disabled and libc stub not included intentionally so as to avoid
multiple libc version bumps.)

Revision 1.204 / (download) - annotate - [select for diffs], Sat Apr 4 06:51:46 2020 UTC (2 years, 10 months ago) by maxv
Branch: MAIN
Changes since 1.203: +5 -1 lines
Diff to previous 1.203 (colored)

Drop specificdata from KCOV, kMSan doesn't interact well with it. Also
reduces the overhead.

Revision 1.203 / (download) - annotate - [select for diffs], Thu Mar 26 19:46:42 2020 UTC (2 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.202: +2 -2 lines
Diff to previous 1.202 (colored)

Change sleepq_t from a TAILQ to a LIST and remove SOBJ_SLEEPQ_FIFO.  Only
select/poll used the FIFO method and that was for collisions which rarely
occur.  Shrinks sleep_t and condvar_t.

Revision 1.192.2.5 / (download) - annotate - [select for diffs], Sat Feb 29 20:21:10 2020 UTC (2 years, 11 months ago) by ad
Branch: ad-namecache
Changes since 1.192.2.4: +20 -9 lines
Diff to previous 1.192.2.4 (colored) to branchpoint 1.192 (colored) next main 1.193 (colored)

Sync with head.

Revision 1.202 / (download) - annotate - [select for diffs], Sat Feb 15 18:12:15 2020 UTC (2 years, 11 months ago) by ad
Branch: MAIN
CVS Tags: is-mlppp-base, is-mlppp, ad-namecache-base3
Changes since 1.201: +16 -5 lines
Diff to previous 1.201 (colored)

- Move the LW_RUNNING flag back into l_pflag: updating l_flag without lock
  in softint_dispatch() is risky.  May help with the "softint screwup"
  panic.

- Correct the memory barriers around zombies switching into oblivion.

Revision 1.201 / (download) - annotate - [select for diffs], Sat Feb 15 17:13:55 2020 UTC (2 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.200: +2 -1 lines
Diff to previous 1.200 (colored)

PR kern/54922: 9.99.45@20200202 panic: diagnostic assertion linux ldconfig triggers vpp != NULL in exit1()->radixtree.c line 674

Create an lwp_renumber() from the code in emulexec() and use in
linux_e_proc_exec() and linux_e_proc_fork() too.

Revision 1.200 / (download) - annotate - [select for diffs], Wed Jan 29 15:47:52 2020 UTC (3 years ago) by ad
Branch: MAIN
Changes since 1.199: +3 -4 lines
Diff to previous 1.199 (colored)

- 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.

Revision 1.199 / (download) - annotate - [select for diffs], Tue Jan 28 16:40:27 2020 UTC (3 years ago) by ad
Branch: MAIN
Changes since 1.198: +2 -2 lines
Diff to previous 1.198 (colored)

Put pri_t back to an int.  It looks like there might be a sign extension
issue somewhere but it's not worth the hassle trying to find it.

Revision 1.192.2.4 / (download) - annotate - [select for diffs], Sat Jan 25 22:38:53 2020 UTC (3 years ago) by ad
Branch: ad-namecache
Changes since 1.192.2.3: +6 -5 lines
Diff to previous 1.192.2.3 (colored) to branchpoint 1.192 (colored)

Sync with head.

Revision 1.198 / (download) - annotate - [select for diffs], Sat Jan 25 15:41:52 2020 UTC (3 years ago) by ad
Branch: MAIN
CVS Tags: ad-namecache-base2
Changes since 1.197: +5 -5 lines
Diff to previous 1.197 (colored)

- 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.

Revision 1.192.2.3 / (download) - annotate - [select for diffs], Wed Jan 22 11:40:17 2020 UTC (3 years ago) by ad
Branch: ad-namecache
Changes since 1.192.2.2: +1 -2 lines
Diff to previous 1.192.2.2 (colored) to branchpoint 1.192 (colored)

Back out previous.

Revision 1.197 / (download) - annotate - [select for diffs], Tue Jan 21 20:31:57 2020 UTC (3 years ago) by ad
Branch: MAIN
Changes since 1.196: +2 -1 lines
Diff to previous 1.196 (colored)

ddb's "show all locks":

- Make the output easier to scan quickly.

- Show every LWP that is blocked on a lock, and the details of the lock.

Revision 1.192.2.2 / (download) - annotate - [select for diffs], Sun Jan 19 21:08:30 2020 UTC (3 years ago) by ad
Branch: ad-namecache
Changes since 1.192.2.1: +2 -1 lines
Diff to previous 1.192.2.1 (colored) to branchpoint 1.192 (colored)

Adaptive rwlocks proposed on tech-kern and working well on this branch
with vnode locks.

Revision 1.192.2.1 / (download) - annotate - [select for diffs], Fri Jan 17 21:47:37 2020 UTC (3 years ago) by ad
Branch: ad-namecache
Changes since 1.192: +16 -19 lines
Diff to previous 1.192 (colored)

Sync with head.

Revision 1.196 / (download) - annotate - [select for diffs], Sun Jan 12 22:03:23 2020 UTC (3 years ago) by ad
Branch: MAIN
CVS Tags: ad-namecache-base1
Changes since 1.195: +2 -1 lines
Diff to previous 1.195 (colored)

A final set of scheduler tweaks:

- Try hard to keep vfork() parent and child on the same CPU until execve(),
  failing that on the same core, but in all other cases scatter new LWPs
  among the different CPU packages, round robin, to try and get the best out
  of the available cache and bus bandwidth.

- Remove attempts at balancing.  Replace with a rate-limited skim of other
  CPU's run queues in sched_idle(), starting in the current package and
  moving outwards.  Add a sysctl tunable to change the interval.

- Make the cacheht_time tuneable take a milliseconds value.

- It's possible to configure things such that there's no CPU allowed to run
  an LWP.  Defeat this by always having a default:

Reported-by: syzbot+46968944dd9359ab93bc@syzkaller.appspotmail.com
Reported-by: syzbot+7f750a4cc230d1e831f9@syzkaller.appspotmail.com
Reported-by: syzbot+88d7675158f5cb4684db@syzkaller.appspotmail.com
Reported-by: syzbot+d409c2338150e9a8ae1e@syzkaller.appspotmail.com
Reported-by: syzbot+e152dc5bff188f67358a@syzkaller.appspotmail.com

Revision 1.195 / (download) - annotate - [select for diffs], Sun Jan 12 21:40:44 2020 UTC (3 years ago) by ad
Branch: MAIN
Changes since 1.194: +2 -2 lines
Diff to previous 1.194 (colored)

Make pri_t a short and get back some more space in struct lwp.

Revision 1.194 / (download) - annotate - [select for diffs], Sun Jan 12 18:37:10 2020 UTC (3 years ago) by ad
Branch: MAIN
Changes since 1.193: +13 -15 lines
Diff to previous 1.193 (colored)

- Shuffle some items around in struct lwp to save space.  Remove an unused
  item or two.

- For lockstat, get a useful callsite for vnode locks (caller to vn_lock()).

Revision 1.193 / (download) - annotate - [select for diffs], Wed Jan 8 17:38:43 2020 UTC (3 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.192: +2 -4 lines
Diff to previous 1.192 (colored)

Hopefully fix some problems seen with MP support on non-x86, in particular
where curcpu() is defined as curlwp->l_cpu:

- mi_switch(): undo the ~2007ish optimisation to unlock curlwp before
  calling cpu_switchto().  It's not safe to let other actors mess with the
  LWP (in particular l->l_cpu) while it's still context switching.  This
  removes l->l_ctxswtch.

- Move the LP_RUNNING flag into l->l_flag and rename to LW_RUNNING since
  it's now covered by the LWP's lock.

- Ditch lwp_exit_switchaway() and just call mi_switch() instead.  Everything
  is in cache anyway so it wasn't buying much by trying to avoid saving old
  state.  This means cpu_switchto() will never be called with prevlwp ==
  NULL.

- Remove some KERNEL_LOCK handling which hasn't been needed for years.

Revision 1.192 / (download) - annotate - [select for diffs], Sun Dec 1 15:34:47 2019 UTC (3 years, 2 months ago) by ad
Branch: MAIN
CVS Tags: ad-namecache-base
Branch point for: ad-namecache
Changes since 1.191: +2 -2 lines
Diff to previous 1.191 (colored)

Fix false sharing problems with cpu_info.  Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
  the IPI bitmask and ci_want_resched.

Revision 1.191 / (download) - annotate - [select for diffs], Sat Nov 30 17:45:54 2019 UTC (3 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.190: +3 -3 lines
Diff to previous 1.190 (colored)

Mark the context switch counters volatile (because preemption).

Revision 1.190 / (download) - annotate - [select for diffs], Sat Nov 23 19:42:52 2019 UTC (3 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.189: +3 -2 lines
Diff to previous 1.189 (colored)

Minor scheduler cleanup:

- Adapt to cpu_need_resched() changes. Avoid lost & duplicate IPIs and ASTs.
  sched_resched_cpu() and sched_resched_lwp() contain the logic for this.
- Changes for LSIDL to make the locking scheme match the intended design.
- Reduce lock contention and false sharing further.
- Numerous small bugfixes, including some corrections for SCHED_FIFO/RT.
- Use setrunnable() in more places, and merge cut & pasted code.

Revision 1.189 / (download) - annotate - [select for diffs], Thu Nov 21 19:47:21 2019 UTC (3 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.188: +2 -2 lines
Diff to previous 1.188 (colored)

lwp_setlock(): return pointer to the kmutex_t that we replaced

Revision 1.188 / (download) - annotate - [select for diffs], Thu Nov 14 16:23:53 2019 UTC (3 years, 2 months ago) by maxv
Branch: MAIN
CVS Tags: phil-wifi-20191119
Changes since 1.187: +8 -1 lines
Diff to previous 1.187 (colored)

Add support for Kernel Memory Sanitizer (kMSan). It detects uninitialized
memory used by the kernel at run time, and just like kASan and kCSan, it
is an excellent feature. It has already detected 38 uninitialized variables
in the kernel during my testing, which I have since discreetly fixed.

We use two shadows:
 - "shad", to track uninitialized memory with a bit granularity (1:1).
   Each bit set to 1 in the shad corresponds to one uninitialized bit of
   real kernel memory.
 - "orig", to track the origin of the memory with a 4-byte granularity
   (1:1). Each uint32_t cell in the orig indicates the origin of the
   associated uint32_t of real kernel memory.

The memory consumption of these shadows is consequent, so at least 4GB of
RAM is recommended to run kMSan.

The compiler inserts calls to specific __msan_* functions on each memory
access, to manage both the shad and the orig and detect uninitialized
memory accesses that change the execution flow (like an "if" on an
uninitialized variable).

We mark as uninit several types of memory buffers (stack, pools, kmem,
malloc, uvm_km), and check each buffer passed to copyout, copyoutstr,
bwrite, if_transmit_lock and DMA operations, to detect uninitialized memory
that leaves the system. This allows us to detect kernel info leaks in a way
that is more efficient and also more user-friendly than KLEAK.

Contrary to kASan, kMSan requires comprehensive coverage, ie we cannot
tolerate having one non-instrumented function, because this could cause
false positives. kMSan cannot instrument ASM functions, so I converted
most of them to __asm__ inlines, which kMSan is able to instrument. Those
that remain receive special treatment.

Contrary to kASan again, kMSan uses a TLS, so we must context-switch this
TLS during interrupts. We use different contexts depending on the interrupt
level.

The orig tracks precisely the origin of a buffer. We use a special encoding
for the orig values, and pack together in each uint32_t cell of the orig:
 - a code designating the type of memory (Stack, Pool, etc), and
 - a compressed pointer, which points either (1) to a string containing
   the name of the variable associated with the cell, or (2) to an area
   in the kernel .text section which we resolve to a symbol name + offset.

This encoding allows us not to consume extra memory for associating
information with each cell, and produces a precise output, that can tell
for example the name of an uninitialized variable on the stack, the
function in which it was pushed on the stack, and the function where we
accessed this uninitialized variable.

kMSan is available with LLVM, but not with GCC.

The code is organized in a way that is similar to kASan and kCSan, so it
means that other architectures than amd64 can be supported.

Revision 1.186.2.1 / (download) - annotate - [select for diffs], Tue Oct 15 18:48:56 2019 UTC (3 years, 3 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1
Changes since 1.186: +2 -1 lines
Diff to previous 1.186 (colored) next main 1.187 (colored)

Pull up following revision(s) (requested by kamil in ticket #318):

	sys/sys/lwp.h: revision 1.187

Define LW_DBGSUSPEND in sys/lwp.h

This flag specifies the suspended by debugger property, as used by
PT_SUSPEND in ptrace(2).

Revision 1.187 / (download) - annotate - [select for diffs], Thu Oct 3 22:26:43 2019 UTC (3 years, 4 months ago) by kamil
Branch: MAIN
Changes since 1.186: +2 -1 lines
Diff to previous 1.186 (colored)

Define LW_DBGSUSPEND in sys/lwp.h

This flag specifies the suspended by debugger property, as used by
PT_SUSPEND in ptrace(2).

Revision 1.186 / (download) - annotate - [select for diffs], Wed Jun 19 21:39:53 2019 UTC (3 years, 7 months ago) by kamil
Branch: MAIN
CVS Tags: netbsd-9-base
Branch point for: netbsd-9
Changes since 1.185: +3 -1 lines
Diff to previous 1.185 (colored)

Add an explicit node that lwp status numbers are set in stone

Requested by <mrg>

Revision 1.185 / (download) - annotate - [select for diffs], Tue Jun 18 22:40:09 2019 UTC (3 years, 7 months ago) by kamil
Branch: MAIN
Changes since 1.184: +2 -3 lines
Diff to previous 1.184 (colored)

Stop defining in lwp.h: LSDEAD

Not used since NetBSD-5.0.

It had a confusing comment that suggested that all entries after LSDEAD
are removed, which wasn't true.

Revision 1.184 / (download) - annotate - [select for diffs], Thu Jun 13 20:20:18 2019 UTC (3 years, 7 months ago) by kamil
Branch: MAIN
Changes since 1.183: +2 -2 lines
Diff to previous 1.183 (colored)

Correct use-after-free issue in vfork(2)

In the previous behavior vforking parent was keeping pointer to a child
and checking whether it clears a PL_PPWAIT in its bitfield p_lflag. However
a child can go invalid between exec/exit event from child and waking up
vforked parent and this can cause invalid pointer read and in the worst
scenario kernel crash.

In the new behavior vforked child keeps a reference to vforked parent LWP
and sets a value l_vforkwaiting to false. This means that vforked child
can finish its work, exec/exit and be terminated and once parent will be
woken up it will read its own field whether its child is still blocking.

Add new field in struct lwp: l_vforkwaiting protected by proc_lock.
In future it should be refactored and all PL_PPWAIT users transformed to
l_vforkwaiting and next l_vforkwaiting probably transformed into a bit
field.

This is another attempt of fixing this bug after <rmind> from 2012 in
commit:

Author: rmind <rmind@NetBSD.org>
Date:   Sun Jul 22 22:40:18 2012 +0000

    fork1: fix use-after-free problems.  Addresses PR/46128 from Andrew Doran.
    Note: PL_PPWAIT should be fully replaced and modificaiton of l_pflag by
    other LWP is undesirable, but this is enough for netbsd-6.

The new version no longer performs unsafe access in l_lflag changing the
LP_VFORKWAIT bit.

Verified with ATF t_vfork and t_ptrace* tests and they are no longer
causing any issues in my local setup.

Fixes PR/46128 by Andrew Doran

Revision 1.179.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:09:57 2019 UTC (3 years, 8 months ago) by christos
Branch: phil-wifi
Changes since 1.179: +5 -2 lines
Diff to previous 1.179 (colored)

Sync with HEAD

Revision 1.183 / (download) - annotate - [select for diffs], Fri May 17 03:34:26 2019 UTC (3 years, 8 months ago) by ozaki-r
Branch: MAIN
CVS Tags: phil-wifi-20190609
Changes since 1.182: +2 -1 lines
Diff to previous 1.182 (colored)

Implement an aggressive psref leak detector

It is yet another psref leak detector that enables to tell where a leak occurs
while a simpler version that is already committed just tells an occurrence of a
leak.

Investigating of psref leaks is hard because once a leak occurs a percpu list of
psref that tracks references can be corrupted.  A reference to a tracking object
is memorized in the list via an intermediate object (struct psref) that is
normally allocated on a stack of a thread.  Thus, the intermediate object can be
overwritten on a leak resulting in corruption of the list.

The tracker makes a shadow entry to an intermediate object and stores some hints
into it (currently it's a caller address of psref_acquire).  We can detect a
leak by checking the entries on certain points where any references should be
released such as the return point of syscalls and the end of each softint
handler.

The feature is expensive and enabled only if the kernel is built with
PSREF_DEBUG.

Proposed on tech-kern

Revision 1.182 / (download) - annotate - [select for diffs], Fri Apr 19 01:52:55 2019 UTC (3 years, 9 months ago) by ozaki-r
Branch: MAIN
CVS Tags: isaki-audio2-base, isaki-audio2
Changes since 1.181: +2 -2 lines
Diff to previous 1.181 (colored)

Implement a simple psref leak detector

It detects leaks by counting up the number of held psref by an LWP and checking
its zeroness at the end of syscalls and softint handlers.  For the counter, a
unused field of struct lwp is reused.

The detector runs only if DIAGNOSTIC is turned on.

Revision 1.181 / (download) - annotate - [select for diffs], Fri Mar 1 09:02:03 2019 UTC (3 years, 11 months ago) by hannken
Branch: MAIN
Changes since 1.180: +2 -1 lines
Diff to previous 1.180 (colored)

Move pointer to fstrans private data into "struct lwp".

Ride NetBSD 8.99.35

Revision 1.178.2.2 / (download) - annotate - [select for diffs], Wed Dec 26 14:02:07 2018 UTC (4 years, 1 month ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.178.2.1: +2 -1 lines
Diff to previous 1.178.2.1 (colored) to branchpoint 1.178 (colored) next main 1.179 (colored)

Sync with HEAD, resolve a few conflicts

Revision 1.180 / (download) - annotate - [select for diffs], Wed Nov 28 19:46:22 2018 UTC (4 years, 2 months ago) by mlelstv
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226
Changes since 1.179: +2 -1 lines
Diff to previous 1.179 (colored)

Move counting involuntary switches into mi_switch. preempt() passes that
information by setting a new LWP flag.

While here, don't even try to switch when the scheduler has no other LWP
to run. This check is currently spread over all callers of preempt()
and will be removed there.

ok mrg@.

Revision 1.178.2.1 / (download) - annotate - [select for diffs], Sun Apr 22 07:20:29 2018 UTC (4 years, 9 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.178: +17 -17 lines
Diff to previous 1.178 (colored)

Sync with HEAD

Revision 1.179 / (download) - annotate - [select for diffs], Thu Apr 19 21:19:07 2018 UTC (4 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422
Branch point for: phil-wifi
Changes since 1.178: +17 -17 lines
Diff to previous 1.178 (colored)

s/static inline/static __inline/g for consistency with other include
headers.

Revision 1.178 / (download) - annotate - [select for diffs], Fri Feb 16 07:11:50 2018 UTC (4 years, 11 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.177: +3 -1 lines
Diff to previous 1.177 (colored)

Add missing barriers to curlwp_bind and curlwp_bindx

The barriers prevent the instruction of setting/clearing the LP_BOUND flag
from reordering over where we want to prevent LWP migrations.

Note that the fix doesn't mean that there was a race condition.  For now the API
is used only for psref and the combination use of them doesn't need the
barriers(*).

(*) https://mail-index.netbsd.org/tech-kern/2018/02/15/msg023101.html

Pointed out by Mateusz Guzik

Revision 1.177 / (download) - annotate - [select for diffs], Sun Jan 14 16:43:03 2018 UTC (5 years ago) by maxv
Branch: MAIN
Changes since 1.176: +4 -4 lines
Diff to previous 1.176 (colored)

typos

Revision 1.174.4.1 / (download) - annotate - [select for diffs], Tue Jan 2 10:56:58 2018 UTC (5 years, 1 month ago) by snj
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1
Changes since 1.174: +3 -1 lines
Diff to previous 1.174 (colored) next main 1.175 (colored)

Pull up following revision(s) (requested by ozaki-r in ticket #463):
	sys/netinet/in.c: revision 1.212
	sys/netinet/ip_output.c: revision 1.288
	sys/netinet6/in6.c: revision 1.256
	sys/netinet6/in6_pcb.c: revision 1.163
	sys/sys/lwp.h: revision 1.176
Add missing curlwp_bindx
--
Add missing curlwp_bindx
--
Check LP_BOUND is surely set in curlwp_bindx
This may find an extra call of curlwp_bindx.
--
Fix usage of curlwp_bind in ip_output
curlwp_bindx must be called in LIFO order, i.e., we can't call curlwp_bind
and curlwp_bindx like this:
  bound1 = curlwp_bind();
  bound2 = curlwp_bind();
  curlwp_bindx(bound1);
  curlwp_bindx(bound2);
ip_outout did so if NET_MPSAFE. Fix it.
--
Fix wrong usage of psref_held
We can't use it for checking if a caller does NOT hold a given target.
If you want to do it you should have psref_not_held or something.

Revision 1.176 / (download) - annotate - [select for diffs], Fri Dec 22 10:24:49 2017 UTC (5 years, 1 month ago) by ozaki-r
Branch: MAIN
Changes since 1.175: +3 -1 lines
Diff to previous 1.175 (colored)

Check LP_BOUND is surely set in curlwp_bindx

This may find an extra call of curlwp_bindx.

Revision 1.163.2.5 / (download) - annotate - [select for diffs], Sun Dec 3 11:39:20 2017 UTC (5 years, 2 months ago) by jdolecek
Branch: tls-maxphys
Changes since 1.163.2.4: +45 -7 lines
Diff to previous 1.163.2.4 (colored) next main 1.164 (colored)

update from HEAD

Revision 1.169.4.3 / (download) - annotate - [select for diffs], Mon Aug 28 17:53:16 2017 UTC (5 years, 5 months ago) by skrll
Branch: nick-nhusb
Changes since 1.169.4.2: +7 -4 lines
Diff to previous 1.169.4.2 (colored) to branchpoint 1.169 (colored) next main 1.170 (colored)

Sync with HEAD

Revision 1.175 / (download) - annotate - [select for diffs], Thu Jun 8 01:09:52 2017 UTC (5 years, 8 months ago) by chs
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825
Changes since 1.174: +2 -1 lines
Diff to previous 1.174 (colored)

allow cv_signal() immediately followed by cv_destroy().
this sequence is used by ZFS in a couple places and by supporting it
natively we can undo our local ZFS changes that avoided it.
note that this is only legal when all of the waiters use cv_wait()
and not any of the other variations, and lockdebug will catch
any violations of this rule.

Revision 1.172.2.1 / (download) - annotate - [select for diffs], Wed Apr 26 02:53:31 2017 UTC (5 years, 9 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.172: +6 -4 lines
Diff to previous 1.172 (colored) next main 1.173 (colored)

Sync with HEAD

Revision 1.172.4.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:54:08 2017 UTC (5 years, 9 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.172: +6 -4 lines
Diff to previous 1.172 (colored) next main 1.173 (colored)

Sync with HEAD

Revision 1.174 / (download) - annotate - [select for diffs], Fri Apr 21 15:10:35 2017 UTC (5 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, netbsd-8-base, matt-nb8-mediatek-base, matt-nb8-mediatek, bouyer-socketcan-base1
Branch point for: netbsd-8
Changes since 1.173: +5 -4 lines
Diff to previous 1.173 (colored)

- 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)

Revision 1.173 / (download) - annotate - [select for diffs], Sat Apr 8 00:25:50 2017 UTC (5 years, 10 months ago) by kamil
Branch: MAIN
CVS Tags: jdolecek-ncq-base, jdolecek-ncq
Changes since 1.172: +2 -1 lines
Diff to previous 1.172 (colored)

Add new ptrace(2) API: PT_SETSTEP & PT_CLEARSTEP

These operations allow to mark thread as a single-stepping one.

This allows to i.a.:
 - single step and emit a signal (PT_SETSTEP & PT_CONTINUE)
 - single step and trace syscall entry and exit (PT_SETSTEP & PT_SYSCALL)

The former is useful for debuggers like GDB or LLDB. The latter can be used
to singlestep a usermode kernel. These examples don't limit use-cases of
this interface.

Define PT_*STEP only for platforms defining PT_STEP.

Add new ATF tests setstep[1234].

These ptrace(2) operations first appeared in FreeBSD.

Sponsored by <The NetBSD Foundation>

Revision 1.169.4.2 / (download) - annotate - [select for diffs], Sat Jul 9 20:25:24 2016 UTC (6 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.169.4.1: +27 -5 lines
Diff to previous 1.169.4.1 (colored) to branchpoint 1.169 (colored)

Sync with HEAD

Revision 1.172 / (download) - annotate - [select for diffs], Sun Jul 3 14:24:59 2016 UTC (6 years, 7 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, localcount-20160914, bouyer-socketcan-base
Branch point for: pgoyette-localcount, bouyer-socketcan
Changes since 1.171: +5 -5 lines
Diff to previous 1.171 (colored)

GSoC 2016 Charles Cui: Implement thread priority protection based on work
by Andy Doran. Also document the get/set pshared thread calls as not
implemented, and add a skeleton implementation that is disabled.
XXX: document _sched_protect(2).

Revision 1.171 / (download) - annotate - [select for diffs], Thu Jun 16 02:34:33 2016 UTC (6 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.170: +23 -1 lines
Diff to previous 1.170 (colored)

Introduce curlwp_bind and curlwp_bindx

The API prevents the current LWP from migrating between CPUs during
the critical section (between curlwp_bind and curlwp_bindx). One use
case of it is psref(9) that has a contract that forbids such migrations.

Proposed at http://mail-index.netbsd.org/tech-kern/2016/06/13/msg020710.html
(check it out if you want to know why the function names are chosen)

Revision 1.169.4.1 / (download) - annotate - [select for diffs], Mon Apr 6 15:18:32 2015 UTC (7 years, 10 months ago) by skrll
Branch: nick-nhusb
Changes since 1.169: +14 -1 lines
Diff to previous 1.169 (colored)

Sync with HEAD

Revision 1.170 / (download) - annotate - [select for diffs], Tue Mar 31 01:10:02 2015 UTC (7 years, 10 months ago) by matt
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406
Changes since 1.169: +14 -1 lines
Diff to previous 1.169 (colored)

Provide struct cpu_info *lwp_getcpu(struct lwp *) inline for <machine/cpu.h>
<machine/cpu.h> is include by <sys/lwp.h> before struct lwp is defined so
it can't access members inside it.  This provides an accessor which is defined
after struct lwp is defined.

Revision 1.163.2.4 / (download) - annotate - [select for diffs], Wed Aug 20 00:04:44 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-maxphys
Changes since 1.163.2.3: +1 -1 lines
Diff to previous 1.163.2.3 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.168.8.1 / (download) - annotate - [select for diffs], Sun Aug 10 06:56:54 2014 UTC (8 years, 6 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.168: +2 -2 lines
Diff to previous 1.168 (colored) next main 1.169 (colored)

Rebase.

Revision 1.156.2.5 / (download) - annotate - [select for diffs], Thu May 22 11:41:18 2014 UTC (8 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.156.2.4: +2 -2 lines
Diff to previous 1.156.2.4 (colored) to branchpoint 1.156 (colored) next main 1.157 (colored)

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")

Revision 1.168.4.1 / (download) - annotate - [select for diffs], Sun May 18 17:46:21 2014 UTC (8 years, 8 months ago) by rmind
Branch: rmind-smpnet
Changes since 1.168: +2 -2 lines
Diff to previous 1.168 (colored) next main 1.169 (colored)

sync with head

Revision 1.169 / (download) - annotate - [select for diffs], Fri May 16 10:05:38 2014 UTC (8 years, 8 months ago) by rmind
Branch: MAIN
CVS Tags: tls-maxphys-base, tls-earlyentropy-base, rmind-smpnet-nbase, rmind-smpnet-base, nick-nhusb-base, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7
Branch point for: nick-nhusb
Changes since 1.168: +2 -2 lines
Diff to previous 1.168 (colored)

It is now lwp_t::l_pcu_valid for the PCU changes (missed in the
previous commit).

Revision 1.163.2.3 / (download) - annotate - [select for diffs], Sun Jun 23 06:20:29 2013 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.163.2.2: +2 -2 lines
Diff to previous 1.163.2.2 (colored)

resync from head

Revision 1.168 / (download) - annotate - [select for diffs], Fri Mar 29 01:09:45 2013 UTC (9 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, khorben-n900
Branch point for: tls-earlyentropy, rmind-smpnet
Changes since 1.167: +2 -2 lines
Diff to previous 1.167 (colored)

prototype adjustments for lwp_park, welcome to 6.99.19

Revision 1.163.2.2 / (download) - annotate - [select for diffs], Mon Feb 25 00:30:12 2013 UTC (9 years, 11 months ago) by tls
Branch: tls-maxphys
Changes since 1.163.2.1: +6 -4 lines
Diff to previous 1.163.2.1 (colored)

resync with head

Revision 1.156.2.4 / (download) - annotate - [select for diffs], Wed Jan 23 00:06:30 2013 UTC (10 years ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.156.2.3: +6 -4 lines
Diff to previous 1.156.2.3 (colored) to branchpoint 1.156 (colored)

sync with head

Revision 1.167 / (download) - annotate - [select for diffs], Wed Jan 2 19:39:04 2013 UTC (10 years, 1 month ago) by dsl
Branch: MAIN
CVS Tags: yamt-pagecache-base8, agc-symver-base, agc-symver
Changes since 1.166: +5 -3 lines
Diff to previous 1.166 (colored)

Only expose the bulk of sys/proc.h and sys/lwp.h if _KERNEL or _KMEMUSER
is defined.
i386 and amd64 build ok.

Revision 1.166 / (download) - annotate - [select for diffs], Wed Dec 26 18:30:22 2012 UTC (10 years, 1 month ago) by matt
Branch: MAIN
Changes since 1.165: +2 -2 lines
Diff to previous 1.165 (colored)

Add support for kernel-based code to use a PCU.  (for memory to memory
copies or in_cksum or ...)

Revision 1.159.2.1.2.2 / (download) - annotate - [select for diffs], Wed Nov 28 22:52:52 2012 UTC (10 years, 2 months ago) by matt
Branch: matt-nb6-plus
Changes since 1.159.2.1.2.1: +2 -2 lines
Diff to previous 1.159.2.1.2.1 (colored) to branchpoint 1.159.2.1 (colored) next main 1.159.2.2 (colored)

Pulled from HEAD:
Don't give a boost to system threads.

Revision 1.163.2.1 / (download) - annotate - [select for diffs], Tue Nov 20 03:02:51 2012 UTC (10 years, 2 months ago) by tls
Branch: tls-maxphys
Changes since 1.163: +3 -5 lines
Diff to previous 1.163 (colored)

Resync to 2012-11-19 00:00:00 UTC

Revision 1.159.2.1.2.1 / (download) - annotate - [select for diffs], Thu Nov 1 16:45:04 2012 UTC (10 years, 3 months ago) by matt
Branch: matt-nb6-plus
Changes since 1.159.2.1: +2 -4 lines
Diff to previous 1.159.2.1 (colored)

sync with netbsd-6-0-RELEASE.

Revision 1.156.2.3 / (download) - annotate - [select for diffs], Tue Oct 30 17:22:56 2012 UTC (10 years, 3 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.156.2.2: +14 -7 lines
Diff to previous 1.156.2.2 (colored) to branchpoint 1.156 (colored)

sync with head

Revision 1.165 / (download) - annotate - [select for diffs], Sun Oct 7 20:43:18 2012 UTC (10 years, 4 months ago) by matt
Branch: MAIN
CVS Tags: yamt-pagecache-base7, yamt-pagecache-base6
Changes since 1.164: +2 -2 lines
Diff to previous 1.164 (colored)

Don't give a boost to system threads.

Revision 1.159.2.2 / (download) - annotate - [select for diffs], Mon Oct 1 23:07:08 2012 UTC (10 years, 4 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, matt-nb6-plus-nbase, matt-nb6-plus-base
Changes since 1.159.2.1: +1 -3 lines
Diff to previous 1.159.2.1 (colored) to branchpoint 1.159 (colored) next main 1.160 (colored)

Pull up following revision(s) (requested by rmind in ticket #583):
	sys/kern/sys_lwp.c: revision 1.55
	sys/sys/lwp.h: revision 1.164
	sys/kern/kern_exit.c: revision 1.242
	sys/kern/kern_lwp.c: revision 1.173
exit_lwps, lwp_wait: fix a race condition by re-trying if p_lock was dropped
in a case of process exit.  Necessary to re-flag all LWPs for exit, as their
state might have changed or new LWPs spawned.
Should fix PR/46168 and PR/46402.

Revision 1.164 / (download) - annotate - [select for diffs], Thu Sep 27 20:43:15 2012 UTC (10 years, 4 months ago) by rmind
Branch: MAIN
Changes since 1.163: +2 -4 lines
Diff to previous 1.163 (colored)

exit_lwps, lwp_wait: fix a race condition by re-trying if p_lock was dropped
in a case of process exit.  Necessary to re-flag all LWPs for exit, as their
state might have changed or new LWPs spawned.

Should fix PR/46168 and PR/46402.

Revision 1.163 / (download) - annotate - [select for diffs], Sun Jul 22 22:40:18 2012 UTC (10 years, 6 months ago) by rmind
Branch: MAIN
Branch point for: tls-maxphys
Changes since 1.162: +5 -3 lines
Diff to previous 1.162 (colored)

fork1: fix use-after-free problems.  Addresses PR/46128 from Andrew Doran.
Note: PL_PPWAIT should be fully replaced and modificaiton of l_pflag by
other LWP is undesirable, but this is enough for netbsd-6.

Revision 1.162 / (download) - annotate - [select for diffs], Sat Jun 9 02:31:15 2012 UTC (10 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.161: +8 -1 lines
Diff to previous 1.161 (colored)

Add a new resource to limit the number of lwps per user, RLIMIT_NTHR. There
is a global sysctl kern.maxlwp to control this, which is by default 2048.
The first lwp of each process or kernel threads are not counted against the
limit. To show the current resource usage per user, I added a new sysctl
that dumps the uidinfo structure fields.

Revision 1.158.2.3 / (download) - annotate - [select for diffs], Sat Jun 2 11:09:39 2012 UTC (10 years, 8 months ago) by mrg
Branch: jmcneill-usbmp
Changes since 1.158.2.2: +1 -0 lines
Diff to previous 1.158.2.2 (colored) to branchpoint 1.158 (colored) next main 1.159 (colored)

sync to latest -current.

Revision 1.156.2.2 / (download) - annotate - [select for diffs], Wed May 23 10:08:17 2012 UTC (10 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.156.2.1: +2 -1 lines
Diff to previous 1.156.2.1 (colored) to branchpoint 1.156 (colored)

sync with head.

Revision 1.159.2.1 / (download) - annotate - [select for diffs], Mon May 21 15:25:56 2012 UTC (10 years, 8 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-0-RC2, netbsd-6-0-RC1
Branch point for: matt-nb6-plus
Changes since 1.159: +2 -1 lines
Diff to previous 1.159 (colored)

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.

Revision 1.161 / (download) - annotate - [select for diffs], Mon May 21 14:15:19 2012 UTC (10 years, 8 months ago) by martin
Branch: MAIN
CVS Tags: yamt-pagecache-base5, jmcneill-usbmp-base10
Changes since 1.160: +2 -1 lines
Diff to previous 1.160 (colored)

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.

Revision 1.156.2.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:08:52 2012 UTC (10 years, 9 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.156: +8 -22 lines
Diff to previous 1.156 (colored)

sync with head

Revision 1.158.2.2 / (download) - annotate - [select for diffs], Fri Feb 24 09:11:50 2012 UTC (10 years, 11 months ago) by mrg
Branch: jmcneill-usbmp
Changes since 1.158.2.1: +5 -19 lines
Diff to previous 1.158.2.1 (colored) to branchpoint 1.158 (colored)

sync to -current.

Revision 1.160 / (download) - annotate - [select for diffs], Sun Feb 19 21:06:58 2012 UTC (10 years, 11 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-pagecache-base4, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3
Changes since 1.159: +5 -19 lines
Diff to previous 1.159 (colored)

Remove COMPAT_SA / KERN_SA.  Welcome to 6.99.3!
Approved by core@.

Revision 1.158.2.1 / (download) - annotate - [select for diffs], Sat Feb 18 07:35:49 2012 UTC (10 years, 11 months ago) by mrg
Branch: jmcneill-usbmp
Changes since 1.158: +3 -3 lines
Diff to previous 1.158 (colored)

merge to -current.

Revision 1.159 / (download) - annotate - [select for diffs], Sun Jan 22 09:11:58 2012 UTC (11 years ago) by plunky
Branch: MAIN
CVS Tags: netbsd-6-base, jmcneill-usbmp-base2
Branch point for: netbsd-6
Changes since 1.158: +3 -3 lines
Diff to previous 1.158 (colored)

fix comment (SRUN->LSRUN, SONPROC->LSONPROC)

Revision 1.114.4.1.4.4 / (download) - annotate - [select for diffs], Tue Dec 27 16:35:13 2011 UTC (11 years, 1 month ago) by matt
Branch: matt-nb5-mips64
Changes since 1.114.4.1.4.3: +10 -8 lines
Diff to previous 1.114.4.1.4.3 (colored) to branchpoint 1.114.4.1 (colored) next main 1.115 (colored)

Backport joinable kthread support (for flash infrastructure).

Revision 1.158 / (download) - annotate - [select for diffs], Mon Nov 21 04:36:05 2011 UTC (11 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: jmcneill-usbmp-pre-base2, jmcneill-usbmp-base
Branch point for: jmcneill-usbmp
Changes since 1.157: +2 -3 lines
Diff to previous 1.157 (colored)

change printf gcc attribute to __printflike(), requested by joerg.

Revision 1.157 / (download) - annotate - [select for diffs], Sun Nov 20 23:37:00 2011 UTC (11 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.156: +3 -2 lines
Diff to previous 1.156 (colored)

add more missing printf attributes.

Revision 1.156 / (download) - annotate - [select for diffs], Mon Oct 31 12:18:32 2011 UTC (11 years, 3 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, jmcneill-audiomp3-base, jmcneill-audiomp3
Branch point for: yamt-pagecache
Changes since 1.155: +6 -1 lines
Diff to previous 1.155 (colored)

- make lendpri/changepri similar.
- make common code a subroutine.

Revision 1.114.4.1.8.2 / (download) - annotate - [select for diffs], Fri Oct 14 17:25:36 2011 UTC (11 years, 3 months ago) by matt
Branch: matt-nb5-pq3
Changes since 1.114.4.1.8.1: +2 -1 lines
Diff to previous 1.114.4.1.8.1 (colored) to branchpoint 1.114.4.1 (colored) next main 1.115 (colored)

Improved kthread join support

Revision 1.155 / (download) - annotate - [select for diffs], Sun Aug 7 21:13:06 2011 UTC (11 years, 6 months ago) by rmind
Branch: MAIN
Changes since 1.154: +1 -2 lines
Diff to previous 1.154 (colored)

Remove LW_AFFINITY flag and fix some bugs affinity mask handling.

Revision 1.154 / (download) - annotate - [select for diffs], Sun Aug 7 14:03:16 2011 UTC (11 years, 6 months ago) by rmind
Branch: MAIN
Changes since 1.153: +2 -2 lines
Diff to previous 1.153 (colored)

Rename slightly misleading KTHREAD_JOINABLE to KTHREAD_MUSTJOIN.

Revision 1.153 / (download) - annotate - [select for diffs], Sun Aug 7 13:33:02 2011 UTC (11 years, 6 months ago) by rmind
Branch: MAIN
Changes since 1.152: +2 -1 lines
Diff to previous 1.152 (colored)

Add kcpuset(9) - a reworked dynamic CPU set implementation for kernel.
Suitable for use during the early boot.  MD and other implementations
should be replaced with this interface.

Discussed on: tech-kern@

Revision 1.140.2.1 / (download) - annotate - [select for diffs], Mon Jun 6 09:10:11 2011 UTC (11 years, 8 months ago) by jruoho
Branch: jruoho-x86intr
Changes since 1.140: +56 -43 lines
Diff to previous 1.140 (colored) next main 1.141 (colored)

Sync with HEAD.

Revision 1.128.2.5 / (download) - annotate - [select for diffs], Tue May 31 03:05:12 2011 UTC (11 years, 8 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.128.2.4: +4 -1 lines
Diff to previous 1.128.2.4 (colored) to branchpoint 1.128 (colored) next main 1.129 (colored)

sync with head

Revision 1.152 / (download) - annotate - [select for diffs], Thu May 19 03:07:29 2011 UTC (11 years, 8 months ago) by rmind
Branch: MAIN
CVS Tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base, cherry-xenmp
Changes since 1.151: +2 -1 lines
Diff to previous 1.151 (colored)

Re-implement kthread_join(9), so that it actually works (hi haad@).

Revision 1.151 / (download) - annotate - [select for diffs], Mon May 2 02:28:57 2011 UTC (11 years, 9 months ago) by rmind
Branch: MAIN
Changes since 1.150: +4 -2 lines
Diff to previous 1.150 (colored)

Limit sys/pcu.h inclusion within _KERNEL scope, plus _KMEMUSER.

Revision 1.114.4.1.4.3 / (download) - annotate - [select for diffs], Fri Apr 29 08:20:15 2011 UTC (11 years, 9 months ago) by matt
Branch: matt-nb5-mips64
Changes since 1.114.4.1.4.2: +9 -1 lines
Diff to previous 1.114.4.1.4.2 (colored) to branchpoint 1.114.4.1 (colored)

Pull in lwp_setprivate/cpu_lwp_setprivate from -current.
Also pull in lwp_getpcb

Revision 1.128.2.4 / (download) - annotate - [select for diffs], Thu Apr 21 01:42:18 2011 UTC (11 years, 9 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.128.2.3: +1 -1 lines
Diff to previous 1.128.2.3 (colored) to branchpoint 1.128 (colored)

sync with head

Revision 1.150 / (download) - annotate - [select for diffs], Tue Mar 8 12:39:29 2011 UTC (11 years, 11 months ago) by pooka
Branch: MAIN
Changes since 1.149: +2 -2 lines
Diff to previous 1.149 (colored)

Nuke all threads belonging to a process calling exec before allowing
the exec handshake to return.

In addition to being The Right Thing To Do, fixes some nasty
conditions for CLOEXEC fd's (or at least does so in theory, I
couldn't create any problems although I tried).

Revision 1.128.2.3 / (download) - annotate - [select for diffs], Sat Mar 5 20:56:23 2011 UTC (11 years, 11 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.128.2.2: +80 -66 lines
Diff to previous 1.128.2.2 (colored) to branchpoint 1.128 (colored)

sync with head

Revision 1.141.2.2 / (download) - annotate - [select for diffs], Sat Mar 5 15:10:51 2011 UTC (11 years, 11 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.141.2.1: +20 -9 lines
Diff to previous 1.141.2.1 (colored) next main 1.142 (colored)

Sync with HEAD

Revision 1.149 / (download) - annotate - [select for diffs], Mon Feb 21 20:23:28 2011 UTC (11 years, 11 months ago) by pooka
Branch: MAIN
CVS Tags: bouyer-quota2-nbase
Changes since 1.148: +3 -2 lines
Diff to previous 1.148 (colored)

Borrow the lwpctl data area from the parent for the vfork() child.
Otherwise the child will incorrectly see it is not running on any
CPU.  Among other things, this fixes crashes from having
LD_PRELOAD=libpthread.so set in the env.

reviewed by tech-kern

Revision 1.148 / (download) - annotate - [select for diffs], Sat Feb 19 20:19:54 2011 UTC (11 years, 11 months ago) by matt
Branch: MAIN
Changes since 1.147: +3 -1 lines
Diff to previous 1.147 (colored)

Default PCU_UNIT_COUNT to 0.  If 0, don't compile the contents of subr_pcu.c
and don't include the pcu related members into struct lwp.

Revision 1.147 / (download) - annotate - [select for diffs], Sat Feb 19 00:22:50 2011 UTC (11 years, 11 months ago) by jakllsch
Branch: MAIN
Changes since 1.146: +10 -8 lines
Diff to previous 1.146 (colored)

Move lwp_getpcb() into a (_KERNEL || _KMEMUSER) ifdef.  Unbreaks crash(8).

Revision 1.146 / (download) - annotate - [select for diffs], Thu Feb 17 21:02:26 2011 UTC (11 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.145: +1 -3 lines
Diff to previous 1.145 (colored)

Need pcu.h unconditionally.

Revision 1.145 / (download) - annotate - [select for diffs], Thu Feb 17 20:55:01 2011 UTC (11 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.144: +1 -2 lines
Diff to previous 1.144 (colored)

don't include things twice.

Revision 1.144 / (download) - annotate - [select for diffs], Thu Feb 17 19:28:46 2011 UTC (11 years, 11 months ago) by matt
Branch: MAIN
Changes since 1.143: +13 -8 lines
Diff to previous 1.143 (colored)

Move lwp_getpcb to the area with the rest of the _KERNEL function declarations.

Revision 1.143 / (download) - annotate - [select for diffs], Thu Feb 17 18:32:29 2011 UTC (11 years, 11 months ago) by rmind
Branch: MAIN
Changes since 1.142: +5 -1 lines
Diff to previous 1.142 (colored)

Add PCU (Per-CPU Unit) - an interface to manage synchronization of any
per CPU context tied with an LWP.  Main use - lazy FPU handling on SMP.

Requested by matt@, will be used on mips64.  Note: implementation will
be improved to use IPIs before adopting on x86.  OK ad@.

Revision 1.141.2.1 / (download) - annotate - [select for diffs], Tue Feb 8 16:20:05 2011 UTC (12 years ago) by bouyer
Branch: bouyer-quota2
Changes since 1.141: +2 -1 lines
Diff to previous 1.141 (colored)

Sync with HEAD

Revision 1.114.4.1.4.2 / (download) - annotate - [select for diffs], Sat Feb 5 06:31:06 2011 UTC (12 years ago) by cliff
Branch: matt-nb5-mips64
Changes since 1.114.4.1.4.1: +3 -1 lines
Diff to previous 1.114.4.1.4.1 (colored) to branchpoint 1.114.4.1 (colored)

- protect option includes ("opt_multiprocessor.h") with #ifdef _KERNEL_OPT

Revision 1.114.4.1.4.1 / (download) - annotate - [select for diffs], Sat Feb 5 06:00:15 2011 UTC (12 years ago) by cliff
Branch: matt-nb5-mips64
Changes since 1.114.4.1: +3 -1 lines
Diff to previous 1.114.4.1 (colored)

- include opt_multiprocessor.h for explicit MULTIPROCESSOR dependency

Revision 1.142 / (download) - annotate - [select for diffs], Fri Jan 28 16:58:27 2011 UTC (12 years ago) by pooka
Branch: MAIN
CVS Tags: uebayasi-xip-base7, bouyer-quota2-base
Changes since 1.141: +2 -1 lines
Diff to previous 1.141 (colored)

Some lwp-walkers expect the correct value for l_stat, so use a flag
in l_flag instead of l_stat for the purpose of flagging lwps in a
dying proc.

Revision 1.141 / (download) - annotate - [select for diffs], Tue Jan 18 20:17:50 2011 UTC (12 years ago) by rmind
Branch: MAIN
Branch point for: bouyer-quota2
Changes since 1.140: +33 -35 lines
Diff to previous 1.140 (colored)

G/C unused declaration; fix few comments on locking; whitespaces.
No functional changes.

Revision 1.140 / (download) - annotate - [select for diffs], Fri Jan 14 02:06:34 2011 UTC (12 years ago) by rmind
Branch: MAIN
CVS Tags: jruoho-x86intr-base
Branch point for: jruoho-x86intr
Changes since 1.139: +8 -16 lines
Diff to previous 1.139 (colored)

Retire struct user, remove sys/user.h inclusions.  Note sys/user.h header
as obsolete.  Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.

Revision 1.114.4.1.8.1 / (download) - annotate - [select for diffs], Tue Jan 11 18:49:34 2011 UTC (12 years, 1 month ago) by matt
Branch: matt-nb5-pq3
Changes since 1.114.4.1: +9 -1 lines
Diff to previous 1.114.4.1 (colored)

Add lwp_getpcb to help shrink differences between -5 and -HEAD

Revision 1.139 / (download) - annotate - [select for diffs], Sat Dec 18 01:36:20 2010 UTC (12 years, 1 month ago) by rmind
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231
Changes since 1.138: +10 -9 lines
Diff to previous 1.138 (colored)

- Fix a few possible locking issues in execve1() and exit1().  Add a note
  that scheduler locks are special in this regard - adaptive locks cannot
  be in the path due to turnstiles.  Randomly spotted/reported by uebayasi@.
- Remove unused lwp_relock() and replace lwp_lock_retry() by simplifying
  lwp_lock() and sleepq_enter() a little.
- Give alllwp its own cache-line and mark lwp_cache pointer as read-mostly.

OK ad@

Revision 1.127.2.3 / (download) - annotate - [select for diffs], Fri Oct 22 07:22:54 2010 UTC (12 years, 3 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.127.2.2: +1 -0 lines
Diff to previous 1.127.2.2 (colored) to branchpoint 1.127 (colored) next main 1.128 (colored)

Sync with HEAD (-D20101022).

Revision 1.89.2.7 / (download) - annotate - [select for diffs], Sat Oct 9 03:32:45 2010 UTC (12 years, 4 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.89.2.6: +2 -1 lines
Diff to previous 1.89.2.6 (colored) to branchpoint 1.89 (colored) next main 1.90 (colored)

sync with head

Revision 1.138 / (download) - annotate - [select for diffs], Wed Sep 1 19:37:58 2010 UTC (12 years, 5 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, uebayasi-xip-base6, uebayasi-xip-base5, uebayasi-xip-base4, uebayasi-xip-base3
Changes since 1.137: +2 -1 lines
Diff to previous 1.137 (colored)

Implement rump_lwproc: the new lwp/proc management routines for
rump.  These move the management of the pid/lwpid space from the
application into the kernel, make code more robust, and make it
possible to attach multiple lwp's to non-proc0 processes.

Revision 1.127.2.2 / (download) - annotate - [select for diffs], Tue Aug 17 06:48:07 2010 UTC (12 years, 5 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.127.2.1: +18 -6 lines
Diff to previous 1.127.2.1 (colored) to branchpoint 1.127 (colored)

Sync with HEAD.

Revision 1.89.2.6 / (download) - annotate - [select for diffs], Wed Aug 11 22:55:10 2010 UTC (12 years, 6 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.89.2.5: +25 -12 lines
Diff to previous 1.89.2.5 (colored) to branchpoint 1.89 (colored)

sync with head.

Revision 1.137 / (download) - annotate - [select for diffs], Thu Jul 8 12:23:31 2010 UTC (12 years, 7 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-nfs-mp-base10, uebayasi-xip-base2
Changes since 1.136: +10 -4 lines
Diff to previous 1.136 (colored)

Implement direct select/poll support, currently effective for socket and
pipe subsystems.  Avoids overhead of second selscan() on wake-up, and thus
improves performance on certain workloads (especially when polling on many
file-descriptors).  Also, clean-up sys/fd_set.h header and improve macros.

Welcome to 5.99.36!

Revision 1.136 / (download) - annotate - [select for diffs], Wed Jul 7 01:30:38 2010 UTC (12 years, 7 months ago) by chs
Branch: MAIN
Changes since 1.135: +7 -3 lines
Diff to previous 1.135 (colored)

many changes for COMPAT_LINUX:
 - update the linux syscall table for each platform.
 - support new-style (NPTL) linux pthreads on all platforms.
   clone() with CLONE_THREAD uses 1 process with many LWPs
   instead of separate processes.
 - move the contents of sys__lwp_setprivate() into a new
   lwp_setprivate() and use that everywhere.
 - update linux_release[] and linux32_release[] to "2.6.18".
 - adjust placement of emul fork/exec/exit hooks as needed
   and adjust other emul code to match.
 - convert all struct emul definitions to use named initializers.
 - change the pid allocator to allow multiple pids to refer to the same proc.
 - remove a few fields from struct proc that are no longer needed.
 - disable the non-functional "vdso" code in linux32/amd64,
   glibc works fine without it.
 - fix a race in the futex code where we could miss a wakeup after
   a requeue operation.
 - redo futex locking to be a little more efficient.

Revision 1.128.2.2 / (download) - annotate - [select for diffs], Sat Jul 3 01:20:03 2010 UTC (12 years, 7 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.128.2.1: +4 -2 lines
Diff to previous 1.128.2.1 (colored) to branchpoint 1.128 (colored)

sync with head

Revision 1.135 / (download) - annotate - [select for diffs], Sun Jun 13 03:31:28 2010 UTC (12 years, 8 months ago) by yamt
Branch: MAIN
Changes since 1.134: +2 -2 lines
Diff to previous 1.134 (colored)

remove __dead from the prototype of lwp_exit, which actually can
return these days.

Revision 1.134 / (download) - annotate - [select for diffs], Thu Jun 10 20:54:53 2010 UTC (12 years, 8 months ago) by pooka
Branch: MAIN
Changes since 1.133: +2 -1 lines
Diff to previous 1.133 (colored)

lwp0 seems like an lwp instead of a process, so move bits related
to it from kern_proc.c to kern_lwp.c.  This makes kern_proc
"scheduling-clean" and more easily usable in environments with a
non-integrated scheduler (like, to take a random example, rump).

Revision 1.128.2.1 / (download) - annotate - [select for diffs], Sun May 30 05:18:08 2010 UTC (12 years, 8 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.128: +8 -7 lines
Diff to previous 1.128 (colored)

sync with head

Revision 1.133 / (download) - annotate - [select for diffs], Sun May 30 02:25:15 2010 UTC (12 years, 8 months ago) by dholland
Branch: MAIN
Changes since 1.132: +2 -1 lines
Diff to previous 1.132 (colored)

Uses PRI_KERNEL from sys/param.h; include that explicitly instead of by
accident.

Revision 1.127.2.1 / (download) - annotate - [select for diffs], Fri Apr 30 14:44:32 2010 UTC (12 years, 9 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.127: +10 -7 lines
Diff to previous 1.127 (colored)

Sync with HEAD.

Revision 1.132 / (download) - annotate - [select for diffs], Sun Apr 25 15:55:24 2010 UTC (12 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: uebayasi-xip-base1
Changes since 1.131: +5 -4 lines
Diff to previous 1.131 (colored)

Make select/poll work with more than 32 CPUs.
No ABI change.

Revision 1.131 / (download) - annotate - [select for diffs], Fri Apr 23 19:18:09 2010 UTC (12 years, 9 months ago) by rmind
Branch: MAIN
Changes since 1.130: +1 -4 lines
Diff to previous 1.130 (colored)

Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.

Revision 1.130 / (download) - annotate - [select for diffs], Mon Apr 12 22:15:31 2010 UTC (12 years, 10 months ago) by pooka
Branch: MAIN
Changes since 1.129: +2 -1 lines
Diff to previous 1.129 (colored)

Separate lwp specificdata data structure management from lwp cpu/vm
management.

No functional change.

(specificdata routines went from kern_lwp.c to subr_lwp_specificdata.c)

Revision 1.129 / (download) - annotate - [select for diffs], Tue Apr 6 13:50:22 2010 UTC (12 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.128: +3 -1 lines
Diff to previous 1.128 (colored)

PR/43128: Paul Koning: Threads support in ptrace() is insufficient for gdb to
debug threaded live apps: Add an optional lwpid in PT_STEP and PT_CONTINUE to
indicate which lwp to operate on, and implement the glue required to make it
work.

Revision 1.89.2.5 / (download) - annotate - [select for diffs], Thu Mar 11 15:04:42 2010 UTC (12 years, 11 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.89.2.4: +15 -9 lines
Diff to previous 1.89.2.4 (colored) to branchpoint 1.89 (colored)

sync with head

Revision 1.128 / (download) - annotate - [select for diffs], Sun Feb 21 02:11:39 2010 UTC (12 years, 11 months ago) by darran
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9
Branch point for: rmind-uvmplock
Changes since 1.127: +3 -1 lines
Diff to previous 1.127 (colored)

Add the DTrace hooks to the kernel (KDTRACE_HOOKS config option).
DTrace adds a pointer to the lwp and proc structures which it uses to
manage its state.  These are opaque from the kernel perspective to keep
the kernel free of CDDL code. The state arenas are kmem_alloced and freed
as proccesses and threads are created and destoyed.

Also add a check for trap06 (privileged/illegal instruction) so that
DTrace can check for D scripts that may have triggered the trap so it
can clean up after them and resume normal operation.

Ok with core@.

Revision 1.127 / (download) - annotate - [select for diffs], Sun Nov 29 16:23:49 2009 UTC (13 years, 2 months ago) by rmind
Branch: MAIN
CVS Tags: uebayasi-xip-base, matt-premerge-20091211
Branch point for: uebayasi-xip
Changes since 1.126: +2 -2 lines
Diff to previous 1.126 (colored)

Make lwp_getpcb() C89-happy by using __inline.

Revision 1.126 / (download) - annotate - [select for diffs], Wed Nov 25 13:53:19 2009 UTC (13 years, 2 months ago) by rmind
Branch: MAIN
Changes since 1.125: +8 -8 lines
Diff to previous 1.125 (colored)

Restore exporting of lwp_getpcb() to userland and fix DDB properly.
While the header might be abstracted better, it is a separate issue.

Revision 1.125 / (download) - annotate - [select for diffs], Sat Nov 21 19:54:49 2009 UTC (13 years, 2 months ago) by dsl
Branch: MAIN
Changes since 1.124: +8 -8 lines
Diff to previous 1.124 (colored)

Revert last change - don't expose lwp_getpcb() to userspace.

Revision 1.124 / (download) - annotate - [select for diffs], Sat Nov 21 18:53:08 2009 UTC (13 years, 2 months ago) by rmind
Branch: MAIN
Changes since 1.123: +8 -8 lines
Diff to previous 1.123 (colored)

Export lwp_getpcb() to userland, since crash(8) needs it.

Revision 1.123 / (download) - annotate - [select for diffs], Fri Nov 20 03:12:13 2009 UTC (13 years, 2 months ago) by rmind
Branch: MAIN
Changes since 1.122: +9 -2 lines
Diff to previous 1.122 (colored)

Add lwp_getpcb().  OK matt@.

Revision 1.122 / (download) - annotate - [select for diffs], Sun Nov 1 20:57:34 2009 UTC (13 years, 3 months ago) by rmind
Branch: MAIN
Changes since 1.121: +2 -3 lines
Diff to previous 1.121 (colored)

- Fix comment: proclist_mutex was merged with proclist_lock a long time ago.
- Remove unused alllwp_mutex declaration.

Revision 1.121 / (download) - annotate - [select for diffs], Wed Oct 21 21:12:07 2009 UTC (13 years, 3 months ago) by rmind
Branch: MAIN
CVS Tags: jym-xensuspend-nbase
Changes since 1.120: +4 -6 lines
Diff to previous 1.120 (colored)

Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.

Revision 1.117.2.1 / (download) - annotate - [select for diffs], Thu Jul 23 23:32:56 2009 UTC (13 years, 6 months ago) by jym
Branch: jym-xensuspend
Changes since 1.117: +13 -1 lines
Diff to previous 1.117 (colored) next main 1.118 (colored)

Sync with HEAD.

Revision 1.89.2.4 / (download) - annotate - [select for diffs], Sat Jul 18 14:53:27 2009 UTC (13 years, 6 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.89.2.3: +2 -1 lines
Diff to previous 1.89.2.3 (colored) to branchpoint 1.89 (colored)

sync with head.

Revision 1.120 / (download) - annotate - [select for diffs], Sun Jun 28 15:18:50 2009 UTC (13 years, 7 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, jymxensuspend-base
Changes since 1.119: +2 -1 lines
Diff to previous 1.119 (colored)

Ephemeral mapping (emap) implementation.  Concept is based on the idea that
activity of other threads will perform the TLB flush for the processes using
emap as a side effect.  To track that, global and per-CPU generation numbers
are used.  This idea was suggested by Andrew Doran; various improvements to
it by me.  Notes:

- For now, zero-copy on pipe is not yet enabled.
- TCP socket code would likely need more work.
- Additional UVM loaning improvements are needed.

Proposed on <tech-kern>, silence there.
Quickly reviewed by <ad>.

Revision 1.89.2.3 / (download) - annotate - [select for diffs], Sat Jun 20 07:20:38 2009 UTC (13 years, 7 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.89.2.2: +12 -1 lines
Diff to previous 1.89.2.2 (colored) to branchpoint 1.89 (colored)

sync with head

Revision 1.119 / (download) - annotate - [select for diffs], Wed May 27 12:08:35 2009 UTC (13 years, 8 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-nfs-mp-base5
Changes since 1.118: +9 -1 lines
Diff to previous 1.118 (colored)

add a comment about USER_TO_UAREA/UAREA_TO_USER.

Revision 1.118 / (download) - annotate - [select for diffs], Sat May 23 17:08:05 2009 UTC (13 years, 8 months ago) by ad
Branch: MAIN
Changes since 1.117: +4 -1 lines
Diff to previous 1.117 (colored)

- Add lwp_pctr(), get an LWP's preemption/ctxsw counter.
- Fix a preemption bug in CURCPU_IDLE_P() that can lead to a bogus
  assertion failure on DEBUG kernels.
- Fix MP/preemption races with timecounter detachment.

Revision 1.89.2.2 / (download) - annotate - [select for diffs], Mon May 4 08:14:35 2009 UTC (13 years, 9 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.89.2.1: +39 -38 lines
Diff to previous 1.89.2.1 (colored) to branchpoint 1.89 (colored)

sync with head.

Revision 1.114.2.2 / (download) - annotate - [select for diffs], Tue Mar 3 18:34:31 2009 UTC (13 years, 11 months ago) by skrll
Branch: nick-hppapmap
Changes since 1.114.2.1: +4 -2 lines
Diff to previous 1.114.2.1 (colored) to branchpoint 1.114 (colored) next main 1.115 (colored)

Sync with HEAD.

Revision 1.114.4.1 / (download) - annotate - [select for diffs], Fri Feb 6 01:54:09 2009 UTC (14 years ago) by snj
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, matt-nb5-pq3-base, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb4-mips64-k7-u2a-k9b
Branch point for: matt-nb5-pq3, matt-nb5-mips64
Changes since 1.114: +4 -2 lines
Diff to previous 1.114 (colored) next main 1.115 (colored)

Pull up following revision(s) (requested by ad in ticket #414):
	sys/kern/kern_lwp.c: revision 1.127
	sys/kern/sys_process.c: revision 1.146
	sys/sys/lwp.h: revision 1.117
PR kern/36183 problem with ptrace and multithreaded processes
Fix the crashy test case that Thor provided.

Revision 1.117 / (download) - annotate - [select for diffs], Wed Feb 4 21:17:39 2009 UTC (14 years ago) by ad
Branch: MAIN
CVS Tags: yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, jym-xensuspend-base
Branch point for: jym-xensuspend
Changes since 1.116: +4 -2 lines
Diff to previous 1.116 (colored)

PR kern/36183 problem with ptrace and multithreaded processes

Fix the crashy test case that Thor provided.

Revision 1.114.2.1 / (download) - annotate - [select for diffs], Mon Jan 19 13:20:30 2009 UTC (14 years ago) by skrll
Branch: nick-hppapmap
Changes since 1.114: +6 -8 lines
Diff to previous 1.114 (colored)

Sync with HEAD.

Revision 1.78.6.6 / (download) - annotate - [select for diffs], Sat Jan 17 13:29:40 2009 UTC (14 years ago) by mjf
Branch: mjf-devfs2
Changes since 1.78.6.5: +22 -9 lines
Diff to previous 1.78.6.5 (colored) to branchpoint 1.78 (colored) next main 1.79 (colored)

Sync with HEAD.

Revision 1.116 / (download) - annotate - [select for diffs], Sun Jan 11 02:45:55 2009 UTC (14 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: mjf-devfs2-base
Changes since 1.115: +2 -5 lines
Diff to previous 1.115 (colored)

merge christos-time_t

Revision 1.105.2.2 / (download) - annotate - [select for diffs], Sat Dec 13 01:15:35 2008 UTC (14 years, 2 months ago) by haad
Branch: haad-dm
Changes since 1.105.2.1: +8 -5 lines
Diff to previous 1.105.2.1 (colored) next main 1.106 (colored)

Update haad-dm branch to haad-dm-base2.

Revision 1.85.2.3 / (download) - annotate - [select for diffs], Thu Nov 20 20:45:39 2008 UTC (14 years, 2 months ago) by christos
Branch: christos-time_t
Changes since 1.85.2.2: +5 -4 lines
Diff to previous 1.85.2.2 (colored) next main 1.86 (colored)

merge with head.

Revision 1.115 / (download) - annotate - [select for diffs], Wed Nov 12 12:36:28 2008 UTC (14 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: haad-nbase2, haad-dm-base2, haad-dm-base, christos-time_t-nbase, christos-time_t-base, ad-audiomp2-base, ad-audiomp2
Changes since 1.114: +5 -4 lines
Diff to previous 1.114 (colored)

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.

Revision 1.85.2.2 / (download) - annotate - [select for diffs], Sat Nov 1 21:22:28 2008 UTC (14 years, 3 months ago) by christos
Branch: christos-time_t
Changes since 1.85.2.1: +92 -41 lines
Diff to previous 1.85.2.1 (colored)

Sync with head.

Revision 1.114 / (download) - annotate - [select for diffs], Tue Oct 21 12:22:00 2008 UTC (14 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-0-RC1, matt-mips64-base2
Branch point for: nick-hppapmap, netbsd-5
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (colored)

Correction to previous.

Revision 1.113 / (download) - annotate - [select for diffs], Tue Oct 21 12:16:59 2008 UTC (14 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.112: +3 -1 lines
Diff to previous 1.112 (colored)

Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.

Revision 1.112 / (download) - annotate - [select for diffs], Tue Oct 21 11:51:23 2008 UTC (14 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.111: +2 -2 lines
Diff to previous 1.111 (colored)

Undo revivesa damage to userret().

Revision 1.105.2.1 / (download) - annotate - [select for diffs], Sun Oct 19 22:18:09 2008 UTC (14 years, 3 months ago) by haad
Branch: haad-dm
Changes since 1.105: +16 -14 lines
Diff to previous 1.105 (colored)

Sync with HEAD.

Revision 1.111 / (download) - annotate - [select for diffs], Thu Oct 16 08:52:20 2008 UTC (14 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: haad-dm-base1
Changes since 1.110: +1 -2 lines
Diff to previous 1.110 (colored)

Another revivesa merge botch.

Revision 1.110 / (download) - annotate - [select for diffs], Wed Oct 15 20:32:46 2008 UTC (14 years, 3 months ago) by wrstuden
Branch: MAIN
Changes since 1.109: +2 -1 lines
Diff to previous 1.109 (colored)

Pre-declare struct sadata_vp here so we avoid a circular dependency
between this file and savar.h. This lets lwp.h stand on its own.

I do not understand why compiling kernels on i386 did not catch this.

Revision 1.109 / (download) - annotate - [select for diffs], Wed Oct 15 06:51:21 2008 UTC (14 years, 3 months ago) by wrstuden
Branch: MAIN
Changes since 1.108: +11 -1 lines
Diff to previous 1.108 (colored)

Merge wrstuden-revivesa into HEAD.

Revision 1.94.2.8 / (download) - annotate - [select for diffs], Fri Oct 10 22:37:09 2008 UTC (14 years, 4 months ago) by skrll
Branch: wrstuden-revivesa
Changes since 1.94.2.7: +5 -2 lines
Diff to previous 1.94.2.7 (colored) to branchpoint 1.94 (colored) next main 1.95 (colored)

Sync with HEAD.

Revision 1.108 / (download) - annotate - [select for diffs], Tue Oct 7 09:48:27 2008 UTC (14 years, 4 months ago) by rmind
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-4
Changes since 1.107: +5 -2 lines
Diff to previous 1.107 (colored)

- Replace lwp_t::l_sched_info with union: pointer and timeslice.
- Change minimal time-quantum to ~20 ms.
- Thus remove unneeded pool in M2, and unused sched_lwp_exit().
- Do not increase l_slptime twice for SCHED_4BSD (regression fix).

Revision 1.78.6.5 / (download) - annotate - [select for diffs], Sun Sep 28 10:41:04 2008 UTC (14 years, 4 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.78.6.4: +3 -20 lines
Diff to previous 1.78.6.4 (colored) to branchpoint 1.78 (colored)

Sync with HEAD.

Revision 1.94.2.7 / (download) - annotate - [select for diffs], Thu Sep 18 04:37:05 2008 UTC (14 years, 4 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.94.2.6: +4 -21 lines
Diff to previous 1.94.2.6 (colored) to branchpoint 1.94 (colored)

Sync with wrstuden-revivesa-base-2.

Revision 1.107 / (download) - annotate - [select for diffs], Thu Aug 28 06:21:22 2008 UTC (14 years, 5 months ago) by yamt
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2
Changes since 1.106: +1 -12 lines
Diff to previous 1.106 (colored)

remove now unused spc_dunlock.

Revision 1.98.2.4 / (download) - annotate - [select for diffs], Mon Jul 28 14:37:37 2008 UTC (14 years, 6 months ago) by simonb
Branch: simonb-wapbl
Changes since 1.98.2.3: +2 -2 lines
Diff to previous 1.98.2.3 (colored) to branchpoint 1.98 (colored) next main 1.99 (colored)

Sync with head.

Revision 1.106 / (download) - annotate - [select for diffs], Fri Jul 25 00:48:59 2008 UTC (14 years, 6 months ago) by uwe
Branch: MAIN
CVS Tags: simonb-wapbl-nbase, simonb-wapbl-base
Changes since 1.105: +2 -2 lines
Diff to previous 1.105 (colored)

Declare lwp_exit_switchaway() __dead.  Add infinite loop at the end of
lwp_exit_switchaway() to convince gcc that cpu_switchto(NULL, ...) is
really not going to return in that case.  Exposed by gcc4.3.

Reported on tech-kern by Alexander Shishkin.

Revision 1.98.2.3 / (download) - annotate - [select for diffs], Thu Jul 3 18:38:24 2008 UTC (14 years, 7 months ago) by simonb
Branch: simonb-wapbl
Changes since 1.98.2.2: +3 -9 lines
Diff to previous 1.98.2.2 (colored) to branchpoint 1.98 (colored)

Sync with head.

Revision 1.105 / (download) - annotate - [select for diffs], Thu Jul 3 15:15:40 2008 UTC (14 years, 7 months ago) by ad
Branch: MAIN
Branch point for: haad-dm
Changes since 1.104: +1 -5 lines
Diff to previous 1.104 (colored)

lwp_lock: this can't be simplified for the UP case, as races still exist.

Revision 1.104 / (download) - annotate - [select for diffs], Wed Jul 2 19:44:10 2008 UTC (14 years, 7 months ago) by rmind
Branch: MAIN
Changes since 1.103: +1 -2 lines
Diff to previous 1.103 (colored)

Remove outdated comments, and historical CCPU_SHIFT.  Make resched_cpu static,
const-ify ccpu.  Note: resched_cpu is not correct, should be revisited.

OK by <ad>.

Revision 1.103 / (download) - annotate - [select for diffs], Wed Jul 2 19:38:37 2008 UTC (14 years, 7 months ago) by rmind
Branch: MAIN
Changes since 1.102: +3 -4 lines
Diff to previous 1.102 (colored)

Remove locking of p_stmutex from sched_pstats(), protect l_pctcpu with p_lock,
and make l_cpticks lock-less.  Should fix PR/38296.

Reviewed (slightly different version) by <ad>.

Revision 1.94.2.6 / (download) - annotate - [select for diffs], Mon Jun 30 04:55:56 2008 UTC (14 years, 7 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.94.2.5: +2 -1 lines
Diff to previous 1.94.2.5 (colored) to branchpoint 1.94 (colored)

Change how we make SA threads not generate upcalls. Instead of clearing
LW_SA, use a private flag, LP_SA_NOBLOCK, that we set when we want
to not generate upcalls. This means we do NOT need to lock (l)
(ourselves) to set it.

Adjust tests that look at LW_SA. Now, we are an upcall-generating
lwp if ((l->l_flag & LW_SA) && (~l->l_pflag & LP_SA_NOBLOCK)).

Introduce code pattern to set & remember this:

	f = ~l->l_pflag & LP_SA_NOBLOCK;
	l->l_pflag |= LP_SA_NOBLOCK;

	...

	/* f is now LP_SA_NOBLOCK if it wasn't set in l_pflag before */

	l->l_pflag ^= f;

I updated a lot of the trap handlers to do trap handling iff LP_SA_NOBLOCK
is not set. I tried to figure out if the trap handler could be triggered
for user-based faults as opposed to kernel faults to user addresses, and
only look at LP_SA_NOBLOCK for the latter.

Above is a result of discussions with rmind at to reduce lock twiddling.

Also, per same discussions, add locking to sys_sa_preempt(). p_lock is
the lock we want.

Also, per same discussions, remove use of LSSUSPENDED as a thread state.
We needed to use it when we were emulating the 4.X and previous behavior
of hiding cached threads. For the moment, we now have them instead
remain visible to all and have them sleeping on the "lwpcache" wait
channel.

sa_newcachelwp(): sa_putcachelwp() wants savp_mutex held, not p_lock.

Tweak some comments.

Revision 1.78.6.4 / (download) - annotate - [select for diffs], Sun Jun 29 09:33:20 2008 UTC (14 years, 7 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.78.6.3: +4 -3 lines
Diff to previous 1.78.6.3 (colored) to branchpoint 1.78 (colored)

Sync with HEAD.

Revision 1.98.2.2 / (download) - annotate - [select for diffs], Fri Jun 27 15:11:55 2008 UTC (14 years, 7 months ago) by simonb
Branch: simonb-wapbl
Changes since 1.98.2.1: +2 -2 lines
Diff to previous 1.98.2.1 (colored) to branchpoint 1.98 (colored)

Sync with head.

Revision 1.94.2.5 / (download) - annotate - [select for diffs], Fri Jun 27 01:53:46 2008 UTC (14 years, 7 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.94.2.4: +2 -2 lines
Diff to previous 1.94.2.4 (colored) to branchpoint 1.94 (colored)

LP_SA_SWITCHING -> LW_SA_SWITCHING. Since we set the flag on threads
that may not be us, we need to use l_flag and lock, not l_pflag.

Revision 1.94.2.4 / (download) - annotate - [select for diffs], Tue Jun 24 02:07:36 2008 UTC (14 years, 7 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.94.2.3: +5 -4 lines
Diff to previous 1.94.2.3 (colored) to branchpoint 1.94 (colored)

Fix merge conflicts.

Revision 1.94.2.3 / (download) - annotate - [select for diffs], Mon Jun 23 04:32:02 2008 UTC (14 years, 7 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.94.2.2: +7 -4 lines
Diff to previous 1.94.2.2 (colored) to branchpoint 1.94 (colored)

Sync w/ -current. 34 merge conflicts to follow.

Revision 1.102 / (download) - annotate - [select for diffs], Sun Jun 22 00:06:36 2008 UTC (14 years, 7 months ago) by christos
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-1, wrstuden-revivesa-base
Changes since 1.101: +2 -2 lines
Diff to previous 1.101 (colored)

Adjust to separate kcpuset_t and cpuset_t.

Revision 1.98.2.1 / (download) - annotate - [select for diffs], Wed Jun 18 16:33:51 2008 UTC (14 years, 7 months ago) by simonb
Branch: simonb-wapbl
Changes since 1.98: +5 -4 lines
Diff to previous 1.98 (colored)

Sync with head.

Revision 1.87.2.3 / (download) - annotate - [select for diffs], Tue Jun 17 09:15:16 2008 UTC (14 years, 7 months ago) by yamt
Branch: yamt-pf42
Changes since 1.87.2.2: +3 -3 lines
Diff to previous 1.87.2.2 (colored) to branchpoint 1.87 (colored) next main 1.88 (colored)

sync with head.

Revision 1.101 / (download) - annotate - [select for diffs], Tue Jun 17 09:08:52 2008 UTC (14 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.100: +3 -2 lines
Diff to previous 1.100 (colored)

Update a comment.

Revision 1.100 / (download) - annotate - [select for diffs], Mon Jun 16 09:45:20 2008 UTC (14 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base4
Changes since 1.99: +2 -2 lines
Diff to previous 1.99 (colored)

lwp_lock_retry: return a pointer to the lock acquired. No functional change.

Revision 1.99 / (download) - annotate - [select for diffs], Sun Jun 15 20:32:57 2008 UTC (14 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.98: +2 -2 lines
Diff to previous 1.98 (colored)

Don't expose struct cpuset, share the l_affinity flag and only allocate it
if we need to. This is not a compatible change, but the syscalls are new
enough and they don't need to be versioned. Approved by rmind.

Revision 1.78.6.3 / (download) - annotate - [select for diffs], Thu Jun 5 19:14:37 2008 UTC (14 years, 8 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.78.6.2: +1 -1 lines
Diff to previous 1.78.6.2 (colored) to branchpoint 1.78 (colored)

Sync with HEAD.

Also fix build.

Revision 1.87.2.2 / (download) - annotate - [select for diffs], Wed Jun 4 02:05:49 2008 UTC (14 years, 8 months ago) by yamt
Branch: yamt-pf42
Changes since 1.87.2.1: +7 -4 lines
Diff to previous 1.87.2.1 (colored) to branchpoint 1.87 (colored)

sync with head

Revision 1.98 / (download) - annotate - [select for diffs], Mon Jun 2 13:58:07 2008 UTC (14 years, 8 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base3
Branch point for: simonb-wapbl
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

If vfork(), we want the LWP to run fast and on the same CPU
as its parent, so that it can reuse the VM context and cache
footprint on the local CPU.

Revision 1.78.6.2 / (download) - annotate - [select for diffs], Mon Jun 2 13:24:33 2008 UTC (14 years, 8 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.78.6.1: +74 -22 lines
Diff to previous 1.78.6.1 (colored) to branchpoint 1.78 (colored)

Sync with HEAD.

Revision 1.97 / (download) - annotate - [select for diffs], Sat May 31 21:26:01 2008 UTC (14 years, 8 months ago) by ad
Branch: MAIN
Changes since 1.96: +3 -3 lines
Diff to previous 1.96 (colored)

PR kern/38812 race between lwp_exit_switchaway and exit1/coredump

Move the LWP RUNNING and TIMEINTR flags into the thread-private flag word.

Revision 1.96 / (download) - annotate - [select for diffs], Mon May 19 12:48:54 2008 UTC (14 years, 8 months ago) by rmind
Branch: MAIN
CVS Tags: hpcarm-cleanup-nbase
Changes since 1.95: +4 -1 lines
Diff to previous 1.95 (colored)

- Make periodical balancing mandatory.
- Fix priority raising in M2 (broken after making runqueues mandatory).

Revision 1.87.2.1 / (download) - annotate - [select for diffs], Sun May 18 12:35:49 2008 UTC (14 years, 8 months ago) by yamt
Branch: yamt-pf42
Changes since 1.87: +64 -11 lines
Diff to previous 1.87 (colored)

sync with head.

Revision 1.95 / (download) - annotate - [select for diffs], Fri May 16 09:22:00 2008 UTC (14 years, 8 months ago) by hannken
Branch: MAIN
CVS Tags: yamt-pf42-base2
Changes since 1.94: +1 -2 lines
Diff to previous 1.94 (colored)

Make sure all cached buffers with valid, not yet written data have been
run through copy-on-write.  Call fscow_run() with valid data where possible.

The LP_UFSCOW hack is no longer needed to protect ffs_copyonwrite() against
endless recursion.

- Add a flag B_MODIFY to bread(), breada() and breadn().  If set the caller
  intends to modify the buffer returned.

- Always run copy-on-write on buffers returned from ffs_balloc().

- Add new function ffs_getblk() that gets a buffer, assigns a new blkno,
  may clear the buffer and runs copy-on-write.  Process possible errors
  from getblk() or fscow_run().  Part of PR kern/38664.

Welcome to 4.99.63

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>

Revision 1.89.2.1 / (download) - annotate - [select for diffs], Fri May 16 02:25:51 2008 UTC (14 years, 8 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.89: +46 -11 lines
Diff to previous 1.89 (colored)

sync with head.

Revision 1.94.2.2 / (download) - annotate - [select for diffs], Wed May 14 19:54:12 2008 UTC (14 years, 8 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.94.2.1: +3 -10 lines
Diff to previous 1.94.2.1 (colored) to branchpoint 1.94 (colored)

Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.

Revision 1.94.2.1 / (download) - annotate - [select for diffs], Sat May 10 23:49:08 2008 UTC (14 years, 9 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.94: +18 -3 lines
Diff to previous 1.94 (colored)

Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.

Revision 1.94 / (download) - annotate - [select for diffs], Tue May 6 18:40:57 2008 UTC (14 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: yamt-nfs-mp-base2
Branch point for: wrstuden-revivesa
Changes since 1.93: +4 -3 lines
Diff to previous 1.93 (colored)

LOCKDEBUG: try to speed it up a bit by not using so much global state.

This will break the build briefly but will be followed by another commit
to fix that..

Revision 1.93 / (download) - annotate - [select for diffs], Fri May 2 17:40:30 2008 UTC (14 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.92: +3 -1 lines
Diff to previous 1.92 (colored)

PR kern/38141 lookup/vfs_busy acquire rwlock recursively

Until the code paths are fixed properly, put in place an ugly workaround
to make it safe to recursively acquire a read lock on a mount.

Revision 1.92 / (download) - annotate - [select for diffs], Tue Apr 29 13:02:03 2008 UTC (14 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.91: +21 -1 lines
Diff to previous 1.91 (colored)

Move override of curlwp into lwp.h.

Revision 1.91 / (download) - annotate - [select for diffs], Mon Apr 28 20:24:10 2008 UTC (14 years, 9 months ago) by martin
Branch: MAIN
Changes since 1.90: +1 -8 lines
Diff to previous 1.90 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.90 / (download) - annotate - [select for diffs], Mon Apr 28 15:36:01 2008 UTC (14 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.89: +23 -4 lines
Diff to previous 1.89 (colored)

Add MI code to support in-kernel preemption. Preemption is deferred by
one of the following:

- Holding kernel_lock (indicating that the code is not MT safe).
- Bracketing critical sections with kpreempt_disable/kpreempt_enable.
- Holding the interrupt priority level above IPL_NONE.

Statistics on kernel preemption are reported via event counters, and
where preemption is deferred for some reason, it's also reported via
lockstat. The LWP priority at which preemption is triggered is tuneable
via sysctl.

Revision 1.89 / (download) - annotate - [select for diffs], Sun Apr 27 11:37:48 2008 UTC (14 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: yamt-nfs-mp-base
Branch point for: yamt-nfs-mp
Changes since 1.88: +20 -1 lines
Diff to previous 1.88 (colored)

- Rename crit_enter/crit_exit to kpreempt_disable/kpreempt_enable.
  DragonflyBSD uses the crit names for something quite different.
- Add a kpreempt_disabled function for diagnostic assertions.
- Add inline versions of kpreempt_enable/kpreempt_disable for primitives.
- Make some more changes for preemption safety to the x86 pmap.

Revision 1.88 / (download) - annotate - [select for diffs], Thu Apr 24 18:39:25 2008 UTC (14 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.87: +2 -2 lines
Diff to previous 1.87 (colored)

Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.

Revision 1.87 / (download) - annotate - [select for diffs], Sat Apr 12 17:16:09 2008 UTC (14 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base
Branch point for: yamt-pf42
Changes since 1.86: +2 -2 lines
Diff to previous 1.86 (colored)

Move the LW_BOUND flag into the thread-private flag word. It can be tested
by other threads/CPUs but that is only done when the LWP is known to be in a
quiescent state (for example, on a run queue).

Revision 1.86 / (download) - annotate - [select for diffs], Sat Apr 12 17:02:09 2008 UTC (14 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.85: +6 -10 lines
Diff to previous 1.85 (colored)

Take the run queue management code from the M2 scheduler, and make it
mandatory. Remove the 4BSD run queue code. Effects:

- Pluggable scheduler is only responsible for co-ordinating timeshared jobs.
- All systems run with per-CPU run queues.
- 4BSD scheduler gets processor sets / affinity.
- 4BSD scheduler gets a significant peformance boost on some workloads.

Discussed on tech-kern@.

Revision 1.78.6.1 / (download) - annotate - [select for diffs], Thu Apr 3 12:43:12 2008 UTC (14 years, 10 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.78: +12 -14 lines
Diff to previous 1.78 (colored)

Sync with HEAD.

Revision 1.85.2.1 / (download) - annotate - [select for diffs], Sat Mar 29 20:47:03 2008 UTC (14 years, 10 months ago) by christos
Branch: christos-time_t
Changes since 1.85: +2 -5 lines
Diff to previous 1.85 (colored)

Welcome to the time_t=long long dev_t=uint64_t branch.

Revision 1.85 / (download) - annotate - [select for diffs], Thu Mar 27 19:06:52 2008 UTC (14 years, 10 months ago) by ad
Branch: MAIN
Branch point for: christos-time_t
Changes since 1.84: +3 -1 lines
Diff to previous 1.84 (colored)

Make rusage collection per-LWP and collate in the appropriate places.
cloned threads need a little bit more work but the locking needs to
be fixed first.

Revision 1.28.2.11 / (download) - annotate - [select for diffs], Mon Mar 24 09:39:10 2008 UTC (14 years, 10 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.10: +10 -13 lines
Diff to previous 1.28.2.10 (colored) next main 1.29 (colored)

sync with head.

Revision 1.78.2.1 / (download) - annotate - [select for diffs], Mon Mar 24 07:16:28 2008 UTC (14 years, 10 months ago) by keiichi
Branch: keiichi-mipv6
Changes since 1.78: +3 -11 lines
Diff to previous 1.78 (colored) next main 1.79 (colored)

sync with head.

Revision 1.63.2.3 / (download) - annotate - [select for diffs], Sun Mar 23 02:05:10 2008 UTC (14 years, 10 months ago) by matt
Branch: matt-armv6
Changes since 1.63.2.2: +44 -11 lines
Diff to previous 1.63.2.2 (colored) next main 1.64 (colored)

sync with HEAD

Revision 1.84 / (download) - annotate - [select for diffs], Sun Mar 23 00:46:25 2008 UTC (14 years, 10 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-lazymbuf-base15, yamt-lazymbuf-base14, ad-socklock-base1
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (colored)

G/C l->l_locks.
OK by <ad>.

Revision 1.83 / (download) - annotate - [select for diffs], Sat Mar 22 18:04:42 2008 UTC (14 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.82: +3 -2 lines
Diff to previous 1.82 (colored)

Commit the "per-CPU" select patch. This is the result of much work and
testing by rmind@ and myself.

Which approach to use is still being discussed, but I would like to get
this out of my working tree. If we decide to use a different approach
there is no problem with revisiting this.

Revision 1.82 / (download) - annotate - [select for diffs], Sat Mar 22 17:53:34 2008 UTC (14 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.81: +4 -2 lines
Diff to previous 1.81 (colored)

LWP_CACHE_CREDS: instead of testing (l_cred != p_cred), use a per-LWP
flag bit to indicate a pending cred update. Avoids touching one item of
shared state in the syscall path.

Revision 1.81 / (download) - annotate - [select for diffs], Fri Mar 21 21:55:01 2008 UTC (14 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.80: +2 -1 lines
Diff to previous 1.80 (colored)

Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.

Revision 1.80 / (download) - annotate - [select for diffs], Mon Mar 17 16:54:51 2008 UTC (14 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base
Changes since 1.79: +3 -10 lines
Diff to previous 1.79 (colored)

Add a boolean parameter to syncobj_t::sobj_unsleep. If true we want the
existing behaviour: the unsleep method unlocks and wakes the swapper if
needs be. If false, the caller is doing a batch operation and will take
care of that later. This is kind of ugly, but it's difficult for the caller
to know which lock to release in some situations.

Revision 1.28.2.10 / (download) - annotate - [select for diffs], Mon Mar 17 09:15:47 2008 UTC (14 years, 10 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.9: +1 -2 lines
Diff to previous 1.28.2.9 (colored)

sync with head.

Revision 1.79 / (download) - annotate - [select for diffs], Sun Mar 9 15:39:14 2008 UTC (14 years, 11 months ago) by rmind
Branch: MAIN
Changes since 1.78: +1 -2 lines
Diff to previous 1.78 (colored)

Remove include of sys/pset.h in sys/lwp.h header.
Include it in few appropriate sources.

Revision 1.67.2.4 / (download) - annotate - [select for diffs], Mon Feb 18 21:07:23 2008 UTC (14 years, 11 months ago) by mjf
Branch: mjf-devfs
Changes since 1.67.2.3: +46 -4 lines
Diff to previous 1.67.2.3 (colored) next main 1.68 (colored)

Sync with HEAD.

Revision 1.28.2.9 / (download) - annotate - [select for diffs], Mon Feb 4 09:24:59 2008 UTC (15 years ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.8: +2 -1 lines
Diff to previous 1.28.2.8 (colored)

sync with head.

Revision 1.78 / (download) - annotate - [select for diffs], Sat Jan 26 17:55:29 2008 UTC (15 years ago) by rmind
Branch: MAIN
CVS Tags: nick-net80211-sync-base, nick-net80211-sync, mjf-devfs-base, hpcarm-cleanup-base
Branch point for: mjf-devfs2, keiichi-mipv6
Changes since 1.77: +2 -1 lines
Diff to previous 1.77 (colored)

sched_setparam: fix the case when incorrect (according to the class)
in-kernel priority is used.  Reported by <drochner>.

Minor fixes for scheduling calls to conform the POSIX:
- If pid is equal to zero, use the calling process;
- In case of permission problem, return EPERM instead of EACESS;
- sched_setscheduler() should return previously used policy;
- pthread_* calls should return the error code or zero;

Should fix the namespace problems (and builds of some packages):
- Move cpuset_t defintion from pset.h to sched.h;
- Remove the #include of pset.h in pthread.h;

Revision 1.28.2.8 / (download) - annotate - [select for diffs], Mon Jan 21 09:47:52 2008 UTC (15 years ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.7: +50 -6 lines
Diff to previous 1.28.2.7 (colored)

sync with head

Revision 1.71.6.4 / (download) - annotate - [select for diffs], Sat Jan 19 12:15:41 2008 UTC (15 years ago) by bouyer
Branch: bouyer-xeni386
Changes since 1.71.6.3: +41 -1 lines
Diff to previous 1.71.6.3 (colored) to branchpoint 1.71 (colored) next main 1.72 (colored)

Sync with HEAD

Revision 1.77 / (download) - annotate - [select for diffs], Tue Jan 15 03:37:12 2008 UTC (15 years ago) by rmind
Branch: MAIN
CVS Tags: bouyer-xeni386-nbase, bouyer-xeni386-base
Changes since 1.76: +42 -2 lines
Diff to previous 1.76 (colored)

Implementation of processor-sets, affinity and POSIX real-time extensions.
Add schedctl(8) - a program to control scheduling of processes and threads.

Notes:
- This is supported only by SCHED_M2;
- Migration of LWP mechanism will be revisited;

Proposed on: <tech-kern>. Reviewed by: <ad>.

Revision 1.63.2.2 / (download) - annotate - [select for diffs], Wed Jan 9 01:58:11 2008 UTC (15 years, 1 month ago) by matt
Branch: matt-armv6
Changes since 1.63.2.1: +14 -6 lines
Diff to previous 1.63.2.1 (colored)

sync with HEAD

Revision 1.71.6.3 / (download) - annotate - [select for diffs], Tue Jan 8 22:11:56 2008 UTC (15 years, 1 month ago) by bouyer
Branch: bouyer-xeni386
CVS Tags: bouyer-xeni386-merge1
Changes since 1.71.6.2: +1 -0 lines
Diff to previous 1.71.6.2 (colored) to branchpoint 1.71 (colored)

Sync with HEAD

Revision 1.76 / (download) - annotate - [select for diffs], Mon Jan 7 16:12:56 2008 UTC (15 years, 1 month ago) by ad
Branch: MAIN
CVS Tags: matt-armv6-base
Changes since 1.75: +2 -1 lines
Diff to previous 1.75 (colored)

Patch up sysctl locking:

- Lock processes, credentials, filehead etc correctly.
- Acquire a read hold on sysctl_treelock if only doing a query.
- Don't wire down the output buffer. It doesn't work correctly and the code
  regularly does long term sleeps with it held - it's not worth it.
- Don't hold locks other than sysctl_lock while doing copyout().
- Drop sysctl_lock while doing copyout / allocating memory in a few places.
- Don't take kernel_lock for sysctl.
- Fix a number of bugs spotted along the way

Revision 1.71.6.2 / (download) - annotate - [select for diffs], Wed Jan 2 21:58:03 2008 UTC (15 years, 1 month ago) by bouyer
Branch: bouyer-xeni386
Changes since 1.71.6.1: +4 -4 lines
Diff to previous 1.71.6.1 (colored) to branchpoint 1.71 (colored)

Sync with HEAD

Revision 1.67.2.3 / (download) - annotate - [select for diffs], Thu Dec 27 00:46:39 2007 UTC (15 years, 1 month ago) by mjf
Branch: mjf-devfs
Changes since 1.67.2.2: +6 -3 lines
Diff to previous 1.67.2.2 (colored)

Sync with HEAD.

Revision 1.71.2.2 / (download) - annotate - [select for diffs], Wed Dec 26 21:39:55 2007 UTC (15 years, 1 month ago) by ad
Branch: vmlocking2
Changes since 1.71.2.1: +7 -4 lines
Diff to previous 1.71.2.1 (colored) to branchpoint 1.71 (colored) next main 1.72 (colored)

Sync with head.

Revision 1.75 / (download) - annotate - [select for diffs], Wed Dec 26 16:01:38 2007 UTC (15 years, 1 month ago) by ad
Branch: MAIN
CVS Tags: vmlocking2-base3
Changes since 1.74: +2 -2 lines
Diff to previous 1.74 (colored)

Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.

Revision 1.74 / (download) - annotate - [select for diffs], Tue Dec 25 18:33:48 2007 UTC (15 years, 1 month ago) by perry
Branch: MAIN
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored)

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h

Revision 1.73 / (download) - annotate - [select for diffs], Sat Dec 22 01:14:53 2007 UTC (15 years, 1 month ago) by yamt
Branch: MAIN
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored)

use binuptime for l_stime/l_rtime.

Revision 1.71.2.1 / (download) - annotate - [select for diffs], Sat Dec 15 00:26:55 2007 UTC (15 years, 1 month ago) by ad
Branch: vmlocking2
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

uvm_lwp_hold, uvm_lwp_rele: use atomic ops to avoid lock order problems.

Revision 1.71.6.1 / (download) - annotate - [select for diffs], Thu Dec 13 21:56:58 2007 UTC (15 years, 2 months ago) by bouyer
Branch: bouyer-xeni386
Changes since 1.71: +4 -1 lines
Diff to previous 1.71 (colored)

Sync with HEAD

Revision 1.71.4.1 / (download) - annotate - [select for diffs], Thu Dec 13 05:06:02 2007 UTC (15 years, 2 months ago) by yamt
Branch: yamt-kmem
Changes since 1.71: +4 -1 lines
Diff to previous 1.71 (colored) next main 1.72 (colored)

sync with head.

Revision 1.72 / (download) - annotate - [select for diffs], Thu Dec 13 02:45:09 2007 UTC (15 years, 2 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-kmem-base3
Changes since 1.71: +4 -1 lines
Diff to previous 1.71 (colored)

add ddb "whatis" command.  inspired from solaris ::whatis dcmd.

Revision 1.62.6.8 / (download) - annotate - [select for diffs], Sun Dec 9 19:38:48 2007 UTC (15 years, 2 months ago) by jmcneill
Branch: jmcneill-pm
Changes since 1.62.6.7: +3 -2 lines
Diff to previous 1.62.6.7 (colored) to branchpoint 1.62 (colored) next main 1.63 (colored)

Sync with HEAD.

Revision 1.67.2.2 / (download) - annotate - [select for diffs], Sat Dec 8 18:21:32 2007 UTC (15 years, 2 months ago) by mjf
Branch: mjf-devfs
Changes since 1.67.2.1: +4 -2 lines
Diff to previous 1.67.2.1 (colored)

Sync with HEAD.

Revision 1.28.2.7 / (download) - annotate - [select for diffs], Fri Dec 7 17:34:55 2007 UTC (15 years, 2 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.6: +4 -2 lines
Diff to previous 1.28.2.6 (colored)

sync with head

Revision 1.71 / (download) - annotate - [select for diffs], Mon Dec 3 17:14:59 2007 UTC (15 years, 2 months ago) by ad
Branch: MAIN
CVS Tags: yamt-kmem-base2, yamt-kmem-base, vmlocking2-base2, vmlocking2-base1, vmlocking-nbase, reinoud-bufcleanup-nbase, reinoud-bufcleanup-base, jmcneill-pm-base, cube-autoconf-base, cube-autoconf
Branch point for: yamt-kmem, vmlocking2, bouyer-xeni386
Changes since 1.70: +3 -2 lines
Diff to previous 1.70 (colored)

For the slow path soft interrupts, arrange to have the priority of a
borrowed user LWP raised into the 'kernel RT' range if the LWP sleeps
(which is unlikely).

Revision 1.62.6.7 / (download) - annotate - [select for diffs], Mon Dec 3 16:15:20 2007 UTC (15 years, 2 months ago) by joerg
Branch: jmcneill-pm
Changes since 1.62.6.6: +2 -1 lines
Diff to previous 1.62.6.6 (colored) to branchpoint 1.62 (colored)

Sync with HEAD.

Revision 1.70 / (download) - annotate - [select for diffs], Sun Dec 2 14:55:49 2007 UTC (15 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.69: +2 -1 lines
Diff to previous 1.69 (colored)

mi_switch: adjust so that we don't have to hold the old LWP locked across
context switch, since cpu_switchto() can be slow under certain conditions.
From rmind@ with adjustments by me.

Revision 1.67.2.1 / (download) - annotate - [select for diffs], Mon Nov 19 00:49:27 2007 UTC (15 years, 2 months ago) by mjf
Branch: mjf-devfs
Changes since 1.67: +18 -14 lines
Diff to previous 1.67 (colored)

Sync with HEAD.

Revision 1.28.2.6 / (download) - annotate - [select for diffs], Thu Nov 15 11:45:31 2007 UTC (15 years, 2 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.5: +19 -15 lines
Diff to previous 1.28.2.5 (colored)

sync with head.

Revision 1.62.6.6 / (download) - annotate - [select for diffs], Wed Nov 14 19:04:52 2007 UTC (15 years, 2 months ago) by joerg
Branch: jmcneill-pm
Changes since 1.62.6.5: +3 -1 lines
Diff to previous 1.62.6.5 (colored) to branchpoint 1.62 (colored)

Sync with HEAD.

Revision 1.66.2.1 / (download) - annotate - [select for diffs], Tue Nov 13 16:03:22 2007 UTC (15 years, 3 months ago) by bouyer
Branch: bouyer-xenamd64
Changes since 1.66: +19 -15 lines
Diff to previous 1.66 (colored) next main 1.67 (colored)

Sync with HEAD

Revision 1.69 / (download) - annotate - [select for diffs], Mon Nov 12 23:12:00 2007 UTC (15 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: bouyer-xenamd64-base2, bouyer-xenamd64-base
Changes since 1.68: +3 -1 lines
Diff to previous 1.68 (colored)

Add _lwp_ctl() system call: provides a bidirectional, per-LWP communication
area between processes and the kernel.

Revision 1.63.2.1 / (download) - annotate - [select for diffs], Tue Nov 6 23:34:50 2007 UTC (15 years, 3 months ago) by matt
Branch: matt-armv6
CVS Tags: matt-armv6-prevmlocking
Changes since 1.63: +19 -14 lines
Diff to previous 1.63 (colored)

sync with HEAD

Revision 1.62.6.5 / (download) - annotate - [select for diffs], Tue Nov 6 19:25:38 2007 UTC (15 years, 3 months ago) by joerg
Branch: jmcneill-pm
Changes since 1.62.6.4: +16 -14 lines
Diff to previous 1.62.6.4 (colored) to branchpoint 1.62 (colored)

Sync with HEAD.

Revision 1.68 / (download) - annotate - [select for diffs], Tue Nov 6 00:42:45 2007 UTC (15 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: jmcneill-base
Changes since 1.67: +16 -14 lines
Diff to previous 1.67 (colored)

Merge scheduler changes from the vmlocking branch. All discussed on
tech-kern:

- Invert priority space so that zero is the lowest priority. Rearrange
  number and type of priority levels into bands. Add new bands like
  'kernel real time'.
- Ignore the priority level passed to tsleep. Compute priority for
  sleep dynamically.
- For SCHED_4BSD, make priority adjustment per-LWP, not per-process.

Revision 1.56.2.20 / (download) - annotate - [select for diffs], Mon Nov 5 23:18:32 2007 UTC (15 years, 3 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.19: +1 -6 lines
Diff to previous 1.56.2.19 (colored) next main 1.57 (colored)

Remove l_usrpri compat def.

Revision 1.56.2.19 / (download) - annotate - [select for diffs], Mon Nov 5 15:04:44 2007 UTC (15 years, 3 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.18: +2 -3 lines
Diff to previous 1.56.2.18 (colored)

- Locking tweaks for estcpu/nice. XXX The schedclock musn't run above
  IPL_SCHED.
- Hide most references to l_estcpu.
- l_policy was here first, but l_class is referenced in more places now.

Revision 1.62.6.4 / (download) - annotate - [select for diffs], Sun Nov 4 21:03:51 2007 UTC (15 years, 3 months ago) by jmcneill
Branch: jmcneill-pm
Changes since 1.62.6.3: +2 -2 lines
Diff to previous 1.62.6.3 (colored) to branchpoint 1.62 (colored)

Sync with HEAD.

Revision 1.56.2.18 / (download) - annotate - [select for diffs], Thu Nov 1 21:58:25 2007 UTC (15 years, 3 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.17: +19 -11 lines
Diff to previous 1.56.2.17 (colored)

- Fix interactivity problems under high load. Beacuse soft interrupts
  are being stacked on top of regular LWPs, more often than not aston()
  was being called on a soft interrupt thread instead of a user thread,
  meaning that preemption was not happening on EOI.

- Don't use bool in a couple of data structures. Sub-word writes are not
  always atomic and may clobber other fields in the containing word.

- For SCHED_4BSD, make p_estcpu per thread (l_estcpu). Rework how the
  dynamic priority level is calculated - it's much better behaved now.

- Kill the l_usrpri/l_priority split now that priorities are no longer
  directly assigned by tsleep(). There are three fields describing LWP
  priority:

        l_priority: Dynamic priority calculated by the scheduler.
                This does not change for kernel/realtime threads,
                and always stays within the correct band. Eg for
                timeshared LWPs it never moves out of the user
                priority range. This is basically what l_usrpri
                was before.

        l_inheritedprio: Lent to the LWP due to priority inheritance
                (turnstiles).

        l_kpriority: A boolean value set true the first time an LWP
                sleeps within the kernel. This indicates that the LWP
                should get a priority boost as compensation for blocking.
                lwp_eprio() now does the equivalent of sched_kpri() if
                the flag is set. The flag is cleared in userret().

- Keep track of scheduling class (OTHER, FIFO, RR) in struct lwp, and use
  this to make decisions in a few places where we previously tested for a
  kernel thread.

- Partially fix itimers and usr/sys/intr time accounting in the presence
  of software interrupts.

- Use kthread_create() to create idle LWPs. Move priority definitions
  from the various modules into sys/param.h.

- newlwp -> lwp_create

Revision 1.67 / (download) - annotate - [select for diffs], Thu Nov 1 21:54:10 2007 UTC (15 years, 3 months ago) by dsl
Branch: MAIN
Branch point for: mjf-devfs
Changes since 1.66: +2 -2 lines
Diff to previous 1.66 (colored)

Shave cycles of syscall entry by adding __predict_false() to LWP_CACHE_CREDS()

Revision 1.28.2.5 / (download) - annotate - [select for diffs], Sat Oct 27 11:36:30 2007 UTC (15 years, 3 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.4: +5 -2 lines
Diff to previous 1.28.2.4 (colored)

sync with head.

Revision 1.62.6.3 / (download) - annotate - [select for diffs], Fri Oct 26 15:49:19 2007 UTC (15 years, 3 months ago) by joerg
Branch: jmcneill-pm
Changes since 1.62.6.2: +4 -1 lines
Diff to previous 1.62.6.2 (colored) to branchpoint 1.62 (colored)

Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.

Revision 1.56.2.17 / (download) - annotate - [select for diffs], Thu Oct 18 15:47:35 2007 UTC (15 years, 3 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.16: +2 -2 lines
Diff to previous 1.56.2.16 (colored)

Update for soft interrupt changes. See kern_softint.c 1.1.2.17 for details.

Revision 1.64.2.1 / (download) - annotate - [select for diffs], Sun Oct 14 11:49:08 2007 UTC (15 years, 3 months ago) by yamt
Branch: yamt-x86pmap
Changes since 1.64: +4 -1 lines
Diff to previous 1.64 (colored) next main 1.65 (colored)

sync with head.

Revision 1.56.2.16 / (download) - annotate - [select for diffs], Wed Oct 10 23:03:25 2007 UTC (15 years, 4 months ago) by rmind
Branch: vmlocking
Changes since 1.56.2.15: +2 -1 lines
Diff to previous 1.56.2.15 (colored)

Sync with HEAD.

Revision 1.66 / (download) - annotate - [select for diffs], Tue Oct 9 19:00:15 2007 UTC (15 years, 4 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, yamt-x86pmap-base3, vmlocking-base
Branch point for: bouyer-xenamd64
Changes since 1.65: +2 -1 lines
Diff to previous 1.65 (colored)

Import of SCHED_M2 - the implementation of new scheduler, which is based
on the original approach of SVR4 with some inspirations about balancing
and migration from Solaris.  It implements per-CPU runqueues, provides a
real-time (RT) and time-sharing (TS) queues, ready to support a POSIX
real-time extensions, and also prepared for the support of CPU affinity.

The following lines in the kernel config enables the SCHED_M2:

no options SCHED_4BSD
options SCHED_M2

The scheduler seems to be stable.  Further work will come soon.

http://mail-index.netbsd.org/tech-kern/2007/10/04/0001.html
http://www.netbsd.org/~rmind/m2/mysql_bench_ro_4x_local.png
Thanks <ad> for the benchmarks!

Revision 1.56.2.15 / (download) - annotate - [select for diffs], Tue Oct 9 13:45:09 2007 UTC (15 years, 4 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.14: +2 -2 lines
Diff to previous 1.56.2.14 (colored)

Sync with head.

Revision 1.65 / (download) - annotate - [select for diffs], Mon Oct 8 20:06:20 2007 UTC (15 years, 4 months ago) by ad
Branch: MAIN
Changes since 1.64: +3 -1 lines
Diff to previous 1.64 (colored)

Merge run time accounting changes from the vmlocking branch. These make
the LWP "start time" per-thread instead of per-CPU.

Revision 1.62.6.2 / (download) - annotate - [select for diffs], Tue Oct 2 18:29:27 2007 UTC (15 years, 4 months ago) by joerg
Branch: jmcneill-pm
Changes since 1.62.6.1: +2 -2 lines
Diff to previous 1.62.6.1 (colored) to branchpoint 1.62 (colored)

Sync with HEAD.

Revision 1.62.2.2 / (download) - annotate - [select for diffs], Mon Sep 10 10:56:18 2007 UTC (15 years, 5 months ago) by skrll
Branch: nick-csl-alignment
Changes since 1.62.2.1: +2 -2 lines
Diff to previous 1.62.2.1 (colored) to branchpoint 1.62 (colored) next main 1.63 (colored)

Sync with HEAD.

Revision 1.64 / (download) - annotate - [select for diffs], Thu Sep 6 23:59:01 2007 UTC (15 years, 5 months ago) by ad
Branch: MAIN
CVS Tags: yamt-x86pmap-base2, yamt-x86pmap-base, nick-csl-alignment-base5
Branch point for: yamt-x86pmap
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 (colored)

- Fix sleepq_block() to return EINTR if the LWP is cancelled. Pointed out
  by yamt@.

- Introduce SOBJ_SLEEPQ_LIFO, and use for LWPs sleeping via _lwp_park.
  libpthread enqueues most waiters in LIFO order to try and wake LWPs that
  ran recently, since their working set is more likely to be in cache.
  Matching the order of insertion reduces the time spent searching queues
  in the kernel.

- Do not boost the priority of LWPs sleeping in _lwp_park, just let them
  sleep at their user priority level. LWPs waiting for some I/O event in
  the kernel still wait with kernel priority and get woken more quickly.
  This needs more evaluation and is to be revisited, but the effect on a
  variety of benchmarks is positive.

- When waking LWPs, do not send an IPI to remote CPUs or arrange for the
  current LWP to be preempted unless (a) the thread being awoken has kernel
  priority and has higher priority than the currently running thread or (b)
  the remote CPU is idle.

Revision 1.28.2.4 / (download) - annotate - [select for diffs], Mon Sep 3 14:46:24 2007 UTC (15 years, 5 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.3: +100 -110 lines
Diff to previous 1.28.2.3 (colored)

sync with head.

Revision 1.56.2.14 / (download) - annotate - [select for diffs], Mon Aug 20 21:28:17 2007 UTC (15 years, 5 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.13: +6 -1 lines
Diff to previous 1.56.2.13 (colored)

Sync with HEAD.

Revision 1.62.2.1 / (download) - annotate - [select for diffs], Wed Aug 15 13:50:56 2007 UTC (15 years, 5 months ago) by skrll
Branch: nick-csl-alignment
Changes since 1.62: +6 -1 lines
Diff to previous 1.62 (colored)

Sync with HEAD.

Revision 1.62.6.1 / (download) - annotate - [select for diffs], Thu Aug 9 02:37:28 2007 UTC (15 years, 6 months ago) by jmcneill
Branch: jmcneill-pm
Changes since 1.62: +6 -1 lines
Diff to previous 1.62 (colored)

Sync with HEAD.

Revision 1.63 / (download) - annotate - [select for diffs], Tue Aug 7 19:00:42 2007 UTC (15 years, 6 months ago) by ad
Branch: MAIN
Branch point for: matt-armv6
Changes since 1.62: +6 -1 lines
Diff to previous 1.62 (colored)

- 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.

Revision 1.56.2.13 / (download) - annotate - [select for diffs], Sun Jul 15 15:53:04 2007 UTC (15 years, 6 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.12: +2 -4 lines
Diff to previous 1.56.2.12 (colored)

Sync with head.

Revision 1.56.2.12 / (download) - annotate - [select for diffs], Sat Jul 14 22:09:49 2007 UTC (15 years, 7 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.11: +3 -1 lines
Diff to previous 1.56.2.11 (colored)

Make it possible to track time spent by soft interrupts as is done for
normal LWPs, and provide a sysctl to switch it on/off. Not enabled by
default because microtime() is not free. XXX Not happy with this but
I want it get it out of my local tree for the time being.

Revision 1.56.4.1 / (download) - annotate - [select for diffs], Wed Jul 11 20:12:32 2007 UTC (15 years, 7 months ago) by mjf
Branch: mjf-ufs-trans
Changes since 1.56: +75 -114 lines
Diff to previous 1.56 (colored) next main 1.57 (colored)

Sync with head.

Revision 1.62 / (download) - annotate - [select for diffs], Mon Jul 9 21:54:10 2007 UTC (15 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base, mjf-ufs-trans-base, matt-mips64-base, matt-mips64, hpcarm-cleanup
Branch point for: nick-csl-alignment, jmcneill-pm
Changes since 1.61: +2 -2 lines
Diff to previous 1.61 (colored)

Don't use lwp_t in areas not protected by _KERNEL.

Revision 1.61 / (download) - annotate - [select for diffs], Mon Jul 9 21:11:32 2007 UTC (15 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.60: +13 -14 lines
Diff to previous 1.60 (colored)

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements

Revision 1.56.2.11 / (download) - annotate - [select for diffs], Sat Jul 7 11:56:12 2007 UTC (15 years, 7 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.10: +2 -2 lines
Diff to previous 1.56.2.10 (colored)

- Remove the interrupt priority range and use 'kernel RT' instead,
  since only soft interrupts are threaded.
- Rename l->l_pinned to l->l_switchto. It might be useful for (re-)
  implementing SA or doors.
- Simplify soft interrupt dispatch so MD code is doing as little as
  possible that is new.

Revision 1.56.2.10 / (download) - annotate - [select for diffs], Sun Jul 1 19:25:01 2007 UTC (15 years, 7 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.9: +2 -3 lines
Diff to previous 1.56.2.9 (colored)

- LW_SELECT is gone
- struct callout -> callout_t

Revision 1.56.2.9 / (download) - annotate - [select for diffs], Sun Jun 17 21:32:01 2007 UTC (15 years, 7 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.8: +6 -4 lines
Diff to previous 1.56.2.8 (colored)

- Increase the number of thread priorities from 128 to 256. How the space
  is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
  is provided, with hooks for fast-path MD code that can run the interrupt
  threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
  locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.

Revision 1.56.2.8 / (download) - annotate - [select for diffs], Fri Jun 8 14:18:11 2007 UTC (15 years, 8 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.7: +23 -64 lines
Diff to previous 1.56.2.7 (colored)

Sync with head.

Revision 1.60 / (download) - annotate - [select for diffs], Thu May 17 14:51:42 2007 UTC (15 years, 8 months ago) by yamt
Branch: MAIN
Changes since 1.59: +29 -71 lines
Diff to previous 1.59 (colored)

merge yamt-idlelwp branch.  asked by core@.  some ports still needs work.

from doc/BRANCHES:

	idle lwp, and some changes depending on it.

	1. separate context switching and thread scheduling.
	   (cf. gmcgarry_ctxsw)
	2. implement idle lwp.
	3. clean up related MD/MI interfaces.
	4. make scheduler(s) modular.

Revision 1.48.2.16 / (download) - annotate - [select for diffs], Thu May 17 13:41:55 2007 UTC (15 years, 8 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.48.2.15: +2 -2 lines
Diff to previous 1.48.2.15 (colored) next main 1.49 (colored)

sync with head.

Revision 1.59 / (download) - annotate - [select for diffs], Thu May 17 12:05:03 2007 UTC (15 years, 8 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-idlelwp-base8
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored)

mark lwp_exit() and exit1() __noreturn__.

Revision 1.56.2.7 / (download) - annotate - [select for diffs], Sun May 13 17:36:40 2007 UTC (15 years, 9 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.6: +3 -3 lines
Diff to previous 1.56.2.6 (colored)

- Pass the error number and residual count to biodone(), and let it handle
  setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
  of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
  create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.

Revision 1.56.2.6 / (download) - annotate - [select for diffs], Sat Apr 28 22:40:04 2007 UTC (15 years, 9 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.5: +2 -2 lines
Diff to previous 1.56.2.5 (colored)

select/poll:

- Don't try to awaken LWPs more than once. Prevents unnecessary locking.
- Tidy slightly.

Revision 1.48.2.15 / (download) - annotate - [select for diffs], Sat Apr 21 15:50:20 2007 UTC (15 years, 9 months ago) by ad
Branch: yamt-idlelwp
Changes since 1.48.2.14: +7 -3 lines
Diff to previous 1.48.2.14 (colored)

Some changes mainly for top/ps:

- Add an optional name field to struct lwp.
- Count the total number of context switches + involuntary,
  not voluntary + involuntary.
- Mark the idle threads as LSIDL when not running, otherwise
  they show up funny in a top(1) that shows threads.
- Make pctcpu and cpticks per-LWP attributes.
- Add to kinfo_lwp: cpticks, pctcpu, pid, name.

Revision 1.48.2.14 / (download) - annotate - [select for diffs], Mon Apr 16 23:31:19 2007 UTC (15 years, 9 months ago) by ad
Branch: yamt-idlelwp
Changes since 1.48.2.13: +8 -31 lines
Diff to previous 1.48.2.13 (colored)

- Nuke the seperate scheduler locking scheme for UP kernels - it has been
  at the root of too many bugs.
- Add a LW_BOUND flag that indicates an LWP is bound to a specific CPU.

Revision 1.48.2.13 / (download) - annotate - [select for diffs], Sun Apr 15 16:59:21 2007 UTC (15 years, 9 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.48.2.12: +3 -3 lines
Diff to previous 1.48.2.12 (colored)

move the definition of lwp_t from lwp.h to types.h.

Revision 1.48.2.12 / (download) - annotate - [select for diffs], Sun Apr 15 16:04:04 2007 UTC (15 years, 9 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.48.2.11: +49 -47 lines
Diff to previous 1.48.2.11 (colored)

sync with head.

Revision 1.56.2.5 / (download) - annotate - [select for diffs], Tue Apr 10 13:26:18 2007 UTC (15 years, 10 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.4: +59 -55 lines
Diff to previous 1.56.2.4 (colored)

Sync with head.

Revision 1.56.2.4 / (download) - annotate - [select for diffs], Tue Apr 10 00:22:12 2007 UTC (15 years, 10 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.3: +5 -2 lines
Diff to previous 1.56.2.3 (colored)

Changes to select/poll:

- Make them MP safe and decouple from the proc locks.
- selwakeup: don't call p_find, or traverse per-proc LWP lists (ouch).
- selwakeup: don't lock the sleep queue unless we need to.

Revision 1.56.2.3 / (download) - annotate - [select for diffs], Mon Apr 9 22:10:06 2007 UTC (15 years, 10 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.2: +3 -1 lines
Diff to previous 1.56.2.2 (colored)

- Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.

Revision 1.56.2.2 / (download) - annotate - [select for diffs], Thu Apr 5 21:38:37 2007 UTC (15 years, 10 months ago) by ad
Branch: vmlocking
Changes since 1.56.2.1: +4 -10 lines
Diff to previous 1.56.2.1 (colored)

- Make context switch counters 64-bit, and count the total number of
  context switches + voluntary, instead of involuntary + voluntary.
- Add lwp::l_swaplock for uvm.
- PHOLD/PRELE are replaced.

Revision 1.56.6.1 / (download) - annotate - [select for diffs], Thu Mar 29 19:28:03 2007 UTC (15 years, 10 months ago) by reinoud
Branch: reinoud-bufcleanup
Changes since 1.56: +59 -55 lines
Diff to previous 1.56 (colored) next main 1.57 (colored)

Pullup to -current

Revision 1.58 / (download) - annotate - [select for diffs], Thu Mar 29 17:34:39 2007 UTC (15 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: thorpej-atomic-base, thorpej-atomic
Changes since 1.57: +57 -55 lines
Diff to previous 1.57 (colored)

- cv_wakeup: remove this. There are ~zero situations where it's useful.
- cv_wait and friends: after resuming execution, check to see if we have
  been restarted as a result of cv_signal. If we have, but cannot take
  the wakeup (because of eg a pending Unix signal or timeout) then try to
  ensure that another LWP sees it. This is necessary because there may
  be multiple waiters, and at least one should take the wakeup if possible.
  Prompted by a discussion with pooka@.
- typedef struct lwp lwp_t;
- int -> bool, struct lwp -> lwp_t in a few places.

Revision 1.48.2.11 / (download) - annotate - [select for diffs], Sat Mar 24 17:13:14 2007 UTC (15 years, 10 months ago) by ad
Branch: yamt-idlelwp
Changes since 1.48.2.10: +1 -3 lines
Diff to previous 1.48.2.10 (colored)

- Ensure that context switch always happens at least at IPL_SCHED, even
  if no spin lock is held. Should fix the assertion failure seen on hppa.
- Reduce the amount of spl frobbing in mi_switch.
- Add some comments.

Reviewed by yamt@.

Revision 1.48.2.10 / (download) - annotate - [select for diffs], Sat Mar 24 14:56:15 2007 UTC (15 years, 10 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.48.2.9: +4 -2 lines
Diff to previous 1.48.2.9 (colored)

sync with head.

Revision 1.48.2.9 / (download) - annotate - [select for diffs], Sat Mar 24 00:43:09 2007 UTC (15 years, 10 months ago) by rmind
Branch: yamt-idlelwp
Changes since 1.48.2.8: +13 -16 lines
Diff to previous 1.48.2.8 (colored)

Checkpoint:
- Abstract for per-CPU locking of runqueues.
  As a workaround for SCHED_4BSD global runqueue, covered by sched_mutex,
  spc_mutex is a pointer for now. After making SCHED_4BSD runqueues
  per-CPU, it will became a storage mutex.
- suspendsched: Locking is not necessary for cpu_need_resched().
- Remove mutex_spin_exit() prototype in patch.c and LOCK_ASSERT() check
  in runqueue_nextlwp() in sched_4bsd.c to make them compile again.

Revision 1.48.2.8 / (download) - annotate - [select for diffs], Fri Mar 23 16:54:03 2007 UTC (15 years, 10 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.48.2.7: +2 -3 lines
Diff to previous 1.48.2.7 (colored)

replace l_forw and l_back with TAILQ_ENTRY.
(forgot to commit with sched_4bsd.c rev.1.1.2.16.)

Revision 1.48.2.7 / (download) - annotate - [select for diffs], Wed Mar 21 22:04:18 2007 UTC (15 years, 10 months ago) by ad
Branch: yamt-idlelwp
Changes since 1.48.2.6: +3 -2 lines
Diff to previous 1.48.2.6 (colored)

Previously cpu_info::ci_curlwp was protected by the sched_mutex and this is
used in a few places to synchronise. Now the state of LWPs is protected
during switch by their current lock (which might be e.g. a sleep queue
lock). So ci_curlwp is unlocked, which is necessary to be able to do
preemption and to run interrupts as LWPs cheaply.

Add a (locked) flag to the lwp (LW_RUNNING) that indicates if it is on CPU
somewhere. More exactly, it means that the LWP's state is tied to a CPU, and
that the LWP has not yet switched away even if (l->l_cpu->ci_curcpu != l) or
(l->l_stat != LSONPROC).

Revision 1.56.2.1 / (download) - annotate - [select for diffs], Wed Mar 21 20:10:22 2007 UTC (15 years, 10 months ago) by ad
Branch: vmlocking
Changes since 1.56: +5 -5 lines
Diff to previous 1.56 (colored)

GC the simplelock/spinlock debugging stuff.

Revision 1.57 / (download) - annotate - [select for diffs], Wed Mar 21 18:25:59 2007 UTC (15 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.56: +4 -2 lines
Diff to previous 1.56 (colored)

Improvements to lwp_wait1(), for PR kern/35932:

- Better detect simple cycles of threads calling _lwp_wait and return
  EDEADLK. Does not handle deeper cycles like t1 -> t2 -> t3 -> t1.
- If there are multiple threads in _lwp_wait, then make sure that
  targeted waits take precedence over waits for any LWP to exit.
- When checking for deadlock, also count the number of zombies currently
  in the process as potentially reapable. Whenever a zombie is murdered,
  kick all waiters to make them check again for deadlock.
- Add more comments.

Also, while here:

- LOCK_ASSERT -> KASSERT in some places
- lwp_free: change boolean arguments to type 'bool'.
- proc_free: let lwp_free spin waiting for the last LWP to exit, there's
  no reason to do it here.

Revision 1.48.2.6 / (download) - annotate - [select for diffs], Mon Mar 12 06:00:52 2007 UTC (15 years, 11 months ago) by rmind
Branch: yamt-idlelwp
Changes since 1.48.2.5: +2 -1 lines
Diff to previous 1.48.2.5 (colored)

Sync with HEAD.

Revision 1.48.2.5 / (download) - annotate - [select for diffs], Fri Mar 9 15:16:26 2007 UTC (15 years, 11 months ago) by rmind
Branch: yamt-idlelwp
Changes since 1.48.2.4: +2 -1 lines
Diff to previous 1.48.2.4 (colored)

Checkpoint:

- Addition of scheduler-specific pointers in the struct proc, lwp and
  schedstate_percpu.
- Addition of sched_lwp_fork(), sched_lwp_exit() and sched_slept() hooks.
- mi_switch() now has only one argument.
- sched_nextlwp(void) becomes sched_switch(struct lwp *) and does an
  enqueueing of LWP.
- Addition of general kern.sched sysctl node.
- Remove twice called uvmexp.swtch++, other cleanups.

Discussed on tech-kern@

Revision 1.56 / (download) - annotate - [select for diffs], Fri Mar 2 15:57:06 2007 UTC (15 years, 11 months ago) by skd
Branch: MAIN
Branch point for: vmlocking, reinoud-bufcleanup, mjf-ufs-trans
Changes since 1.55: +2 -2 lines
Diff to previous 1.55 (colored)

Fix probable typo.
LW_UNPARKED conflicted with LW_PENDSIG.

Without this I see lots of threaded apps getting stuck in parked state.
Ok'ed by Christos.

Revision 1.55 / (download) - annotate - [select for diffs], Thu Mar 1 14:55:06 2007 UTC (15 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.54: +2 -1 lines
Diff to previous 1.54 (colored)

Fix a couple of races with LWP park/unpark.

Revision 1.48.2.4 / (download) - annotate - [select for diffs], Tue Feb 27 16:55:15 2007 UTC (15 years, 11 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.48.2.3: +51 -21 lines
Diff to previous 1.48.2.3 (colored)

- sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.

Revision 1.54 / (download) - annotate - [select for diffs], Tue Feb 27 15:07:28 2007 UTC (15 years, 11 months ago) by yamt
Branch: MAIN
Changes since 1.53: +5 -5 lines
Diff to previous 1.53 (colored)

typedef pri_t and use it instead of int and u_char.

Revision 1.53 / (download) - annotate - [select for diffs], Mon Feb 26 10:50:30 2007 UTC (15 years, 11 months ago) by yamt
Branch: MAIN
CVS Tags: ad-audiomp-base, ad-audiomp
Changes since 1.52: +1 -2 lines
Diff to previous 1.52 (colored)

move wchan_t and syncobj_t to a dedicated header to simplify dependencies.
fix "XXX wchan_t".

Revision 1.52 / (download) - annotate - [select for diffs], Mon Feb 26 09:20:52 2007 UTC (15 years, 11 months ago) by yamt
Branch: MAIN
Changes since 1.51: +27 -3 lines
Diff to previous 1.51 (colored)

implement priority inheritance.

Revision 1.28.2.3 / (download) - annotate - [select for diffs], Mon Feb 26 09:12:12 2007 UTC (15 years, 11 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.2: +248 -81 lines
Diff to previous 1.28.2.2 (colored)

sync with head.

Revision 1.51 / (download) - annotate - [select for diffs], Thu Feb 22 04:38:03 2007 UTC (15 years, 11 months ago) by matt
Branch: MAIN
Changes since 1.50: +2 -2 lines
Diff to previous 1.50 (colored)

Fix lossage from boolean_t -> bool and updated x86 bus_dma.

Revision 1.48.2.3 / (download) - annotate - [select for diffs], Tue Feb 20 21:48:46 2007 UTC (15 years, 11 months ago) by rmind
Branch: yamt-idlelwp
Changes since 1.48.2.2: +1 -19 lines
Diff to previous 1.48.2.2 (colored)

General Common Scheduler Framework (CSF) patch import. Huge thanks for
Daniel Sieger <dsieger at TechFak.Uni-Bielefeld de> for this work.

Short abstract: Split the dispatcher from the scheduler in order to
make the scheduler more modular. Introduce initial API for other
schedulers' implementations.

Discussed in tech-kern@
OK: yamt@, ad@

Note: further work will go soon.

Revision 1.50 / (download) - annotate - [select for diffs], Tue Feb 20 18:08:43 2007 UTC (15 years, 11 months ago) by dsl
Branch: MAIN
Changes since 1.49: +5 -1 lines
Diff to previous 1.49 (colored)

Add lwp members needed for the SYSCALL_TIMES option.
These are added unconditionally to avoid having the structure size be
option dependant.

Revision 1.48.2.2 / (download) - annotate - [select for diffs], Sun Feb 18 13:32:34 2007 UTC (15 years, 11 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.48.2.1: +0 -1 lines
Diff to previous 1.48.2.1 (colored)

remove unused lwp_exit2.

Revision 1.49 / (download) - annotate - [select for diffs], Sat Feb 17 22:31:45 2007 UTC (15 years, 11 months ago) by pavel
Branch: MAIN
Changes since 1.48: +17 -14 lines
Diff to previous 1.48 (colored)

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.

Revision 1.48.2.1 / (download) - annotate - [select for diffs], Sat Feb 17 10:31:03 2007 UTC (15 years, 11 months ago) by yamt
Branch: yamt-idlelwp
Changes since 1.48: +7 -7 lines
Diff to previous 1.48 (colored)

- separate context switching and thread scheduling.
- introduce idle lwp.
- change some related MD/MI interfaces and implement i386 version.

Revision 1.48 / (download) - annotate - [select for diffs], Thu Feb 15 15:13:10 2007 UTC (15 years, 11 months ago) by ad
Branch: MAIN
Branch point for: yamt-idlelwp
Changes since 1.47: +3 -2 lines
Diff to previous 1.47 (colored)

Restore proc::p_userret in a limited way for Linux compat. XXX

Revision 1.47 / (download) - annotate - [select for diffs], Fri Feb 9 21:55:37 2007 UTC (16 years ago) by ad
Branch: MAIN
CVS Tags: post-newlock2-merge
Changes since 1.46: +238 -79 lines
Diff to previous 1.46 (colored)

Merge newlock2 to head.

Revision 1.41.4.13 / (download) - annotate - [select for diffs], Sun Feb 4 14:05:18 2007 UTC (16 years ago) by ad
Branch: newlock2
Changes since 1.41.4.12: +9 -6 lines
Diff to previous 1.41.4.12 (colored) to branchpoint 1.41 (colored) next main 1.42 (colored)

o sigtimedwait1(): don't allocate the waitset every time. This gets
  called often enough to justify stashing it in struct lwp.
o Push kernel_lock back in a few places.

Revision 1.41.4.12 / (download) - annotate - [select for diffs], Tue Jan 30 13:51:42 2007 UTC (16 years ago) by ad
Branch: newlock2
Changes since 1.41.4.11: +4 -13 lines
Diff to previous 1.41.4.11 (colored) to branchpoint 1.41 (colored)

Remove support for SA. Ok core@.

Revision 1.41.4.11 / (download) - annotate - [select for diffs], Sat Jan 27 14:00:02 2007 UTC (16 years ago) by ad
Branch: newlock2
Changes since 1.41.4.10: +4 -4 lines
Diff to previous 1.41.4.10 (colored) to branchpoint 1.41 (colored)

Rename some functions to better describe what they do.

Revision 1.41.4.10 / (download) - annotate - [select for diffs], Thu Jan 25 20:18:37 2007 UTC (16 years ago) by ad
Branch: newlock2
Changes since 1.41.4.9: +4 -2 lines
Diff to previous 1.41.4.9 (colored) to branchpoint 1.41 (colored)

Eliminate some uses of mtsleep().

Revision 1.41.4.9 / (download) - annotate - [select for diffs], Tue Jan 16 01:26:20 2007 UTC (16 years ago) by ad
Branch: newlock2
Changes since 1.41.4.8: +3 -3 lines
Diff to previous 1.41.4.8 (colored) to branchpoint 1.41 (colored)

Minor corrections.

Revision 1.41.4.8 / (download) - annotate - [select for diffs], Fri Jan 12 01:04:24 2007 UTC (16 years, 1 month ago) by ad
Branch: newlock2
Changes since 1.41.4.7: +44 -1 lines
Diff to previous 1.41.4.7 (colored) to branchpoint 1.41 (colored)

Sync with head.

Revision 1.41.4.7 / (download) - annotate - [select for diffs], Thu Jan 11 22:23:00 2007 UTC (16 years, 1 month ago) by ad
Branch: newlock2
Changes since 1.41.4.6: +4 -5 lines
Diff to previous 1.41.4.6 (colored) to branchpoint 1.41 (colored)

Checkpoint work in progress.

Revision 1.28.2.2 / (download) - annotate - [select for diffs], Sat Dec 30 20:50:55 2006 UTC (16 years, 1 month ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28.2.1: +25 -4 lines
Diff to previous 1.28.2.1 (colored)

sync with head.

Revision 1.41.4.6 / (download) - annotate - [select for diffs], Fri Dec 29 20:27:45 2006 UTC (16 years, 1 month ago) by ad
Branch: newlock2
Changes since 1.41.4.5: +110 -102 lines
Diff to previous 1.41.4.5 (colored) to branchpoint 1.41 (colored)

Checkpoint work in progress.

Revision 1.41.6.2 / (download) - annotate - [select for diffs], Sun Dec 10 07:19:28 2006 UTC (16 years, 2 months ago) by yamt
Branch: yamt-splraiseipl
Changes since 1.41.6.1: +4 -1 lines
Diff to previous 1.41.6.1 (colored) to branchpoint 1.41 (colored) next main 1.42 (colored)

sync with head.

Revision 1.41.4.5 / (download) - annotate - [select for diffs], Sat Nov 18 21:39:47 2006 UTC (16 years, 2 months ago) by ad
Branch: newlock2
Changes since 1.41.4.4: +16 -2 lines
Diff to previous 1.41.4.4 (colored) to branchpoint 1.41 (colored)

Sync with head.

Revision 1.41.4.4 / (download) - annotate - [select for diffs], Fri Nov 17 16:34:40 2006 UTC (16 years, 2 months ago) by ad
Branch: newlock2
Changes since 1.41.4.3: +78 -22 lines
Diff to previous 1.41.4.3 (colored) to branchpoint 1.41 (colored)

Checkpoint work in progress.

Revision 1.41.4.3 / (download) - annotate - [select for diffs], Tue Oct 24 21:10:21 2006 UTC (16 years, 3 months ago) by ad
Branch: newlock2
Changes since 1.41.4.2: +12 -47 lines
Diff to previous 1.41.4.2 (colored) to branchpoint 1.41 (colored)

- Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().

Revision 1.46 / (download) - annotate - [select for diffs], Tue Oct 24 10:05:45 2006 UTC (16 years, 3 months ago) by hannken
Branch: MAIN
CVS Tags: yamt-splraiseipl-base5, yamt-splraiseipl-base4, yamt-splraiseipl-base3, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, newlock2-nbase, newlock2-base, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, matt-nb4-arm-base, matt-nb4-arm
Changes since 1.45: +4 -1 lines
Diff to previous 1.45 (colored)

Remove specificdata_setspecific_nowait() as result of discussion on tech-kern.

Add _lwp_getspecific_by_lwp() to get lwp specific data from other lwp's.
Protected by #ifdef _LWP_API_PRIVATE.

Approved by: Jason Thorpe <thorpej@netbsd.org>

Revision 1.41.6.1 / (download) - annotate - [select for diffs], Sun Oct 22 06:07:47 2006 UTC (16 years, 3 months ago) by yamt
Branch: yamt-splraiseipl
Changes since 1.41: +13 -2 lines
Diff to previous 1.41 (colored)

sync with head

Revision 1.41.4.2 / (download) - annotate - [select for diffs], Sat Oct 21 15:20:48 2006 UTC (16 years, 3 months ago) by ad
Branch: newlock2
Changes since 1.41.4.1: +132 -42 lines
Diff to previous 1.41.4.1 (colored) to branchpoint 1.41 (colored)

Checkpoint work in progress on locking and per-LWP signals. Very much a
a work in progress and there is still a lot to do.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Oct 11 04:51:06 2006 UTC (16 years, 4 months ago) by thorpej
Branch: MAIN
CVS Tags: yamt-splraiseipl-base2
Changes since 1.44: +2 -1 lines
Diff to previous 1.44 (colored)

Don't free specificdata in lwp_exit2(); it's not safe to block there.
Instead, free an LWP's specificdata from lwp_exit() (if it is not the
last LWP) or exit1() (if it is the last LWP).  For consistency, free the
proc's specificdata from exit1() as well.  Add lwp_finispecific() and
proc_finispecific() functions to make this more convenient.

Revision 1.44 / (download) - annotate - [select for diffs], Wed Oct 11 03:46:42 2006 UTC (16 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored)

Upon further reflection, make lwp_{get,set}specific() operate only on
curlwp.  Things that need to operate on "other" LWPs will get a very
special (and very private) API for their needs.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Oct 8 22:57:11 2006 UTC (16 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.42: +2 -1 lines
Diff to previous 1.42 (colored)

add {proc,lwp}_initspecific and use them to init proc0 and lwp0.

Revision 1.42 / (download) - annotate - [select for diffs], Sun Oct 8 04:28:44 2006 UTC (16 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.41: +11 -2 lines
Diff to previous 1.41 (colored)

Add specificdata support to procs and lwps, each providing their own
wrappers around the speicificdata subroutines.  Also:
- Call the new lwpinit() function from main() after calling procinit().
- Move some pool initialization out of kern_proc.c and into files that
  are directly related to the pools in question (kern_lwp.c and kern_ras.c).
- Convert uipc_sem.c to proc_{get,set}specific(), and eliminate the p_ksems
  member from struct proc.

Revision 1.41.4.1 / (download) - annotate - [select for diffs], Mon Sep 11 18:19:09 2006 UTC (16 years, 5 months ago) by ad
Branch: newlock2
Changes since 1.41: +4 -2 lines
Diff to previous 1.41 (colored)

- Allocate and free turnstiles where needed.
- Split proclist_mutex and alllwp_mutex out of the proclist_lock,
  and use in interrupt context.
- Fix an MP race in enterpgrp()/setsid().
- Acquire proclist_lock and p_crmutex in some obvious places.

Revision 1.32.4.1 / (download) - annotate - [select for diffs], Sat Sep 9 02:59:42 2006 UTC (16 years, 5 months ago) by rpaulo
Branch: rpaulo-netinet-merge-pcb
Changes since 1.32: +31 -15 lines
Diff to previous 1.32 (colored) next main 1.33 (colored)

sync with head

Revision 1.33.2.3 / (download) - annotate - [select for diffs], Fri Aug 11 15:47:26 2006 UTC (16 years, 6 months ago) by yamt
Branch: yamt-pdpolicy
Changes since 1.33.2.2: +10 -3 lines
Diff to previous 1.33.2.2 (colored) to branchpoint 1.33 (colored) next main 1.34 (colored)

sync with head

Revision 1.41 / (download) - annotate - [select for diffs], Sun Jul 30 21:58:11 2006 UTC (16 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: yamt-splraiseipl-base, yamt-pdpolicy-base9, yamt-pdpolicy-base8, yamt-pdpolicy-base7, rpaulo-netinet-merge-pcb-base, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: yamt-splraiseipl, newlock2
Changes since 1.40: +1 -2 lines
Diff to previous 1.40 (colored)

Single-thread updates to the process credential.

Revision 1.40 / (download) - annotate - [select for diffs], Thu Jul 20 00:17:10 2006 UTC (16 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.39: +2 -3 lines
Diff to previous 1.39 (colored)

Try again.. Move l_cred into the startzero section, and fix the define.
Doesn't change the layout of struct lwp.

Revision 1.39 / (download) - annotate - [select for diffs], Wed Jul 19 22:06:09 2006 UTC (16 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (colored)

Move l_acflag into the section that gets zeroed in newlwp().

Revision 1.38 / (download) - annotate - [select for diffs], Wed Jul 19 21:11:38 2006 UTC (16 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.37: +11 -2 lines
Diff to previous 1.37 (colored)

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.

Revision 1.28.2.1 / (download) - annotate - [select for diffs], Wed Jun 21 15:12:03 2006 UTC (16 years, 7 months ago) by yamt
Branch: yamt-lazymbuf
Changes since 1.28: +28 -18 lines
Diff to previous 1.28 (colored)

sync with head.

Revision 1.36.2.1 / (download) - annotate - [select for diffs], Mon Jun 19 04:11:12 2006 UTC (16 years, 7 months ago) by chap
Branch: chap-midi
Changes since 1.36: +9 -1 lines
Diff to previous 1.36 (colored) next main 1.37 (colored)

Sync with head.

Revision 1.32.6.2 / (download) - annotate - [select for diffs], Thu Jun 1 22:39:26 2006 UTC (16 years, 8 months ago) by kardel
Branch: simonb-timecounters
CVS Tags: simonb-timcounters-final
Changes since 1.32.6.1: +9 -1 lines
Diff to previous 1.32.6.1 (colored) next main 1.33 (colored)

Sync with head.

Revision 1.33.6.2 / (download) - annotate - [select for diffs], Wed May 24 15:50:47 2006 UTC (16 years, 8 months ago) by tron
Branch: peter-altq
Changes since 1.33.6.1: +15 -7 lines
Diff to previous 1.33.6.1 (colored) to branchpoint 1.33 (colored) next main 1.34 (colored)

Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.

Revision 1.33.2.2 / (download) - annotate - [select for diffs], Wed May 24 10:59:21 2006 UTC (16 years, 8 months ago) by yamt
Branch: yamt-pdpolicy
Changes since 1.33.2.1: +9 -1 lines
Diff to previous 1.33.2.1 (colored) to branchpoint 1.33 (colored)

sync with head.

Revision 1.37 / (download) - annotate - [select for diffs], Mon May 22 13:43:54 2006 UTC (16 years, 8 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-pdpolicy-base6, yamt-pdpolicy-base5, simonb-timecounters-base, gdamore-uart-base, gdamore-uart, chap-midi-nbase, chap-midi-base
Changes since 1.36: +9 -1 lines
Diff to previous 1.36 (colored)

introduce macros, UAREA_TO_USER and USER_TO_UAREA,
to convert uarea VA into a pointer to struct user and vice versa,
so that MD code can change the layout in uarea.

Revision 1.32.6.1 / (download) - annotate - [select for diffs], Sat Apr 22 11:40:18 2006 UTC (16 years, 9 months ago) by simonb
Branch: simonb-timecounters
Changes since 1.32: +14 -13 lines
Diff to previous 1.32 (colored)

Sync with head.

Revision 1.33.4.1 / (download) - annotate - [select for diffs], Wed Apr 19 04:36:01 2006 UTC (16 years, 9 months ago) by elad
Branch: elad-kernelauth
Changes since 1.33: +13 -12 lines
Diff to previous 1.33 (colored) next main 1.34 (colored)

sync with head.

Revision 1.26.2.2 / (download) - annotate - [select for diffs], Fri Apr 7 12:27:23 2006 UTC (16 years, 10 months ago) by tron
Branch: netbsd-3
CVS Tags: netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1
Changes since 1.26.2.1: +13 -13 lines
Diff to previous 1.26.2.1 (colored) to branchpoint 1.26 (colored) next main 1.27 (colored)

Pull up following revision(s) (requested by pavel in ticket #1244):
	sys/sys/lwp.h: revision 1.35 via patch
Following the example of sys/sys/proc.h rev. 1.164, pad the LWP flags to 8
chars. It is nicer and makes the comparison of proc and lwp flags much
easier.

Revision 1.33.2.1 / (download) - annotate - [select for diffs], Sat Apr 1 12:07:51 2006 UTC (16 years, 10 months ago) by yamt
Branch: yamt-pdpolicy
Changes since 1.33: +13 -12 lines
Diff to previous 1.33 (colored)

sync with head.

Revision 1.36 / (download) - annotate - [select for diffs], Sat Apr 1 00:57:34 2006 UTC (16 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pdpolicy-base4, yamt-pdpolicy-base3, elad-kernelauth-base
Branch point for: chap-midi
Changes since 1.35: +7 -7 lines
Diff to previous 1.35 (colored)

PR/32809: Pavel Cahyna: Conflicting flags in l_flag and p_flag are causing
ps(1) to print incorrect information. Annotate the flags in the header files
to make sure that flags are not being re-used and move flags so that there
are no conflicts.

Revision 1.33.6.1 / (download) - annotate - [select for diffs], Fri Mar 31 09:45:29 2006 UTC (16 years, 10 months ago) by tron
Branch: peter-altq
Changes since 1.33: +12 -11 lines
Diff to previous 1.33 (colored)

Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.

Revision 1.35 / (download) - annotate - [select for diffs], Thu Mar 30 07:08:40 2006 UTC (16 years, 10 months ago) by pavel
Branch: MAIN
Changes since 1.34: +11 -11 lines
Diff to previous 1.34 (colored)

Following the example of sys/sys/proc.h rev. 1.164, pad the LWP flags to 8
chars. It is nicer and makes the comparison of proc and lwp flags much
easier.

Revision 1.34 / (download) - annotate - [select for diffs], Wed Mar 29 23:02:31 2006 UTC (16 years, 10 months ago) by cube
Branch: MAIN
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored)

Rework the _lwp* and sa_* families of syscalls so some details can be
handled differently depending on the emulation.  This paves the way for
COMPAT_NETBSD32 support of our pthread system.

Revision 1.32.2.1 / (download) - annotate - [select for diffs], Sat Feb 18 15:39:23 2006 UTC (16 years, 11 months ago) by yamt
Branch: yamt-uio_vmspace
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored) next main 1.33 (colored)

sync with head.

Revision 1.33 / (download) - annotate - [select for diffs], Thu Feb 16 20:17:20 2006 UTC (16 years, 11 months ago) by perry
Branch: MAIN
CVS Tags: yamt-uio_vmspace-base5, yamt-pdpolicy-base2, yamt-pdpolicy-base, peter-altq-base
Branch point for: yamt-pdpolicy, peter-altq, elad-kernelauth
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.

Revision 1.32 / (download) - annotate - [select for diffs], Sat Dec 24 19:01:28 2005 UTC (17 years, 1 month ago) by perry
Branch: MAIN
Branch point for: yamt-uio_vmspace, simonb-timecounters, rpaulo-netinet-merge-pcb
Changes since 1.31: +3 -3 lines
Diff to previous 1.31 (colored)

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.

Revision 1.6.2.5 / (download) - annotate - [select for diffs], Sun Dec 11 10:29:36 2005 UTC (17 years, 2 months ago) by christos
Branch: ktrace-lwp
Changes since 1.6.2.4: +3 -3 lines
Diff to previous 1.6.2.4 (colored) next main 1.7 (colored)

Sync with head.

Revision 1.31 / (download) - annotate - [select for diffs], Sat Dec 3 17:10:46 2005 UTC (17 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: ktrace-lwp-base
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

Make sure that multiple header inclusion is done, it uses consistent names,
and it is around the whole code of the file, not parts of it.

Revision 1.6.2.4 / (download) - annotate - [select for diffs], Thu Nov 10 14:12:12 2005 UTC (17 years, 3 months ago) by skrll
Branch: ktrace-lwp
Changes since 1.6.2.3: +8 -8 lines
Diff to previous 1.6.2.3 (colored)

Sync with HEAD. Here we go again...

Revision 1.30 / (download) - annotate - [select for diffs], Sat Oct 1 06:12:44 2005 UTC (17 years, 4 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-vop-base3, yamt-vop-base2, yamt-vop-base, yamt-vop, yamt-readahead-pervnode, yamt-readahead-perfile, yamt-readahead-base3, yamt-readahead-base2, yamt-readahead-base, yamt-readahead, thorpej-vnode-attr-base, thorpej-vnode-attr
Changes since 1.29: +1 -2 lines
Diff to previous 1.29 (colored)

simplify lwp exit code.

Revision 1.29 / (download) - annotate - [select for diffs], Sat Jul 16 17:50:26 2005 UTC (17 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.28: +3 -1 lines
Diff to previous 1.28 (colored)

Don't leak kernel external variables to userland. This file is included
from <sys/sysctl.h>.

Revision 1.28 / (download) - annotate - [select for diffs], Sun May 29 21:16:44 2005 UTC (17 years, 8 months ago) by christos
Branch: MAIN
Branch point for: yamt-lazymbuf
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

make the wait channel volatile.

Revision 1.26.2.1 / (download) - annotate - [select for diffs], Wed May 11 18:04:58 2005 UTC (17 years, 9 months ago) by tron
Branch: netbsd-3
CVS Tags: netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0
Changes since 1.26: +5 -6 lines
Diff to previous 1.26 (colored)

Pull up revision 1.27 (requested by yamt in ticket #291):
move l_private and l_locks so that they're initialized.

Revision 1.27 / (download) - annotate - [select for diffs], Wed May 4 23:22:44 2005 UTC (17 years, 9 months ago) by yamt
Branch: MAIN
Changes since 1.26: +5 -6 lines
Diff to previous 1.26 (colored)

move l_private and l_locks so that they're initialized.

Revision 1.24.4.1 / (download) - annotate - [select for diffs], Fri Apr 29 11:29:37 2005 UTC (17 years, 9 months ago) by kent
Branch: kent-audio2
Changes since 1.24: +3 -2 lines
Diff to previous 1.24 (colored) next main 1.25 (colored)

sync with -current

Revision 1.21.4.1 / (download) - annotate - [select for diffs], Sun Mar 20 11:58:59 2005 UTC (17 years, 10 months ago) by tron
Branch: netbsd-2
CVS Tags: netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1
Changes since 1.21: +2 -1 lines
Diff to previous 1.21 (colored) next main 1.22 (colored)

Pull up revision 1.25 via patch (requested by chs in ticket #1160):
define a new LWP flag which indicates that we're in the process of
doing a context switch.  use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).

Revision 1.21.2.1 / (download) - annotate - [select for diffs], Sun Mar 20 11:58:55 2005 UTC (17 years, 10 months ago) by tron
Branch: netbsd-2-0
CVS Tags: netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE
Changes since 1.21: +2 -1 lines
Diff to previous 1.21 (colored) next main 1.22 (colored)

Pull up revision 1.25 via patch (requested by chs in ticket #1160):
define a new LWP flag which indicates that we're in the process of
doing a context switch.  use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).

Revision 1.24.6.2 / (download) - annotate - [select for diffs], Sat Mar 19 08:36:52 2005 UTC (17 years, 10 months ago) by yamt
Branch: yamt-km
Changes since 1.24.6.1: +2 -2 lines
Diff to previous 1.24.6.1 (colored) to branchpoint 1.24 (colored) next main 1.25 (colored)

sync with head.  xen and whitespace.  xen part is not finished.

Revision 1.6.2.3 / (download) - annotate - [select for diffs], Fri Mar 4 16:54:22 2005 UTC (17 years, 11 months ago) by skrll
Branch: ktrace-lwp
Changes since 1.6.2.2: +2 -2 lines
Diff to previous 1.6.2.2 (colored)

Sync with HEAD.

Hi Perry!

Revision 1.26 / (download) - annotate - [select for diffs], Sat Feb 26 22:25:34 2005 UTC (17 years, 11 months ago) by perry
Branch: MAIN
CVS Tags: yamt-km-base4, yamt-km-base3, netbsd-3-base, kent-audio2-base
Branch point for: netbsd-3
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

nuke trailing whitespace

Revision 1.24.6.1 / (download) - annotate - [select for diffs], Sat Feb 12 18:17:55 2005 UTC (18 years ago) by yamt
Branch: yamt-km
Changes since 1.24: +2 -1 lines
Diff to previous 1.24 (colored)

sync with head.

Revision 1.6.2.2 / (download) - annotate - [select for diffs], Fri Feb 4 11:48:06 2005 UTC (18 years ago) by skrll
Branch: ktrace-lwp
Changes since 1.6.2.1: +2 -1 lines
Diff to previous 1.6.2.1 (colored)

Sync with HEAD.

Revision 1.25 / (download) - annotate - [select for diffs], Sun Jan 30 16:56:27 2005 UTC (18 years ago) by chs
Branch: MAIN
CVS Tags: yamt-km-base2
Changes since 1.24: +2 -1 lines
Diff to previous 1.24 (colored)

define a new LWP flag which indicates that we're in the process of
doing a context switch.  use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).

Revision 1.6.2.1 / (download) - annotate - [select for diffs], Tue Aug 3 10:56:28 2004 UTC (18 years, 6 months ago) by skrll
Branch: ktrace-lwp
Changes since 1.6: +11 -10 lines
Diff to previous 1.6 (colored)

Sync with HEAD

Revision 1.24 / (download) - annotate - [select for diffs], Sun Jul 18 21:26:52 2004 UTC (18 years, 6 months ago) by chs
Branch: MAIN
CVS Tags: yamt-km-base, kent-audio1-beforemerge, kent-audio1-base, kent-audio1
Branch point for: yamt-km, kent-audio2
Changes since 1.23: +1 -2 lines
Diff to previous 1.23 (colored)

remove unneeded include.

Revision 1.23 / (download) - annotate - [select for diffs], Sun Jun 20 18:55:58 2004 UTC (18 years, 7 months ago) by hannken
Branch: MAIN
Changes since 1.22: +2 -1 lines
Diff to previous 1.22 (colored)

- Add flag L_COWINPROGRESS to struct lwp to avoid recursion when
  doing copy-on-write.

- Change VFS_SNAPSHOT() to return the snapshot vnode locked.

- Make the IO path for copy-on-write and snapshot-read more lightweight.
  Avoids deadlocks where vn_rdwr(...READ...) has a shared lock and needs
  to copy-on-write.
  Avoids deadlocks/panics where to clean pages the copy-on-write needs
  to allocate pages for its VOP_PUTPAGES().

L_COWINPROGRESS part approved by: Jason R. Thorpe <thorpej@netbsd.org>

Revision 1.22 / (download) - annotate - [select for diffs], Tue May 18 11:59:11 2004 UTC (18 years, 8 months ago) by yamt
Branch: MAIN
Changes since 1.21: +1 -2 lines
Diff to previous 1.21 (colored)

use lockstatus() instead of L_BIGLOCK to check if we're holding a biglock.
fix PR/25595.

Revision 1.21 / (download) - annotate - [select for diffs], Sun Mar 14 01:08:47 2004 UTC (18 years, 11 months ago) by cl
Branch: MAIN
CVS Tags: netbsd-2-base, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-1-RELEASE
Branch point for: netbsd-2-0, netbsd-2
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
  * VP id
  * lock on VP data
  * LWP on VP
  * recently blocked LWP on VP
  * queue of LWPs woken which ran on this VP before sleep
  * faultaddr
  * LWP cache for upcalls
  * upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP

Revision 1.20 / (download) - annotate - [select for diffs], Sun Mar 14 00:45:21 2004 UTC (18 years, 11 months ago) by cl
Branch: MAIN
Changes since 1.19: +2 -4 lines
Diff to previous 1.19 (colored)

g/c sys_sa_unblockyield which has been unused since 2004/01/02

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jan 11 18:37:52 2004 UTC (19 years, 1 month ago) by jdolecek
Branch: MAIN
Changes since 1.18: +1 -2 lines
Diff to previous 1.18 (colored)

ride 1.6ZH version bump - g/c some unused struct lwp and struct proc
fields (former reaper stuff)

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jan 4 11:33:31 2004 UTC (19 years, 1 month ago) by jdolecek
Branch: MAIN
Changes since 1.17: +3 -4 lines
Diff to previous 1.17 (colored)

Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
  as FPU state), and is the last potentially blocking operation;
  all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
  by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
  for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread

Revision 1.17 / (download) - annotate - [select for diffs], Fri Jan 2 18:52:17 2004 UTC (19 years, 1 month ago) by cl
Branch: MAIN
Changes since 1.16: +3 -1 lines
Diff to previous 1.16 (colored)

kernel part of no-syscall upcall stack return:  libpthread registers
an offset between ss_sp and struct sa_stackinfo_t (located in struct
__pthread_st) when calling sa_register.  The kernel increments the
sast_gen counter in struct sastack when an upcall stack is used.
libpthread increments the sasi_stackgen counter in struct
sa_stackinfo_t when an upcall stack is freed.  The kernel compares the
two counters to decide if a stack is free or in use.

- add struct sa_stackinfo_t with sasi_stackgen to count stack use in
  userland
- add sast_gen to struct sastack to count stack use in kernel
- add SA_FLAG_STACKINFO to enable the stackinfo_offset argument in the
  sa_register syscall
- add sa_stackinfo_offset to struct sadata for offset between ss_sp
  and struct sa_stackinfo_t
- add ssize_t stackinfo_offset argument to sa_register, initialize
  struct sadata's sa_stackinfo_offset from it if SA_FLAG_STACKINFO is
  set
- add sa_getstack, sa_getstack0, sa_stackused and sa_setstackfree
  functions to find/use/free upcall stacks and use these where
  appropriate
- don't record stack for upcall in sa_upcall0
- pass sau to sa_switchcall instead of l2 (l2 = curlwp in sa_switchcall)
- add sa_vp_blocker to struct sadata to pass recently blocked lwp to
  sa_switchcall
- delay finding a stack for blocked upcalls to sa_switchcall
- add sa_stacknext to struct sadata pointing to next most likely free
  upcall stack; also g/c sa_stackslist in struct sadata and sast_list
  in struct sastack
- add L_SA_WOKEN flag: LWP is on sa_woken queue
- add L_SA_RECYCLE flag: LWP should be recycled in sa_setwoken
- replace l_upcallstack with L_SA_WOKEN/L_SA_RECYCLE/L_SA_BLOCKING
  flags
- g/c now unused sast_blocker in struct sastack
- make sa_switchcall, sa_upcall0 and sa_upcall_getstate static in
  kern_sa.c
- call sa_upcall_userret only once in userret
- split sa_makeupcalls out of sa_upcall_userret and use to process
  the sa_upcalls queue
- on process exit: mark LWPs sleeping in saunblock interruptible; also
  there are no LWPs sleeping on l->l_upcallstack anymore; also clear
  sa_wokenq_head to prevent unblocked upcalls

additional changes:
- cleanup timerupcall sa_vp == curlwp check
- add check in sa_yield if we didn't block on our way here and we
  wouldn't any longer be the LWP on the VP
- invalidate sa_vp_ofaultaddr after resolving pagefault

Revision 1.16 / (download) - annotate - [select for diffs], Wed Dec 24 22:42:11 2003 UTC (19 years, 1 month ago) by manu
Branch: MAIN
Changes since 1.15: +2 -1 lines
Diff to previous 1.15 (colored)

Split sys_lwp_suspend, just like sys_lwp_unsuspend is split. We get
sys_lwp_suspend, with the sanity checks, and lwp_suspend, with the
actual implementation.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Dec 20 18:22:16 2003 UTC (19 years, 1 month ago) by manu
Branch: MAIN
Changes since 1.14: +1 -3 lines
Diff to previous 1.14 (colored)

Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.

Revision 1.14 / (download) - annotate - [select for diffs], Mon Nov 17 22:52:09 2003 UTC (19 years, 2 months ago) by cl
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

- use list to keep track of free stacks.
- use splay tree for the pagefault check if the thread was running on
  an upcall stack.

=> removes the limitation that all upcall stacks need to be
   adjoining and that all upcall stacks have to be loaded with the
   1st sys_sa_stacks call.
=> enables keeping information associated with a stack in the kernel
   which makes it simpler to find out which LWP is using a stack.
=> allows increasing the SA_MAXNUMSTACKS without having to
   allocate an array of that size.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Nov 3 22:34:51 2003 UTC (19 years, 3 months ago) by cl
Branch: MAIN
Changes since 1.12: +1 -2 lines
Diff to previous 1.12 (colored)

Reimplement VP donation such that multiple unblocked upcalls can be
combined.  Also prepare for adding VP repossession later.

- kern_sa.c: sa_yield/sa_switch: detect if there are pending unblocked
  upcalls.
- kern_sa.c: sa_unblock_userret/sa_setwoken: queue LWPs about to invoke
  an unblocked upcall on the sa_wokenq.  put queued LWPs in a state where
  they can be put in the cache.  notify LWP on the VP about pending
  upcalls.
- kern_sa.c: sa_upcall_userret: check sa_wokenq for pending upcalls,
  generate unblocked upcalls with multiple event sas
- kern_sa.c: sa_vp_repossess/sa_vp_donate: g/c, restore original
  sa_vp_repossess

Revision 1.12 / (download) - annotate - [select for diffs], Sun Nov 2 16:26:10 2003 UTC (19 years, 3 months ago) by cl
Branch: MAIN
Changes since 1.11: +5 -3 lines
Diff to previous 1.11 (colored)

Cleanup signal delivery for SA processes:
General idea:  only consider the LWP on the VP for signal delivery, all
other LWPs are either asleep or running from waking up until repossessing
the VP.

- in kern_sig.c:kpsignal2: handle all states the LWP on the VP can be in
- in kern_sig.c:proc_stop: only try to stop the LWP on the VP.  All other
  LWPs will suspend in sa_vp_repossess() until the VP-LWP donates the VP.
  Restore original behaviour (before SA-specific hacks were added) for
  non-SA processes.
- in kern_sig.c:proc_unstop: only return the LWP on the VP
- handle sa_yield as case 0 in sa_switch instead of clearing L_SA, add an
  L_SA_YIELD flag
- replace sa_idle by L_SA_IDLE flag since it was either NULL or == sa_vp

Also don't output itimerfire overrun warning if the process is already
exiting.
Also g/c sa_woken because it's not used.
Also g/c some #if 0 code.

Revision 1.11 / (download) - annotate - [select for diffs], Tue Sep 16 13:46:26 2003 UTC (19 years, 4 months ago) by cl
Branch: MAIN
Changes since 1.10: +3 -1 lines
Diff to previous 1.10 (colored)

fix SA/pthread pagefault failure:
- prevent BLOCKED upcalls on double page faults and during upcalls
- make libpthread handle blocked threads which hold locks
- prevent UNBLOCKED upcalls from overtaking their BLOCKED upcall
this adds a new syscall sa_unblockyield
see also http://mail-index.netbsd.org/tech-kern/2003/09/15/0020.html

Revision 1.10 / (download) - annotate - [select for diffs], Sat Sep 13 08:32:18 2003 UTC (19 years, 5 months ago) by jdolecek
Branch: MAIN
Changes since 1.9: +2 -1 lines
Diff to previous 1.9 (colored)

move dupfd from struct proc to struct lwp - it's per-LWP, not per-process; we
use curlwp where the lwp is not directly available, i.e. in device open
routines

briefly discussed on tech-kern

Revision 1.9 / (download) - annotate - [select for diffs], Sat Sep 13 07:56:03 2003 UTC (19 years, 5 months ago) by jdolecek
Branch: MAIN
Changes since 1.8: +2 -3 lines
Diff to previous 1.8 (colored)

move l_ctxlink in struct definition to 'zero' region visually too, to
make it more clear that l_ctxlink _is_ zeroed

Revision 1.8 / (download) - annotate - [select for diffs], Mon Jul 28 23:35:21 2003 UTC (19 years, 6 months ago) by matt
Branch: MAIN
Changes since 1.7: +2 -1 lines
Diff to previous 1.7 (colored)

Improve _lwp_wakeup so when it wakes a thread, the target thread thinks
ltsleep has been interrupted and thus the target will not think it was
a spurious wakeup.  (this makes syscalls cancellable for libpthread).

Revision 1.7 / (download) - annotate - [select for diffs], Thu Jul 17 18:16:59 2003 UTC (19 years, 6 months ago) by fvdl
Branch: MAIN
Changes since 1.6: +2 -1 lines
Diff to previous 1.6 (colored)

Changes from Stephan Uphoff to patch problems with LWPs blocking when they
shouldn't, and MP.

Revision 1.6 / (download) - annotate - [select for diffs], Tue Feb 4 13:41:48 2003 UTC (20 years ago) by yamt
Branch: MAIN
Branch point for: ktrace-lwp
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

constify wait channels of ltsleep/wakeup.  they are never dereferenced.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Feb 2 20:34:42 2003 UTC (20 years ago) by matt
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

Move l_flags to after l_cpu to save 4 bytes on LP64 machines.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Jan 30 19:14:18 2003 UTC (20 years ago) by manu
Branch: MAIN
Changes since 1.3: +3 -1 lines
Diff to previous 1.3 (colored)

For cproc_t, use a per thread value instead of a per process value. ifdef
out l_emuldata in struct lwp until we actually use it.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Jan 21 04:06:06 2003 UTC (20 years ago) by matt
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

Do a preliminary switchover of the mach code to lwp's.  It compiles now
but probably doesn't work.   That's for someone who understand this code
better.

Revision 1.2 / (download) - annotate - [select for diffs], Sat Jan 18 09:53:16 2003 UTC (20 years ago) by thorpej
Branch: MAIN
Changes since 1.1: +187 -0 lines
Diff to previous 1.1 (colored)

Merge the nathanw_sa branch.

Revision 1.1.2.24 / (download) - annotate - [select for diffs], Tue Jan 7 22:12:09 2003 UTC (20 years, 1 month ago) by thorpej
Branch: nathanw_sa
CVS Tags: nathanw_sa_end
Changes since 1.1.2.23: +1 -1 lines
Diff to previous 1.1.2.23 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

In the SA universe, the switch-to-this-LWP decision is made at a
different level than where preempt() calls are made, which renders
the "newlwp" argument useless.  Replace it with a "more work to do"
boolean argument.  Returning to userspace preempt() calls pass 0.
"Voluntary" preemptions in e.g. uiomove() pass 1.  This will be used
to indicate to the SA subsystem that the LWP is not yet finished in
the kernel.

Collapse the SA vs. non-SA cases of preempt() together, making the
conditional code block much smaller, and don't call sa_preempt() if
more work is to come.

NOTE: THIS IS NOT A COMPLETE FIX TO THE preempt()-in-uiomove() PROBLEM
THAT CURRENTLY EXISTS FOR SA PROCESSES.

Revision 1.1.2.23 / (download) - annotate - [select for diffs], Tue Dec 31 01:03:52 2002 UTC (20 years, 1 month ago) by thorpej
Branch: nathanw_sa
Changes since 1.1.2.22: +2 -2 lines
Diff to previous 1.1.2.22 (colored) to branchpoint 1.1 (colored)

Rename cpu_preempt() to cpu_switchto(), and make the caller remove the
new process from its run queue before calling cpu_switchto().

While here, make a few cpu_switch() and cpu_switchto() implementations
get the outgoing LWP from the args, rather than looking at the curlwp
variable.

Revision 1.1.2.22 / (download) - annotate - [select for diffs], Mon Dec 30 18:28:01 2002 UTC (20 years, 1 month ago) by thorpej
Branch: nathanw_sa
Changes since 1.1.2.21: +2 -0 lines
Diff to previous 1.1.2.21 (colored) to branchpoint 1.1 (colored)

Like cpu_switch(), allow cpu_preempt() to be a CPP macro.

Revision 1.1.2.21 / (download) - annotate - [select for diffs], Sun Dec 29 21:07:37 2002 UTC (20 years, 1 month ago) by thorpej
Branch: nathanw_sa
Changes since 1.1.2.20: +1 -1 lines
Diff to previous 1.1.2.20 (colored) to branchpoint 1.1 (colored)

$Id$ -> $NetBSD$

Revision 1.1.2.20 / (download) - annotate - [select for diffs], Sun Dec 15 23:31:59 2002 UTC (20 years, 1 month ago) by thorpej
Branch: nathanw_sa
Changes since 1.1.2.19: +2 -2 lines
Diff to previous 1.1.2.19 (colored) to branchpoint 1.1 (colored)

Add an "inmem" argument to newlwp(), and use it to properly set
up L_INMEM in the new LWP.  Should fix a problem mentioned to me
by Nick Hudson.

Revision 1.1.2.19 / (download) - annotate - [select for diffs], Wed Dec 4 21:59:09 2002 UTC (20 years, 2 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.18: +2 -2 lines
Diff to previous 1.1.2.18 (colored) to branchpoint 1.1 (colored)

Typo in comment.

Revision 1.1.2.18 / (download) - annotate - [select for diffs], Fri Oct 18 04:06:45 2002 UTC (20 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.17: +2 -2 lines
Diff to previous 1.1.2.17 (colored) to branchpoint 1.1 (colored)

Fix cpu_switch() prototype.

Revision 1.1.2.17 / (download) - annotate - [select for diffs], Fri Oct 18 03:30:14 2002 UTC (20 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.16: +4 -1 lines
Diff to previous 1.1.2.16 (colored) to branchpoint 1.1 (colored)

Sort out the location of a few interface definitions.

Revision 1.1.2.16 / (download) - annotate - [select for diffs], Fri Jul 26 01:19:09 2002 UTC (20 years, 6 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.15: +2 -1 lines
Diff to previous 1.1.2.15 (colored) to branchpoint 1.1 (colored)

Add prototype for lwp_continue().

Revision 1.1.2.15 / (download) - annotate - [select for diffs], Thu Jul 25 22:32:40 2002 UTC (20 years, 6 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.14: +1 -4 lines
Diff to previous 1.1.2.14 (colored) to branchpoint 1.1 (colored)

Remove prototypes for one defunct function and one nonexistent
function.

Revision 1.1.2.14 / (download) - annotate - [select for diffs], Mon Jun 24 22:12:18 2002 UTC (20 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.13: +2 -1 lines
Diff to previous 1.1.2.13 (colored) to branchpoint 1.1 (colored)

Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).

Revision 1.1.2.13 / (download) - annotate - [select for diffs], Wed Apr 24 04:20:28 2002 UTC (20 years, 9 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.12: +2 -2 lines
Diff to previous 1.1.2.12 (colored) to branchpoint 1.1 (colored)

Change the value of L_DETACHED so as not to collide with P_TRACED, to
avoid unfortunate interpretation by ps(1).

Revision 1.1.2.12 / (download) - annotate - [select for diffs], Thu Mar 28 22:07:57 2002 UTC (20 years, 10 months ago) by ragge
Branch: nathanw_sa
Changes since 1.1.2.11: +7 -1 lines
Diff to previous 1.1.2.11 (colored) to branchpoint 1.1 (colored)

No prototypes for remrunqueue, setrunqueue and cpu_switch if they are macros.

Revision 1.1.2.11 / (download) - annotate - [select for diffs], Mon Dec 17 20:37:35 2001 UTC (21 years, 1 month ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.10: +2 -1 lines
Diff to previous 1.1.2.10 (colored) to branchpoint 1.1 (colored)

Add L_SA_BLOCKING flag, which indicates that a LWP has been blocked by
a call to tsleep().

Revision 1.1.2.10 / (download) - annotate - [select for diffs], Thu Nov 29 01:22:57 2001 UTC (21 years, 2 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.9: +2 -1 lines
Diff to previous 1.1.2.9 (colored) to branchpoint 1.1 (colored)

Make proc_representative_lwp() non-static and move it to kern_lwp.c.

Revision 1.1.2.9 / (download) - annotate - [select for diffs], Tue Nov 27 03:17:19 2001 UTC (21 years, 2 months ago) by thorpej
Branch: nathanw_sa
Changes since 1.1.2.8: +2 -1 lines
Diff to previous 1.1.2.8 (colored) to branchpoint 1.1 (colored)

Make lockmgr() lwp-aware:
- Locks are counted against LWPs, not procs.
- When we record the lockholder in the lock structure, we need to
  also record the lwpid.
- When we are checking who holds the lock, also consider lwpid.

Fixes a "locking against myself" panic reported by Allen Briggs that
could be easily triggered by redirecting the output of an LWP-using
program to a file.

Revision 1.1.2.8 / (download) - annotate - [select for diffs], Sat Nov 17 00:44:07 2001 UTC (21 years, 2 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.7: +2 -2 lines
Diff to previous 1.1.2.7 (colored) to branchpoint 1.1 (colored)

upcallret() takes a struct lwp *, in reality. Make the prototype match.

Revision 1.1.2.7 / (download) - annotate - [select for diffs], Tue Sep 25 16:30:13 2001 UTC (21 years, 4 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.6: +3 -3 lines
Diff to previous 1.1.2.6 (colored) to branchpoint 1.1 (colored)

Change numeric values of L_SA and L_SA_UPCALL to not collide
with proc flags P_WAITED and P_WEXIT, to simplify the job of reporting
single-LWP process status to userland.

Revision 1.1.2.6 / (download) - annotate - [select for diffs], Thu Aug 30 23:26:58 2001 UTC (21 years, 5 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.5: +2 -1 lines
Diff to previous 1.1.2.5 (colored) to branchpoint 1.1 (colored)

The BIGLOCK flag is lwp-specific, not proc-specific.

Revision 1.1.2.5 / (download) - annotate - [select for diffs], Fri Jul 13 02:33:44 2001 UTC (21 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.4: +36 -3 lines
Diff to previous 1.1.2.4 (colored) to branchpoint 1.1 (colored)

Note copyright.

Revision 1.1.2.4 / (download) - annotate - [select for diffs], Mon Jul 9 22:34:00 2001 UTC (21 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.3: +5 -4 lines
Diff to previous 1.1.2.3 (colored) to branchpoint 1.1 (colored)

Add a upcall-is-pending flag.
Fix some tabifying.

Revision 1.1.2.3 / (download) - annotate - [select for diffs], Thu Jun 21 20:09:48 2001 UTC (21 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.2: +2 -2 lines
Diff to previous 1.1.2.2 (colored) to branchpoint 1.1 (colored)

Catch up to -current.

Revision 1.1.2.2 / (download) - annotate - [select for diffs], Sun Apr 8 20:51:35 2001 UTC (21 years, 10 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.1: +3 -3 lines
Diff to previous 1.1.2.1 (colored) to branchpoint 1.1 (colored)

Change return type of cpu_switch() and mi_switch() to int.

Revision 1.1.2.1 / (download) - annotate - [select for diffs], Mon Mar 5 22:50:02 2001 UTC (21 years, 11 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1: +139 -0 lines
Diff to previous 1.1 (colored)

Initial commit of scheduler activations and lightweight process support.

Revision 1.1, Mon Mar 5 22:50:02 2001 UTC (21 years, 11 months ago) by nathanw
Branch: MAIN
CVS Tags: thorpej_scsipi_nbase, thorpej_scsipi_beforemerge, thorpej_scsipi_base, thorpej-mips-cache-base, thorpej-mips-cache, thorpej-devvp-base, thorpej-devvp, newlock-base, newlock, nathanw_sa_before_merge, nathanw_sa_base, kqueue-base, kqueue, ifpoll-base, gmcgarry_ucred_base, gmcgarry_ucred, gmcgarry_ctxsw_base, gmcgarry_ctxsw, gehenna-devsw-base, gehenna-devsw, eeh-devprop-base, eeh-devprop
Branch point for: nathanw_sa
FILE REMOVED

file lwp.h was initially added on branch nathanw_sa.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>