Home | History | Annotate | Download | only in genfs
History log of /src/sys/miscfs/genfs/genfs_io.c
RevisionDateAuthorComments
 1.104  05-Apr-2024  riastradh uvm: Expand v_size <= v_writesize assertions to help diagnostics.

PR kern/58117
 1.103  09-Apr-2023  riastradh genfs: KASSERT(A && B) -> KASSERT(A); KASSERT(B)
 1.102  14-Jan-2022  riastradh genfs(9): Prune dead branch.
 1.101  19-Aug-2020  simonb Remove trailing \n from UVMHIST_LOG() format strings.
 1.100  14-Aug-2020  chs centralize calls from UVM to radixtree into a few functions.
in those functions, assert that the object lock is held in
the correct mode.
 1.99  10-Aug-2020  rin Output offsets in hex for UVMHIST.
 1.98  14-Jun-2020  ad genfs_putpages(): when building a cluster make use of pages in the in the
existing uvm_page_array.
 1.97  25-May-2020  ad - Alter the convention for uvm_page_array slightly, so the basic search
parameters can't change part way through a search: move the "uobj" and
"flags" arguments over to uvm_page_array_init() and store those with the
array.

- With that, detect when it's not possible to find any more pages in the
tree with the given search parameters, and avoid repeated tree lookups if
the caller loops over uvm_page_array_fill_and_peek().
 1.96  17-May-2020  ad Start trying to reduce cache misses on vm_page during fault processing.

- Make PGO_LOCKED getpages imply PGO_NOBUSY and remove the latter. Mark
pages busy only when there's actually I/O to do.

- When doing COW on a uvm_object, don't mess with neighbouring pages. In
all likelyhood they're already entered.

- Don't mess with neighbouring VAs that have existing mappings as replacing
those mappings with same can be quite costly.

- Don't enqueue pages for neighbour faults unless not enqueued already, and
don't activate centre pages unless uvmpdpol says its useful.

Also:

- Make PGO_LOCKED getpages on UAOs work more like vnodes: do gang lookup in
the radix tree, and don't allocate new pages.

- Fix many assertion failures around faults/loans with tmpfs.
 1.95  22-Mar-2020  ad Process concurrent page faults on individual uvm_objects / vm_amaps in
parallel, where the relevant pages are already in-core. Proposed on
tech-kern.

Temporarily disabled on MP architectures with __HAVE_UNLOCKED_PMAP until
adjustments are made to their pmaps.
 1.94  17-Mar-2020  ad Tweak the March 14th change to make page waits interlocked by pg->interlock.
Remove unneeded changes and only deal with the PQ_WANTED flag, to exclude
possible bugs.
 1.93  14-Mar-2020  ad Make uvm_pagemarkdirty() responsible for putting vnodes onto the syncer
work list. Proposed on tech-kern@.
 1.92  14-Mar-2020  ad Make page waits (WANTED vs BUSY) interlocked by pg->interlock. Gets RW
locks out of the equation for sleep/wakeup, and allows observing+waiting
for busy pages when holding only a read lock. Proposed on tech-kern.
 1.91  14-Mar-2020  ad Unused variable.
 1.90  14-Mar-2020  ad - Hide the details of SPCF_SHOULDYIELD and related behind a couple of small
functions: preempt_point() and preempt_needed().

- preempt(): if the LWP has exceeded its timeslice in kernel, strip it of
any priority boost gained earlier from blocking.
 1.89  14-Mar-2020  ad OR into bp->b_cflags; don't overwrite.
 1.88  27-Feb-2020  ad Tighten up the locking around vp->v_iflag a little more after the recent
split of vmobjlock & v_interlock.
 1.87  24-Feb-2020  ad v_interlock -> vmobjlock
 1.86  23-Feb-2020  ad UVM locking changes, proposed on tech-kern:

- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart. v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap. Others to follow later.
 1.85  18-Feb-2020  chs remove the aiodoned thread. I originally added this to provide a thread context
for doing page cache iodone work, but since then biodone() has changed to
hand off all iodone work to a softint thread, so we no longer need the
special-purpose aiodoned thread.
 1.84  15-Jan-2020  ad Merge from yamt-pagecache (after much testing):

- Reduce unnecessary page scan in putpages esp. when an object has a ton of
pages cached but only a few of them are dirty.

- Reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
 1.83  31-Dec-2019  ad branches: 1.83.2;
- Add and use wrapper functions that take and acquire page interlocks, and pairs
of page interlocks. Require that the page interlock be held over calls to
uvm_pageactivate(), uvm_pagewire() and similar.

- Solve the concurrency problem with page replacement state. Rather than
updating the global state synchronously, set an intended state on
individual pages (active, inactive, enqueued, dequeued) while holding the
page interlock. After the interlock is released put the pages on a 128
entry per-CPU queue for their state changes to be made real in batch.
This results in in a ~400 fold decrease in contention on my test system.
Proposed on tech-kern but modified to use the page interlock rather than
atomics to synchronise as it's much easier to maintain that way, and
cheaper.
 1.82  31-Dec-2019  ad Rename uvm_page_locked_p() -> uvm_page_owner_locked_p()
 1.81  16-Dec-2019  ad genfs_do_putpages(): add a missing call to uvm_page_array_advance().

Spotted by the automated test runs and:

Reported-by: syzbot+adc1f0ce21bcece5307d@syzkaller.appspotmail.com
 1.80  16-Dec-2019  ad Correction to previous for DEBUG case.
 1.79  15-Dec-2019  ad Fix DEBUG build.
 1.78  15-Dec-2019  ad Merge from yamt-pagecache:

- do gang lookup of pages using radixtree.
- remove now unused uvm_object::uo_memq and vm_page::listq.queue.
 1.77  13-Dec-2019  ad Break the global uvm_pageqlock into a per-page identity lock and a private
lock for use of the pagedaemon policy code. Discussed on tech-kern.

