Commit graph

44834 commits

Author SHA1 Message Date
Pawel Jakub Dawidek 4133136ba7 Add SX_UNLOCKED define. It will be used with sx_assert(9) to be
sure that current thread does not hold given sx(9) lock.

Reviewed by:	jhb
Approved by:	jhb, scottl (mentor)
2004-02-04 07:53:35 +00:00
Robert Watson 5e312ddcc6 A variety of further cleanups to ttyinfo():
- Rename temporary variable names ("tmp", "tmp2") to more informative
  names ("load", "pctcpu", "rss", ...)

- Unclutter indentation and return paths: rather than lots of nested
  ifs, simply return earlier if it's not going to work out.  Simplify
  general structure and avoid "deep" code.

- Comment on the thread/process selection and locking.

- Correct handling of "running"/"runnable" states, avoid "unknown"
  that people were seeing for running processes.  This was due to
  a misunderstanding of the more complex state machine / inhibitors
  behavior of KSE.

- Do perform ttyinfo() printing on KSE (P_SA) processes, it seems
  generally to work.

While I initially attempted to formulate this as two commits (one
layout, the other content), I concluded that the layout changes were
really structural changes.

Many elements submitted by:  bde
2004-02-04 05:46:05 +00:00
Peter Grehan 78bdfb1f1c - removed debug printf that was a false positive on non-OpenPIC systems
- white space nits
2004-02-04 04:53:09 +00:00
Bill Paul b783c5e972 Correct/improve the implementation of NdisMAllocateSharedMemoryAsync().
Since we have a worker thread now, we can actually do the allocation
asynchronously in that thread's context. Also, we need to return a
status value: if we're unable to queue up the async allocation, we
return NDIS_STATUS_FAILURE, otherwise we return NDIS_STATUS_PENDING
to indicate the allocation has been queued and will occur later.

This replaces the kludge where we just invoked the callback routine
right away in the current context.
2004-02-04 04:44:16 +00:00
Brooks Davis 36c19a572a Add the kernel side of network interface renaming support.
The basic process is to send a routing socket announcement that the
interface has departed, change if_xname, update the sockaddr_dl
associated with the interface, and announce the arrival of the interface
on the routing socket.

As part of this change, ifunit() is greatly simplified by testing
if_xname directly.  if_clone_destroy() now uses if_dname to look up the
cloner for the interface and if_dunit to identify the unit number.

Reviewed by:	ru, sam (concept)
		Vincent Jardin <vjardin AT free.fr>
		Max Laier <max AT love2party.net>
2004-02-04 02:54:25 +00:00
Daniel Eischen 3c96f1d190 The sem_timedwait() and ksem_timedwait() functions both
need struct timespec, so define it here.

Discussed in:	standards (wollman)
2004-02-03 22:27:03 +00:00
John Baldwin 7a9d7023a2 Revert the skipping of segment register reloads as it appears to actually
be a pessimization on non Pentium4 CPUs.  More importantly, it is buggy as
it can cause GPF's when using APM or vm86.
2004-02-03 22:00:42 +00:00
Hajimu UMEMOTO f073c60f73 pass pcb rather than so. it is expected that per socket policy
works again.
2004-02-03 18:20:55 +00:00
John Baldwin 3e9ac3ebf2 Remove a bogus assertion.
Noticed by:	bde
Pointy hat to:	jhb
2004-02-03 15:14:27 +00:00
Daniel Eischen 4e4710b784 Add prototype for sem_timedwait().
Reviewed by:	standards (Stefan Farfeleder)
2004-02-03 10:15:16 +00:00
Peter Grehan 2894a94905 Use device alias "mpic" to locate the macio OpenPIC. This works
on the new 12/15/17" PowerBooks that don't have the "interrupt-controller"
property underneath "/chosen", which was the previous way of
searching.
2004-02-03 08:00:37 +00:00
Bill Paul cea179a3fe Implement support for single packet sends. The Intel Centrino driver
that Asus provides on its CDs has both a MiniportSend() routine
and a MiniportSendPackets() function. The Microsoft NDIS docs say
that if a driver has both, only the MiniportSendPackets() routine
will be used. Although I think I implemented the support correctly,
calling the MiniportSend() routine seems to result in no packets going
out on the air, even though no error status is returned. The
MiniportSendPackets() function does work though, so at least in
this case it doesn't matter.

In if_ndis.c:ndis_getstate_80211(), if ndis_get_assoc() returns
an error, don't bother trying to obtain any other state since the
calls may fail, or worse cause the underlying driver to crash.

(The above two changes make the Asus-supplied Centrino work.)

Also, when calling the OID_802_11_CONFIGURATION OID, remember
to initialize the structure lengths correctly.

In subr_ndis.c:ndis_open_file(), set the current working directory
to rootvnode if we're in a thread that doesn't have a current
working directory set.
2004-02-03 07:39:23 +00:00
Bruce Evans ab2bf9ff6a Removed bogus checks that (PCPU_GET(curpcb) != NULL). Rev.1.586 of
machdep.c fixed the missing early initialization of curpcb, so curpcb
is now always set together with curthread and it cannot be NULL except
before the IDT has been set up (so trap() is unreachable) or after a
memory error.  In any case, it was often used without checking.

