Link [ NetBSD | NetBSD OpenGrok source search | PR fulltext-search | Summary of daily snapshot builds | history of daily build result | pkgsrc commit viewer ]


   
        usage: [branch:branch] [user:user] [path@revision] keyword [... [-excludekeyword [...]]] (e.g. branch:MAIN sys/arch/arm, if_wm.c@1.234 )




switch to index mode

recent branches: MAIN (6h)  netbsd-10 (18d)  netbsd-9 (18d)  netbsd-8 (23d) 

2024-06-04 00:48:57 UTC Now

2020-04-29 02:16:57 UTC MAIN commitmail json YAML

Reverse sense of NO_STATIC_MODULES -> OPENPAM_STATIC_MODULES.

This avoids leaking NO_STATIC_MODULES into the public header, which
has led to considerable confusion and workarounds in pkgrsc.

PR security/39313
PR security/55216

ok christos

(riastradh)

2020-04-28 17:27:03 UTC MAIN commitmail json YAML

Make FUTEX_WAIT_BITSET(bitset=0) fail with EINVAL to match Linux.

(riastradh)

2020-04-28 16:22:25 UTC MAIN commitmail json YAML

Fix waiting on a zero bitset.

The logic in futex_wait assumes there are two paths out:

1. Error (signal or timeout), in which case we take ourselves off the
  queue.

2. Wakeup, in which case the waker takes us off the queue.

But if the user does FUTEX_WAIT_BITSET(bitset=0), as in the
futex_wait_pointless_bitset test, then we will never even go to
sleep, so there will be nobody to wake us as in (2), but it's not an
error as in (1) either.  As a result, we're left on the queue.

Instead, don't bother with any of the wait machinery in that case.
This does not actually match Linux semantics -- Linux returns EINVAL
if bitset is zero.  But let's make sure this passes the releng test
rig as the tests are written now, and then fix both the logic and the
tests -- this is a candidate fix for:

lib/libc/sys/t_futex_ops (277/847): 20 test cases
    futex_basic_wait_wake_private: [6.645189s] Passed.
    futex_basic_wait_wake_shared: [6.572692s] Passed.
    futex_cmp_requeue: [4.624082s] Passed.
    futex_requeue: [4.427191s] Passed.
    futex_wait_pointless_bitset: [0.202865s] Passed.
    futex_wait_timeout_deadline: [ 9074.4164779] panic: TAILQ_INSERT_TAIL 0xffff000056a1ad48 /tmp/bracket/build/2020.04.28.03.00.23-evbarm-aarch64/src/sys/kern/sys_futex.c:826
[ 9074.4340691] cpu0: Begin traceback...
[ 9074.4340691] trace fp ffffc0004ceffb40
[ 9074.4340691] fp ffffc0004ceffb60 vpanic() at ffffc000004aac58 netbsd:vpanic+0x160
[ 9074.4441432] fp ffffc0004ceffbd0 panic() at ffffc000004aad4c netbsd:panic+0x44
[ 9074.4441432] fp ffffc0004ceffc60 futex_wait_enqueue() at ffffc000004b7710 netbsd:futex_wait_enqueue+0x138
[ 9074.4555795] fp ffffc0004ceffc80 futex_func_wait.part.5() at ffffc000004b82f4 netbsd:futex_func_wait.part.5+0x17c
[ 9074.4660518] fp ffffc0004ceffd50 do_futex() at ffffc000004b8cd8 netbsd:do_futex+0x1d0
[ 9074.4660518] fp ffffc0004ceffdf0 sys___futex() at ffffc000004b9078 netbsd:sys___futex+0x50

(riastradh)

2020-04-28 00:54:24 UTC MAIN commitmail json YAML

Rename futex_get -> futex_lookup_create.  Remove futex_put.

Just use futex_rele instead of futex_put.  There may once have been a
method to the madness this alias in an early draft but there is no
longer.

No functional change; all names are private to sys_futex.c.

(riastradh)

2020-04-27 23:54:43 UTC MAIN commitmail json YAML

Fix races in aborted futex waits.

- Re-check the wake condition in futex_wait in the event of error.
  => Otherwise, if futex_wait times out in cv_timedwait_sig but
    futex_wake wakes it while cv_timedwait_sig is still trying to
    reacquire fw_lock, the wake would be incorrectly accounted.

- Fold futex_wait_abort into futex_wait so it happens atomically.
  => Otherwise, if futex_wait times out and release fw_lock, then,
    before futex_wait_abort reacquires the lock and removes it from
    the queue, the waiter could be woken by futex_wake.  But once we
    enter futex_wait_abort, the decision to abort is final, so the
    wake would incorrectly accounted.

- In futex_wait_abort, mark each waiter aborting while we do the lock
  dance, and skip over aborting waiters in futex_wake and
  futex_requeue.
  => Otherwise, futex_wake might move it to a new futex while
    futex_wait_abort has released all the locks -- but
    futex_wait_abort still has the old futex, so TAILQ_REMOVE will
    cross the streams and bad things will happen.

- In futex_wait_abort, release the futex we moved the waiter off.
  => Otherwise, we would leak the futex reference acquired by
    futex_func_wait, in the event of aborting.  (For normal wakeups,
    futex_wake releases the reference on our behalf.)

- Consistently use futex_wait_dequeue rather than TAILQ_REMOVE so that
  all changes to fw_futex and the waiter queue are isolated to
  futex_wait_enqueue/dequeue and happen together.

Patch developed with and tested by thorpej@.

(riastradh)

2020-04-27 03:26:10 UTC MAIN commitmail json YAML

Speed up cksum word-by-word with a 15 KB table generated dynamically.

(Really we could generate the main table dynamically too.)

From anonymous.

(riastradh)

2020-04-20 02:04:44 UTC MAIN commitmail json YAML

More -Wno-error=address-of-packed-member to placate clang.

(riastradh)

2020-04-19 18:02:36 UTC MAIN commitmail json YAML

2020-04-19 03:12:35 UTC MAIN commitmail json YAML

Need <sys/types.h> for uint32_t and uintptr_t.

(riastradh)

2020-04-19 03:12:26 UTC MAIN commitmail json YAML

do {...} while (0) to make DTRACE_PROBE macros proper statements.

(riastradh)

2020-04-18 17:22:26 UTC MAIN commitmail json YAML

Fix trailing whitespace.

(riastradh)

2020-04-12 01:12:03 UTC MAIN commitmail json YAML

Reject overly large widths, from mlelstv.

We are returning an ACPI_INTEGER (= uint64_t), so it doesn't make
sense to handle more than 64 bits.

Apparently there are some ACPIs out there that ask for unreasonably
large widths here.  Just reject those requests, rather than writing
past the caller's stack buffer.

Previously we attempted to fix this by copying byte by byte as large
as the caller asked, in order to avoid the undefined behaviour of
shifting past the size of ACPI_INTEGER, but that just turned a shift
(which might have been harmless on real machines) into a stack buffer
overflow (!).

ok msaitoh

(riastradh)

2020-04-12 01:11:52 UTC MAIN commitmail json YAML

2020-04-12 01:11:43 UTC MAIN commitmail json YAML

Revert acpi_ec.c 1.76.

We will do this another way, and separate KNF fixes from the critical
functional change.

ok msaitoh

(riastradh)