PR kern/54209: NetBSD 8 large memory performance extremely low
PR kern/54210: NetBSD-8 processes presumably not exiting
PR kern/54727: writing a large file causes unreasonable system behaviour
 1.76  06-Oct-2019  mlelstv Defer to synchronous I/O before the aiodone work queue exists.
 1.75  11-Jul-2019  maxv Fix (harmless) uninitialized variable: 'pg' could be 'endm', in which case
'pg->uobject' would not be initialized. Just invert the two last conditions
of the KASSERT.

ok hannken@
 1.74  10-Dec-2018  jdolecek assert that WAPBL journal write lock is actually held when called with
PGO_JOURNALLOCKED or IO_JOURNALLOCKED

suggested by mrg@, thanks
 1.73  09-Dec-2018  jdolecek support flag PGO_JOURNALLOCKED also for genfs_getpages()
 1.72  28-May-2018  chs branches: 1.72.2;
add a genfs method to allow a file system to limit the range of pages
that are given to a single GOP_WRITE() call. needed by ZFS.
 1.71  28-Oct-2017  pgoyette branches: 1.71.2;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.
 1.70  27-Jun-2017  hannken Add missing check for dead or dying vnode to the entry of genfs_getpages().
 1.69  04-Jun-2017  hannken Operations fstrans_start() and fstrans_start_nowait() now always
use FSTRANS_SHARED as lock type so remove the lock type argument.

File system state FSTRANS_SUSPENDING is now unused so remove it.

Regen vnode_if files.

Ride 8.99.1 less than a hour ago.
 1.68  01-Apr-2017  dholland branches: 1.68.6;
Clarify meaning of "glocked" argument of genfs_putpages_read.
 1.67  01-Apr-2017  riastradh Simplify genfs_getpages_read async/unlock protocol.

Previously the caller unlocked for error or sync I/O, whereas
genfs_getpages_read unlocked on successful async.

Now caller unlocks in every case, and genfs_getpages_read doesn't
touch the lock.
 1.66  30-Mar-2017  hannken Change last users of FSTRANS_LAZY to FSTRANS_SHARED and change
genfs_suspendctl() to move from FSTRANS_NORMAL to FSTRANS_SUSPENDED
and vice versa.
 1.65  09-Mar-2017  hannken Protect genfs_do_putpages() against vnodes disappearing during
a forced mount update from read-write to read-only.
 1.64  01-Mar-2017  hannken Protect genfs_getpages() against vnodes disappearing during a
forced mount update from read-write to read-only.
 1.63  29-Sep-2016  christos branches: 1.63.2;
don't change the loop counts; noted by mrg@
 1.62  29-Sep-2016  christos Allow sparc kernels to build with SSP by using a constant PAGE_SIZE...
 1.61  06-May-2015  hannken branches: 1.61.2;
Remove miscfs/syncfs and

- move the syncer into kern/vfs_subr.c.

- change the syncer to process the mountlist and VFS_SYNC as appropriate.

- use an API for mount points similiar to the API for vnodes:
- vfs_syncer_add_to_worklist(struct mount *mp) to add
- vfs_syncer_remove_from_worklist(struct mount *mp) to remove a mount.

No objections on tech-kern@
 1.60  12-Apr-2015  skrll Fix UVMHIST build.
 1.59  10-Apr-2015  riastradh Pull VOP_BMAP/VOP_STRATEGY loop from getpages into its own function.

No functional change.

In preparation for a gop_read like the existing gop_write.
 1.58  25-Oct-2013  martin branches: 1.58.6;
Turn a few __unused into __diagused
 1.57  19-Oct-2013  martin Mark a potentially unused variable
 1.56  19-Oct-2013  martin Mark a potentially unused (if an arch implements pmap_update as empty
macro) variable accordingly.
 1.55  22-May-2012  yamt branches: 1.55.2; 1.55.4;
don't block on pager map for read-ahead.
reduce code duplication.
 1.54  29-Apr-2012  chs change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
 1.53  31-Oct-2011  yamt branches: 1.53.2; 1.53.6; 1.53.8;
typo in a comment
 1.52  09-Oct-2011  uebayasi Trim unused headers.
 1.51  01-Sep-2011  matt Use the new UVM_KMF_COLORMATCH flag to get a congruent mappings of the user
buffer so we can use unmanaged mappings (pmap_kenter_pa/pmap_kremove).
 1.50  31-Aug-2011  rmind genfs_do_directio: acquire the lock of page owner for now and fix PR/45177.
Will be revisited to avoid locking dance and be more efficient, e.g. we can
use unmanaged-mapping by allocating with colouring in mind.
 1.49  12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.48  21-Apr-2011  matt branches: 1.48.2;
Move some #ifdefs to prevent a code path change when DEBUG .vs. !DEBUG
Solves problem an assert firing when using NFS on MIPS.
 1.47  18-Apr-2011  rmind G/C unused speedup_syncer() mechanism and thus simplify some code.
Update some comments to reflect the reality. No actual changes to
the (used) syncer logic.

OK ad@
 1.46  06-Dec-2010  uebayasi branches: 1.46.2;
Correct an assertion; pointed out by mrg@ and pooka@, thanks.
 1.45  03-Dec-2010  hannken genfs_do_putpages(): When testing an uobject for dirty or modified
pages skip uninitialized (PG_FAKE) pages (DEBUG only).
 1.44  30-Nov-2010  hannken Always take the object lock before changing vmpage flags. Fixes a deadlock
where a thread is waiting on "genput" but the page in question is neither
BUSY nor WANTED.

No objections from tech-kern@.
 1.43  19-Nov-2010  uebayasi Whitespace.
 1.42  09-Nov-2010  hannken Genfs_getpages(): Break a deadlock where one thread runs VOP_GETPAGES(),
has busy pages and wants the wapbl lock as reader from wapbl_begin(),
another thread has the wapbl lock as reader and waits for a page from
the first thread. Now a third thread calls wapbl_flush() and wants the
wapbl lock as writer.

Move the wapbl_begin() up to a point where genfs_getpages() has no busy
pages yet.
 1.41  03-Nov-2010  uebayasi genfs_getpages: restore vm_page array correctly in PGO_LOCKED error
