Commit Graph

3113 Commits

Author SHA1 Message Date
pgoyette 9aa9288552 Regen 2020-01-21 02:38:25 +00:00
ad c2e9cb9413 VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode.  Matches
FreeBSD.
2020-01-17 20:08:06 +00:00
ad 05a3457e85 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.
2020-01-15 17:55:43 +00:00
ad 2ddceed1d9 Hopefully fix some problems seen with MP support on non-x86, in particular
where curcpu() is defined as curlwp->l_cpu:

- mi_switch(): undo the ~2007ish optimisation to unlock curlwp before
  calling cpu_switchto().  It's not safe to let other actors mess with the
  LWP (in particular l->l_cpu) while it's still context switching.  This
  removes l->l_ctxswtch.

- Move the LP_RUNNING flag into l->l_flag and rename to LW_RUNNING since
  it's now covered by the LWP's lock.

- Ditch lwp_exit_switchaway() and just call mi_switch() instead.  Everything
  is in cache anyway so it wasn't buying much by trying to avoid saving old
  state.  This means cpu_switchto() will never be called with prevlwp ==
  NULL.

- Remove some KERNEL_LOCK handling which hasn't been needed for years.
2020-01-08 17:38:41 +00:00
ad afb661980d Regen. 2020-01-08 12:06:09 +00:00
ad d1f2c5511e Regen. 2020-01-06 11:23:31 +00:00
para 1682d72797 remove unused predicate function
likely unused since kmem changes
2020-01-05 15:57:15 +00:00
ad 26972d1c77 rump: initialize pg->interlock 2020-01-02 16:56:58 +00:00
thorpej d6c967bb85 - Eliminate the global "boottime" variable, which was being accessed
without any synchronization against changes by e.g. clock_settime().
- Replace with new getbinboottime() / getnanoboottime() / getmicroboottime()
  functions (naming mirrors that of other time access functions in kern_tc.c).
  It returns the (maybe-converted) value of timebasebin, which also tracks
  our estimate of when the system was booted (i.e. the legacy "boottime" was
  redundant).

XXX There needs to be a lockless synchronization mechanism for reading
timebasebin, but this is a problem in kern_tc.c that pre-existed these
"boottime" changes.  At least now the problem is centralized in one location.
2020-01-02 15:42:26 +00:00
martin 38e2db7699 Add shutting_down variable for rump. 2020-01-02 08:49:10 +00:00
ad 60fa01590b Fix rump. 2019-12-31 23:32:05 +00:00
ad 5c06357c90 Rename uvm_free() -> uvm_availmem(). 2019-12-31 13:07:09 +00:00
ad b78a6618bd Rename uvm_page_locked_p() -> uvm_page_owner_locked_p() 2019-12-31 12:40:27 +00:00
ad f391f83641 Add uvm_free(): returns number of free pages in system. 2019-12-21 12:58:26 +00:00
ad dd632e5898 Split subr_cpu.c out of kern_cpu.c, to contain routines shared with rump. 2019-12-20 21:20:09 +00:00
mlelstv cea9bbee01 Add error and zero targets to build. 2019-12-17 07:57:25 +00:00
ad 5b04a37fe9 Rump is living up to its name 2019-12-17 00:51:28 +00:00
ad a98966d3dc - Extend the per-CPU counters matt@ did to include all of the hot counters
in UVM, excluding uvmexp.free, which needs special treatment and will be
  done with a separate commit.  Cuts system time for a build by 20-25% on
  a 48 CPU machine w/DIAGNOSTIC.

- Avoid 64-bit integer divide on every fault (for rnd_add_uint32).
2019-12-16 22:47:54 +00:00
ad 881d12e6f2 Merge from yamt-pagecache:
- do gang lookup of pages using radixtree.
- remove now unused uvm_object::uo_memq and vm_page::listq.queue.
2019-12-15 21:11:34 +00:00
pgoyette cd4e04efe1 Initialize the module_hook synchronization variables in rump, too.
Fixes recently reported test failures for dev/sysmon/t_swsensor
and net/if_vlan/t_vlan
2019-12-15 14:21:34 +00:00
ad 6857513180 Merge from yamt-pagecache: use radixtree for page lookup.
rbtree page lookup was introduced during the NetBSD 5.0 development cycle to
bypass lock contention problems with the (then) global page hash, and was a
temporary solution to allow us to make progress.  radixtree is the intended
replacement.

Ok yamt@.
2019-12-14 17:28:58 +00:00
ad 5978ddc663 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
2019-12-13 20:10:21 +00:00
pgoyette f01c2b4e29 Eliminate per-hook duplication of common code as suggested by
(and with major contributions from) riastradh@

Welcome to 9.99.23
2019-12-12 22:55:20 +00:00
riastradh 131828f69c Restore call to pserialize_init.
We need it after all for psz_lock on the event counter.
2019-12-07 14:55:58 +00:00
riastradh 38e3ff59e6 Missed a spot in the crypto/arc4 deletion. 2019-12-05 03:57:55 +00:00
riastradh fd49f423fd Fix rump definition of cpu_number(). 2019-12-04 03:04:52 +00:00
riastradh a0c864ecf3 Rip out pserialize(9) logic now that the RCU patent has expired.
pserialize_perform() is now basically just xc_barrier(XC_HIGHPRI).
No more tentacles throughout the scheduler.  Simplify the psz read
count for diagnostic assertions by putting it unconditionally into
cpu_info.

