Commit Graph

77801 Commits

Author SHA1 Message Date
Alan Cox
72dc3eb65b Simplify the inner loop of pmap_collect(): While iterating over the page's
pv list, there is no point in checking whether or not the pv list is empty.
Instead, wait until the loop completes.
2010-05-30 18:48:41 +00:00
Alan Cox
a1192299b3 Merge various changes from i386/i386/pmap.c:
The remaining, unmerged portions of r175404
  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.

Merge portions of r177659
  To date, we have assumed that the TLB will only set the PG_M bit in a
  PTE if that PTE has the PG_RW bit set.  However, this assumption does
  not hold on recent processors from Intel.  For example, consider a PTE
  that has the PG_RW bit set but the PG_M bit clear.  Suppose this PTE
  is cached in the TLB and later the PG_RW bit is cleared in the PTE,
  but the corresponding TLB entry is not (yet) invalidated.
  Historically, upon a write access using this (stale) TLB entry, the
  TLB would observe that the PG_RW bit had been cleared and initiate a
  page fault, aborting the setting of the PG_M bit in the PTE.  Now,
  however, P4- and Core2-family processors will set the PG_M bit before
  observing that the PG_RW bit is clear and initiating a page fault.  In
  other words, the write does not occur but the PG_M bit is still set.

  The real impact of this difference is not that great.  Specifically,
  we should no longer assert that any PTE with the PG_M bit set must
  also have the PG_RW bit set, and we should ignore the state of the
  PG_M bit unless the PG_RW bit is set.

r208609
  Defer freeing any page table pages in pmap_remove_all() until after the
  page queues lock is released.  This may reduce the amount of time that the
  page queues lock is held by pmap_remove_all().

r208645
  When I pushed down the page queues lock into pmap_is_modified(), I created
  an ordering dependence: A pmap operation that clears PG_WRITEABLE and calls
  vm_page_dirty() must perform the call first.  Otherwise, pmap_is_modified()
  could return FALSE without acquiring the page queues lock because the page
  is not (currently) writeable, and the caller to pmap_is_modified() might
  believe that the page's dirty field is clear because it has not seen the
  effect of the vm_page_dirty() call.

  When I pushed down the page queues lock into pmap_is_modified(), I
  overlooked one place where this ordering dependence is violated:
  pmap_enter().  In a rare situation pmap_enter() can be called to replace a
  dirty mapping to one page with a mapping to another page.  (I say rare
  because replacements generally occur as a result of a copy-on-write fault,
  and so the old page is not dirty.)  This change delays clearing PG_WRITEABLE
  until after vm_page_dirty() has been called.

  Fixing the ordering dependency also makes it easy to introduce a small
  optimization: When pmap_enter() used to replace a mapping to one page with a
  mapping to another page, it freed the pv entry for the first mapping and
  later called the pv entry allocator for the new mapping.  Now, pmap_enter()
  attempts to recycle the old pv entry, saving two calls to the pv entry
  allocator.

  There is no point in setting PG_WRITEABLE on unmanaged pages, so don't.
  Update a comment to reflect this.

  Tidy up the variable declarations at the start of pmap_enter().
2010-05-30 04:44:32 +00:00
Jung-uk Kim
4affd62610 Fix a regression from r200554, which broke fdc(4) attachment to acpi(4).
I removed too many lines and a wrong pointer was accidentally passed down.

Tested by:	Scott Allendorf (scott-allendorf at uiowa dot edu), kib
MFC after:	3 days
2010-05-30 03:45:41 +00:00
Alan Cox
ff8ffaf43a Don't set PG_WRITEABLE in pmap_enter() unless the page is managed. 2010-05-29 18:26:44 +00:00
Alan Cox
8f0d5d3b9f When I pushed down the page queues lock into pmap_is_modified(), I created
an ordering dependence: A pmap operation that clears PG_WRITEABLE and calls
vm_page_dirty() must perform the call first.  Otherwise, pmap_is_modified()
could return FALSE without acquiring the page queues lock because the page
is not (currently) writeable, and the caller to pmap_is_modified() might
believe that the page's dirty field is clear because it has not seen the
effect of the vm_page_dirty() call.

When I pushed down the page queues lock into pmap_is_modified(), I
overlooked one place where this ordering dependence is violated:
pmap_enter().  In a rare situation pmap_enter() can be called to replace a
dirty mapping to one page with a mapping to another page.  (I say rare
because replacements generally occur as a result of a copy-on-write fault,
and so the old page is not dirty.)  This change delays clearing PG_WRITEABLE
until after vm_page_dirty() has been called.