2020-04-12 01:11:23 UTC MAIN commitmail json YAML

Revert acpi_ec.c 1.77.

We will do this another way.

ok msaitoh

(riastradh)

2020-04-04 00:01:28 UTC MAIN commitmail json YAML

Mark res __diagused; #ifdef DIAGNOSTIC panic ---> KASSERT.

(riastradh)

2020-03-21 18:58:43 UTC MAIN commitmail json YAML

Suppress spurious address-of-packed error in rump lfs too.

(riastradh)

2020-03-21 18:43:47 UTC MAIN commitmail json YAML

Fix clang build after packed lfs64 accessor change.

(riastradh)

2020-03-21 17:00:48 UTC MAIN commitmail json YAML

Revert another historic $Hdr$ collapse.

(riastradh)

2020-03-21 06:11:05 UTC MAIN commitmail json YAML

Avoid misaligned access to lfs64 on-disk records in memory.

lfs64 directory entries are only 32-bit aligned in order to conserve
space in directory blocks, and we had a hack to stuff a 64-bit inode
in them.  This replaces the hack by __aligned(4) __packed, and goes
further:

1. It's not clear that all the other lfs64 data structures are 64-bit
  aligned on disk to begin with.  We can go through these later and
  upgrade them from

struct foo64 {
...
} __aligned(4) __packed;

union foo {
struct foo64 f64;
...
};

  to

struct foo64 {
...
};

union foo {
struct foo64 f64 __aligned(8);
...
} __aligned(4) __packed;

  if we really want to take advantage of 64-bit memory accesses.

  However, the __aligned(4) __packed must remain on the union
  because:

2. We access even the lfs32 data structures via a union that has
  lfs64 members, and it turns out that compilers will assume access
  through a union with 64-bit aligned members implies the whole
  union has 64-bit alignment, even if we're only accessing a 32-bit
  aligned member.

(riastradh)

2020-03-21 06:09:34 UTC MAIN commitmail json YAML

CTASSERT lfs on-disk structure sizes.

(riastradh)

2020-03-21 06:02:13 UTC MAIN commitmail json YAML

Restore historic $Hdr: ...$ text.

This was presumably eaten by git cvsexportcommit, which is curious
because I thought I had gotten out of the habit of passing -k to it.

(riastradh)

2020-03-08 19:59:45 UTC MAIN commitmail json YAML

Avoid unnecessary zil_commit on rm.

1. Issue zil_commit only if we're actually updating something --
  there's no need to commit if we're unlinking the file or if
  there's no atime update being applied.

2. Issue zil_commit only if the zfs has sync=always set -- for
  sync=standard there's no need for us to commit anything here since
  no application asked for an explicit sync.

Speeds up untarring base.tgz on top of itself by a factor of about
2x, and speeds up rm by a factor of about 10x, on my system with an
SSD SLOG over SATA.  Histogram of unlink, rmdir, and rename timing
shows dramatic reduction in latency for most samples.

(To be fair, this was not an improvement over zfs; issuing the
unnecessary zil_commit was a self-inflicted performance wound.)

(riastradh)

2020-03-06 02:46:18 UTC MAIN commitmail json YAML

Include "opt_uvm_page_trkown.h" for UVM_PAGE_TRKOWN.

(riastradh)

2020-03-05 17:58:08 UTC MAIN commitmail json YAML

Fix userland build by surrounding stuff with #ifdef _KERNEL.

(...Why does this header file get exposed to userland at all?)

(riastradh)

2020-03-05 16:05:06 UTC MAIN commitmail json YAML

Revert "Add fixup operation to remove private mutex types for x86."

The x86 (and arm) definitions of struct kmutex are no longer defined
differently depending on __MUTEX_PRIVATE.

(riastradh)

2020-03-05 15:56:56 UTC MAIN commitmail json YAML

Remove __MUTEX_PRIVATE conditional in definition of struct kmutex.

This doesn't buy us anything but the need to hack around it in
ctfmerge to avoid massive duplication of kernel types -- which only
worked for the x86 definition.

This changes only x86 and arm for now, pending compile-testing the
remaining architectures.

(riastradh)

2020-03-05 15:18:56 UTC MAIN commitmail json YAML

2020-03-05 08:36:54 UTC MAIN commitmail json YAML

Hackily rename enum pipe for drm, without patching.

The patch we used to maintain to do this rename doubled the pain
of merging drm updates.  But ctf gets confused if we have a struct
and an enum both called `pipe', and it's technically against C99
to do so.  So #define it in all drm code for now to fix dtrace.

(riastradh)

2020-03-05 08:08:34 UTC MAIN commitmail json YAML

2020-03-05 07:46:59 UTC MAIN commitmail json YAML

Avoid struct inode.

This is an fs-independent structure in Linux.  We don't actually use
it as such; it's just a dummy struct tag.  But we do have an actual
struct inode in ufs and in lfs, and using the same struct tag here
confuses ctf leading to four copies of pretty much every drm data
structure.

(riastradh)

2020-03-05 07:46:49 UTC MAIN commitmail json YAML

Avoid duplicate definition of internal_state struct.

(riastradh)

2020-03-05 07:46:36 UTC MAIN commitmail json YAML

2020-03-03 06:44:38 UTC MAIN commitmail json YAML

Use vpanic, not vprintf and then panic.

(riastradh)

2020-03-03 04:20:50 UTC MAIN commitmail json YAML

Remove unfinished hack I accidentally committed in 2017.

This caused make to unconditionally take ages running useless
submakes in every subdirectory.  Accidentally committed during the
MKCRYPTO option removal when I was presumably experimenting with
automating library dependency generation in lib.

Should shave a few seconds at least off every build!

(riastradh)

2020-03-02 16:01:57 UTC MAIN commitmail json YAML

New ioctl DIOCGSECTORALIGN returns sector alignment parameters.

struct disk_sectoralign {
/* First aligned sector number.  */
uint32_t dsa_firstaligned;

/* Number of sectors per aligned unit.  */
uint32_t dsa_alignment;
};

- Teach wd(4) to get it from ATA.
- Teach cgd(4) to pass it through from the underlying disk.
- Teach dk(4) to pass it through with adjustments.
- Teach zpool (zfs) to take advantage of it.
  => XXX zpool doesn't seem to understand when the vdev's starting
    sector is misaligned.

Missing:

- ccd(4) and raidframe(4) support -- these should support _using_
  DIOCGSECTORALIGN to decide where to start putting ccd or raid
  stripes on disk, and these should perhaps _implement_
  DIOCGSECTORALIGN by reporting the stripe/interleave factor.

- sd(4) support -- I don't know any obvious way to get it from SCSI,
  but if any SCSI wizards know better than I, please feel free to
  teach sd(4) about it!

- any ld(4) attachments -- might be worth teaching the ld drivers for
  nvme and various raid controllers to get the aligned sector size

There's some duplicate logic here for now.  I'm doing it this way,
rather than gathering the logic into a new disklabel_sectoralign
function or something, so that this change is limited to adding a new
ioctl, without any new kernel symbols, in order to make it easy to
pull up to netbsd-9 without worrying about the module ABI.

(riastradh)

2020-03-02 16:00:54 UTC MAIN commitmail json YAML

Include kern_crashme.c in non-DEBUG kernels.

This is useful for simulating crashes in production to test failover.

(riastradh)

2020-03-02 15:49:30 UTC MAIN commitmail json YAML

Create /dev/ipmi0 in `MAKEDEV all'.

