Commit graph

66026 commits

Author SHA1 Message Date
John Baldwin 304a4c6fb1 - Retire npe_defrag(), gem_defrag(), msk_defrag(), nfe_defrag(), and
re_defrag() and use m_collapse() instead.
- Replace a reference to ath_defrag() in a comment in if_wpi.c with
  m_collapse().
2008-01-17 23:37:47 +00:00
John Baldwin 2c17901060 Add 'compat_freebsd[4567]' features corresponding to the kernel options
COMPAT_FREEBSD[4567].

MFC after:	1 week
Requested by:	kris
2008-01-17 22:46:32 +00:00
Kip Macy 8ec3680eb5 - remove bogus_imm counter
- disable pcpu cluster cache by default until reference counting is handled
  correctly for held clusters - can be re-enable by sysctl
2008-01-17 21:25:58 +00:00
Sam Leffler eeb76a1889 promote ath_defrag to m_collapse (and retire private+unused
m_collapse from cxgb)

Reviewed by:	pyun, jhb, kmacy
MFC after:	2 weeks
2008-01-17 21:25:09 +00:00
John Baldwin cff3c4fdc5 Remove a conditional that is always true.
MFC after:	2 weeks
2008-01-17 20:15:15 +00:00
John Baldwin 9a57f6280c Use pause(9) instead of a tsleep() on a stack variable.
MFC after:	1 week
2008-01-17 20:11:58 +00:00
John Baldwin c05655bfda Use cpu_spinwait() (i.e., "pause") when spinning on rdtsc during DELAY().
MFC after:	1 week
2008-01-17 18:59:38 +00:00
Alan Cox 6634dbbde4 Retire PMAP_DIAGNOSTIC. Any useful diagnostics that were conditionally
compiled under PMAP_DIAGNOSTIC are now KASSERT()s.  (Note: The kernel
option DIAGNOSTIC still disables inlining of certain pmap functions.)

Eliminate dead code from pmap_enter().  This code implemented an assertion.
On i386, an equivalent check is already implemented.  However, on amd64,
a small change is required to implement an equivalent check.

Eliminate \n from a nearby panic string.

Use KASSERT() to reimplement pmap_copy()'s two assertions.
2008-01-17 18:25:52 +00:00
Bruce Evans a4b679d859 Translate from the i386. All FP constants and operations are evaluated
in the range and precision of their type(s) on amd64, but FLT_EVAL_METHOD
said that they were evalated in the "interesting" (buggy) i387 methods.
float_t was broken compatibly with FLT_EVAL_METHOD.

These definitions seem to be broken on powerpc and possibly on arm.
float_t is float on powerpc with gcc [-notraditional] according to
glibc, and FLT_EVAL_METHOD is marked with XXX on arm.
2008-01-17 13:12:46 +00:00
Olivier Houchard 10457dbaf2 Unbreak build by adding the missing parameter to pmap_enter(). 2008-01-17 12:41:59 +00:00
Andrew Thompson eaf56834f1 Sync from OpenBSD r1.118, nuke clause 3 & 4. 2008-01-17 09:46:16 +00:00
Kip Macy 4f6a96ae5b Fix lock ordering panic by not calling ether_ioctl with port lock held
Reported by: rrs
2008-01-16 21:33:34 +00:00
John Baldwin f831d6e073 Add a header containing constants for the various HPET registers and their
fields and update the code to match.  The PR served more as an inspiration
than providing the actual diffs.

MFC after:	1 week
PR:		kern/112544
2008-01-16 18:47:07 +00:00
John Baldwin 8ffbe1559e Add a set of regression tests for the POSIX shm API (shm_open(2) and
shm_unlink(2)).
2008-01-16 15:51:24 +00:00
Remko Lodder 149e9017bd Dont accidentally remove a filesocket which is still in use. This gives
problems when the DRM driver is loaded and the AIXGL extension is loaded
, the AIXGL driver requests a drm_close and this will cause the radeon
driver to fail while starting X windows.

PR:		kern/114688
Submitted by:	vehemens <vehemens at verizon dot net>
Prodded by:	Robert Noland
Approved by:	imp (mentor, a while ago already), anholt
MFC After:	1 week
2008-01-16 13:54:40 +00:00
Giorgos Keramidas 82d16f31df Bump manpage date for rev 1.27
MFC after:	3 days
2008-01-16 07:00:55 +00:00
Giorgos Keramidas b8b4c607d8 Document that loader(8) stops reading `loader.conf' when it
encounters a syntax error, and add a tip about adding first
the `vital' options and then experimental ones.

