Commit Graph

68722 Commits

Author SHA1 Message Date
Weongyo Jeong
e6be242b0a clear pending callbacks when the driver try to change the state
Pointed by:	sam
2008-09-19 05:10:33 +00:00
Warner Losh
5d99d99ff4 MFp4: Merge interrupt code from p4
Submitted by:	gonzo@
2008-09-19 04:16:13 +00:00
Warner Losh
3fbac48f38 MFp4: Update the interrupt code from perforce.
Submitted by:	gonzo@
2008-09-19 04:10:09 +00:00
Warner Losh
7c626c0c38 Merge from p4: add bpf 2008-09-19 03:47:29 +00:00
Warner Losh
1ca5d948a3 Merge from p4: add Juniper license statement. 2008-09-19 03:36:37 +00:00
Alan Cox
2af89e55cc MFamd64 SVN rev 179471 CVS rev 1.619
Correct an error in pmap_promote_pde() that may result in an errant
  promotion within the kernel's address space.
2008-09-19 03:33:49 +00:00
Maxim Sobolev
ccb33393cc When attaching framebuffer to "/chosen/stdout" node fails, try attaching
to "screen" node directly. The problem is that by default OF on some (all?)
Macs either doesn't provide "/chosen/stdout" or redirects it somewhere,
unless you boot in manual mode via CMD-ALT-O-F. It's nice to see normal
FreeBSD boot output instead of blank gray screen.
2008-09-19 03:22:47 +00:00
Kip Macy
7c2bd2b9e2 Fix two panics:
1. panic: rtalloc1_fib: bad fibnum

2. panic: Lock tcpinp not exclusively locked
@ /usr/src/sys/netinet/in_pcb.c:1284

Submitted by:	Chelsio Inc.
MFC after:	3 days
2008-09-18 23:56:42 +00:00
Andrew Thompson
149bac03d9 Move the protocol and port count checks to outside the loop, these conditions
can not change while we have the lock so no point retesting.
2008-09-18 20:56:35 +00:00
John Baldwin
4e63215ba8 Whitespace fixes. This file also had 7 space indent in a few places. 2008-09-18 20:26:06 +00:00
John Baldwin
da672ec2ca Various style fixes. 7 space indent is just odd. 2008-09-18 20:10:11 +00:00
John Baldwin
cbb598af66 Sort includes. 2008-09-18 20:04:22 +00:00
Warner Losh
6e1a9d1739 Mips needs the same treatment for atomic_or_8 as the other RISCy
architectures.
2008-09-18 19:57:06 +00:00
Marius Strobl
9d769eb369 Clear any possibly pending PCI error bits left by the firmware. These
could trigger an error interrupt that we can't actually to do anything
against as soon as enabling the error handlers.
While at it don't bother about writing only to the write-one-to-clear
bits when clearing error bits.
2008-09-18 19:45:22 +00:00
Stanislav Sedov
4f55a298ce - Recognize SAVE and OSXSAVE extended processor features.
Approved by:	kib (mentor)
MFC after:	1 month
2008-09-18 18:51:32 +00:00
David E. O'Brien
bbb1474986 No FORTH for MIPS. 2008-09-18 15:25:35 +00:00
David E. O'Brien
b17e4de65f Catch up with intr_event_create() API changes. 2008-09-18 15:24:49 +00:00
David E. O'Brien
c542342568 Catch up with intr_event_create() API changes. 2008-09-18 15:15:42 +00:00
Sean Bruno
c4901b6798 Just a fixup for a KTRACE message I stumbled upon many moons ago.
Reviewed by:	Scott Long
MFC after:	2 days
2008-09-18 15:02:19 +00:00
Sean Bruno
954e36405f Add a new cam_status CAM_SCSI_IT_NEXUS_LOST. This will be used by future patches
for target mode that are forthcoming.

