Skip site navigation (1)Skip section navigation (2)

CVS log for src/sys/ia64/ia64/machdep.c

[BACK] Up to [FreeBSD] / src / sys / ia64 / ia64

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.278.2.1.2.1: download - view: text, markup, annotated - select for diffs
Fri Nov 11 04:20:22 2011 UTC (2 months, 4 weeks ago) by kensmith
Branches: RELENG_9_0
CVS tags: RELENG_9_0_0_RELEASE
Diff to: previous 1.278.2.1: preferred, colored; next MAIN 1.279: preferred, colored
Changes since revision 1.278.2.1: +0 -0 lines
SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)

Revision 1.279: download - view: text, markup, annotated - select for diffs
Mon Nov 7 15:43:11 2011 UTC (3 months ago) by ed
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.278: preferred, colored
Changes since revision 1.278: +2 -2 lines
SVN rev 227309 on 2011-11-07 15:43:11Z by ed

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.

Revision 1.278.2.1: download - view: text, markup, annotated - select for diffs
Fri Sep 23 00:51:37 2011 UTC (4 months, 2 weeks ago) by kensmith
Branches: RELENG_9
CVS tags: RELENG_9_0_BP
Branch point for: RELENG_9_0
Diff to: previous 1.278: preferred, colored; next MAIN 1.279: preferred, colored
Changes since revision 1.278: +0 -0 lines
SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)

Revision 1.278: download - view: text, markup, annotated - select for diffs
Fri Sep 16 13:58:51 2011 UTC (4 months, 3 weeks ago) by kmacy
Branches: MAIN
CVS tags: RELENG_9_BP
Branch point for: RELENG_9
Diff to: previous 1.277: preferred, colored
Changes since revision 1.277: +2 -2 lines
SVN rev 225617 on 2011-09-16 13:58:51Z by kmacy

In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by:	rwatson
Approved by:	re (bz)

