Commit Graph

1370 Commits

Author SHA1 Message Date
Andrey A. Chernov
527b997c3d Add OFF_T_MAX/OFF_T_MIN 2001-08-15 19:12:46 +00:00
Bill Paul
3708f8da9c Teach bus_dmamem_free() about contigfree(). This is a bit of a hack,
but it's better than the buggy behavior we have now. If we contigmalloc()
buffers in bus_dmamem_alloc(), then we must configfree() them in
bus_dmamem_free(). Trying to free() them is wrong, and will cause
a panic (at least, it does on the alpha.)

I tripped over this when trying to kldunload my busdma-ified if_rl
driver.
2001-08-15 17:26:54 +00:00
Matt Jacob
cf1bca84b6 Old business: some SMP support. 2001-08-15 17:23:22 +00:00
Matt Jacob
c70f4417dc Old business: be able to disable processor configuration from resource. 2001-08-15 17:03:13 +00:00
David E. O'Brien
059d1e91d8 Style changes to commonize the various platforms. 2001-08-15 04:02:41 +00:00
Bill Paul
ee755665c2 Fix yet another "unconditionally free()ing memory without even checking
to see if it was malloc()ed first" bug. In bus_dmamap_create(), one of
two things can happen: either we need to allocate a special map due to
some manner of bounce buffering requirement, or we can DMA a buffer
in place. On the x86 platform, the "in place" case results in
bus_dmamap_create() returning a dmamap of NULL. The bus_dmamap_destroy()
routine later checks for NULL and won't bother free()ing the map if
it detects this condition.

But on the alpha, we don't use NULL, we use a statically allocated map
called nobounce_dmamap(). Unfortunately, bus_dmamap_destroy() does not
handle the condition where we attempt to destroy such a map: it tries
to free() the dmamap, which causes a panic.

Fix: test that map != &nobounce_dmamap before trying to free() it.

With this fix, my busdma-ified if_sis driver works on the alpha. I'm
a bit alarmed that I'm the first person ever to trip over this bug, since
we have been using busdma on the alpha for a while, and since it sort
of screams out "Hi! I'm a bug! Booga-booga!" when you look at it.

(Somewhere, somebody will say: "But Bill, why don't you just not bother
destroying the maps in this case." Because the API is supposed to be
a) symetrical and b) opaque to the caller. I can't know whether it's safe
to skip the bus_dmamap_destroy() step or not without sticking my fingers
into unsafe places, which is what I wanted to avoid in the first place.)
2001-08-14 21:56:53 +00:00
John Baldwin
4f99f11257 In prom_halt(), set the halt restart flags on the current CPU, not the
boot CPU.  This was the reason reboots on SMP systems could result in
weird hangs.  Unlike the x86, we do not need to switch back to the boot
CPU in order to reboot the machine.  See Section 3.4.5 of Part III
(Console Interface Architecture) from the Alpha Architecture Reference
Manual (aka the Brown Book) for more info.
2001-08-13 22:44:55 +00:00
John Baldwin
6937ca29dc Remove IPI_HALT to make way for a more correct fix for halts and restarts
on SMP alphas.
2001-08-13 22:41:15 +00:00
John Baldwin
1c94cee872 Minor style nits: cleanup and add some function prototypes. 2001-08-13 22:38:36 +00:00
John Baldwin
688ebe120c - Close races with signals and other AST's being triggered while we are in
the process of exiting the kernel.  The ast() function now loops as long
  as the PS_ASTPENDING or PS_NEEDRESCHED flags are set.  It returns with
  preemption disabled so that any further AST's that arrive via an
  interrupt will be delayed until the low-level MD code returns to user
  mode.
- Use u_int's to store the tick counts for profiling purposes so that we
  do not need sched_lock just to read p_sticks.  This also closes a
  problem where the call to addupc_task() could screw up the arithmetic
  due to non-atomic reads of p_sticks.
- Axe need_proftick(), aston(), astoff(), astpending(), need_resched(),
  clear_resched(), and resched_wanted() in favor of direct bit operations
  on p_sflag.