PR:		docs/119658
Submitted by:	Julian Stacey, jhs at berklix.org
2008-01-16 06:59:22 +00:00
Kip Macy 8030c630da remove superfluous debug printfs 2008-01-16 02:39:33 +00:00
Nate Lawson e1f13773ec Remove duplicate cpufreq levels, i.e. ones that are within 25 Mhz of each
other.  The first one survives, the rest are removed.  So far, it appears
only some acpi_perf(4) BIOS tables have these invalid states, but address
this in the core to be sure to handle other potential driver data.

PR:		kern/114722
Tested by:	stefan.lambrev / moneybookers.com
MFC after:	3 days
2008-01-16 01:05:21 +00:00
Kip Macy c833fdd83f Fix mbuf leak caused by freeing packet zone clusters but not their associated mbufs
- Track packet zone mbufs separately from other mbufs
- free packet zone buffers via m_free rather than trying to manage the refcount
  as with clusters - its refcount and management seems to be "special"
2008-01-16 00:28:30 +00:00
Kip Macy 2fd79ec2de put tx queue size back to 1024 2008-01-16 00:26:04 +00:00
John Baldwin 16670d1bd1 Use '%zd' to print PIO_LEN since it involves a size_t (via sizeof()) to
appease the tinderbox on 32-bit platforms.

Tested on:	amd64, i386
2008-01-15 22:01:26 +00:00
John Baldwin 0678f786c4 Don't cache the new-bus name of a PCI device in the PCI conf structure,
but reread it from the device_t every time the device list is fetched.
Previously the device name in pciconf -l would not be updated when a driver
was unloaded or if a device was detached and attached to a different
driver.

MFC after:	1 week
PR:		kern/104777
Submitted by:	"Iasen Kostoff"  tbyte | otel net
2008-01-15 21:40:46 +00:00
Andrew Gallatin 1e413cf932 Add optional support to mxge for MSI-X interrupts and multiple receive
queues (which we call slices).  The NIC will steer traffic into up to
hw.mxge.max_slices different receive rings based on a configurable
hash type (hw.mxge.rss_hash_type).

Currently the driver defaults to using a single slice, so the default
behavior is unchanged.  Also, transmit from non-zero slices is
disabled currently.
2008-01-15 20:34:49 +00:00
Maxim Sobolev 9e2211fd05 Hide common prints under bootverbose.
Obtained from:	src/sys/dev/rr232x/osm_bsd.c, rev.1.2-1.3
MFC after:	2 weeks
2008-01-15 19:21:08 +00:00
John Baldwin 572f347d9f Fix a few minor issues based on a bug report and reading over the HPET
spec:
- Use read/modify/write cycles to enable and disable the HPET instead of
  writing 0 to reserved bits.
- Shutdown the HPET during suspend as encouraged by the spec.
- Fail to attach to an HPET with a period of zero.

MFC after:	1 week
PR:		kern/119675 [3]
Reported by:	Leo Bicknell | bicknell ufp.org
2008-01-15 18:50:47 +00:00
Maxim Sobolev dd8c2454a8 Make test00 compilable again. 2008-01-15 18:34:47 +00:00
Andrew Gallatin 93143d572a Fix accidental swap of "const" for "static" in mxge firmware byte arrays
caused by running my import script with the wrong args.
2008-01-15 15:04:40 +00:00
Andrew Gallatin 7e8305464a Update to firmware version 1.4.29 from 1.4.25. Relevant changes include:
- Fix a bug introduced in 1.4.20 where speculative read by the processor in the
   write-only doorbell region would cause a target-abort (as opposed to simply
   returning random data). This could manifest itself as NMI or machine freeze
   depending on how the BIOS/OS/chipset configuration handles target-abort.

- Add support for new revisions of -R cards (with AEL1002/AEL1010 xaui->xfi)

- Increase an internal timing (dispatch engine): fix possible spurious reset
  (seen on very few cards).
2008-01-15 13:29:32 +00:00
Jeff Roberson a755f21484 - When executing the 'tryself' branch in sched_pickcpu() look at the
lowest priority on the queue for the current cpu vs curthread's
   priority.  In the case that curthread is waking up many threads of a
   lower priority as would happen with a turnstile_broadcast() or wakeup()
   of many threads this prevents them from all ending up on the current cpu.
 - In sched_add() make the relationship between a scheduled ithread and
   the current cpu advisory rather than strict.  Only give the ithread
   affinity for the current cpu if it's actually being scheduled from
   a hardware interrupt.  This prevents it from migrating when it simply
   blocks on a lock.

Sponsored by:	Nokia
2008-01-15 09:03:09 +00:00
Kip Macy 139edb19d9 - Simplify mb_free_ext_fast
- increase asserts for mbuf accounting
- track outstanding mbufs (maps very closely to leaked)
- actually only create one thread per port if !multiq
    Oddly enough this fixes the use after free

