Commit graph

216 commits

Author SHA1 Message Date
Julian Elischer ed062c8d66 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
2004-09-05 02:09:54 +00:00
Warner Losh 9e749cc9c5 Expand the license referenced indirectly inline. 2004-07-31 18:49:53 +00:00
Alexander Kabaev e1f91dbd18 Remove stale code protected by #ifdef sparc. GCC 3.4.x adds sparc to
predefined symbols on all SPARC platforms and FreeBSD follows the crowd.
2004-07-28 05:43:08 +00:00
Ruslan Ermilov 1a0a934547 Mechanically kill hard sentence breaks. 2004-07-02 23:52:20 +00:00
Ruslan Ermilov 862b46f607 Markup, grammar, punctuation. 2004-07-01 18:20:57 +00:00
Garance A Drosehn 1566329b0f Fix a test of bit-flag "P_SA" by adding parenthesis around the expression.
Submitted by:	Cyrille Lefevre
2004-06-23 21:59:56 +00:00
Garance A Drosehn b7e7c21adf Replace a call to strncpy() with a call to strlcpy()
Submitted by:	Cyrille Lefevre
2004-06-23 21:31:43 +00:00
Garance A Drosehn 276de18cc9 Fill in the some new fields 'struct kinfo_proc', namely ki_childstime,
ki_childutime, and ki_emul.  Also uses the timeradd() macro to correct
the calculation of ki_childtime.  That will correct the value returned
when ki_childtime.tv_usec > 1,000,000.

This also implements a new KERN_PROC_GID option for kvm_getprocs().
It also implements the KERN_PROC_RGID and KERN_PROC_SESSION options
which were added to sys/kern/kern_proc.c revision 1.203.

PR:		bin/65803  (a very tiny piece of the PR)
Submitted by:	Cyrille Lefevre
2004-06-19 14:08:10 +00:00
Poul-Henning Kamp f3732fd15b Second half of the dev_t cleanup.
The big lines are:
	NODEV -> NULL
	NOUDEV -> NODEV
	udev_t -> dev_t
	udev2dev() -> findcdev()

Various minor adjustments including handling of userland access to kernel
space struct cdev etc.
2004-06-17 17:16:53 +00:00
Julian Elischer 3010536674 This library has to change whenever the kernel process structure changes. 2004-06-16 00:34:31 +00:00
Stefan Farfeleder 1a5ff9285a Avoid assignments to cast expressions.
Reviewed by:	md5
Approved by:	das (mentor)
2004-06-08 13:08:19 +00:00
Peter Wemm f2b2912599 Implement crashdump decoding for AMD64 as well, now that I have finally
got a sample to test against.
2004-05-19 18:24:13 +00:00
Olivier Houchard 8cffa1b42d Import libkvm MD file for arm. 2004-05-14 12:24:03 +00:00
Jens Schweikhardt 5aaa432dcc Fix a warning: compare u_long ps_strings to 0 instead of NULL. 2004-03-28 11:50:54 +00:00
Ruslan Ermilov 2769244880 Document that kvm_open(3) also accepts "/dev/null" as a special
"corefile" argument, to access the running system via sysctl(3)
if possible, thus not requring special setgid privileges.
2004-03-26 08:05:39 +00:00
Ruslan Ermilov 8a34ef53ab Document that libkvm also uses /dev/kmem, to access KVM. 2004-03-26 08:03:53 +00:00
Daniel Eischen f3e170bbdb Update man page to reflect additional flag to allow selection of threads. 2004-02-22 18:12:56 +00:00
Daniel Eischen 694127f89c Teach kvm_getprocs() to recognize a sysctl flag for including threads. 2004-02-22 17:57:10 +00:00
Hidetoshi Shimokawa 7928124aa5 Allow to specify a character special device as a core file.
This enable us to use /dev/fwmem* as a core file.
e.g.
	ps -M /dev/fwmem0.0 -N kernel.debug
	dmesg -M /dev/fwmem0.0 -N kernel.debug
	gdb -k -c /dev/fwmem0.0 kernel.debug