Reviewed by:	Scott Long
MFC after:	2 days
2008-09-18 14:48:46 +00:00
Marius Strobl
054224cc75 - Add a missing prototype.
- Remove a banal comment.
2008-09-18 14:17:10 +00:00
Marius Strobl
b2a1ae8353 - Newer firmware versions no longer provide SUNW,stop-self so just
disable interrupts and loop forever with these.
- Hide all MP-related bits in <machine/smp.h> underneath #ifdef SMP.
- Inline ipi_all_but_self(9) and ipi_selected(9). We don't expose any
  additional bits but save a few cycles by doing so.
- Remove ipi_all(9), which actually only called panic(9). It can't be
  implemented natively anyway and having it removed at least causes
  MI users to fail already fail when linking.
2008-09-18 13:56:30 +00:00
Søren Schmidt
7aab7e054f Cleanup the AHCI code a bit.
Add suspend/resume for AHCI, general methods added.

Inspired by: Andrey V. Elsukov
2008-09-18 12:12:34 +00:00
Andrew Thompson
96c41c08b0 Make sure there is at least one port to avoid divide by zero when choosing the
tx port.

PR:		kern/122794
MFC after:	3 days
2008-09-18 04:14:28 +00:00
Kip Macy
4e772e405d Don't do round robin assignment of interrupts on xen
MFC after:	1 month
2008-09-18 03:19:46 +00:00
Kip Macy
425eaba985 Change order of pcpu initialization so the pc_prvspace is set
MFC after:	1 month
2008-09-18 02:59:19 +00:00
Kip Macy
6cf8efdc48 fix initial page directory setup for APs to work when KERNBASE < 0xc0000000
MFC after:	1 month
2008-09-18 01:09:15 +00:00
John Baldwin
9a9d4b5f48 MFamd64: More CPUID feature flags: SSE4, X2APIC, POPCNT, DTES64, and 1GB
large pages.

MFC after:	1 month
2008-09-17 20:45:18 +00:00
Kip Macy
57bd99b3c5 Some people have very strange notions of how large KVA_PAGES should be. The
core of this change generalizes the initial page directory setup so that
the kernel can be given arbitrarily large or small.

- small formatting fixes
- update copyright

MFC after:	1 month
2008-09-17 19:11:37 +00:00
Attilio Rao
fbd5dccf46 Document the suser(9) and suser_cred(9) interface removal. 2008-09-17 15:50:41 +00:00
Attilio Rao
cecd8edba5 Remove the suser(9) interface from the kernel. It has been replaced from
years by the priv_check(9) interface and just very few places are left.
Note that compatibility stub with older FreeBSD version
(all above the 8 limit though) are left in order to reduce diffs against
old versions. It is responsibility of the maintainers for any module, if
they think it is the case, to axe out such cases.

This patch breaks KPI so __FreeBSD_version will be bumped into a later
commit.

This patch needs to be credited 50-50 with rwatson@ as he found time to
explain me how the priv_check() works in detail and to review patches.

Tested by:      Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
Reviewed by:    rwatson
2008-09-17 15:49:44 +00:00
Ed Schouten
a56f84cf2c Small consistency bug: remove named function attribute.
Everywhere in <sys/ttydisc.h> we don't specify a function argument name,
except in a single place. Also remove it there.
2008-09-17 13:59:05 +00:00
Attilio Rao
3daba5a642 Decontext-alize the nfsserver module.
Now, only some few places still require thread passing (mostly the ones which
access to VOP_* functions) and will be fixed once the primitive also will be.

Tested by:	Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
2008-09-16 21:57:39 +00:00
John Baldwin
db2529820a Add 'device acpi' to GENERIC on i386. Most newer i386 machines require it,
so the benefit of having acpi.ko as a standalone module is outweighed by
the complications of drivers compiled into the kernel not including ACPI
attachments by default.

Discussed on:	current
2008-09-16 20:22:22 +00:00
Alexander Motin
4d423c805b Hide some of driver's internal debugging.
Left only parts surely required for basic troubleshooting and configuration
purposes. There is still very long output, but further shrinking makes it
less informative.