curcpb shouldn't exist anyway.  It doesn't exist for most non-i386 arches.
It just caches curthread->td_pcb in a global.  This was a better idea
before it was per-cpu.  trap() and some other places can get at it more
efficiently using td->td_pcb instead of PCPU_GET(curpcb).  The main
exception is support.s which mostly wants only curpcb->pcb_onfault.
2004-02-03 06:35:29 +00:00
Daniel Eischen 51305c403f Regen. 2004-02-03 05:20:28 +00:00
Daniel Eischen 12ef052ac2 Sync with kern/syscalls.master. 2004-02-03 05:18:48 +00:00
Daniel Eischen b5426f096b Regen after adding ksem_timedwait(). 2004-02-03 05:11:31 +00:00
Daniel Eischen aae94fbbb6 Add ksem_timedwait() to complement ksem_wait().
Glanced at by:	alfred
2004-02-03 05:08:32 +00:00
Robert Watson 4f638130c3 Don't dec/inc the amountpipes counter every time we resize a pipe --
instead, just dec/inc in the ctor/dtor.  For now, increment/decrement
in two's, since we're now performing the operation once per pair,
not once per pipe.  Not really any measurable performance change
in my micro-benchmarks, but doing less work is good, especially when
it comes to atomic operations.

Suggested by:	alc
2004-02-03 04:55:24 +00:00
Nate Lawson 526785c638 Notify the user (at kern.emerg) that the system will be shutting down if
it is still above the critical temperature on the next poll cycle.  This
is a 10 second advance notice by default.  Document the private
(non-standard) notify we will be using with devd(8).
2004-02-03 04:18:56 +00:00
Robert Watson 9a830ddc54 Catch instances of (pipe == NULL) that were obsoleted with recent
changes to jointly allocated pipe pairs.  Replace these checks
with pipe_present checks.  This avoids a NULL pointer dereference
when a pipe is half-closed.

Submitted by:	Peter Edwards <peter.edwards@openet-telecom.com>
2004-02-03 02:50:51 +00:00
John Baldwin b56ef1c10d Drop the reference count on the old vmspace after fully switching the
current thread to the new vmspace.

Suggested by:	dillon
2004-02-02 23:23:48 +00:00
John Baldwin b71aa5f5e9 Set PCPU_GET(curpcb) for the BSP to thread0's pcb. Otherwise, the boot CPU
doesn't have a pcb until after it's first context switch.  This can cause
secondary panics if a page fault happens during bootup.
2004-02-02 23:22:24 +00:00
Andre Oppermann b74d89bbbb Add sysctl net.inet.icmp.reply_src to specify the interface name
used for the ICMP reply source in reponse to packets which are not
directly addressed to us.  By default continue with with normal
source selection.

Reviewed by:	bms
2004-02-02 22:53:16 +00:00
Andre Oppermann 1488eac8ec More verbose description of the source ip address selection for ICMP replies.
Reviewed by:	bms
2004-02-02 22:17:09 +00:00
John Baldwin 9c9c52a3ed - Assert that witness_cold is not true in enroll().
- Only check witness_watch once in enroll().

Reported by:	ru (2)
2004-02-02 22:15:17 +00:00
Brooks Davis ccb82468ac More macro cleanup. Use the system roundup2() macro instead of making
our own ROUNDUP() macro.

Suggested by:	bde
2004-02-02 21:55:34 +00:00
Paul Saab 65fd52fc8b Reserve 187 (twa) for the new 3ware ATA RAID controller. 2004-02-02 20:00:56 +00:00
Poul-Henning Kamp 0ed4f6a180 Allow a GEOM class to unload if it has no geoms or a method function to
get rid of them.

Prodded by:	pjd
2004-02-02 19:49:41 +00:00
Pawel Jakub Dawidek 3410b19324 Fix many issues related to mount/unmount:
1. Root from inside a jail was able to unmount any file system
   (except /).
2. Unprivileged root was able to unmount file systems mounted by
   privileged root (execpt /).
3. User from inside a jail was able to mount file system when
   sysctl vfs.usermount was set to 1.