Fixing the ordering dependency also makes it easy to introduce a small
optimization: When pmap_enter() used to replace a mapping to one page with a
mapping to another page, it freed the pv entry for the first mapping and
later called the pv entry allocator for the new mapping.  Now, pmap_enter()
attempts to recycle the old pv entry, saving two calls to the pv entry
allocator.

There is no point in setting PG_WRITEABLE on unmanaged pages, so don't.
Update a comment to reflect this.

Tidy up the variable declarations at the start of pmap_enter().
2010-05-29 17:10:45 +00:00
Rui Paulo
bf59e055db Due to the way HALDEBUG() is defined, we need to add curly brackets
when using it as a sole if clause instruction.
While there, fix 'const static' typo.

Submitted by:	Arnaud Lacombe <alc@FreeBSD.org>
MFC after:	1 week
2010-05-29 16:14:02 +00:00
Rui Paulo
3a4a144128 Due to the way HALDEBUG() is defined, we need to add curly brackets when
using it as a sole if clause instruction.

Submitted by:	Arnaud Lacombe <alc@FreeBSD.org>
MFC after:	1 week
2010-05-29 16:11:51 +00:00
Rui Paulo
efe604e56b Don't shadow the global variable 'version'.
Submitted by:	Arnaud Lacombe <alc@NetBSD.org>
MFC after:	1 week
2010-05-29 16:10:07 +00:00
Yoshihiro Takahashi
29eca7a86f MFi386: the part of revision 181809
Use SEL_KPL macro.
2010-05-29 09:12:02 +00:00
Yoshihiro Takahashi
ecedb795c4 MFi386: revision 178471
- 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.
2010-05-29 09:07:40 +00:00
Yoshihiro Takahashi
5ba5bf13b7 Reduce diffs against i386. 2010-05-29 03:40:00 +00:00
Yoshihiro Takahashi
08cb7c2804 MFi386: revision 208621
Defer initializing machine checks for the boot CPU until the local APIC is
  fully configured.
2010-05-29 03:09:29 +00:00
Yoshihiro Takahashi
c80244db64 MFi386: revision 208604
Clarify a potential issue in get_fpcontext() use.
2010-05-29 03:06:56 +00:00
Zachary Loafman
911de7741d Avoid a wakeup(9) if we can be sure no one is waiting on the task.
Submitted by:       Matthew Fleming <matthew.fleming@isilon.com>
Reviewed by:        zml, jhb
2010-05-28 18:15:34 +00:00
Zachary Loafman
6e86cdb85c Revert r207439 and solve the problem differently. The task handler
ta_func may free the task structure, so no references to its members
are valid after the handler has been called. Using a per-queue member
and having waits longer than strictly necessary was suggested by jhb.

Submitted by:       Matthew Fleming <matthew.fleming@isilon.com>
Reviewed by:        zml, jhb
2010-05-28 18:15:28 +00:00
John Baldwin
0c86af8162 Defer initializing machine checks for the boot CPU until the local APIC is
fully configured.

MFC after:	1 month
2010-05-28 17:50:24 +00:00
Jayachandran C.
9be223a169 Fix lock order reversal, unlock page queue and pmap locks before
calling uma_zfree().
Also if needed, acquire page queue lock before modifying pte page
attributes.

Approved by:	rrs (mentor)
2010-05-28 12:05:56 +00:00
Rafal Jaworowski
6365985dfc Initial implementation of the OFW i/f methods for FDT back-end.
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-05-28 10:51:44 +00:00
Rafal Jaworowski
8297758a22 Prepare and extend OFW layer for FDT support.
o Let OFW_INIT() and OF_init() return status value.

o Provide helper routines for 'compatible' property handling.

o Only compile OF and OFW code, which is relevant in FDT scenario.

o Other minor cosmetics

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-05-28 10:43:56 +00:00
Rafal Jaworowski
77e46080d8 Introduce kernel build options for the Flattened Device Tree support.
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-05-28 10:35:44 +00:00
Andriy Gapon
7bdc66dab8 boot/zfs: fix gang block reading code
- use correct size (512) while reading a gang block
- skip holes while reading child blocks
- advance buffer pointer while reading child blocks

PR:		144214
MFC after:	10 days
2010-05-28 07:34:20 +00:00
Alan Cox
52d8ba372e Defer freeing any page table pages in pmap_remove_all() until after the
page queues lock is released.  This may reduce the amount of time that the
page queues lock is held by pmap_remove_all().
2010-05-28 06:49:57 +00:00
Neel Natu
8ccf57985c Get rid of unused variable 'virtual_sys_start'. 2010-05-28 05:34:43 +00:00
Neel Natu
03cfd5266e If 'timer2hz' is zero then we don't need to call 'timer2clock()' directly. It
will be called automatically by 'timer1clock()'.