- move txq_segs to stack in t3_encap
- add checks that pidx doesn't move pass cidx
- simplify mbuf free logic in collapse mbufs routine
2008-01-15 08:08:09 +00:00
Pyun YongHyeon 1083833205 Protect arg in macro M_ASSERTPKTHDR. 2008-01-15 04:00:12 +00:00
Pyun YongHyeon 738489d1c1 Fix build. 2008-01-15 03:47:24 +00:00
Kip Macy 60f1e27625 - move WR_LEN in to cxgb_adapter.h add PIO_LEN to make intent clearer
- move cxgb_tx_common in to cxgb_multiq.c and rename to cxgb_tx
- move cxgb_tx_common dependencies
- further simplify cxgb_dequeue_packet for the non-multiqueue case
- only launch one service thread per port in the non-multiq case
- remove dead cleaning code from cxgb_sge.c
- simplify PIO case substantially in by returning directly from mbuf collapse
  and just using m_copydata
- remove gratuitous m_gethdr in the rx path
- clarify freeing of mbufs in collapse
2008-01-15 03:27:42 +00:00
Kip Macy 74aba11713 remove superfluous locking from dequeue 2008-01-15 03:21:02 +00:00
Pyun YongHyeon d65abd6663 Overhaul re(4).
o Increased number of Rx/Tx descriptors to 256 for 8169 GigEs
  because it's hard to push the hardware to the limit with default
  64 descriptors.
  TSO requires large number of Tx descriptors to pass a full sized
  TCP segment(65535 bytes IP packet) to hardware. Previously it
  consumed 32 Tx descriptors, assuming MCLBYTES DMA segment size,
  to send the TCP segment which means re(4) couldn't queue more
  than two full sized IP packets.
  For 8139C+ it still uses 64 Rx/Tx descriptors due to its hardware
  limitations. With this changes there are (very) small waste of
  memory for 8139C+ users but I don't think it would affect 8139C+
  users for most cases.
o Various bus_dma(9) fixes.
   - The hardware supports DAC so allow 64bit DMA operations.
   - Removed BUS_DMA_ALLOC_NOW flag.
   - Increased DMA segment size to 4096 from MCLBYTES because TSO
     consumes too many descriptors with MCLBYTES DMA segment size.
   - Tx/Rx side bus_dmamap_load_mbuf_sg(9) support. With these
     changes the code is more readable than previous one and got a
     (slightly) better performance as it doesn't need to pass/
     decode arguments to/from callback function.
   - Removed unnecessary callback function re_dmamap_desc() and
     nuked rl_dmaload_arg structure which was used in the callback.
   - Additional protection for DMA map load failure. In case of
     failure reuse current map instead of returning a bogus DMA
     map.
  -  Deferred DMA map unloading/sync operation for maximum
     performance until we really need to load new DMA map. If we
     happen to reuse current map(e.g. input error) there is no need
     to sync/unload/load again.
  -  The number of allowable Tx DMA segments for a mbuf chains are
     now 32 instead of magic nseg value. If the number of available
     Tx descriptors are short enough to send highly fragmented mbuf
     chains an optimized re_defrag() is called to collapse mbuf
     chains which is supposed to be much faster than m_defrag(9).
     re_defrag() was borrowed from ath(4).
   - Separated Rx/Tx DMA tag from a common DMA tag such that Rx DMA
     tag correctly uses DMA maps that were created with DMA alignment
     restriction(8bytes alignments). Tx DMA tag does not have such
     alignment limitation.
   - Added additional sanity checks for DMA ring map load failure.
   - Added additional spare Rx DMA map for graceful handling of Rx
     DMA map load failure.
   - Fixed misused bus_dmamap_sync(9) and added missing
     bus_dmamap_sync(9) in re_encap()/re_txeof()/re_rxeof().
o Enabled TSO again as re(4) have reasonable number of Tx
  descriptors.
o Don't touch DMA address of a Tx descriptor in re_txeof(). It's
  not needed.
o Fix incorrect update of if_ierrors counter. For Rx buffer
  shortage it should update if_qdrops as the buffer is reused.
o Added checks for unsupported H/W revisions and return ENXIO for
  these hardwares. This is required to remove resource allocation
  code in re_probe as other drivers do in device probe routine.
o Modified descriptor index manipulation macros as it's now possible
  to have different number of descriptors for Rx/Tx.
o In re_start, to save a lock operation, use IFQ_DRV_IS_EMPTY before
  trying to invoke IFQ_DRV_DEQUEUE. Also don't blindly call re_encap
  since we already know the number of available Tx descriptors in
  advance.