From rmind@, tidied up by me.
2019-12-03 05:07:48 +00:00
ad ea045f02e7 Another instance of cpu_onproc to replace. 2019-12-01 19:21:13 +00:00
ad bcbc56a72a Regen. 2019-12-01 18:32:07 +00:00
ad f278a3b979 Add ci_onproc. 2019-12-01 18:29:26 +00:00
ad 64e45337af cpu_onproc -> ci_onproc 2019-12-01 18:12:51 +00:00
ad 94bb47e411 Regen for VOP_LOCK & LK_UPGRADE/LK_DOWNGRADE. 2019-12-01 13:58:52 +00:00
ad ce41050c72 Regen. 2019-12-01 13:46:34 +00:00
ad 566436656a namecache changes:
- Delete the per-entry lock, and borrow the associated vnode's v_interlock
  instead.  We need to acquire it during lookup anyway.  We can revisit this
  in the future but for now it's a stepping stone, and works within the
  quite limited context of what we have (BSD namecache/lookup design).

- Implement an idea that Mateusz Guzik (mjg@FreeBSD.org) gave me.  In
  cache_reclaim(), we don't need to lock out all of the CPUs to garbage
  collect entries.  All we need to do is observe their locks unheld at least
  once: then we know they are not in the critical section, and no longer
  have visibility of the entries about to be garbage collected.

- The above makes it safe for sysctl to take only namecache_lock to get stats,
  and we can remove all the crap dealing with per-CPU locks.

- For lockstat, make namecache_lock a static now we have __cacheline_aligned.

- Avoid false sharing - don't write back to nc_hittime unless it has changed.
  Put a a comment in place explaining this.  Pretty sure this was there in
  2008/2009 but someone removed it (understandably, the code looks weird).

- Use a mutex to protect the garbage collection queue instead of atomics, and
  adjust the low water mark up so that cache_reclaim() isn't doing so much
  work at once.
2019-12-01 13:39:53 +00:00
ad 11ba4e1830 Minor scheduler cleanup:
- Adapt to cpu_need_resched() changes. Avoid lost & duplicate IPIs and ASTs.
  sched_resched_cpu() and sched_resched_lwp() contain the logic for this.
- Changes for LSIDL to make the locking scheme match the intended design.
- Reduce lock contention and false sharing further.
- Numerous small bugfixes, including some corrections for SCHED_FIFO/RT.
- Use setrunnable() in more places, and merge cut & pasted code.
2019-11-23 19:42:52 +00:00
kamil 77a1ad5f00 Switch the iconv(3) prototype to the POSIX conformant variation
Remove const from the 2nd argument.

const char ** and char ** are incompatible types and it was a cost to keep
the technically incompatible form for a more purist variation. NetBSD was
almost the last alive OS to still keep the const argument (known leftovers:
Minix and Illumos).

Keep the const form for the internal purposes inside citrus and rump.

Address the build breakage fallout in the same change.

There are no ABI changes.

Change accepted by core@.
2019-10-24 18:17:14 +00:00
christos 075f50f56a Add a function cast for enosys 2019-10-15 18:36:38 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
christos 916f96072a regen 2019-10-09 01:43:35 +00:00
uwe edcef67ec2 xc_barrier - convenience function to xc_broadcast() a nop.
Make the intent more clear and also avoid a bunch of (xcfunc_t)nullop
casts that gcc 8 -Wcast-function-type is not happy about.
2019-10-06 15:11:16 +00:00
mrg 21303c93e9 convert HAVE_GCC == 7 to HAVE_GCC >= 7. 2019-09-29 23:44:58 +00:00
bad 62a168f97a Remove libelf from "usr" list. Deleted 2015-09-30. 2019-09-27 11:57:42 +00:00
bad c0a44e83e0 Exclude sys/external/{gpl2/dts,bsd/drm*}.
Saves some 100MB in the src-netbsd repo.
2019-09-27 11:53:42 +00:00
bad 604f5fbb67 rtadvd needs expandm.[hc] from libwrap. 2019-09-26 22:43:36 +00:00
bad 6551e0cc8c revert r1.35-r1.40 of sys/rump/listsrcdirs.
addressed differently in tools/Makefile r1.204.
2019-09-26 22:39:55 +00:00
bad c3c178f615 Provide a weak alias for vnode_to_path to be used unless librumpvfs is present. 2019-09-26 17:52:50 +00:00
christos e613c37a50 Regen 2019-09-25 16:44:42 +00:00
christos ff17893526 regen 2019-09-22 23:03:20 +00:00
christos 38aa2a6771 Regen 2019-09-13 13:59:31 +00:00
bad 10596c0d1e typo: ARCH_EXTRA -> ARCHS_EXTRA 2019-09-12 21:37:06 +00:00