Do profiling as often as possible by running it as the same frequency as
'timer1hz'. The statistics clock is run as close to 128Hz as possible.

Pointed out by: mav@
2010-05-28 02:00:15 +00:00
Xin LI
76af820152 Fix build: newnp represents newvp so KDTRACE_NFS_ATTRCACHE_FLUSH_DONE()
on newvp instead of vp here.
2010-05-27 22:59:37 +00:00
Konstantin Belousov
eee6151f46 Clarify a potential issue in get_fpcontext() use.
MFC after:	1 week
2010-05-27 18:33:00 +00:00
John Baldwin
b367632ec2 More gracefully handle stale file handles and attributes when opening a
file via NFS.  Specifically, to satisfy close-to-open-consistency, the NFS
client always performs at least one RPC on a file during an open(2) to see
if the file has changed.  Normally this RPC is an ACCESS or GETATTR RPC
that is forced by flushing a file's attribute cache during nfs_open() and
then requesting new attributes.  However, if the file is noticed to be
stale during nfs_open(), the only recourse is to fail the open(2) call
with ESTALE.  On the other hand, if the ACCESS or GETATTR RPC is sent
during nfs_lookup(), then the NFS client can fall back to a LOOKUP RPC to
obtain the new file handle in the case that a file has been replaced.

This change causes the NFS client to flush the attribute cache during
nfs_lookup() when validating a name cache hit if the attributes fetched
during nfs_lookup() can be reused in nfs_open().  This allows the client
to open a replaced file via the new file handle the first time that it
notices a replaced file rather than failing with ESTALE in some cases.

Reviewed by:	rmacklem, bde
Reviewed by:	mohans (older version)
MFC after:	1 week
2010-05-27 18:07:20 +00:00
Robert Watson
e35973e4b8 When close() is called on a connected socket pair, SO_ISCONNECTED might be
set but be cleared before the call to sodisconnect().  In this case,
ENOTCONN is returned: suppress this error rather than returning it to
userspace so that close() doesn't report an error improperly.

PR:		kern/144061
Reported by:	Matt Reimer <mreimer at vpop.net>,
		Nikolay Denev <ndenev at gmail.com>,
		Mikolaj Golub <to.my.trociny at gmail.com>
MFC after:	3 days
2010-05-27 15:27:31 +00:00
Rui Paulo
65872f8fb5 Revert r208590. A license ack is not needed as per r186984. 2010-05-27 12:54:42 +00:00
Rui Paulo
db0de2596e Make the user ack the license before using this firmware.
MFC after:	3 days
2010-05-27 12:11:21 +00:00
Jayachandran C.
fde7da314a Call VM_WAIT in pmap_ptpgzone_allocf() if M_WAITOK is set.
Removed unused variable.

Approved by:	rrs (mentor)
2010-05-27 10:05:40 +00:00
Attilio Rao
937912ea04 Add the support for reporting the NOCOREDUMP flag from
sysctl_kern_proc_vmmap().

Sponsored by:	Sandvine Incorporated
Reviewed by:	kib, emaste
MFC after:	1 week
2010-05-27 08:10:12 +00:00
Colin Percival
8fd6c56d29 Change the current working directory to be inside the jail created by
the jail(8) command. [10:04]

Fix a one-NUL-byte buffer overflow in libopie. [10:05]

Correctly sanity-check a buffer length in nfs mount. [10:06]

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-10:04.jail
Security:	FreeBSD-SA-10:05.opie
Security:	FreeBSD-SA-10:06.nfsclient
2010-05-27 03:15:04 +00:00
Neel Natu
87164cbbaa Simplify clock interrupt handling on mips by using the new KPI - timer1clock()
and timer2clock().

Dynamically adjust the tick frequency depending on the value of 'hz'. Tested
with hz values of 100, 1000 and 2000.
2010-05-27 01:27:25 +00:00
Matt Jacob
0e85f214e3 Add a new primitive, XPT_SCAN_TGT, to cover the range between scanning a
whole bus (XPT_SCAN_BUS) and a single lun on that bus (XPT_SCAN_LUN).

It's less resource comsumptive than scanning a whole bus when the
caller knows only one target has changes.

Reviewed by:	scsi@
Sponsored by:	Panasas
MFC after:	1 month
2010-05-26 22:49:42 +00:00
Oleksandr Tymoshenko
522c90a143 - Fix kseg0 address calculation - it doesn't always start at
page boundary
- Add cache ops to ensure memory validity before/after
    copy operation