o Removed RL_TX_DESC_THLD which was used to reserve RL_TX_DESC_THLD
  descriptors in Tx path. There is no such a limitation mentioned in
  8139C+/8169/8110/8168/8101/8111 datasheet and it seems to work ok
  without reserving RL_TX_DESC_THLD descriptors.
o Fix a comment for RL_GTXSTART. The register is 8bits register.
o Added comments for 8169/8139C+ hardware restrictions on descriptors.
o Removed forward declaration for "struct rl_softc", it's not needed.
o Added a new structure rl_txdesc for Tx descriptor managements and
  a structure rl_rxdesc for Rx descriptor managements.
o Removed unused member variable rl_intlock in driver softc. There are
  still several unused member variables which are supposed to be used
  to access hardware statistics counters. But it seems that accessing
  hardware counters were not implemented yet.
2008-01-15 01:10:31 +00:00
Peter Wemm 2577760fca Update the KVA_PAGES comments for the effect that PAE has on it. It
becomes a unit size of 2MB instead of 4MB and must be a multiple of 8 to
get a valid KERNBASE.
2008-01-14 22:53:01 +00:00
Peter Wemm a658a1e0a5 Add a CTASSERT that KERNBASE is valid. This is usually messed up by an
invalid KVA_PAGES, so add a pointer to there.
2008-01-14 22:51:43 +00:00
Alan Cox dd9d15f294 Make pmap_is_prefaultable() more TLB friendly. Specifically, make it use
the kernel's direct map instead of the pmap's recursive mapping to access
the lowest level in the page table.  The direct map is preferable for two
reasons: (1) The TLB is more likely to hold the required direct mapping
because pmap_enter() has already used the direct map to access a nearby
PTE and (2) loading a direct mapping into the TLB involves walking only 2
or 3 levels of the page table instead of 4.
2008-01-14 21:25:06 +00:00
Kip Macy 8b7399ad30 - Assert that immpkt is not set
- convert %lx to 32-bit safe %jx
2008-01-14 07:55:56 +00:00
Pyun YongHyeon 346de09f2a Implement WOL capability.
- Turn on WOL bits in suspend/shutdown method.
 - WOL is disabled in resume routine as WOL can interfere normal
   Rx operation.
 - Move stge_reset() to stge_init_locked() as resetting hardware
   clears configured Rx information which in turn results in
   non-working Rx module after suspend/shutdown operation.
2008-01-14 07:16:48 +00:00
Joseph Koshy 6180b9de75 Increment major version to mark the ABI change between RELENG_7 and -HEAD. 2008-01-14 06:33:41 +00:00
Kip Macy efe7dfb26c - Add more extensive sanity checks
- remove initial dequeue from cxgb_start as it was causing an mbuf to be referenced twice
2008-01-14 06:00:41 +00:00
Kip Macy 9346e5197a Make back pressure visible more quickly, particularly now that we maintain a queue internally 2008-01-14 05:59:06 +00:00
Kip Macy 6481d641b5 Add extensive sanity checking to buf_ring 2008-01-14 05:56:03 +00:00
Kip Macy 20532d115c Add cxgb_multiq.c to the cxgb build for static linking 2008-01-14 00:59:33 +00:00
Kip Macy 5ef02c0223 Convert over to using the multiqueue infrastructure although all calls going
through cxgb_start still end up using queue 0
2008-01-13 22:38:17 +00:00
Kip Macy 0d57d78ca0 Add buf_ring_full utility function, make sure dequeue/enqueue see the latest
indexes
2008-01-13 22:37:09 +00:00
Kip Macy 1f36fc8a84 remove unused code 2008-01-13 22:35:12 +00:00
Kip Macy 9b063e763d style nit 2008-01-13 22:33:49 +00:00
Kip Macy 9c76da338c add cxgb_multiq.c to the build 2008-01-13 22:31:59 +00:00
Attilio Rao e71c446a86 Version bumping in order to reflect VOP_LOCK1(), VOP_UNLOCK() KPI
changing.
2008-01-13 14:48:51 +00:00
Attilio Rao 22db15c06f VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used in
conjuction with 'thread' argument passing which is always curthread.
Remove the unuseful extra-argument and pass explicitly curthread to lower
layer functions, when necessary.