4. User was able to mount file system when vfs.usermount was set to 1
   (that's ok) and unmount it even if vfs.usermount was equal to 0
   (that's not correct).

Possibility from point 1 was reported by: Dariusz Kowalski <darek@76.pl>

Only a part of this fix will be MFC'ed (if approved).

PR:		kern/60149
Reviewed by:	rwatson
Approved by:	scottl (mentor)
MFC after:	3 days
2004-02-02 19:02:05 +00:00
Pawel Jakub Dawidek 43a55a72ef Added flag MNT_USER to MNT_UPDATEMASK, it will be used for detecting
file systems mounted by unprivileged users.

Reviewed by:	rwatson
Approved by:	scottl (mentor)
MFC after:	3 days
2004-02-02 18:24:29 +00:00
Nate Lawson 322141f1e2 If the temperature is at _HOT or _CRT for 3 sequential readings, shutdown
the system.  Also, decrease the poll interval to 10 seconds from 30
seconds.  This is needed because some systems will report an invalid high
temperature for one poll cycle.  It is suspected this is due to the
embedded controller timing out.  A typical value is 138C for one cycle on a
system that is otherwise 65C.  This prevents the system from prematurely
shutting down after one invalid reading.  It will still shut down after 30
seconds of high temperature, which is the same as previous default
behavior.

Tested by:	Scott Lambert <lambert AT lambertfam.org>
2004-02-02 18:03:35 +00:00
Pawel Jakub Dawidek cff2ddaeb2 - Use proper names in KASSERTs.
- Typos.

Approved by:	phk, scottl (mentor)
2004-02-02 17:50:09 +00:00
Poul-Henning Kamp c740ae4b46 Add CRD_F_KEY_EXPLICIT which allows the key to be changed per
operation, just like it was possible to change the IV.

Currently supported on Hifn and software engines only.

Approved by:	sam@
2004-02-02 17:06:34 +00:00
Søren Schmidt b8f6dec455 Move the enabling of interrupt back to where it was some time ago.
This apparently was what broke the boot with some devices (liteon).
2004-02-02 15:49:01 +00:00
MIHIRA Sanpei Yoshiro e08f155b25 MFNetBSD: URL updates(rev.1.108) 2004-02-02 15:00:15 +00:00
Søren Schmidt 6595b49405 Fix support for the Promise TX4 on amd64.
Somehow the bridge on there shows up with another PCI id than
it does on x86, no idea why...
2004-02-02 14:05:57 +00:00
Poul-Henning Kamp abc2e0fd56 Check error return from g_clone_bio(). (netchild@)
Rearrange code to avoid duplication (phk@)

Submitted by:	netchild@
2004-02-02 13:36:06 +00:00
Poul-Henning Kamp 3e5b686160 Check error return from g_clone_bio(). (netchild@)
Add XXX comment about why this is still not optimal. (phk@)

Submitted by:	netchild@
2004-02-02 13:08:03 +00:00
Poul-Henning Kamp 42fd931ee9 GC old unused dev_t mangling stuff. 2004-02-02 12:57:49 +00:00
Poul-Henning Kamp 793ffa8e55 Don't mingle malloc/g_event flags.
Spotted by:	pjd@
2004-02-02 10:58:07 +00:00
Jeff Roberson fe5efaede8 - Make sure the apic is idle before sending an IPI. This is required on
non-X-APIC machines.  Previously this was only done in the
   DETECT_DEADLOCK case when really it is needed in all cases.

Reminded by:	jhb
2004-02-02 09:50:43 +00:00
Mike Silbersack 02ec600572 Remove debugging code that slipped into the previous commit.
Spotted by:	bde
2004-02-02 09:09:59 +00:00
Jeff Roberson b209e5e3e4 - style fixes to the critical_exit() KASSERT().
Submitted by:	bde
2004-02-02 08:13:27 +00:00
Jeff Roberson 7b09539ce2 - Use a seperate startup function for the zeroidle kthread. Use this to
set P_NOLOAD prior to running the thread.
2004-02-02 07:51:03 +00:00
Peter Grehan aa1985722c Add new Apple GEM PCI id. 2004-02-02 01:11:39 +00:00
David E. O'Brien 02c4c7b81f Remove a device that will compile fine, isn't 64-bit clean. 2004-02-02 00:54:59 +00:00
Robert Watson 91c2dc9478 Commit file missed in last pass: MAC api uses 'struct pipepair', not
'struct pipe' now.
2004-02-01 21:52:09 +00:00
Bill Paul f0aed0dbd0 Use the OID_802_11_CONFIGURATION OID when deciding if the underlying driver
is for an 802.11 device or not. At least one driver I have does not
support the OID_802_11_NETWORK_TYPES_SUPPORTED OID.

Also, for now, don't do anything special in the ndis_suspend() method.
I originally wanted to shut down the NIC but leave the IFF_UP flag alone
since technically the interface is meant to remain up, but an interrupt
may be delivered to the ISR on suspend, and if this happens while the
NIC is halted, we will crash, since none of the miniport driver methods
will function.

This needs to be dealt with properly later, but for now this prevents
a panic, and the resume method properly re-inits the NIC.
2004-02-01 21:35:15 +00:00
Alan Cox 8600a4122a Eliminate all TLB shootdowns by pmap_pte_quick(): By temporarily pinning
the thread that calls pmap_pte_quick() and by virtue of the page queues
lock being held, we can manage PADDR1/PMAP1 as a CPU private mapping.

The most common effect of this change is to reduce the overhead of the page
daemon on multiprocessors.

In collaboration with:  tegge
2004-02-01 20:14:00 +00:00
Jeff Roberson 0392e39dff - Allow interactive tasks to use the maximum time-slice. This is not as
detrimental as I thought it would be in the case of massive process
   storms from a shell and it makes regular desktop usage noticeably
   better.
2004-02-01 10:38:13 +00:00