code path.
 1.40  01-Sep-2010  chs replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings. instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.
 1.39  19-Aug-2010  pooka print more info in the "past eof" panic
 1.38  08-Aug-2010  chs in genfs_getpages(), mark the vnode dirty (ie. add to syncer worklist
and set VI_WRMAPDIRTY) after we have busied the pages rather than
before. this prevents other threads calling genfs_do_putpages() from
marking the vnode clean again while we're in the process of creating
new writable mappings, since such threads will wait for the page(s) to
become unbusy before proceeding.
fixes the problem recently reported by hannken@ on tech-kern.
 1.37  29-Jul-2010  hannken Add vm page flag PG_MARKER and use it to tag dummy marker pages
in genfs_do_putpages() and uao_put().
Use 'v_uobj.uo_npages' to check for an empty memq.
Put some assertions where these marker pages may not appear.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
 1.36  30-Jan-2010  uebayasi branches: 1.36.2; 1.36.4;
Reduce the diff between genfs_getpages() and genfs_do_io(). These should be
merged eventually.
 1.35  30-Jan-2010  uebayasi Slightly more descriptive local variable names.
 1.34  29-Jan-2010  uebayasi genfs_getpages: Narrow & clarify the context where I/O happens & vmobjlock is dropped.
 1.33  29-Jan-2010  uebayasi genfs_getpages: Redo previous with a better goto label.
 1.32  28-Jan-2010  uebayasi Revert part which variable initializations within interleaved gotos.

again: if (...) goto err;
void *ptr = alloc();
if (...) goto again;
if (...) goto err1;
...
err1: if (ptr) free(ptr);
err:
return;

This leaks memory if exited with "goto again; -> goto err;".
 1.31  28-Jan-2010  uebayasi genfs_getpages: More constification & localization.
 1.30  28-Jan-2010  uebayasi genfs_getpages: Constify 2 variables, move one. No functional changes.
 1.29  28-Jan-2010  uebayasi genfs_getpages: Constify orignpages. Don't override its meaning by the value
re-calucated from GOP_SIZE(GOP_SIZE_MEM), but assign another variable
(orignmempages).
 1.28  28-Jan-2010  uebayasi Unbreak modules build.
 1.27  28-Jan-2010  uebayasi genfs_getpages: Constify & localize more variables.
 1.26  28-Jan-2010  uebayasi genfs_getpages: Move local variable declarations that are used only for I/O
to where they're used. This helps to track what's going in this lengthy
function.
 1.25  28-Jan-2010  uebayasi genfs_getpages: Localize a few more variables.
 1.24  28-Jan-2010  uebayasi genfs_putpages: Localize a few variables. No functional changes.
 1.23  27-Jan-2010  uebayasi Use genfs_node_*lock().
 1.22  27-Jan-2010  uebayasi Constify some pointers in genfs_getpages() and genfs_do_putpages().
 1.21  21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.20  18-Apr-2009  pooka Move genfs_null_putpages() from genfs_io.c to genfs_vnops.c -- it does
not really do i/o.
 1.19  23-Feb-2009  rmind genfs_getpages: rework 1.18 revision - move uvm_pagermapout() back.
It is useful to make KVA available ASAP. Per discussion with <yamt>.
 1.18  04-Feb-2009  rmind branches: 1.18.2;
genfs_getpages: move putiobuf() and uvm_pagermapout() outside the glock.
OK by <ad>.
 1.17  16-Jan-2009  yamt - g/c stale function prototypes.
- rename UVM_PAGE_HASH_PENALTY to UVM_PAGE_TREE_PENALTY.
 1.16  01-Dec-2008  joerg Check that the filesystem acutally uses WAPBL before initiating a
transaction for the directio case. Fixes PR 39929 and similiar issues
seen with PostgreSQL.
 1.15  16-Nov-2008  pooka more <sys/buf.h> police
 1.14  31-Oct-2008  christos - allocate 8 pointers on the stack to avoid stack overflow in nfs.
- make that 8 a constant
- remove bogus panic
 1.13  19-Oct-2008  hannken branches: 1.13.2; 1.13.4;
Make genfs_directio() IO_JOURNALLOCKED aware. DirectIO no longer triggers
"locking against myself" panic in wapbl_begin().

Observed and tested by: Frank Kardel <kardel@netbsd.org>
 1.12  10-Oct-2008  hannken Break a deadlock where one thread has a wapbl transaction, calls VOP_GETPAGES
and wants to busy a page while another thread calls VOP_PUTPAGES on the same
vnode, takes pages busy and wants to start a wapbl transaction.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.11  14-Aug-2008  yamt remove always-true conditionals.
 1.10  11-Aug-2008  yamt constify
 1.9  31-Jul-2008  simonb Merge the simonb-wapbl branch. From the original branch commit:

Add Wasabi System's WAPBL (Write Ahead Physical Block Logging)
journaling code. Originally written by Darrin B. Jewell while
at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

OK'd by core@, releng@.
 1.8  04-Jun-2008  ad branches: 1.8.2; 1.8.4;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.7  14-May-2008  reinoud Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.6  19-Apr-2008  hannken branches: 1.6.2; 1.6.4;
Remove a race when pages are released while waiting for fstrans_start().

Fixes PR #38460
 1.5  18-Jan-2008  yamt branches: 1.5.6; 1.5.8;
genfs_do_putpages: DEBUG checks.
 1.4  18-Jan-2008  yamt genfs_do_putpages: ensure that we clean the vnode in the case of PGO_RECLAIM.
 1.3  18-Jan-2008  yamt push pmap_clear_reference calls into pdpolicy code, where reference bits
actually matter.
 1.2  02-Jan-2008  ad Merge vmlocking2 to head.
 1.1  17-Oct-2007  pooka branches: 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12; 1.1.14; 1.1.16; 1.1.20;
