The NetBSD Project

CVS log for src/sys/kern/kern_lwp.c

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

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.208 / (download) - annotate - [select for diffs], Thu Nov 14 16:23:52 2019 UTC (8 hours, 23 minutes ago) by maxv
Branch: MAIN
CVS Tags: HEAD
Changes since 1.207: +5 -2 lines
Diff to previous 1.207 (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.207 / (download) - annotate - [select for diffs], Sun Nov 10 23:39:03 2019 UTC (4 days, 1 hour ago) by joerg
Branch: MAIN
Changes since 1.206: +7 -2 lines
Diff to previous 1.206 (colored)

Ensure that the second LWP of a new process uses a free LWP ID.
Document overflow behavior.

Revision 1.206 / (download) - annotate - [select for diffs], Thu Nov 7 19:45:18 2019 UTC (7 days, 5 hours ago) by joerg
Branch: MAIN
Changes since 1.205: +4 -2 lines
Diff to previous 1.205 (colored)

Preserve the LWP ID of the calling thread on (v)fork. This ensures that
_lwp_self() remains invariant as necessary for the locking in the
dynamic linker. Otherwise if a process creates a thread and forks from
it, the main thread of the parent would share the LWP ID of the main
thread of the child, even though they have different origins.

Partial fix for pkg/54192.

Revision 1.205 / (download) - annotate - [select for diffs], Sun Oct 6 15:11:17 2019 UTC (5 weeks, 4 days ago) by uwe
Branch: MAIN
Changes since 1.204: +3 -5 lines
Diff to previous 1.204 (colored)

xc_barrier - convenience function to xc_broadcast() a nop.

Make the intent more clear and also avoid a bunch of (xcfunc_t)nullop
casts that gcc 8 -Wcast-function-type is not happy about.

Revision 1.204 / (download) - annotate - [select for diffs], Thu Oct 3 22:48:44 2019 UTC (6 weeks ago) by kamil
Branch: MAIN
Changes since 1.203: +10 -3 lines
Diff to previous 1.203 (colored)

Separate flag for suspended by _lwp_suspend and suspended by a debugger

Once a thread was stopped with ptrace(2), userland process must not
be able to unstop it deliberately or by an accident.

This was a Windows-style behavior that makes threading tracing fragile.

Revision 1.203 / (download) - annotate - [select for diffs], Mon Sep 30 21:13:33 2019 UTC (6 weeks, 3 days ago) by kamil
Branch: MAIN
Changes since 1.202: +4 -4 lines
Diff to previous 1.202 (colored)

Move TRAP_CHLD/TRAP_LWP ptrace information from struct proc to siginfo

Storing struct ptrace_state information inside struct proc was vulnerable
to synchronization bugs, as multiple events emitted in the same time were
overwritting other ones.

Cache the original parent process id in p_oppid. Reusing here p_opptr is
in theory prone to slight race codition.

Change the semantics of PT_GET_PROCESS_STATE, reutning EINVAL for calls
prompting for the value in cases when there wasn't registered an
appropriate event.

Add an alternative approach to check the ptrace_state information, directly
from the siginfo_t value returned from PT_GET_SIGINFO. The original
PT_GET_PROCESS_STATE approach is kept for compat with older NetBSD and
OpenBSD. New code is recommended to keep using PT_GET_PROCESS_STATE.

Add a couple of compile-time asserts for assumptions in the code.

No functional change intended in existing ptrace(2) software.

All ATF ptrace(2) and ATF GDB tests pass.

This change improves reliability of the threading ptrace(2) code.

Revision 1.202 / (download) - annotate - [select for diffs], Tue Jun 4 11:54:03 2019 UTC (5 months, 1 week ago) by kamil
Branch: MAIN
CVS Tags: phil-wifi-20190609, netbsd-9-base
Branch point for: netbsd-9
Changes since 1.201: +13 -5 lines
Diff to previous 1.201 (colored)

Stop trying to inform debugger about events from an exiting child

Do not emit signals to parent for if a process is demising:

 - fork/vfork/similar
 - lwp created/exited
 - exec
 - syscall entry/exit

With these changes Go applications can be traced without a clash under
a debugger, at least without deadlocking always. The culprit reason was
an attempt to inform a debugger in the middle of exit1() call about
a dying LWP. Go applications perform exit(2) without collecting threads
first. Verified with GDB and picotrace-based utilities like sigtracer.

PR kern/53120
PR port-arm/51677
PR bin/54060
PR bin/49662
PR kern/52548

Revision 1.201 / (download) - annotate - [select for diffs], Fri May 17 03:34:26 2019 UTC (5 months, 4 weeks ago) by ozaki-r
Branch: MAIN
Changes since 1.200: +4 -2 lines
Diff to previous 1.200 (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.200 / (download) - annotate - [select for diffs], Fri May 3 22:34:21 2019 UTC (6 months, 1 week ago) by kamil
Branch: MAIN
Changes since 1.199: +3 -5 lines
Diff to previous 1.199 (colored)

Register KTR events for debugger related signals

Register signals for:

 - crashes (FPE, SEGV, FPE, ILL, BUS)
 - LWP events
 - CHLD (FORK/VFORK/VFORK_DONE) events -- temporarily disabled
 - EXEC events

While there refactor related functions in order to simplify the code.

Add missing comment documentation for recently added kernel functions.

Revision 1.199 / (download) - annotate - [select for diffs], Thu May 2 22:23:49 2019 UTC (6 months, 1 week ago) by kamil
Branch: MAIN
Changes since 1.198: +3 -3 lines
Diff to previous 1.198 (colored)

Introduce fixes for ptrace(2)

Stop disabling LWP create and exit events for PT_SYSCALL tracing.
PT_SYSCALL disabled EXEC reporting for legacy reasons, there is no need
to repeat it for LWP and CHLD events.

Pass full siginfo from trapsignal events (SEGV, BUS, ILL, TRAP, FPE).
This adds missing information about signals like fault address.

Set ps_lwp always.

Before passing siginfo to userland through p_sigctx.ps_info, make sure
that it was zeroed for unused bytes. LWP and CHLD events do not set si_addr
and si_trap, these pieces of information are passed for crashes (like
software breakpoint).

LLDB crash reporting works now correctly:

(lldb) r
Process 552 launched: '/tmp/a.out' (x86_64)
Process 552 stopped
* thread #1, stop reason = signal SIGSEGV: invalid address (fault address: 0x123456)

Revision 1.198 / (download) - annotate - [select for diffs], Wed May 1 21:57:34 2019 UTC (6 months, 2 weeks ago) by kamil
Branch: MAIN
Changes since 1.197: +15 -38 lines
Diff to previous 1.197 (colored)

Correct passing debugger related events for LWP create and exit

Add MI toplevel startlwp function.

Switch all userland LWPs to go through lwp_create using a shared
mi_startlwp() function between all MD ABIs.

Add debugger related event handling in mi_startlwp() and continue with
standard p->p_emul->e_startlwp at the end of this routine.

Use eventswitch() to notify the event of LWP exit in lwp_exit().

ATF ptrace(2) tests signal9 and signal10 now pass.

Revision 1.197 / (download) - annotate - [select for diffs], Fri Apr 19 01:52:55 2019 UTC (6 months, 3 weeks ago) by ozaki-r
Branch: MAIN
CVS Tags: isaki-audio2-base, isaki-audio2
Changes since 1.196: +3 -2 lines
Diff to previous 1.196 (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.196 / (download) - annotate - [select for diffs], Fri Mar 1 09:02:03 2019 UTC (8 months, 2 weeks ago) by hannken
Branch: MAIN
Changes since 1.195: +6 -2 lines
Diff to previous 1.195 (colored)

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

Ride NetBSD 8.99.35

Revision 1.195 / (download) - annotate - [select for diffs], Mon Nov 26 17:18:01 2018 UTC (11 months, 2 weeks ago) by skrll
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226
Changes since 1.194: +3 -3 lines
Diff to previous 1.194 (colored)

Use cpu_index(). NFC.

Revision 1.194 / (download) - annotate - [select for diffs], Wed Jul 4 18:15:27 2018 UTC (16 months, 1 week ago) by kamil
Branch: MAIN
CVS Tags: pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728
Changes since 1.193: +1 -1 lines
Diff to previous 1.193 (colored)

Avoid undefined behavior in lwp_ctl_free()

Do not left shift signed integer in a way that the signedness bit is
changed.

sys/kern/kern_lwp.c:1892:29, left shift of 1 by 31 places cannot be represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by <Harry Pantazis>

Revision 1.193 / (download) - annotate - [select for diffs], Wed Jul 4 18:13:01 2018 UTC (16 months, 1 week ago) by kamil
Branch: MAIN
Changes since 1.192: +3 -3 lines
Diff to previous 1.192 (colored)

Avoid undefined behavior in lwp_ctl_alloc()

Do not left shift signed integer in a way that the signedness bit is
changed.

sys/kern/kern_lwp.c:1849:27, left shift of 1 by 31 places cannot be represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by <Harry Pantazis>

Revision 1.192 / (download) - annotate - [select for diffs], Mon Apr 23 15:51:00 2018 UTC (18 months, 3 weeks ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502
Branch point for: phil-wifi
Changes since 1.191: +4 -5 lines
Diff to previous 1.191 (colored)

PR/kern/53202: Kernel hangs running t_ptrace_wait:resume1 test, revert
previous.

Revision 1.191 / (download) - annotate - [select for diffs], Sat Dec 2 22:51:22 2017 UTC (23 months, 1 week ago) by christos
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.190: +5 -4 lines
Diff to previous 1.190 (colored)

Also wait interruptibly when exiting. Avoids deadlocked on exit processes
create by golang.

Revision 1.190 / (download) - annotate - [select for diffs], Thu Jun 22 09:05:09 2017 UTC (2 years, 4 months ago) by skrll
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825
Changes since 1.189: +3 -4 lines
Diff to previous 1.189 (colored)

Unwrap two lines. NFC.

Revision 1.189 / (download) - annotate - [select for diffs], Thu Jun 1 02:45:13 2017 UTC (2 years, 5 months ago) by chs
Branch: MAIN
CVS Tags: netbsd-8-base, matt-nb8-mediatek-base, matt-nb8-mediatek
Branch point for: netbsd-8
Changes since 1.188: +3 -6 lines
Diff to previous 1.188 (colored)

remove checks for failure after memory allocation calls that cannot fail:

  kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.

Revision 1.188 / (download) - annotate - [select for diffs], Fri Apr 21 15:10:34 2017 UTC (2 years, 6 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, bouyer-socketcan-base1
Changes since 1.187: +7 -6 lines
Diff to previous 1.187 (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.187 / (download) - annotate - [select for diffs], Sat Jan 14 19:32:10 2017 UTC (2 years, 10 months ago) by kamil
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320, nick-nhusb-base-20170204, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.186: +3 -3 lines
Diff to previous 1.186 (colored)

Fix generation of PTRACE_LWP_EXIT event

Set p_lwp_exited instead of p_lwp_created for PTRACE_LWP_EXIT.

This made the lwp_exit1 ATF test passing.

Sponsored by <The NetBSD Foundation>

Revision 1.186 / (download) - annotate - [select for diffs], Sat Jan 14 06:36:52 2017 UTC (2 years, 10 months ago) by kamil
Branch: MAIN
Changes since 1.185: +38 -2 lines
Diff to previous 1.185 (colored)

Introduce PTRACE_LWP_{CREATE,EXIT} in ptrace(2) and TRAP_LWP in siginfo(5)

Add interface in ptrace(2) to track thread (LWP) events:
 - birth,
 - termination.

The purpose of this thread is to keep track of the current thread state in
a tracee and apply e.g. per-thread designed hardware assisted watchpoints.

This interface reuses the EVENT_MASK and PROCESS_STATE interface, and
shares it with PTRACE_FORK, PTRACE_VFORK and PTRACE_VFORK_DONE.

Change the following structure:

typedef struct ptrace_state {
        int     pe_report_event;
        pid_t   pe_other_pid;
} ptrace_state_t;

to

typedef struct ptrace_state {
        int     pe_report_event;
        union {
                pid_t   _pe_other_pid;
                lwpid_t _pe_lwp;
        } _option;
} ptrace_state_t;

#define pe_other_pid    _option._pe_other_pid
#define pe_lwp          _option._pe_lwp

This keeps size of ptrace_state_t unchanged as both pid_t and lwpid_t are
defined as int32_t-like integer. This change does not break existing
prebuilt software and has minimal effect on necessity for source-code
changes. In summary, this change should be binary compatible and shouldn't
break build of existing software.


Introduce new siginfo(5) type for LWP events under the SIGTRAP signal:
TRAP_LWP. This change will help debuggers to distinguish exact source of
SIGTRAP.


Add two basic t_ptrace_wait* tests:
lwp_create1:
    Verify that 1 LWP creation is intercepted by ptrace(2) with
    EVENT_MASK set to PTRACE_LWP_CREATE

lwp_exit1:
    Verify that 1 LWP creation is intercepted by ptrace(2) with
    EVENT_MASK set to PTRACE_LWP_EXIT

All tests are passing.


Surfing the previous kernel ABI bump to 7.99.59 for PTRACE_VFORK{,_DONE}.

Sponsored by <The NetBSD Foundation>

Revision 1.185 / (download) - annotate - [select for diffs], Sun Jul 3 14:24:58 2016 UTC (3 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, localcount-20160914
Branch point for: pgoyette-localcount
Changes since 1.184: +4 -2 lines
Diff to previous 1.184 (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.184 / (download) - annotate - [select for diffs], Mon Apr 4 23:07:06 2016 UTC (3 years, 7 months ago) by christos
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529, nick-nhusb-base-20160422
Changes since 1.183: +3 -3 lines
Diff to previous 1.183 (colored)

no need to pass the coredump flag to exit1() since it is set and known
in one place.

Revision 1.183 / (download) - annotate - [select for diffs], Mon Apr 4 20:47:57 2016 UTC (3 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.182: +4 -4 lines
Diff to previous 1.182 (colored)

Split p_xstat (composite wait(2) status code, or signal number depending
on context) into:
1. p_xexit:		exit code
2. p_xsig:		signal number
3. p_sflag & WCOREFLAG	bit to indicated that the process core-dumped.

Fix the documentation of the flag bits in <sys/proc.h>

Revision 1.182 / (download) - annotate - [select for diffs], Thu Nov 26 13:15:34 2015 UTC (3 years, 11 months ago) by martin
Branch: MAIN
CVS Tags: nick-nhusb-base-20160319, nick-nhusb-base-20151226
Changes since 1.181: +4 -3 lines
Diff to previous 1.181 (colored)

We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.

Revision 1.181 / (download) - annotate - [select for diffs], Thu Nov 12 10:47:30 2015 UTC (4 years ago) by skrll
Branch: MAIN
Changes since 1.180: +3 -3 lines
Diff to previous 1.180 (colored)

Drop to spl0 after the pmap_activate call.  Should address

PR port-arm/50420: curcpu()->ci_pmap_cur != pm || pm->pm_pai[0].pai_asid == curcpu()->ci_pmap_asid_cur" failed

Discussed with matt@ and rmind@

Revision 1.180 / (download) - annotate - [select for diffs], Fri Oct 2 16:54:15 2015 UTC (4 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.179: +10 -17 lines
Diff to previous 1.179 (colored)

Change SDT (Statically Defined Tracing) probes to use link sets so that it
is easier to add probes. (From FreeBSD)

Revision 1.179 / (download) - annotate - [select for diffs], Sat Oct 18 08:33:29 2014 UTC (5 years ago) by snj
Branch: MAIN
CVS Tags: nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base
Branch point for: nick-nhusb
Changes since 1.178: +3 -3 lines
Diff to previous 1.178 (colored)

src is too big these days to tolerate superfluous apostrophes.  It's
"its", people!

Revision 1.178 / (download) - annotate - [select for diffs], Fri Sep 5 05:57:21 2014 UTC (5 years, 2 months ago) by matt
Branch: MAIN
Changes since 1.177: +15 -15 lines
Diff to previous 1.177 (colored)

Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.

Revision 1.177 / (download) - annotate - [select for diffs], Mon Nov 25 16:29:25 2013 UTC (5 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, rmind-smpnet-nbase, rmind-smpnet-base, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, 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
Changes since 1.176: +9 -3 lines
Diff to previous 1.176 (colored)

Use the process credentials instead of the lwp credentials because if the
process just did a setuid() call, the lwp might not have had a chance to
refresh l->l_cred (still has LPR_CRMOD), and we don't want to bother spending
time syncing the creds of a dying lwp. Should fix the problem with hald
people have been observing.

Revision 1.176 / (download) - annotate - [select for diffs], Fri Nov 22 21:04:11 2013 UTC (5 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.175: +3 -3 lines
Diff to previous 1.175 (colored)

convert vmem, signals, powerhooks from CIRCLEQ -> TAILQ.

Revision 1.175 / (download) - annotate - [select for diffs], Sun Jun 9 01:13:47 2013 UTC (6 years, 5 months ago) by riz
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Branch point for: rmind-smpnet
Changes since 1.174: +5 -5 lines
Diff to previous 1.174 (colored)

Add another field to the SDT_PROBE_DEFINE macro, so our DTrace probes
can named the same as those on other platforms.

For example, proc:::exec-success, not proc:::exec_success.

Implementation follows the same basic principle as FreeBSD's; add
another field to the SDT_PROBE_DEFINE macro which is the name
as exposed to userland.

Revision 1.174 / (download) - annotate - [select for diffs], Sun Dec 16 22:21:03 2012 UTC (6 years, 10 months ago) by dsl
Branch: MAIN
CVS Tags: yamt-pagecache-base8, khorben-n900, agc-symver-base, agc-symver
Changes since 1.173: +75 -8 lines
Diff to previous 1.173 (colored)

The lwp_id in a process are supposed to be non-zero and unique.
This stops being true once a process has allocated (and freed) 2^32 lwps.
(I've not timed it!)
There is also some code lurking (eg ld.elf_so) that doesn't expect the
  high be be set.
Once the lwp_id wraps, scan the list to find the first free id higher
  than the last one allocated.
Maintain the sort order to make the possible.
Note that if some lwp (but not all) are allocated numbers from the pid
  space it will go horribly wrong.
Tested by setting the limit to 128 and getting firefox to create threads.

Revision 1.173 / (download) - annotate - [select for diffs], Thu Sep 27 20:43:15 2012 UTC (7 years, 1 month ago) by rmind
Branch: MAIN
CVS Tags: yamt-pagecache-base7, yamt-pagecache-base6
Changes since 1.172: +14 -17 lines
Diff to previous 1.172 (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.172 / (download) - annotate - [select for diffs], Thu Aug 30 02:26:02 2012 UTC (7 years, 2 months ago) by matt
Branch: MAIN
Branch point for: tls-maxphys
Changes since 1.171: +4 -2 lines
Diff to previous 1.171 (colored)

A few more KASSERT/KASSERTMSG.

Revision 1.171 / (download) - annotate - [select for diffs], Sun Jul 22 22:40:19 2012 UTC (7 years, 3 months ago) by rmind
Branch: MAIN
Changes since 1.170: +5 -2 lines
Diff to previous 1.170 (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.170 / (download) - annotate - [select for diffs], Sat Jun 9 02:55:32 2012 UTC (7 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.169: +5 -10 lines
Diff to previous 1.169 (colored)

Remove debugging.

Revision 1.169 / (download) - annotate - [select for diffs], Sat Jun 9 02:31:14 2012 UTC (7 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.168: +74 -2 lines
Diff to previous 1.168 (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.168 / (download) - annotate - [select for diffs], Fri Apr 13 15:32:43 2012 UTC (7 years, 7 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-pagecache-base5, yamt-pagecache-base4, jmcneill-usbmp-base9, jmcneill-usbmp-base10
Changes since 1.167: +3 -3 lines
Diff to previous 1.167 (colored)

comment

Revision 1.167 / (download) - annotate - [select for diffs], Sun Feb 19 21:06:51 2012 UTC (7 years, 8 months ago) by rmind
Branch: MAIN
CVS Tags: jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3
Changes since 1.166: +5 -33 lines
Diff to previous 1.166 (colored)

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

Revision 1.166 / (download) - annotate - [select for diffs], Sat Feb 11 23:16:17 2012 UTC (7 years, 9 months ago) by martin
Branch: MAIN
CVS Tags: netbsd-6-base, netbsd-6-0-RC2, netbsd-6-0-RC1, jmcneill-usbmp-base2
Branch point for: netbsd-6, matt-nb6-plus
Changes since 1.165: +4 -3 lines
Diff to previous 1.165 (colored)

Add a posix_spawn syscall, as discussed on tech-kern.
Based on the summer of code project by Charles Zhang, heavily reworked
later by me - all bugs are likely mine.
Ok: core, releng.

Revision 1.165 / (download) - annotate - [select for diffs], Thu Dec 15 00:05:18 2011 UTC (7 years, 11 months ago) by jmcneill
Branch: MAIN
Changes since 1.164: +3 -2 lines
Diff to previous 1.164 (colored)

In lwp_create, copy l_sigstk from the template. Previously sigaltstack wasn't
inherited across fork (but SA_ONSTACK handlers was), causing the child
process to crash when the handler is invoked. ok martin@, christos@

Revision 1.164 / (download) - annotate - [select for diffs], Wed Oct 19 10:51:47 2011 UTC (8 years ago) by yamt
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base, jmcneill-audiomp3-base, jmcneill-audiomp3
Branch point for: yamt-pagecache, jmcneill-usbmp
Changes since 1.163: +3 -2 lines
Diff to previous 1.163 (colored)

don't forget to call kdtrace_thread_ctor for lwp0

Revision 1.163 / (download) - annotate - [select for diffs], Wed Aug 31 16:04:39 2011 UTC (8 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.162: +5 -2 lines
Diff to previous 1.162 (colored)

make lwp_unstop look like proc_unstop. If p->p_xstat is set, then make it
runnable so that it can receive the signal.

Revision 1.162 / (download) - annotate - [select for diffs], Sun Aug 7 21:13:05 2011 UTC (8 years, 3 months ago) by rmind
Branch: MAIN
Changes since 1.161: +19 -19 lines
Diff to previous 1.161 (colored)

Remove LW_AFFINITY flag and fix some bugs affinity mask handling.

Revision 1.161 / (download) - annotate - [select for diffs], Sat Jul 30 17:01:04 2011 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.160: +7 -2 lines
Diff to previous 1.160 (colored)

Add an implementation of passive serialization as described in expired
US patent 4809168. This is a reader / writer synchronization mechanism,
designed for lock-less read operations.

Revision 1.160 / (download) - annotate - [select for diffs], Tue Jul 26 13:03:57 2011 UTC (8 years, 3 months ago) by yamt
Branch: MAIN
Changes since 1.159: +3 -2 lines
Diff to previous 1.159 (colored)

assertion

Revision 1.159 / (download) - annotate - [select for diffs], Mon Jun 13 21:32:42 2011 UTC (8 years, 5 months ago) by matt
Branch: MAIN
Changes since 1.158: +10 -8 lines
Diff to previous 1.158 (colored)

Deal with PCU state when performing coredumps.  As the kernel moves each LWP
into LSSUSPENDED state, have that LWP save its PCU state for the coredump and
release its PCU status since its probably going to be exiting very soon.
Make pcu_save_all tolerate for being called for non-curlwp if that lwp belongs
to the same process, has a state of LSSUSPENDED, and no PCUs are in use.

Make the MD coredump code use pcu_save_all(l) since it'll need to save all
the PCU state anyways and can take advantage of the above tests.

Revision 1.158 / (download) - annotate - [select for diffs], Mon Jun 6 22:04:34 2011 UTC (8 years, 5 months ago) by matt
Branch: MAIN
CVS Tags: rmind-uvmplock-nbase, rmind-uvmplock-base
Changes since 1.157: +13 -2 lines
Diff to previous 1.157 (colored)

Add some more MI hook points for PCU.  Discard the PCU state at lwp_exit and
at exec time.  Before forking, save the PCU state so that cpu_lwp_fork
doesn't have.  Remove MD code which did that before.

Revision 1.157 / (download) - annotate - [select for diffs], Sun Mar 20 23:19:16 2011 UTC (8 years, 7 months ago) by rmind
Branch: MAIN
CVS Tags: cherry-xenmp-base
Branch point for: cherry-xenmp
Changes since 1.156: +26 -3 lines
Diff to previous 1.156 (colored)

Optimise mutex_onproc() and rw_onproc() by making them O(1), instead
of O(ncpu) for adaptive paths.  Add an LWP destructor, lwp_dtor() with
a comment describing the principle of this barrier.

Reviewed by yamt@ and ad@.

Revision 1.156 / (download) - annotate - [select for diffs], Mon Feb 21 20:23:28 2011 UTC (8 years, 8 months ago) by pooka
Branch: MAIN
CVS Tags: bouyer-quota2-nbase
Changes since 1.155: +33 -3 lines
Diff to previous 1.155 (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.155 / (download) - annotate - [select for diffs], Thu Feb 17 18:50:02 2011 UTC (8 years, 8 months ago) by matt
Branch: MAIN
Changes since 1.154: +3 -2 lines
Diff to previous 1.154 (colored)

When freeing a lwp, make sure it's biglock count is 0.

Revision 1.154 / (download) - annotate - [select for diffs], Mon Jan 17 08:26:58 2011 UTC (8 years, 9 months ago) by matt
Branch: MAIN
CVS Tags: bouyer-quota2-base
Branch point for: bouyer-quota2
Changes since 1.153: +5 -2 lines
Diff to previous 1.153 (colored)

If LWP0_MD_INITIALIZER is defined, use it to initalize .l_md (avoid runtime
to do it if possible).

Revision 1.153 / (download) - annotate - [select for diffs], Fri Jan 14 02:06:34 2011 UTC (8 years, 10 months ago) by rmind
Branch: MAIN
CVS Tags: jruoho-x86intr-base
Branch point for: jruoho-x86intr
Changes since 1.152: +4 -2 lines
Diff to previous 1.152 (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.152 / (download) - annotate - [select for diffs], Sat Dec 18 01:36:19 2010 UTC (8 years, 10 months ago) by rmind
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231
Changes since 1.151: +10 -61 lines
Diff to previous 1.151 (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.151 / (download) - annotate - [select for diffs], Wed Jul 7 01:30:37 2010 UTC (9 years, 4 months ago) by chs
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2
Changes since 1.150: +38 -19 lines
Diff to previous 1.150 (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.150 / (download) - annotate - [select for diffs], Thu Jul 1 02:38:30 2010 UTC (9 years, 4 months ago) by rmind
Branch: MAIN
Changes since 1.149: +19 -12 lines
Diff to previous 1.149 (colored)

Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour.  Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.

Revision 1.149 / (download) - annotate - [select for diffs], Sun Jun 13 04:13:31 2010 UTC (9 years, 5 months ago) by yamt
Branch: MAIN
Changes since 1.148: +3 -2 lines
Diff to previous 1.148 (colored)

increment p_nrlwps in lwp_create rather than letting callers do so
as it's always decremented by lwp_exit.  this fixes error recovery of
eg. aio_procinit.

Revision 1.148 / (download) - annotate - [select for diffs], Fri Jun 11 07:32:32 2010 UTC (9 years, 5 months ago) by pooka
Branch: MAIN
Changes since 1.147: +3 -3 lines
Diff to previous 1.147 (colored)

Fix DIAGNOSTIC.  Moral of the story: don't comment xen kernels out of the
build even if you'd like to go to sleep earlier.

Revision 1.147 / (download) - annotate - [select for diffs], Thu Jun 10 20:54:53 2010 UTC (9 years, 5 months ago) by pooka
Branch: MAIN
Changes since 1.146: +45 -2 lines
Diff to previous 1.146 (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.146 / (download) - annotate - [select for diffs], Fri Apr 23 19:18:09 2010 UTC (9 years, 6 months ago) by rmind
Branch: MAIN
CVS Tags: uebayasi-xip-base1
Changes since 1.145: +4 -9 lines
Diff to previous 1.145 (colored)

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

Revision 1.145 / (download) - annotate - [select for diffs], Mon Apr 12 23:20:18 2010 UTC (9 years, 7 months ago) by pooka
Branch: MAIN
Changes since 1.144: +3 -3 lines
Diff to previous 1.144 (colored)

tyop

Revision 1.144 / (download) - annotate - [select for diffs], Mon Apr 12 22:15:31 2010 UTC (9 years, 7 months ago) by pooka
Branch: MAIN
Changes since 1.143: +4 -91 lines
Diff to previous 1.143 (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.143 / (download) - annotate - [select for diffs], Fri Apr 9 11:47:17 2010 UTC (9 years, 7 months ago) by njoly
Branch: MAIN
Changes since 1.142: +3 -3 lines
Diff to previous 1.142 (colored)

Make lwp_ctl_alloc() return 0 instead of EINVAL, when lwpctl user
address already exists. This allow calling _lwp_ctl(2) more than once
on the same LWP.

Revision 1.142 / (download) - annotate - [select for diffs], Tue Apr 6 13:50:22 2010 UTC (9 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.141: +55 -3 lines
Diff to previous 1.141 (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.141 / (download) - annotate - [select for diffs], Mon Mar 1 21:10:17 2010 UTC (9 years, 8 months ago) by darran
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9
Branch point for: rmind-uvmplock
Changes since 1.140: +23 -2 lines
Diff to previous 1.140 (colored)

DTrace: Add an SDT (Statically Defined Tracing) provider framework, and
implement most of the proc provider.  Adds proc:::create, exec,
exec_success, exec_faillure, signal_send, signal_discard, signal_handle,
lwp_create, lwp_start, lwp_exit.

Revision 1.140 / (download) - annotate - [select for diffs], Tue Feb 23 22:19:27 2010 UTC (9 years, 8 months ago) by darran
Branch: MAIN
Changes since 1.139: +2 -9 lines
Diff to previous 1.139 (colored)

DTrace: Get rid of the KDTRACE_HOOKS ifdefs in the kernel.  Replace the
functions with inline function that are empty when KDTRACE_HOOKS is not
defined.

Revision 1.139 / (download) - annotate - [select for diffs], Sun Feb 21 07:01:57 2010 UTC (9 years, 8 months ago) by darran
Branch: MAIN
Changes since 1.138: +3 -2 lines
Diff to previous 1.138 (colored)

Added a defflag option for KDTRACE_HOOKS and included opt_dtrace.h in the
relevant files. (Per Quentin Garnier - thanks!).

Revision 1.138 / (download) - annotate - [select for diffs], Sun Feb 21 02:11:40 2010 UTC (9 years, 8 months ago) by darran
Branch: MAIN
Changes since 1.137: +12 -2 lines
Diff to previous 1.137 (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.137 / (download) - annotate - [select for diffs], Thu Dec 17 01:25:10 2009 UTC (9 years, 11 months ago) by rmind
Branch: MAIN
CVS Tags: uebayasi-xip-base
Branch point for: uebayasi-xip
Changes since 1.136: +3 -4 lines
Diff to previous 1.136 (colored)

Replace few USER_TO_UAREA/UAREA_TO_USER uses, reduce sys/user.h inclusions.

Revision 1.136 / (download) - annotate - [select for diffs], Tue Oct 27 02:58:28 2009 UTC (10 years ago) by rmind
Branch: MAIN
CVS Tags: matt-premerge-20091211, jym-xensuspend-nbase
Changes since 1.135: +3 -3 lines
Diff to previous 1.135 (colored)

- Amend fd_hold() to take an argument and add assert (reflects two cases,
  fork1() and the rest, e.g. kthread_create(), when creating from lwp0).

- lwp_create(): do not touch filedesc internals, use fd_hold().

Revision 1.135 / (download) - annotate - [select for diffs], Thu Oct 22 22:28:57 2009 UTC (10 years ago) by rmind
Branch: MAIN
Changes since 1.134: +3 -6 lines
Diff to previous 1.134 (colored)

Avoid #ifndef __NO_CPU_LWP_FREE, only ia64 is missing cpu_lwp_free
routines and it can/should provide stubs.

Revision 1.134 / (download) - annotate - [select for diffs], Wed Oct 21 21:12:06 2009 UTC (10 years ago) by rmind
Branch: MAIN
Changes since 1.133: +11 -25 lines
Diff to previous 1.133 (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.133 / (download) - annotate - [select for diffs], Sun Sep 13 18:45:11 2009 UTC (10 years, 2 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-nfs-mp-base8
Changes since 1.132: +5 -4 lines
Diff to previous 1.132 (colored)

Wipe out the last vestiges of POOL_INIT with one swift stroke.  In
most cases, use a proper constructor.  For proplib, give a local
equivalent of POOL_INIT for the kernel object implementation.  This
way the code structure can be preserved, and a local link set is
not hazardous anyway (unless proplib is split to several modules,
but that'll be the day).

tested by booting a kernel in qemu and compile-testing i386/ALL

Revision 1.132 / (download) - annotate - [select for diffs], Fri Jul 10 23:07:54 2009 UTC (10 years, 4 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-nfs-mp-base7, yamt-nfs-mp-base6, jymxensuspend-base
Changes since 1.131: +3 -3 lines
Diff to previous 1.131 (colored)

In lwp_create(), take a reference to l2's filedesc_t instead of
taking a reference to curlwp's by calling fd_hold().  If lwp_create()
is called from fork1(), then l2 != curlwp, but l2's and not curlwp's
filedesc_t whose reference we should take.

This change stops the problem I describe in
<http://mail-index.netbsd.org/tech-kern/2009/07/09/msg005422.html>,
where /dev/rsd0a is never properly closed after fsck / runs on it.
This change seems to quiet my USB backup drive, sd0 at scsibus0 at
umass0, which had stopped spinning down when it was not in use:
The unit probably stayed open after mount(8) tried (and failed:
errant fstab entry) to mount it.

I am confident that this change is an improvement, but I doubt that
it is the last word on the matter.  I hate to get under the filedesc_t
abstraction by fiddling with fd_refcnt, and there may be something
I have missed, so somebody with greater understanding of the file
descriptors code should have a look.

Revision 1.131 / (download) - annotate - [select for diffs], Sat May 23 18:28:06 2009 UTC (10 years, 5 months ago) by ad
Branch: MAIN
CVS Tags: yamt-nfs-mp-base5
Changes since 1.130: +19 -3 lines
Diff to previous 1.130 (colored)

Make descriptor access and file allocation cheaper in many cases,
mostly by avoiding a bunch of atomic operations.

Revision 1.130 / (download) - annotate - [select for diffs], Sat May 23 18:21:20 2009 UTC (10 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.129: +14 -2 lines
Diff to previous 1.129 (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.129 / (download) - annotate - [select for diffs], Sat Apr 4 22:34:03 2009 UTC (10 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base, jym-xensuspend-base
Changes since 1.128: +18 -14 lines
Diff to previous 1.128 (colored)

Update the big comment block.

Revision 1.128 / (download) - annotate - [select for diffs], Tue Mar 3 21:55:06 2009 UTC (10 years, 8 months ago) by rmind
Branch: MAIN
Changes since 1.127: +20 -17 lines
Diff to previous 1.127 (colored)

lwp_create: fix the locking bugs on affinity ingerition path (mea culpa).
pset_assign: traverse the list of LWPs safely.
sched_setaffinity: free cpuset (unused path) outside the lock.

Reviewed (with feedback) by <ad>.

Revision 1.127 / (download) - annotate - [select for diffs], Wed Feb 4 21:17:39 2009 UTC (10 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: nick-hppapmap-base2
Branch point for: jym-xensuspend
Changes since 1.126: +44 -3 lines
Diff to previous 1.126 (colored)

PR kern/36183 problem with ptrace and multithreaded processes

Fix the crashy test case that Thor provided.

Revision 1.126 / (download) - annotate - [select for diffs], Tue Oct 28 22:11:36 2008 UTC (11 years ago) by wrstuden
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-0-RC1, mjf-devfs2-base, haad-nbase2, haad-dm-base2, haad-dm-base, ad-audiomp2-base, ad-audiomp2
Branch point for: netbsd-5
Changes since 1.125: +6 -6 lines
Diff to previous 1.125 (colored)

Tweak change to move SA support from userret() to lwp_userret().

1) Since we want to check for upcalls only once, take LW_SA_UPCALL
out of the while(l->l_flags & LW_USERRET) loop.

2) since the goal is to keep SA code out of userret() (and especially
all the emulations that include userret() but will never do SA),
ALWAYS set LW_SA_UPCALL when we set SAVP_FLAG_NOUPCALLS. Drop the
test for it in lwp_userret() since it will never be set bare.

3) Adapt sa_upcall_userret() to clear LW_SA_UPCALL if it's no longer
needed. If we have gained upcalls since sa_yield(), we will deliver
them next time around.

Tested by skrll at.

Revision 1.125 / (download) - annotate - [select for diffs], Tue Oct 21 11:51:23 2008 UTC (11 years ago) by ad
Branch: MAIN
CVS Tags: matt-mips64-base2
Branch point for: nick-hppapmap
Changes since 1.124: +15 -2 lines
Diff to previous 1.124 (colored)

Undo revivesa damage to userret().

Revision 1.124 / (download) - annotate - [select for diffs], Wed Oct 15 06:51:20 2008 UTC (11 years, 1 month ago) by wrstuden
Branch: MAIN
CVS Tags: haad-dm-base1
Changes since 1.123: +16 -2 lines
Diff to previous 1.123 (colored)

Merge wrstuden-revivesa into HEAD.

Revision 1.123 / (download) - annotate - [select for diffs], Tue Oct 7 09:48:27 2008 UTC (11 years, 1 month ago) by rmind
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-4
Changes since 1.122: +2 -3 lines
Diff to previous 1.122 (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.122 / (download) - annotate - [select for diffs], Mon Jul 14 01:19:37 2008 UTC (11 years, 4 months ago) by rmind
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, simonb-wapbl-nbase, simonb-wapbl-base
Changes since 1.121: +20 -10 lines
Diff to previous 1.121 (colored)

- Disallow setting of affinity for zombie LWPs.
- Fix the possible NULL dereference when LWP exiting.
- Fix the inhertance of affinity.

Revision 1.121 / (download) - annotate - [select for diffs], Wed Jul 2 19:53:12 2008 UTC (11 years, 4 months ago) by rmind
Branch: MAIN
Branch point for: haad-dm
Changes since 1.120: +11 -5 lines
Diff to previous 1.120 (colored)

lwp_migrate: if LWP is still on the CPU (LP_RUNNING), it must be handled
like LSONPROC.  Should fix PR/38588.  OK by <ad>.

Revision 1.120 / (download) - annotate - [select for diffs], Wed Jul 2 19:49:58 2008 UTC (11 years, 4 months ago) by rmind
Branch: MAIN
Changes since 1.119: +2 -111 lines
Diff to previous 1.119 (colored)

Remove proc_representative_lwp(), use a simple LIST_FIRST() instead.
OK by <ad>.

Revision 1.119 / (download) - annotate - [select for diffs], Mon Jun 16 09:45:20 2008 UTC (11 years, 5 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base4, wrstuden-revivesa-base-1, wrstuden-revivesa-base
Changes since 1.118: +5 -3 lines
Diff to previous 1.118 (colored)

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

Revision 1.118 / (download) - annotate - [select for diffs], Mon Jun 16 01:41:20 2008 UTC (11 years, 5 months ago) by rmind
Branch: MAIN
Changes since 1.117: +4 -4 lines
Diff to previous 1.117 (colored)

- Add general cpuset macros.
- Use kcpuset name for kernel-only functions.
- Use cpuid_t to specify CPU ID.
- Unify all cpuset users.

API is expected to be stable now.

Revision 1.117 / (download) - annotate - [select for diffs], Sun Jun 15 20:32:57 2008 UTC (11 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.116: +11 -3 lines
Diff to previous 1.116 (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.116 / (download) - annotate - [select for diffs], Mon Jun 2 13:58:07 2008 UTC (11 years, 5 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base3
Branch point for: simonb-wapbl
Changes since 1.115: +9 -3 lines
Diff to previous 1.115 (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.115 / (download) - annotate - [select for diffs], Sat May 31 21:26:01 2008 UTC (11 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.114: +6 -6 lines
Diff to previous 1.114 (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.114 / (download) - annotate - [select for diffs], Thu May 29 22:33:27 2008 UTC (11 years, 5 months ago) by rmind
Branch: MAIN
Changes since 1.113: +46 -17 lines
Diff to previous 1.113 (colored)

Simplifcation for running LWP migration.  Removes double-locking in
mi_switch(), migration for LSONPROC is now performed via idle loop.
Handles/fixes on-CPU case in lwp_migrate(), misc.

Closes PR/38169, idea of migration via idle loop by Andrew Doran.

Revision 1.113 / (download) - annotate - [select for diffs], Tue May 27 17:51:17 2008 UTC (11 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.112: +2 -28 lines
Diff to previous 1.112 (colored)

Move lwp_exit_switchaway() into kern_synch.c. Instead of always switching
to the idle loop, pick a new LWP from the run queue.

Revision 1.112 / (download) - annotate - [select for diffs], Mon May 26 12:08:38 2008 UTC (11 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.111: +4 -4 lines
Diff to previous 1.111 (colored)

Take the mutex pointer and waiters count out of sleepq_t: the values can
be or are maintained elsewhere. Now a sleepq_t is just a TAILQ_HEAD.

Revision 1.111 / (download) - annotate - [select for diffs], Mon May 19 17:06:02 2008 UTC (11 years, 5 months ago) by ad
Branch: MAIN
CVS Tags: hpcarm-cleanup-nbase
Changes since 1.110: +3 -8 lines
Diff to previous 1.110 (colored)

Reduce ifdefs due to MULTIPROCESSOR slightly.

Revision 1.110 / (download) - annotate - [select for diffs], Tue May 6 18:40:57 2008 UTC (11 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base2, yamt-nfs-mp-base2
Branch point for: wrstuden-revivesa
Changes since 1.109: +3 -2 lines
Diff to previous 1.109 (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.109 / (download) - annotate - [select for diffs], Thu May 1 21:25:23 2008 UTC (11 years, 6 months ago) by rmind
Branch: MAIN
Changes since 1.108: +3 -3 lines
Diff to previous 1.108 (colored)

lwp_suspend: check for LW_* flags in l_flag, not l_stat.

Revision 1.108 / (download) - annotate - [select for diffs], Mon Apr 28 20:24:03 2008 UTC (11 years, 6 months ago) by martin
Branch: MAIN
Changes since 1.107: +2 -9 lines
Diff to previous 1.107 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.107 / (download) - annotate - [select for diffs], Mon Apr 28 15:36:01 2008 UTC (11 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.106: +17 -8 lines
Diff to previous 1.106 (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.106 / (download) - annotate - [select for diffs], Sun Apr 27 11:39:20 2008 UTC (11 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: yamt-nfs-mp-base
Branch point for: yamt-nfs-mp
Changes since 1.105: +3 -4 lines
Diff to previous 1.105 (colored)

Disable preemption during the final stages of LWP exit.

Revision 1.105 / (download) - annotate - [select for diffs], Fri Apr 25 14:34:41 2008 UTC (11 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.104: +3 -3 lines
Diff to previous 1.104 (colored)

lwp_startup: spl0 after pmap_activate, otherwise we could be preempted
without a pmap active.

Revision 1.104 / (download) - annotate - [select for diffs], Thu Apr 24 21:47:11 2008 UTC (11 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.103: +4 -2 lines
Diff to previous 1.103 (colored)

lwp_userret: don't drop p_lock while holding a scheduler lock.

Revision 1.103 / (download) - annotate - [select for diffs], Thu Apr 24 18:39:24 2008 UTC (11 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.102: +51 -53 lines
Diff to previous 1.102 (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.102 / (download) - annotate - [select for diffs], Thu Apr 24 15:35:29 2008 UTC (11 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.101: +7 -9 lines
Diff to previous 1.101 (colored)

Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.

Revision 1.101 / (download) - annotate - [select for diffs], Tue Apr 15 18:54:30 2008 UTC (11 years, 7 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base
Branch point for: yamt-pf42
Changes since 1.100: +56 -56 lines
Diff to previous 1.100 (colored)

Adjust comments: spc_mutex is now always a per-CPU lock, L_INMEM -> LW_INMEM,
L_WSUSPEND -> LW_WSUSPEND, and remove white-spaces, while here.

Revision 1.100 / (download) - annotate - [select for diffs], Thu Mar 27 19:06:52 2008 UTC (11 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.99: +7 -2 lines
Diff to previous 1.99 (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.99 / (download) - annotate - [select for diffs], Sun Mar 23 16:39:34 2008 UTC (11 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: yamt-lazymbuf-base15, yamt-lazymbuf-base14, ad-socklock-base1
Changes since 1.98: +3 -2 lines
Diff to previous 1.98 (colored)

lwp_ctl_alloc: initialize lcp_kaddr to vm_map_min(kernel_map), in order to
prevent uvm_map() from spuriously failing.

Revision 1.98 / (download) - annotate - [select for diffs], Sat Mar 22 17:53:34 2008 UTC (11 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.97: +5 -2 lines
Diff to previous 1.97 (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.97 / (download) - annotate - [select for diffs], Fri Mar 21 21:55:00 2008 UTC (11 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.96: +4 -5 lines
Diff to previous 1.96 (colored)

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

Revision 1.96 / (download) - annotate - [select for diffs], Mon Mar 17 16:54:51 2008 UTC (11 years, 8 months ago) by ad
Branch: MAIN
CVS Tags: matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base
Changes since 1.95: +12 -2 lines
Diff to previous 1.95 (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.95 / (download) - annotate - [select for diffs], Fri Mar 7 18:06:04 2008 UTC (11 years, 8 months ago) by ad
Branch: MAIN
Changes since 1.94: +4 -3 lines
Diff to previous 1.94 (colored)

lwp_ctl_exit: fix a use-after-free that caused the following:

_lwp_ctl()	<- works
execve()	<- tears down lwpctl state
_lwp_ctl()	<- fails erroneously

Revision 1.94 / (download) - annotate - [select for diffs], Fri Feb 22 22:32:49 2008 UTC (11 years, 8 months ago) by rmind
Branch: MAIN
CVS Tags: hpcarm-cleanup-base
Changes since 1.93: +10 -6 lines
Diff to previous 1.93 (colored)

sys__sched_getparam and sys__sched_getaffinity: Do not assume that LWP
with LID=1 exists, use LIST_FIRST(&p->p_lwps) instead.
Fixes PR/37987 by <yamt>.

While here, adjust license.

Revision 1.93 / (download) - annotate - [select for diffs], Mon Jan 28 12:23:42 2008 UTC (11 years, 9 months ago) by yamt
Branch: MAIN
CVS Tags: nick-net80211-sync-base, nick-net80211-sync, mjf-devfs-base
Branch point for: mjf-devfs2, keiichi-mipv6
Changes since 1.92: +4 -3 lines
Diff to previous 1.92 (colored)

wrap a long line.

Revision 1.92 / (download) - annotate - [select for diffs], Mon Jan 28 10:24:45 2008 UTC (11 years, 9 months ago) by yamt
Branch: MAIN
Changes since 1.91: +5 -2 lines
Diff to previous 1.91 (colored)

lwp_free: add assertions.

Revision 1.91 / (download) - annotate - [select for diffs], Tue Jan 15 03:37:11 2008 UTC (11 years, 10 months ago) by rmind
Branch: MAIN
CVS Tags: bouyer-xeni386-nbase, bouyer-xeni386-base
Changes since 1.90: +84 -10 lines
Diff to previous 1.90 (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.90 / (download) - annotate - [select for diffs], Sat Jan 12 18:06:40 2008 UTC (11 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.89: +6 -2 lines
Diff to previous 1.89 (colored)

- lwp_exit: if the LWP has a name, rename it to "(zombie)".
- lwp_free: don't leak l_name.

Revision 1.89 / (download) - annotate - [select for diffs], Mon Jan 7 11:41:29 2008 UTC (11 years, 10 months ago) by yamt
Branch: MAIN
CVS Tags: matt-armv6-base
Changes since 1.88: +11 -5 lines
Diff to previous 1.88 (colored)

lwp_ctl_alloc: fix error handling.

Revision 1.88 / (download) - annotate - [select for diffs], Wed Jan 2 11:48:50 2008 UTC (11 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.87: +5 -12 lines
Diff to previous 1.87 (colored)

Merge vmlocking2 to head.

Revision 1.87 / (download) - annotate - [select for diffs], Wed Dec 26 16:01:36 2007 UTC (11 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: vmlocking2-base3
Changes since 1.86: +7 -6 lines
Diff to previous 1.86 (colored)

Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.

Revision 1.86 / (download) - annotate - [select for diffs], Sat Dec 22 01:14:54 2007 UTC (11 years, 10 months ago) by yamt
Branch: MAIN
Changes since 1.85: +3 -3 lines
Diff to previous 1.85 (colored)

use binuptime for l_stime/l_rtime.

Revision 1.85 / (download) - annotate - [select for diffs], Thu Dec 13 05:25:03 2007 UTC (11 years, 11 months ago) by yamt
Branch: MAIN
Changes since 1.84: +3 -2 lines
Diff to previous 1.84 (colored)

include <sys/user.h>.

Revision 1.84 / (download) - annotate - [select for diffs], Thu Dec 13 02:45:10 2007 UTC (11 years, 11 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-kmem-base3
Changes since 1.83: +22 -2 lines
Diff to previous 1.83 (colored)

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

Revision 1.83 / (download) - annotate - [select for diffs], Mon Dec 3 20:26:25 2007 UTC (11 years, 11 months ago) by ad
Branch: MAIN
CVS Tags: yamt-kmem-base2, yamt-kmem-base, vmlocking2-base2, vmlocking2-base1, 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.82: +2 -4 lines
Diff to previous 1.82 (colored)

Soft interrupts can now take proclist_lock, so there is no need to
double-lock alllwp or allproc.

Revision 1.82 / (download) - annotate - [select for diffs], Mon Dec 3 17:14:59 2007 UTC (11 years, 11 months ago) by ad
Branch: MAIN
CVS Tags: vmlocking-nbase
Changes since 1.81: +3 -2 lines
Diff to previous 1.81 (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.81 / (download) - annotate - [select for diffs], Sun Dec 2 14:55:32 2007 UTC (11 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.80: +18 -7 lines
Diff to previous 1.80 (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.
- lwpctl: allow LWPs to reregister instead of returning EINVAL. Just return
  their existing lwpctl user address.

Revision 1.80 / (download) - annotate - [select for diffs], Tue Nov 13 11:38:35 2007 UTC (12 years ago) by skrll
Branch: MAIN
CVS Tags: bouyer-xenamd64-base2, bouyer-xenamd64-base
Changes since 1.79: +3 -2 lines
Diff to previous 1.79 (colored)

Explicitly include <uvm/uvm_object.h>

Revision 1.79 / (download) - annotate - [select for diffs], Tue Nov 13 08:38:06 2007 UTC (12 years ago) by yamt
Branch: MAIN
Changes since 1.78: +5 -3 lines
Diff to previous 1.78 (colored)

lwp_ctl_alloc: fix a mutex_enter/exit mismatch.

Revision 1.78 / (download) - annotate - [select for diffs], Mon Nov 12 23:11:59 2007 UTC (12 years ago) by ad
Branch: MAIN
Changes since 1.77: +195 -22 lines
Diff to previous 1.77 (colored)

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

Revision 1.77 / (download) - annotate - [select for diffs], Sun Nov 11 23:22:23 2007 UTC (12 years ago) by matt
Branch: MAIN
Changes since 1.76: +3 -3 lines
Diff to previous 1.76 (colored)

Change some initialization of static queues to compile time.
(xxx_INIT to xxx_HEAD_INITIALIZER).  Drop code which inits
non-auto (global or static) variables to 0 since that's
already implied by being non-auto.  Init some static/global
cpu_simple_locks at compile time.

Revision 1.76 / (download) - annotate - [select for diffs], Wed Nov 7 00:23:21 2007 UTC (12 years ago) by ad
Branch: MAIN
Changes since 1.75: +6 -6 lines
Diff to previous 1.75 (colored)

Merge from vmlocking:

- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.

Revision 1.75 / (download) - annotate - [select for diffs], Tue Nov 6 00:42:41 2007 UTC (12 years ago) by ad
Branch: MAIN
CVS Tags: jmcneill-base
Changes since 1.74: +31 -11 lines
Diff to previous 1.74 (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.74 / (download) - annotate - [select for diffs], Sat Oct 13 00:30:26 2007 UTC (12 years, 1 month ago) by rmind
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, yamt-x86pmap-base3
Branch point for: mjf-devfs, bouyer-xenamd64
Changes since 1.73: +4 -4 lines
Diff to previous 1.73 (colored)

- Fix a comment: LSIDL is covered by spc_mutex, not spc_lwplock.
- mi_switch: Add a comment that spc_lwplock might not necessary be held.

Revision 1.73 / (download) - annotate - [select for diffs], Tue Oct 9 19:00:13 2007 UTC (12 years, 1 month ago) by rmind
Branch: MAIN
CVS Tags: vmlocking-base
Changes since 1.72: +8 -4 lines
Diff to previous 1.72 (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.72 / (download) - annotate - [select for diffs], Mon Oct 8 18:11:11 2007 UTC (12 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.71: +6 -2 lines
Diff to previous 1.71 (colored)

Merge from vmlocking: fix LWP reference counting problems.

Revision 1.71 / (download) - annotate - [select for diffs], Tue Sep 25 21:38:56 2007 UTC (12 years, 1 month ago) by ad
Branch: MAIN
CVS Tags: yamt-x86pmap-base2
Changes since 1.70: +2 -3 lines
Diff to previous 1.70 (colored)

curlwp appears to be set by all active copies of cpu_switchto - remove
the MI assignments and assert that it's set in mi_switch().

Revision 1.70 / (download) - annotate - [select for diffs], Thu Sep 6 23:58:56 2007 UTC (12 years, 2 months ago) by ad
Branch: MAIN
CVS Tags: yamt-x86pmap-base, nick-csl-alignment-base5
Branch point for: yamt-x86pmap
Changes since 1.69: +5 -4 lines
Diff to previous 1.69 (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.69 / (download) - annotate - [select for diffs], Thu Aug 2 01:48:44 2007 UTC (12 years, 3 months ago) by rmind
Branch: MAIN
CVS Tags: matt-mips64-base
Branch point for: matt-mips64, matt-armv6, jmcneill-pm
Changes since 1.68: +3 -12 lines
Diff to previous 1.68 (colored)

sys__lwp_suspend: implement waiting for target LWP status changes (or
process exiting). Removes XXXLWP.

Reviewed by <ad> some time ago..

Revision 1.68 / (download) - annotate - [select for diffs], Tue Jul 31 09:56:31 2007 UTC (12 years, 3 months ago) by tnn
Branch: MAIN
Changes since 1.67: +3 -3 lines
Diff to previous 1.67 (colored)

Fix previous; lwp status are states, not flags.

Revision 1.67 / (download) - annotate - [select for diffs], Tue Jul 31 00:52:04 2007 UTC (12 years, 3 months ago) by tnn
Branch: MAIN
Changes since 1.66: +3 -7 lines
Diff to previous 1.66 (colored)

proc_representative_lwp:
 - Correct expression for checking if the lwp is running.
 - Remove dead code. Ok'd by Andrew Doran.

Revision 1.66 / (download) - annotate - [select for diffs], Sat Jul 28 00:12:26 2007 UTC (12 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: hpcarm-cleanup
Changes since 1.65: +39 -38 lines
Diff to previous 1.65 (colored)

Update the blurb to match reality.

Revision 1.65 / (download) - annotate - [select for diffs], Mon Jul 9 21:10:52 2007 UTC (12 years, 4 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base, mjf-ufs-trans-base
Branch point for: nick-csl-alignment
Changes since 1.64: +38 -21 lines
Diff to previous 1.64 (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.64 / (download) - annotate - [select for diffs], Thu May 17 14:51:39 2007 UTC (12 years, 6 months ago) by yamt
Branch: MAIN
Changes since 1.63: +69 -53 lines
Diff to previous 1.63 (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.63 / (download) - annotate - [select for diffs], Wed Mar 21 18:26:00 2007 UTC (12 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: yamt-idlelwp-base8, thorpej-atomic-base, thorpej-atomic
Changes since 1.62: +133 -56 lines
Diff to previous 1.62 (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.62 / (download) - annotate - [select for diffs], Mon Mar 12 18:18:33 2007 UTC (12 years, 8 months ago) by ad
Branch: MAIN
Branch point for: reinoud-bufcleanup, mjf-ufs-trans
Changes since 1.61: +4 -4 lines
Diff to previous 1.61 (colored)

Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.

Revision 1.61 / (download) - annotate - [select for diffs], Sun Mar 4 20:59:00 2007 UTC (12 years, 8 months ago) by ad
Branch: MAIN
Branch point for: vmlocking
Changes since 1.60: +6 -5 lines
Diff to previous 1.60 (colored)

lwp_userret: if the process is exiting, don't bother looking for signals.

Revision 1.60 / (download) - annotate - [select for diffs], Mon Feb 26 09:20:53 2007 UTC (12 years, 8 months ago) by yamt
Branch: MAIN
CVS Tags: ad-audiomp-base, ad-audiomp
Changes since 1.59: +26 -2 lines
Diff to previous 1.59 (colored)

implement priority inheritance.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Feb 21 23:48:13 2007 UTC (12 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.58: +3 -3 lines
Diff to previous 1.58 (colored)

Pick up some additional files that were missed before due to conflicts
with newlock2 merge:

Replace the Mach-derived boolean_t type with the C99 bool type.  A
future commit will replace use of TRUE and FALSE with true and false.

Revision 1.58 / (download) - annotate - [select for diffs], Tue Feb 20 17:47:03 2007 UTC (12 years, 8 months ago) by ad
Branch: MAIN
Changes since 1.57: +2 -5 lines
Diff to previous 1.57 (colored)

When sending signals, only boost the priority of the receiving LWP if
the process is being killed.

Revision 1.57 / (download) - annotate - [select for diffs], Sun Feb 18 16:58:15 2007 UTC (12 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.56: +5 -2 lines
Diff to previous 1.56 (colored)

Add code to support per-system call statistics:
option SYSCALL_STATS	counts the number of times each system call is made
option SYSCALL_TIMES	counts the amount of time spent in each system call
Currently the counting hooks have only been added to the i386 system call
handler, and the time spent in interrupts is not subtracted.
It ought also be possible to add the times to the processes profiling
counters in order to get a more accurate user/system/interrupt split.
The counts themselves are readable via the sysctl interface.

Revision 1.56 / (download) - annotate - [select for diffs], Sat Feb 17 22:31:43 2007 UTC (12 years, 8 months ago) by pavel
Branch: MAIN
Changes since 1.55: +21 -21 lines
Diff to previous 1.55 (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.55 / (download) - annotate - [select for diffs], Fri Feb 16 00:35:45 2007 UTC (12 years, 9 months ago) by ad
Branch: MAIN
Branch point for: yamt-idlelwp
Changes since 1.54: +4 -4 lines
Diff to previous 1.54 (colored)

lwp_free(): pass curlwp to KERNEL_LOCK(), not 'l'.

Revision 1.54 / (download) - annotate - [select for diffs], Thu Feb 15 15:13:10 2007 UTC (12 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.53: +13 -2 lines
Diff to previous 1.53 (colored)

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

Revision 1.53 / (download) - annotate - [select for diffs], Thu Feb 15 15:08:42 2007 UTC (12 years, 9 months ago) by yamt
Branch: MAIN
Changes since 1.52: +6 -3 lines
Diff to previous 1.52 (colored)

newlwp: ensure not to assign lid 0.

Revision 1.52 / (download) - annotate - [select for diffs], Fri Feb 9 21:55:30 2007 UTC (12 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: post-newlock2-merge
Changes since 1.51: +897 -476 lines
Diff to previous 1.51 (colored)

Merge newlock2 to head.

Revision 1.51 / (download) - annotate - [select for diffs], Sat Dec 23 08:39:47 2006 UTC (12 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: newlock2-nbase, newlock2-base
Changes since 1.50: +4 -2 lines
Diff to previous 1.50 (colored)

lwp_update_creds(): acquire the kernel lock to avoid potential deadlock.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Dec 22 08:04:01 2006 UTC (12 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.49: +3 -8 lines
Diff to previous 1.49 (colored)

lwp::l_acflag is no longer useful.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Nov 3 19:46:03 2006 UTC (13 years ago) by ad
Branch: MAIN
CVS Tags: yamt-splraiseipl-base5, yamt-splraiseipl-base4, yamt-splraiseipl-base3, netbsd-4-base
Branch point for: netbsd-4
Changes since 1.48: +3 -3 lines
Diff to previous 1.48 (colored)

- issignal(): acquire the kernel lock before inspecting signal state
- lwp_exit2(): don't drop the kernel lock until after doing wakeup()

Revision 1.48 / (download) - annotate - [select for diffs], Wed Nov 1 10:17:58 2006 UTC (13 years ago) by yamt
Branch: MAIN
Changes since 1.47: +11 -11 lines
Diff to previous 1.47 (colored)

remove some __unused from function parameters.

Revision 1.47 / (download) - annotate - [select for diffs], Tue Oct 24 10:05:45 2006 UTC (13 years ago) by hannken
Branch: MAIN
Changes since 1.46: +12 -2 lines
Diff to previous 1.46 (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.46 / (download) - annotate - [select for diffs], Thu Oct 12 01:32:16 2006 UTC (13 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: yamt-splraiseipl-base2
Changes since 1.45: +11 -11 lines
Diff to previous 1.45 (colored)

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386

Revision 1.45 / (download) - annotate - [select for diffs], Wed Oct 11 04:51:06 2006 UTC (13 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.44: +25 -8 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 (13 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.43: +5 -5 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], Mon Oct 9 00:39:06 2006 UTC (13 years, 1 month ago) by martin
Branch: MAIN
Changes since 1.42: +3 -3 lines
Diff to previous 1.42 (colored)

Remove unused variables.

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

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

Revision 1.41 / (download) - annotate - [select for diffs], Sun Oct 8 04:28:44 2006 UTC (13 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.40: +79 -3 lines
Diff to previous 1.40 (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.40 / (download) - annotate - [select for diffs], Mon Aug 14 14:11:21 2006 UTC (13 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: yamt-splraiseipl-base, yamt-pdpolicy-base9, yamt-pdpolicy-base8, rpaulo-netinet-merge-pcb-base
Branch point for: yamt-splraiseipl, newlock2
Changes since 1.39: +9 -4 lines
Diff to previous 1.39 (colored)

sys__lwp_create: put newuc back to the pool on failure.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Jul 30 21:58:11 2006 UTC (13 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pdpolicy-base7, abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.38: +2 -23 lines
Diff to previous 1.38 (colored)

Single-thread updates to the process credential.

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

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

Revision 1.37 / (download) - annotate - [select for diffs], Wed Jul 19 21:11:37 2006 UTC (13 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.36: +59 -2 lines
Diff to previous 1.36 (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.36 / (download) - annotate - [select for diffs], Mon May 22 13:43:54 2006 UTC (13 years, 5 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.35: +1 -1 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Wed Apr 26 11:44:39 2006 UTC (13 years, 6 months ago) by yamt
Branch: MAIN
CVS Tags: elad-kernelauth-base
Branch point for: chap-midi
Changes since 1.34: +4 -2 lines
Diff to previous 1.34 (colored)

lwp_suspend: don't forget to decrement p_nrlwps when suspending ourselves.
fix PR/33287 from Gregory McGarry.

Revision 1.34 / (download) - annotate - [select for diffs], Wed Mar 29 23:02:31 2006 UTC (13 years, 7 months ago) by cube
Branch: MAIN
CVS Tags: yamt-pdpolicy-base4, yamt-pdpolicy-base3
Changes since 1.33: +4 -3 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.33 / (download) - annotate - [select for diffs], Sat Nov 12 02:28:31 2005 UTC (14 years ago) by chs
Branch: MAIN
CVS Tags: yamt-uio_vmspace-base5, yamt-uio_vmspace, yamt-readahead-pervnode, yamt-readahead-perfile, yamt-readahead-base3, yamt-readahead-base2, yamt-readahead-base, yamt-readahead, yamt-pdpolicy-base2, yamt-pdpolicy-base, peter-altq-base, ktrace-lwp-base
Branch point for: yamt-pdpolicy, simonb-timecounters, rpaulo-netinet-merge-pcb, peter-altq, elad-kernelauth
Changes since 1.32: +11 -2 lines
Diff to previous 1.32 (colored)

disallow non-SA LWP syscalls for SA processes.  they add no value
in this context, only headaches.

Revision 1.32 / (download) - annotate - [select for diffs], Wed Oct 5 15:46:00 2005 UTC (14 years, 1 month ago) by yamt
Branch: MAIN
CVS Tags: yamt-vop-base3, yamt-vop-base2, yamt-vop-base, yamt-vop, thorpej-vnode-attr-base, thorpej-vnode-attr
Changes since 1.31: +2 -3 lines
Diff to previous 1.31 (colored)

remove a redundant assignment in the previous.

Revision 1.31 / (download) - annotate - [select for diffs], Sat Oct 1 06:12:44 2005 UTC (14 years, 1 month ago) by yamt
Branch: MAIN
Changes since 1.30: +15 -11 lines
Diff to previous 1.30 (colored)

simplify lwp exit code.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Aug 28 14:57:18 2005 UTC (14 years, 2 months ago) by yamt
Branch: MAIN
Changes since 1.29: +6 -11 lines
Diff to previous 1.29 (colored)

protect p_nrlwps by sched_lock.  no objection on tech-kern@.  PR/29652.

Revision 1.29 / (download) - annotate - [select for diffs], Sat Feb 12 21:39:00 2005 UTC (14 years, 9 months ago) by fvdl
Branch: MAIN
CVS Tags: yamt-km-base4, yamt-km-base3, netbsd-3-base, kent-audio2-base
Branch point for: yamt-lazymbuf, netbsd-3
Changes since 1.28: +4 -4 lines
Diff to previous 1.28 (colored)

Don't panic when lwp_suspend finds an LWP on another CPU, just return
EINVAL for now.

Revision 1.28 / (download) - annotate - [select for diffs], Wed Oct 6 08:55:27 2004 UTC (15 years, 1 month ago) by skrll
Branch: MAIN
CVS Tags: yamt-km-base2, yamt-km-base, kent-audio1-beforemerge, kent-audio1-base, kent-audio1
Branch point for: yamt-km, kent-audio2
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

Correct arg name in comment.

Revision 1.27 / (download) - annotate - [select for diffs], Wed May 12 21:10:09 2004 UTC (15 years, 6 months ago) by matt
Branch: MAIN
Changes since 1.26: +8 -2 lines
Diff to previous 1.26 (colored)

In proc_representative_lwp, if there is an outstanding trap signal, return
the lwp that had the trap.

Revision 1.26 / (download) - annotate - [select for diffs], Fri Mar 5 11:17:41 2004 UTC (15 years, 8 months ago) by junyoung
Branch: MAIN
CVS Tags: netbsd-2-base, 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, 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-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

lwp_exit2(): set lwp state to SZOMB at more appropriate point.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Mar 2 09:15:26 2004 UTC (15 years, 8 months ago) by yamt
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

once exit1() releases big kernel lock, the struct proc can be freed and
re-used by another cpu immediately.  in that case, lwp_exit2() will
access freed memory.  to fix this:

- remove curlwp from p_lwps in exit1() rather than letting lwp_exit2() do so.
- add assertions to ensure freed proc has no lwps.

kern/24329 from me and kern/24574 from Havard Eidnes.

Revision 1.24 / (download) - annotate - [select for diffs], Fri Feb 13 11:36:23 2004 UTC (15 years, 9 months ago) by wiz
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

Uppercase CPU, plural is CPUs.

Revision 1.23 / (download) - annotate - [select for diffs], Mon Feb 9 13:11:21 2004 UTC (15 years, 9 months ago) by yamt
Branch: MAIN
Changes since 1.22: +4 -2 lines
Diff to previous 1.22 (colored)

- borrow vmspace0 in uvm_proc_exit instead of uvmspace_free.
  the latter is not a appropriate place to do so and it broke vfork.
- deactivate pmap before calling cpu_exit() to keep a balance of
  pmap_activate/deactivate.

Revision 1.22 / (download) - annotate - [select for diffs], Mon Feb 9 13:02:48 2004 UTC (15 years, 9 months ago) by yamt
Branch: MAIN
Changes since 1.21: +5 -2 lines
Diff to previous 1.21 (colored)

lwp_exit2: grab kernel_lock to preserve locking order.

Revision 1.21 / (download) - annotate - [select for diffs], Fri Feb 6 08:08:46 2004 UTC (15 years, 9 months ago) by junyoung
Branch: MAIN
Changes since 1.20: +4 -13 lines
Diff to previous 1.20 (colored)

ANSIfy & zap some blank lines.

Revision 1.20 / (download) - annotate - [select for diffs], Sun Jan 11 19:39:48 2004 UTC (15 years, 10 months ago) by jdolecek
Branch: MAIN
Changes since 1.19: +2 -4 lines
Diff to previous 1.19 (colored)

g/c process state SDEAD - it's not used anymore after 'reaper' removal

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jan 4 11:33:31 2004 UTC (15 years, 10 months ago) by jdolecek
Branch: MAIN
Changes since 1.18: +40 -20 lines
Diff to previous 1.18 (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.18 / (download) - annotate - [select for diffs], Sat Jan 3 20:10:01 2004 UTC (15 years, 10 months ago) by jdolecek
Branch: MAIN
Changes since 1.17: +4 -4 lines
Diff to previous 1.17 (colored)

constify a bit

Revision 1.17 / (download) - annotate - [select for diffs], Wed Dec 24 22:42:11 2003 UTC (15 years, 10 months ago) by manu
Branch: MAIN
Changes since 1.16: +18 -5 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Sat Dec 20 18:22:17 2003 UTC (15 years, 10 months ago) by manu
Branch: MAIN
Changes since 1.15: +8 -2 lines
Diff to previous 1.15 (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.15 / (download) - annotate - [select for diffs], Tue Nov 4 10:33:15 2003 UTC (16 years ago) by dsl
Branch: MAIN
Changes since 1.14: +12 -12 lines
Diff to previous 1.14 (colored)

Remove p_nras from struct proc - use LIST_EMPTY(&p->p_raslist) instead.
Remove p_raslock and rename p_lwplock p_lock (one lock is enough).
Simplify window test when adding a ras and correct test on VM_MAXUSER_ADDRESS.
Avoid unpredictable branch in i386 locore.S
(pad fields left in struct proc to avoid kernel bump)

Revision 1.14 / (download) - annotate - [select for diffs], Thu Oct 30 23:31:21 2003 UTC (16 years ago) by cl
Branch: MAIN
Changes since 1.13: +5 -6 lines
Diff to previous 1.13 (colored)

Don't grab the sched lock in lwp_continue() because lwp_continue() is
called from kpsignal2() with the sched lock held.  Get the lock in
sys__lwp_continue() instead.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Oct 19 01:44:49 2003 UTC (16 years, 1 month ago) by simonb
Branch: MAIN
Changes since 1.12: +2 -3 lines
Diff to previous 1.12 (colored)

Remove unreachable break after return and goto statements.

Revision 1.12 / (download) - annotate - [select for diffs], Mon Jul 28 23:35:20 2003 UTC (16 years, 3 months ago) by matt
Branch: MAIN
Changes since 1.11: +6 -2 lines
Diff to previous 1.11 (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.11 / (download) - annotate - [select for diffs], Thu Jul 17 19:05:30 2003 UTC (16 years, 4 months ago) by fvdl
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

Return the value of 'error' instead of always 0. From Christian Limpach.

Revision 1.10 / (download) - annotate - [select for diffs], Thu Jul 17 18:16:58 2003 UTC (16 years, 4 months ago) by fvdl
Branch: MAIN
Changes since 1.9: +23 -8 lines
Diff to previous 1.9 (colored)

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

Revision 1.9 / (download) - annotate - [select for diffs], Mon Jul 14 14:59:01 2003 UTC (16 years, 4 months ago) by lukem
Branch: MAIN
Changes since 1.8: +4 -1 lines
Diff to previous 1.8 (colored)

add missing __KERNEL_RCSID()

Revision 1.8 / (download) - annotate - [select for diffs], Mon Jun 23 11:02:05 2003 UTC (16 years, 4 months ago) by martin
Branch: MAIN
Branch point for: ktrace-lwp
Changes since 1.7: +3 -1 lines
Diff to previous 1.7 (colored)

Make sure to include opt_foo.h if a defflag option FOO is used.

Revision 1.7 / (download) - annotate - [select for diffs], Wed May 21 17:57:21 2003 UTC (16 years, 5 months ago) by kristerw
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

Use 0 instead of NULL for size parameters.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Mar 19 11:36:33 2003 UTC (16 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.

Revision 1.5 / (download) - annotate - [select for diffs], Thu Jan 30 05:51:58 2003 UTC (16 years, 9 months ago) by matt
Branch: MAIN
Changes since 1.4: +2 -1 lines
Diff to previous 1.4 (colored)

Add a KASSERT when copying l1->l_cpu to l2->l_cpu

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jan 29 23:27:54 2003 UTC (16 years, 9 months ago) by nathanw
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

Fix _lwp_wakeup() so that it stands a chance of working (although it
turns out to be insufficent for signal-level interruption of system
calls. guess we need _lwp_kill(), ugh).

Revision 1.3 / (download) - annotate - [select for diffs], Tue Jan 28 02:20:35 2003 UTC (16 years, 9 months ago) by nathanw
Branch: MAIN
Changes since 1.2: +11 -11 lines
Diff to previous 1.2 (colored)

Fix proc_representative_lwp(); a closing brace was in the wrong place,
which means it would return the first non-dead LWP.

Pointed out by Stephan Uphoff.

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

Merge the nathanw_sa branch.

Revision 1.1, Mon Mar 5 22:49:40 2001 UTC (18 years, 8 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 kern_lwp.c 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>