KPI results broken by this change, which should affect several ports, so
version bumping and manpage update will be further committed.

Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
2008-01-13 14:44:15 +00:00
Nate Lawson 814cc347e1 This commit was generated by cvs2svn to compensate for changes in r175256,
which included commits to RCS files with non-trunk default branches.
2008-01-12 22:13:12 +00:00
Nate Lawson 4c12fb6750 Fix GPE livelock that occurs on HP/Compaq laptops, mostly in the thermal
zone code.  The GPE handler method (i.e. _L00) generates various Notify
events that need to be run to completion before the GPE is re-enabled.
In ACPI-CA, we queue an asynch callback at the same priority as a Notify
so that it will only run after all Notify handlers have completed.  The
callback re-enables the GPE afterwards.  We also changed the priority of
Notifies to be the same as GPEs, given the possibility that another GPE
could arrive before the Notifies have completed and we don't want it to
get queued ahead of the rest.

The ACPI-CA change was submitted by Alexey Starikovskiy (SUSE) and will
appear in a later release.  Special thanks to him for helping track this
bug down.

MFC after:	1 week
Tested by:	jhb, Yousif Hassan <yousif / alumni.jmu.edu>
2008-01-12 22:13:12 +00:00
Nate Lawson 265ed03ff5 Fix GPE livelock that occurs on HP/Compaq laptops, mostly in the thermal
zone code.  The GPE handler method (i.e. _L00) generates various Notify
events that need to be run to completion before the GPE is re-enabled.
In ACPI-CA, we queue an asynch callback at the same priority as a Notify
so that it will only run after all Notify handlers have completed.  The
callback re-enables the GPE afterwards.  We also changed the priority of
Notifies to be the same as GPEs, given the possibility that another GPE
could arrive before the Notifies have completed and we don't want it to
get queued ahead of the rest.

The ACPI-CA change was submitted by Alexey Starikovskiy (SUSE) and will
appear in a later release.  Special thanks to him for helping track this
bug down.

MFC after:	1 week
Tested by:	jhb, Yousif Hassan <yousif / alumni.jmu.edu>
2008-01-12 22:13:12 +00:00
Olivier Houchard 253d846886 Back when I committed the arm port, I've been asked to move
memcpy/memset/memcmp and friends from libkern/arm to arm/arm/support.S, and so
I did, but in the process, I didn't add the appropriate copyrights.
This is a major oversight from me, and I apology to the NetBSD people for it.

MFC After:	1 day
2008-01-12 21:11:43 +00:00
Kip Macy 9b74c87f1f MFp4 multiple queue support 2008-01-12 20:34:56 +00:00
Maxim Konovalov d5b851f626 o Correct EasyMP3 EM732X usb 2.0 flash mp3 player revision:
it's 1.00 not 1.0.

PR:		usb/96546
Submitted by:	Eugene Grosbein
MFC after:	1 month
2008-01-12 19:24:55 +00:00
Maxim Konovalov f6a60feb6c o Add Moxa Technologies CP-104EL PCI Express 4 port Serial card.
PR:		kern/119515
Submitted by:	Gavin Stone-Tolcher
MFC after:	1 month
2008-01-12 19:14:29 +00:00
John Baldwin b3c56ffc39 The previous revision broke the case of reconnecting to a TCP NFS server
via a new socket during an NFS operation as that reconnect takes place in
the context of an arbitrary thread with an arbitrary credential.  Ideally
we would like to use the mount point's credential for the entire process
of setting up the socket to connect to the NFS server.  Since some of the
APIs (sobind(), etc.) only take a thread pointer and infer the credential
from that instead of a direct credential, work around the problem by
temporarily changing the current thread's credential to that of the mount
point while connecting the socket and then reverting back to the original
credential when we are done.

Reviewed by:	rwatson
Tested on:	UDP, TCP, TCP with forced reconnect
2008-01-11 23:57:39 +00:00
Bruce Evans 0209f729a1 MFamd64 (everything possible up to 1.19; mainly the amd64 implementations
of fpget*() and fpset*()).

The i386 fpget*() were efficient but a bit obfuscated (using macros
and a case statement to demultiplex them through a single inline).
The demultiplexing mainly gave smaller source code.

The i386 fpset*() were obfuscated in the same way and were very
inefficient due to the case statement not having enough cases or
complexity so all cases used the FP environment.

This also fixes a harmless bug in rev.1.12.  fpsetmask() extracted the
old value from the bit-field twice, but the doubled shift was harmless
since the shift count is 0.

All fp*() interfaces are now inline functions on i386.  They used to
be macros that call (a different set of) inline functions.  This is a
small ABI change which shouldn't cause problems since cases where
inlining fails (mainly -O0) only give (working) static functions.
2008-01-11 18:59:35 +00:00
Bruce Evans f107f876a6 Separate fpresetsticky() from the other fpset functions so that the
others can be replaced cleanly by the amd64 versions.   There is no
current amd64 version to merge, but there is an old one which is
similar.