- Fix up locking with sched_lock some.  In addupc_intr(), use sched_lock
  to ensure pr_addr and pr_ticks are updated atomically with setting
  PS_OWEUPC.  In ast() we clear pr_ticks atomically with clearing
  PS_OWEUPC.  We also do not grab the lock just to test a flag.
- Simplify the handling of Giant in ast() slightly.

Reviewed by:	bde (mostly)
2001-08-10 22:53:32 +00:00
Peter Wemm
2aca0c28d3 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.
2001-08-08 05:25:15 +00:00
Matt Jacob
d82784053e Revert part of previous- I misunderstood the use of 'ncpus'- I thought it'd
been hack to keep clocks from being reinitialized.
2001-08-01 20:35:42 +00:00
Matt Jacob
802f355a3f Don't initialize a clock twice (it's not a function of number of
cpus).
2001-08-01 19:40:11 +00:00
Jake Burkholder
7e5102989e Use a machine dependent type, Elf_Hashelt, for the elements of the elf
dynamic symbol table buckets and chains.  The sparc64 toolchain uses 32
bit .hash entries, unlike other 64 bits architectures (alpha), which use
64 bit entries.

Discussed with: dfr, jdp
2001-07-31 03:46:39 +00:00
Peter Wemm
0b27d7104f Make PMAP_SHPGPERPROC tunable. One shouldn't need to recompile a kernel
for this, since it is easy to run into with large systems with lots of
shared mmap space.

Obtained from:	yahoo
2001-07-27 01:08:59 +00:00
Peter Wemm
bd40659f85 Call the early tunable setup functions as soon as kern_envp is available.
Some things depend on hz being set not long after this.
2001-07-26 23:06:44 +00:00
Bosko Milekic
49f854f926 - Do not handle the per-CPU containers in mbuf code as though the cpuids
were indices in a dense array. The cpuids are a sparse set and treat
  them as such, setting up containers only for CPUs activated during
  mb_init().

- Fix netstat(1) and systat(1) to treat the per-CPU stats area as a sparse
  map, in accordance with the above.

This allows us to properly boot with certain CPUs disactivated. However, if
we later decide to re-activate said CPUs, we will barf until we decide to
implement CPU spinon/spinoff callback hooks to allow for said CPUs' per-CPU
containers to get configured on their activation.

Reported by: mjacob
Partially (sys/ diffs) Submitted by: mjacob
2001-07-26 18:47:46 +00:00
Doug Rabson
d4127edb9d Simplify the implementation of pmap_emulate_reference(). The new version
simply manipulates the pte which faulted instead of traversing the mapping
list for that page. This makes it possible to complete the trap without
needing locks and incidentally improves the accuracy of some statistics
used by the VM system.
2001-07-24 07:13:07 +00:00
Bill Paul
362c5c1e02 You were knocked senseless by the Boomerang, spun around by the Cyclone,
blown over by the Hurricane and had a house dropped on you by the Tornado.
Now it's time to have your parade rained on by... the Typhoon!

This commit adds driver support for 3Com 3cR990 10/100 ethernet
adapters based on the Typhoon I and Typhoon II chipsets. This is actually
a port of the OpenBSD driver with many hacks by me.

No Virginia, there isn't any support for the hardware crypto yet. However
there is support for TCP/IP checksum offload and VLANs.

Special thanks go to Jason Wright, Aaron Campbell and Theo de Raadt for
squeezing enough info out of 3Com to get this written, and for doing
most of the hard work.

Manual page is included. Compiled as a module and included in GENERIC.
2001-07-23 20:44:54 +00:00
David E. O'Brien
59177a15cc Now that config(8) has stopped breaking POLA (mkmakefile.c rev 1.69) by
always including <KERNEL>.hints if its exist reguardless of the lack of a
"hints" directive in the <KERNEL> file; we can have a real hints file again.
2001-07-15 17:56:53 +00:00
David E. O'Brien
2a57c11a3a Turn off preemption on the Alpha for the time being. Peter and JHB aren't
sure when things got so bad (JHB says preemption worked just fine for months
before the AlbertVM commit).  Even post DillionVM locking commit, Miatas
(DEC Personal Workstations) are very fragile -- not making it thru a world
build.  With this patch it does.

