#
c9a08d1c |
| 25-Apr-2006 |
John Baldwin <jhb@FreeBSD.org> |
- Overhaul the 'ps' command in ddb to be mostly readable again. :) It is now back to using fixed-size columns for output and each line of output should fit in 80 columns on both 32-bit and 64-bi
- Overhaul the 'ps' command in ddb to be mostly readable again. :) It is now back to using fixed-size columns for output and each line of output should fit in 80 columns on both 32-bit and 64-bit architectures. In general the output is close to that of the userland ps(1) with the exception that the 'wmesg' field is mostly similar to the "state" field in top(1) in that it will show either a wmesg, a lock name (prefixed with an *), "CPU xx" (for a running thread), or nothing if none of those three conditions are true. It also respects td_name when listing threads in a multithreaded process. There is a somewhat evilly-defined PTR64 macro I use to make account for the change in the size of the 'wchan' column in the formatted output (wchan is now the only pointer in the ps output and is available so it can be passed to 'show sleepq', 'show turnstile', or 'show lock'). - Add two new commands "show proc [process]" and "show thread [thread]" that show details about the specified process or thread (specified either by pid/tid or pointer), respectively. If an address it not specified, it uses the current kdb thread.
show more ...
|
Revision tags: release/6.0.0_cvs, release/6.0.0, release/5.4.0_cvs, release/5.4.0, release/4.11.0_cvs, release/4.11.0 |
|
#
626ff208 |
| 20-Nov-2004 |
David Schultz <das@FreeBSD.org> |
Remove the uarea column from the DDB 'ps' display, and from grog's gdb scripts.
Reviewed by: arch@
|
Revision tags: release/5.3.0_cvs, release/5.3.0 |
|
#
d39d4a6e |
| 01-Nov-2004 |
John Baldwin <jhb@FreeBSD.org> |
- Change the ddb paging "support" to use a variable (db_lines_per_page) to control the number of lines per page rather than a constant. The variable can be examined and changed in ddb as '$lines
- Change the ddb paging "support" to use a variable (db_lines_per_page) to control the number of lines per page rather than a constant. The variable can be examined and changed in ddb as '$lines'. Setting the variable to 0 will effectively turn off paging. - Change db_putchar() to force out pending whitespace before outputting newlines and carriage returns so that one can rub out content on the current line via '\r \r' type strings. - Change the simple pager to rub out the --More-- prompt explicitly when the routine exits. - Add some aliases to the simple pager to make it more compatible with more(1): 'e' and 'j' do a single line. 'd' does half a page, and 'f' does a full page.
MFC after: 1 month Inspired by: kris
show more ...
|
#
ed062c8d |
| 05-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
Refactor a bunch of scheduler code to give basically the same behaviour but with slightly cleaned up interfaces.
The KSE structure has become the same as the "per thread scheduler private data" stru
Refactor a bunch of scheduler code to give basically the same behaviour but with slightly cleaned up interfaces.
The KSE structure has become the same as the "per thread scheduler private data" structure. In order to not make the diffs too great one is #defined as the other at this time.
The KSE (or td_sched) structure is now allocated per thread and has no allocation code of its own.
Concurrency for a KSEGRP is now kept track of via a simple pair of counters rather than using KSE structures as tokens.
Since the KSE structure is different in each scheduler, kern_switch.c is now included at the end of each scheduler. Nothing outside the scheduler knows the contents of the KSE (aka td_sched) structure.
The fields in the ksegrp structure that are to do with the scheduler's queueing mechanisms are now moved to the kg_sched structure. (per ksegrp scheduler private data structure). In other words how the scheduler queues and keeps track of threads is no-one's business except the scheduler's. This should allow people to write experimental schedulers with completely different internal structuring.
A scheduler call sched_set_concurrency(kg, N) has been added that notifies teh scheduler that no more than N threads from that ksegrp should be allowed to be on concurrently scheduled. This is also used to enforce 'fainess' at this time so that a ksegrp with 10000 threads can not swamp a the run queue and force out a process with 1 thread, since the current code will not set the concurrency above NCPU, and both schedulers will not allow more than that many onto the system run queue at a time. Each scheduler should eventualy develop their own methods to do this now that they are effectively separated.
Rejig libthr's kernel interface to follow the same code paths as linkse for scope system threads. This has slightly hurt libthr's performance but I will work to recover as much of it as I can.
Thread exit code has been cleaned up greatly. exit and exec code now transitions a process back to 'standard non-threaded mode' before taking the next step. Reviewed by: scottl, peter MFC after: 1 week
show more ...
|
#
37224cd3 |
| 11-Jul-2004 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Mega update for the KDB framework: turn DDB into a KDB backend. Most of the changes are a direct result of adding thread awareness. Typically, DDB_REGS is gone. All registers are taken from the trapf
Mega update for the KDB framework: turn DDB into a KDB backend. Most of the changes are a direct result of adding thread awareness. Typically, DDB_REGS is gone. All registers are taken from the trapframe and backtraces use the PCB based contexts. DDB_REGS was defined to be a trapframe on all platforms anyway. Thread awareness introduces the following new commands: thread X switch to thread X (where X is the TID), show threads list all threads.
The backtrace code has been made more flexible so that one can create backtraces for any thread by giving the thread ID as an argument to trace.
With this change, ia64 has support for breakpoints.
show more ...
|
Revision tags: release/4.10.0_cvs, release/4.10.0 |
|
#
f36cfd49 |
| 07-Apr-2004 |
Warner Losh <imp@FreeBSD.org> |
Remove advertising clause from University of California Regent's license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson.
Approved by: core, peter, alc, rwatson
|
#
44f3b092 |
| 27-Feb-2004 |
John Baldwin <jhb@FreeBSD.org> |
Switch the sleep/wakeup and condition variable implementations to use the sleep queue interface: - Sleep queues attempt to merge some of the benefits of both sleep queues and condition variables.
Switch the sleep/wakeup and condition variable implementations to use the sleep queue interface: - Sleep queues attempt to merge some of the benefits of both sleep queues and condition variables. Having sleep qeueus in a hash table avoids having to allocate a queue head for each wait channel. Thus, struct cv has shrunk down to just a single char * pointer now. However, the hash table does not hold threads directly, but queue heads. This means that once you have located a queue in the hash bucket, you no longer have to walk the rest of the hash chain looking for threads. Instead, you have a list of all the threads sleeping on that wait channel. - Outside of the sleepq code and the sleep/cv code the kernel no longer differentiates between cv's and sleep/wakeup. For example, calls to abortsleep() and cv_abort() are replaced with a call to sleepq_abort(). Thus, the TDF_CVWAITQ flag is removed. Also, calls to unsleep() and cv_waitq_remove() have been replaced with calls to sleepq_remove(). - The sched_sleep() function no longer accepts a priority argument as sleep's no longer inherently bump the priority. Instead, this is soley a propery of msleep() which explicitly calls sched_prio() before blocking. - The TDF_ONSLEEPQ flag has been dropped as it was never used. The associated TDF_SET_ONSLEEPQ and TDF_CLR_ON_SLEEPQ macros have also been dropped and replaced with a single explicit clearing of td_wchan. TD_SET_ONSLEEPQ() would really have only made sense if it had taken the wait channel and message as arguments anyway. Now that that only happens in one place, a macro would be overkill.
show more ...
|
Revision tags: release/5.2.1_cvs, release/5.2.1, release/5.2.0_cvs, release/5.2.0, release/4.9.0_cvs, release/4.9.0 |
|
#
71b797c1 |
| 30-Aug-2003 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Label the uarea address as such in DDB's ps output
|
#
3f2a1b06 |
| 31-Jul-2003 |
John Baldwin <jhb@FreeBSD.org> |
Update the 'ps', 'show pci', and 'show ktr' ddb commands to use the new pager callout instead of homerolling their own paging facility.
|
#
cb075651 |
| 30-Jul-2003 |
John Baldwin <jhb@FreeBSD.org> |
Whitespace nit.
|
#
0e2a4d3a |
| 15-Jun-2003 |
David Xu <davidxu@FreeBSD.org> |
Rename P_THREADED to P_SA. P_SA means a process is using scheduler activations.
|
#
753960f7 |
| 11-Jun-2003 |
David E. O'Brien <obrien@FreeBSD.org> |
Use __FBSDID().
|
#
b4106261 |
| 06-Jun-2003 |
Julian Elischer <julian@FreeBSD.org> |
Attempt to crunch down the thread state info so that it is more likely to fit on one line. Account for threads better.
* No need to report that it is on a sleep queue if it is actually sleeping * "N
Attempt to crunch down the thread state info so that it is more likely to fit on one line. Account for threads better.
* No need to report that it is on a sleep queue if it is actually sleeping * "Normal" state is almost ubiquitous.. only report abnormal states. * increment the #lines count for each separate thread shown in threaded programs.
makes it less likely that a threaded program will make all the data on a screen overflow off the top of the screen.
show more ...
|
#
a85b6f82 |
| 06-Jun-2003 |
John Baldwin <jhb@FreeBSD.org> |
Handle the TDS_INACTIVE state by printing '[INACTIVE]' instead of panic'ing. Also, for unknown thread states, print out the value rather than panic. Panic'ing in the debugger is pointless at best.
|
#
ac39898e |
| 06-Jun-2003 |
John Baldwin <jhb@FreeBSD.org> |
Whitespace nits.
|
Revision tags: release/5.1.0_cvs, release/5.1.0 |
|
#
060563ec |
| 10-Apr-2003 |
Julian Elischer <julian@FreeBSD.org> |
Move the _oncpu entry from the KSE to the thread. The entry in the KSE still exists but it's purpose will change a bit when we add the ability to lock a KSE to a cpu.
|
Revision tags: release/4.8.0_cvs, release/4.8.0 |
|
#
ac2e4153 |
| 27-Feb-2003 |
Julian Elischer <julian@FreeBSD.org> |
Change the process flags P_KSES to be P_THREADED. This is just a cosmetic change but I've been meaning to do it for about a year.
|
#
5215b187 |
| 17-Feb-2003 |
Jeff Roberson <jeff@FreeBSD.org> |
- Split the struct kse into struct upcall and struct kse. struct kse will soon be visible only to schedulers. This greatly simplifies much the KSE code.
Submitted by: davidxu
|
#
6f8132a8 |
| 01-Feb-2003 |
Julian Elischer <julian@FreeBSD.org> |
Reversion of commit by Davidxu plus fixes since applied.
I'm not convinced there is anything major wrong with the patch but them's the rules..
I am using my "David's mentor" hat to revert this as h
Reversion of commit by Davidxu plus fixes since applied.
I'm not convinced there is anything major wrong with the patch but them's the rules..
I am using my "David's mentor" hat to revert this as he's offline for a while.
show more ...
|
#
0dbb100b |
| 26-Jan-2003 |
David Xu <davidxu@FreeBSD.org> |
Move UPCALL related data structure out of kse, introduce a new data structure called kse_upcall to manage UPCALL. All KSE binding and loaning code are gone.
A thread owns an upcall can collect all c
Move UPCALL related data structure out of kse, introduce a new data structure called kse_upcall to manage UPCALL. All KSE binding and loaning code are gone.
A thread owns an upcall can collect all completed syscall contexts in its ksegrp, turn itself into UPCALL mode, and takes those contexts back to userland. Any thread without upcall structure has to export their contexts and exit at user boundary.
Any thread running in user mode owns an upcall structure, when it enters kernel, if the kse mailbox's current thread pointer is not NULL, then when the thread is blocked in kernel, a new UPCALL thread is created and the upcall structure is transfered to the new UPCALL thread. if the kse mailbox's current thread pointer is NULL, then when a thread is blocked in kernel, no UPCALL thread will be created.
Each upcall always has an owner thread. Userland can remove an upcall by calling kse_exit, when all upcalls in ksegrp are removed, the group is atomatically shutdown. An upcall owner thread also exits when process is in exiting state. when an owner thread exits, the upcall it owns is also removed.
KSE is a pure scheduler entity. it represents a virtual cpu. when a thread is running, it always has a KSE associated with it. scheduler is free to assign a KSE to thread according thread priority, if thread priority is changed, KSE can be moved from one thread to another.
When a ksegrp is created, there is always N KSEs created in the group. the N is the number of physical cpu in the current system. This makes it is possible that even an userland UTS is single CPU safe, threads in kernel still can execute on different cpu in parallel. Userland calls kse_create to add more upcall structures into ksegrp to increase concurrent in userland itself, kernel is not restricted by number of upcalls userland provides.
The code hasn't been tested under SMP by author due to lack of hardware.
Reviewed by: julian
show more ...
|
Revision tags: release/5.0.0_cvs, release/5.0.0 |
|
#
93a7aa79 |
| 28-Dec-2002 |
Julian Elischer <julian@FreeBSD.org> |
Add code to ddb to allow backtracing an arbitrary thread. (show thread {address})
Remove the IDLE kse state and replace it with a change in the way threads sahre KSEs. Every KSE now has a thread, wh
Add code to ddb to allow backtracing an arbitrary thread. (show thread {address})
Remove the IDLE kse state and replace it with a change in the way threads sahre KSEs. Every KSE now has a thread, which is considered its "owner" however a KSE may also be lent to other threads in the same group to allow completion of in-kernel work. n this case the owner remains the same and the KSE will revert to the owner when the other work has been completed.
All creations of upcalls etc. is now done from kse_reassign() which in turn is called from mi_switch or thread_exit(). This means that special code can be removed from msleep() and cv_wait().
kse_release() does not leave a KSE with no thread any more but converts the existing thread into teh KSE's owner, and sets it up for doing an upcall. It is just inhibitted from being scheduled until there is some reason to do an upcall.
Remove all trace of the kse_idle queue since it is no-longer needed. "Idle" KSEs are now on the loanable queue.
show more ...
|
#
1dab89f1 |
| 22-Oct-2002 |
Julian Elischer <julian@FreeBSD.org> |
Remove the process state PRS_WAIT. It is never used. I left it there from pre-KSE days as I didn't know if I'd need it or not but now I know I don't.. It's functionality is in TDI_IWAIT in the thread.
|
#
48bfcddd |
| 09-Oct-2002 |
Julian Elischer <julian@FreeBSD.org> |
Round out the facilty for a 'bound' thread to loan out its KSE in specific situations. The owner thread must be blocked, and the borrower can not proceed back to user space with the borrowed KSE. The
Round out the facilty for a 'bound' thread to loan out its KSE in specific situations. The owner thread must be blocked, and the borrower can not proceed back to user space with the borrowed KSE. The borrower will return the KSE on the next context switch where teh owner wants it back. This removes a lot of possible race conditions and deadlocks. It is consceivable that the borrower should inherit the priority of the owner too. that's another discussion and would be simple to do.
Also, as part of this, the "preallocatd spare thread" is attached to the thread doing a syscall rather than the KSE. This removes the need to lock the scheduler when we want to access it, as it's now "at hand".
DDB now shows a lot mor info for threaded proceses though it may need some optimisation to squeeze it all back into 80 chars again. (possible JKH project)
Upcalls are now "bound" threads, but "KSE Lending" now means that other completing syscalls can be completed using that KSE before the upcall finally makes it back to the UTS. (getting threads OUT OF THE KERNEL is one of the highest priorities in the KSE system.) The upcall when it happens will present all the completed syscalls to the KSE for selection.
show more ...
|
Revision tags: release/4.7.0_cvs |
|
#
551cf4e1 |
| 02-Oct-2002 |
John Baldwin <jhb@FreeBSD.org> |
Rename the mutex thread and process states to use a more generic 'LOCK' name instead. (e.g., SLOCK instead of SMTX, TD_ON_LOCK() instead of TD_ON_MUTEX()) Eventually a turnstile abstraction will be
Rename the mutex thread and process states to use a more generic 'LOCK' name instead. (e.g., SLOCK instead of SMTX, TD_ON_LOCK() instead of TD_ON_MUTEX()) Eventually a turnstile abstraction will be added that will be shared with mutexes and other types of locks. SLOCK/TDI_LOCK will be used internally by the turnstile code and will not be specific to mutexes. Making the change now ensures that turnstiles can be dropped in at a later date without affecting the ABI of userland applications.
show more ...
|
#
71fad9fd |
| 11-Sep-2002 |
Julian Elischer <julian@FreeBSD.org> |
Completely redo thread states.
Reviewed by: davidxu@freebsd.org
|