Commit Graph

150998 Commits

Author SHA1 Message Date
macallan 5c1e31280b add entry for BCM43362, found on Cubietruck
ok jmcneill@
2020-05-07 11:46:27 +00:00
simonb da4f320927 Add PRID definition for newer SiByte SB1 cores (rev 0x11).
Add a constant for SiByte/BCRM cacheable coherent TLB cache attribute.
2020-05-07 11:43:28 +00:00
jmcneill 6a3493dbfe Add A20 CLK_OUT_A and CLK_OUT_B clocks 2020-05-07 11:24:47 +00:00
riastradh caee431449 Fix two mistakes in entropy accounting.
1. When consolidating entropy from per-CPU pools, drop the amount
   pending to zero; otherwise the entropy consolidation thread might
   keep consolidating every second.

This uncovered a feedback loop with kern.entropy.depletion=1 and
on-demand entropy sources, which is that depleting the pool and then
requesting more from it causes the on-demand entropy sources to
trigger reseed, which causes cprng_fast/strong to request more which
depletes the pool again which causes on-demand entropy sources to
trigger reseed, and so on.

To work around this:

2. Set a rate limit on reseeding (advancing the entropy epoch) when
   kern.entropy.depletion=1; otherwise reseeding gets into a feedback
   loop when there are on-demand entropy sources like RDRAND/RDSEED.

(By default, kern.entropy.depletion=0, so this mainly only affects
systems where you're simulating what happens when /dev/random blocks
for testing.)
2020-05-07 00:55:13 +00:00
bouyer 9aa14e3164 The event channel is not necesserely bound to the primary CPU.
Use the CPU returned in the interrupt handler instead.
2020-05-06 20:40:33 +00:00
bouyer b1ac263880 Drop xbdi_lock() before calling intr_disestablish(), it needs to take
cpu_lock.
2020-05-06 20:09:26 +00:00
bouyer f3d444f821 Attempts to make MP-safe:
xpmap_ptom_unmap() doens't need to be called at splvm; we own the pa.
Use atomic ops to change pmap_pa_end
Make sure the ptom/mtop are up to date before giving the pages back to the
pool.
2020-05-06 19:52:19 +00:00
bouyer 3705635c0d Make MP-safe: make sure the xpq_queue* are flushed before making the
pages visible to UVM.
2020-05-06 19:50:26 +00:00
bouyer 7cfb6126f7 We can't take v_interlock with a spin lock held. Release xbdi_lock
before scheduling the I/O, and take again once queued.
It looks safe to drop the lock here.
2020-05-06 19:49:00 +00:00
bouyer 0eef747d02 xpq_queue_* use per-cpu queue; splvm() is enough to protect them.
remove the XXX SMP comments.
2020-05-06 19:47:05 +00:00
bouyer 85af261e00 x86/x86/ipi.c should not be built for XENPV, even if dom0ops is defined. 2020-05-06 19:45:12 +00:00
riastradh 9d3b7ca9dc Don't reject seed file entropy estimates, until one is nonzero.
We try to avoid counting the seed file's entropy twice, e.g. once
from the boot loader and once from rndctl via /etc/rc.d/random_seed.