Those hacking on SMPng will want to locally back out this commit.  The rest
of us will want to run with it until the SMPng guys figure out the problem(s).

Submitted by:	peter
2001-07-15 00:03:01 +00:00
Matt Jacob
8f01c08a34 Fix reboot hangs that have happened with multiple processors
on Alpha 4100s.

Basically, if you're halting or you're rebooting, you should
tell all other processors to halt first. Define IPI_HALT- IPI_STOP
is not what we want for this purpose, which will call prom_halt(0)
on receipt.

The processor running the halt or reboot wil send an IPI_HALT to all
other processors, delay a bit, then continue to do what what it was
planning on doing (prom_halt({0|1})).
2001-07-14 21:37:57 +00:00
Dima Dorfman
a7a1b07e25 Move fxp to the miibus section where it belongs. 2001-07-14 06:35:54 +00:00
David E. O'Brien
6036d427b7 I really should have just commented out this intire file vs. removing all
the contents.  One may still want the contents as reference for creating
/boot/device.hints.
2001-07-13 18:45:06 +00:00
David E. O'Brien
5f662f42d6 Hints processing is FUBAR'ed right now.
By default, we will end up with a duplicate set of hints if people have
a properly populated /boot/device.hints.  So for now, remove the hints
here until Peter revisits the new hints processing from mid-June that
broke Alpha booting.
2001-07-13 17:43:38 +00:00
Dima Dorfman
2e1b1231fc `pcn' supports AMD Am79C97x cards, not Am79C79x cards.
PR:		28946
Submitted by:	Ryuichiro Imura <imura@ryu16.org>
2001-07-13 13:34:08 +00:00
Brian S. Dean
17bbfb5897 Add 'hwatch' and 'dhwatch' ddb commands analogous to 'watch' and
'dwatch'.  The new commands install hardware watchpoints if supported
by the architecture and if there are enough registers to cover the
desired memory area.

No objection by: audit@, hackers@

MFC after: 2 weeks
2001-07-11 03:15:25 +00:00
Matt Jacob
cd7c95e0bd Sanity guard- return ENODEV if we don't have a good IRQ resource. 2001-07-11 02:24:28 +00:00
Matt Jacob
71cfb39eb9 Slight cleanliness- add an unlock of Giant in one dopanic case. Do
some very minor formatting changes.
2001-07-11 02:23:31 +00:00
Julian Elischer
0b1ae8097d A set of changes to reduce the number of include files the kernel
takes from /usr/include. I cannot check them on alpha.. (will try beast)

Briefly looked at by: Warner Losh <imp@harmony.village.org>
2001-07-08 04:56:07 +00:00
Matt Jacob
48bd6f600e Bracket call to vm_page_flag_set with required Giant lock/unlock. 2001-07-05 17:27:50 +00:00
Matt Jacob
0b848380bb You cannot require Giant to be locked when you haven't acquired it yet. 2001-07-05 16:55:50 +00:00
Matthew Dillon
7197571105 Move vm_page_zero_idle() from machine-dependant sections to a
machine-independant source file, vm/vm_zeroidle.c.  It was exactly the
same for all platforms and updating them all was getting annoying.
2001-07-05 01:32:42 +00:00
Matthew Dillon
6d03d577a5 Reorg vm_page.c into vm_page.c, vm_pageq.c, and vm_contig.c (for contigmalloc).
Also removed some spl's and added some VM mutexes, but they are not actually
used yet, so this commit does not really make any operational changes
to the system.

vm_page.c relates to vm_page_t manipulation, including high level deactivation,
activation, etc...  vm_pageq.c relates to finding free pages and aquiring
exclusive access to a page queue (exclusivity part not yet implemented).
And the world still builds... :-)
2001-07-04 23:27:09 +00:00
Matthew Dillon
0cddd8f023 With Alfred's permission, remove vm_mtx in favor of a fine-grained approach
(this commit is just the first stage).  Also add various GIANT_ macros to
formalize the removal of Giant, making it easy to test in a more piecemeal
fashion. These macros will allow us to test fine-grained locks to a degree
before removing Giant, and also after, and to remove Giant in a piecemeal
fashion via sysctl's on those subsystems which the authors believe can
operate without Giant.
2001-07-04 16:20:28 +00:00
Matt Jacob
d99b6ac2d7 Follow Bruce's suggestions. They're probably wrong, but better than before. 2001-07-04 05:16:56 +00:00
John Baldwin
d2a5bcc3d3 Allow Giant to be recursed when a process terminates. 2001-07-03 05:09:48 +00:00
Brooks Davis
53dab5fe7b gif(4) and stf(4) modernization:
- Remove gif dependencies from stf.
 - Make gif and stf into modules
 - Make gif cloneable.

PR:		kern/27983
Reviewed by:	ru, ume
Obtained from:	NetBSD
MFC after:	1 week
2001-07-02 21:02:09 +00:00
Warner Losh
1f94b9005c Don't need the .keep_me files. Obrien and I committed past each other.
Add 0-9 to the list of possible kernel names at matsushita-san's
suggestion.

Submitted by: Makoto MATSUSHITA-san <matusita@jp.FreeBSD.org>
2001-07-01 23:35:44 +00:00
David E. O'Brien
5e6ded4212 Ensure sys/${MACHINE}/compile/FOO exists
Reviewed by: arch, imp, peter, and the USENIX terminal room secret kernel cabal
2001-06-30 15:16:29 +00:00
Warner Losh
e1d0d8a941 Really do proper keepme files in the compile directories. Use
.cvsignore file for [A-Za-z]* to keep these directories around rather
than waste a file on .keepme.  This should also make people's built
trees place nice with CVS.

Idea for .cvsignore: peter (although I suggested the regexp)
Pointed out by: Makoto MATSUSHITA-san <matusita@jp.FreeBSD.org>
Llama's costuming by: Fernamdo Llamas
2001-06-30 14:38:32 +00:00
Warner Losh
1b0a8621e6 Repo copy i8237.h to dev/ic so we can get rid of some of the final vestiges
of includes of i386 files from non-i386 ports.
2001-06-30 05:29:11 +00:00
John Baldwin
7aa7260e4a Move ast() and userret() to sys/kern/subr_trap.c now that they are MI. 2001-06-29 19:51:37 +00:00
John Baldwin
6be523bca7 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)
2001-06-29 11:10:41 +00:00
John Baldwin
f052203eed Grab Giant around fault handling at the top level for now. 2001-06-29 04:18:59 +00:00
John Baldwin
f565449541 Allow the clock lock to recurse. 2001-06-25 23:56:56 +00:00
John Baldwin
eaa942ebbd - Grab the vm lock around all of pmap_emulate_reference() as it manipulates
vm_page_t's.
- Add a KTR_TRAP tracepoint to trap() on the alpha that displays the
  contents of a0, a1, and a2 to make debugging of nested traps that
  panic before displaying any useful output easier.
2001-06-25 23:52:25 +00:00
Matt Jacob
d1d080f810 fix oopslet for PROC_UNLOCK_NOSWITCH 2001-06-24 18:23:17 +00:00
John Baldwin
06c836bbca - Grab the proc lock around CURSIG and postsig(). Don't release the proc
lock until after grabbing the sched_lock to avoid CURSIG racing with
  psignal.
- Don't grab Giant for addupc_task() as it isn't needed.

Reported by:	tegge (signal race), bde (addupc_task a while back)
2001-06-22 23:05:11 +00:00
John Baldwin
49f886f5d3 Be conservative and always perform an mb after an atomic_cmpset operation. 2001-06-22 21:13:20 +00:00