You need to set target EUI64 in hw.firewire.fwmem.eui64_hi/lo before
opening the device. On the target arch, (PCI) bus address must be
equivalent to physical address.
(We cannot use this for sparc64 because of IOMMU.)

No objection in: -audit
2003-10-29 14:02:16 +00:00
Bruce Evans 7f75c38230 Fixed some style bugs in the removal of __P(()). Blind removal of
spaces before __P(()) outdented continuation lines to column 0.
2003-10-13 04:44:55 +00:00
Tim J. Robbins 38e9739322 Document KERN_PROC_PROC, update KERN_PROC_ALL description. 2003-09-27 08:22:23 +00:00
Tim J. Robbins f2dd06ab16 Use the 3-component version of the KERN_PROC_PROC sysctl. 2003-09-27 08:14:37 +00:00
David E. O'Brien 4f4a104ee8 style.Makefile(5) 2003-08-18 15:25:39 +00:00
Gordon Tetlow 41d8423f71 Stage 3 of dynamic root support. Make all the libraries needed to run
binaries in /bin and /sbin installed in /lib. Only the versioned files
reside in /lib, the .so symlink continues to live /usr/lib so the
toolchain doesn't need to be modified.
2003-08-17 08:28:46 +00:00
Poul-Henning Kamp 8d2fd95bc8 Remove unnecssary <vm/swap_pager.h> includes.
These were probably not cleaned up back in whatever murky past these
files were split into separate files.
2003-07-31 21:44:31 +00:00
Poul-Henning Kamp b8c609915e Remove various unused variables, prototypes and local variables. 2003-07-31 21:42:12 +00:00
Poul-Henning Kamp 5d6fec5b63 Disable and lobotomize the kvm image reading swapinfo code, the kernel
layout is about to change.

The sysctl based method still returns correct information.
2003-07-31 21:38:32 +00:00
Poul-Henning Kamp 5243b6799b Retire the SWIF_DUMP_TREE code, this is in the way for a rework of
the swap_pager layout.
2003-07-31 21:30:28 +00:00
Poul-Henning Kamp a8818ec991 Unifdef -UDEBUG_SWAPINFO The kernel data structures are about to change. 2003-07-31 20:53:04 +00:00
David Xu d8406ada91 P_THREADED was renamed to P_SA, follow up. 2003-06-15 03:42:04 +00:00
Marcel Moolenaar f2c49dd248 Revamp of the syscall path, exception and context handling. The
prime objectives are:
o  Implement a syscall path based on the epc inststruction (see
   sys/ia64/ia64/syscall.s).
o  Revisit the places were we need to save and restore registers
   and define those contexts in terms of the register sets (see
   sys/ia64/include/_regset.h).

Secundairy objectives:
o  Remove the requirement to use contigmalloc for kernel stacks.
o  Better handling of the high FP registers for SMP systems.
o  Switch to the new cpu_switch() and cpu_throw() semantics.
o  Add a good unwinder to reconstruct contexts for the rare
   cases we need to (see sys/contrib/ia64/libuwx)

Many files are affected by this change. Functionally it boils
down to:
o  The EPC syscall doesn't preserve registers it does not need
   to preserve and places the arguments differently on the stack.
   This affects libc and truss.
o  The address of the kernel page directory (kptdir) had to
   be unstaticized for use by the nested TLB fault handler.
   The name has been changed to ia64_kptdir to avoid conflicts.
   The renaming affects libkvm.
o  The trapframe only contains the special registers and the
   scratch registers. For syscalls using the EPC syscall path
   no scratch registers are saved. This affects all places where
   the trapframe is accessed. Most notably the unaligned access
   handler, the signal delivery code and the debugger.
o  Context switching only partly saves the special registers
   and the preserved registers. This affects cpu_switch() and
   triggered the move to the new semantics, which additionally
   affects cpu_throw().
o  The high FP registers are either in the PCB or on some
   CPU. context switching for them is done lazily. This affects
   trap().
o  The mcontext has room for all registers, but not all of them
   have to be defined in all cases. This mostly affects signal
   delivery code now. The *context syscalls are as of yet still
   unimplemented.