Split I/O-related routines (getpages, putpages, etc.) which are heavily
tied to uvm out of genfs_vnops into genfs_io.c
 1.1.20.2  19-Jan-2008  bouyer Sync with HEAD
 1.1.20.1  02-Jan-2008  bouyer Sync with HEAD
 1.1.16.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.1.14.4  23-Mar-2008  matt sync with HEAD
 1.1.14.3  09-Jan-2008  matt sync with HEAD
 1.1.14.2  06-Nov-2007  matt sync with HEAD
 1.1.14.1  17-Oct-2007  matt file genfs_io.c was added on branch matt-armv6 on 2007-11-06 23:33:16 +0000
 1.1.12.1  18-Feb-2008  mjf Sync with HEAD.
 1.1.10.3  21-Jan-2008  yamt sync with head
 1.1.10.2  27-Oct-2007  yamt sync with head.
 1.1.10.1  17-Oct-2007  yamt file genfs_io.c was added on branch yamt-lazymbuf on 2007-10-27 11:35:52 +0000
 1.1.8.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.1.8.1  17-Oct-2007  joerg file genfs_io.c was added on branch jmcneill-pm on 2007-10-26 15:48:52 +0000
 1.1.6.2  23-Oct-2007  ad Sync with head.
 1.1.6.1  17-Oct-2007  ad file genfs_io.c was added on branch vmlocking on 2007-10-23 20:36:43 +0000
 1.1.4.2  18-Oct-2007  yamt sync with head.
 1.1.4.1  17-Oct-2007  yamt file genfs_io.c was added on branch yamt-x86pmap on 2007-10-18 08:33:12 +0000
 1.5.8.2  17-Jun-2008  yamt sync with head.
 1.5.8.1  18-May-2008  yamt sync with head.
 1.5.6.4  17-Jan-2009  mjf Sync with HEAD.
 1.5.6.3  28-Sep-2008  mjf Sync with HEAD.
 1.5.6.2  05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.5.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.6.4.3  10-Oct-2008  skrll Sync with HEAD.
 1.6.4.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.6.4.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.2.5  09-Oct-2010  yamt sync with head
 1.6.2.4  11-Aug-2010  yamt sync with head.
 1.6.2.3  11-Mar-2010  yamt sync with head
 1.6.2.2  04-May-2009  yamt sync with head.
 1.6.2.1  16-May-2008  yamt sync with head.
 1.8.4.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.4.1  19-Oct-2008  haad Sync with HEAD.
 1.8.2.1  10-Jun-2008  simonb Initial commit of Wasabi System's WAPBL (Write Ahead Physical Block
Logging) journaling code. Originally written by Darrin B. Jewell
while at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

Still a number of issues - look in doc/BRANCHES for "simonb-wapbl"
for more info.
 1.13.4.5  21-Apr-2012  riz Back out a commit included in the ticket 1750 patch which obviously