Revision 1.277: download - view: text, markup, annotated - select for diffs
Sat Jun 25 02:15:14 2011 UTC (7 months, 2 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.276: preferred, colored
Changes since revision 1.276: +5 -4 lines
SVN rev 223526 on 2011-06-25 02:15:14Z by marcel

Switch to the event timers infrastructure. This includes:
o   Setting td_intr_frame to the XIVs trap frame because it's referenced
    by the ET event handler.
o   Signal EOI to the CPU before calling the registered XIV handlers.
    This prevents lost ITC interrupts, which cause starvation in one-shot
    mode.
o   Adding support for IPI_HARDCLOCK with corresponding per-CPU counters.
o   Have the APs call cpu_initclocks() so as to limited the scattering of
    clock related initialization. cpu_initclocks() calls the <self>_bsp()
    or <self>_ap() version accordingly.
o   Uncomment the ET clock handling in cpu_idle().
o   Update the DDB 'show pcpu' output for the new MD fields.
o   Entirely rewritten ia64_ih_clock(). Note that we don't create as many
    clock XIVs as we have CPUs, as is done on PowerPC. It doesn't scale.
    We can only have 240 XIVs and we can have more CPUs than that. There's
    a single intrcnt index for the cumulative clock ticks and we keep per
    CPU counts in the PCPU stats structure.
o   Register the ITC by hooking SI_SUB_CONFIGURE (2nd order).

Open issues:
o   Clock interrupts can still be lost. Some tweaking is still necessary.

Thanks to: mav@ for his support, feedback and explanations.

ET stats while committing:
eris% sysctl machdep.cpu | grep nclks

machdep.cpu.0.nclks: 24007
machdep.cpu.1.nclks: 22895
machdep.cpu.2.nclks: 13523
machdep.cpu.3.nclks: 9342
machdep.cpu.4.nclks: 9103
machdep.cpu.5.nclks: 9298
machdep.cpu.6.nclks: 10039
machdep.cpu.7.nclks: 9479
eris% vmstat -i | grep clock
clock                      108599         50

Revision 1.276: download - view: text, markup, annotated - select for diffs
Thu Jun 23 16:21:43 2011 UTC (7 months, 2 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.275: preferred, colored
Changes since revision 1.275: +2 -2 lines
SVN rev 223478 on 2011-06-23 16:21:43Z by marcel

Unblock the outgoing thread after we performed pmap_switch() to
switch the region registers. pmap_switch() returns the pmap for
which the region register are currently programmed, which needs
to be re-programmed on the CPU the ougoing thread gets switched
in.  This change does not noticibly change anything or fix known
bugs, but does give me a warm fuzzy feeling by being more
correct.

Revision 1.275: download - view: text, markup, annotated - select for diffs
Sat Jun 11 02:22:11 2011 UTC (8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.274: preferred, colored
Changes since revision 1.274: +3 -0 lines
SVN rev 222971 on 2011-06-11 02:22:11Z by marcel

Add the model number for the Montvale processor (marketed as Itanium 2 9100).
At this time we're missing just one: Tukwila (Itanium 2 9300).

Revision 1.274: download - view: text, markup, annotated - select for diffs
Tue Jun 7 01:06:49 2011 UTC (8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.273: preferred, colored
Changes since revision 1.273: +2 -0 lines
SVN rev 222800 on 2011-06-07 01:06:49Z by marcel

Call set_cputicker() to have the time counter use the ITC register.
Note that the ITC frequency is fixed.

Revision 1.273: download - view: text, markup, annotated - select for diffs
Mon Jun 6 19:06:15 2011 UTC (8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.272: preferred, colored
Changes since revision 1.272: +29 -4 lines
SVN rev 222769 on 2011-06-06 19:06:15Z by marcel

Improve cpu_idle():
o   cpu_idle_hook is expected to be called with interrupts
    disabled and re-enables interrupts on return.
o   sync with x86: don't idle when the CPU has runnable tasks
o   have callers of ia64_call_pal_static() disable interrupts
    and re-enable interrupts.
o   add, but compile-out, support for idle mode. This will be
    enabled at some later time, after proper testing.

Revision 1.272: download - view: text, markup, annotated - select for diffs
Tue May 31 15:11:43 2011 UTC (8 months, 1 week ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.271: preferred, colored
Changes since revision 1.271: +1 -1 lines
SVN rev 222531 on 2011-05-31 15:11:43Z by nwhitehorn

On multi-core, multi-threaded PPC systems, it is important that the threads
be brought up in the order they are enumerated in the device tree (in
particular, that thread 0 on each core be brought up first). The SLIST
through which we loop to start the CPUs has all of its entries added with
SLIST_INSERT_HEAD(), which means it is in reverse order of enumeration
and so AP startup would always fail in such situations (causing a machine
check or RTAS failure). Fix this by changing the SLIST into an STAILQ,
and inserting new CPUs at the end.

Reviewed by:	jhb

Revision 1.271: download - view: text, markup, annotated - select for diffs
Sat Apr 30 20:49:00 2011 UTC (9 months, 1 week ago) by marcel
Branches: MAIN
Diff to: previous 1.270: preferred, colored
Changes since revision 1.270: +47 -46 lines
SVN rev 221271 on 2011-04-30 20:49:00Z by marcel

Stop linking against a direct-mapped virtual address and instead
use the PBVM. This eliminates the implied hardcoding of the
physical address at which the kernel needs to be loaded. Using the
PBVM makes it possible to load the kernel irrespective of the
physical memory organization and allows us to replicate kernel text
on NUMA machines.

While here, reduce the direct-mapped page size to the kernel's
page size so that we can support memory attributes better.

Revision 1.270: download - view: text, markup, annotated - select for diffs
Mon Mar 21 18:20:53 2011 UTC (10 months, 3 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.269: preferred, colored
Changes since revision 1.269: +18 -18 lines
SVN rev 219841 on 2011-03-21 18:20:53Z by marcel

Fix switching to physical mode as part of calling into EFI runtime
services or PAL procedures. The new implementation is based on
specific functions that are known to be called in certain scenarios
only. This in particular fixes the PAL call to obtain information
about translation registers. In general, the new implementation does
not bank on virtual addresses being direct-mapped and will work when
the kernel uses PBVM.

When new scenarios need to be supported, new functions are added if
the existing functions cannot be changed to handle the new scenario.
If a single generic implementation is possible, it will become clear
in due time.

While here, change bootinfo to a pointer type in anticipation of
future development.

Revision 1.269: download - view: text, markup, annotated - select for diffs
Fri Mar 18 15:36:28 2011 UTC (10 months, 3 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.268: preferred, colored
Changes since revision 1.268: +3 -3 lines
SVN rev 219741 on 2011-03-18 15:36:28Z by marcel

Use VM_MAXUSER_ADDRESS rather than VM_MAX_ADDRESS when we talk about
the bounds of user space. Redefine VM_MAX_ADDRESS as ~0UL, even though
it's not used anywhere in the source tree.

Revision 1.245.2.13: download - view: text, markup, annotated - select for diffs
Tue Mar 15 08:20:59 2011 UTC (10 months, 3 weeks ago) by pluknet
Branches: RELENG_8
Diff to: previous 1.245.2.12: preferred, colored; branchpoint 1.245: preferred, colored; next MAIN 1.246: preferred, colored
Changes since revision 1.245.2.12: +2 -3 lines
SVN rev 219662 on 2011-03-15 08:20:59Z by pluknet

MFC kern.msgbufsize: r217688-217689,r217709,r218666-218667,r218913.
Note, that arm/{s3c2xx0,econa} exist only in head, thus not merged.

r217688:
 Make MSGBUF_SIZE kernel option a loader tunable kern.msgbufsize.

r217689:
 Add kern.msgbufsize default setting to /boot/defaults/loader.conf.

r217709,218666-218667,218913 by marcel, cognet:
 Fix up for various arm subtargets: call init_param1() before we use
 msgbufsize, now that the size of the message buffer is a tunable.

Reviewed by:	marcel
Approved by:	avg (mentor)

Revision 1.268: download - view: text, markup, annotated - select for diffs
Fri Mar 11 18:56:55 2011 UTC (11 months ago) by mdf
Branches: MAIN
Diff to: previous 1.267: preferred, colored
Changes since revision 1.267: +1 -1 lines
SVN rev 219523 on 2011-03-11 18:56:55Z by mdf

Mostly revert r219468, as I had misremembered the C standard regarding
the size of an extern array.

Keep one change from strncpy to strlcpy.

Revision 1.267: download - view: text, markup, annotated - select for diffs
Thu Mar 10 22:56:00 2011 UTC (11 months ago) by mdf
Branches: MAIN
Diff to: previous 1.266: preferred, colored
Changes since revision 1.266: +1 -1 lines
SVN rev 219468 on 2011-03-10 22:56:00Z by mdf

Use MAXPATHLEN rather than the size of an extern array when copying the
kernel name.  Also consistenly use strlcpy().

Suggested by:	Warner Losh

Revision 1.225.2.9: download - view: text, markup, annotated - select for diffs
Tue Jan 25 22:08:43 2011 UTC (12 months, 2 weeks ago) by jhb
Branches: RELENG_7
Diff to: previous 1.225.2.8: preferred, colored; branchpoint 1.225: preferred, colored; next MAIN 1.226: preferred, colored
Changes since revision 1.225.2.8: +10 -4 lines
SVN rev 217856 on 2011-01-25 22:08:43Z by jhb

MFC 214835:
Adjust the order of operations in spinlock_enter() and spinlock_exit() to
work properly with single-stepping in a kernel debugger.

Revision 1.245.2.12: download - view: text, markup, annotated - select for diffs
Tue Jan 25 22:08:22 2011 UTC (12 months, 2 weeks ago) by jhb
Branches: RELENG_8
Diff to: previous 1.245.2.11: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.11: +10 -4 lines
SVN rev 217855 on 2011-01-25 22:08:22Z by jhb

MFC 214835:
Adjust the order of operations in spinlock_enter() and spinlock_exit() to
work properly with single-stepping in a kernel debugger.

Revision 1.266: download - view: text, markup, annotated - select for diffs
Fri Jan 21 10:26:26 2011 UTC (12 months, 2 weeks ago) by pluknet
Branches: MAIN
Diff to: previous 1.265: preferred, colored
Changes since revision 1.265: +2 -3 lines
SVN rev 217688 on 2011-01-21 10:26:26Z by pluknet

Make MSGBUF_SIZE kernel option a loader tunable kern.msgbufsize.

Submitted by:	perryh pluto.rain.com (previous version)
Reviewed by:	jhb
Approved by:	kib (mentor)
Tested by:	universe

Revision 1.225.2.8.4.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:10:29 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_7_4
CVS tags: RELENG_7_4_0_RELEASE
Diff to: previous 1.225.2.8: preferred, colored; next MAIN 1.225.2.9: preferred, colored
Changes since revision 1.225.2.8: +0 -0 lines
SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)

Revision 1.245.2.11.4.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:09:25 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_8_2
CVS tags: RELENG_8_2_0_RELEASE
Diff to: previous 1.245.2.11: preferred, colored; next MAIN 1.245.2.12: preferred, colored
Changes since revision 1.245.2.11: +0 -0 lines
SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)

Revision 1.265: download - view: text, markup, annotated - select for diffs
Tue Nov 9 20:41:10 2010 UTC (15 months ago) by jhb
Branches: MAIN
Diff to: previous 1.264: preferred, colored
Changes since revision 1.264: +0 -1 lines
SVN rev 215052 on 2010-11-09 20:41:10Z by jhb

Remove unused includes of <sys/mutex.h> and <machine/mutex.h>.

Revision 1.264: download - view: text, markup, annotated - select for diffs
Fri Nov 5 13:42:58 2010 UTC (15 months ago) by jhb
Branches: MAIN
Diff to: previous 1.263: preferred, colored
Changes since revision 1.263: +10 -4 lines
SVN rev 214835 on 2010-11-05 13:42:58Z by jhb

Adjust the order of operations in spinlock_enter() and spinlock_exit() to
work properly with single-stepping in a kernel debugger.  Specifically,
these routines have always disabled interrupts before increasing the nesting
count and restored the prior state of interrupts after decreasing the nesting
count to avoid problems with a nested interrupt not disabling interrupts
when acquiring a spin lock.  However, trap interrupts for single-stepping
can still occur even when interrupts are disabled.  Now the saved state of
interrupts is not saved in the thread until after interrupts have been
disabled and the nesting count has been increased.  Similarly, the saved
state from the thread cannot be read once the nesting count has been
decreased to zero.  To fix this, use temporary variables to store interrupt
state and shuffle it between the thread's MD area and the appropriate
registers.

In cooperation with:	bde
MFC after:     1 month

Revision 1.263: download - view: text, markup, annotated - select for diffs
Wed Jun 30 18:03:42 2010 UTC (19 months, 1 week ago) by jhb
Branches: MAIN
Diff to: previous 1.262: preferred, colored
Changes since revision 1.262: +1 -0 lines
SVN rev 209613 on 2010-06-30 18:03:42Z by jhb

Move prototypes for kern_sigtimedwait() and kern_sigprocmask() to
<sys/syscallsubr.h> where all other kern_<syscall> prototypes live.

Revision 1.245.2.11.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 14 02:09:06 2010 UTC (19 months, 4 weeks ago) by kensmith
Branches: RELENG_8_1
CVS tags: RELENG_8_1_0_RELEASE
Diff to: previous 1.245.2.11: preferred, colored; next MAIN 1.245.2.12: preferred, colored
Changes since revision 1.245.2.11: +0 -0 lines
SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)

Revision 1.245.2.11: download - view: text, markup, annotated - select for diffs
Wed Apr 7 02:24:41 2010 UTC (22 months ago) by nwhitehorn
Branches: RELENG_8
CVS tags: RELENG_8_2_BP, RELENG_8_1_BP
Branch point for: RELENG_8_2, RELENG_8_1
Diff to: previous 1.245.2.10: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.10: +3 -3 lines
SVN rev 206336 on 2010-04-07 02:24:41Z by nwhitehorn

MFC r205014,205015:

Provide groundwork for 32-bit binary compatibility on non-x86 platforms,
for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32
option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts
of the kernel and enhances the freebsd32 compatibility code to support
big-endian platforms.

This MFC is required for MFCs of later changes to the freebsd32
compatibility from HEAD.

Requested by:	kib

Revision 1.245.2.10: download - view: text, markup, annotated - select for diffs
Wed Mar 31 05:05:28 2010 UTC (22 months, 1 week ago) by marcel
Branches: RELENG_8
Diff to: previous 1.245.2.9: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.9: +22 -29 lines
SVN rev 205960 on 2010-03-31 05:05:28Z by marcel

MFC rev 199727, 200888, 201031, 202904, 203054, 203106, 203572, 203884,
204183, 204184, 204185, 204425, 204904, 204905, 205172, 205234, 205357,
205428, 205429, 205431, 205432, 205433, 205434, 205435, 205454, 205665,
205713, 205723, 205726 and 205727:

Bring ia64 machine-dependent changes from 9-current to 8-stable.

Revision 1.262: download - view: text, markup, annotated - select for diffs
Fri Mar 26 00:53:13 2010 UTC (22 months, 2 weeks ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.261: preferred, colored
Changes since revision 1.261: +1 -1 lines
SVN rev 205660 on 2010-03-26 00:53:13Z by nwhitehorn

Fix the ia64 build.

Pointy hat to: me

Revision 1.261: download - view: text, markup, annotated - select for diffs
Thu Mar 25 14:24:00 2010 UTC (22 months, 2 weeks ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.260: preferred, colored
Changes since revision 1.260: +3 -3 lines
SVN rev 205642 on 2010-03-25 14:24:00Z by nwhitehorn

Change the arguments of exec_setregs() so that it receives a pointer
to the image_params struct instead of several members of that struct
individually. This makes it easier to expand its arguments in the future
without touching all platforms.

Reviewed by:	jhb

Revision 1.260: download - view: text, markup, annotated - select for diffs
Sat Mar 20 04:22:22 2010 UTC (22 months, 3 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.259: preferred, colored
Changes since revision 1.259: +1 -11 lines
SVN rev 205357 on 2010-03-20 04:22:22Z by marcel

Don't check for boot_verbose in the environment. The loader does
that already and sets RB_VERBOSE. The loader has always done it.

Revision 1.259: download - view: text, markup, annotated - select for diffs
Wed Mar 17 00:37:15 2010 UTC (22 months, 3 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.258: preferred, colored
Changes since revision 1.258: +2 -1 lines
SVN rev 205234 on 2010-03-17 00:37:15Z by marcel

Revamp the interrupt code based on the previous commit:
o   Introduce XIV, eXternal Interrupt Vector, to differentiate from
    the interrupts vectors that are offsets in the IVT (Interrupt
    Vector Table). There's a vector for external interrupts, which
    are based on the XIVs.

o   Keep track of allocated and reserved XIVs so that we can assign
    XIVs without hardcoding anything. When XIVs are allocated, an
    interrupt handler and a class is specified for the XIV. Classes
    are:
    1.  architecture-defined: XIV 15 is returned when no external
	interrupt are pending,
    2.  platform-defined: SAL reports which XIV is used to wakeup
	an AP (typically 0xFF, but it's 0x12 for the Altix 350).
    3.  inter-processor interrupts: allocated for SMP support and
	non-redirectable.
    4.  device interrupts (i.e. IRQs): allocated when devices are
	discovered and are redirectable.

o   Rewrite the central interrupt handler to call the per-XIV
    interrupt handler and rename it to ia64_handle_intr(). Move
    the per-XIV handler implementation to the file where we have
    the XIV allocation/reservation. Clock interrupt handling is
    moved to clock.c. IPI handling is moved to mp_machdep.c.

o   Drop support for the Intel 8259A because it was broken. When
    XIV 0 is received, the CPU should initiate an INTA cycle to
    obtain the interrupt vector of the 8259-based interrupt. In
    these cases the interrupt controller we should be talking to
    WRT to masking on signalling EOI is the 8259 and not the I/O
    SAPIC. This requires adriver for the Intel 8259A which isn't
    available for ia64. Thus stop pretending to support ExtINTs
    and instead panic() so that if we come across hardware that
    has an Intel 8259A, so have something real to work with.

o   With XIVs for IPIs dynamically allocatedi and also based on
    priority, define the IPI_* symbols as variables rather than
    constants. The variable holds the XIV allocated for the IPI.

o   IPI_STOP_HARD delivers a NMI if possible. Otherwise the XIV
    assigned to IPI_STOP is delivered.

Revision 1.258: download - view: text, markup, annotated - select for diffs
Mon Mar 15 16:53:09 2010 UTC (22 months, 3 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.257: preferred, colored
Changes since revision 1.257: +17 -8 lines
SVN rev 205172 on 2010-03-15 16:53:09Z by marcel

Have cpu_throw() loop on blocked_lock as well. This bug has existed
a long time and has gone unnoticed just as long, because I kept
using sched_4bsd (due to sched_ule not working with preemption),
but GENERIC had sched_ule by default -- including SMP.

While here, remove unused inclusion of <machine/clock.h>, remove
totally bogus inclusion of <i386/include/specialreg.h>.

Revision 1.257: download - view: text, markup, annotated - select for diffs
Thu Mar 11 14:49:06 2010 UTC (23 months ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.256: preferred, colored
Changes since revision 1.256: +3 -3 lines
SVN rev 205014 on 2010-03-11 14:49:06Z by nwhitehorn

Provide groundwork for 32-bit binary compatibility on non-x86 platforms,
for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32
option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts
of the kernel and enhances the freebsd32 compatibility code to support
big-endian platforms.

Reviewed by:	kib, jhb

Revision 1.245.2.9: download - view: text, markup, annotated - select for diffs
Sat Feb 20 22:43:12 2010 UTC (23 months, 2 weeks ago) by marcel
Branches: RELENG_8
Diff to: previous 1.245.2.8: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.8: +9 -1 lines
SVN rev 204148 on 2010-02-20 22:43:12Z by marcel

MFC rev 203883:
o   Eliminate IA64_PHYS_TO_RR6 by calling bus_space_map() or pmap_mapdev().
o   Implement bus_space_map() in terms of pmap_mapdev().
o   Have ia64_pib hold the uncached virtual address of the PIB.

Revision 1.256: download - view: text, markup, annotated - select for diffs
Sun Feb 14 16:56:24 2010 UTC (23 months, 3 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.255: preferred, colored
Changes since revision 1.255: +9 -1 lines
SVN rev 203883 on 2010-02-14 16:56:24Z by marcel

Some code churn:
o   Eliminate IA64_PHYS_TO_RR6 and change all places where the macro is used
    by calling either bus_space_map() or pmap_mapdev().
o   Implement bus_space_map() in terms of pmap_mapdev() and implement
    bus_space_unmap() in terms of pmap_unmapdev().
o   Have ia64_pib hold the uncached virtual address of the processor interrupt
    block throughout the kernel's life and access the elements of the PIB
    through this structure pointer.

This is a non-functional change with the exception of using ia64_ld1() and
ia64_st8() to write to the PIB. We were still using assignments, for which
the compiler generates semaphore reads -- which cause undefined behaviour
for uncacheable memory. Note also that the memory barriers in ipi_send() are
critical for proper functioning.

With all the mapping of uncached memory done by pmap_mapdev(), we can keep
track of the translations and wire them in the CPU. This then eliminates
the need to reserve a whole region for uncached I/O and it eliminates
translation traps for device I/O accesses.

Revision 1.225.2.8.2.1: download - view: text, markup, annotated - select for diffs
Wed Feb 10 00:26:20 2010 UTC (2 years ago) by kensmith
Branches: RELENG_7_3
CVS tags: RELENG_7_3_0_RELEASE
Diff to: previous 1.225.2.8: preferred, colored; next MAIN 1.225.2.9: preferred, colored
Changes since revision 1.225.2.8: +0 -0 lines
SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)

Revision 1.255: download - view: text, markup, annotated - select for diffs
Wed Jan 27 02:32:07 2010 UTC (2 years ago) by marcel
Branches: MAIN
Diff to: previous 1.254: preferred, colored
Changes since revision 1.254: +1 -1 lines
SVN rev 203054 on 2010-01-27 02:32:07Z by marcel

In cpu_switch(), use an atomic operation to set the td_lock
of the old thread to the mutex that's passed.

Pointed out by: attilio, jhb

Revision 1.254: download - view: text, markup, annotated - select for diffs
Sat Jan 23 23:16:50 2010 UTC (2 years ago) by marcel
Branches: MAIN
Diff to: previous 1.253: preferred, colored
Changes since revision 1.253: +1 -8 lines
SVN rev 202904 on 2010-01-23 23:16:50Z by marcel

Remove cpu_boot() and call efi_reset_system() directly from
cpu_reset().

Revision 1.245.2.8: download - view: text, markup, annotated - select for diffs
Sun Jan 10 23:51:02 2010 UTC (2 years ago) by marcel
Branches: RELENG_8
Diff to: previous 1.245.2.7: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.7: +0 -10 lines
SVN rev 202052 on 2010-01-10 23:51:02Z by marcel

MFC rev 201269, 201373:
o   Revamp bus_space access functions (201269).
o   Change BUS_SPACE_MAXADDR from 2^32-1 to 2^64-1 (201373).

Revision 1.253: download - view: text, markup, annotated - select for diffs
Wed Dec 30 18:15:25 2009 UTC (2 years, 1 month ago) by marcel
Branches: MAIN
Diff to: previous 1.252: preferred, colored
Changes since revision 1.252: +0 -10 lines
SVN rev 201269 on 2009-12-30 18:15:25Z by marcel

Revamp bus_space access functions:
o   Optimize for memory mapped I/O by making all I/O port acceses function
    calls and marking the test for the IA64_BUS_SPACE_IO tag with
    __predict_false(). Implement the I/O port access functions in a new
    file, called bus_machdep.c.
o   Change the bus_space_handle_t for memory mapped I/O to the virtual
    address rather than the physical address. This eliminates the PA->VA
    translation for every I/O access. The handle for I/O port access is
    still the port number.
o   Move inb(), outb(), inw(), outw(), inl(), outl(), and their string
    variants from cpufunc.h and define them in bus.h. On ia64 these are
    not CPU functions at all. In bus.h they are merely aliases for the
    new I/O port access functions defined in bus_machdep.h.
o   Handle the ACPI resource bug in nexus_set_resource(). There we can
    do it once so that we don't have to worry about it whenever we need
    to write to an I/O port that is really a memory mapped address.

The upshot of this change is that the KBI is better defined and that I/O
port access always involves a function call, allowing us to change the
actual implementation without breaking the KBI. For memory mapped I/O the
virtual address is abstracted, so that we can change the VA->PA mapping
in the kernel without causing an KBI breakage. The exception at this time
is for bus_space_map() and bus_space_unmap().

MFC after:	1 week.

Revision 1.245.2.7: download - view: text, markup, annotated - select for diffs
Sat Dec 26 04:29:38 2009 UTC (2 years, 1 month ago) by marcel
Branches: RELENG_8
Diff to: previous 1.245.2.6: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.6: +37 -22 lines
SVN rev 201013 on 2009-12-26 04:29:38Z by marcel

MFC rev 200889:
Export the bus, cpu and itc frequencies under the hw.freq sysctl node.

Revision 1.252: download - view: text, markup, annotated - select for diffs
Wed Dec 23 04:48:42 2009 UTC (2 years, 1 month ago) by marcel
Branches: MAIN
Diff to: previous 1.251: preferred, colored
Changes since revision 1.251: +37 -22 lines
SVN rev 200889 on 2009-12-23 04:48:42Z by marcel

Export the bus, cpu and itc frequencies under the hw.freq sysctl node.
The frequencies are in MHz (i.e. a value of 1000 represents 1GHz). The
frequencies are rounded to the nearest whole MHz.

While here, rename and re-type bus_frequency, processor_frequency and
itc_frequency to bus_freq, cpu_freq and itc_freq and make them static.
As unsigned integers, the hw.freq.cpu sysctl can more easily be made
generic (across all architectures) making porting easier.

MFC after:	3 days

Revision 1.245.2.6: download - view: text, markup, annotated - select for diffs
Sat Dec 19 11:31:28 2009 UTC (2 years, 1 month ago) by kib
Branches: RELENG_8
Diff to: previous 1.245.2.5: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.5: +1 -7 lines
SVN rev 200722 on 2009-12-19 11:31:28Z by kib

MFC r198507:
Use kern_sigprocmask() instead of direct manipulation of td_sigmask to
reschedule newly blocked signals.

MFC r198590:
Trapsignal() calls kern_sigprocmask() when delivering catched signal
with proc lock held.

MFC r198670:
For trapsignal() and postsig(), kern_sigprocmask() is called with
both process lock and curproc->p_sigacts->ps_mtx locked. Prevent lock
recursion on ps_mtx in reschedule_signals().

Revision 1.245.2.5: download - view: text, markup, annotated - select for diffs
Sat Dec 12 05:14:40 2009 UTC (2 years, 1 month ago) by marcel
Branches: RELENG_8
Diff to: previous 1.245.2.4: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.4: +67 -4 lines
SVN rev 200431 on 2009-12-12 05:14:40Z by marcel

MFC rev 199893, 199941, 200200 and 200207:
o   Eliminate MAXCPU.
o   Revamp the PCPU structure.

Revision 1.251: download - view: text, markup, annotated - select for diffs
Mon Dec 7 06:41:27 2009 UTC (2 years, 2 months ago) by marcel
Branches: MAIN
Diff to: previous 1.250: preferred, colored
Changes since revision 1.250: +27 -24 lines
SVN rev 200207 on 2009-12-07 06:41:27Z by marcel

Define struct pcpu_md as the only MD field of struct pcpu (pc_acpi_id
excluded, as it's used by MI code) and mode the sysctl variables from
pcpu_stats to pcpu_md.
Adjust all references accordingly.

While nearby, change the PCPU sysctl tree so that they match the CPU
device sysctl tree -- they are now children of a static node called
"machdep.cpu" and are named only with their cpu ID.

Revision 1.245.2.4: download - view: text, markup, annotated - select for diffs
Fri Dec 4 18:29:59 2009 UTC (2 years, 2 months ago) by marcel
Branches: RELENG_8
Diff to: previous 1.245.2.3: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.3: +2 -2 lines
SVN rev 200103 on 2009-12-04 18:29:59Z by marcel

MFC rev 200051:
Make sure bus space accesses use unorder memory loads and stores.

Revision 1.250: download - view: text, markup, annotated - select for diffs
Thu Dec 3 04:06:48 2009 UTC (2 years, 2 months ago) by marcel
Branches: MAIN
Diff to: previous 1.249: preferred, colored
Changes since revision 1.249: +2 -2 lines
SVN rev 200051 on 2009-12-03 04:06:48Z by marcel

Make sure bus space accesses use unorder memory loads and stores.
Memory accesses are posted in program order by virtue of the
uncacheable memory attribute.
Since GCC, by default, adds acquire and release semantics to
volatile memory loads and stores, we need to use inline assembly
to guarantee it. With inline assembly, we don't need volatile
pointers anymore.

Itanium does not support semaphore instructions to uncacheable
memory.

Revision 1.249: download - view: text, markup, annotated - select for diffs
Sat Nov 28 21:01:15 2009 UTC (2 years, 2 months ago) by marcel
Branches: MAIN
Diff to: previous 1.248: preferred, colored
Changes since revision 1.248: +64 -4 lines
SVN rev 199893 on 2009-11-28 21:01:15Z by marcel

Eliminate teh use of MAXCPU in static arrays of interrupt counters by
adding statistics counters to the PCPU structure. Export the counters
through sysctl by giving each PCPU structure its own sysctl context.

While here, fix cnt.v_intr by not just having it count clock interrupts,
but every interrupt and add more counters for each interrupt source.

Revision 1.245.2.3: download - view: text, markup, annotated - select for diffs
Tue Nov 24 03:32:42 2009 UTC (2 years, 2 months ago) by marcel
Branches: RELENG_8
Diff to: previous 1.245.2.2: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.2: +0 -75 lines
SVN rev 199732 on 2009-11-24 03:32:42Z by marcel

MFC r198733:
Reimplement the lazy FP context switching...
...This change fixes the high FP inconsistency panics.

Revision 1.248: download - view: text, markup, annotated - select for diffs
Sat Oct 31 22:27:31 2009 UTC (2 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.247: preferred, colored
Changes since revision 1.247: +0 -75 lines
SVN rev 198733 on 2009-10-31 22:27:31Z by marcel

Reimplement the lazy FP context switching:
o   Move all code into a single file for easier maintenance.
o   Use a single global lock to avoid having to handle either
    multiple locks or race conditions.
o   Make sure to disable the high FP registers after saving
    or dropping them.
o   use msleep() to wait for the other CPU to save the high
    FP registers.

This change fixes the high FP inconsistency panics.

A single global lock typically serializes too much, which may
be noticable when a lot of threads use the high FP registers,
but in that case it's probably better to switch the high FP
context synchronuously. Put differently: cpu_switch() should
switch the high FP registers if the incoming and outgoing
threads both use the high FP registers.

Revision 1.247: download - view: text, markup, annotated - select for diffs
Tue Oct 27 10:47:58 2009 UTC (2 years, 3 months ago) by kib
Branches: MAIN
Diff to: previous 1.246: preferred, colored
Changes since revision 1.246: +1 -7 lines
SVN rev 198507 on 2009-10-27 10:47:58Z by kib

In r197963, a race with thread being selected for signal delivery
while in kernel mode, and later changing signal mask to block the
signal, was fixed for sigprocmask(2) and ptread_exit(3). The same race
exists for sigreturn(2), setcontext(2) and swapcontext(2) syscalls.

Use kern_sigprocmask() instead of direct manipulation of td_sigmask to
reschedule newly blocked signals, closing the race.

Reviewed by:	davidxu
Tested by:	pho
MFC after:	1 month

Revision 1.245.2.2.2.1: download - view: text, markup, annotated - select for diffs
Sun Oct 25 01:10:29 2009 UTC (2 years, 3 months ago) by kensmith
Branches: RELENG_8_0
CVS tags: RELENG_8_0_0_RELEASE
Diff to: previous 1.245.2.2: preferred, colored; next MAIN 1.245.2.3: preferred, colored
Changes since revision 1.245.2.2: +0 -0 lines
SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)

Revision 1.245.2.2: download - view: text, markup, annotated - select for diffs
Sun Aug 16 02:12:13 2009 UTC (2 years, 5 months ago) by marcel
Branches: RELENG_8
CVS tags: RELENG_8_0_BP
Branch point for: RELENG_8_0
Diff to: previous 1.245.2.1: preferred, colored; branchpoint 1.245: preferred, colored
Changes since revision 1.245.2.1: +5 -1 lines
SVN rev 196270 on 2009-08-16 02:12:13Z by marcel

MFC rev 196268:
Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be
sparse, which causes a kernel assert.

Approved by:	re (kensmith)

Revision 1.246: download - view: text, markup, annotated - select for diffs
Sun Aug 16 01:43:08 2009 UTC (2 years, 5 months ago) by marcel
Branches: MAIN
Diff to: previous 1.245: preferred, colored
Changes since revision 1.245: +5 -1 lines
SVN rev 196268 on 2009-08-16 01:43:08Z by marcel

Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be
sparse, which causes a kernel assert.

Approved by:	re (kensmith)

Revision 1.245.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 3 08:13:06 2009 UTC (2 years, 6 months ago) by kensmith
Branches: RELENG_8
Diff to: previous 1.245: preferred, colored
Changes since revision 1.245: +0 -0 lines
SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)

Revision 1.225.2.8: download - view: text, markup, annotated - select for diffs
Tue Jun 30 14:11:43 2009 UTC (2 years, 7 months ago) by avg
Branches: RELENG_7
CVS tags: RELENG_7_4_BP, RELENG_7_3_BP
Branch point for: RELENG_7_4, RELENG_7_3
Diff to: previous 1.225.2.7: preferred, colored; branchpoint 1.225: preferred, colored
Changes since revision 1.225.2.7: +0 -8 lines
SVN rev 195193 on 2009-06-30 14:11:43Z by avg

MFC 179229 (alc), 195188: The VM system no longer uses setPQL2().

Remove it and its helpers.
Drop unused extern declarations in amd64 that seem to have been related.

Reviewed by:	alc

Revision 1.245: download - view: text, markup, annotated - select for diffs
Tue Jun 23 22:42:39 2009 UTC (2 years, 7 months ago) by jeff
Branches: MAIN
CVS tags: RELENG_8_BP
Branch point for: RELENG_8
Diff to: previous 1.244: preferred, colored
Changes since revision 1.244: +17 -15 lines
SVN rev 194784 on 2009-06-23 22:42:39Z by jeff

Implement a facility for dynamic per-cpu variables.
 - Modules and kernel code alike may use DPCPU_DEFINE(),
   DPCPU_GET(), DPCPU_SET(), etc. akin to the statically defined
   PCPU_*.  Requires only one extra instruction more than PCPU_* and is
   virtually the same as __thread for builtin and much faster for shared
   objects.  DPCPU variables can be initialized when defined.
 - Modules are supported by relocating the module's per-cpu linker set
   over space reserved in the kernel.  Modules may fail to load if there
   is insufficient space available.
 - Track space available for modules with a one-off extent allocator.
   Free may block for memory to allocate space for an extent.

Reviewed by:    jhb, rwatson, kan, sam, grehan, marius, marcel, stas

Revision 1.244: download - view: text, markup, annotated - select for diffs
Mon May 18 18:44:54 2009 UTC (2 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.243: preferred, colored
Changes since revision 1.243: +4 -4 lines
SVN rev 192324 on 2009-05-18 18:44:54Z by marcel

Rename ia64_invalidate_icache() to ia64_sync_icache(). We're
not invalidating anything.

Revision 1.243: download - view: text, markup, annotated - select for diffs
Mon May 18 18:37:18 2009 UTC (2 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.242: preferred, colored
Changes since revision 1.242: +15 -0 lines
SVN rev 192323 on 2009-05-18 18:37:18Z by marcel

Add cpu_flush_dcache() for use after non-DMA based I/O so that a
possible future I-cache coherency operation can succeed. On ARM
for example the L1 cache can be (is) virtually mapped, which
means that any I/O that uses temporary mappings will not see the
I-cache made coherent. On ia64 a similar behaviour has been
observed. By flushing the D-cache, execution of binaries backed
by md(4) and/or NFS work reliably.
For Book-E (powerpc), execution over NFS exhibits SIGILL once in
a while as well, though cpu_flush_dcache() hasn't been implemented
yet.

Doing an explicit D-cache flush as part of the non-DMA based I/O
read operation eliminates the need to do it as part of the
I-cache coherency operation itself and as such avoids pessimizing
the DMA-based I/O read operations for which D-cache are already
flushed/invalidated. It also allows future optimizations whereby
the bcopy() followed by the D-cache flush can be integrated in a
single operation, which could be implemented using on-chips DMA
engines, by-passing the D-cache altogether.

Revision 1.225.2.7.4.1: download - view: text, markup, annotated - select for diffs
Wed Apr 15 03:14:26 2009 UTC (2 years, 9 months ago) by kensmith
Branches: RELENG_7_2
CVS tags: RELENG_7_2_0_RELEASE
Diff to: previous 1.225.2.7: preferred, colored; next MAIN 1.225.2.8: preferred, colored
Changes since revision 1.225.2.7: +0 -0 lines
SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)

Revision 1.225.2.7.2.1: download - view: text, markup, annotated - select for diffs
Tue Nov 25 02:59:29 2008 UTC (3 years, 2 months ago) by kensmith
Branches: RELENG_7_1
CVS tags: RELENG_7_1_0_RELEASE
Diff to: previous 1.225.2.7: preferred, colored; next MAIN 1.225.2.8: preferred, colored
Changes since revision 1.225.2.7: +0 -0 lines
SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)

Revision 1.200.2.5.6.1: download - view: text, markup, annotated - select for diffs
Thu Oct 2 02:57:24 2008 UTC (3 years, 4 months ago) by kensmith
Branches: RELENG_6_4
CVS tags: RELENG_6_4_0_RELEASE
Diff to: previous 1.200.2.5: preferred, colored; next MAIN 1.201: preferred, colored
Changes since revision 1.200.2.5: +0 -0 lines
SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)

Revision 1.225.2.7: download - view: text, markup, annotated - select for diffs
Tue Jul 22 14:27:47 2008 UTC (3 years, 6 months ago) by rwatson
Branches: RELENG_7
CVS tags: RELENG_7_2_BP, RELENG_7_1_BP
Branch point for: RELENG_7_2, RELENG_7_1
Diff to: previous 1.225.2.6: preferred, colored; branchpoint 1.225: preferred, colored
Changes since revision 1.225.2.6: +1 -1 lines
SVN rev 180695 on 2008-07-22 14:27:47Z by rwatson

Merge r177253, r177255 from head to stable/7:

  In keeping with style(9)'s recommendations on macros, use a ';'
  after each SYSINIT() macro invocation.  This makes a number of
  lightweight C parsers much happier with the FreeBSD kernel
  source, including cflow's prcc and lxr.

  Discussed with: imp, rink

The requirement to place a ; after each SYSINIT definition has not been
MFC'd, as this might break the compile third-party modules, but merging
the actual ; additions reduces diffs against 8.x making it easier to
merge other changes.

Revision 1.242: download - view: text, markup, annotated - select for diffs
Mon Jul 7 17:43:56 2008 UTC (3 years, 7 months ago) by marcel
Branches: MAIN
Diff to: previous 1.241: preferred, colored
Changes since revision 1.241: +4 -1 lines
SVN rev 180354 on 2008-07-07 17:43:56Z by marcel

Add inline function ia64_fc_i() to abstract inline assembly.
Use the new inline function in ia64_invalidate_icache().
While there, add proper synchronization so that we know
the fc.i instructions have taken effect when we return.

Revision 1.225.2.6: download - view: text, markup, annotated - select for diffs
Sun Jun 1 18:04:29 2008 UTC (3 years, 8 months ago) by marcel
Branches: RELENG_7
Diff to: previous 1.225.2.5: preferred, colored; branchpoint 1.225: preferred, colored
Changes since revision 1.225.2.5: +6 -3 lines
SVN rev 179479 on 2008-06-01 18:04:29Z by marcel

Merge rev 179173:

We can call ia64_flush_dirty() when the corresponding process is
locked or not. As such, use PROC_LOCKED() to determine which case
it is and lock the process when not.

This is a manual merge. No merge history is created.

Revision 1.241: download - view: text, markup, annotated - select for diffs
Fri May 23 04:03:53 2008 UTC (3 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.240: preferred, colored
Changes since revision 1.240: +0 -8 lines
The VM system no longer uses setPQL2().  Remove it and its helpers.

Revision 1.240: download - view: text, markup, annotated - select for diffs
Wed May 21 05:15:27 2008 UTC (3 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.239: preferred, colored
Changes since revision 1.239: +6 -3 lines
We can call ia64_flush_dirty() when the corresponding process is
locked or not. As such, use PROC_LOCKED() to determine which case
it is and lock the process when not.

Revision 1.225.2.5: download - view: text, markup, annotated - select for diffs
Sat Apr 26 03:50:24 2008 UTC (3 years, 9 months ago) by marcel
Branches: RELENG_7
Diff to: previous 1.225.2.4: preferred, colored; branchpoint 1.225: preferred, colored
Changes since revision 1.225.2.4: +18 -5 lines
MFC: Better implement I-cache invalidation.

 Revision  Changes    Path
 1.25      +4 -0      src/sys/ia64/ia64/elf_machdep.c
 1.235     +18 -5     src/sys/ia64/ia64/machdep.c
 1.198     +37 -84    src/sys/ia64/ia64/pmap.c
 1.28      +1 -0      src/sys/ia64/include/md_var.h

Revision 1.239: download - view: text, markup, annotated - select for diffs
Fri Apr 25 16:09:03 2008 UTC (3 years, 9 months ago) by marcel
Branches: MAIN
Diff to: previous 1.238: preferred, colored
Changes since revision 1.238: +10 -13 lines
Unbreak previous commit. While here, refactor the code a bit.

Revision 1.238: download - view: text, markup, annotated - select for diffs
Fri Apr 25 05:18:48 2008 UTC (3 years, 9 months ago) by jeff
Branches: MAIN
Diff to: previous 1.237: preferred, colored
Changes since revision 1.237: +8 -1 lines
 - Add an integer argument to idle to indicate how likely we are to wake
   from idle over the next tick.
 - Add a new MD routine, cpu_wake_idle() to wakeup idle threads who are
   suspended in cpu specific states.  This function can fail and cause the
   scheduler to fall back to another mechanism (ipi).
 - Implement support for mwait in cpu_idle() on i386/amd64 machines that
   support it.  mwait is a higher performance way to synchronize cpus
   as compared to hlt & ipis.
 - Allow selecting the idle routine by name via sysctl machdep.idle.  This
   replaces machdep.cpu_idle_hlt.  Only idle routines supported by the
   current machine are permitted.

Sponsored by:	Nokia

Revision 1.225.2.4: download - view: text, markup, annotated - select for diffs
Thu Apr 24 22:42:00 2008 UTC (3 years, 9 months ago) by marcel
Branches: RELENG_7
Diff to: previous 1.225.2.3: preferred, colored; branchpoint 1.225: preferred, colored
Changes since revision 1.225.2.3: +1 -1 lines
MFC fix for PR ia64/118024

o  Rename cpu_thread_setup() to cpu_thread_alloc() to better communicate that
   it relates to (is called by) thread_alloc()
o  Add cpu_thread_free() which is called from thread_free() to counter-act
   cpu_thread_alloc().

i386:	Have cpu_thread_free() call cpu_thread_clean() to preserve behaviour.
ia64:	Have cpu_thread_free() call mtx_destroy() for the mutex initialized
	in cpu_thread_alloc().

files:	sys/amd64/amd64/vm_machdep.c:1.256
	sys/arm/arm/vm_machdep.c:1.35
	sys/i386/i386/vm_machdep.c1.284
	sys/ia64/ia64/machdep.c:1.227
	sys/ia64/ia64/vm_machdep.c:1.95
	sys/kern/kern_thread.c:1.260
	sys/powerpc/powerpc/vm_machdep.c:1.117
	sys/sparc64/sparc64/vm_machdep.c:1.77
	sys/sun4v/sun4v/vm_machdep.c:1.8
	sys/sys/proc.h:1.495

Revision 1.237: download - view: text, markup, annotated - select for diffs
Tue Apr 22 19:38:28 2008 UTC (3 years, 9 months ago) by phk
Branches: MAIN
Diff to: previous 1.236: preferred, colored
Changes since revision 1.236: +0 -1 lines
Now that all platforms use genclock, shuffle things around slightly
for better structure.

Much of this is related to <sys/clock.h>, which should really have
been called <sys/calendar.h>, but unless and until we need the name,
the repocopy can wait.

In general the kernel does not know about minutes, hours, days,
timezones, daylight savings time, leap-years and such.  All that
is theoretically a matter for userland only.

Parts of kernel code does however care: badly designed filesystems
store timestamps in local time and RTC chips almost universally
track time in a YY-MM-DD HH:MM:SS format, and sometimes in local
timezone instead of UTC.  For this we have <sys/clock.h>

<sys/time.h> on the other hand, deals with time_t, timeval, timespec
and so on.  These know only seconds and fractions thereof.

Move inittodr() and resettodr() prototypes to <sys/time.h>.
Retain the names as it is one of the few surviving PDP/VAX references.

Move startrtclock() to <machine/clock.h> on relevant platforms, it
is a MD call between machdep.c/clock.c.  Remove references to it
elsewhere.

Remove a lot of unnecessary <sys/clock.h> includes.

Move the machdep.disable_rtc_set sysctl to subr_rtc.c where it belongs.
XXX: should be kern.disable_rtc_set really, it's not MD.

Revision 1.236: download - view: text, markup, annotated - select for diffs
Tue Apr 15 05:02:42 2008 UTC (3 years, 9 months ago) by marcel
Branches: MAIN
Diff to: previous 1.235: preferred, colored
Changes since revision 1.235: +11 -0 lines
Support and switch to the ULE scheduler:
o  Implement IPI_PREEMPT,
o  Set td_lock for the thread being switched out,
o  For ULE & SMP, loop while td_lock points to blocked_lock for
   the thread being switched in,
o  Enable ULE by default in GENERIC and SKI,

Revision 1.235: download - view: text, markup, annotated - select for diffs
Sun Mar 30 23:09:14 2008 UTC (3 years, 10 months ago) by marcel
Branches: MAIN
Diff to: previous 1.234: preferred, colored
Changes since revision 1.234: +18 -5 lines
Better implement I-cache invalidation. The previous implementation
was a kluge. This implementation matches the behaviour on powerpc
and sparc64.
While on the subject, make sure to invalidate the I-cache after
loading a kernel module.

MFC after: 2 weeks

Revision 1.225.2.3: download - view: text, markup, annotated - select for diffs
Sun Mar 30 09:19:07 2008 UTC (3 years, 10 months ago) by rwatson
Branches: RELENG_7
Diff to: previous 1.225.2.2: preferred, colored; branchpoint 1.225: preferred, colored
Changes since revision 1.225.2.2: +2 -1 lines
Merge amd64/machdep.c:1.680, amd64/mp_watchdog.c:1.6,
uart_dev_at91usart.c:1.13, scsi_low.h:1.9, subr_ntoskrnl.c:1.94,
OsdDebug.c:1.14, dcons_os.c:1.20, ofw_consle.c:1.37,
dev/sio.c:1.473, syscons.c:1.454, uart_core.c:1.23,
union_subr.c:1.96, i386/machdep.c:1.664, i386/mp_watchdog.c:1.6,
ia64/machdep.c:1.228, kern_clock.c:1.206, kern_shutdown.c:1.186,
subr_kdb.c:1.25, subr_witness.c:1.239, vfs_subr.c:1.711,
ng_base.c:1.140, cbus/sio.c:1.247, pc98/machdep.c:1.399,
aim/machdep.c:1.107, pswitch.c:1.7, mac_test.c:19.3,
psycho.c:1.73, sparc64/machdep.c:1.140, sparc64/trap.c:1.89,
hvcons.c:1.7, sun4v/machdep.c:1.17, sun4v/trap.c:1.17, kdb.h:1.6
from HEAD to RELENG_7:

  Add a new 'why' argument to kdb_enter(), and a set of constants to use
  for that argument.  This will allow DDB to detect the broad category of
  reason why the debugger has been entered, which it can use for the
  purposes of deciding which DDB script to run.

  Assign approximate why values to all current consumers of the
  kdb_enter() interface.

For ABI/KPI reasons, the MFC creates a new function, kdb_enter_why(),
with the new argument, updating existing consumers to use that,
preserving kdb_enter() with the current argument, and wrapping it around
kdb_enter_why().

Revision 1.234: download - view: text, markup, annotated - select for diffs
Wed Mar 26 20:09:19 2008 UTC (3 years, 10 months ago) by phk
Branches: MAIN
Diff to: previous 1.233: preferred, colored
Changes since revision 1.233: +0 -6 lines
The "free-lance" timer in the i8254 is only used for the speaker
these days, so de-generalize the acquire_timer/release_timer api
to just deal with speakers.

The new (optional) MD functions are:
	timer_spkr_acquire()
	timer_spkr_release()
and
	timer_spkr_setfreq()

the last of which configures the timer to generate a tone of a given
frequency, in Hz instead of 1/1193182th of seconds.

Drop entirely timer2 on pc98, it is not used anywhere at all.

Move sysbeep() to kern/tty_cons.c and use the timer_spkr*() if
they exist, and do nothing otherwise.

Remove prototypes and empty acquire-/release-timer() and sysbeep()
functions from the non-beeping archs.

This eliminate the need for the speaker driver to know about
i8254frequency at all.  In theory this makes the speaker driver MI,
contingent on the timer_spkr_*() functions existing but the driver
does not know this yet and still attaches to the ISA bus.

Syscons is more tricky, in one function, sc_tone(), it knows the hz
and things are just fine.

In the other function, sc_bell() it seems to get the period from
the KDMKTONE ioctl in terms if 1/1193182th second, so we hardcode
the 1193182 and leave it at that.  It's probably not important.

Change a few other sysbeep() uses which obviously knew that the
argument was in terms of i8254 frequency, and leave alone those
that look like people thought sysbeep() took frequency in hertz.

This eliminates the knowledge of i8254_freq from all but the actual
clock.c code and the prof_machdep.c on amd64 and i386, where I think
it would be smart to ask for help from the timecounters anyway [TBD].

Revision 1.233: download - view: text, markup, annotated - select for diffs
Sun Mar 16 10:58:04 2008 UTC (3 years, 10 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.232: preferred, colored
Changes since revision 1.232: +1 -1 lines
In keeping with style(9)'s recommendations on macros, use a ';'
after each SYSINIT() macro invocation.  This makes a number of
lightweight C parsers much happier with the FreeBSD kernel
source, including cflow's prcc and lxr.

MFC after:	1 month
Discussed with:	imp, rink

Revision 1.232: download - view: text, markup, annotated - select for diffs
Wed Mar 12 22:14:14 2008 UTC (3 years, 10 months ago) by jeff
Branches: MAIN
Diff to: previous 1.231: preferred, colored
Changes since revision 1.231: +3 -4 lines
 - Fix build breakage; there was a reference to a removed syscall in
   a KASSERT().  Attempt to cleanup the comment to reflect reality.

Revision 1.231: download - view: text, markup, annotated - select for diffs
Wed Mar 12 10:11:58 2008 UTC (3 years, 11 months ago) by jeff
Branches: MAIN
Diff to: previous 1.230: preferred, colored
Changes since revision 1.230: +0 -3 lines
Remove kernel support for M:N threading.

While the KSE project was quite successful in bringing threading to
FreeBSD, the M:N approach taken by the kse library was never developed
to its full potential.  Backwards compatibility will be provided via
libmap.conf for dynamically linked binaries and static binaries will
be broken.

Revision 1.225.4.2: download - view: text, markup, annotated - select for diffs
Thu Feb 14 22:51:51 2008 UTC (3 years, 11 months ago) by marcel
Branches: RELENG_7_0
CVS tags: RELENG_7_0_0_RELEASE
Diff to: previous 1.225.4.1: preferred, colored; branchpoint 1.225: preferred, colored; next MAIN 1.226: preferred, colored
Changes since revision 1.225.4.1: +6 -0 lines
MFC: machdep.c:1.230, pmap.c:1.197

On Montecito processors, the instruction cache is in fact not
coherent with the data caches. Implement a quick fix to allow
us to boot on Montecito, while I'm working on a better fix in
the mean time.

Approved by: re (kensmith - big thanks!)

Revision 1.225.2.2: download - view: text, markup, annotated - select for diffs
Thu Feb 14 19:15:46 2008 UTC (3 years, 11 months ago) by marcel
Branches: RELENG_7
Diff to: previous 1.225.2.1: preferred, colored; branchpoint 1.225: preferred, colored
Changes since revision 1.225.2.1: +6 -0 lines
Insta MFC: machdep.c:1.230, pmap.c:1.197

On Montecito processors, the instruction cache is in fact not
coherent with the data caches. Implement a quick fix to allow
us to boot on Montecito, while I'm working on a better fix in
the mean time.

Commit made on Montecito-based Itanium...

Revision 1.230: download - view: text, markup, annotated - select for diffs
Thu Feb 14 18:46:50 2008 UTC (3 years, 11 months ago) by marcel
Branches: MAIN
Diff to: previous 1.229: preferred, colored
Changes since revision 1.229: +6 -0 lines
On Montecito processors, the instruction cache is in fact not
coherent with the data caches. Implement a quick fix to allow
us to boot on Montecito, while I'm working on a better fix in
the mean time.

Commit made on Montecito-based Itanium...

Revision 1.229: download - view: text, markup, annotated - select for diffs
Mon Feb 4 02:21:33 2008 UTC (4 years ago) by marcel
Branches: MAIN
Diff to: previous 1.228: preferred, colored
Changes since revision 1.228: +6 -20 lines
Allocate a stack for thread0 and switch to it before calling
mi_startup(). This frees up kstack for static PAL/SAL calls
and double-fault handling.

Revision 1.225.4.1: download - view: text, markup, annotated - select for diffs
Sat Jan 19 18:15:04 2008 UTC (4 years ago) by kib
Branches: RELENG_7_0
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +1 -1 lines
MFC fix for the panic("vm_thread_new: kstack allocation failed") and
silent NULL pointer dereference in the i386 and sparc64 pmap_pinit()
when the kmem_alloc_nofault() failed to allocate address space. Both
functions now return error instead of panicing or dereferencing NULL.

The reason for MFCing this so late in release cycle is, according to
marius@, because
> it fixes the crashing (though no panic) of the test suite
> of the graphic/OpenEXR port on sparc64. This test suite is run
> (and required to succeed) during the package build and that's
> why portmgr@ bitch about at it as OpenEXR is a dependency of KDE
> which in turn is supposed to end up on the release CD images.

Revisions MFCed:
  1.677     of      src/sys/amd64/amd64/machdep.c
  1.592     of      src/sys/amd64/amd64/pmap.c
  1.88      of      src/sys/arm/arm/pmap.c
  1.27      of      src/sys/arm/at91/kb920x_machdep.c
  1.22      of      src/sys/arm/sa11x0/assabet_machdep.c
  1.8       of      src/sys/arm/xscale/i80321/ep80219_machdep.c
  1.29      of      src/sys/arm/xscale/i80321/iq31244_machdep.c
  1.3       of      src/sys/arm/xscale/i8134x/crb_machdep.c
  1.6       of      src/sys/arm/xscale/ixp425/avila_machdep.c
  1.41      of      src/sys/compat/pecoff/imgact_pecoff.c
  1.26      of      src/sys/compat/svr4/imgact_svr4.c
  1.660     of      src/sys/i386/i386/machdep.c
  1.596     of      src/sys/i386/i386/pmap.c
  1.68      of      src/sys/i386/ibcs2/imgact_coff.c
  1.56      of      src/sys/i386/linux/imgact_linux.c
  1.226     of      src/sys/ia64/ia64/machdep.c
  1.192     of      src/sys/ia64/ia64/pmap.c
  1.102     of      src/sys/kern/imgact_aout.c
  1.179     of      src/sys/kern/imgact_elf.c
  1.56      of      src/sys/kern/imgact_gzip.c
  1.310     of      src/sys/kern/kern_exec.c
  1.287     of      src/sys/kern/kern_fork.c
  1.236     of      src/sys/kern/kern_kse.c
  1.253     of      src/sys/kern/kern_proc.c
  1.352     of      src/sys/kern/kern_sig.c
  1.63      of      src/sys/kern/kern_thr.c
  1.257     of      src/sys/kern/kern_thread.c
  1.397     of      src/sys/pc98/pc98/machdep.c
  1.104     of      src/sys/powerpc/powerpc/machdep.c
  1.10      of      src/sys/powerpc/powerpc/pmap_dispatch.c
  1.139     of      src/sys/sparc64/sparc64/machdep.c
  1.167     of      src/sys/sparc64/sparc64/pmap.c
  1.16      of      src/sys/sun4v/sun4v/machdep.c
  1.40      of      src/sys/sun4v/sun4v/pmap.c
  1.493     of      src/sys/sys/proc.h
  1.78      of      src/sys/sys/signalvar.h
  1.80      of      src/sys/vm/pmap.h
  1.79      of      src/sys/vm/vm_extern.h
  1.226     of      src/sys/vm/vm_glue.c
  1.390     of       src/sys/vm/vm_map.c

Requested by:	marius
Tested by:	Peter Holm, marius (make universe and sparc64 runs)
Approved by:	re (kensmith)

Revision 1.225.2.1: download - view: text, markup, annotated - select for diffs
Fri Jan 18 10:02:50 2008 UTC (4 years ago) by kib
Branches: RELENG_7
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +1 -1 lines
MFC fix for the panic("vm_thread_new: kstack allocation failed") and
silent NULL pointer dereference in the i386 and sparc64 pmap_pinit()
when the kmem_alloc_nofault() failed to allocate address space. Both
functions now return error instead of panicing or dereferencing NULL.

The reason for MFCing this so late in release cycle is, according to
marius@, because
> it fixes the crashing (though no panic) of the test suite
> of the graphic/OpenEXR port on sparc64. This test suite is run
> (and required to succeed) during the package build and that's
> why portmgr@ bitch about at it as OpenEXR is a dependency of KDE
> which in turn is supposed to end up on the release CD images.

Revisions MFCed:
  1.677     of      src/sys/amd64/amd64/machdep.c
  1.592     of      src/sys/amd64/amd64/pmap.c
  1.88      of      src/sys/arm/arm/pmap.c
  1.27      of      src/sys/arm/at91/kb920x_machdep.c
  1.22      of      src/sys/arm/sa11x0/assabet_machdep.c
  1.8       of      src/sys/arm/xscale/i80321/ep80219_machdep.c
  1.29      of      src/sys/arm/xscale/i80321/iq31244_machdep.c
  1.3       of      src/sys/arm/xscale/i8134x/crb_machdep.c
  1.6       of      src/sys/arm/xscale/ixp425/avila_machdep.c
  1.41      of      src/sys/compat/pecoff/imgact_pecoff.c
  1.26      of      src/sys/compat/svr4/imgact_svr4.c
  1.660     of      src/sys/i386/i386/machdep.c
  1.596     of      src/sys/i386/i386/pmap.c
  1.68      of      src/sys/i386/ibcs2/imgact_coff.c
  1.56      of      src/sys/i386/linux/imgact_linux.c
  1.226     of      src/sys/ia64/ia64/machdep.c
  1.192     of      src/sys/ia64/ia64/pmap.c
  1.102     of      src/sys/kern/imgact_aout.c
  1.179     of      src/sys/kern/imgact_elf.c
  1.56      of      src/sys/kern/imgact_gzip.c
  1.310     of      src/sys/kern/kern_exec.c
  1.287     of      src/sys/kern/kern_fork.c
  1.236     of      src/sys/kern/kern_kse.c
  1.253     of      src/sys/kern/kern_proc.c
  1.352     of      src/sys/kern/kern_sig.c
  1.63      of      src/sys/kern/kern_thr.c
  1.257     of      src/sys/kern/kern_thread.c
  1.397     of      src/sys/pc98/pc98/machdep.c
  1.104     of      src/sys/powerpc/powerpc/machdep.c
  1.10      of      src/sys/powerpc/powerpc/pmap_dispatch.c
  1.139     of      src/sys/sparc64/sparc64/machdep.c
  1.167     of      src/sys/sparc64/sparc64/pmap.c
  1.16      of      src/sys/sun4v/sun4v/machdep.c
  1.40      of      src/sys/sun4v/sun4v/pmap.c
  1.493     of      src/sys/sys/proc.h
  1.78      of      src/sys/sys/signalvar.h
  1.80      of      src/sys/vm/pmap.h
  1.79      of      src/sys/vm/vm_extern.h
  1.226     of      src/sys/vm/vm_glue.c
  1.390     of       src/sys/vm/vm_map.c

Requested by:	marius
Tested by:	Peter Holm, marius (make universe and sparc64 runs)
Approved by:	re (kensmith)

Revision 1.228: download - view: text, markup, annotated - select for diffs
Tue Dec 25 17:51:58 2007 UTC (4 years, 1 month ago) by rwatson
Branches: MAIN
Diff to: previous 1.227: preferred, colored
Changes since revision 1.227: +2 -1 lines
Add a new 'why' argument to kdb_enter(), and a set of constants to use
for that argument.  This will allow DDB to detect the broad category of
reason why the debugger has been entered, which it can use for the
purposes of deciding which DDB script to run.

Assign approximate why values to all current consumers of the
kdb_enter() interface.

Revision 1.227: download - view: text, markup, annotated - select for diffs
Wed Nov 14 20:21:53 2007 UTC (4 years, 2 months ago) by marcel
Branches: MAIN
Diff to: previous 1.226: preferred, colored
Changes since revision 1.226: +1 -1 lines
o  Rename cpu_thread_setup() to cpu_thread_alloc() to better
   communicate that it relates to (is called by) thread_alloc()
o  Add cpu_thread_free() which is called from thread_free()
   to counter-act cpu_thread_alloc().

i386:	Have cpu_thread_free() call cpu_thread_clean() to
	preserve behaviour.
ia64:	Have cpu_thread_free() call mtx_destroy() for the
	mutex initialized in cpu_thread_alloc().

PR: ia64/118024

Revision 1.226: download - view: text, markup, annotated - select for diffs
Mon Nov 5 11:36:13 2007 UTC (4 years, 3 months ago) by kib
Branches: MAIN
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +1 -1 lines
Fix for the panic("vm_thread_new: kstack allocation failed") and
silent NULL pointer dereference in the i386 and sparc64 pmap_pinit()
when the kmem_alloc_nofault() failed to allocate address space. Both
functions now return error instead of panicing or dereferencing NULL.

As consequence, vmspace_exec() and vmspace_unshare() returns the errno
int. struct vmspace arg was added to vm_forkproc() to avoid dealing
with failed allocation when most of the fork1() job is already done.

The kernel stack for the thread is now set up in the thread_alloc(),
that itself may return NULL. Also, allocation of the first process
thread is performed in the fork1() to properly deal with stack
allocation failure. proc_linkup() is separated into proc_linkup()
called from fork1(), and proc_linkup0(), that is used to set up the
kernel process (was known as swapper).

In collaboration with:	Peter Holm
Reviewed by:	jhb

Revision 1.225: download - view: text, markup, annotated - select for diffs
Sat Aug 4 19:33:27 2007 UTC (4 years, 6 months ago) by marcel
Branches: MAIN
CVS tags: RELENG_7_BP, RELENG_7_0_BP
Branch point for: RELENG_7_0, RELENG_7
Diff to: previous 1.224: preferred, colored
Changes since revision 1.224: +18 -16 lines
Replace "__asm __volatile()" by equivalent support functions from
ia64_cpu.h. This improves readability and consistency and aids in
auditing the code.
Add data-serialization after writing to cr.tpr.

Approved by: re (blanket)

Revision 1.224: download - view: text, markup, annotated - select for diffs
Mon Jul 30 22:12:53 2007 UTC (4 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.223: preferred, colored
Changes since revision 1.223: +24 -0 lines
Explicitly map the VHPT on all processors. Previously we were
merely lucky that the VHPT was mapped as a side-effect of
mapping the kernel, but when there's enough physical memory,
this may not at all be the case.

Approved by: re (blanket)

Revision 1.223: download - view: text, markup, annotated - select for diffs
Sun Jun 10 23:39:07 2007 UTC (4 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.222: preferred, colored
Changes since revision 1.222: +3 -1 lines
Add the machine-specific definitions for configuring the new physical
memory allocator.

Set the size of phys_avail[] using one of these definitions.

Approved by:	re

Revision 1.222: download - view: text, markup, annotated - select for diffs
Sun Jun 10 16:53:00 2007 UTC (4 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.221: preferred, colored
Changes since revision 1.221: +10 -0 lines
Work around a firmware bug in the HP rx2660, where in ACPI an I/O port
is really a memory mapped I/O address. The bug is in the GAS that
describes the address and in particular the SpaceId field. The field
should not say the address is an I/O port when it clearly is not.

With an additional check for the IA64_BUS_SPACE_IO case in the bus
access functions, and the fact that I/O ports pretty much not used
in general on ia64, make the calculation of the I/O port address a
function. This avoids inlining the work-around into every driver,
and also helps reduce overall code bloat.

Revision 1.221: download - view: text, markup, annotated - select for diffs
Sat Jun 9 01:19:08 2007 UTC (4 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.220: preferred, colored
Changes since revision 1.220: +4 -3 lines
Physical memory regions can be larger than INT_MAX. Change size1
from an int to a long to avoid printing negative byte and page
counts.

Revision 1.220: download - view: text, markup, annotated - select for diffs
Thu Jun 7 18:36:58 2007 UTC (4 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.219: preferred, colored
Changes since revision 1.219: +0 -2 lines
Remove remaining references to pc_curtid missed in previous commit.

Revision 1.219: download - view: text, markup, annotated - select for diffs
Thu Jun 7 01:53:29 2007 UTC (4 years, 8 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +0 -1 lines
Fix compiling error.

Revision 1.218: download - view: text, markup, annotated - select for diffs
Mon Jun 4 23:58:47 2007 UTC (4 years, 8 months ago) by jeff
Branches: MAIN
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +1 -1 lines
Commit 13/14 of sched_lock decomposition.
 - Add a new parameter to cpu_switch() that is used to release the lock on
   the outgoing thread and properly acquire the lock on the incoming
   thread.  This parameter is not required for schedulers that don't do
   per-cpu locking and architectures which do not support it may continue
   to use the 4BSD scheduler.  This feature is presently not supported
   on ia64

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)

Revision 1.217: download - view: text, markup, annotated - select for diffs
Thu May 31 22:52:12 2007 UTC (4 years, 8 months ago) by attilio
Branches: MAIN
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +2 -2 lines
Revert VMCNT_* operations introduction.
Probabilly, a general approach is not the better solution here, so we should
solve the sched_lock protection problems separately.

Requested by: alc
Approved by: jeff (mentor)

Revision 1.216: download - view: text, markup, annotated - select for diffs
Fri May 18 07:10:45 2007 UTC (4 years, 8 months ago) by jeff
Branches: MAIN
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +2 -2 lines
 - define and use VMCNT_{GET,SET,ADD,SUB,PTR} macros for manipulating
   vmcnts.  This can be used to abstract away pcpu details but also changes
   to use atomics for all counters now.  This means sched lock is no longer
   responsible for protecting counts in the switch routines.

Contributed by:		Attilio Rao <attilio@FreeBSD.org>

Revision 1.215: download - view: text, markup, annotated - select for diffs
Sat May 5 19:50:27 2007 UTC (4 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +0 -15 lines
Define every architecture as either VM_PHYSSEG_DENSE or
VM_PHYSSEG_SPARSE depending on whether the physical address space is
densely or sparsely populated with memory.  The effect of this
definition is to determine which of two implementations of
vm_page_array and PHYS_TO_VM_PAGE() is used.  The legacy
implementation is obtained by defining VM_PHYSSEG_DENSE, and a new
implementation that trades off time for space is obtained by defining
VM_PHYSSEG_SPARSE.  For now, all architectures except for ia64 and
sparc64 define VM_PHYSSEG_DENSE.  Defining VM_PHYSSEG_SPARSE on ia64
allows the entirety of my Itanium 2's memory to be used.  Previously,
only the first 1 GB could be used.  Defining VM_PHYSSEG_SPARSE on
sparc64 allows USIIIi-based systems to boot without crashing.

This change is a combination of Nathan Whitehorn's patch and my own
work in perforce.

Discussed with: kmacy, marius, Nathan Whitehorn
PR:		112194

Revision 1.214: download - view: text, markup, annotated - select for diffs
Wed Dec 20 04:40:39 2006 UTC (5 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +3 -0 lines
Add a lwpid field into per-cpu structure, the lwpid represents current
running thread's id on each cpu. This allow us to add in-kernel adaptive
spin for user level mutex. While spinning in user space is possible,
without correct thread running state exported from kernel, it hardly
can be implemented efficiently without wasting cpu cycles, however
exporting thread running state unlikely will be implemented soon as
it has to design and stablize interfaces. This implementation is
transparent to user space, it can be disabled dynamically. With this
change, mutex ping-pong program's performance is improved massively on
SMP machine. performance of mysql super-smack select benchmark is increased
about 7% on Intel dual dual-core2 Xeon machine, it indicates on systems
which have bunch of cpus and system-call overhead is low (athlon64, opteron,
and core-2 are known to be fast), the adaptive spin does help performance.

Added sysctls:
    kern.threads.umtx_dflt_spins
        if the sysctl value is non-zero, a zero umutex.m_spincount will
        cause the sysctl value to be used a spin cycle count.
    kern.threads.umtx_max_spins
        the sysctl sets upper limit of spin cycle count.

Tested on: Athlon64 X2 3800+, Dual Xeon 5130

Revision 1.213: download - view: text, markup, annotated - select for diffs
Wed Dec 6 06:34:55 2006 UTC (5 years, 2 months ago) by julian
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +3 -5 lines
Threading cleanup.. part 2 of several.

Make part of John Birrell's KSE patch permanent..
Specifically, remove:
Any reference of the ksegrp structure. This feature was
never fully utilised and made things overly complicated.
All code in the scheduler that tried to make threaded programs
fair to unthreaded programs.  Libpthread processes will already
do this to some extent and libthr processes already disable it.

Also:
Since this makes such a big change to the scheduler(s), take the opportunity
to rename some structures and elements that had to be moved anyhow.
This makes the code a lot more readable.

The ULE scheduler compiles again but I have no idea if it works.

The 4bsd scheduler still reqires a little cleaning and some functions that now do
ALMOST nothing will go away, but I thought I'd do that as a separate commit.

Tested by David Xu, and Dan Eischen using libthr and libpthread.

Revision 1.212: download - view: text, markup, annotated - select for diffs
Sat Nov 18 23:15:25 2006 UTC (5 years, 2 months ago) by marcel
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +7 -5 lines
Since printf also has at least one critical section, we need to
initialize pc_curthread. While here, rename early_pcpu to pcpu0
to be conistent (compare thread0 and proc0).

Revision 1.211: download - view: text, markup, annotated - select for diffs
Sat Nov 18 21:52:26 2006 UTC (5 years, 2 months ago) by marcel
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +8 -20 lines
Now that printf() needs the PCPU, set it up before we call printf().
Change the pc_pcb field from a pointer to struct pcb to struct pcb
so that sizeof(struct pcb) includes the PCB we use for IPI_STOP.
Statically declare early_pcb so that we don't have to allocate the
PCB for thread0. This way we can setup the PCPU before cninit()
and thus before we use printf().

Revision 1.210: download - view: text, markup, annotated - select for diffs
Fri Nov 3 04:06:17 2006 UTC (5 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.209: preferred, colored
Changes since revision 1.209: +4 -3 lines
Make sure kern_envp is never NULL. If we don't get a pointer to
the environment from the loader, use the static environment.

Revision 1.209: download - view: text, markup, annotated - select for diffs
Thu Oct 26 21:42:19 2006 UTC (5 years, 3 months ago) by jb
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +4 -0 lines
Make KSE a kernel option, turned on by default in all GENERIC
kernel configs except sun4v (which doesn't process signals properly
with KSE).

Reviewed by:	davidxu@

Revision 1.200.2.5: download - view: text, markup, annotated - select for diffs
Fri Sep 1 22:15:57 2006 UTC (5 years, 5 months ago) by marcel
Branches: RELENG_6
CVS tags: RELENG_6_4_BP, RELENG_6_3_BP, RELENG_6_3_0_RELEASE, RELENG_6_3, RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2
Branch point for: RELENG_6_4
Diff to: previous 1.200.2.4: preferred, colored; branchpoint 1.200: preferred, colored; next MAIN 1.201: preferred, colored
Changes since revision 1.200.2.4: +3 -3 lines
Diff reduction: MFC -r1.204.

Revision 1.200.2.4: download - view: text, markup, annotated - select for diffs
Sun Jun 25 19:07:51 2006 UTC (5 years, 7 months ago) by marcel
Branches: RELENG_6
Diff to: previous 1.200.2.3: preferred, colored; branchpoint 1.200: preferred, colored
Changes since revision 1.200.2.3: +8 -0 lines
MFC 1.208: Identify the dual-core Montecito.

Revision 1.208: download - view: text, markup, annotated - select for diffs
Thu Jun 22 00:56:58 2006 UTC (5 years, 7 months ago) by marcel
Branches: MAIN
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +8 -0 lines
Identify the cual-core Montecito.

MFC after: 3 days

Revision 1.200.2.3: download - view: text, markup, annotated - select for diffs
Tue Mar 7 18:08:09 2006 UTC (5 years, 11 months ago) by jhb
Branches: RELENG_6
CVS tags: RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1
Diff to: previous 1.200.2.2: preferred, colored; branchpoint 1.200: preferred, colored
Changes since revision 1.200.2.2: +2 -0 lines
MFC: Close some races between procfs/ptrace and exit1() by changing
exit1() to block until any current PHOLD's are released.  This includes
Simplifying the cleanup code in kern_ptrace() and removing the now
unnecessary vmspace ref counting magic from proc_rwmem().  Also, the
locking for ptrace_single_step(), ptrace_set_pc(), and
ptrace_clear_single_step() have been fixed to be consistent across the
tree.

Approved by:	re (scottl)

Revision 1.200.2.2: download - view: text, markup, annotated - select for diffs
Wed Mar 1 16:30:51 2006 UTC (5 years, 11 months ago) by jhb
Branches: RELENG_6
Diff to: previous 1.200.2.1: preferred, colored; branchpoint 1.200: preferred, colored
Changes since revision 1.200.2.1: +1 -1 lines
MFC: Fix the hw.realmem sysctl on alpha, ia64, and sparc64.

Approved by:	re (scottl)

Revision 1.207: download - view: text, markup, annotated - select for diffs
Wed Feb 22 18:57:49 2006 UTC (5 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +2 -0 lines
Close some races between procfs/ptrace and exit(2):
- Reorder the events in exit(2) slightly so that we trigger the S_EXIT
  stop event earlier.  After we have signalled that, we set P_WEXIT and
  then wait for any processes with a hold on the vmspace via PHOLD to
  release it.  PHOLD now KASSERT()'s that P_WEXIT is clear when it is
  invoked, and PRELE now does a wakeup if P_WEXIT is set and p_lock drops
  to zero.
- Change proc_rwmem() to require that the processing read from has its
  vmspace held via PHOLD by the caller and get rid of all the junk to
  screw around with the vmspace reference count as we no longer need it.
- In ptrace() and pseudofs(), treat a process with P_WEXIT set as if it
  doesn't exist.
- Only do one PHOLD in kern_ptrace() now, and do it earlier so it covers
  FIX_SSTEP() (since on alpha at least this can end up calling proc_rwmem()
  to clear an earlier single-step simualted via a breakpoint).  We only
  do one to avoid races.  Also, by making the EINVAL error for unknown
  requests be part of the default: case in the switch, the various
  switch cases can now just break out to return which removes a _lot_ of
  duplicated PRELE and proc unlocks, etc.  Also, it fixes at least one bug
  where a LWP ptrace command could return EINVAL with the proc lock still
  held.
- Changed the locking for ptrace_single_step(), ptrace_set_pc(), and
  ptrace_clear_single_step() to always be called with the proc lock
  held (it was a mixed bag previously).  Alpha and arm have to drop
  the lock while the mess around with breakpoints, but other archs
  avoid extra lock release/acquires in ptrace().  I did have to fix a
  couple of other consumers in kern_kse and a few other places to
  hold the proc lock and PHOLD.

Tested by:	ps (1 mostly, but some bits of 2-4 as well)
MFC after:	1 week

Revision 1.206: download - view: text, markup, annotated - select for diffs
Tue Feb 14 14:50:10 2006 UTC (5 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +1 -1 lines
Fix the hw.realmem sysctl.  The global realmem variable is a count of
pages, not a count of bytes.  The sysctl handler for hw.realmem already
uses ctob() to convert realmem from pages to bytes.  Thus, on archs that
were storing a byte count in the realmem variable, hw.realmem was inflated.

Reported by:	Valerio daelli valerio dot daelli at gmail dot com (alpha)
MFC after:	3 days

Revision 1.205: download - view: text, markup, annotated - select for diffs
Sat Dec 31 14:39:18 2005 UTC (6 years, 1 month ago) by netchild
Branches: MAIN
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +8 -0 lines
MI changes:
 - provide an interface (macros) to the page coloring part of the VM system,
   this allows to try different coloring algorithms without the need to
   touch every file [1]
 - make the page queue tuning values readable: sysctl vm.stats.pagequeue
 - autotuning of the page coloring values based upon the cache size instead
   of options in the kernel config (disabling of the page coloring as a
   kernel option is still possible)

MD changes:
 - detection of the cache size: only IA32 and AMD64 (untested) contains
   cache size detection code, every other arch just comes with a dummy
   function (this results in the use of default values like it was the
   case without the autotuning of the page coloring)
 - print some more info on Intel CPU's (like we do on AMD and Transmeta
   CPU's)

Note to AMD owners (IA32 and AMD64): please run "sysctl vm.stats.pagequeue"
and report if the cache* values are zero (= bug in the cache detection code)
or not.

Based upon work by:	Chad David <davidc@acns.ab.ca> [1]
Reviewed by:		alc, arch (in 2004)
Discussed with:		alc, Chad David, arch (in 2004)

Revision 1.204: download - view: text, markup, annotated - select for diffs
Tue Dec 6 11:19:37 2005 UTC (6 years, 2 months ago) by ru
Branches: MAIN
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +3 -3 lines
Fix -Wundef warnings from compiling GENERIC and LINT kernels of
all architectures.

Revision 1.203: download - view: text, markup, annotated - select for diffs
Fri Oct 14 12:43:45 2005 UTC (6 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +10 -21 lines
1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, most
   changes in MD code are trivial, before this change, trapsignal and
   sendsig use discrete parameters, now they uses member fields of
   ksiginfo_t structure. For sendsig, this change allows us to pass
   POSIX realtime signal value to user code.

2. Remove cpu_thread_siginfo, it is no longer needed because we now always
   generate ksiginfo_t data and feed it to libpthread.

3. Add p_sigqueue to proc structure to hold shared signals which were
   blocked by all threads in the proc.

4. Add td_sigqueue to thread structure to hold all signals delivered to
   thread.

5. i386 and amd64 now return POSIX standard si_code, other arches will
   be fixed.

6. In this sigqueue implementation, pending signal set is kept as before,
   an extra siginfo list holds additional siginfo_t data for signals.
   kernel code uses psignal() still behavior as before, it won't be failed
   even under memory pressure, only exception is when deleting a signal,
   we should call sigqueue_delete to remove signal from sigqueue but
   not SIGDELSET. Current there is no kernel code will deliver a signal
   with additional data, so kernel should be as stable as before,
   a ksiginfo can carry more information, for example, allow signal to
   be delivered but throw away siginfo data if memory is not enough.
   SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can
   not be caught or masked.
   The sigqueue() syscall allows user code to queue a signal to target
   process, if resource is unavailable, EAGAIN will be returned as
   specification said.
   Just before thread exits, signal queue memory will be freed by
   sigqueue_flush.
   Current, all signals are allowed to be queued, not only realtime signals.

Earlier patch reviewed by: jhb, deischen
Tested on: i386, amd64

Revision 1.200.2.1: download - view: text, markup, annotated - select for diffs
Tue Sep 13 21:07:14 2005 UTC (6 years, 4 months ago) by marcel
Branches: RELENG_6
CVS tags: RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +30 -13 lines
Mega-MFC: Add SMP support and enable it by default. This includes:
	conf/GENERIC: 1.73, 1.53
	ia64/exception.S: 1.57
	ia64/interrupt.c: 1.50, 1.51
	ia64/machdep.c: 1.201, 1.202
	ia64/mp_machdep.c: 1.56, 1.57, 1.58
	ia64/pmap.c: 1.161, 1.162, 1.164, 1.165, 1.166
	ia64/sal.c: 1.15
	ia64/trap.c: 1.114, 1.115
	ia64/vm_machdep.c: 1.91, 1.92
	include/ia64_cpu.h: 1.20
	include/param.h: 1.21
	include/pmap.h: 1.25
	include/proc.h: 1.15
	include/smp.h: 1.10

Approved by: re (kensmith, scottl -- thanks!)

Revision 1.202: download - view: text, markup, annotated - select for diffs
Fri Sep 9 19:18:36 2005 UTC (6 years, 5 months ago) by marcel
Branches: MAIN
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +7 -7 lines
Change the High FP lock from a sleep lock to a spin lock. We can
take the lock from interrupt context, which causes an implicit
lock order reversal. We've been using the lock carefully enough
that making it a spin lock should not be harmful.

Revision 1.201: download - view: text, markup, annotated - select for diffs
Sat Aug 6 20:28:19 2005 UTC (6 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +30 -13 lines
Improve SMP support:
o  Allocate a VHPT per CPU. The VHPT is a hash table that the CPU
   uses to look up translations it can't find in the TLB. As such,
   the VHPT serves as a level 1 cache (the TLB being a level 0 cache)
   and best results are obtained when it's not shared between CPUs.
   The collision chain (i.e. the hash bucket) is shared between CPUs,
   as all buckets together constitute our collection of PTEs. To
   achieve this, the collision chain does not point to the first PTE
   in the list anymore, but to a hash bucket head structure. The
   head structure contains the pointer to the first PTE in the list,
   as well as a mutex to lock the bucket. Thus, each bucket is locked
   independently of each other. With at least 1024 buckets in the VHPT,
   this provides for sufficiently finei-grained locking to make the
   ssolution scalable to large SMP machines.
o  Add synchronisation to the lazy FP context switching. We do this
   with a seperate per-thread lock. On SMP machines the lazy high FP
   context switching without synchronisation caused inconsistent
   state, which resulted in a panic. Since the use of the high FP
   registers is not common, it's possible that races exist. The ia64
   package build has proven to be a good stress test, so this will
   get plenty of exercise in the near future.
o  Don't use the local ID of the processor we want to send the IPI to
   as the argument to ipi_send(). use the struct pcpu pointer instead.
   The reason for this is that IPI delivery is unreliable. It has been
   observed that sending an IPI to a CPU causes it to receive a stray
   external interrupt. As such, we need a way to make the delivery
   reliable. The intended solution is to queue requests in the target
   CPU's per-CPU structure and use a single IPI to inform the CPU that
   there's a new entry in the queue. If that IPI gets lost, the CPU
   can check it's queue at any convenient time (such as for each
   clock interrupt). This also allows us to send requests to a CPU
   without interrupting it, if such would be beneficial.

With these changes SMP is almost working. There are still some random
process crashes and the machine can hang due to having the IPI lost
that deals with the high FP context switch.

The overhead of introducing the hash bucket head structure results
in a performance degradation of about 1% for UP (extra pointer
indirection). This is surprisingly small and is offset by gaining
reasonably/good scalable SMP support.

Revision 1.200: download - view: text, markup, annotated - select for diffs
Tue Jul 5 17:12:18 2005 UTC (6 years, 7 months ago) by marcel
Branches: MAIN
CVS tags: RELENG_6_BP
Branch point for: RELENG_6
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +51 -22 lines
Enhance ia64_flush_dirty() to handle the case in which td != curthread.
This case is triggered with ptrace(2) and the PT_SETREGS function.
Change the return type of the function to int so that errors can be
passed on to the caller.

Approved by: re (scottl)

Revision 1.199: download - view: text, markup, annotated - select for diffs
Mon Apr 4 21:53:54 2005 UTC (6 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +24 -0 lines
Divorce critical sections from spinlocks.  Critical sections as denoted by
critical_enter() and critical_exit() are now solely a mechanism for
deferring kernel preemptions.  They no longer have any affect on
interrupts.  This means that standalone critical sections are now very
cheap as they are simply unlocked integer increments and decrements for the
common case.

Spin mutexes now use a separate KPI implemented in MD code: spinlock_enter()
and spinlock_exit().  This KPI is responsible for providing whatever MD
guarantees are needed to ensure that a thread holding a spin lock won't
be preempted by any other code that will try to lock the same lock.  For
now all archs continue to block interrupts in a "spinlock section" as they
did formerly in all critical sections.  Note that I've also taken this
opportunity to push a few things into MD code rather than MI.  For example,
critical_fork_exit() no longer exists.  Instead, MD code ensures that new
threads have the correct state when they are created.  Also, we no longer
try to fixup the idlethreads for APs in MI code.  Instead, each arch sets
the initial curthread and adjusts the state of the idle thread it borrows
in order to perform the initial context switch.

This change is largely a big NOP, but the cleaner separation it provides
will allow for more efficient alternative locking schemes in other parts
of the kernel (bare critical sections rather than per-CPU spin mutexes
for per-CPU data for example).

Reviewed by:	grehan, cognet, arch@, others
Tested on:	i386, alpha, sparc64, powerpc, arm, possibly more

Revision 1.185.2.5: download - view: text, markup, annotated - select for diffs
Mon Mar 14 20:23:03 2005 UTC (6 years, 10 months ago) by marcel
Branches: RELENG_5
CVS tags: RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5, RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4
Diff to: previous 1.185.2.4: preferred, colored; branchpoint 1.185: preferred, colored; next MAIN 1.186: preferred, colored
Changes since revision 1.185.2.4: +2 -1 lines
MFC rev. 1.198:
Make sure fpswa_interface equals NULL when bootinfo.bi_fpswa equals 0.

PR: ia64/77591
Approved by: re (kensmith)

Revision 1.185.2.4: download - view: text, markup, annotated - select for diffs
Thu Mar 3 00:46:31 2005 UTC (6 years, 11 months ago) by wes
Branches: RELENG_5
Diff to: previous 1.185.2.3: preferred, colored; branchpoint 1.185: preferred, colored
Changes since revision 1.185.2.3: +2 -0 lines
MFC 'hw.physmem' sysctl.

Submitted by:	Nicko Dehaine <nicko@stbernard.com>

Revision 1.198: download - view: text, markup, annotated - select for diffs
Wed Mar 2 20:29:04 2005 UTC (6 years, 11 months ago) by marcel
Branches: MAIN
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +2 -1 lines
Make sure fpswa_iface equals NULL when bootinfo.bi_fpswa equals 0.
We need to be able to test for the (possible) non-existence of the
FPSWA code.

PR: ia64/77591
Submitted by: Christian Kandeler (christian dot kandeler at hob dot de)
MFC after: 1 day

Revision 1.197: download - view: text, markup, annotated - select for diffs
Tue Mar 1 21:55:26 2005 UTC (6 years, 11 months ago) by wes
Branches: MAIN
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +2 -0 lines
Attempt to doff the pointy hat: implement 'hw.realmem' on remaining
architectures.  Pointed out by O'Brien, ScottL via email.

Reviewed by:	obrien (various)

Revision 1.185.2.3: download - view: text, markup, annotated - select for diffs
Fri Feb 25 21:17:22 2005 UTC (6 years, 11 months ago) by njl
Branches: RELENG_5
Diff to: previous 1.185.2.2: preferred, colored; branchpoint 1.185: preferred, colored
Changes since revision 1.185.2.2: +49 -30 lines
MFC: cpu.h header and cpu_est_clockrate() functions for each arch.

Revision 1.196: download - view: text, markup, annotated - select for diffs
Sun Feb 6 01:55:07 2005 UTC (7 years ago) by njl
Branches: MAIN
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +33 -28 lines
Finish the job of sorting all includes and fix the build by including
malloc.h before proc.h on sparc64.  Noticed by das@

Compiled on:	alpha, amd64, i386, pc98, sparc64

Revision 1.185.2.2: download - view: text, markup, annotated - select for diffs
Sat Feb 5 01:01:47 2005 UTC (7 years ago) by das
Branches: RELENG_5
Diff to: previous 1.185.2.1: preferred, colored; branchpoint 1.185: preferred, colored
Changes since revision 1.185.2.1: +2 -5 lines
MFC:

  2004-11-20 02:29:25 UTC
  U areas are going away, so don't allocate one for process 0.

  2004-11-27 06:51:39 UTC
  Don't include sys/user.h merely for its side-effect of recursively
  including other headers.

Revision 1.195: download - view: text, markup, annotated - select for diffs
Fri Feb 4 06:38:58 2005 UTC (7 years ago) by marcel
Branches: MAIN
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +1 -0 lines
Include sys/bus.h before sys/cpu.h. The latter needs device_t.

Revision 1.194: download - view: text, markup, annotated - select for diffs
Fri Feb 4 05:32:56 2005 UTC (7 years ago) by njl
Branches: MAIN
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +12 -0 lines
Add an implementation of cpu_est_clockrate(9).  This function estimates the
current clock frequency for the given CPU id in units of Hz.

Revision 1.193: download - view: text, markup, annotated - select for diffs
Wed Dec 8 05:46:54 2004 UTC (7 years, 2 months ago) by marcel
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +7 -0 lines
Don't obtain the HCDP address directly from the bootinfo structure.
Use a function to keep the details at arms length from uart(4).

Revision 1.192: download - view: text, markup, annotated - select for diffs
Sat Nov 27 06:51:36 2004 UTC (7 years, 2 months ago) by das
Branches: MAIN
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +1 -1 lines
Don't include sys/user.h merely for its side-effect of recursively
including other headers.

Revision 1.191: download - view: text, markup, annotated - select for diffs
Sat Nov 20 02:29:24 2004 UTC (7 years, 2 months ago) by das
Branches: MAIN
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +1 -4 lines
U areas are going away, so don't allocate one for process 0.

Reviewed by:	arch@

Revision 1.190: download - view: text, markup, annotated - select for diffs
Wed Oct 6 02:43:28 2004 UTC (7 years, 4 months ago) by marcel
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +3 -0 lines
Add the Madison II, which is the second generation Madison. The Madison II
is model 2 in the Itanium 2 family and has up to 9MB of L3 cache and clocks
higher than 1.5Ghz. There's no LV variant AFAICT.

Revision 1.189: download - view: text, markup, annotated - select for diffs
Thu Sep 23 00:05:20 2004 UTC (7 years, 4 months ago) by marcel
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +14 -24 lines
Redefine a PTE as a 64-bit integral type instead of a struct of
bit-fields. Unify the PTE defines accordingly and update all
uses.

Revision 1.188: download - view: text, markup, annotated - select for diffs
Sun Sep 19 03:50:46 2004 UTC (7 years, 4 months ago) by marcel
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +27 -29 lines
MFp4:
Completely remove the remaining EFI includes and add our own (type)
definitions instead. While here, abstract more of the internals by
providing interface functions.

Revision 1.187: download - view: text, markup, annotated - select for diffs
Fri Sep 17 22:19:41 2004 UTC (7 years, 4 months ago) by marcel
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +4 -5 lines
Provide our own FPSWA definitions, instead of depending on the Intel
EFI headers and put them all in <machine/fpu.h>. The Intel EFI headers
conflict with the Intel ACPI headers (duplicate type definitions), so
are being phased out in the kernel.

Revision 1.185.2.1: download - view: text, markup, annotated - select for diffs
Thu Sep 9 10:03:19 2004 UTC (7 years, 5 months ago) by julian
Branches: RELENG_5
CVS tags: RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +1 -1 lines
MFC of:
  Refactor a bunch of scheduler code to give basically the same behaviour
  but with slightly cleaned up interfaces.
(2004-09-05 02:09:54 UTC)
  see version 1.16 of sched.h for the original commit message.

Approved by: re (scottl)

Revision 1.186: download - view: text, markup, annotated - select for diffs
Sun Sep 5 02:09:53 2004 UTC (7 years, 5 months ago) by julian
Branches: MAIN
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +1 -1 lines
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

Revision 1.185: download - view: text, markup, annotated - select for diffs
Mon Aug 16 18:54:22 2004 UTC (7 years, 5 months ago) by marcel
Branches: MAIN
CVS tags: RELENG_5_BP
Branch point for: RELENG_5
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +3 -3 lines
Catch up with the drive-by renaming of IA32 to COMPAT_IA32. It must
have been rush hour...

While here, move COMPAT_IA32 from opt_global.h to opt_compat.h like on
amd64. Consequently, it's unsafe to use the option in pcb.h. We now
unconditionally have the ia32 specific registers in the PCB.

This commit is untested.

Revision 1.184: download - view: text, markup, annotated - select for diffs
Wed Aug 11 05:29:13 2004 UTC (7 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.183: preferred, colored
Changes since revision 1.183: +3 -0 lines
In set_regs(), flush the dirty registers onto the backingstore before
we update the registers. That way we don't have any dirty registers to
worry about and also know that bsp=bspstore, which makes updating the
RSE related registers predictable.
This is not the end of it. We need more validity checks, but for now
this allows us to complete the gdb testsuite without crashing the
kernel.

Revision 1.183: download - view: text, markup, annotated - select for diffs
Wed Aug 11 02:35:05 2004 UTC (7 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +28 -23 lines
Add __elfN(dump_thread). This function is called from __elfN(coredump)
to allow dumping per-thread machine specific notes. On ia64 we use this
function to flush the dirty registers onto the backingstore before we
write out the PRSTATUS notes.

Tested on: alpha, amd64, i386, ia64 & sparc64
Not tested on: arm, powerpc

Revision 1.182: download - view: text, markup, annotated - select for diffs
Sun Aug 8 00:28:07 2004 UTC (7 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.181: preferred, colored
Changes since revision 1.181: +22 -2 lines
Implement single stepping when we leave the kernel through the EPC syscall
path. The basic problem is that we cannot set the single stepping flag
directly, because we don't leave the kernel via an interrupt return. So,
we need another way to set the single stepping flag.
The way we do this is by enabling the lower-privilege transfer trap, which
gets raised when we drop the privilege level. However, since we're still
running in kernel space (sec), we're not yet done. We clear the lower-
privilege transfer trap, enable the taken-branch trap and continue exiting
the kernel until we branch into user space.
Given the current code, there's a total of two traps this way before
we can raise SIGTRAP.

Revision 1.181: download - view: text, markup, annotated - select for diffs
Tue Jul 13 07:22:54 2004 UTC (7 years, 6 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +8 -0 lines
Add ptrace_clear_single_step(), alpha already has it for years, the function
will be used by ptrace to clear a thread's single step state.

Revision 1.180: download - view: text, markup, annotated - select for diffs
Sat Jul 10 22:59:30 2004 UTC (7 years, 7 months ago) by marcel
Branches: MAIN
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +9 -17 lines
Update for the KDB framework:
o  ksym_start and ksym_end changed type to vm_offset_t.
o  Make debugging support conditional upon KDB instead of DDB.
o  Call kdb_enter() instead of breakpoint().
o  Remove implementation of Debugger().
o  Call kdb_trap() according to the new world order.

unwinder:
o  s/db_active/kdb_active/g
o  Various s/ddb/kdb/g
o  Add support for unwinding from the PCB as well as the trapframe.
   Abuse a spare field in the special register set to flag whether
   the PCB was actually constructed from a trapframe so that we can
   make the necessary adjustments.

md_var.h:
o   Add RSE convenience macros.
o   Add ia64_bsp_adjust() to add or subtract from BSP while taking
    NaT collections into account.

Revision 1.179: download - view: text, markup, annotated - select for diffs
Sat Jul 10 19:55:59 2004 UTC (7 years, 7 months ago) by marcel
Branches: MAIN
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +17 -0 lines
Implement makectx(). The makectx() function is used by KDB to create
a PCB from a trapframe for purposes of unwinding the stack. The PCB
is used as the thread context and all but the thread that entered the
debugger has a valid PCB.
This function can also be used to create a context for the threads
running on the CPUs that have been stopped when the debugger got
entered. This however is not done at the time of this commit.

Revision 1.178: download - view: text, markup, annotated - select for diffs
Fri Jun 11 11:16:23 2004 UTC (7 years, 8 months ago) by phk
Branches: MAIN
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +2 -2 lines
Deorbit COMPAT_SUNOS.

We inherited this from the sparc32 port of BSD4.4-Lite1.  We have neither
a sparc32 port nor a SunOS4.x compatibility desire these days.

Revision 1.177: download - view: text, markup, annotated - select for diffs
Wed Mar 10 22:23:20 2004 UTC (7 years, 11 months ago) by marcel
Branches: MAIN
Diff to: previous 1.176: preferred, colored
Changes since revision 1.176: +25 -12 lines
Identify the Deerfield processor. Deerfield is a low-voltage variant
based on the Madison core and targeting the low end of the spectrum.
Its clock frequency is 1Ghz, whereas Madison starts at 1.3Ghz. Since
the CPUID information is the same for Madison and Deerfield, we use
the clock frequency to identify the processor.
Supposedly the Deerfield only uses 62W, which seems to be less than
modern Xeon processors (about 70W) and about half what a Madison would
need.

Revision 1.176: download - view: text, markup, annotated - select for diffs
Sun Feb 22 02:10:48 2004 UTC (7 years, 11 months ago) by marcel
Branches: MAIN
Diff to: previous 1.175: preferred, colored
Changes since revision 1.175: +0 -33 lines
Do not pre-map the I/O port space. On the Intel Tiger 4 this conflicts
with a memory mapped I/O range that's immediately before it and is
not 256MB aligned. As a result, when an address is accessed in the
memory mapped range and a direct mapping is added for it, it overlaps
with the pre-mapped I/O port space and causes a machine check.

Based on a patch from: arun@

Revision 1.175: download - view: text, markup, annotated - select for diffs
Sat Jan 3 02:02:25 2004 UTC (8 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.174: preferred, colored
Changes since revision 1.174: +8 -8 lines
Make sigaltstack as per-threaded, because per-process sigaltstack state
is useless for threaded programs, multiple threads can not share same
stack.
The alternative signal stack is private for thread, no lock is needed,
the orignal P_ALTSTACK is now moved into td_pflags and renamed to
TDP_ALTSTACK.
For single thread or Linux clone() based threaded program, there is no
semantic changed, because those programs only have one kernel thread
in every process.

Reviewed by: deischen, dfr

Revision 1.174: download - view: text, markup, annotated - select for diffs
Sun Dec 14 01:59:31 2003 UTC (8 years, 1 month ago) by marcel
Branches: MAIN
Diff to: previous 1.173: preferred, colored
Changes since revision 1.173: +10 -5 lines
In set_mcontext(), take into account that kse_switchin(2) will
eventually be passed an async. context as well as a syscall
context.
While here, fix a serious bug in that if the trapframe is a
syscall frame, but we're restoring an async context, we need
to clear the FRAME_SYSCALL flag so that we leave the kernel
via exception_restore.

Revision 1.173: download - view: text, markup, annotated - select for diffs
Sun Dec 7 20:47:32 2003 UTC (8 years, 2 months ago) by marcel
Branches: MAIN
Diff to: previous 1.172: preferred, colored
Changes since revision 1.172: +10 -26 lines
Simplify the contexts created by the kernel and remove the related
flags. We now create asynchronous contexts or syscall contexts only.
Syscall contexts differ from the minimal ABI dictated contexts by
having the scratch registers saved and restored because that's where
we keep the syscall arguments and syscall return values.
Since this change affects KSE, have it use kse_switchin(2) for the
"new" syscall context.

Revision 1.172: download - view: text, markup, annotated - select for diffs
Thu Nov 20 16:42:39 2003 UTC (8 years, 2 months ago) by marcel
Branches: MAIN
CVS tags: RELENG_5_2_BP, RELENG_5_2_1_RELEASE, RELENG_5_2_0_RELEASE, RELENG_5_2
Diff to: previous 1.171: preferred, colored
Changes since revision 1.171: +1 -1 lines
Set the ACPI processor Id in the PCPU structure so that CPU idling
on SMP systems has a chance of working. This was a loose end of the
implementation of the ACPI Cx idle states. Since our logical CPU Id
is the ACPI processor Id, we do not need to jump through hoops to
obtain it.

Approved: re@ (jhb)

Revision 1.171: download - view: text, markup, annotated - select for diffs
Sat Nov 15 18:58:29 2003 UTC (8 years, 2 months ago) by njl
Branches: MAIN
Diff to: previous 1.170: preferred, colored
Changes since revision 1.170: +1 -0 lines
Add the pc_acpi_id PCPU member.  The new acpi_cpu driver uses this to
dereference the softc.

Revision 1.170: download - view: text, markup, annotated - select for diffs
Wed Nov 12 03:24:34 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.169: preferred, colored
Changes since revision 1.169: +0 -14 lines
Remove ia64_highfp_load() now that it's unused.

Revision 1.169: download - view: text, markup, annotated - select for diffs
Wed Nov 12 01:26:02 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.168: preferred, colored
Changes since revision 1.168: +4 -0 lines
Further work-out the handling of the high FP registers. The most
important change is in cpu_switch() where we disable the high FP
registers for the thread that we switch-out if the CPU currently
has its high FP registers. This avoids that the high FP registers
remain enabled for the thread even when the CPU has unloaded them
or the thread migrated to another processor.
Likewise, when we switch-in a thread of that has its high FP
registers on the CPU, we enable them. This avoids an otherwise
harmless, but unnecessary trap to have them enabled.

The code that handles the disabled high FP trap (in trap()) has
been turned into a critical section for the most part to avoid
being preempted. If there's a race, we bail out and have the
processor trap again if necessary.

Avoid using the generic ia64_highfp_save() function when the
context is predictable. The function adds unnecessary overhead.
Don't use ia64_highfp_load() for the same reason. The function
is now unused and can be removed.

These changes make the lazy context switching of the high FP
registers in an UP kernel functional.

Revision 1.168: download - view: text, markup, annotated - select for diffs
Tue Nov 11 09:53:37 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.167: preferred, colored
Changes since revision 1.167: +9 -2 lines
Save and restore the high FP registers in {g|s}_mcontext(). Note
that we currently do not keep track of whether the thread has
actually used the high FP registers before. If not, we should
not save them in the context which automaticly means that we
also would not restore them from the context. For now, do it
unconditionally so that we can reach functional completeness.

Revision 1.167: download - view: text, markup, annotated - select for diffs
Tue Nov 11 09:25:19 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.166: preferred, colored
Changes since revision 1.166: +10 -1 lines
Fix a nasty bug that got exposed when the sendsig() and sigreturn()
functions switched to using {g|s}et_mcontext(). The problem is that
sigreturn(), being a syscall, can be given an async. context (i.e.
one corresponding to an interrupt or trap). When this happens, we
try to return to user mode via epc_syscall_return with a trapframe
that can only be used to return to user mode via exception_restore.

To fix this, we check the frame's flags immediately prior to
epc_syscall_return and branch to exception_restore for non-syscall
frames. Modify the assertion in set_mcontext() to check that if
there's a mismatch, it's because of sigreturn().

Revision 1.166: download - view: text, markup, annotated - select for diffs
Mon Nov 10 05:28:05 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +9 -5 lines
In get_mcontext(), do not update bspstore and ndirty in the trapframe.
Only update them in the newly created context to reflect the state
after copying the dirty registers onto the user stack. If we were to
update the trapframe, we lose the state at entry into the kernel. We
may need that after we create the context, such as for KSE upcalls.

We have to update the trapframe after writing the dirty registers to
the user stack for signal delivery to work. But this is best done in
sendsig() itself where it applies, not in get_mcontext() where it's
done unconditionally.

Revision 1.165: download - view: text, markup, annotated - select for diffs
Sun Nov 9 22:17:36 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.164: preferred, colored
Changes since revision 1.164: +34 -72 lines
Use get_mcontext() to construct the signal context in sendsig() and
use set_mcontext() to restore the context in sigreturn(). Since we
put the syscall number and the syscall arguments in the trapframe
(we don't save the scratch registers for syscalls, which allows us
to reuse the space to our advantage), create a MD specific flag so
that we save the scratch registers even for syscalls. We would not
be able to restart a syscall otherwise.

The signal trampoline does not need to flush the regiters anymore,
because get_mcontext() already handles that. In fact, if we set up
the context correctly, we do not need to have a trampoline at all.
This change however only minimally changes the trampoline code. In
follow-up commits this can be further optimized.

Note that normally we preserve cfm and iip in the trapframe created
by the EPC syscall path when we restore a context in set_mcontext()
because those fields are not normally set for a synchronuous context.
The kernel puts the return address and frame info of the syscall
stub in there. By preserving these fields we hide this detail from
userland which allows us to use setcontext(2) for user created
contexts. However, sigreturn() is commonly called from the trampoline,
which means that if we preserve cfm and iip in all cases, we would
return to the trampoline after the sigreturn(), which means we hit
the safety net: we call exit(2). So, we do not preserve cfm and iip
when we have a synchronous context that also has scratch registers
(the uncommon context created by sendsig() only), under the assumption
that if such a context is created in userland, something special is
going on and the use of cfm and iip is then just another quirk. All
this is invisible in the common case.

Revision 1.164: download - view: text, markup, annotated - select for diffs
Sun Nov 9 20:31:03 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.163: preferred, colored
Changes since revision 1.163: +2 -2 lines
Change the clear_ret argument of get_mcontext() to be a flags argument.
Since all callers either passed 0 or 1 for clear_ret, define bit 0 in
the flags for use as clear_ret. Reserve bits 1, 2 and 3 for use by MI
code for possible (but unlikely) future use. The remaining bits are for
use by MD code.

This change is triggered by a need on ia64 to have another knob for
get_mcontext().

Revision 1.163: download - view: text, markup, annotated - select for diffs
Tue Oct 28 19:38:26 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +14 -22 lines
When switching the RSE to use the kernel stack as backing store, keep
the RNAT bit index constant. The net effect of this is that there's
no discontinuity WRT NaT collections which greatly simplifies certain
operations. The cost of this is that there can be up to 504 bytes of
unused stack between the true base of the kernel stack and the start
of the RSE backing store. The cost of adjusting the backing store
pointer to keep the RNAT bit index constant, for each kernel entry,
is negligible.

The primary reasons for this change are:
1. Asynchronuous contexts in KSE processes have the disadvantage of
   having to copy the dirty registers from the kernel stack onto the
   user stack. The implementation we had so far copied the registers
   one at a time without calculating NaT collection values. A process
   that used speculation would not work. Now that the RNAT bit index
   is constant, we can block-copy the registers from the kernel stack
   to the user stack without having to worry about NaT collections.
   They will be in the right place on the user stack.
2. The ndirty field in the trapframe is now also usable in userland.
   This was previously not the case because ndirty also includes the
   space occupied by NaT collections. The value could be off by 8,
   depending on the discontinuity. Now that the RNAT bit index is
   contants, we have exactly the same number of NaT collection points
   on the kernel stack as we would have had on the user stack if we
   didn't switch backing stores.
3. Debuggers and other applications that use ptrace(2) can now copy
   the dirty registers from the kernel stack (using ptrace(2)) and
   copy them whereever they want them (onto the user stack of the
   inferior as might be the case for gdb) without having to worry
   about NaT collections in the same way the kernel doesn't have to
   worry about them.

There's a second order effect caused by the randomization of the
base of the backing store, for it depends on the number of dirty
registers the processor happened to have at the time of entry into
the kernel. The second order effect is that the RSE will have a
better cache utilization as compared to having the backing store
always aligned at page boundaries. This has not been measured and
may be in practice only minimally beneficial, if at all measurable.

Revision 1.162: download - view: text, markup, annotated - select for diffs
Fri Oct 24 06:52:21 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.161: preferred, colored
Changes since revision 1.161: +0 -25 lines
Remove ia64_pack_bundle() and ia64_unpack_bundle(). They are not
used anymore.

Revision 1.161: download - view: text, markup, annotated - select for diffs
Fri Oct 24 04:56:58 2003 UTC (8 years, 3 months ago) by arun
Branches: MAIN
Diff to: previous 1.160: preferred, colored
Changes since revision 1.160: +1 -2 lines
Use a TR of size 1 << IA64_ID_PAGE_SHIFT instead of 16M to avoid
overlapping TR/TC entries (which results in a machine check). Note
that we don't look at the size of the memory descriptor, because
it doesn't guarantee non-overlap.

With this change, a UP kernel could boot on a Intel Tiger4 machine
with the following options:

options         LOG2_ID_PAGE_SIZE=26		# 64M
options         LOG2_PAGE_SIZE=14               # 16K

Approved by: marcel

Revision 1.160: download - view: text, markup, annotated - select for diffs
Tue Oct 21 01:13:49 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +2 -2 lines
Remove md_bspstore from the MD fields of struct thread. Now that
the backing store is at a fixed address, there's no need for a
per-thread variable.

Revision 1.159: download - view: text, markup, annotated - select for diffs
Sat Oct 18 22:25:07 2003 UTC (8 years, 3 months ago) by njl
Branches: MAIN
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +11 -2 lines
Add the cpu_idle_hook() function pointer so that other idlers can be
hooked at runtime.  Make C1 sleep (e.g., HLT) be the default.  This
prepares the way for further ACPI sleep states.

Revision 1.158: download - view: text, markup, annotated - select for diffs
Fri Oct 17 02:24:59 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.157: preferred, colored
Changes since revision 1.157: +9 -1 lines
Implement cpu_idle() on ia64. We put the processor in a lightweight
halt state that minimizes power consumption while still preserving
cache and TLB coherency. Halting the processor is not conditional at
this time. Tested with UP and SMP kernels.

Revision 1.157: download - view: text, markup, annotated - select for diffs
Fri Oct 3 03:50:29 2003 UTC (8 years, 4 months ago) by marcel
Branches: MAIN
Diff to: previous 1.156: preferred, colored
Changes since revision 1.156: +5 -11 lines
Swap the syscall caller frame info (i.e. the return pointer and
frame marker) and the syscall stub frame info in the trap frame.
Previously we stored the stub frame info in (rp,pfs) and the
caller frame info in (iip,cfm). This ends up being suboptimal
for the following reasons:
1. When we create a new context, such as for an execve(2), we had
   to set the (rp,pfs) pair for the entry point when using the
   syscall path out of the kernel but we need to set the (iip,cfm)
   pair when we take the interrupt way out. This is mostly just
   an inconsistency from the kernel's point of view, but an ugly
   irregularity from gdb(1)'s point of view.
2. The getcontext(2) and setcontext(2) syscalls had to swap the
   (rp,pfs) and (iip,cfm) pairs to make the context compatible
   with one created purely in userland.

Swapping the (rp,pfs) and (iip,cfm) pairs is visible to signal
handlers that actually peek at the mcontext_t and to gdb(1).
Since this change is made for gdb(1) and we don't care about
signal handlers that peek at the mcontext_t because we're still
a tier 2 platform, this ABI breakage is academic at this moment
in time.

Note that there was no real reason to save the caller frame info
in (iip,cfm) and the stub frame info in (rp,pfs).

Revision 1.156: download - view: text, markup, annotated - select for diffs
Sat Sep 20 20:34:58 2003 UTC (8 years, 4 months ago) by marcel
Branches: MAIN
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +5 -1 lines
Fix the last remaining problem encountered by KSE: apparently it is
not guaranteed that the RSE writes the NaT collection immediately,
sort of atomically, to the backing store when it writes the register
immediately prior to the NaT collection point. This means that we
cannot assume that the low 9 bits of the backingstore pointer do not
point to the NaT collection. This is rather a surprise and I don't
know at this time if it's a bug in the Merced or that it's actually
a valid condition of the architecture. A quick scan over the sources
does not indicate that we depend on the false assumption elsewhere,
but it's something to keep in mind.

The fix is to write the saved contents of the ar.rnat register to
the backingstore prior to entering the loop that copies the dirty
registers from the kernel stack to the user stack.

Revision 1.155: download - view: text, markup, annotated - select for diffs
Fri Sep 19 22:51:26 2003 UTC (8 years, 4 months ago) by marcel
Branches: MAIN
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +12 -4 lines
Fix the most significant KSE breakage caused by not restoring the
restart instruction bits in the PSR. As such, we were returning
from interrupt to the instruction in the bundle that caused us
to enter the kernel, only now we're returning to a completely
different bundle.

While close here: add two KASSERTs to make sure that we restore
sync contexts only when entered the kernel through a syscall and
restore an async context only when entered the kernel through an
interrupt, trap or fault.

While not exactly here, but close enough: use suword64() when we
copy the dirty registers from the kernel stack to the user stack.
The code was intended to be be replaced shortly after being added,
but that was a couple of weeks ago. I might as well avoid that it
is a source for panics until it's replaced.

Revision 1.154: download - view: text, markup, annotated - select for diffs
Tue Sep 9 05:59:09 2003 UTC (8 years, 5 months ago) by marcel
Branches: MAIN
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +3 -3 lines
Introduce IA64_ID_PAGE_{MASK|SHIFT|SIZE} and LOG2_ID_PAGE_SIZE. The
latter is a kernel option for IA64_ID_PAGE_SHIFT, which in turn
determines IA64_ID_PAGE_MASK and IA64_ID_PAGE_SIZE.

The constants are used instead of the literal hardcoding (in its
various forms) of the size of the direct mappings created in region
6 and 7. The default and probably only workable size is still 256M,
but for kicks we use 128M for LINT.

Revision 1.153: download - view: text, markup, annotated - select for diffs
Mon Sep 1 07:06:57 2003 UTC (8 years, 5 months ago) by marcel
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +2 -25 lines
Use pmap_steal_memory() for the msgbuf instead of trying to squeeze
it in the last chunk (phys_avail block). The last chunk very often is
not larger than one or two pages, resulting in a msgbuf that's too
small to hold a complete verbose boot.
Note that pmap_steal_memory() will bzero the memory it "allocates".
Consequently, ia64 will never preserve previous msgbufs. This is not
a noticable difference in practice. If the msgbuf could be reused,
it was invariably too small to have anything preserved anyway.

Revision 1.152: download - view: text, markup, annotated - select for diffs
Sat Aug 23 00:07:52 2003 UTC (8 years, 5 months ago) by marcel
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +0 -1 lines
Remove unused inclusion of opt_acpi.h

Revision 1.151: download - view: text, markup, annotated - select for diffs
Tue Aug 12 08:10:16 2003 UTC (8 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +36 -17 lines
Extend identifycpu():
o  Differentiate between CPU family and CPU model. There are multiple
   Itanium 2 models and it's nice to differentiate between them.
o  Seperately export the CPU family and CPU model with sysctl.
o  Merced is the only model in the Itanium family.
o  Add Madison to the Itanium 2 family. We already knew about McKinley.
o  Print the CPU family between parenthesis, like we do with the i386
   CPU class.

My prototype now identifies itself as:
	CPU: Merced (800.03-Mhz Itanium)

pluto1 and pluto2 will eventually identify themselves as:
	CPU: McKinley (900.00-Mhz Itanium 2)

Revision 1.150: download - view: text, markup, annotated - select for diffs
Sun Aug 10 21:33:07 2003 UTC (8 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +68 -69 lines
o move cpu_reset() from vm_machdep.c to machdep.c.
o reorder cpu_boot(), cpu_halt() and identifycpu().

No functional change.

Revision 1.149: download - view: text, markup, annotated - select for diffs
Sun Aug 10 08:04:21 2003 UTC (8 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +30 -45 lines
Now that we can ignore up to 8KB of dirty registers, remove the RSE
magic from exec_setregs(). In set_mcontext() we now also don't have
to worry that we entered the kernel with more that 512 bytes of
dirty registers on the kernel stack. Note that we cannot make any
assumptions anymore WRT to NaT collection points in exec_setregs(),
so we have to deal with them now.

Revision 1.148: download - view: text, markup, annotated - select for diffs
Thu Aug 7 07:52:39 2003 UTC (8 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.147: preferred, colored
Changes since revision 1.147: +69 -33 lines
Better define the flags in the mcontext_t and properly set the flags
when we create contexts. The meaning of the flags are documented in
<machine/ucontext.h>. I only list them here to help browsing the
commit logs:
	_MC_FLAGS_ASYNC_CONTEXT
	_MC_FLAGS_HIGHFP_VALID
	_MC_FLAGS_KSE_SET_MBOX
	_MC_FLAGS_RETURN_VALID
	_MC_FLAGS_SCRATCH_VALID

Yes, _MC_FLAGS_KSE_SET_MBOX is a hack and I'm proud of it :-)

Revision 1.147: download - view: text, markup, annotated - select for diffs
Tue Aug 5 18:52:02 2003 UTC (8 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +50 -6 lines
o  Put the syscall return registers in the context. Not only do we
   need this for swapcontext(), KSE upcalls initiated from ast()
   also need to save them so that we properly return the syscall
   results after having had a context switch. Note that we don't
   use r11 in the kernel. However, the runtime specification has
   defined r8-r11 as return registers, so we put r11 in the context
   as well. I think deischen@ was trying to tell me that we should
   save the return registers before. I just wasn't ready for it :-)

o  The EPC syscall code has 2 return registers and 2 frame markers
   to save. The first (rp/pfs) belongs to the syscall stub itself.
   The second (iip/cfm) belongs to the caller of the syscall stub.
   We want to put the second in the context (note that iip and cfm
   relate to interrupts. They are only being misused by the syscall
   code, but are not part of a regular context).
   This way, when the context is switched to again, we return to
   the caller of setcontext(2) as one would expect.

o  Deal with dirty registers on the kernel stack. The getcontext()
   syscall will flush the RSE, so we don't expect any dirty registers
   in that case. However, in thread_userret() we also need to save
   the context in certain cases. When that happens, we are sure that
   there are dirty registers on the kernel stack.
   This implementation simply copies the registers, one at a time,
   from the kernel stack to the user stack. NAT collections are not
   dealt with. Hence we don't preserve NaT bits. A better solution
   needs to be found at some later time.
   We also don't deal with this in all cases in set_mcontext. No
   temporay solution is implemented because it's not a showstopper.
   The problem is that we need to ignore the dirty registers and we
   automaticly do that for at most 62 registers. When there are more
   than 62 dirty registers we have a memory "leak".

This commit is fundamental for KSE support.

Revision 1.146: download - view: text, markup, annotated - select for diffs
Mon Aug 4 05:13:17 2003 UTC (8 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +6 -20 lines
Cleanup the clock code. This includes:
o  Remove alpha specific timer code (mc146818A) and compiled-out
   calibration of said timer.
o  Remove i386 inherited timer code (i8253) and related acquire and
   release functions.
o  Move sysbeep() from clock.c to machdep.c and have it return
   ENODEV. Console beeps should be implemented using ACPI or if no
   such device is described, using the sound driver.
o  Move the sysctls related to adjkerntz, disable_rtc_set and
   wall_cmos_clock from machdep.c to clock.c, where the variables
   are.
o  Don't hardcode a hz value of 1024 in cpu_initclocks() and don't
   bother faking a stathz that's 1/8 of that. Keep it simple: hz
   defaults to HZ and stathz equals hz. This is also how it's done
   for sparc64.
o  Keep a per-CPU ITC counter (pc_clock) and adjustment (pc_clockadj)
   to calculate ITC skew and corrections. On average, we adjust the
   ITC match register once every ~1500 interrupts for a duration of
   2 consequtive interruprs. This is to correct the non-deterministic
   behaviour of the ITC interrupt (there's a delay between the match
   and the raising of the interrupt).
o  Add 4 debugging sysctls to monitor clock behaviour. Those are
   debug.clock_adjust_edges, debug.clock_adjust_excess,
   debug.clock_adjust_lost and debug.clock_adjust_ticks. The first
   counts the individual adjustment cycles (when the skew first
   crosses the threshold), the second counts the number of times the
   adjustment was excessive (any non-zero value is to be considered
   a bug), the third counts lost clock interrupts and the last counts
   the number of interrupts for which we applied an adjustment
   (debug.clock_adjust_ticks / debug.clock_adjust_edges gives the
   avarage duration of an individual adjustment -- should be ~2).

While here, remove some nearby (trivial) left-overs from alpha and
other cleanups.

Revision 1.145: download - view: text, markup, annotated - select for diffs
Fri Aug 1 07:21:34 2003 UTC (8 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +4 -4 lines
Write the preserved registers to (and read them from) struct reg and
struct fpreg.

Revision 1.144: download - view: text, markup, annotated - select for diffs
Thu Jul 31 01:29:09 2003 UTC (8 years, 6 months ago) by peter
Branches: MAIN
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +2 -1 lines
Cosmetic: fix some disorder of #include "opt_...." files

Revision 1.143: download - view: text, markup, annotated - select for diffs
Fri Jul 25 05:37:13 2003 UTC (8 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +0 -6 lines
Move ia64_pa_access() from machdep.c to mem.c and declare it static.
It's only used in mem.c and cannot accidentally be used elsewhere
this way.

Revision 1.142: download - view: text, markup, annotated - select for diffs
Tue Jul 15 04:43:33 2003 UTC (8 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +1 -1 lines
Rename thread_siginfo to cpu_thread_siginfo.

Revision 1.141: download - view: text, markup, annotated - select for diffs
Sat Jun 28 06:34:07 2003 UTC (8 years, 7 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +19 -0 lines
Add a machine depended function thread_siginfo, SA signal code
will use the function to construct a siginfo structure and use
the result to export to userland.

Reviewed by: julian

Revision 1.140: download - view: text, markup, annotated - select for diffs
Thu Jun 12 00:15:18 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.139: preferred, colored
Changes since revision 1.139: +10 -2 lines
Make sure pcpu->pc_pcb is pointing to a 16-byte aligned address. The
PCB contains FP registers, whose alignment must be 16 bytes at least.
Since the PCB pointed to by pc_pcb is immediately after the PCPU
itself, round-up the size of thge PCPU to a multiple of 16 bytes. The
PCPU is page aligned.

This fixes a misalignment trap caused by stopping a CPU in a SMP
kernel, such as been done when entering the debugger.

Reported by: Alan Robinson <alan.robinson@fujitsu-siemens.com>

Revision 1.139: download - view: text, markup, annotated - select for diffs
Sun Jun 1 23:22:56 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +5 -0 lines
Improve set_mcontext:
o  Don't copy psr verbatim from the user supplied context. Only allow
   userland to change the processor settings that are part of the user
   mask.

Revision 1.138: download - view: text, markup, annotated - select for diffs
Sat May 31 21:07:08 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +14 -4 lines
Implement set_mcontext() and get_mcontext(). Just as for sendsig() and
sigreturn(), we cheat and assume the preserved registers are still
on-chip and unmodified. This is actually the case, but more by accident
than by design. We need to use unwinding eventually or explicitly
compile the kernel in a way that the compiler steers clear from using
the preserved registers completely.

Revision 1.137: download - view: text, markup, annotated - select for diffs
Sat May 31 20:42:35 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +12 -2 lines
Make sure we have all the dirty registers in user frames on the
backing store before we discard them. It is possible that we
enter the kernel (due to an execve in this case) with a lot of
dirty user registers and that the RSE has only partially spilled
them (to make room for new frames). We cannot move the backing
store pointer down (to discard user registers) when not all of
the user registers are on the backing store.
So, we flush the register stack IFF this happens. Unconditionally
doing the flush is too costly, because the condition in which we
need to flush is very rare.

This change appears to fix the SIGSEGV that sometimes happen for
newly executed processes and so far also appears to fix the last
of the corruption. It is possible, although not likely, that this
change prevents some other bug from happening, even though it is
itself not a fix. Hence the uncertainty. We'll know in a couple
of months I guess :-)

Revision 1.136: download - view: text, markup, annotated - select for diffs
Thu May 29 06:30:36 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
CVS tags: RELENG_5_1_BP, RELENG_5_1_0_RELEASE, RELENG_5_1
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +0 -13 lines
Move the sysctls of the misalignment handler to where they belong
and use OID_AUTO instead of fixed IDs.

Approved by: re@ (blanket)

Revision 1.135: download - view: text, markup, annotated - select for diffs
Tue May 27 01:00:12 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +0 -6 lines
Fix fu{byte|word*} and su{byte|word*}:
o  If the address was not within user space we jumped to fusufault
   where we would clear pcb_onfault and return 0. There are two
   bugs here:
   1. We never got to the point where we assigned the address of
      pcb_onfault to r15, which means that we would clobber some
      random memory location, including I/O space or ROM.
   2. We're supposed to return -1 on error.
o  Make sure we have proper memory ordering for setting pcb_onfault,
   doing the memory access to user space and clearing pcb_onfault.
   For the fu* family of functions this means that we need a mf
   instruction, because we don't have acquire semantics on stores
   and release semantics on loads (hence st;ld cannot be ordered
   without intermediate mf).

While here, implement casuptr() so that we are a (small) step
closer to supporting libthr and deobfuscate the non-implementation
of {f|s}uswintr.

Approved by: re@ (blanket)

Revision 1.134: download - view: text, markup, annotated - select for diffs
Sat May 24 00:17:33 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +17 -1 lines
Fix an alpha inheritance bug:

On alpha, PAL is involved in context management and after wiring
the CPU (in alpha_init()) a context switch was performed to tell
PAL about the context. This was bogusly brought over to ia64
where it introduced bugs, because we restored the context from
a mostly uninitialized PCB.

The cleanup constitutes:
o  Remove the unused arguments from ia64_init().
o  Don't return from ia64_init(), but instead call mi_startup()
   directly. This reduces the amount of muckery in assembly and
   also allows for the next bullet:
o  Save our currect context prior to calling mi_startup(). The
   reason for this is that many threads are created from thread0
   by cloning the PCB. By saving our context in the PCB, we have
   something sane to clone. It also ensures that a cloned thread
   that does not alter the context in any way will return to
   the saved context, where we're ready for the eventuality with
   a nice, user unfriendly panic().

The cleanup fixes at least the following bugs:
o  Entering mi_startup() with the RSE in enforced lazy mode.
o  Re-execution of ia64_init() in certain "lab" conditions.

While here, add proper unwind directives to __start() so that
the unwind knows it has reached the bottom of the (call) stack.

Approved by: re@ (blanket)

Revision 1.133: download - view: text, markup, annotated - select for diffs
Mon May 19 04:16:30 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +6 -3 lines
pmap_install() needs to be atomic WRT to context switching. Protect
switching user regions (region 0-4) with schedlock. Avoid unnecessary
recursion on schedlock by moving the core functionality to another
function (pmap_switch()) where we assert schedlock is held. Turn
pmap_install() into a wrapper that grabs schedlock. This minimizes
the number of callsites that need to be changed.
Since we already have schedlock in cpu_switch() and cpu_throw(),
have them call pmap_switch() directly. These were also the only two
calls to pmap_install() outside pmap.c, so make pmap_install() static
and remove its prototype from pmap.h

Approved by: re (blanket)

Revision 1.132: download - view: text, markup, annotated - select for diffs
Fri May 16 21:26:40 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +368 -466 lines
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)

Revision 1.131: download - view: text, markup, annotated - select for diffs
Tue May 13 20:35:58 2003 UTC (8 years, 9 months ago) by jhb
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +4 -1 lines
- Merge struct procsig with struct sigacts.
- Move struct sigacts out of the u-area and malloc() it using the
  M_SUBPROC malloc bucket.
- Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(),
  sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared().
- Remove the p_sigignore, p_sigacts, and p_sigcatch macros.
- Add a mutex to struct sigacts that protects all the members of the struct.
- Add sigacts locking.
- Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now
  that sigacts is locked.
- Several in-kernel functions such as psignal(), tdsignal(), trapsignal(),
  and thread_stopped() are now MP safe.

Reviewed by:	arch@
Approved by:	re (rwatson)

Revision 1.130: download - view: text, markup, annotated - select for diffs
Fri May 2 20:34:15 2003 UTC (8 years, 9 months ago) by marcel
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +0 -3 lines
Option KADB does not exist. It came from alpha, where it still exists.

Revision 1.129: download - view: text, markup, annotated - select for diffs
Fri Apr 25 01:50:29 2003 UTC (8 years, 9 months ago) by deischen
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +1 -1 lines
Add an argument to get_mcontext() which specified whether the
syscall return values should be cleared.  The system calls
getcontext() and swapcontext() want to return 0 on success
but these contexts can be switched to at a later time so
the return values need to be cleared in the saved register
sets.  Other callers of get_mcontext() would normally want
the context without clearing the return values.

Remove the i386-specific context saving from the KSE code.
get_mcontext() is not i386-specific any more.

Fix a bad pointer in the alpha get_mcontext() code.  The
context was being bcopy()'d from &td->tf_frame, but tf_frame
is itself a pointer, so the thread was being copied instead.
Spotted by jake.

Glanced at by:  jake
Reviewed by:    bde (months ago)

Revision 1.128: download - view: text, markup, annotated - select for diffs
Tue Apr 1 00:18:55 2003 UTC (8 years, 10 months ago) by jeff
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +7 -0 lines
 - Define a new md function 'casuptr'.  This atomically compares and sets
   a pointer that is in user space.  It will be used as the basic primitive
   for a kernel supported user space lock implementation.
 - Implement this function in x86's support.s
 - Provide stubs that return -1 in all other architectures.  Implementations
   will follow along shortly.

Reviewed by:	jake

Revision 1.127: download - view: text, markup, annotated - select for diffs
Mon Mar 31 22:49:15 2003 UTC (8 years, 10 months ago) by jeff
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +3 -3 lines
 - Move p->p_sigmask to td->td_sigmask.  Signal masks will be per thread with
   a follow on commit to kern_sig.c
 - signotify() now operates on a thread since unmasked pending signals are
   stored in the thread.
 - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.

Revision 1.126: download - view: text, markup, annotated - select for diffs
Mon Mar 31 21:40:47 2003 UTC (8 years, 10 months ago) by jeff
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +1 -5 lines
 - Use sigexit() instead of twiddling the signal mask, catch, ignore, and
   action bits to allow SIGILL to work as expected.  This brings this file in
   line with other architectures.

Revision 1.125: download - view: text, markup, annotated - select for diffs
Mon Feb 17 08:17:26 2003 UTC (8 years, 11 months ago) by marcel
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +4 -2 lines
Print two new processor features:
o  Spontaneous deferral (A feature required by dutch railways :-)
o  16-byte atomic operations (ld, st, cmpxchg)

Revision 1.124: download - view: text, markup, annotated - select for diffs
Sat Feb 1 22:50:09 2003 UTC (9 years ago) by marcel
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +7 -60 lines
Remove special casing for running in the simulator from the kernel
and instead add platform, firmware and EFI stubs to the loader.
The net effect of this change is that besides a special console and
disk driver, the kernel has no knowledge of the simulator. This has
the following advantages:
o  Simulator support is much harder to break,
o  It's easier to make use of more feature complete simulators.
   This would only need a change in the simulator specific loader,
o  Running SMP kernels within the simulator. Note that ski at this
   time does not simulate IPIs, so there's no way to start APs.

The platform, firmware and EFI stubs describe the following hardware:
o  4 CPU Itanium,
o  128 MB RAM within the 4GB address space,
o  64 MB RAM above the 4GB address space.

NOTE: The stubs in the skiloader describe a machine that should in
parts be defined by the simulator. Things like processor interrupt
block and AP wakeup vector cannot be choosen at random because they
require interpretation by the simulator. Currently the simulator is
ignorant of this.

This change introduces an unofficial SSC call SSC_SAL_SET_VECTORS
which is ignored by the simulator.

Tested with: ski (version 0.943 for linux)

Revision 1.123: download - view: text, markup, annotated - select for diffs
Sun Nov 24 20:15:08 2002 UTC (9 years, 2 months ago) by marcel
Branches: MAIN
CVS tags: RELENG_5_0_BP, RELENG_5_0_0_RELEASE, RELENG_5_0
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +37 -3 lines
MFp4:
Add function map_port_space() to map the memory mapped I/O port
range as uncacheable virtual memory and call it prior to probing
for a console. This removes the dependency on the loader to have
done this for us. Note that this change does not include doing
the same for APs.

Approved by: re (blanket)

Revision 1.122: download - view: text, markup, annotated - select for diffs
Sat Nov 16 06:35:52 2002 UTC (9 years, 2 months ago) by deischen
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +14 -0 lines
Add getcontext, setcontext, and swapcontext as system calls.
Previously these were libc functions but were requested to
be made into system calls for atomicity and to coalesce what
might be two entrances into the kernel (signal mask setting
and floating point trap) into one.

A few style nits and comments from bde are also included.

Tested on alpha by: gallatin

Revision 1.121: download - view: text, markup, annotated - select for diffs
Sat Nov 9 16:19:14 2002 UTC (9 years, 3 months ago) by des
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +4 -3 lines
Print real / avail memory in megabytes rather than kilobytes.

Revision 1.120: download - view: text, markup, annotated - select for diffs
Thu Nov 7 23:57:16 2002 UTC (9 years, 3 months ago) by tmm
Branches: MAIN
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +0 -27 lines
Move the definitions of the hw.physmem, hw.usermem and hw.availpages
sysctls to MI code; this reduces code duplication and makes all of them
available on sparc64, and the latter two on powerpc.
The semantics by the i386 and pc98 hw.availpages is slightly changed:
previously, holes between ranges of available pages would be included,
while they are excluded now. The new behaviour should be more correct
and brings i386 in line with the other architectures.

Move physmem to vm/vm_init.c, where this variable is used in MI code.

Revision 1.119: download - view: text, markup, annotated - select for diffs
Wed Nov 6 14:53:35 2002 UTC (9 years, 3 months ago) by jmallett
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +0 -2 lines
Remove what was a temporary bogus assignment of bits of siginfo_t, as it does
not look like the prerequisites to fill it in properly will be in the tree
for the upcoming release, but it's mostly done, so there is no need for these
to stay around to remind us.

Revision 1.118: download - view: text, markup, annotated - select for diffs
Wed Oct 30 05:55:29 2002 UTC (9 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +35 -15 lines
Rewrite cpu_switch(). The most notable change is the fact that we now
have f16-f31 as part of the context. The PCB has been reorganized to
better match how we save and restore the (preserved) registers. This
commit also moves the context restoriation to its own function (named
pcb_restore), as we did with pcb_save.

Only minimal effort has been put in writing optimal assembly. The
expectation is that there will be more rounds of changes.

Revision 1.117: download - view: text, markup, annotated - select for diffs
Fri Oct 25 19:10:56 2002 UTC (9 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +9 -12 lines
Split 4.x and 5.x signal handling so that we can keep 4.x signal
handling clean and functional as 5.x evolves.  This allows some of the
nasty bandaids in the 5.x codepaths to be unwound.

Encapsulate 4.x signal handling under COMPAT_FREEBSD4 (there is an
anti-foot-shooting measure in place, 5.x folks need this for a while) and
finish encapsulating the older stuff under COMPAT_43.  Since the ancient
stuff is required on alpha (longjmp(3) passes a 'struct osigcontext *'
to the current sigreturn(2), instead of the 'ucontext_t *' that sigreturn
is supposed to take), add a compile time check to prevent foot shooting
there too.  Add uniform COMPAT_43 stubs for ia64/sparc64/powerpc.

Tested on: i386, alpha, ia64.  Compiled on sparc64 (a few days ago).
Approved by: re

Revision 1.116: download - view: text, markup, annotated - select for diffs
Thu Oct 24 19:17:06 2002 UTC (9 years, 3 months ago) by jhb
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +5 -5 lines
Oops, I missed a few changes in 'device acpica' -> 'device acpi' change.

Submitted by:	Hiten Pandya <hiten@angelica.unixdaemons.com>

Revision 1.115: download - view: text, markup, annotated - select for diffs
Sat Oct 19 19:30:38 2002 UTC (9 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +0 -14 lines
Update the unwind information when modules are loaded and unloaded
by using the linker hooks. Since these hooks are called for the
kernel as well, we don't need to deal with that with a special
SYSINIT. The initialization implicitly performed on the first
update of the unwind information is made explicit with a SYSINIT.
We now don't need the _ia64_unwind_{start|end} symbols.

Revision 1.114: download - view: text, markup, annotated - select for diffs
Sat Oct 19 04:14:08 2002 UTC (9 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +6 -1 lines
Make this compile when DDB is not defined by conditionally compiling
all references to ksym_start and ksym_end.

Revision 1.113: download - view: text, markup, annotated - select for diffs
Fri Oct 4 01:00:35 2002 UTC (9 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +1 -0 lines
Do a bit of rude hackery to get clock interrupts on all CPUs.  This
is partly based on the Alpha system which duplicates the clock to
each cpu, instead of doing a clock roundrobin like on i386.  This means
we get hz * ncpu clocks per second and so we have to seperate clock
sampling from actual 'do the work' clock processing.  The BSP runs the
complete processing, the rest just sample state etc.

Using the on-cpu interval timer is not ideal as it will drift.  There
is more to be done here, we should use an external clock source.

Revision 1.112: download - view: text, markup, annotated - select for diffs
Fri Sep 20 17:50:58 2002 UTC (9 years, 4 months ago) by phk
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +0 -62 lines
For reasons now lost in historical fog, the bounds_check_with_label()
function were put in i386/i386/machdep.c from where it has been
cut and pasted to other architectures with only minor corruption.

Disklabel is really a MI format in many ways, at least it certainly
is when you operate on struct disklabel.

Put bounds_check_with_label() back in subr_disklabel.c where it belongs.

Sponsored by:   DARPA & NAI Labs.

Revision 1.111: download - view: text, markup, annotated - select for diffs
Sun Sep 15 23:52:23 2002 UTC (9 years, 4 months ago) by julian
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +1 -1 lines
Allocate KSEs and KSEGRPs separatly and remove them from the proc structure.
next step is to allow > 1 to be allocated per process. This would give
multi-processor threads. (when the rest of the infrastructure is
in place)

While doing this I noticed libkvm and sys/kern/kern_proc.c:fill_kinfo_proc
are diverging more than they should.. corrective action needed soon.

Revision 1.110: download - view: text, markup, annotated - select for diffs
Sat Sep 7 19:12:45 2002 UTC (9 years, 5 months ago) by jmallett
Branches: MAIN
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +2 -0 lines
Fill out two fields (si_pid, si_uid) in the siginfo structure handed back
to userland in the signal handler that were not being iflled out before, but
should and can be.

This part of sendsig could be slightly refactored to use an MI interface, or
ideally, *sendsig*() would have an API change to accept a siginfo_t, which
would be filled out by an MI function in the level above sendsig, and said MI
function would make a small call into MD code to fill out the MD parts (some
of which may be bogus, such as the si_addr stuff in some places).  This would
eventually make it possible for parts of the kernel sending signals to set up
a siginfo with meaningful information.

Reviewed by:	mux
MFC after:	2 weeks

Revision 1.109: download - view: text, markup, annotated - select for diffs
Sat Aug 31 03:33:31 2002 UTC (9 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +7 -11 lines
Take a shot at fixing up a whole stack of style and other embarresing
unforced errors that Bruce identified.  I have not yet addressed all of
his concerns.

Revision 1.108: download - view: text, markup, annotated - select for diffs
Fri Aug 30 04:04:35 2002 UTC (9 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +17 -10 lines
Change hw.physmem and hw.usermem to unsigned long like they used to be
in the original hardwired sysctl implementation.

The buf size calculator still overflows an integer on machines with large
KVA (eg: ia64) where the number of pages does not fit into an int.  Use
'long' there.

Change Maxmem and physmem and related variables to 'long', mostly for
completeness.  Machines are not likely to overflow 'int' pages in the
near term, but then again, 640K ought to be enough for anybody.  This
comes for free on 32 bit machines, so why not?

Revision 1.107: download - view: text, markup, annotated - select for diffs
Thu Aug 29 06:17:47 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +2 -1 lines
Renamed poorly named setregs to exec_setregs.  Moved its prototype to
imgact.h with the other exec support functions.

Revision 1.106: download - view: text, markup, annotated - select for diffs
Sat Aug 3 03:35:06 2002 UTC (9 years, 6 months ago) by peter
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +15 -0 lines
Ignore memory above 4GB for now due to unpleasant pci issues.

Revision 1.105: download - view: text, markup, annotated - select for diffs
Wed May 29 05:19:07 2002 UTC (9 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +1 -0 lines
Remove the definition of struct mca_guid and use the generic
struct uuid defined in <sys/uuid.h>.

Use uuid/UUID instead of guid/GUID to emphasize that the
identifiers are DCE version 1 identifiers and also to avoid
inconsistencies as much a possible.

Revision 1.104: download - view: text, markup, annotated - select for diffs
Mon May 20 05:41:20 2002 UTC (9 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +95 -14 lines
Flesh-out ptrace support. This obviously needs more work.

Revision 1.103: download - view: text, markup, annotated - select for diffs
Sun May 19 04:42:19 2002 UTC (9 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +1 -0 lines
o  Remove namespace pollution from param.h:
   -  Don't include ia64_cpu.h and cpu.h
   -  Guard definitions by  _NO_NAMESPACE_POLLUTION
   -  Move definition of KERNBASE to vmparam.h

o  Move definitions of IA64_RR_{BASE|MASK} to vmparam.h
o  Move definitions of IA64_PHYS_TO_RR{6|7} to vmparam.h

o  While here, remove some left-over Alpha references.

Revision 1.102: download - view: text, markup, annotated - select for diffs
Thu May 2 05:30:42 2002 UTC (9 years, 9 months ago) by marcel
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +0 -1 lines
PCPU(current_pmap) is initialized in pmap_bootstrap. No need to
do it again.

Revision 1.101: download - view: text, markup, annotated - select for diffs
Wed May 1 06:52:08 2002 UTC (9 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +14 -7 lines
Connect up kern_envp *before* we use it for getenv() and console probing.
It is a bit late after that when we have no consoles. :-]

Also, fix a comment nit and print a warning about missing metadata.

Revision 1.100: download - view: text, markup, annotated - select for diffs
Tue Apr 30 02:29:00 2002 UTC (9 years, 9 months ago) by marcel
Branches: MAIN
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +10 -11 lines
Make this work for ski again. Don't call ia64_mca_init() when we're
in the simulator.

Revision 1.99: download - view: text, markup, annotated - select for diffs
Fri Apr 26 19:36:25 2002 UTC (9 years, 9 months ago) by marcel
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +3 -0 lines
Initialize MCA in cpu_startup() so that it's ready before we wake-up
the application processors. This allows us to collect unconsumed AP
specific error records as part of the wake-up.

Revision 1.98: download - view: text, markup, annotated - select for diffs
Thu Apr 25 17:51:43 2002 UTC (9 years, 9 months ago) by marcel
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +1 -1 lines
The official name for McKinley is: Itanium 2

Revision 1.97: download - view: text, markup, annotated - select for diffs
Fri Apr 19 06:35:55 2002 UTC (9 years, 9 months ago) by marcel
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +4 -29 lines
Remove the bootinfo kludge. We get the address of the bootinfo
block from the loader.

Revision 1.96: download - view: text, markup, annotated - select for diffs
Wed Apr 17 13:06:35 2002 UTC (9 years, 9 months ago) by mux
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +4 -1 lines
Rework the kernel environment subsystem.  We now convert the static
environment needed at boot time to a dynamic subsystem when VM is
up.  The dynamic kernel environment is protected by an sx lock.

This adds some new functions to manipulate the kernel environment :
freeenv(), setenv(), unsetenv() and testenv().  freeenv() has to be
called after every getenv() when you have finished using the string.
testenv() only tests if an environment variable is present, and
doesn't require a freeenv() call. setenv() and unsetenv() are self
explanatory.

The kenv(2) syscall exports these new functionalities to userland,
mainly for kenv(1).

Reviewed by:	peter

Revision 1.95: download - view: text, markup, annotated - select for diffs
Sun Apr 14 04:33:41 2002 UTC (9 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +14 -2 lines
Allow a kernel to be compiled with both SKI and acpica and still
work on real hardware.  (SKI used to break the sapic probes)

Revision 1.94: download - view: text, markup, annotated - select for diffs
Sat Apr 13 23:37:10 2002 UTC (9 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +2 -0 lines
Add comment that sigreturn() is MPSAFE.

Revision 1.93: download - view: text, markup, annotated - select for diffs
Fri Apr 12 07:43:35 2002 UTC (9 years, 10 months ago) by dfr
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +7 -0 lines
Initialise ar.cflg, which contains the IA-32 registers cr0 and cr4. Since
all IA-32 processes use the same values for cr0 and cr4, we initialise
them at system startup.

Revision 1.92: download - view: text, markup, annotated - select for diffs
Fri Apr 12 05:17:15 2002 UTC (9 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +1 -1 lines
Really fix uniprocessor on IA64.  Note to self: do not use variables before
they are initialized.   I had correctly figured out that the UP problem was
the pcpu current_pmap thing, but didn't fix it right last time.

Revision 1.91: download - view: text, markup, annotated - select for diffs
Tue Apr 9 11:18:40 2002 UTC (9 years, 10 months ago) by phk
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +0 -12 lines
GC various bits and pieces of USERCONFIG from all over the place.

Revision 1.90: download - view: text, markup, annotated - select for diffs
Thu Apr 4 17:49:46 2002 UTC (9 years, 10 months ago) by bde
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +1 -0 lines
Moved signal handling and rescheduling from userret() to ast() so that
they aren't in the usual path of execution for syscalls and traps.
The main complication for this is that we have to set flags to control
ast() everywhere that changes the signal mask.

Avoid locking in userret() in most of the remaining cases.

Submitted by:	luoqi (first part only, long ago, reorganized by me)
Reminded by:	dillon

Revision 1.89: download - view: text, markup, annotated - select for diffs
Thu Apr 4 06:59:18 2002 UTC (9 years, 10 months ago) by alc
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +16 -18 lines
 o Kill the MD grow_stack().  Call the MI vm_map_growstack()
   in its place.
 o Eliminate the use of useracc() and grow_stack() from sendsig().

Reviewed by:	peter

Revision 1.88: download - view: text, markup, annotated - select for diffs
Wed Apr 3 05:16:09 2002 UTC (9 years, 10 months ago) by marcel
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +2 -4 lines
o  GC dumplo
o  Replace the string lit. "ia64" with MACHINE

Revision 1.87: download - view: text, markup, annotated - select for diffs
Tue Apr 2 22:19:14 2002 UTC (9 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +5 -18 lines
- Move the MI mutexes sched_lock and Giant from being declared in the
  various machdep.c's to being declared in kern_mutex.c.
- Add a new function mutex_init() used to perform early initialization
  needed for mutexes such as setting up thread0's contested lock list
  and initializing MI mutexes.  Change the various MD startup routines
  to call this function instead of duplicating all the code themselves.

Tested on:	alpha, i386

Revision 1.86: download - view: text, markup, annotated - select for diffs
Tue Apr 2 07:20:42 2002 UTC (9 years, 10 months ago) by marcel
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +5 -11 lines
o  GC totalphysmem and resvmem.
o  Rephrase comment describing that the memory region can contain
   the kernel.

Revision 1.85: download - view: text, markup, annotated - select for diffs
Sat Mar 30 23:25:22 2002 UTC (9 years, 10 months ago) by marcel
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +31 -4 lines
Transition to a model where the loader passes the address of the
bootinfo block in register r8. In locore.s we save the address
in the global variable 'pa_bootinfo'. In machdep.c we compare
this value against the hardwired address, but don't depend on its
validity yet (ie: we still expect the bootinfo block to be at the
hardwired address). After a small amount of time, we'll flip the
switch and depend on the loader to pass us the address. From that
moment on the loader is free to put it anywhere it likes, provided
the machine itself likes it as well.

Add some verbosity to aid in the transition. We emit a message if
the loader didn't pass the address and we also emit a message if
there's no bootinfo block at the hardwired address.

While in locore.s, reduce the number of redundant serialization
instructions. A srlz.i is a proper superset of a srlz.d and thus
is a valid replacement. Also slightly reorder the movl instructions
to improve bundle density.

Revision 1.84: download - view: text, markup, annotated - select for diffs
Wed Mar 27 09:23:37 2002 UTC (9 years, 10 months ago) by jeff
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +1 -1 lines
Add a new mtx_init option "MTX_DUPOK" which allows duplicate acquires of locks
with this flag.  Remove the dup_list and dup_ok code from subr_witness.  Now
we just check for the flag instead of doing string compares.

Also, switch the process lock, process group lock, and uma per cpu locks over
to this interface.  The original mechanism did not work well for uma because
per cpu lock names are unique to each zone.

Approved by:	jhb

Revision 1.83: download - view: text, markup, annotated - select for diffs
Thu Mar 21 07:41:02 2002 UTC (9 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +1 -0 lines
In UP mode, the primary cpu's per-cpu current_pmap was not initialized -
this was only done as a side effect of calling cpu_mp_start().  I haven't
actually tested that this fixes UP kernels, but it feels about right.

Revision 1.82: download - view: text, markup, annotated - select for diffs
Wed Mar 20 23:30:30 2002 UTC (9 years, 10 months ago) by alfred
Branches: MAIN
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +2 -2 lines
Remove __P.

Reviewd by: peter

Revision 1.81: download - view: text, markup, annotated - select for diffs
Tue Mar 19 11:18:47 2002 UTC (9 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +1 -1 lines
My ia64 box for some reason likes to fragment the beginning/end of memory
a bit before handing it over to the OS.  I occasionally have 11
segments with several 8K or so fragments depending on nvram settings and
what I have done under loader(8) before booting.  This needs to be
revisited.

Revision 1.80: download - view: text, markup, annotated - select for diffs
Tue Mar 19 11:14:51 2002 UTC (9 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +0 -3 lines
Move a couple of prototypes together instead of being incompletely
scattered around.

Revision 1.79: download - view: text, markup, annotated - select for diffs
Thu Mar 14 09:20:07 2002 UTC (9 years, 11 months ago) by dfr
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +9 -6 lines
Move the call to pmap_bootstrap to after the initialisation of thread0.
This allows us to use mutexes in pmap safely. Also initialise fpcurthread
for cpu0 so that ia64_fpstate_check doesn't barf during boot.

Revision 1.78: download - view: text, markup, annotated - select for diffs
Tue Mar 12 00:18:20 2002 UTC (9 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +2 -1 lines
Fix a warning (make ucontext_t *ucp a const)

Revision 1.77: download - view: text, markup, annotated - select for diffs
Tue Mar 12 00:17:45 2002 UTC (9 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +2 -2 lines
Stop concatenating __func__ with strings

Revision 1.76: download - view: text, markup, annotated - select for diffs
Sun Mar 3 19:23:15 2002 UTC (9 years, 11 months ago) by dfr
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +15 -12 lines
* Include <sys/ucontext.h> so that this compiles again.
* Move the section which manipulates ia64_pal_base to after cninit() so
  that we don't risk printing anything before we have a console.
* Don't call ia64_probe_sapics() for a SKI build. This should really
  be dependant on ACPICA being present or something.

Revision 1.75: download - view: text, markup, annotated - select for diffs
Thu Feb 7 20:58:44 2002 UTC (10 years ago) by julian
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +9 -10 lines
Pre-KSE/M3 commit.
this is a low-functionality change that changes the kernel to access the main
thread of a process via the linked list of threads rather than
assuming that it is embedded in the process. It IS still embeded there
but remove all teh code that assumes that in preparation for the next commit
which will actually move it out.

Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,

Revision 1.74: download - view: text, markup, annotated - select for diffs
Fri Feb 1 15:44:02 2002 UTC (10 years ago) by bde
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +6 -15 lines
Compile osigreturn() unconditionally since it will always be needed on
some arches and the syscall table is machine-independent.  It was
(bogusly) conditional on COMPAT_43, so this usually makes no difference.

ia64: in addition:
- replace the bogus cloned comment before osigreturn() by a correct one.
  osigreturn() is just a stub fo ia64's.
- fix the formatting of cloned comment before sigreturn().
- fix the return code.  use nosys() instead of returning ENOSYS to get
  the same semantics as if the syscall is not in the syscall table.
  Generating SIGSYS is actually correct here.
- fix style bugs.

powerpc: copy the cleaned up ia64 stub.  This mainly fixes a bogus comment.

sparc64: copy the cleaned up the ia64 stub, since there was no stub before.

Revision 1.73: download - view: text, markup, annotated - select for diffs
Fri Jan 18 07:49:37 2002 UTC (10 years ago) by marcel
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +1 -1 lines
Remove the definition of bootverbose. This fixes the link failure
caused by disabling the emission of common symbols.

Revision 1.72: download - view: text, markup, annotated - select for diffs
Sun Dec 30 09:49:39 2001 UTC (10 years, 1 month ago) by marcel
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +37 -51 lines
o  Reimplement map_pal_code to work with a global variable
   ia64_pal_base instead of scanning the EFI tables. This way
   AP startup code can more easily use the function.
o  Initialize ia64_pal_base in ia64_init(). When the PAL code
   doesn't need explicit mapping or no PAL code has been found,
   ia64_pal_base will be 0.
o  Remove some unused global variables.
o  Also in ia64_init(), allocate only 1 page for struct pcpu
   and remove some Alpha leftovers.
o  Initialize pc_pcb in cpu_pcpu_init().

Revision 1.71: download - view: text, markup, annotated - select for diffs
Tue Dec 11 23:33:41 2001 UTC (10 years, 2 months ago) by jhb
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +8 -15 lines
Overhaul the per-CPU support a bit:

- The MI portions of struct globaldata have been consolidated into a MI
  struct pcpu.  The MD per-CPU data are specified via a macro defined in
  machine/pcpu.h.  A macro was chosen over a struct mdpcpu so that the
  interface would be cleaner (PCPU_GET(my_md_field) vs.
  PCPU_GET(md.md_my_md_field)).
- All references to globaldata are changed to pcpu instead.  In a UP kernel,
  this data was stored as global variables which is where the original name
  came from.  In an SMP world this data is per-CPU and ideally private to each
  CPU outside of the context of debuggers.  This also included combining
  machine/globaldata.h and machine/globals.h into machine/pcpu.h.
- The pointer to the thread using the FPU on i386 was renamed from
  npxthread to fpcurthread to be identical with other architectures.
- Make the show pcpu ddb command MI with a MD callout to display MD
  fields.
- The globaldata_register() function was renamed to pcpu_init() and now
  init's MI fields of a struct pcpu in addition to registering it with
  the internal array and list.
- A pcpu_destroy() function was added to remove a struct pcpu from the
  internal array and list.

Tested on:	alpha, i386
Reviewed by:	peter, jake

Revision 1.70: download - view: text, markup, annotated - select for diffs
Sun Dec 9 01:57:07 2001 UTC (10 years, 2 months ago) by dillon
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +2 -1 lines
Allow maxusers to be specified as 0 in the kernel config, which will
cause the system to auto-size to between 32 and 512 depending on the
amount of memory.

MFC after:	1 week

Revision 1.69: download - view: text, markup, annotated - select for diffs
Mon Nov 19 07:25:42 2001 UTC (10 years, 2 months ago) by peter
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +11 -0 lines
Initial cut at calling the EFI-provided FPSWA (Floating Point Software
Assist) driver to handle the "messy" floating point cases which
cause traps to the kernel for handling.

Revision 1.68: download - view: text, markup, annotated - select for diffs
Mon Nov 12 07:18:16 2001 UTC (10 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +9 -4 lines
o  os_boot_rendez is responsible for clearing the IRR bit by
   reading cr.ivr, as well as writing to cr.eoi.
o  use global variables to pass information to os_boot_rendez
   so that it doesn't have to jump through hoops to find it
   out. This avoids traps on the AP without it even being
   initialized. This fixes SMP configurations.
o  Move the probing of the MADT to the end of cpu_startup,
   instead of at the start of cpu_mp_probe. We need to probe
   the MADT for non-SMP configurations as well. This fixes
   uniprocessor configurations.
o  Serialize AP wake-up by waiting for the AP. We need to do
   this since we use global variables to for the AP to use.
   As a side-effect, we can use printf() more easily to see
   what's going on.

Revision 1.67: download - view: text, markup, annotated - select for diffs
Mon Nov 12 04:14:04 2001 UTC (10 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +0 -126 lines
Remove #if 0'ed code that was replaced by vm_ksubmap_init() and GC'ed
on other platforms.

Revision 1.66: download - view: text, markup, annotated - select for diffs
Fri Nov 9 13:09:57 2001 UTC (10 years, 3 months ago) by dfr
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +1 -1 lines
Reserve more space for phys_avail. Really need to be more careful about
overflowing phys_avail.

Revision 1.65: download - view: text, markup, annotated - select for diffs
Fri Nov 2 01:45:11 2001 UTC (10 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +1 -1 lines
argh! cut/paste typo. :-(
(committed on a different machine to what I was testing it on)

Revision 1.64: download - view: text, markup, annotated - select for diffs
Fri Nov 2 00:41:00 2001 UTC (10 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +3 -1 lines
"Fix" a problem that got copied from alpha to ia64 and broke there.
When we truncate the msgbuf size because the last chunk is too small,
correctly terminate the phys_avail[] array - the VM system tests
the *end* for zero, not the start.  This leads the VM startup to
attempt to recreate a duplicate set of pages for all physical memory.

XXX the msgbuf handling is suspiciously different on i386 vs
alpha/ia64...

Revision 1.63: download - view: text, markup, annotated - select for diffs
Mon Oct 29 12:04:23 2001 UTC (10 years, 3 months ago) by dfr
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +58 -1 lines
* Factor out common code for manipulating the RSE backing store.
* Implement a fairly simplistic parser for unwinding stack frames.
* Use unwind records for DDB's 'trace' command. Also add support for
  tracing past exceptions to the context which generated the exception.

The stack unwind code requires a toolchain based on binutils-2.11.2 or
later and gcc-3.0.1 or later.

Revision 1.62: download - view: text, markup, annotated - select for diffs
Tue Oct 23 22:23:22 2001 UTC (10 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +1 -1 lines
Fix RAW dependency violation when compiled with gcc-3
Warning: Use of 'br.ret.sptk.many' violates RAW dependency 'PSR.tb' (data)

Revision 1.61: download - view: text, markup, annotated - select for diffs
Tue Oct 23 11:04:43 2001 UTC (10 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +0 -5 lines
Turn off the single-user override.  We've been running multi-user
for some time.  Having a machine boot unattended is useful. :-)

Revision 1.60: download - view: text, markup, annotated - select for diffs
Sun Oct 21 22:16:44 2001 UTC (10 years, 3 months ago) by des
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +0 -0 lines
[partially forced commit due to pilot error in earlier commit attempt]

{set,fill}_{,fp,db}regs() fixup:

 - Add dummy {set,fill}_dbregs() on architectures that don't have them.

 - KSEfy the powerpc versions (struct proc -> struct thread).

 - Some architectures had the prototypes in md_var.h, some in reg.h, and
   some in both; for consistency, move them to reg.h on all platforms.

These functions aren't really MD (the implementation is MD, but the interface
is MI), so they should move to an MI header, but I haven't figured out which
one yet.

Run-tested on i386, build-tested on Alpha, untested on other platforms.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Sun Oct 21 22:14:00 2001 UTC (10 years, 3 months ago) by des
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +14 -1 lines
{set,fill}_{,fp,db}regs() fixup:

 - Add dummy {set,fill}_dbregs() on architectures that don't have them.

 - KSEfy the powerpc versions (struct proc -> struct thread).

 - Some architectures had the prototypes in md_var.h, some in reg.h, and
   some in both; for consistency, move them to reg.h on all platforms.

These functions aren't really MD (the implementation is MD, but the interface
is MI), so they should move to an MI header, but I haven't figured out which
{set,fill}_{,fp,db}regs() fixup:

 - Add dummy {set,fill}_dbregs() on architectures that don't have them.

 - KSEfy the powerpc versions (struct proc -> struct thread).

 - Some architectures had the prototypes in md_var.h, some in reg.h, and
   some in both; for consistency, move them to reg.h on all platforms.

These functions aren't really MD (the implementation is MD, but the interface
is MI), so they should move to an MI header, but I haven't figured out which
one yet.

Run-tested on i386, build-tested on Alpha, untested on other platforms.

Revision 1.58: download - view: text, markup, annotated - select for diffs
Sun Oct 21 14:01:48 2001 UTC (10 years, 3 months ago) by dfr
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +1 -1 lines
Use ia64_set_fpsr() instead of __asm to set ar.fpsr.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Thu Oct 18 16:20:04 2001 UTC (10 years, 3 months ago) by dfr
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +26 -0 lines
Shift the code which packs and unpacks instruction bundles out of DDB
since it is useful for various emulations duties (e.g. unaligned trap
handling).

Revision 1.56: download - view: text, markup, annotated - select for diffs
Mon Oct 15 07:58:27 2001 UTC (10 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +2 -2 lines
When compiling with SKI support, create the fake memory regions
when either the memory descriptor in the bootinfo is NULL or
the descriptor count is 0.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Thu Oct 11 12:31:50 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +20 -12 lines
* Change the calling convention for execve so that it conforms to normal
  C calling conventions. This allows crt1.c to be written nearly without
  any inline assembler.
* Initialise cpu_model[] so that the hw.model sysctl works properly.

Revision 1.54: download - view: text, markup, annotated - select for diffs
Sun Oct 7 14:20:01 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +1 -2 lines
Remove bogus include.

Revision 1.53: download - view: text, markup, annotated - select for diffs
Sat Oct 6 16:06:48 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +8 -8 lines
Move console probes until after we set boothowto so that 'boot -h' works.

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sat Sep 29 11:43:36 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +159 -38 lines
Various changes to use the firmware on a real machine.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Sat Sep 22 19:50:12 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +16 -11 lines
* Turn off memory descriptor debugging - its served its purpose.
* Don't get confused when memory regions don't lie on page boundaries -
  remember our page size is typically larger than the firmware's page size.
* Add a function ia64_running_in_simulator() which is intended to detect
  whether the kernel is running in SKI or on real hardware.

Revision 1.50: download - view: text, markup, annotated - select for diffs
Tue Sep 18 13:26:30 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +36 -2 lines
Flesh out identifycpu().

Revision 1.49: download - view: text, markup, annotated - select for diffs
Sat Sep 15 18:31:49 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +54 -45 lines
Rearrange so we search for I/O port space as early as possible (i.e.
before console probing). Also fix a confusion between EFI's page size
which is fixed at 4096 and our own page size which is variable at compile
time.

Revision 1.48: download - view: text, markup, annotated - select for diffs
Sat Sep 15 15:31:59 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +4 -6 lines
Use the MI console code to initialise the console.

Revision 1.47: download - view: text, markup, annotated - select for diffs
Sat Sep 15 12:29:46 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +42 -24 lines
* Use Intel's EFI headers instead of home-grown ones.
* Use the bootinfo's memory map if present instead of hard-coding SKI's
  memory map.
* Record the location of the I/O Port Space if present in the memory map.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Thu Sep 13 12:39:14 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +16 -71 lines
* Enable dynamically linked kernel. This involves adding a self-relocator
  to locore to process the @fptr relocations in the dynamic executable.
* Don't initialise the timer until *after* we install the timecounter to
  avoid a race between timecounter initialisation and hardclock.
* Tidy up bootinfo somewhat including adding sanity checks for when the
  kernel is loaded without a recognisable bootinfo.

Revision 1.45: download - view: text, markup, annotated - select for diffs
Wed Sep 12 08:37:40 2001 UTC (10 years, 5 months ago) by julian
Branches: MAIN
CVS tags: KSE_MILESTONE_2
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +82 -64 lines
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha

Revision 1.44: download - view: text, markup, annotated - select for diffs
Mon Sep 10 13:39:59 2001 UTC (10 years, 5 months ago) by dfr
Branches: MAIN
CVS tags: KSE_PRE_MILESTONE_2
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +10 -16 lines
* Make a start on a realistic definition for bootinfo.
* Switch to proc0's stack and backing store before calling ia64_init
  so that we don't rely on the loader's stack at all.
* Change kernel entry point name from locorestart to __start.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Thu Sep 6 22:20:41 2001 UTC (10 years, 5 months ago) by jhb
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +2 -4 lines
Call sendsig() with the proc lock held and return with it held.

Revision 1.42: download - view: text, markup, annotated - select for diffs
Sun Sep 2 07:47:47 2001 UTC (10 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +27 -15 lines
Merge from i386: various cleanups including moving the map calculations
to MI code.  This gets ia64 to compile again.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Mon Aug 27 05:11:20 2001 UTC (10 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +5 -2 lines
Enable hardwiring of things like tunables from embedded enironments
that do not start from loader(8).

Revision 1.40: download - view: text, markup, annotated - select for diffs
Tue Aug 21 02:32:58 2001 UTC (10 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +3 -1 lines
Make COMPAT_43 optional again.   XXX we need COMPAT_FBSD3 etc for this
stuff.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Wed Aug 8 05:25:06 2001 UTC (10 years, 6 months ago) by peter
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +1 -54 lines
Zap 'ptrace(PT_READ_U, ...)' and 'ptrace(PT_WRITE_U, ...)' since they
are a really nasty interface that should have been killed long ago
when 'ptrace(PT_[SG]ETREGS' etc came along.  The entity that they
operate on (struct user) will not be around much longer since it
is part-per-process and part-per-thread in a post-KSE world.

gdb does not actually use this except for the obscure 'info udot'
command which does a hexdump of as much of the child's 'struct user'
as it can get.  It carries its own #defines so it doesn't break
compiles.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Mon Aug 6 12:52:17 2001 UTC (10 years, 6 months ago) by dfr
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +1 -3 lines
Remove usage of nonexistent vm_mtx.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Thu Jul 26 23:06:44 2001 UTC (10 years, 6 months ago) by peter
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +4 -1 lines
Call the early tunable setup functions as soon as kern_envp is available.
Some things depend on hz being set not long after this.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Fri Jun 29 11:10:35 2001 UTC (10 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +13 -13 lines
Add a new MI pointer to the process' trapframe p_frame instead of using
various differently named pointers buried under p_md.

Reviewed by:	jake (in principle)

Revision 1.35: download - view: text, markup, annotated - select for diffs
Wed Jun 27 14:57:17 2001 UTC (10 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +5 -16 lines
Catch up to mbuf allocator changes from last September so this compiles
again.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Wed May 30 00:03:13 2001 UTC (10 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +3 -1 lines
- Catch up to the VM mutex changes.
- Sort includes in a few places.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Wed May 23 09:42:03 2001 UTC (10 years, 8 months ago) by ru
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +2 -2 lines
- FDESC, FIFO, NULL, PORTAL, PROC, UMAP and UNION file
  systems were repo-copied from sys/miscfs to sys/fs.

- Renamed the following file systems and their modules:
  fdesc -> fdescfs, portal -> portalfs, union -> unionfs.

- Renamed corresponding kernel options:
  FDESC -> FDESCFS, PORTAL -> PORTALFS, UNION -> UNIONFS.

- Install header files for the above file systems.

- Removed bogus -I${.CURDIR}/../../sys CFLAGS from userland
  Makefiles.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Thu May 17 22:28:46 2001 UTC (10 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +1 -5 lines
- Move the setting of bootverbose to a MI SI_SUB_TUNABLES SYSINIT.
- Attach a writable sysctl to bootverbose (debug.bootverbose) so it can be
  toggled after boot.
- Move the printf of the version string to a SI_SUB_COPYRIGHT SYSINIT just
  afer the display of the copyright message instead of doing it by hand in
  three MD places.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Thu May 10 17:45:47 2001 UTC (10 years, 9 months ago) by jhb
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +2 -3 lines
- Split out the support for per-CPU data from the SMP code.  UP kernels
  have per-CPU data and gdb on the i386 at least needs access to it.
- Clean up includes in kern_idle.c and subr_smp.c.

Reviewed by:	jake

Revision 1.30: download - view: text, markup, annotated - select for diffs
Fri Apr 27 19:28:22 2001 UTC (10 years, 9 months ago) by jhb
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +14 -9 lines
Overhaul of the SMP code.  Several portions of the SMP kernel support have
been made machine independent and various other adjustments have been made
to support Alpha SMP.

- It splits the per-process portions of hardclock() and statclock() off
  into hardclock_process() and statclock_process() respectively.  hardclock()
  and statclock() call the *_process() functions for the current process so
  that UP systems will run as before.  For SMP systems, it is simply necessary
  to ensure that all other processors execute the *_process() functions when the
  main clock functions are triggered on one CPU by an interrupt.  For the alpha
  4100, clock interrupts are delievered in a staggered broadcast fashion, so
  we simply call hardclock/statclock on the boot CPU and call the *_process()
  functions on the secondaries.  For x86, we call statclock and hardclock as
  usual and then call forward_hardclock/statclock in the MD code to send an IPI
  to cause the AP's to execute forwared_hardclock/statclock which then call the
  *_process() functions.
- forward_signal() and forward_roundrobin() have been reworked to be MI and to
  involve less hackery.  Now the cpu doing the forward sets any flags, etc. and
  sends a very simple IPI_AST to the other cpu(s).  AST IPIs now just basically
  return so that they can execute ast() and don't bother with setting the
  astpending or needresched flags themselves.  This also removes the loop in
  forward_signal() as sched_lock closes the race condition that the loop worked
  around.
- need_resched(), resched_wanted() and clear_resched() have been changed to take
  a process to act on rather than assuming curproc so that they can be used to
  implement forward_roundrobin() as described above.
- Various other SMP variables have been moved to a MI subr_smp.c and a new
  header sys/smp.h declares MI SMP variables and API's.   The IPI API's from
  machine/ipl.h have moved to machine/smp.h which is included by sys/smp.h.
- The globaldata_register() and globaldata_find() functions as well as the
  SLIST of globaldata structures has become MI and moved into subr_smp.c.
  Also, the globaldata list is only available if SMP support is compiled in.

Reviewed by:	jake, peter
Looked over by:	eivind

Revision 1.29: download - view: text, markup, annotated - select for diffs
Tue Apr 24 15:55:47 2001 UTC (10 years, 9 months ago) by dfr
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +6 -1 lines
Align stack pointer and backing store pointer to 16 byte boundary when
delivering signals.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Thu Mar 29 20:26:12 2001 UTC (10 years, 10 months ago) by obrien
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +2 -2 lines
Reduce the emasculation of bounds_check_with_label() by one line, so we
propagate a bio error condition to the caller and above.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Wed Mar 28 09:03:21 2001 UTC (10 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +2 -2 lines
Rework the witness code to work with sx locks as well as mutexes.
- Introduce lock classes and lock objects.  Each lock class specifies a
  name and set of flags (or properties) shared by all locks of a given
  type.  Currently there are three lock classes: spin mutexes, sleep
  mutexes, and sx locks.  A lock object specifies properties of an
  additional lock along with a lock name and all of the extra stuff needed
  to make witness work with a given lock.  This abstract lock stuff is
  defined in sys/lock.h.  The lockmgr constants, types, and prototypes have
  been moved to sys/lockmgr.h.  For temporary backwards compatability,
  sys/lock.h includes sys/lockmgr.h.
- Replace proc->p_spinlocks with a per-CPU list, PCPU(spinlocks), of spin
  locks held.  By making this per-cpu, we do not have to jump through
  magic hoops to deal with sched_lock changing ownership during context
  switches.
- Replace proc->p_heldmtx, formerly a list of held sleep mutexes, with
  proc->p_sleeplocks, which is a list of held sleep locks including sleep
  mutexes and sx locks.
- Add helper macros for logging lock events via the KTR_LOCK KTR logging
  level so that the log messages are consistent.
- Add some new flags that can be passed to mtx_init():
  - MTX_NOWITNESS - specifies that this lock should be ignored by witness.
    This is used for the mutex that blocks a sx lock for example.
  - MTX_QUIET - this is not new, but you can pass this to mtx_init() now
    and no events will be logged for this lock, so that one doesn't have
    to change all the individual mtx_lock/unlock() operations.
- All lock objects maintain an initialized flag.  Use this flag to export
  a mtx_initialized() macro that can be safely called from drivers.  Also,
  we on longer walk the all_mtx list if MUTEX_DEBUG is defined as witness
  performs the corresponding checks using the initialized flag.
- The lock order reversal messages have been improved to output slightly
  more accurate file and line numbers.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Fri Mar 9 13:44:53 2001 UTC (10 years, 11 months ago) by dfr
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +2 -3 lines
Adjust a comment slightly.

Revision 1.25: download - view: text, markup, annotated - select for diffs
Wed Mar 7 03:37:02 2001 UTC (10 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +2 -2 lines
Grab the process lock while calling psignal and before calling psignal.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Fri Feb 9 16:25:15 2001 UTC (11 years ago) by jhb
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +2 -1 lines
Move the initailization of the proc lock for proc0 very early into the MD
startup code.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Fri Feb 9 14:50:52 2001 UTC (11 years ago) by jhb
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +1 -8 lines
Remove bogus #if 0'd code that dinked with the saved interrupt state in
sched_lock.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Fri Feb 9 06:09:34 2001 UTC (11 years ago) by bmilekic
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +2 -2 lines
Change and clean the mutex lock interface.

mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)

Revision 1.21: download - view: text, markup, annotated - select for diffs
Sun Feb 4 07:00:46 2001 UTC (11 years ago) by peter
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +2 -1 lines
All the world is not an i386.  Merge rev 1.438 of i386/i386/machdep.c.
Make buffer_map a system map.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Mon Jan 29 13:31:18 2001 UTC (11 years ago) by dfr
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +23 -23 lines
Flesh out EFI support somewhat.

Revision 1.19: download - view: text, markup, annotated - select for diffs
Fri Jan 26 17:52:34 2001 UTC (11 years ago) by dfr
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +8 -3 lines
Initialise proc0.p_heldmtx and proc0.p_contested and call
mtx_enter(&Giant, MTX_DEF) after Giant is initialised.

Reviewed by: jhb

Revision 1.18: download - view: text, markup, annotated - select for diffs
Wed Jan 24 10:36:47 2001 UTC (11 years ago) by jhb
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +11 -2 lines
- Proc locking.
- P_FOO -> PS_FOO.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Sun Jan 21 07:52:17 2001 UTC (11 years ago) by jasone
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +5 -5 lines
Remove MUTEX_DECLARE() and MTX_COLD.  Instead, postpone full mutex
initialization until after malloc() is safe to call, then iterate through
all mutexes and complete their initialization.

This change is necessary in order to avoid some circular bootstrapping
dependencies.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Fri Jan 19 01:58:49 2001 UTC (11 years ago) by bmilekic
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +4 -4 lines
Implement MTX_RECURSE flag for mtx_init().
All calls to mtx_init() for mutexes that recurse must now include
the MTX_RECURSE bit in the flag argument variable. This change is in
preparation for an upcoming (further) mutex API cleanup.
The witness code will call panic() if a lock is found to recurse but
the MTX_RECURSE bit was not set during the lock's initialization.

The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to
MTX_RECURSED, which is more appropriate given its meaning.

The following locks have been made "recursive," thus far:
eventhandler, Giant, callout, sched_lock, possibly some others declared
in the architecture-specific code, all of the network card driver locks
in pci/, as well as some other locks in dev/ stuff that I've found to
be recursive.

Reviewed by: jhb

Revision 1.15: download - view: text, markup, annotated - select for diffs
Tue Dec 5 00:35:58 2000 UTC (11 years, 2 months ago) by jake
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +1 -28 lines
Remove the last of the MD netisr code.  It is now all MI.  Remove
spending, which was unused now that all software interrupts have
their own thread.  Make the legacy schednetisr use an atomic op
for setting bits in the netisr mask.

Reviewed by:	jhb

Revision 1.14: download - view: text, markup, annotated - select for diffs
Thu Nov 30 05:23:47 2000 UTC (11 years, 2 months ago) by marcel
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +9 -3 lines
Don't use p->p_sigstk.ss_flags to keep state of whether the
process is on the alternate stack or not. For compatibility
with sigstack(2) state is being updated if such is needed.

We now determine whether the process is on the alternate
stack by looking at its stack pointer. This allows a process
to siglongjmp from a signal handler on the alternate stack
to the place of the sigsetjmp on the normal stack. When
maintaining state, this would have invalidated the state
information and causing a subsequent signal to be delivered
on the normal stack instead of the alternate stack.

PR: 22286

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sun Nov 26 13:52:17 2000 UTC (11 years, 2 months ago) by jlemon
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +2 -2 lines
Add 'mpsafe' parameter to callout_init() in MD bits.

Reminded by:  jake

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sun Nov 19 06:02:23 2000 UTC (11 years, 2 months ago) by jake
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +3 -1 lines
- Protect the callout wheel with a separate spin mutex, callout_lock.
- Use the mutex in hardclock to ensure no races between it and
  softclock.
- Make softclock be INTR_MPSAFE and provide a flag,
  CALLOUT_MPSAFE, which specifies that a callout handler does not
  need giant.  There is still no way to set this flag when
  regstering a callout.

Reviewed by:	-smp@, jlemon

Revision 1.11: download - view: text, markup, annotated - select for diffs
Fri Oct 27 11:45:29 2000 UTC (11 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +1 -3 lines
Convert all users of fldoff() to offsetof().  fldoff() is bad
because it only takes a struct tag which makes it impossible to
use unions, typedefs etc.

Define __offsetof() in <machine/ansi.h>

Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h>

Remove myriad of local offsetof() definitions.

Remove includes of <stddef.h> in kernel code.

NB: Kernelcode should *never* include from /usr/include !

Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API.

Deprecate <struct.h> with a warning.  The warning turns into an error on
01-12-2000 and the file gets removed entirely on 01-01-2001.

Paritials reviews by:   various.
Significant brucifications by:  bde

Revision 1.10: download - view: text, markup, annotated - select for diffs
Tue Oct 24 19:54:37 2000 UTC (11 years, 3 months ago) by dfr
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +68 -29 lines
* Various fixes to breakage introduced by the atomic and mutex reorgs.
* Fixes to the signal delivery code. Not quite right yet.

I would have preferred to wait until I have signal delivery actually
working but the current kernel in CVS doesn't build.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Fri Oct 20 07:32:48 2000 UTC (11 years, 3 months ago) by jhb
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +5 -5 lines
- machine/mutex.h -> sys/mutex.h
- Use MUTEX_DECLARE() and MTX_COLD for Giant and sched_lock.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Thu Oct 19 20:39:48 2000 UTC (11 years, 3 months ago) by dfr
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +2 -3 lines
Don't force bootverbose anymore.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Mon Oct 16 08:54:38 2000 UTC (11 years, 3 months ago) by dfr
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +6 -4 lines
* Correct some of my misunderstandings about how best to switch to the
  kernel backing store.
* Implement syscalls via break instructions.
* Fix backing store copying in cpu_fork() so that the child gets the right
  register values.

This thing is actually starting to work now. This set of changes takes me
up to the second execve (the one which runs the first shell). Next stop
single-user mode :-).

Revision 1.6: download - view: text, markup, annotated - select for diffs
Thu Oct 12 17:47:01 2000 UTC (11 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +2 -2 lines
Implement a rudimentary interrupt handling system which should be good
enough for clock interrupts in SKI.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Thu Oct 12 14:36:38 2000 UTC (11 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +35 -83 lines
* Fix exception handling so that it actually works. We can now handle
  exceptions from both kernel and user mode.
* Fix context switching so that we can switch back to a proc which we
  switched away from (we were saving the state in the wrong place).
* Implement lazy switching of the high-fp state. This needs to be looked
  at again for SMP to cope with the case of a process migrating from one
  processor to another while it has the high-fp state.
* Make setregs() work properly. I still think this should be called
  cpu_exec() or something.
* Various other minor fixes.

With this lot, we can execve() /sbin/init and we get all the way up to its
first syscall. At that point, we stop because syscall handling is not done
yet.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Tue Oct 10 14:57:10 2000 UTC (11 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +2 -2 lines
* Add rudimentary DDB support (no kgdb, no backtrace, no single step).
* Track recent changes to SWI code.
* Allocate RIDs for pmaps (untested).
* Implement assembler version of cpu_switch - its cleaner that way.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Wed Oct 4 17:52:58 2000 UTC (11 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +22 -2 lines
Next round of fixes to the ia64 code. This includes simulated clock and
disk drivers along with a load of fixes to context switching, fork
handling and a load of other stuff I can't remember now. This takes us as
far as start_init() before it dies. I guess now I will have to finish off
the VM system and syscall handling :-).

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sat Sep 30 17:48:43 2000 UTC (11 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +16 -15 lines
Next round of ia64 work, including fixes to context switching,
implementing cpu_fork(), copy*str(), bcopy(), copy{in,out}(). With these
changes, my test kernel reaches the mountroot prompt.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Fri Sep 29 13:46:04 2000 UTC (11 years, 4 months ago) by dfr
Branches: MAIN
This is the first snapshot of the FreeBSD/ia64 kernel. This kernel will
not work on any real hardware (or fully work on any simulator). Much more
needs to happen before this is actually functional but its nice to see
the FreeBSD copyright message appear in the ia64 simulator.

Diff request

This form allows you to request diffs 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.

Log view options