Original debugging can be enabled with hw.snd.verbose=4.
2008-09-16 20:03:34 +00:00
John Baldwin
e7e2941b81 Allow child devices of vgapci(4) to query VPD strings and use MSI/MSI-X
interrupts.  For the MSI/MSI-X case, we only allow 1 child device to use
MSI or MSI-X at a time.

Tested by:	rnoland
2008-09-16 19:52:02 +00:00
Marcel Moolenaar
e4f72b32cb o When not making a translation cache-inhibit and guarded (PTE_I|PTE_G)
make it memory-coherency enforced (PTE_M). This is required for SMP
   to work.
o  Serialize tlbie operations and implement the tlbie operation in a
   function called tlbie(). Hardware can end up in a live-lock if
   between the tlbsync and subsequent sync on one processor another
   processor executes a tlbie or tlbsync.
o  Eliminate the following defines:
	TLBIE, TLBSYNC, SYNC and EIEIO
   Use either inline assembly statements or inline functions defined
   in <machine/cpufunc.h>
2008-09-16 19:16:33 +00:00
John Baldwin
c481551083 Retire the 'i_reclen' field from the in-memory i-node. Previously,
during a DELETE lookup operation, lookup would cache the length of the
directory entry to be deleted in 'i_reclen'.  Later, the actual VOP to
remove the directory entry (ufs_remove, ufs_rename, etc.) would call
ufs_dirremove() which extended the length of the previous directory
entry to "remove" the deleted entry.

However, we always read the entire block containing the directory
entry when doing the removal, so we always have the directory entry to
be deleted in-memory when doing the update to the directory block.
Also, we already have to figure out where the directory entry that is
being removed is in the block so that we can pass the component name
to the dirhash code to update the dirhash.  So, instead of passing
'i_reclen' from ufs_lookup() to the ufs_dirremove() routine, just read
the 'd_reclen' field directly out of the entry being removed when
updating the length of the previous entry in the block.

This avoids a cosmetic issue of writing to 'i_reclen' while holding a
shared vnode lock.  It also slightly reduces the amount of side-band
data passed from ufs_lookup() to operations updating a directory via
the directory's i-node.

Reviewed by:	jeff
2008-09-16 19:06:44 +00:00
Craig Rodrigues
8c83611684 Bump __FreeBSD_version to reflect that kernel NFS mount code can accept
mount options in individual members of nmount() iovec array instead of
one big struct nfs_args.

Requested by:	dfr
2008-09-16 17:39:01 +00:00
Marcel Moolenaar
6e32690075 Rewrite cpudep_ap_bootstrap(). We now enable L3, L2, L1D and L1I
caches if not yet enabed. This is required for coherency and
atomic operations to work, not to mention performance. We use the
L2 and L3 cache settings of the BSP to configure the APs caches.
Can't be bad.

Program NAP and not DOZE. DOZE is present only on earlier CPUs
and the bit is reserved on the MPC7441 & MPC7451. NAP will do
bus snooping to keep caches coherent.

Program the PIR with the cpuid. This may not be necessary...
2008-09-16 17:22:16 +00:00
Marcel Moolenaar
d349b8aca9 o In decr_get_timecount() only read the low timebase register.
We're only returning a 32-bit counter.
o  In decr_intr(), manually perform LICM, so that we don't test
   a loop invariant condition inside a loop.
o  Include <machine/smp.h>
2008-09-16 17:11:33 +00:00
Marcel Moolenaar
5e3943bf93 Set pcpup->pc_curthread and pcpup->pc_curpcb before calling
pmap_activate. While pmap_activate doesn't need either, we
do need a valid curthread if we enable KTR_PMAP.
2008-09-16 17:03:52 +00:00
Marcel Moolenaar
bdd42e42d7 o Synchronize the APs timebase and decrementer values with the BSP.
o  Don't set/get the PIR register. It's CPU dependent.
o  Also initialize pcpup->pc_curpcb, in case it's dereferenced.
2008-09-16 16:33:36 +00:00
Marcel Moolenaar
5da7ea0a89 In powerpc_get_pcpup(), make the inline assembly statement
volatile so that the compiler won't perform CSE. For SMP,
this may result in us accessing the wrong PCPU and as such
results in a bogus curthread value.