Fix the following bugs in fpresetsticky():
- garbage args clobbered non-sticky bits in the status register
- the return value was usually garbage since it was masked with the
  arg instead of with the field selector.

Optimize fpresetsticky() to avoid using the environment as in
feclearexcept() (use only fnclex() if possible) and also to avoid
using fnclex() for null changes.  The second of these optimizations
might not be so good since its branch might cost more than it saves.
2008-01-11 18:27:01 +00:00
Bruce Evans 98a80542e7 MFamd64 1.15-1.18 (cosmetic changes, mainly to comments). The inline
functions haven't been cleaned up here because the amd64 cleanups
don't apply directly and the functions here will be merged or rewritten
later.
2008-01-11 17:54:20 +00:00
Bruce Evans 31e30d75d5 Fix fpset*() to not trap if there is a currently unmasked exception.
Unmasked exceptions (which can be fixed up using fpset*() before they
trap) are very rare, especially on amd64 since SSE exceptions trap
synchronously, but I want to merge the faster amd64 implementations of
fpset*() back to i386 without introducing the bug on i386.

The i386 implementation has always avoided the trap automatically by
changing things using load/store of the FP environment, but this is
very slow.  Most changes only affect the control word, so they can
usually be done much more efficiently, and amd64 has always done this,
but loading the control word can trap.