2010-05-26 22:38:45 +00:00
Alan Cox
c46b90e90a Push down page queues lock acquisition in pmap_enter_object() and
pmap_is_referenced().  Eliminate the corresponding page queues lock
acquisitions from vm_map_pmap_enter() and mincore(), respectively.  In
mincore(), this allows some additional cases to complete without ever
acquiring the page queues lock.

Assert that the page is managed in pmap_is_referenced().

On powerpc/aim, push down the page queues lock acquisition from
moea*_is_modified() and moea*_is_referenced() into moea*_query_bit().
Again, this will allow some additional cases to complete without ever
acquiring the page queues lock.

Reorder a few statements in vm_page_dontneed() so that a race can't lead
to an old reference persisting.  This scenario is described in detail by a
comment.

Correct a spelling error in vm_page_dontneed().

Assert that the object is locked in vm_page_clear_dirty(), and restrict the
page queues lock assertion to just those cases in which the page is
currently writeable.

Add object locking to vnode_pager_generic_putpages().  This was the one
and only place where vm_page_clear_dirty() was being called without the
object being locked.

Eliminate an unnecessary vm_page_lock() around vnode_pager_setsize()'s call
to vm_page_clear_dirty().

Change vnode_pager_generic_putpages() to the modern-style of function
definition.  Also, change the name of one of the parameters to follow
virtual memory system naming conventions.

Reviewed by:	kib
2010-05-26 18:00:44 +00:00
Jung-uk Kim
55e1b13327 Do not attempt to switch to the same VTs between suspend and resume. 2010-05-26 16:37:54 +00:00
Konstantin Belousov
b2318c2860 Allow to use syscallname(9) outside subr_trap.c.
MFC after:	1 month
2010-05-26 15:39:43 +00:00
Konstantin Belousov
47d9159525 Remove a check that should be always true.
Discussed with:	pjd
MFC after:	1 week
2010-05-26 15:36:29 +00:00
Jung-uk Kim
cb881f8f8e Let the first device suspend and the last device resume syscons(4). 2010-05-26 15:29:53 +00:00
Yoshihiro Takahashi
38eeaac17b Reduce diffs against syscons_isa.c. No functional changes. 2010-05-26 11:31:57 +00:00
Rafal Jaworowski
13ced1d6a0 Initial device tree source (DTS) files for Marvell ARM systems:
o DB-88F5182
  o DB-88F5281
  o DB-88F6281
  o DB-78100
  o SheevaPlug

This also includes device tree bindings definitions for some newly introduced
nodes (mpp, gpio).

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-05-26 09:50:09 +00:00
Rafal Jaworowski
103de39de5 Import device tree source (DTS) files for PowerPC MPC8555CDS and MPC8572DS
development systems.

Special thanks to Phil Brownfield for help with BSD-style relicensing of
these files.

Obtained from:	Freescale
2010-05-26 09:34:02 +00:00
John Baldwin
835f163a20 Only enable CMCI on i386 if 'device apic' is enabled in the kernel since
it requires the local APIC to work.
2010-05-25 21:39:30 +00:00
John Baldwin
0bfbf4d220 Ignore the 'addr' argument passed to PT_STEP (it is required to be '1'
for PT_STEP which means "ignore") and PT_DETACH.

PR:		kern/146167
MFC after:	1 week
2010-05-25 21:32:37 +00:00
Gleb Smirnoff
f25a8a0150 Add uep(4), driver for USB onscreen touch panel from eGalax.
The driver is stub. It just creates device entry and feeds
reassembled packets from hardware into it.

If in future we would port wsmouse(4) from NetBSD, or make
sysmouse(4) to support absolute motion events, then the driver
can be extended to act as system mouse. Meanwhile, it just
presents a /dev/uep0, that can be utilized by X driver, that
I am going to commit to ports tree soon.

The name for the driver is chosen to be the same as in NetBSD,
however, due to different USB stacks this driver isn't a port.
2010-05-25 21:20:56 +00:00
Qing Li
0ed6142b31 This patch fixes the problem where proxy ARP entries cannot be added
over the if_ng interface.

MFC after:	3 days
2010-05-25 20:42:35 +00:00
Matt Jacob
1c0a1eb299 Don't leak CCBs for every ABORT.
Submitted by:	Ken Merry
MFC after:	One week
2010-05-25 20:19:45 +00:00
Matt Jacob
331c6a355a Remove extra break left by hand editing.
X-MFC: 208542
MFC after:	One Month
2010-05-25 16:50:35 +00:00