Many details went into the removal of the requirement to use
contigmalloc for kernel stacks. The details are mostly CPU
specific and limited to exception_save() and exception_restore().
The few places where we create, destroy or switch stacks were
mostly simplified by not having to construct physical addresses
and additionally saving the virtual addresses for later use.

Besides more efficient context saving and restoring, which of
course yields a noticable speedup, this also fixes the dreaded
SMP bootup problem as a side-effect. The details of which are
still not fully understood.

This change includes all the necessary backward compatibility
code to have it handle older userland binaries that use the
break instruction for syscalls. Support for break-based syscalls
has been pessimized in favor of a clean implementation. Due to
the overall better performance of the kernel, this will still
be notived as an improvement if it's noticed at all.

Approved by: re@ (jhb)
2003-05-16 21:26:42 +00:00
John Baldwin 840558b971 s/procsig/sigacts/ to catch up to procsig and sigacts changes in the kernel.
Approved by:	re (scottl)
2003-05-14 15:01:20 +00:00
Peter Wemm e472fbeee2 Bandaid for world. jhb gets the pointy hat here and he needs to look at
this.

Approved by:   re (scottl)
2003-05-14 07:28:43 +00:00
Peter Wemm a1de871d26 AMD64 support; repocopied from i386 2003-04-30 21:05:33 +00:00
Tom Rhodes 225823c590 Add sys/user.h to the list of includes. Without it you lack a definition of
'struct kinfo_proc' for calls to kvm_getargv() and kvm_getenvv().

PR:	51322
2003-04-26 15:00:57 +00:00
Julian Elischer a0ddbf497b Catch up with the kernel. Move the current cpu indicator to the thread. 2003-04-10 17:41:40 +00:00
Jeff Roberson 42d3ad7144 - Spell SIGSETOR correctly. 2003-04-01 04:49:12 +00:00
Jeff Roberson 31a9779e5d - Catch up with kernel signal changes. 2003-03-31 22:57:55 +00:00
Philippe Charnier 4cacb61823 The .Fn function
The .Fa argument
2003-03-24 15:58:53 +00:00
John Baldwin 8b7a975ed4 Catch up to p_tracep -> p_tracevp rename to unbreak world.
Pointy hat to:	jhb
2003-03-13 21:40:54 +00:00
Julian Elischer ac2e415327 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.
2003-02-27 02:05:19 +00:00
Matthew Dillon 57e6d29b1e Remove all use of the LOG2() macro/inline, undoing some non-optimal cruft
that crept in recently.  GCC will optimize the divides and multiplies for us.

Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
MFC after:	1 day
2003-01-11 01:09:51 +00:00
Poul-Henning Kamp 42c43e6031 Make struct swblock kernel only, to make vm/swap_pager.h userland includable.
Move struct swdevt from sys/conf.h to the more appropriate vm/swap_pager.h.
Adjust #include use in libkvm and pstat(8) to match.
2003-01-03 16:23:12 +00:00
Jake Burkholder 3eb81c6900 Teach libkvm to deal with direct mapped addresses. 2002-12-27 01:45:05 +00:00
Ruslan Ermilov facc67676f mdoc(7) police: Deal with self-xrefs. 2002-12-24 13:41:48 +00:00
Ruslan Ermilov ae82896268 Consistently mark std(in|out|err) with .Dv, because that's how they
are marked up in stdio(3), and because they are defined expressions
of type "FILE *".

Approved by:	re
2002-12-04 18:57:46 +00:00
Marcel Moolenaar 8aab0cca45 Implement working on ELF corefiles. Use kvm_read() when reading
memory while mapping a virtual address to a physical address.
This allows us to work with virtual addresses for page tables,
provided it doesn't cause infinite recursion. Currently all
page tables are direct mapped.
2002-10-21 04:21:12 +00:00
Thomas Moestl 4ed0293602 Adapt to handle the new sparc64 core dump format correctly.
Reviewed by:	jake
2002-10-20 17:06:50 +00:00
John Baldwin 0d6326492b Catch up to SMTX -> SLOCK changes. 2002-10-02 20:33:52 +00:00
Juli Mallett e8a58a8362 Ressurect libkvm use of the bitmasked signal list in the kernel, now that
reliable signal queues are gone.
2002-10-01 17:17:32 +00:00