doesn't belong there.
 1.13.4.4  21-Apr-2012  riz Pull up following revision(s) (requested by spz in ticket #1750):
crypto/dist/openssl/crypto/mem.c patch
crypto/dist/openssl/crypto/asn1/a_d2i_fp.c patch
crypto/dist/openssl/crypto/buffer/buffer.c patch
sys/miscfs/genfs/genfs_io.c patch

Address CVE-2012-2110.
[spz, ticket #1750]
 1.13.4.3  07-Sep-2010  bouyer branches: 1.13.4.3.2;
Pull up following revision(s) (requested by chs in ticket #1448):
sys/uvm/uvm_pager.h: revision 1.39 via patch
sys/miscfs/genfs/genfs_vnops.c: revision 1.183 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.83 via patch
sys/miscfs/genfs/genfs_io.c: revision 1.40 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.20 via patch
replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings. instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.
 1.13.4.2  04-Apr-2009  snj branches: 1.13.4.2.2; 1.13.4.2.4;
Pull up following revision(s) (requested by joerg in ticket #664):
sys/miscfs/genfs/genfs_io.c: revision 1.16
Check that the filesystem acutally uses WAPBL before initiating a
transaction for the directio case. Fixes PR 39929 and similiar issues
seen with PostgreSQL.
 1.13.4.1  02-Nov-2008  snj Pull up following revision(s) (requested by tron in ticket #9):
sys/nfs/nfs_bio.c: revision 1.180
sys/miscfs/genfs/genfs_io.c: revision 1.14
sys/uvm/uvm_extern.h: revision 1.149
- allocate 8 pointers on the stack to avoid stack overflow in nfs.
- make that 8 a constant
- remove bogus panic
 1.13.4.3.2.2  21-Apr-2012  riz Back out a commit included in the ticket 1750 patch which obviously
doesn't belong there.
 1.13.4.3.2.1  21-Apr-2012  riz Pull up following revision(s) (requested by spz in ticket #1750):
crypto/dist/openssl/crypto/mem.c patch
crypto/dist/openssl/crypto/asn1/a_d2i_fp.c patch
crypto/dist/openssl/crypto/buffer/buffer.c patch
sys/miscfs/genfs/genfs_io.c patch

Address CVE-2012-2110.
[spz, ticket #1750]
 1.13.4.2.4.5  29-Feb-2012  matt Improve UVM_PAGE_TRKOWN.
Add more asserts to uvm_page.
 1.13.4.2.4.4  09-Feb-2012  matt Change to use the updated uvm_pageout_* signature.
 1.13.4.2.4.3  25-May-2011  matt Make uvm_map recognize UVM_FLAG_COLORMATCH which tells uvm_map that the
'align' argument specifies the starting color of the KVA range to be returned.

When calling uvm_km_alloc with UVM_KMF_VAONLY, also specify the starting
color of the kva range returned (UMV_KMF_COLORMATCH) and pass those to
uvm_map.

In uvm_pglistalloc, make sure the pages being returned have sequentially
advancing colors (so they can be mapped in a contiguous address range).
Add a few missing UVM_FLAG_COLORMATCH flags to uvm_pagealloc calls.

Make the socket and pipe loan color-safe.

Make the mips pmap enforce strict page color (color(VA) == color(PA)).
 1.13.4.2.4.2  20-May-2011  matt bring matt-nb5-mips64 up to date with netbsd-5-1-RELEASE (except compat).
 1.13.4.2.4.1  29-Apr-2011  matt Fix placement of #ifdef DEBUG / #endif
 1.13.4.2.2.3  21-Apr-2012  riz Back out a commit included in the ticket 1750 patch which obviously
doesn't belong there.
 1.13.4.2.2.2  21-Apr-2012  riz Pull up following revision(s) (requested by spz in ticket #1750):
crypto/dist/openssl/crypto/mem.c patch
crypto/dist/openssl/crypto/asn1/a_d2i_fp.c patch
crypto/dist/openssl/crypto/buffer/buffer.c patch
sys/miscfs/genfs/genfs_io.c patch

Address CVE-2012-2110.
[spz, ticket #1750]
 1.13.4.2.2.1  07-Sep-2010  bouyer Pull up following revision(s) (requested by chs in ticket #1448):
sys/uvm/uvm_pager.h: revision 1.39 via patch
sys/miscfs/genfs/genfs_vnops.c: revision 1.183 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.83 via patch
sys/miscfs/genfs/genfs_io.c: revision 1.40 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.20 via patch
replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings. instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.
 1.13.2.3  28-Apr-2009  skrll Sync with HEAD.
 1.13.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.13.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.18.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.36.4.5  31-May-2011  rmind sync with head
 1.36.4.4  21-Apr-2011  rmind sync with head
 1.36.4.3  05-Mar-2011  rmind sync with head
 1.36.4.2  17-Mar-2010  rmind Reorganise UVM locking to protect P->V state and serialise pmap(9)
operations on the same page(s) by always locking their owner. Hence
lock order: "vmpage"-lock -> pmap-lock.

Patch, proposed on tech-kern@, from Andrew Doran.
 1.36.4.1  16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.36.2.65  11-Feb-2011  uebayasi Clean up debug code.
 1.36.2.64  21-Nov-2010  uebayasi Clarify things a bit in XIP putpages.
 1.36.2.63  21-Nov-2010  uebayasi Put back XIP putpages, but slightly modifed to be called from the
generic putpages, and to call pgo_get() than a specific function.
Without this, UVM went mad after unmount (vinval, etc.).
 1.36.2.62  21-Nov-2010  uebayasi Rename PGO_ZERO as PGO_HOLE, and s/uvm_page_zeropage/uvm_page_holepage/.
 1.36.2.61  21-Nov-2010  uebayasi Assert.
 1.36.2.60  21-Nov-2010  uebayasi Resurrect PGO_ZERO support.

When vnode pager encounters hole pages in XIP'ed vnodes, it fills
page slots with PGO_ZERO and returns them back to the caller (fault
handler). Fault handlers are responsible to check page slots and
redirect PGO_ZERO to the single "zero page" allocated by calling
uvm_page_zeropage_alloc(9).

The zero page is wired, read-only (PG_RDONLY) page. It's shared
by multiple vnodes, it has no single owner.

XIP'ed vnodes are supposed to be "stable" during I/O (unlocked).
Because XIP'ed mounts are always read-only. There's no chance to
change mappings of XIP'ed vnodes and their XIP'ed pages. Thus the
cached uobj is reused after pgo_get() for PGO_ZERO.

(Do we need a new concept of "read-only UVM object"?)
 1.36.2.59  21-Nov-2010  uebayasi Revert XIP putpages totally.

XIP'ed uobj owns no pages; uvm_object::uo_npages is always 0,
nothing happens.

Upper layer is responsible to unmap pmap-level mappings.
 1.36.2.58  21-Nov-2010  uebayasi Clean up, reduce diff from trunk.
 1.36.2.57  21-Nov-2010  uebayasi Merge getpages finalization code.

In XIP case, there's nothing to do because MMIO device pages are
"staleless", unlike page caches used as I/O buffers.
 1.36.2.56  21-Nov-2010  uebayasi Kill one more goto.
 1.36.2.55  21-Nov-2010  uebayasi Clean up gotos.
 1.36.2.54  21-Nov-2010  uebayasi Clean up ifdefs.
 1.36.2.53  21-Nov-2010  uebayasi Adjust merged XIP getpages page slot offset calculation again so
it really works. Sprinkle a few assertions and UVMHISTs.
 1.36.2.52  20-Nov-2010  uebayasi genfs_do_getpages_xip_io_done: Adjust page condition checks:
- Expect uvn_findpage_xip() returns busy pages.
- Device pages are always initialized (== !uninitialized == !fake).
 1.36.2.51  20-Nov-2010  uebayasi XIP has no "fake" (== unitinialized) pages, because pages are
already initialized when mounted. Adjust getpages loop again.
 1.36.2.50  20-Nov-2010  uebayasi Adjust again when heading page slots are skipped.
 1.36.2.49  20-Nov-2010  uebayasi Fix a bug (offset calculation) in the previous.
 1.36.2.48  20-Nov-2010  uebayasi Snapshot of getpages BMAP loop merge.
 1.36.2.47  19-Nov-2010  uebayasi genfs_*_xip_io: Adjust start offset.
 1.36.2.46  19-Nov-2010  uebayasi Comment.
 1.36.2.45  19-Nov-2010  uebayasi Remove unused code.
 1.36.2.44  19-Nov-2010  uebayasi More adjustment.

Reorder
genfs_node_unlock() -> putiobuf()
to
putiobuf() -> genfs_node_unlock()
but I don't think there's any constraint between these two.
 1.36.2.43  19-Nov-2010  uebayasi Share mode code. Care glock.
 1.36.2.42  19-Nov-2010  uebayasi Reduce code duplication.
 1.36.2.41  19-Nov-2010  uebayasi Reduce code.
 1.36.2.40  19-Nov-2010  uebayasi Reduce unnecessary code.
 1.36.2.39  19-Nov-2010  uebayasi Call XIP getpages() from within the generic one.
 1.36.2.38  19-Nov-2010  uebayasi Really remove XIP hole code.
 1.36.2.37  19-Nov-2010  uebayasi Comment out XIP hole page redirection code. Since makefs(8) doesn't
support hole, and these code paths can be never tested.

(The current XIP is read-only, so hole pages are pointless in
practice.)
 1.36.2.36  19-Nov-2010  uebayasi Adjust XIP putpages to I/O XIP getpages.
 1.36.2.35  19-Nov-2010  uebayasi Make XIP genfs_getpages_xip() return pages in I/O path, preparing
merge into the generic genfs_getpages().
 1.36.2.34  18-Nov-2010  uebayasi Make XIP pager use cdev_mmap() instead of struct vm_physseg.
 1.36.2.33  18-Nov-2010  uebayasi Style change.
 1.36.2.32  16-Nov-2010  uebayasi Factor out the part which lookups physical page "identity" from
UVM object, into sys/uvm/uvm_vnode.c:uvn_findpage_xip(). Eventually
this will become a call to cdev UVM object pager.
 1.36.2.31  15-Nov-2010  uebayasi Move zero-page into a common place, in the hope that it's shared
for other purposes.

According to Chuck Silvers, zero-page mappings don't need to be
explicitly unmapped in putpages(). Follow that advice.
 1.36.2.30  06-Nov-2010  uebayasi Sync with HEAD.
 1.36.2.29  04-Nov-2010  uebayasi Split physical device segment pages from "managed" to "managed
device". Cache that information as a flag PG_DEVICE so that callers
don't need to walk physsegs everytime.

Remove PQ_FIXED, which means that page daemon doesn't need to know
device segment pages at all. But still fault handlers need to know
them.

I think this is what I can do best now.
 1.36.2.28  04-Nov-2010  uebayasi Remove a XXX comment which is only confusing.
 1.36.2.27  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.36.2.26  27-Sep-2010  uebayasi genfs_do_getpages_xip1: Adjust locking. Although XIP never does real I/O,
it's called without PGO_LOCKED in some cases. Leave vmobjlock unlocked in
that case.
 1.36.2.25  26-Sep-2010  uebayasi Minor fixes.
 1.36.2.24  26-Sep-2010  uebayasi Implement XIP "putpages". Invalidate MMU mappings of pages at the
request of PGO_FREE. PGO_DEACTIVATE and PGO_CLEANIT do nothing, because
XIP pages are neither queued nor writable.

Allocate read-only "zero" page per vnode. Put it at offset 0 of vnode's
uvm_object. This per-vnode "zero" page is mapped to all hole pages of
the vnode. If one of its mapped pages are forced to be PGO_FREE'ed,
all the mappings are invalidated.
 1.36.2.23  26-Sep-2010  uebayasi Wrap long lines.
 1.36.2.22  25-Aug-2010  uebayasi Fix UVMHIST build.

Remove a comment about xip getpages optimization; quick profiling showed
that this routine is not expensive. It'd be better to concentrate on
reducing TLB miss.
 1.36.2.21  17-Aug-2010  uebayasi Sync with HEAD.
 1.36.2.20  12-Aug-2010  uebayasi vm_physseg::start is PFN, not mdpgno, so don't decode it using
pmap_phys_address().
 1.36.2.19  11-Aug-2010  uebayasi In XIP vnode pager, assert that filesystem blocks and pages are aligned.
 1.36.2.18  22-Jul-2010  uebayasi s/PG_XIP/PQ_FIXED/, meaning that the fault handler sees XIP pages as
"fixed", and doesn't pass them to paging activity.

("XIP" is a vnode specific knowledge. It was wrong that the fault
handler had to know such a special thing.)
 1.36.2.17  20-Jul-2010  uebayasi genfs_do_getpages_xip: Simplify code.
 1.36.2.16  15-Jul-2010  uebayasi s/PG_DIRECT/PG_XIP/
 1.36.2.15  12-Jul-2010  uebayasi Reduce more diff by backing out XIP page specific code. Allow XIP pages
to be loaned.
 1.36.2.14  09-Jul-2010  uebayasi opt_direct_page.h is no more.
 1.36.2.13  09-Jul-2010  uebayasi Mark XIP pages as PG_CLEAN and/or PG_BUSY when appropriate. Protect
vnode lock when vm_page::flags is manipulated.
 1.36.2.12  07-Jul-2010  uebayasi To simplify things, revert global vm_page_md hash and allocate struct
vm_page [] for XIP physical segments.
 1.36.2.11  06-Jul-2010  uebayasi Directly allocate zero'ed vm_page for XIP unallocated blocks, instead
of abusing pool page. Move the code to XIP vnode pager in genfs_io.c.
 1.36.2.10  08-Jun-2010  uebayasi Comment.
 1.36.2.9  07-Jun-2010  uebayasi Comment.
 1.36.2.8  31-May-2010  uebayasi Re-define the definition of "device page"; device pages are pages of
device memory. Pages which don't have vm_page (== can't be used for
generic use), but whose PV are tracked, are called "direct pages" from
now.
 1.36.2.7  28-Apr-2010  uebayasi When mounting a block device as XIP, pass registered struct vm_physseg
* as a cookie from the block device to the caller (== mount code).
struct vm_physseg * will be passed to XIP vnode pager
(genfs_do_getpages_xip()), then converted back to paddr_t.

(My future plan is to pass struct vm_physseg * back to the fault handler,
and to pmap_enter() as is.)
 1.36.2.6  23-Mar-2010  uebayasi Put run-time XIP-specific per-mount data in struct specdev, not struct mount.
 1.36.2.5  17-Mar-2010  uebayasi Put comments to reflect my intent about genfs_do_getpages_xip method.
 1.36.2.4  28-Feb-2010  uebayasi Don't always enable XIP on this branch to prepare the merge. Fix build
without XIP in places.
 1.36.2.3  28-Feb-2010  uebayasi To mount block devices as XIP, pass physical address "cookie" used by
bus_space_mmap(9) / pmap_phys_addr(9) via struct mount.
 1.36.2.2  23-Feb-2010  uebayasi genfs_do_getpages_xip: Drop vmobjlock before calling VOP_BMAP, otherwise
deadlock. No idea how this worked for me before.

Directly call uvm_phys_to_vm_page_device() to make a device page cookie.
 1.36.2.1  11-Feb-2010  uebayasi genfs_getpages() for XIP.

Pages are directly mappable, and always there. What we need to do here is
to address filesystem blocks and tell those addresses back to the fault
handler by encoding the physical addresses in struct vm_page * pointers.

(I hate code duplication. What can I do?)
 1.46.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.48.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.53.8.1  07-May-2012  riz Pull up following revision(s) (requested by chs in ticket #204):
sys/fs/sysvbfs/sysvbfs_vnops.c: revision 1.44
sys/ufs/ffs/ffs_vfsops.c: revision 1.277
sys/fs/v7fs/v7fs_vnops.c: revision 1.11
sys/ufs/chfs/chfs_vnops.c: revision 1.7
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.61
sys/miscfs/genfs/genfs_io.c: revision 1.54
sys/kern/vfs_wapbl.c: revision 1.52
sys/uvm/uvm_pager.h: revision 1.43
sys/ufs/ffs/ffs_vnops.c: revision 1.121
sys/kern/vfs_subr.c: revision 1.434
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.83
sys/fs/ntfs/ntfs_vnops.c: revision 1.51
sys/fs/udf/udf_subr.c: revision 1.119
sys/miscfs/specfs/spec_vnops.c: revision 1.135
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.103
sys/fs/udf/udf_vnops.c: revision 1.71
sys/ufs/ufs/ufs_readwrite.c: revision 1.104
change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
mark all wapbl I/O as BPRIO_TIMECRITICAL.
this is the second part of addressing PR 46325.
 1.53.6.1  02-Jun-2012  mrg sync to latest -current.
 1.53.2.19  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.53.2.18  22-Apr-2013  yamt revert unnecessary diff
 1.53.2.17  02-Nov-2012  yamt tweak integrity_sync cases
some comments
 1.53.2.16  01-Aug-2012  yamt - fix integrity sync.
putpages for integrity sync (fsync, msync with MS_SYNC, etc) should not
skip pages being written back by other threads.

- adapt to radix tree tag api changes.
 1.53.2.15  01-Aug-2012  yamt remove stale comments
 1.53.2.14  23-May-2012  yamt sync with head.
 1.53.2.13  17-Feb-2012  yamt byebye PG_HOLE as it turned out to be unnecessary.
 1.53.2.12  05-Feb-2012  yamt genfs_gop_write_rwmap: comment
 1.53.2.11  05-Feb-2012  yamt use unsigned
comments
assertions
 1.53.2.10  25-Jan-2012  yamt comment
 1.53.2.9  24-Jan-2012  yamt - g/c #if 0'ed code
- minor optimization
- comments
 1.53.2.8  18-Jan-2012  yamt - bug fixes
- minor optimizations
- assertions
- comments
 1.53.2.7  14-Jan-2012  yamt fix overwrite case
 1.53.2.6  20-Dec-2011  yamt don't inline uvn_findpages in genfs_io.
 1.53.2.5  30-Nov-2011  yamt g/c #if 1
comment
 1.53.2.4  26-Nov-2011  yamt - uvm_page_array_fill: add some more parameters
- uvn_findpages: use gang-lookup
- genfs_putpages: re-enable backward clustering
- mechanical changes after the recent radixtree.h api changes
 1.53.2.3  20-Nov-2011  yamt - simplify code
- comments
 1.53.2.2  10-Nov-2011  yamt - remove uobj->memq
- fix UVM_PAGE_TRKOWN
- comments
 1.53.2.1  02-Nov-2011  yamt page cache related changes

- maintain object pages in radix tree rather than rb tree.
- reduce unnecessary page scan in putpages. esp. when an object has a ton of
pages cached but only a few of them are dirty.
- reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
- fix nfs commit range tracking.
- fix nfs write clustering. XXX hack
 1.55.4.1  18-May-2014  rmind sync with head
 1.55.2.4  03-Dec-2017  jdolecek update from HEAD
 1.55.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.2.2  10-Oct-2012  bouyer We know vp is not NULL, no need to check
 1.55.2.1  12-Sep-2012  tls Initial snapshot of work to eliminate 64K MAXPHYS. Basically works for
physio (I/O to raw devices); needs more doing to get it going with the
filesystems, but it shouldn't damage data.

All work's been done on amd64 so far. Not hard to add support to other
ports. If others want to pitch in, one very helpful thing would be to
sort out when and how IDE disks can do 128K or larger transfers, and
adjust the various PCI IDE (or at least ahcisata) drivers and wd.c
accordingly -- it would make testing much easier. Another very helpful
thing would be to implement a smart minphys() for RAIDframe along the
lines detailed in the MAXPHYS-NOTES file.
 1.58.6.3  28-Aug-2017  skrll Sync with HEAD
 1.58.6.2  05-Oct-2016  skrll Sync with HEAD
 1.58.6.1  06-Jun-2015  skrll Sync with HEAD
 1.61.2.3  26-Apr-2017  pgoyette Sync with HEAD
 1.61.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.61.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.63.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.68.6.3  02-Nov-2017  snj Pull up following revision(s) (requested by pgoyette in ticket #335):
share/man/man9/kernhist.9: 1.5-1.8
sys/arch/acorn26/acorn26/pmap.c: 1.39
sys/arch/arm/arm32/fault.c: 1.105 via patch
sys/arch/arm/arm32/pmap.c: 1.350, 1.359
sys/arch/arm/broadcom/bcm2835_bsc.c: 1.7
sys/arch/arm/omap/if_cpsw.c: 1.20
sys/arch/arm/omap/tiotg.c: 1.7
sys/arch/evbarm/conf/RPI2_INSTALL: 1.3
sys/dev/ic/sl811hs.c: 1.98
sys/dev/usb/ehci.c: 1.256
sys/dev/usb/if_axe.c: 1.83
sys/dev/usb/motg.c: 1.18
sys/dev/usb/ohci.c: 1.274
sys/dev/usb/ucom.c: 1.119
sys/dev/usb/uhci.c: 1.277
sys/dev/usb/uhub.c: 1.137
sys/dev/usb/umass.c: 1.160-1.162
sys/dev/usb/umass_quirks.c: 1.100
sys/dev/usb/umass_scsipi.c: 1.55
sys/dev/usb/usb.c: 1.168
sys/dev/usb/usb_mem.c: 1.70
sys/dev/usb/usb_subr.c: 1.221
sys/dev/usb/usbdi.c: 1.175
sys/dev/usb/usbdi_util.c: 1.67-1.70
sys/dev/usb/usbroothub.c: 1.3
sys/dev/usb/xhci.c: 1.75
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: 1.34
sys/kern/kern_history.c: 1.15
sys/kern/kern_xxx.c: 1.74
sys/kern/vfs_bio.c: 1.275-1.276
sys/miscfs/genfs/genfs_io.c: 1.71
sys/sys/kernhist.h: 1.21
sys/ufs/ffs/ffs_balloc.c: 1.63
sys/ufs/lfs/lfs_vfsops.c: 1.361
sys/ufs/lfs/ulfs_inode.c: 1.21
sys/ufs/lfs/ulfs_vnops.c: 1.52
sys/ufs/ufs/ufs_inode.c: 1.102
sys/ufs/ufs/ufs_vnops.c: 1.239
sys/uvm/pmap/pmap.c: 1.37-1.39
sys/uvm/pmap/pmap_tlb.c: 1.22
sys/uvm/uvm_amap.c: 1.108
sys/uvm/uvm_anon.c: 1.64
sys/uvm/uvm_aobj.c: 1.126
sys/uvm/uvm_bio.c: 1.91
sys/uvm/uvm_device.c: 1.66
sys/uvm/uvm_fault.c: 1.201
sys/uvm/uvm_km.c: 1.144
sys/uvm/uvm_loan.c: 1.85
sys/uvm/uvm_map.c: 1.353
sys/uvm/uvm_page.c: 1.194
sys/uvm/uvm_pager.c: 1.111
sys/uvm/uvm_pdaemon.c: 1.109
sys/uvm/uvm_swap.c: 1.175
sys/uvm/uvm_vnode.c: 1.103
usr.bin/vmstat/vmstat.c: 1.219
Reorder to test for null before null deref in debug code
--
Reorder to test for null before null deref in debug code
--
KNF
--
No need for '\n' in UVMHIST_LOG
--
normalise a BIOHIST log message
--
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...
(As proposed on tech-kern@ with additional changes and enhancements.)
Details of changes:
* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)
* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.
* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.
* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."
* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.
* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).
* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).
* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.
* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.
[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3)
format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".
[2] I've tried very hard to find "all [the] existing users of
kernhist(9)"
but it is possible that I've missed some of them. I would be glad
to
update any stragglers that anyone identifies.
--
For some reason this single kernel seems to have outgrown its declared
size as a result of the kernhist(9) changes. Bump the size.
XXX The amount of increase may be excessive - anyone with more detailed
XXX knowledge please feel free to further adjust the value
appropriately.
--
Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit
--
And yet another one. :(
--
Use correct mark-up for NetBSD version.
--
More improvements in grammar and readability.
--
Remove a stray '"' (obvious typo) and add a couple of casts that are
probably needed.
--
And replace an instance of "%p" conversion with "%#jx"
--
Whitespace fix. Give Bl tag table a width. Fix Xr.
 1.68.6.2  05-Jul-2017  martin Pull up following revision(s) (requested by hannken in ticket #84):
sys/miscfs/genfs/genfs_io.c: revision 1.70
Add missing check for dead or dying vnode to the entry of genfs_getpages().
 1.68.6.1  04-Jun-2017  bouyer pullup the following revisions, requested by hannken in ticket #2:
src/share/man/man9/fstrans.9 1.25
src/sys/kern/vfs_mount.c 1.66
src/sys/kern/vfs_subr.c 1.468
src/sys/kern/vfs_trans.c 1.46
src/sys/kern/vfs_vnode.c 1.94, 1.95, 1.96
src/sys/kern/vnode_if.c 1.105, 1.106
src/sys/kern/vnode_if.sh 1.65, 1.66
src/sys/kern/vnode_if.src 1.76
src/sys/miscfs/genfs/genfs_io.c 1.69
src/sys/miscfs/genfs/genfs_vnops.c 1.196, 1.197
src/sys/miscfs/genfs/layer_extern.h 1.40
src/sys/miscfs/genfs/layer_vfsops.c 1.51
src/sys/miscfs/genfs/layer_vnops.c 1.67
src/sys/miscfs/nullfs/null_vnops.c 1.42
src/sys/miscfs/overlay/overlay_vnops.c 1.24
src/sys/miscfs/umapfs/umap_vnops.c 1.60
src/sys/rump/include/rump/rumpvnode_if.h 1.29, 1.30
src/sys/rump/librump/rumpkern/emul.c 1.182
src/sys/rump/librump/rumpvfs/rumpvnode_if.c 1.29, 1.30
src/sys/sys/fstrans.h 1.11
src/sys/sys/vnode.h 1.278
src/sys/sys/vnode_if.h 1.100, 1.101
src/sys/sys/vnode_impl.h 1.14, 1.15
src/sys/ufs/lfs/lfs_pages.c 1.12

Vnode state, lock and fstrans cleanup:
- Rename vnode state "VS_ACTIVE" to "VS_LOADED" and add synthetic
state "VS_ACTIVE" to assert a loaded vnode with usecount > 0.

- Redo FSTRANS in vnode_if.c and use it for VOP_LOCK and VOP_UNLOCK.

- Cleanup the genfs lock operations.

- Make "struct vnode_impl" member "vi_lock" a krwlock_t again.

- Remove the lock type argument from fstrans_start and
fstrans_start_nowait,
remove now unused FSTRANS state "FSTRANS_SUSPENDING".
 1.71.2.2  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.71.2.1  25-Jun-2018  pgoyette Sync with HEAD
 1.72.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.72.2.1  10-Jun-2019  christos Sync with HEAD
 1.83.2.2  29-Feb-2020  ad Sync with head.
 1.83.2.1  17-Jan-2020  ad Sync with head.

RSS XML Feed