Works on my machine with sysutils/ipmitool if the latter is built
with CONFIGURE_ARGS+= --enable-intf-open.

(riastradh)

2020-03-01 03:21:54 UTC MAIN commitmail json YAML

Add a flag to dk_dump for virtual disk devices.

If a disk is backed by a physical medium other than itself, such as
cgd(4), then it passes DK_DUMP_RECURSIVE to disable the recursion
detection for dk_dump.

If, however, a device represents a physical medium on its own, such
as wd(4), then it passes 0 instead.

With this, I can now dump to dk on cgd on dk on wd.

(riastradh)

2020-03-01 03:19:46 UTC MAIN commitmail json YAML

Allow dumping to cgd(4) on a dk(4).

(Technically this also allows dumping to a dk(4) on which there
happens to be a cgd(4) configured, but I'm not sure how to
distinguish that case here.  So don't do that!)

(riastradh)

2020-02-28 03:52:26 UTC MAIN commitmail json YAML

Teach zfs bdevsw to do b_psize.

This is needed, among other things, to swap on zvols.

Attempting to swap on zvols currently deadlocks but that's a separate
issue that needs to be fixed too!

(riastradh)

2020-02-27 16:59:23 UTC MAIN commitmail json YAML

Create some more cgd device nodes.

(riastradh)

2020-02-27 16:35:40 UTC MAIN commitmail json YAML

Add cgd to evbarm GENERIC.common.

(riastradh)

2020-02-27 15:41:47 UTC MAIN commitmail json YAML

Take a mutex around mode config logic as the comment advises.

XXX pullup

(riastradh)

2020-02-26 16:00:48 UTC MAIN commitmail json YAML

2020-02-26 15:44:57 UTC MAIN commitmail json YAML

2020-02-26 07:31:51 UTC MAIN commitmail json YAML

Draft man pages for the standard users and groups.

These are currently listed in order of uid because I went through
src/etc/group and src/etc/master.passwd line by line, and sorting any
other way after the fact -- like lexicographically, how it should be
-- was kinda inconvenient.

Feel free to sort, add information, add historical references,
correct any mistakes, &c., so that these remain living documents
describing NetBSD's standard users and groups and practices around
them.

(riastradh)

2020-02-23 15:23:08 UTC MAIN commitmail json YAML

Fix missing <sys/evcnt.h> by removing the evcnts instead.

Just wanted to confirm that a race might happen, and indeed it did.
These serve little diagnostic value otherwise.

(riastradh)

2020-02-23 15:11:33 UTC MAIN commitmail json YAML

Fix userland references to LFS_ORPHAN_NEXTFREE.

Forgot to grep for these or do a full distribution build, oops!

(riastradh)

2020-02-23 08:54:55 UTC MAIN commitmail json YAML

Simplify some branches and kassert some redundant assignments.

(riastradh)

2020-02-23 08:54:47 UTC MAIN commitmail json YAML

Fix mistake in use of usbd_xfer_schedule_timeout in motg.

This code path is used both for xfers that are new, and xfers that
are being done piece by piece and are partway done.  For the latter
case, skip usbd_xfer_schedule_timeout so we schedule it only once per
xfer.

(riastradh)

2020-02-23 08:53:26 UTC MAIN commitmail json YAML

If zfs=YES, unconditioally do zfs mount/unmount -a.

If you set zfs=YES, presumably you positively want the automatic rc.d
actions, so if there's no /sbin/zfs or if zfs can't find pools with
/etc/zfs/zpool.cache, presumably you would like feedback about that
in rc.log.

(riastradh)

2020-02-23 08:53:14 UTC MAIN commitmail json YAML

Allow random seed on zfs.

(riastradh)

2020-02-23 08:49:46 UTC MAIN commitmail json YAML

2020-02-23 08:49:34 UTC MAIN commitmail json YAML

Teach LFS_ORPHAN_NEXTFREE about lfs64.

(riastradh)

2020-02-23 08:42:53 UTC MAIN commitmail json YAML

lfs_writer_enter can't fail; keep it simple and don't pretend it can.

Assert that mtsleep can't fail either -- it doesn't catch signals and
there's no timeout.

(riastradh)

2020-02-23 08:41:08 UTC MAIN commitmail json YAML

Call lfs_orphan in lfs_rename while we're still in the dirop.

(riastradh)

2020-02-23 08:40:59 UTC MAIN commitmail json YAML

In lfs_update, hold lfs_writer around lfs_vflush.

Otherwise, we might do

lfs_vflush
-> lfs_seglock
-> lfs_segwait(SEGM_CKP)
  -> lfs_writer_enter

which is the reverse of the lfs_writer -> lfs_seglock ordering.

(riastradh)

2020-02-23 08:40:49 UTC MAIN commitmail json YAML

Initialize/destroy lfs_allclean_wakeup in modcmd, not lfs_mountfs.

Fixes reloading lfs.kmod.

(riastradh)

2020-02-23 08:40:37 UTC MAIN commitmail json YAML

Break deadlock in PR kern/52301.

The lock order is lfs_writer -> lfs_seglock.  The problem in 52301 is
that lfs_segwrite violates this lock order by sometimes doing
lfs_seglock -> lfs_writer, either (a) when doing a checkpoint or (b),
opportunistically, when there are no dirops pending.  Both cases can
deadlock, because dirops sometimes take the seglock (lfs_truncate,
lfs_valloc, lfs_vfree):

(a) There may be dirops pending, and they may be waiting for the
seglock, so we can't wait for them to complete while holding the
seglock.

(b) The test for fs->lfs_dirops == 0 happens unlocked, and the state
may change by the time lfs_writer_enter acquires lfs_lock.

To resolve this in each case:

(a) Do lfs_writer_enter before lfs_seglock, since we will need it
unconditionally anyway.  The worst performance impact of this should
be that some dirops get delayed a little bit.

(b) Create a new lfs_writer_tryenter to use at this point so that the
test for fs->lfs_dirops == 0 and the acquisition of lfs_writer happen
atomically under lfs_lock.

(riastradh)

2020-02-23 08:40:28 UTC MAIN commitmail json YAML

Don't lfs_writer_enter while holding v_interlock.

There's no need to lfs_writer_enter at all here, as far as I can see.
lfs_flush_fs will do it for us.

(riastradh)

2020-02-23 08:40:19 UTC MAIN commitmail json YAML

Take a reference and fix assertions in lfs_flush_dirops.

Fixes panic:

KASSERT((ip->i_state & IN_ADIROP) == 0) at lfs_vnops.c:1670
lfs_flush_dirops
lfs_check
lfs_setattr
VOP_SETATTR
change_mode
sys_fchmod
syscall

This assertion -- and the assertion that vp->v_uflag has VU_DIROP set
-- is valid only until we release lfs_lock, because we may race with
lfs_unmark_dirop which will remove the nodes and change the flags.

Further, vp itself is valid only as long as it is referenced, which it
is as long as it's on the dchain, but lfs_unmark_dirop drops the
dchain's reference.

(riastradh)

2020-02-23 08:40:08 UTC MAIN commitmail json YAML

2020-02-23 08:39:48 UTC MAIN commitmail json YAML

Serialize access to the splay tree with lfs_lock.

(riastradh)

2020-02-23 08:39:39 UTC MAIN commitmail json YAML

Assert lfs_writer where I think we can now prove it.

(riastradh)

2020-02-23 08:39:28 UTC MAIN commitmail json YAML

Prevent new dirops while we issue lfs_flush_dirops.

lfs_flush_dirops assumes (by KASSERT((ip->i_state & IN_ADIROP) == 0))
that vnodes on the dchain will not become involved in active dirops
even while holding no other locks (lfs_lock, v_interlock), so we must
set lfs_writer here.  All other callers already set lfs_writer.

We set fs->lfs_writer++ without explicitly doing lfs_writer_enter
because

(a) we already waited for the dirops to drain, and
(b) we hold lfs_lock and cannot drop it before setting lfs_writer.

(riastradh)

2020-02-23 08:39:19 UTC MAIN commitmail json YAML

Teach lfs to transition ro<->rw.

(riastradh)

2020-02-23 08:39:09 UTC MAIN commitmail json YAML

Just use VOP_BWRITE for lfs_bwrite_log.

Hope this doesn't cause trouble with vfs_suspend.

(riastradh)

2020-02-23 08:38:58 UTC MAIN commitmail json YAML

Use a marker node to iterate lfs_dchainhd / i_lfs_dchain.

I believe elements can be removed while the lock is dropped,
including the next node we're hanging on to.

(riastradh)

2020-02-23 06:15:27 UTC MAIN commitmail json YAML

Teach device nodes on zfs to handle fsync by calling spec_fsync too.

(riastradh)

2020-02-23 05:50:25 UTC MAIN commitmail json YAML

Teach zfs spec nodes to VOP_BWRITE too.

Fixes hang on writing to, e.g., ffs mounted on a device node that
lives on zfs.

XXX pullup

(riastradh)

2020-02-21 02:04:40 UTC MAIN commitmail json YAML

OOPS -- fix mistake in previous commit.

bbusy really needs to return the error; otherwise things are very
bad!

(riastradh)

2020-02-20 15:48:52 UTC MAIN commitmail json YAML

Fix kassert in lfs by initializing vp first.

(riastradh)

2020-02-20 15:48:38 UTC MAIN commitmail json YAML

Buffer cache SDT probes.

(riastradh)

2020-02-20 15:48:05 UTC MAIN commitmail json YAML

Use vn_bwrite, not genfs_nullop, for VOP_BWRITE.

VOP_BWRITE is responsible for calling biodone; can't just leave it
hanging.

XXX pullup

(riastradh)

2020-02-19 17:05:06 UTC MAIN commitmail json YAML

Mark previous #ifdef __NetBSD__, per request from hannken.

(riastradh)

2020-02-19 16:11:19 UTC MAIN commitmail json YAML

Report the OS name and release appropriately for NetBSD.

We are not OpenSolaris or uts!

(riastradh)

2020-02-19 16:07:38 UTC MAIN commitmail json YAML

usbdi dtrace probes

(riastradh)

2020-02-19 16:05:41 UTC MAIN commitmail json YAML

2020-02-19 16:04:40 UTC MAIN commitmail json YAML

2020-02-19 16:04:01 UTC MAIN commitmail json YAML

umass dtrace probes

(riastradh)

2020-02-19 16:03:30 UTC MAIN commitmail json YAML

New dtrace usb provider, with a handful of probes in usb.c.

(riastradh)

2020-02-19 16:02:50 UTC MAIN commitmail json YAML

Make sure the umass transfer callback is run in error branches.

(riastradh)

2020-02-19 16:02:34 UTC MAIN commitmail json YAML

Consolidate logic to call the transfer callback.

No functional change intended.

(riastradh)

2020-02-19 16:01:37 UTC MAIN commitmail json YAML

Fix mistakes in timeout/abort/completion changes in motg(4).

- Call usbd_xfer_schedule_timeout so we actually do time out.

- Don't call usbd_xfer_trycomplete until all the data have been
  transferred -- it commits to completion, not timeout.

- Use xfer->ux_status != USBD_IN_PROGRESS to test whether, after a
  partial write, an xfer has been interrupted or timed out and need
  not be continued.

- Remove wrong assertion.

(riastradh)

2020-02-19 16:00:28 UTC MAIN commitmail json YAML

Abort default pipe too on detach before detaching children.

This ensures that pending xfers on the default pipe will be aborted
before we wait for children, which, in the case of scsibus -> sd,
means waiting for pending xfers to complete -- xfers that may never
complete if something is wedged.

(riastradh)

2020-02-19 05:52:52 UTC MAIN commitmail json YAML

Define VOP_STRATEGY on zfs device nodes too.

Fixes eternal hangs in attempts to do I/O on device nodes on zfs.

XXX pullup

(riastradh)

2020-02-18 17:50:32 UTC MAIN commitmail json YAML

Fix non-DIAGNOSTIC build with UVM_PAGE_TRKOWN.

(riastradh)

2020-02-18 17:50:21 UTC MAIN commitmail json YAML

Fix wrong KASSERT in motg abort.

This has been wrong since last summer when we did the transition to
xfer->ux_status = USBD_CANCELLED earlier.

XXX pullup-9

(riastradh)

2020-02-17 08:16:44 UTC MAIN commitmail json YAML

When aborting a pipe, set pipe->up_running = 0.

This prevents any concurrent usb_transfer_complete from restarting
the pipe with usbd_start_next.

(riastradh)

2020-02-16 07:29:48 UTC MAIN commitmail json YAML

Move another file from drm2 to common for <linux/kernel.h>.

(riastradh)

2020-02-16 06:50:14 UTC MAIN commitmail json YAML

2020-02-15 23:19:37 UTC MAIN commitmail json YAML

Open /dev/urandom with O_CLOEXEC.

Let's avoid bleeding file descriptors into our clients' children,
shall we?

XXX pullup

(riastradh)

2020-02-15 22:55:22 UTC MAIN commitmail json YAML

Let's not write temporary files to fixed paths in /tmp, shall we?

XXX pullup

(riastradh)

2020-02-15 19:03:15 UTC MAIN commitmail json YAML

Teach zfs to revoke vnodes the usual way.

XXX pullup

(riastradh)

2020-02-15 14:05:06 UTC MAIN commitmail json YAML

#ifdef DIAGNOSTIC --> __diagused

(riastradh)

2020-02-15 13:56:56 UTC MAIN commitmail json YAML

2020-02-15 01:21:56 UTC MAIN commitmail json YAML

Fix mistakes in previous sloppy change with root intr xfers.

- Make sure ux_status is set to USBD_IN_PROGRESS when started.
  Otherwise, if it is still in flight when we abort the pipe,
  usbd_ar_pipe will skip calling upm_abort.

- Initialize ux_status under the lock; in principle a completion
  interrupt (or a delay) could race with the initialization.

- KASSERT that the xfer is in progress when we're about to complete
  it.

Candidate fix for PR kern/54963 for other HCI drivers than uhci.

ok nick
ok phone

(This is the change that nick evidently MEANT to ok when he ok'd the
previous one!)

(riastradh)

2020-02-14 16:47:28 UTC MAIN commitmail json YAML

Set ux_isdone in uhci_poll_hub for DIAGNOSTIC.

(riastradh)

2020-02-14 16:47:11 UTC MAIN commitmail json YAML

Initialize xfer->ux_status in uhci_root_intr_start.

Otherwise, it will be USBD_NOT_STARTED, so usbd_ar_pipe will skip
calling upm_abort.

Candidate fix for PR kern/54963, same problem as reported at:
https://mail-index.NetBSD.org/current-users/2020/02/13/msg037740.html

(riastradh)

2020-02-14 09:39:57 UTC MAIN commitmail json YAML

2020-02-14 09:39:38 UTC MAIN commitmail json YAML

2020-02-14 09:38:51 UTC MAIN commitmail json YAML

2020-02-14 09:35:52 UTC MAIN commitmail json YAML

Carry new CWARNFLAGS over to module reachover makefiles.

Forgot these modules existed!

(riastradh)

2020-02-14 09:35:40 UTC MAIN commitmail json YAML

2020-02-14 04:38:48 UTC MAIN commitmail json YAML

2020-02-14 04:38:36 UTC MAIN commitmail json YAML

2020-02-14 04:38:24 UTC MAIN commitmail json YAML

2020-02-14 04:38:13 UTC MAIN commitmail json YAML

Revert unnecessary change.

The only way this logic can reach the reference to stat is if repcnt
goes to zero, which -- since it starts at 4 -- can only happen if we
go through several iterations of the loop, which in turn implies that
stat is initialized.

If GCC still complains about this, it's wrong and should be dealt
with some other way.

(riastradh)

2020-02-14 04:37:43 UTC MAIN commitmail json YAML

2020-02-14 04:37:29 UTC MAIN commitmail json YAML

2020-02-14 04:37:10 UTC MAIN commitmail json YAML

2020-02-14 04:36:57 UTC MAIN commitmail json YAML

2020-02-14 04:36:33 UTC MAIN commitmail json YAML

Provide necessary forward declarations or includes.

(riastradh)

2020-02-14 04:36:12 UTC MAIN commitmail json YAML

src/sys/external/bsd/drm2/dist/drm/i915/i915_debugfs.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c@1.30 / diff / nxr@1.30
src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h@1.31 / diff / nxr@1.31
src/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c@1.18 / diff / nxr@1.18
src/sys/external/bsd/drm2/dist/drm/i915/intel_audio.c@1.6 / diff / nxr@1.6
src/sys/external/bsd/drm2/dist/drm/i915/intel_crt.c@1.7 / diff / nxr@1.7
src/sys/external/bsd/drm2/dist/drm/i915/intel_ddi.c@1.11 / diff / nxr@1.11
src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c@1.30 / diff / nxr@1.30
src/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c@1.21 / diff / nxr@1.21
src/sys/external/bsd/drm2/dist/drm/i915/intel_dp_mst.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/i915/intel_drv.h@1.12 / diff / nxr@1.12
src/sys/external/bsd/drm2/dist/drm/i915/intel_dsi.c@1.5 / diff / nxr@1.5
src/sys/external/bsd/drm2/dist/drm/i915/intel_dvo.c@1.5 / diff / nxr@1.5
src/sys/external/bsd/drm2/dist/drm/i915/intel_fbc.c@1.6 / diff / nxr@1.6
src/sys/external/bsd/drm2/dist/drm/i915/intel_fifo_underrun.c@1.3 / diff / nxr@1.3
src/sys/external/bsd/drm2/dist/drm/i915/intel_hdmi.c@1.8 / diff / nxr@1.8
src/sys/external/bsd/drm2/dist/drm/i915/intel_lvds.c@1.8 / diff / nxr@1.8
src/sys/external/bsd/drm2/dist/drm/i915/intel_overlay.c@1.9 / diff / nxr@1.9
src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c@1.13 / diff / nxr@1.13
src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c@1.22 / diff / nxr@1.22
      :
(more 6 files)
Undo the `enum pipe' -> `enum i915_pipe' rename.

(riastradh)

2020-02-14 04:35:20 UTC MAIN commitmail json YAML

src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c@1.6 / diff / nxr@1.6
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c@1.5 / diff / nxr@1.5
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_smc.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c@1.5 / diff / nxr@1.5
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c@1.5 / diff / nxr@1.5
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c@1.5 / diff / nxr@1.5
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx_v8_0.c@1.3 / diff / nxr@1.3
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_i2c.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_kms.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_object.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_sdma_v2_4.c@1.2 / diff / nxr@1.2
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_sdma_v3_0.c@1.2 / diff / nxr@1.2
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ucode.c@1.5 / diff / nxr@1.5
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_uvd.c@1.6 / diff / nxr@1.6
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/drm_crtc.c@1.13 / diff / nxr@1.13
src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c@1.10 / diff / nxr@1.10
src/sys/external/bsd/drm2/dist/drm/drm_dp_mst_topology.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/drm_drv.c@1.11 / diff / nxr@1.11
      :
(more 38 files)
Use a header file hack to cope with Linux/NetBSD namespace clashes.

Currently serves for:

ALIGN
mutex_init
mutex_destroy

(riastradh)

2020-02-14 04:30:06 UTC MAIN commitmail json YAML

src/sys/external/bsd/drm2/amdgpu/files.amdgpu@1.8 / diff / nxr@1.8
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atom.c@1.2 / diff / nxr@1.2
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_encoders.c@1.2 / diff / nxr@1.2
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c@1.5 / diff / nxr@1.5
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_dpm.c@1.2 / diff / nxr@1.2
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_smc.c@1.3 / diff / nxr@1.3
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v10_0.c@1.3 / diff / nxr@1.3
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v11_0.c@1.3 / diff / nxr@1.3
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v8_0.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dpm.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v7_0.c@1.2 / diff / nxr@1.2
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v8_0.c@1.2 / diff / nxr@1.2
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_kv_dpm.c@1.3 / diff / nxr@1.3
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_test.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ucode.c@1.4 / diff / nxr@1.4
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_uvd.c@1.5 / diff / nxr@1.5
src/sys/external/bsd/drm2/dist/drm/drm_bufs.c@1.10 / diff / nxr@1.10
      :
(more 18 files)
Eliminate -Wpointer-arith patches; use -Wno-pointer-arith instead.

(riastradh)

2020-02-14 04:29:42 UTC MAIN commitmail json YAML

2020-02-14 04:29:20 UTC MAIN commitmail json YAML

2020-02-12 16:02:01 UTC MAIN commitmail json YAML

Fix steady state of root intr xfers.

Why?

- Avoid completing a root intr xfer multiple times in races.
- Avoid potential use-after-free in poll_hub callouts (uhci, ahci).

How?

- Use sc->sc_intr_xfer or equivalent to store only a pending xfer
  that has not yet completed -- whether successfully, by timeout, or
  by synchronous abort.  When any of those happens, set it to null
  under the lock, so the xfer is completed only once.

- For hci drivers that use a callout to poll the root hub (uhci, ahci):

  . Pass the softc pointer, not the xfer, to the callout, so the
    callout is not even tempted to use xfer after free -- if the
    callout fires, but the xfer is synchronously aborted before the
    callout can do anything, the xfer might be freed by the time the
    callout starts to examine it.

  . Teach the callout to do nothing if it is callout_pending after it
    has fired.  This way:

    1. completion or synchronous abort can just callout_stop
    2. start can just callout_schedule

    If the callout had already fired before (1), and doesn't acquire
    the bus lock until after (2), it may be tempted to abort the new
    root intr xfer just after submission, which would be wrong -- so
    instead we just have the callout do nothing if it notices it has
    been rescheduled, since it will fire again after the appropriate
    time has elapsed.

(riastradh)

2020-02-12 16:01:00 UTC MAIN commitmail json YAML

Factor out HCI-independent xfer completion logic.

New API for HCI drivers to synchronize hardware completion
interrupts, synchronous aborts, and asynchronous timeouts:

- When submitting an xfer to hardware, call
  usbd_xfer_schedule_timeout(xfer).

- On HCI completion interrupt for xfer completion:

if (!usbd_xfer_trycomplete(xfer))
return; /* timed out or aborted, ignore it */

- In upm_abort methods, call usbd_xfer_abort(xfer).

For HCI drivers that use this API (not needed in drivers that don't,
or for xfers like root intr xfers that don't use it):

- New ubm_abortx method serves role of former *hci_abort_xfer, but
  without any logic for wrangling timeouts/callouts/tasks -- caller
  in usbd_xfer_abort has already handled them.

- New ubm_dying method, returns true if the device is in the process
  of detaching, used by the timeout logic.

Converted and tested:
- ehci
- ohci

Converted and compile-tested:
- ahci (XXX did this ever work?)
- dwc2
- motg (XXX missing usbd_xfer_schedule_timeout in motg_*_start?)
- uhci
- xhci

Not changed:

- slhci (sys/dev/ic/sl811hs.c) -- doesn't use a separate per-xfer
  callout for timeouts (XXX but maybe should?)

- ugenhc (sys/rump/dev/lib/libugenhc/ugenhc.c) -- doesn't manage its
  own transfer timeouts

- vhci -- times transfers out only on detach; could be adapted easily
  if we wanted to use the xfer->ux_callout

(riastradh)

2020-02-12 16:00:34 UTC MAIN commitmail json YAML

Fix steady state of timeouts in ehci.

This is complicated because:

1. There are three ways that an xfer can be completed:
  (a) hardware interrupt completes xfer
  (b) software decision aborts xfer with USBD_CANCELLED
  (c) timeout aborts xfer with USBD_TIMEOUT

2. The timeout abort can't be done in callout because ehci_sync_hc,
  called unconditionally by ehci_abort_xfer to wait until the device
  has finished using any references to the xfer, may sleep.  So we
  have to schedule a callout that, when run, will schedule a usb_task.

3. The hardware completion interrupt can't sleep waiting for a callout
  or task to finish -- can't use callout_halt or usb_rem_task_wait.
  So the callout and usb_task must be able to run _after_ the hardware
  completion interrupt, and recognize that they're late to the party.

  (Note, though, that usbd_free_xfer does wait for the callout and
  task to complete, so there's no danger they may use themselves after
  free.)

4. The xfer may resubmitted -- and the timeout may be rescheduled --
  immediately after the hardware completion interrupt, _while_ the
  callout and/or usb_task may still be scheduled.  Specifically, we
  may have the following sequence of events:
  (a) hardware completion interrupt
  (b) callout or usb_task fires
  (c) driver resubmits xfer
  (d) callout or usb_task acquires lock and looks around dazed and
      bewildered at the firehose of events like reading the news in 2019

The mechanism for sorting this out is that we have two bits of state:

- xfer->ux_timeout_set informs the driver, when submitting an xfer and
  setting up its timeout, whether either the callout or usb_task is
  already scheduled or not.

- xfer->ux_timeout_reset informs the callout or usb_task whether it
  should reschedule the callout, because the xfer got resubmitted, or
  not.

(riastradh)

2020-02-12 16:00:17 UTC MAIN commitmail json YAML

New xfer state variables ux_timeout_set and ux_timeout_reset.

These are needed because:

- The host controller interrupt cannot wait for the callout or task
  to finish running.

- Nothing in the USBD API as is waits for the callout or task to
  finish running.

- Callers expect to be able to resubmit USB xfers from xfer callbacks
  without waiting for anything to finish running.

The variable ux_timeout_set can be used by a host controller to
decide on submission whether to schedule the callout or to ask an
already-scheduled callout or already-queued task to reschedule the
callout, by setting the variable ux_timeout_reset to true.

When the callout or task runs and sees that ux_timeout_reset is true,
rather than queue the task or abort the xfer, it can instead just
schedule the callout anew.

(riastradh)

2020-02-12 15:59:59 UTC MAIN commitmail json YAML

Nothing guarantees xfer's timeout has completed.

Wait for it when we free the xfer.

(riastradh)

2020-02-12 15:59:44 UTC MAIN commitmail json YAML

New function usb_task_pending for diagnostic assertions.

Usable only for negative diagnostic assertions:

KASSERT(!usb_task_pending(dev, task))

If you can think of a better name for this than !usb_task_pending,
I'm all ears.

(riastradh)

2020-02-12 15:59:30 UTC MAIN commitmail json YAML

Teach usb_rem_task to return whether removed from queue or not.

(riastradh)

2020-02-12 06:36:19 UTC MAIN commitmail json YAML

cyclic.kmod needs -Wno-sign-compare for aarch64 CPU_INFO_FOREACH.

Provisional workaround; feel free to fix.

(riastradh)

2020-02-12 06:05:46 UTC MAIN commitmail json YAML

Define the MULTIPROCESSOR cpu_number() for modules too.

Modules should work whether the main kernel is multiprocessor or not.
In particular, dtrace should not think cpu_number() is 0 while
cpu_index(curcpu()) and curcpu()->ci_index are nonzero, leading to
rather spectacularly bogus results...

(riastradh)

2020-02-12 06:05:31 UTC MAIN commitmail json YAML

Switch from db_write_bytes to using direct-mapping.

This way there's no dependency on ddb.

(riastradh)

2020-02-12 06:05:23 UTC MAIN commitmail json YAML

Change the address ranges that aarch64 considers toxic for dtrace.

`Toxic' means dtrace forbids D scripts from even attempting to read
or write at them.

Previously we considered [0, VM_MIN_KERNEL_ADDRESS) toxic, but
VM_MIN_KERNEL_ADDRESS is only the minimum address of the kernel map;
the direct-mapped region lies below it, and with PMAP_MAP_POOLPAGE we
allocate virtual pages for pool backing directly from physical pages
through the direct-mapped region.  Also, this did not consider I/O
mappings to be toxic, which they probably should be.

Instead, treat:

[0, AARCH64_KSEG_START)
and
[VM_KERNEL_IO_ADDRESS, 0xfff...ff)

as toxic.  (The upper bound for 0xfff...ff ought to be inclusive, not
exclusive, but I think we'll need another mechanism for expressing
that to dtrace!)

(riastradh)

2020-02-12 01:10:25 UTC MAIN commitmail json YAML

Count the number of artificial frames in aarch64 fbt probe correctly.

(riastradh)

2020-02-12 01:10:16 UTC MAIN commitmail json YAML

Teach dtrace about el1_trap_exit frames on aarch64.

Implement dtrace_getarg and dtrace_getreg while here.

(riastradh)

2020-02-12 01:10:08 UTC MAIN commitmail json YAML

2020-02-12 01:09:48 UTC MAIN commitmail json YAML

Tidy up a bit: don't set things we won't use; assert nonzeroness.

(riastradh)

2020-02-12 01:09:39 UTC MAIN commitmail json YAML

Tidy up a bit.  No functional change intended.

aarch64 fbt_invop doesn't actually use the argument, but it would
make more sense for it to be the return value and/or first argument
register.  Certainly it's not `eax'!

(riastradh)

2020-02-12 01:09:27 UTC MAIN commitmail json YAML

Use db_write_bytes to overwrite kernel text.

(riastradh)

2020-02-12 01:09:17 UTC MAIN commitmail json YAML

Create a buffer space of 512 bytes before the trapframe.

dtrace fbt needs enough space to emulate an

stp x29, x30, [sp,#-FRAMESIZE]!

instruction in a function prologue.  In the aarch64 instruction
encoding, FRAMESIZE can be as large as 512 bytes, so reserve this
much space when KDTRACE_HOOKS is enabled.

(riastradh)

2020-02-11 06:26:19 UTC MAIN commitmail json YAML

2020-02-11 03:15:10 UTC MAIN commitmail json YAML

2020-02-11 03:14:49 UTC MAIN commitmail json YAML

Preserve pcu(9) state in fork.

There should perhaps be a pcu_fork operation to keep this factored
neatly but this will be simpler to pull up.

In practical terms, this may not affect most architecture that use
pcu(9) -- alpha, arm32, mips, powerpc, riscv -- but it does affect
aarch64, in which v8-v15 are callee-saves, and GCC actually takes
advantage of them, and for more than just floating-point data too.

XXX pullup

(riastradh)

2020-02-11 03:12:06 UTC MAIN commitmail json YAML

Delete aarch64 cpu_in_cksum.S draft.

This isn't actually used in the kernel; it is only used to cause the
in_cksum tests to fail.

If you want to revive it and make it work, you can pull it out of the
attic.

(riastradh)

2020-02-11 03:11:43 UTC MAIN commitmail json YAML

aarch64 doesn't trap integer division by zero either.

(riastradh)

2020-02-10 16:51:49 UTC MAIN commitmail json YAML

2020-02-10 07:13:06 UTC MAIN commitmail json YAML

Omit duplicate rnd_init in rump.

(riastradh)

2020-02-10 03:23:29 UTC MAIN commitmail json YAML

Initialize struct cpu_info::ci_cpuname (= ci_data.cpu_name) in rump.

(riastradh)

2020-02-09 22:57:39 UTC MAIN commitmail json YAML

Switch from ad-hoc logging to dtrace probes.

(riastradh)

2020-02-09 22:57:27 UTC MAIN commitmail json YAML

Teach threadpool(9) to use percpu_create, mostly.

(riastradh)

2020-02-06 19:52:09 UTC MAIN commitmail json YAML

Fix previous brainfart.

Don't use the uninitialized trng node as the root node -- derp.
Instead, use the root node as the root node, and initialize the trng
node here.

(riastradh)

2020-02-04 04:19:24 UTC MAIN commitmail json YAML

Use specfs vnops for specnodes in kernfs.

While here, don't filter out rootdev and rrootdev merely because
they're not cached.

Fixes the elusive /kern/rootdev and /kern/rrootdev nodes, which only
appeared sometimes when they felt like it, and fixes operations on
/kern/rootdev and /kern/rrootdev always returning EOPNOTSUPP.

We didn't seem to have a single PR for these issues but the following
PRs are all relevant:

PR bin/13564
PR kern/38265
PR kern/38778
PR kern/45974

XXX pullup-9, pullup-8, pullup-7, pullup-6, pullup-5, pullup-4, pullup-3, pullup-2, pullup-1.4T...

(riastradh)

2020-02-01 22:38:05 UTC MAIN commitmail json YAML

Fix abuse of TAILQ_CONCAT.

Other parts of this expect that the entries will be on wq->wq_queue
or wq->wq_dqueue, so we can't just move a batch of entries onto a
temporary queue.  Instead, use a marker node to delimit when the
batch ends.

XXX pullup

(riastradh)

2020-02-01 13:48:18 UTC MAIN commitmail json YAML

opencrypto orders new_session -> process for us.

No need for membar_producer.

Discussed with hikaru@.

(riastradh)

2020-02-01 13:48:09 UTC MAIN commitmail json YAML

softint_disestablish does xc_barrier(0) for us already.

(riastradh)

2020-02-01 13:35:12 UTC MAIN commitmail json YAML

Redocument xc_barrier.

Be more clearer, and more correcter, about what it does.

(riastradh)

2020-02-01 12:55:35 UTC MAIN commitmail json YAML

2020-02-01 12:55:26 UTC MAIN commitmail json YAML

2020-02-01 12:55:13 UTC MAIN commitmail json YAML

pic_pending_zero is unnecessary; percpu_alloc already zeroes.

(riastradh)

2020-02-01 12:55:03 UTC MAIN commitmail json YAML

Switch arm pic allocation and initialization to percpu_create.

(riastradh)

2020-02-01 12:54:51 UTC MAIN commitmail json YAML

2020-02-01 12:54:30 UTC MAIN commitmail json YAML

Switch opencrypto to percpu_create.

Can't sleep for allocation in percpu_foreach.

(riastradh)

2020-02-01 12:53:41 UTC MAIN commitmail json YAML

2020-02-01 12:51:19 UTC MAIN commitmail json YAML

Use __read_mostly and gather related __cacheline_aligned together.

Should save a few bytes of kernel.

(riastradh)

2020-02-01 12:49:02 UTC MAIN commitmail json YAML

New function percpu_create.

Associates a constructor and destructor with the percpu.  Currently
the constructor runs immediately, but in principle we could use the
same API for future CPU hotplug support.

This lets you sleep for allocation or draining users before
deallocation when setting up or tearing down a percpu -- currently we
have many abuses of percpu_foreach in tree for that purpose.

Proposed on tech-kern:
https://mail-index.NetBSD.org/tech-kern/2020/01/30/msg026036.html

(riastradh)

2020-02-01 02:58:15 UTC MAIN commitmail json YAML

Switch if_vlan to atomic_load/store_*.

Fix missing membar_datadep_consumer -- now atomic_load_consume -- in
vlan_lookup_tag_psref.

(riastradh)

2020-02-01 02:58:06 UTC MAIN commitmail json YAML

Switch if_l2tp to atomic_load/store_*.

Fix missing membar_datadep_consumer -- now atomic_load_consume -- in
l2tp_lookup_session_ref.

(riastradh)

2020-02-01 02:57:56 UTC MAIN commitmail json YAML

Fix order in rollback case; switch if_ipsec to atomic_load/store_*.

(riastradh)

2020-02-01 02:57:45 UTC MAIN commitmail json YAML

Switch if_gif to atomic_load/store_*.

(riastradh)

2020-02-01 02:54:31 UTC MAIN commitmail json YAML

Fix wrong memory order and switch pfil to atomic_load/store_*.

(riastradh)

2020-02-01 02:54:02 UTC MAIN commitmail json YAML

Fix wrong memory order and switch bpf to atomic_load/store_*.

(riastradh)

2020-02-01 02:33:09 UTC MAIN commitmail json YAML

Use atomic_load_acquire for FreeBSDish atomic_load_acq_uint shim.

(riastradh)

2020-02-01 02:32:40 UTC MAIN commitmail json YAML

Use atomic_load/store_* in ena(4), not questionable membar_sync.

(riastradh)

2020-02-01 02:23:23 UTC MAIN commitmail json YAML

Load struct fdfile::ff_file with atomic_load_consume.

Exceptions: when we're only testing whether it's there, not about to
dereference it.

Note: We do not use atomic_store_release to set it because the
preceding mutex_exit should be enough.

(That said, it's not clear the mutex_enter/exit is needed unless
refcnt > 0 already, in which case maybe it would be a win to switch
from the membar implied by mutex_enter to the membar implied by
atomic_store_release -- which I would generally expect to be much
cheaper.  And a little clearer without a long comment.)

(riastradh)

2020-02-01 02:23:04 UTC MAIN commitmail json YAML

Load struct filedesc::fd_dt with atomic_load_consume.

Exceptions: when fd_refcnt <= 1, or when holding fd_lock.

While here:

- Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused.
  => This is used only in fd_close and fd_abort, where it holds.
- Move bounds check assertion in fd_putfile to where it matters.
- Store fd_dt with atomic_store_release.
- Move load of fd_dt under lock in knote_fdclose.
- Omit membar_consumer in fdesc_readdir.
  => atomic_load_consume serves the same purpose now.
  => Was needed only on alpha anyway.

(riastradh)

2020-01-26 22:34:17 UTC MAIN commitmail json YAML

2020-01-26 22:19:54 UTC MAIN commitmail json YAML

Unconditionally enable UATP_DEBUG.

(riastradh)

2020-01-26 22:19:39 UTC MAIN commitmail json YAML

Downgrade noisy message from aprint_verbose to DPRINTF.

(riastradh)

2020-01-26 22:19:27 UTC MAIN commitmail json YAML

Work around quirk of Fountain and Geyser 1 trackpads.

Sometimes they get desynchronized, but we know the last packet is a
17-byte packet, so if we get one early then stop here.

Tested by macallan on an iBook and a PowerBook.  This code path
shouldn't break anything on MacBooks because they have different
total numbers of sensors so this branch won't be reached.

(riastradh)

2020-01-20 16:29:38 UTC MAIN commitmail json YAML

Fix (presently harmless) psato.

Don't overwrite cy_root_node; use cy_trng_node as intended.

(riastradh)

2020-01-19 20:51:13 UTC MAIN commitmail json YAML

2020-01-19 20:41:19 UTC MAIN commitmail json YAML

Remove filemon(4).

Discussed on tech-kern:
https://mail-index.NetBSD.org/tech-kern/2020/01/13/msg025938.html

This was never (intentionally) enabled by default, and the design has
some shortcomings.  You can get mostly the same results with ktrace,
as in usr.bin/make/filemon/filemon_ktrace.c which is now used instead
of filemon for make's meta mode.

If applications require higher performance than ktrace, or nesting
that ktrace doesn't support, we might consider adding something back
into the vfs system calls themselves, without hijacking the syscall
table.  (Might want a more reliable output format too, e.g. one that
can handle newlines in file names.)

(riastradh)

2020-01-19 20:22:57 UTC MAIN commitmail json YAML

Missed a spot -- define _KERNTYPES to get register_t.

(riastradh)

2020-01-19 19:50:54 UTC MAIN commitmail json YAML

Tweak makefile for USE_FILEMON=dev, from sjg.

(riastradh)

2020-01-19 19:49:37 UTC MAIN commitmail json YAML

Per sjg's suggestion, split filemon API into separate back ends.

By default we use the ktrace back end, but the /dev/filemon back end
is available as a compile-time option, by setting USE_FILEMON=dev in
make.  sjg raised concerns about ktrace performance and would like to
continue using /dev/filemon on FreeBSD (which has seen more
maintenance kernel-side) without forking make.

(riastradh)

2020-01-19 19:42:32 UTC MAIN commitmail json YAML

2020-01-12 21:52:36 UTC MAIN commitmail json YAML

Enable sun8icrypto in GENERIC64.

But set its entropy estimate to zero until we have a better idea of
how it works.  Can't really hurt this way unless sun8icrypto is
maliciously dependent on all other inputs to the entropy pool, which
seems unlikely.

(riastradh)

2019-12-18 21:46:03 UTC MAIN commitmail json YAML

Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed.  It is loaded only for fdt platforms at the moment.

Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed.  Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill

(riastradh)

2019-12-18 21:45:44 UTC MAIN commitmail json YAML

New function cpu_startup_hook on arm.

Called at end of cpu_startup.  Can be defined in, e.g., evbarm to do
additional stuff after cpu_startup.  Defined as a weak alias to a
function that does nothing, so optional.

ok jmcneill

(riastradh)

2019-12-18 02:26:48 UTC MAIN commitmail json YAML

Reduce entropy estimate for sun8icrypto TRNG.

NIST's SP800-90B entropy estimation tools put it at no more than .08
bits of entropy per byte of data(!), so estimate 100 bits of data per
bit of entropy.  This is probably not conservative enough -- the NIST
tools were written without knowledge of how this alleged TRNG works!
Knowledge of the physics of how the TRNG is supposed to work could
probably enable a better job at predicting the outputs.

While here, bump the size of data we can sample directly with sysctl
to 4096 bytes.

(riastradh)

2019-12-15 17:17:16 UTC MAIN commitmail json YAML

2019-12-15 01:16:33 UTC MAIN commitmail json YAML

Fix typo -- acknowledge interrupts _and_ errors.

(riastradh)

2019-12-14 17:24:43 UTC MAIN commitmail json YAML

2019-12-14 17:23:47 UTC MAIN commitmail json YAML

2019-12-14 17:23:31 UTC MAIN commitmail json YAML

Omit vestigial unused commented-out experiment.

(riastradh)

2019-12-14 16:58:38 UTC MAIN commitmail json YAML

Just use KASSERTMSG and panic.  No need for custom wrappers.

(riastradh)

2019-12-14 16:58:25 UTC MAIN commitmail json YAML

Remove charade dancing around now-dead RCU patent.

(riastradh)

2019-12-14 15:21:51 UTC MAIN commitmail json YAML

Skip npf_config_sync if nothing to do.

Saves an unnecessary pserialize_perform every second.

(riastradh)

2019-12-10 22:30:34 UTC MAIN commitmail json YAML

Oops -- forgot to kmem_free.

(riastradh)

2019-12-09 14:56:44 UTC MAIN commitmail json YAML

2019-12-09 14:56:30 UTC MAIN commitmail json YAML

Avoid a race between interruption and reacquisition of lock.

Otherwise, we would have leaked the memory in this case.

(riastradh)

2019-12-09 14:56:18 UTC MAIN commitmail json YAML

Make sure ERESTART doesn't come flying out to userland.

I picked ERESTART to mean `all channels are occupied' because that's
what opencrypto(9) uses to decide whether to queue a request, but
it's not appropriate for sysctl(2) to return that.

(riastradh)

2019-12-09 14:56:06 UTC MAIN commitmail json YAML

Factor out some of the self-test logic used for debugging.

Add missing bus_dmamap_sync(POSTWRITE) while here.

(riastradh)