Commit Graph

296422 Commits

Author SHA1 Message Date
skrll db3cbfae74 Trailing whitespace 2022-06-02 07:31:35 +00:00
mrg d4df9519b3 add timeout period to timeout message.
seen on radeon 5450 on an asrock m/b with ryzen 5600g cpu.
2022-06-02 06:51:48 +00:00
mrg 4562bd1970 regen. 2022-06-02 06:50:04 +00:00
mrg b94a10b6b2 add some AMD zen2/3 devices. 2022-06-02 06:49:22 +00:00
ryo e9be3ab9f3 tidy up backtrace from crash(9) on aarch64
- fix to dump trapframe when backtracing from crash(8).
- use db_read_bytes() when reading kernel memory.
2022-06-02 05:09:01 +00:00
msaitoh d489dfd2a7 KNF. No functional change. 2022-06-02 01:57:27 +00:00
rin 6dbfdbfddd As a tiny optimization, rearrange cases as follows:
(1) load/store of format D (base + disp)
(2) load/store of format X (base + index)
(3) lmw and stmw

For clang-compiled userland (*), their frequencies are roughly,
(1) > (2) >> (3) ~ 0.

Improvement should be minor; we are already trapped in the alignment
fault handler.

(*) clang unconditionally emits unaligned memory access for powerpc.
    Undocumented -disable-ppc-unaligned option does not work...
2022-06-02 00:32:14 +00:00
rin a6e7fa5d9d Localize one more variable to NPCI > 0 block. Fix ia64 build. 2022-06-02 00:12:20 +00:00
wiz c68827c5a8 tmux 3.3 out. 2022-06-01 21:01:44 +00:00
riastradh caa8fd7fab cprng(9): cprng_fast is no longer used from interrupt context.
Rip out logic to defer reseeding to softint.
2022-06-01 15:44:37 +00:00
riastradh 8449a122ed mvxpsec(4): Fix missing change to freesession return type.
Not sure how this didn't get committed before -- it was supposed to be
part of this change:

https://mail-index.netbsd.org/source-changes/2022/05/22/msg138764.html
2022-06-01 15:40:15 +00:00
hannken 06cc9cbbb4 tmpfs_read: respect MNT_NOATIME. 2022-06-01 08:42:38 +00:00
skrll a87e9e305a delay slot indentation 2022-06-01 06:18:04 +00:00
martin 9ade61f41b Revert previous, the mask is intented to be like sc_output_mask, a bitmask
of active ports.
2022-06-01 06:05:47 +00:00
martin 4a9ec7ddb8 In SNAPPER_OUTPUT_SELECT the "mask" is a bitmap of muted outputs, not
active outputs.
2022-06-01 05:47:37 +00:00
martin 28979bf0d0 Recognize the OF labels used for line output and headphone output on a
G5 powermac 7,3.
2022-06-01 05:42:52 +00:00
msaitoh 9d31b7fb5a Correctly enter the recovery mode. Not tested. 2022-06-01 05:06:45 +00:00
msaitoh eaf5c01ba5 Correctly re-enable queue interrupt in ixgbe_legacy_irq().
- Don't enable queue 1-15 interrupt.
- Don't enable queue 0 interrupt when the queue work is being scheduled.
- OK'd by knakahara.
2022-06-01 04:15:41 +00:00
msaitoh 675be85245 Simplify ixgbe_msix_que(). No functional change. 2022-06-01 02:07:24 +00:00
mrg 612bc22b90 add now required pci.h / NPCI. (the ia64 version builds with PCI
enabled, but i guess it won't be usable.)

XXX:  enable this on evbarm*?  it is x86/ia64 only currently.
2022-06-01 00:50:24 +00:00
mrg 78608607bf reorganise most of the NetBSD portion of nvkm_mem_dtor().
when nvkm_mem_new_host() is called via the in-kernel ioctl method,
we copy the supplied dmamap, use it's dm_nsegs value for allocation
of "mem->dma", and assume it remains valid until we're done.

when this path is taken "mem->mem" remains NULL so all the code in
nvkm_mem_dtor() is ignored, and the "mem->dma" is leaked.  this is
one leak seen in PR#56826.  as "dmamap->dm_nsegs" can become invalid
before the dtor call, store the value in "mem->nseg" for use in the
dtor, and convert the dtor to free "mem->dma" if "mem->dma" is set.
additionally, "mem->pages" should end up being the same value as
"nseg" here, ASSERT() this.

while here properly mark NetBSD specific code in nvkm_mem_new_host().

additionally, destroy the dmamap created in the non-ioctl path of
nvkm_mem_new_host().  this is another leak seen in PR#56826.

with both of these fixes my "kmem-04096" pool does not grow rapidly
while using "mpv -vo gpu".  infact, once i loaded the relevant file
into memory, this pool remains stable after at least one minute of
video playback.

ok riastradh@
2022-05-31 20:53:35 +00:00
mrg ef019da374 allow ACPI to compile without PCI support. fixes ia64 build. 2022-05-31 20:28:57 +00:00
christos 998b891be9 document gomoku 2022-05-31 19:14:10 +00:00
christos 780fb67fe8 Elide vax breakage 2022-05-31 19:11:58 +00:00
bouyer aa8c264bfb For some reason on my system, the guest starts with a pending event in
the shared structure. On i386, this cause hypervisor_callback to be
entered before cpu_info_primary is fully initialised, especially on i386
ci_intrstack is still NULL, which cause a crash when we try to use it.
Work around by recycling the boot's tmp stack for this until cpu_attach()
is called.
2022-05-31 18:04:11 +00:00
bouyer 08505f36fe When we have pending events in stipending(), evt_set_pending() has to set
the ih_pending flag for each handler too. Xen/i386 should be stable again.
2022-05-31 18:01:22 +00:00
christos 5f34f68b67 fix lint build on vax 2022-05-31 17:52:35 +00:00
tsutsui 27c79ee43b Restore NULL pointer checks lost in rev 1.16.
Fixes PR port-atari/56859, ok'ed mlelstv@, and confirmed on TT030.
Should be pulled up to netbsd-9 and netbsd-8.
2022-05-31 15:24:59 +00:00
riastradh e3d96c2fb2 libpthread(3): Fix a marvellous interaction with rtld.
Patch from chs@.  Comment explaining the story by me.  This patch may
not be optimal -- maybe it would be better in pthread__init, or
better for rtld to call _lwp_unpark after _lwp_park in the contened
case -- but we've tested this version and it's annoying to reproduce,
so let's take this version and worry about testing improvements
later.
2022-05-31 14:23:39 +00:00
bouyer 8ca6eb41dd Revert previous; evt_set_pending() will set ret to 1 if needed to this was
not our bug.
2022-05-31 14:21:44 +00:00
riastradh 0a3781717d vnd(4): Work around deadlock in VNDIOCCLR.
Since the changes this year to eliminate a host of races and
deadlocks in open, close, revoke, attach, and detach, closing the
last instance of a device special node has the side effect of waiting
for all concurrent I/O operations (read, write, ioctl, strategy, &c.)
on the device to complete.

Unfortunately, while this works for physical devices which revoke
open device nodes in their autoconf detach functions, as invoked by
some hardware interrupt indicating that the device is no longer
present, pseudo-devices like vnd(4) work differently -- or, work by
luck, or don't work any more.

VNDIOCCLR acts kind of like an autoconf detach function in that it
revokes open device nodes, which closes the last instance.  But
VNDIOCCLR is itself called via ioctl, which is an I/O operation that
close waits for.  So we end up with a deadlock, spec_io_drain waiting
for spec_close lower down in the call stack:

> spec_io_drain() at netbsd:spec_io_drain+0x84
> spec_close() at netbsd:spec_close+0x1c6
> VOP_CLOSE() at netbsd:VOP_CLOSE+0x38
> spec_node_revoke() at netbsd:spec_node_revoke+0x14d
> vcache_reclaim() at netbsd:vcache_reclaim+0x4e7
> vgone() at netbsd:vgone+0xcd
> vrevoke() at netbsd:vrevoke+0xfa
> genfs_revoke() at netbsd:genfs_revoke+0x13
> VOP_REVOKE() at netbsd:VOP_REVOKE+0x35
> vdevgone() at netbsd:vdevgone+0x64
> vnddoclear.part.0() at netbsd:vnddoclear.part.0+0xaa
> vndioctl() at netbsd:vndioctl+0x78c
> bdev_ioctl() at netbsd:bdev_ioctl+0x91
> spec_ioctl() at netbsd:spec_ioctl+0xa5
> VOP_IOCTL() at netbsd:VOP_IOCTL+0x41
> vn_ioctl() at netbsd:vn_ioctl+0xb3
> sys_ioctl() at netbsd:sys_ioctl+0x555

In the past, there was a workaround for what was presumably a crash
instead of a deadlock here: don't issue revoke (vdevgone) on the open
character devices for the minor number in use by the ioctl.  If you
use, e.g., `vnconfig -u vnd0', and vnconfig(8) picks /dev/rvnd0c or
/dev/rvnd0d, that special case kicks in.  But if you use `vnconfig -u
/dev/vnd0d', the ioctl will be issued on the block device instead, so
the special case doesn't kick in, so the operation deadlocks.

It is actually probably safe not to revoke the block device if what
the ioctl caller holds open is that, because specfs(9) forbids more
than one open of a block device, so nothing else can have it open
anyway.

Unclear what the consequences of failing to revoke the character
device are -- but this is what vnd(4) has done all along.  cgd(4) and
ccd(4) also don't bother to revoke.  We don't have a notion of
`revoke every file descriptor _except_ this one'; only a vnode as a
whole can be revoked, including all references to it.

This is a stop-gap measure to avoid a deadlock we are definitely
hitting on some users.  A slightly better measure would be to revoke
the block or character device according to which one is being used,
but that requires a little more work with two different d_ioctl
functions -- and wouldn't address isues with the character device.  A
proper solution requires identifying the appropriate protocol for all
of these pseudo-device disk drivers and using it uniformly for them.

Reported on current-users:
https://mail-index.netbsd.org/current-users/2022/05/27/msg042437.html
2022-05-31 14:13:31 +00:00
riastradh 2b5e567d9c libc: Reintroduce getentropy.
This was introduced two years ago when the getrandom/getentropy API
question was still open, and removed because the discussion was
ongoing.  Now getentropy is more widely adopted and soon to be in
POSIX.  So reintroduce the symbol into libc since we'll be keeping it
anyway.  Discussion of details of the semantics, as interpreted by
NetBSD, is ongoing, but the symbol needs to get in before the
netbsd-10 branch.  The draft POSIX text is
(https://www.opengroup.org/austin/docs/austin_1110.pdf):

    SYNOPSIS
        #include <unistd.h>

        int getentropy(void *buffer, size_t length);

    DESCRIPTION
        The getentropy() function shall write length bytes of data
        starting at the location pointed to by buffer. The output
        shall be unpredictable high quality random data, generated by
        a cryptographically secure pseudo-random number
        generator. The maximum permitted value for the length
        argument is given by the {GETENTROPY_MAX} symbolic constant
        defined in <limits.h>.

    RETURN VALUES
        Upon successful completion, getentropy() shall return 0;
        otherwise, -1 shall be retunred and errno set to indicate the
        error.

    ERRORS
        The getentropy() function shall fail if:

        [EINVAL]        The value of length is greater than
                        {GETENTROPY_MAX}.

        The getentropy() function may fail if:

        [ENOSYS]        The system does not provide the necessary
                        source of entropy.

    RATIONALE
        The getentropy() function is not a cancellation point.

Minor changes from the previous introduction of getentropy into libc:

- Return EINVAL, not EIO, on buflen > 256.
- Define GETENTROPY_MAX in limits.h.

The declaration of getentropy in unistd.h and definition of
GETENTROPY_MAX in limits.h are currently conditional on
_NETBSD_SOURCE.  When the next revision of POSIX is finalized, we can
expose them also under _POSIX_C_SOURCE > 20yymmL as usual -- and this
can be done as a pullup without breaking existing compiled programs.
2022-05-31 13:42:58 +00:00
andvar 4c33e72fa2 s/longeset/longest/ and s/collsion/collision/ in comments. 2022-05-31 12:59:00 +00:00
bouyer a932986dc8 stipending(): if we're going to process some interrupts don't return 0.
Hopefully fixes random hang seen in i386 Xen PV.

The bug has been there ~forever but was masked by the fact that spllower()
did call event handlers much more often.
2022-05-31 12:52:59 +00:00
andvar bc2346d6b2 s/disbale/disable/ and s/enbale/enable/ in comments. also one more typo fix. 2022-05-31 11:22:33 +00:00
andvar ff23aff6ad fix various typos in comments, documentation and messages. 2022-05-31 08:43:13 +00:00
ryo 5c1221df4e make a frame pointer to show a backtrace correctly. 2022-05-31 07:40:25 +00:00
skrll 8279d5c63e Avoid plabels on hppa to make some tests not crash 2022-05-31 07:12:15 +00:00
skrll 3fed35fccd whitespace including space before delay slot instruction. 2022-05-31 07:10:50 +00:00
mrg 4e4ca7afa5 add .mobi / application/x-mobipocket-ebook. 2022-05-31 06:34:33 +00:00
rillig 3851fec05f lint: fix null pointer dereference after syntax error
Found by afl, starting with the malformed input '/**/f=({;/**/};}' that
no longer crashes.  This input led to 'f=({L:;}', which is at least a
syntactically valid prefix of a translation unit, containing a GCC
statement expression with an unused label.  The error message for this
unused label assumed that it would always be inside a function
definition.

While here, document incomplete recovery after syntax errors, in
msg_249.c.
2022-05-31 00:35:18 +00:00
riastradh 5d78e847e1 nouveau(4): Fix error branches in nouveau_gem_new.
PR kern/56804
2022-05-31 00:17:10 +00:00
rillig 41e8e17da5 lint: prevent assertion failure after parse error from grammar
Instead of running into an assertion failure, the malformed input
'f=({;};}' now generates:

malformed.c(1): error: syntax error ';' [249]
malformed.c(1): warning: ({ }) is a GCC extension [320]
malformed.c(1): warning: ({ }) is a GCC extension [320]
malformed.c(1): error: cannot recover from previous errors [224]
2022-05-31 00:01:35 +00:00
mrg 0c616c7739 re-do previous - it likely broke kmem cache init.
use {0} for zero sentinel.
2022-05-30 23:36:26 +00:00
rillig d29c42aad7 lint: clean up comments
No binary change.
2022-05-30 23:27:45 +00:00
rillig 1dbb90f7e0 lint: clean up usage messages
The two synopsis forms differed in the spelling of 'file ...'.

The options string for getopt does not start with ':', which led to a
duplicate message 'unknown option -- ?' followed by 'Unknown flag ?'.

Be more specific when calling 'lint file.c -u'; the message 'Unknown
argument' was not helpful as it didn't pinpoint that there are two
different phases for parsing options.  In the second phase, only the
options '-L' and '-l' are recognized.

In the manual page, mention the difference between the two synopsis
forms as early as possible.  The two synopsis forms are very similar and
both have far to many options to see the difference at a glance.
2022-05-30 23:02:02 +00:00
mrg be29823e77 apply some missing #ifn?def KDTRACE_HOOKS from the previous. 2022-05-30 21:42:02 +00:00
jkoshy f54da51165 Use the ABI value for 'R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC'. 2022-05-30 21:18:37 +00:00
riastradh 9c52e5d2f7 kmem(9): Create dtrace sdt probes for each kmem cache size.
The names of the probes correspond to the names shown in vmstat -m.
This should make it much easier to track down who's allocating memory
when there's a leak, e.g. by getting a histogram of stack traces for
the matching kmem cache pool:

   # vmstat -m
   Memory resource pool statistics
   Name        Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
   ...
   kmem-00128   256    62242    0        0  3891     0  3891  3891     0   inf    0
   ...
   # dtrace -n 'sdt:kmem:*:kmem-00128 { @[probefunc, stack()] = count() }'
   ^C

When there's no leak, the allocs and frees (probefunc) will be roughly
matched; when there's a leak, the allocs will far outnumber the frees.
2022-05-30 20:28:30 +00:00
riastradh c4afc10ed1 virtio at pci: Provide attribution in debug message.
Also make it only happen in the error case so success doesn't clutter
up the console output.
2022-05-30 20:28:18 +00:00