Note that getting curthread is not quite MP-safe in the sense
that it requires two instructions that aren't performed
atomically. The first instruction gets the address of the PCPU
structure and the second instruction dereferences that pointer
to get curthread. If a thread is switched-out in between these
instructions and switched-in on a different CPU, we still get
the wrong curthread.
2008-09-16 16:28:51 +00:00
John Baldwin
b2ef6b1833 Fix a race with shared lookups on UFS. If the the dirhash code reached the
cap on memory usage, then shared LOOKUP operations could start free'ing
dirhash structures.  Without these fixes, concurrent free's on the same
directory could result in one of the threads blocked on a lock in a dirhash
structure free'd by the other thread.
- Replace the lockmgr lock in the dirhash structure with an sx lock.
- Use a reference count managed with ufsdirhash_hold()/drop() to determine
  when to free the dirhash structures.  The directory i-node holds a
  reference while the dirhash is attached to an i-node.  Code that wishes
  to lock the dirhash while holding a shared vnode lock must first
  acquire a private reference to the dirhash while holding the vnode
  interlock before acquiring the dirhash sx lock.  After acquiring the sx
  lock, it drops the private reference after checking to see if the
  dirhash is still used by the directory i-node.
2008-09-16 16:23:56 +00:00
John Baldwin
5316d529ec - Only set i_offset in the parent directory's i-node during a lookup for
non-LOOKUP operations.
- Relax a VOP assertion for a DELETE lookup.  rename() uses WANTPARENT
  instead of LOCKPARENT when looking up the source pathname.  ufs_rename()
  uses a relookup() to lock the parent directory when it decides to finally
  remove the source path.  Thus, it is ok for a DELETE with WANTPARENT set
  instead of LOCKPARENT to use a shared vnode lock rather than an exclusive
  vnode lock.

Reported by:	kris (2)
Reviewed by:	jeff
2008-09-16 16:18:36 +00:00
John Baldwin
1b7cf11b00 vdropl() drops the vnode interlock. Thus, the code in the QUOTA case that
upgrades the vnode lock if it is share locked was dropping the interlock
before actually checking VI_DOOMED.  Fix this by do the vdropl() after the
check and relying on it to drop the vnode interlock.

Reported by:	pho
Reviewed by:	kib
MFC after:	1 week
2008-09-16 16:15:38 +00:00
Ed Schouten
42ff2756c7 Fix minor TTY API inconsistency.
Unlike tty_rel_gone() and tty_rel_sess(), the tty_rel_pgrp() routine
does not unlock the TTY. I once had the idea to make the code call
tty_rel_pgrp() and tty_rel_sess(), picking up the TTY lock once. This
turned out a little harder than I expected, so this is how it works now.

It's a lot easier if we just let tty_rel_pgrp() unlock the TTY, because
the other routines do this anyway.
2008-09-16 14:57:23 +00:00
Konstantin Belousov
6fecb4e41e Suspend the write operations on the UFS filesystem being unmounted or
remounted from rw to ro.

Proposed and reviewed by:  tegge
In collaboration with:	pho
MFC after:	 1 month
2008-09-16 11:55:53 +00:00
Konstantin Belousov
2814d5ba5f When attempt is made to suspend a filesystem that is already syspended,
wait until the current suspension is lifted instead of silently returning
success immediately. The consequences of calling vfs_write() resume when
not owning the suspension are not well-defined at best.

Add the vfs_susp_clean() mount method to be called from
vfs_write_resume(). Set it to process_deferred_inactive() for ffs, and
stop calling it manually.

Add the thread flag TDP_IGNSUSP that allows to bypass the suspension
point in the vn_start_write. It is intended for use by VFS in the
situations where the suspender want to do some i/o requiring calls to
vn_start_write(), and this i/o cannot be done later.

Reviewed by:	tegge
In collaboration with:	pho
MFC after:	 1 month
2008-09-16 11:51:06 +00:00