This version use the fast method only in the usual case where it will
not trap.  This only costs a couple of integer instructions (including
one branch which I haven't optimized carefully yet) in the usual case,
but bloats the inlines a lot.  The inlines were already a bit too large
to handle both the FPU and SSE.
2008-01-11 17:11:32 +00:00
Konstantin Belousov 89a828fde9 The wakeup() line from the rev. 1.319 is wrong and reintroduces
a panic race on module unload. The wakeup() is internal to
kproc_exit/kthread_exit. The correct fix is to fix the msleep() in
detach to sleep on fdc->fdc_thread instead of &fdc->fdc_thread.

Noted and reviewed by:	jhb
Pointy hat to:	kib
MFC after:	1 week
2008-01-11 16:50:52 +00:00
Attilio Rao d1127e669c lockmgr() function will return successfully when trying to work under
panic but it won't actually lock anything.
This can lead some paths to reach lockmgr_disown() with inconsistent
lock which will let trigger the relative assertions.

Fix those in order to recognize panic situation and to not trigger.

Reported by: pho
Submitted by: kib
2008-01-11 16:38:12 +00:00
Bruce Evans 548868b38d Fix some style bugs:
- fix a previous style fix: shifts should be in the correct direction even
  if they are null.
- restore a comment about namespace pollution from floatingpoint.h 1.12 and
  update it.
- remove unused namespace pollution FP_*REG.
- improve some comments.
- sort macro definitions for entry points.
- don't use underscores for macro args.
2008-01-11 14:11:46 +00:00
Konstantin Belousov fc9f8bcf4f Fix unload of the fdc.ko:
Wakeup the thread doing the fdc_detach() when the fdc worker thread exits [1].
Write access to the write-protected floppy shall call device_unbusy() to
pair the device_busy() in the fd_access() [2].

PR:	116537 [1], 116539 [2]
MFC after:	1 week
2008-01-11 11:53:04 +00:00
Kip Macy 9330dbc3a1 Be more aggressive about tx cleaning - when multiples streams were running the tx
queue could fill up and stop getting cleaned.
2008-01-11 02:26:54 +00:00
Kip Macy 9cce003858 If we're not running with multiqueue enabled we need to wait to acquire the
rspq lock. Not doing so was causing us to skip re-enabling the interrupt.

- remove duplicate credits sysctl
- add support for dumping hardware context of the txq
- decrement budget_left when we break out of the process_responses loop
2008-01-10 23:51:34 +00:00
John Baldwin 618f2b4d55 Work around problems with the ppbus(4)'s interesting way of managing
interrupt handlers for child devices by adding a dummy handler that is
always present so that the underlying interrupt thread is always around
avoiding panics from stray interrupts.

MFC after:	3 days
2008-01-10 23:43:47 +00:00
John Baldwin 0ca54a0fc8 Pass curthread to various socket routines (socreate(), sobind(), and
soconnect()) instead of &thread0 when establishing a connection to the NFS
server.  Otherwise inconsistent credentials may be used when setting up
the NFS socket.

MFC after:	1 week
Reviewed by:	rwatson
2008-01-10 23:36:00 +00:00
Robert Watson d92909c1d4 Don't zero td_runtime when billing thread CPU usage to the process;
maintain a separate td_incruntime to hold unbilled CPU usage for
the thread that has the previous properties of td_runtime.

When thread information is requested using the thread monitoring
sysctls, export thread td_runtime instead of process rusage runtime
in kinfo_proc.

This restores the display of individual ithread and other kernel
thread CPU usage since inception in ps -H and top -SH, as well for
libthr user threads, valuable debugging information lost with the
move to try kthreads since they are no longer independent processes.

There is universal agreement that we should rewrite the process and
thread export sysctls, but this commit gets things going a bit
better in the mean time.  Likewise, there are resevations about the
continued validity of statclock given the speed of modern processors.

Reviewed by:		attilio, emaste, jhb, julian
2008-01-10 22:11:20 +00:00
Rui Paulo ab0b125777 Disable the check for errata AE18. On MacBooks (1,1 version) there's
no problem with coretemp and C3 state.

Approved by:	njl (mentor)
2008-01-10 16:09:22 +00:00
Robert Watson 8a69e5fa71 Remove "lock pushdown" todo item in comment -- I did that for 7.0.
MFC after:	3 weeks
2008-01-10 12:38:17 +00:00
Robert Watson a635784569 Correct typos in comments.
MFC after:	3 weeks
2008-01-10 12:29:12 +00:00
Pawel Jakub Dawidek 79c2840d1d When one tries to allocate memory with the M_WAITOK flag and we are short in
address space in kmem map call vm_lowmem event in a loop and wait a bit for
subsystems to reclaim some memory which in turn will reclaim address space as
well.

Note, this is a work-around.

Reviewed by:	alc
Approved by:	alc
MFC after:	3 days
2008-01-10 08:36:38 +00:00
Kip Macy 10b16b260c Add support for selectively dumping the state of the hardware response queue.
Change ordering of a couple of types.
2008-01-10 06:54:20 +00:00
Kip Macy 4fa42a6fa6 should always free when refcount is 1 2008-01-10 06:52:48 +00:00
Attilio Rao f0d37ed206 Bump FreeBSD_version in order to reflect vn_lock() prototype changes. 2008-01-10 01:25:23 +00:00
Attilio Rao cb05b60a89 vn_lock() is currently only used with the 'curthread' passed as argument.
Remove this argument and pass curthread directly to underlying
VOP_LOCK1() VFS method. This modify makes the code cleaner and in
particular remove an annoying dependence helping next lockmgr() cleanup.
KPI results, obviously, changed.

Manpage and FreeBSD_version will be updated through further commits.

As a side note, would be valuable to say that next commits will address
a similar cleanup about VFS methods, in particular vop_lock1 and
vop_unlock.

Tested by:	Diego Sardina <siarodx at gmail dot com>,
		Andrea Di Pasquale <whyx dot it at gmail dot com>
2008-01-10 01:10:58 +00:00
Kip Macy f001b63dcb - make 9k clusters the default unless a tunable is set
- return the error from cxgb_tx_common so that when an error is hit we dont
  spin forever in the taskq thread
- remove unused rxsd_ref
- simplify header_offset calculation for embedded mbuf headers
- fix memory leak by making sure that mbuf header initialization took place
- disable printf's for stalled queue, don't do offload/ctrl queue restart
  when tunnel queue is restarted
- add more diagnostic information about the txq state
- add facility to dump the actual contents of the hardware queue using sysctl
2008-01-10 00:55:42 +00:00
Robert Watson 9b0fce602a Refine textdump comments slightly.
MFC after:	3 months
2008-01-10 00:26:47 +00:00
Scott Long 15d0222f66 Fix a buffer overflow in the processing of various SCSI commands. This likely
fixes a an great number of weird problems that have been reported with this
driver.

PR: 119114
Submitted by: Jens Rehsack
2008-01-09 20:02:56 +00:00
Bruce Evans 0714d1a223 Simplify the ifdefs:
- fix this to compile with C++ by casting ints to enums in a few places
  and by using the correct parameter type for _fpsetprec().  Remove
  __cplusplus ifdefs which disabled the buggy code.
- remove __CC_SUPPORTS___INLINE ifdefs.  `__inline' vs `inline', and either
  of these #defined away, are supposed to be handled by very old ifdefs
  in <sys/cdefs.h>.  Thus the __CC_SUPPORTS___INLINE macro is not needed
  here (or anywhere else that it used).  It is less needed here than in
  most places, since this file is userland-only and userland is far from
  supporting INTEL_COMPILER.  The __CC_SUPPORTS___INLINE__ macro which
  was used here is even less needed.  It is to support spelling `inline'
  as `__inline__' instead of the usual spelling `__inline'.

Fix some style bugs that I missed in the previous commit (remove unused
asms and sort more variables).
2008-01-09 15:03:03 +00:00
Bruce Evans a2de358449 Fix some style bugs (mainly, use explicit shifts when accessing bit-fields
even if the shift count happens to be 0, sort declarations, and spell
__inline normally).
2008-01-09 13:35:31 +00:00
Bruce Evans fe26672a8f Improve some comments. 2008-01-09 10:42:47 +00:00
Kip Macy 8d5754afc5 make nqsets a uint32_t so that sysctl will work
add 2 fields for allowing queue dumping
2008-01-09 08:12:24 +00:00
Kip Macy b3fa5e2f65 don't decrement ref count below 1 for EXT_PACKET 2008-01-09 08:01:42 +00:00
Kip Macy 5f78571d1c EXT_PACKET is one of the valid mbuf types 2008-01-09 08:01:08 +00:00
Kip Macy f8c9ad8f51 Fix KASSERT in m_free_fast - the LIST_EMPTY check only applies to packet headers.
In the non packet header case there may be data there.
2008-01-09 06:29:49 +00:00
Attilio Rao 80127e4d01 Bump FreeBSD_version in order to reflect lockmgr_disown() function
introduction.
2008-01-09 00:03:50 +00:00
Attilio Rao 6edbb3ee9e Fix a last second typo about recent lockmgr_disown() introduction. 2008-01-09 00:02:43 +00:00
Attilio Rao d7a7e17968 Remove explicit calling of lockmgr() with the NULL argument.
Now, lockmgr() function can only be called passing curthread and the
KASSERT() is upgraded according with this.

In order to support on-the-fly owner switching, the new function
lockmgr_disown() has been introduced and gets used in BUF_KERNPROC().
KPI, so, results changed and FreeBSD version will be bumped soon.
Differently from previous code, we assume idle thread cannot try to
acquire the lockmgr as it cannot sleep, so loose the relative check[1]
in BUF_KERNPROC().

Tested by: kris

[1] kib asked for a KASSERT in the lockmgr_disown() about this
condition, but after thinking at it, as this is a well known general
rule, I found it not really necessary.
2008-01-08 23:48:31 +00:00
John Baldwin 4ad6d200d6 Regen for shm_open(2) and shm_unlink(2). 2008-01-08 22:01:26 +00:00
John Baldwin 8e38aeff17 Add a new file descriptor type for IPC shared memory objects and use it to
implement shm_open(2) and shm_unlink(2) in the kernel:
- Each shared memory file descriptor is associated with a swap-backed vm
  object which provides the backing store.  Each descriptor starts off with
  a size of zero, but the size can be altered via ftruncate(2).  The shared
  memory file descriptors also support fstat(2).  read(2), write(2),
  ioctl(2), select(2), poll(2), and kevent(2) are not supported on shared
  memory file descriptors.
- shm_open(2) and shm_unlink(2) are now implemented as system calls that
  manage shared memory file descriptors.  The virtual namespace that maps
  pathnames to shared memory file descriptors is implemented as a hash
  table where the hash key is generated via the 32-bit Fowler/Noll/Vo hash
  of the pathname.
- As an extension, the constant 'SHM_ANON' may be specified in place of the
  path argument to shm_open(2).  In this case, an unnamed shared memory
  file descriptor will be created similar to the IPC_PRIVATE key for
  shmget(2).  Note that the shared memory object can still be shared among
  processes by sharing the file descriptor via fork(2) or sendmsg(2), but
  it is unnamed.  This effectively serves to implement the getmemfd() idea
  bandied about the lists several times over the years.
- The backing store for shared memory file descriptors are garbage
  collected when they are not referenced by any open file descriptors or
  the shm_open(2) virtual namespace.

Submitted by:	dillon, peter (previous versions)
Submitted by:	rwatson (I based this on his version)
Reviewed by:	alc (suggested converting getmemfd() to shm_open())
2008-01-08 21:58:16 +00:00
David E. O'Brien 9233d8f3ad un-__P() 2008-01-08 19:08:58 +00:00
Christian S.J. Peron 35918c55e5 When MAC is enabled in the kernel, fix a panic triggered by a locking
assertion hit in swapoff_one() when we un-mount a swap partition.  We
should be using curthread where we used thread0 before.  This change
also replaces the thread argument with a credential argument, as the
MAC framework only requires the cred.

It should be noted that this allows the machine to be rebooted without
panicing with "cannot differ from curthread or NULL" when MAC is enabled.

Submitted by:	rwatson
Reviewed by:	attilio
MFC after:	2 weeks
2008-01-08 14:58:41 +00:00
Alan Cox fa093ee242 Convert a PMAP_DIAGNOSTIC to a KASSERT. 2008-01-08 08:30:30 +00:00