But previously, if you had a /var/db/entropy-file that was deemed to
have zero entropy, that would prevent rndctl -L from _ever_ setting a
nonzero entropy estimate, even if you (say) copy a seed file over
from another machine (over a non-eavesdroppable medium) and try to
load it in with rndctl -L, e.g. via `/etc/rc.d/random_seed start'.

Now we accept the first _nonzero_ entropy estimate from a seed file.

The operator can still always trick the kernel into believing there's
entropy in the system by writing data to /dev/random, if the operator
knows something the kernel doesn't; this only affects the _automated_
seed file loading.
2020-05-06 18:31:05 +00:00
bouyer 699b53bbee KASSERT() that the per-cpu queues are run at IPL_VM after boot. 2020-05-06 17:28:26 +00:00
bouyer dc28113a31 No need to run hypercalls at IPL_VM.
XXX still not MP-safe
2020-05-06 17:27:39 +00:00
bouyer 29dc0cfa77 Convert remaining splfoo/splx and tsleep/wakeup to mutex and condvar.
Mark kernel threads and interrupt handlers MPSAFE.
2020-05-06 16:50:13 +00:00
bouyer d3cd9c5f63 remove the per-channel spin lock and instead make sure that events
add/remove will only be done on the CPU the handler is bound to, with
interrupts disabled.
Should be similar to the native x86 interrupts add/remove.
2020-05-06 13:43:48 +00:00
ad 3235a637ea lwp_unpark(): no need to acquire LWP refs or drop the proc lock.
On the hacky benchmarks I have, held over from the transition to 1:1
threading, this restores pthread_cond_signal() perf to radixtree/sleepq
levels, and semes much better than either with pthread_cond_broadcast() and
10 threads.  It would be interesting to see what might be achieved with a
lockless lookup, which is within grasp now thanks to pid_table being used
for lookup.
2020-05-05 22:12:06 +00:00
ad 56d6bdb9f7 PR port-amiga/55233 Process hangs indefinitely if not calling syscalls for a while
cpu_intr_p() is broken on amiga, fix it.

From code inspection it looks like amiga and other m68k ports check for ASTs
with interrupts enabled in some cases, which is racy.  Not fixed.
2020-05-05 21:22:48 +00:00
jdolecek 5eefcf3158 fix KASSERT() for MHLEN case in m_defrag() - network stack usually does
m_adj(ETHER_ALIGN) so check that the mbuf chain data fits
M_LEADINGSPACE() + M_TRAILINGSPACE()
2020-05-05 20:36:48 +00:00
maxv b3f22be23a Gather the section filtering in a single function, and add a sanity check
when relocating, to make sure the section we're accessing is mappable.

Currently this check fails, because of the Xen section, which has RELAs but
is an unmappable unallocated note.

Also improve the prekern ASSERTs while here.
2020-05-05 19:26:47 +00:00
bouyer 4dbd32ce08 Make DOM0OPS build for PVH/PVHVM too 2020-05-05 17:02:01 +00:00
bouyer 9ae5cc2e42 disable I/O or mem decode before probing BAR size.
Bar size is probed writing 0xffffffff to the BAR and reading back; but while
doing this the decoding address is not guaranteed to be valid and could have
side effect.

Xen PVH enforces disabling decoding before writing to a BAR.

Proposed on tech-kern@, got positive comments
2020-05-05 16:58:11 +00:00
riastradh ec335737ff New sysctl kern.entropy.gather=1 to trigger entropy gathering.
Invokes all on-demand RNG sources.  This enables HWRNG driver
developers to use a dtrace probe on rnd_add_data to examine the data
coming out of the HWRNG:

dtrace -n 'fbt::rnd_add_data:entry /args[0]->name == "amdccp0"/ {
   ...examine buffer args[1] length args[2]...
}'
2020-05-05 15:31:42 +00:00
riastradh c7f0fa2cd2 Revert "Use cv_timedwaitclock_sig in futex."
Turned out to break things; we'll do this another way.
2020-05-05 15:25:18 +00:00
riastradh 86f5f90141 Revert "Make sure futex waits never return ERESTART."
Part of redoing the timedwaitclock changes, which were buggy and
committed a little too fast.
2020-05-05 15:23:32 +00:00
jmcneill a90447e255 Align addresses to cache lines in __clear_cache for aarch64.
This corrects an issue where if the start and end address fall in different
lines, and the end address is not cache line size aligned, the last line
will not be invalidated properly.

Patch from compiler-rt upstream: https://reviews.llvm.org/rCRT323315
2020-05-05 12:47:16 +00:00
jdolecek 1d257e5525 due to the locking wild west for if_ioctl can't assert IFNET_LOCKED()
in xennet_ioctl(), so just do splnet() like other drivers do, and hope for best

fixes failed KASSERT() e.g. when starting rpcbind(), which ends
up calling this via sys_setsockopt()->sosetopt()->...->in6_addmulti()->
if_mcast_op(), this path doesn't currently take IFNET_LOCK()
2020-05-05 09:52:13 +00:00
jdolecek ede9f9f8d5 adjust comment - sosetopt() path doesn't take IFNET_LOCK() 2020-05-05 09:26:29 +00:00
jdolecek aa16e18724 add a NOMPSAFE comment for if_mcast_op(), it is called from context
which doesn't hold IFNET_LOCK() in some cases, and calls if_ioctl

this needs to be sorted out for NET_MPSAFE
2020-05-05 09:22:24 +00:00
bouyer 976f6ef646 build start_xenpvh only if XEN. Fixes NET4501 build issue reported by
John D. Baker
2020-05-05 09:07:35 +00:00
jdolecek b07f6e45b7 bump version - struct ifnet change 2020-05-05 08:05:44 +00:00
jdolecek 454d69cd16 remove struct ifnet if_mcastop, it's not used by anything 2020-05-05 08:05:03 +00:00
maxv be6e844aa3 Fix KASAN, init_xen_early must be called after kasan_early_init. 2020-05-05 06:32:43 +00:00
jdolecek 1164d10d30 constify 2020-05-04 20:06:38 +00:00
joerg 2f09f7454a Prevent double definition of pt_entry_t from machine/param.h 2020-05-04 18:36:24 +00:00
riastradh 012d806232 New timedwaitclock_setup.
C99 initializers would have been nice, but part of the struct is
explicit parameters and part of the struct is implicit state, and
-Wmissing-field-initializers can't discriminate between them
(although for some reason it doesn't always fire!).

Instead, just do:

        struct timedwaitclock T;

        timedwaitclock_setup(&T, timeout, clockid, flags, epsilon);
        while (...) {
                error = timedwaitclock_begin(&T, &timo);
                if (error)
                        ...
                error = waitwhatever(timo);
                timedwaitclock_end(&T);
                ...
        }
2020-05-04 18:23:37 +00:00
jdolecek d5100c2314 add support for using MSI for XenPV Dom0
use PHYSDEVOP_map_pirq to get the pirq/gsi for MSI/MSI-X, switch also INTx
to use it instead of PHYSDEVOP_alloc_irq_vector

MSI confirmed working with single-vector MSI for wm(4), ahcisata(4), bge(4)

XXX added some provision for MSI-X, but it doesn't actually work (no interrupts
delivered), needs some further investigation; disable MSI-X for XENPV
via flag in x86/pci/pci_machdep.c
2020-05-04 15:55:56 +00:00
riastradh c89c01dec4 Release the collision if we find one.
Candidate fix for:

panic: lock error: Mutex: mutex_vector_enter,542: locking against myself: lock 0xffff8f611abd37e0 cpu 8 lwp 0xffff8f60a3c6a040
cpu8: Begin traceback...
vpanic() at netbsd:vpanic+0x178
snprintf() at netbsd:snprintf
lockdebug_abort() at netbsd:lockdebug_abort+0xe6
mutex_vector_enter() at netbsd:mutex_vector_enter+0x3c1
ksem_close_fop() at netbsd:ksem_close_fop+0x17
closef() at netbsd:closef+0x69
fd_free() at netbsd:fd_free+0x101
exit1() at netbsd:exit1+0x118
sys_exit() at netbsd:sys_exit+0x3d
syscall() at netbsd:syscall+0x299

Would be nice to have an automatic test for this.  Since semids are
only 24 bits, we only need to create a few thousand of them to have a
high probability of collision.  Maybe we should bump default semmax
while here...
2020-05-04 13:58:48 +00:00
simonb 36c01c395b Enable PTYFS. 2020-05-04 12:15:43 +00:00
jdolecek 810e08fd3b fix delet-o 2020-05-04 10:03:45 +00:00
jdolecek a37cbed637 constify the pic templates 2020-05-04 09:34:37 +00:00
jdolecek 8a3c1b5cf9 remove IPv4 csum offloading for xennet(4) - it's not complete, and even
if it was, it doesn't work with Linux Dom0 as it expects the IPv4 csum present
2020-05-04 08:22:45 +00:00
tsutsui 9b81b6d763 Add bitmap access ops support for EVRX framebuffer on HP9000/425e.
8bpp Xorg wsfb server and mlterm-wscons (formerly mlterm-fb) work.
No particular comment on port-hp300@ and port-hppa@:
 https://mail-index.netbsd.org/port-hp300/2020/05/02/msg000170.html

Special thanks to Miod Vallat, for his advice about HP-UX implementation
and binutils patches to disassemble old HP-UX a.out-hp300hpux binaries
(and also contributing his 425e back in 2014).
2020-05-04 06:52:53 +00:00
joerg 48722dc95d Avoid common symbol declarations. 2020-05-03 21:02:24 +00:00
jdolecek f0a8920e5c add support for scatter-gather also for frontend Rx path (backend -> frontend)
enable ETHERCAP_JUMBO_MTU and feature-sg
2020-05-03 17:56:19 +00:00
jdolecek 987d0db606 reduce buffer size for format_number() so that xbd(4) would show the size
in KB/GB/TB instead of bytes again; the '9' matches what xbd(4) used before,
and also e.g. wd(4)
2020-05-03 17:54:28 +00:00
thorpej cb0aafc488 Move timedwaitclock_begin() and timedwaitclock_end() to subr_time.c
so they can be used by other things.
2020-05-03 17:36:33 +00:00
bouyer b664fe8020 For PVH and HVM, copy hvm_start_info.flags to xen_start_info.flags 2020-05-03 17:24:11 +00:00
bouyer 03ea5b3f0f Hanble dom0 console. This one doesn't need a ring to be mapped, and
can be used earlier.
2020-05-03 17:23:14 +00:00
bouyer 49ecdbbc37 If hvm_start_info has no memmap_entries, fall back to XENMEM_memory_map
hypercall.
2020-05-03 17:22:03 +00:00