Commit Graph

266053 Commits

Author SHA1 Message Date
jmcneill
c8d46f13f9 Use syscon instead of bus_space_map 2019-03-10 19:47:03 +00:00
christos
4ebe1e1401 Add noreturn where needed. In the prof case because of cassert() and return
in some functions we disable the cassert() for clang. We should really have
a JEMALLOC_PROF_NORETURN and a way to mark the remaining of the function
unreachable.
2019-03-10 19:34:30 +00:00
christos
bd8496e18f Add noreturn for the benefit of clang 2019-03-10 19:32:56 +00:00
christos
6f4fc14722 shorten name, use snprintf 2019-03-10 18:03:40 +00:00
kamil
f43e07b7f7 Add support for trace type selection in kcov(4)
Allow to specify mode in KCOV_IOC_ENABLE synchronizing the functionality
with Linux, FreeBSD and OpenBSD. As a NetBSD (and OpenBSD) specific of
the ioctl(2) interface, the mode argument has to be specified as &value
rather than value.

There are 3 modes available:
 1. KCOV_MODE_NONE       -- no trace specified, useful for testing purposes
 2. KCOV_MODE_TRACE_PC   -- trace the kernel program counter
 3. KCOV_MODE_TRACE_CMP  -- trace comparison instructions and switch statements

Adapt the ATF tests and documentation for new API.

The KCOV_MODE_TRACE_CMP mode is implemented but still awaits for the
GCC 8.x upgrade or selection of Clang/LLVM as the kernel compiler.

Obtained from OpenBSD and adapted for NetBSD by myself.
2019-03-10 17:51:00 +00:00
maxv
ffd738cfac Two changes:
* Allow large pages to be passed in pmap_pdes_valid, this happens under
   DDB when it reads RIP (.text), called via pmap_extract.

 * Invert a branch in pmap_extract, so that 'l_cpu' is not touched if we're
   dealing with the kernel pmap.

This fixes 'boot -d'.
2019-03-10 16:30:01 +00:00
christos
177af116b1 clang does not have the gnu_printf attribute 2019-03-10 15:45:26 +00:00
christos
0a0bcc4d2a turn on debugging to help find problems. 2019-03-10 15:32:42 +00:00
christos
9610e03031 catch up with name change. 2019-03-10 15:31:02 +00:00
kre
b0172d2346 Deal with overflow when the sleep duration given is a simple
integer (previously it was just clamped at the max possible value).
This would have caused
	sleep 10000000000000000000
(or anything bigger) to have only actually slept for 9223372036854775807
secs.   Someone would have noticed that happen, one day, in some other
universe.

This is now an error, as it was previously if this had been entered as
	sleep 1e19

Also detect an attempt to sleep for so long that a time_t will no longer
be able to represent the current time when the sleep is done.

Undo the attempts to work around a broken kernel nanosleep()
implementation (by only ever issuing shortish sleep requests,
and looping).   That code was broken (idiot botch of mine) though
you would have had to wait a month to observe it happen.  I was going
to just fix it, but sanity prevailed, and the kernel got fixed instead.

That allows this to be much simplified, only looping as needed to
handle dealing with SIGINFO.   Switch to using clock_nanosleep()
to implement the delay, as while our nanosleep() uses CLOCK_MONOTONIC
the standards say it should use CLOCK_REALTIME, and if that we
ever changed that, the old way would alter "sleep 5" from
"sleep for 5 seconds" to "sleep until now + 5 secs", which is
subtly different.

Always use %g format to print the original sleep duration in reports of how
much time remains - this works best for both long and short durations.
A couple of other minor (frill) mods to the SIGINFO report message as well.
2019-03-10 15:18:45 +00:00
kre
3f1f0cc730 Fix the code that deals with very long sleeps (> 248 days) which
go beyond the maximum that the callout mechanism can handle.
[See the comments in tvtohz() in subr_sleep.c for the details.]

When that happens the timeout is clamped to MAX_INT (ticks), and the
code in nanosleep1() looped (or tried to) repeating the sleep (aka
kpause()) until the requested end time for the sleep was reached.

Unfortunately, the code assumed that kpause() would return 0 when
it returned after the timeout expired.   But it doesn't, it returns
EWOULDBLOCK instead (why is incomprehensible to me, but I assume
there is a reason.)   [That comes from sleepq_block() which returns
EWOULDBLOCK when callout_halt() indicates that the callout had fired,
which is exactly what has happened when the time has elapsed.]

There was already code to deal with that EWOULDBLOCK and return 0
instead of an error in that case - but it was placed after the
error code was tested against 0 for the purposes of the loop.

Simply move the EWOULDBLOCK->0 mapping earlier, so the code which
is expecting "error == 0" to mean "nothing went wrong" actually
gets to see that happen, and the loop can actually loop.

(Someday the loop should probably be rewritten as a loop, instead of
as a bunch of code followed by a "goto again"!)
2019-03-10 14:45:53 +00:00
mrg
58f8d333d6 only do vdpau headers on vdpau systems.
XXX: make this a common define in the few places
2019-03-10 13:52:11 +00:00
kre
dd8f5519fc Undo previous, in the name of "defined" behaviour, it breaks things.
This is all explained in the comment at the head of the file:

 * Some of the "math" in here is a bit tricky.  We have to beware of
 * wrapping ints.
 *
 * [...] but c->c_time can
 * be positive or negative so comparing it with anything is dangerous.

In particular, "if (c->c_time > ticks)" is simply wrong.

 * The only way we can use the c->c_time value in any predictable way is
 * when we calculate how far in the future `to' will timeout - "c->c_time
 * - c->c_cpu->cc_ticks".  The result will always be positive for future
 * timeouts and 0 or negative for due timeouts.

Go back to the old way.   But write the calculation of delta slightly
differently which will hopefully appease KUBsan.   Perhaps.  In any
case, this code works on any system that NetBSD has any hope of ever
running on, whatever the C standards say is "defined" behaviour.
2019-03-10 13:44:49 +00:00
kamil
923f374452 Fix bug in kcov_multiple_threads in t_kcov
Spawn the expected number of threads rather than hardcoding one value for
all tests.
2019-03-10 13:24:50 +00:00
kamil
f0a7538d78 Sync TODO.sanitizers with reality
Mark compiler-rt sanitizers as imported into src/, but still not
integrated (waiting for Clang/LLVM upgrade to 8.0 or newer).

ESan has been discontinued upstream, drop from plans.

lld ported to NetBSD by <mgorny>, but we need to keep local patches.

Mark kernel-msan as finished for Linux

Mark syzkaller and KCOV as finished projects.
2019-03-10 12:59:03 +00:00
kamil
869dfc9042 Add support for multiple threads in kcov(4)
Reuse the fd_clone() API to associate kcov descriptors (KD) with a file
descriptor. Each fd (/dev/kcov) can be reused for a single LWP.

Add new ATF regression tests and cleanup existing code there. All tests
pass.

Refresh the kcov(4) man page documentation.

Developed with help from <maxv>.
2019-03-10 12:54:39 +00:00
skrll
3d8954378b Fix two oddities...
- remove extraneous semi-colons from do { } while (0) macro definitions
- actually wrap MUTEX_INITIALIZE_ADAPTIVE contents in do { }

Spotted by kre@
2019-03-10 12:49:48 +00:00
mrg
9f50906983 libvdpau pkg-config file is called vdpau.pc.
this does not need a special rule, just to be named correctly.
2019-03-10 12:44:58 +00:00
mrg
5e9cdbeac0 add most of the AMDGPU target makefiles and stuff that don't
touch the build.  this comes from:

commit f90685c11d4460d3098fa35f48b58d1893e974e0
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sat Feb 23 09:46:14 2019 +0200

    Separate MKCLANG from MKLLVM.

    build LLVM libraries as PIC.
    Add AMDGPU target, and adjust tools accordingly.
2019-03-10 12:14:05 +00:00
wiz
91d1f8236d Update mandoc entry, and note new 1.14.5 release. 2019-03-10 11:53:35 +00:00
mrg
f4e2645dc0 - build and install libvdpau and x86 and evbarm.
- add khrplatform.h for mesa_ver=18 platforms.

need to enable libvdpau.pc generation (needs special rules)


this mostly comes from maya in the first one, and a small part
of the second:

commit 48eb746983a5a7967fba221e7b167808af36f44a
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sun Feb 24 09:31:22 2019 +0200

    More of vdpau. Cogs spin.

commit d9fbba8f61a43648d32f160c5fa62626788566ff
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sat Feb 23 22:36:37 2019 +0200

    Adjust for MesaLib 18.

    Build llvmpipe driver on x86 (the driver itself is x86-only).
    build llvm on all x86, even on GCC builds.
    galahad driver removed (upstream).
    Don't build mesa 7 at all.
2019-03-10 11:18:02 +00:00
jmcneill
478d6c3484 Add support for Rockchip eMMC PHY 2019-03-10 11:10:21 +00:00
jmcneill
a14204ca85 Add eMMC clocks 2019-03-10 11:09:35 +00:00
mrg
21af34482f convert make's HAVE_MESA_VER into mesa_ver for set lists 2019-03-10 11:04:08 +00:00
mrg
47a40b7ad1 export HAVE_MESA_VER for use in makefiles and set lists. 2019-03-10 11:02:46 +00:00
mrg
1fd2e2d284 pull across most of the new build infrastruture for mesa18 from maya's
git tree.  this includes may of the changes from the changes below:


commit 52d85e74a1197aace38cc7acb705509e969120e6
Author: coypu <coypu@sdf.org>
Date:   Mon Mar 4 12:25:33 2019 +0200

    Make 32bit archs happier.

    except i386, which now suffers from locked atomics because we
    don't have clever ifunc tricks in libc.

commit ee9b4c19c58127934ed3548ad0d68934cc95ccc7
Author: coypu <coypu@sdf.org>
Date:   Mon Mar 4 09:08:35 2019 +0200

    Adjust includes, append rather than replace, appease clang ppc builds

commit a5341a3ad42572c78b6a2e6e5545bd323d7f2e4c
Author: coypu <coypu@sdf.org>
Date:   Sun Mar 3 11:52:19 2019 +0200

    Resolve i386 atomic issue and set lists.

    XXX libGL in i386 is still causing issues
    XXX pkgconfig file for vdpau
    XXX set lists for arm32

commit 27bffc20bc15186c92cc5b8d5cc08d7299966b34
Author: coypu <coypu@sdf.org>
Date:   Sat Mar 2 21:52:45 2019 +0200

    make llvm sources x86 specific

    hopefully not breaking non-x86 clang builds, which
    have MKLLVM set.

commit f9d34922619cc8f2a224c0138a73985e50daf87f
Author: coypu <coypu@sdf.org>
Date:   Sat Mar 2 21:33:31 2019 +0200

    move hack to build llvm libraries soon enough.

    add u_process.c to libGL specifically (dri, gallium and libGL all need
    it).

    Add some missing includes for pipe-loader when it moved to gallium

commit 2b1083d0d538bb5d5dd88ab2ca0ca6c331e5dd5b
Author: coypu <coypu@sdf.org>
Date:   Sat Mar 2 16:47:58 2019 +0200

    shuffle around:

    some files move from shared driver.mk/loader.mk into gallium.
    others move to shared.

    add i915 files.

    now i965 glxgears works (amd64).

commit 1897a90569b30b294bcbedadb3745092eca0bb33
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sun Feb 24 23:36:26 2019 +0200

    Progress towards glxgears on i915

commit 28c9c99a236404de41ae74e88ea6d9578c088b92
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sun Feb 24 21:55:56 2019 +0200

    rototill i965/i915 causing it to no longer startx.

    Now missing sw_screen_create in the dri driver.

commit 48eb746983a5a7967fba221e7b167808af36f44a
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sun Feb 24 09:31:22 2019 +0200

    More of vdpau. Cogs spin.

commit d9fbba8f61a43648d32f160c5fa62626788566ff
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sat Feb 23 22:36:37 2019 +0200

    Adjust for MesaLib 18.

    Build llvmpipe driver on x86 (the driver itself is x86-only).
    build llvm on all x86, even on GCC builds.
    galahad driver removed (upstream).
    Don't build mesa 7 at all.
2019-03-10 10:51:58 +00:00
kamil
24ff731477 Rename je_mallctltomib to je_mallctlnametomib
This unbreaks the build.
2019-03-10 10:00:29 +00:00
christos
8f28406217 add missing externs. 2019-03-10 03:54:08 +00:00
christos
b8c1d815cd Make the non-standard jemalloc api weak. 2019-03-10 02:49:52 +00:00
mrg
e3ecb7100d move mesa10 build into .old scheme:
- add ${X11SRCDIR.MesaLib.old} and introduce ${X11SRCDIR.Mesa} as an
  alias for either the former or the non old.  this allows many of
  the makefiles to simply use ${X11SRCDIR.Mesa} (but does not really
  enable much sharing of makefiles, but reduces their diffs.)

- use mesa-which.mk to define ${OLD_PREFIX} to either "" or ".old",
  and to know if to build 'dri7' (.old only.)  ${OLD_PREFIX} is used
  by other code (eg, LIBDPLIBS) to pick the right subdir.
2019-03-10 02:29:52 +00:00
mrg
f05065bf5d remove 30-urw-aliases.conf and add 45-generic.conf and 60-generic.conf.
should fix build issues reported on current-users.
2019-03-09 23:46:34 +00:00
jakllsch
69c5b1fa79 Add Tegra124 "mselect" clock and two PCIe-related clocks it sources.
With mainline u-boot (not starting the pci subsystem in the firmware):
Gets to a root prompt instead of hanging during tegrapcie attach, but
PCIe remains non-functional without a modern "xusbpad" phy driver for
Tegra124 (needed to configure the lane map).
2019-03-09 19:41:26 +00:00
kamil
e7e18034ff Reserve DTrace sdt and fdt major numbers
Register cmajor 252 for fbt and 253 for sdt.

Previously the major number was picked randomly and it causes conflicts
with preallocated values for different devices.
2019-03-09 18:53:52 +00:00
kamil
fedd7fc74d Fix MKCATPAGES=yes build
Register missing files in distribution sets.
2019-03-09 18:38:34 +00:00
christos
1d3883b194 Switch i386 and aarch64 to jemalloc (really I could switch everyone at this
point).
2019-03-09 17:59:28 +00:00
christos
24c1376449 no -g 2019-03-09 16:18:37 +00:00
christos
36c6018433 Fix another bug found by jemalloc: don't access dirent entry after closedir(3). 2019-03-09 16:18:22 +00:00
skrll
05e38dac76 Sort DTS 2019-03-09 15:25:33 +00:00
skrll
1759e98be8 Add DTS for Raspberry Pi Compute Module IO board rev1 2019-03-09 15:23:59 +00:00
skrll
fd313234a3 Add DTS for Raspberry Pi Compute Module 3 IO board V3.0 2019-03-09 15:22:45 +00:00
jmcneill
d64fe86fe7 Workaround a bug with ROCKPro64's U-Boot EFI implementation. The booted
device path when booting from SD card sometimes does not include a
MEDIA_DEVICE_PATH component, so in this case fallback to doing an exact
match on the booted device path with the block device path to detect the
default boot device.
2019-03-09 13:16:42 +00:00
kre
421460ff59 In acpi_md_OsRemoveInterruptHandler() redir and mpflags are only
relevant to the NIOAPIC > 0 case (not used without that).  Rearrange
#if's slightly to make that happen (avoid "set but not used" warnings
(aka errors) when NIOAPIC == 0 (or undefined)).
2019-03-09 10:04:41 +00:00
kre
93ab6d4522 error in xen_resumeclocks() is __diagused.
Avoid compile warning (-->error) when ! options DIAGNOSTIC.
2019-03-09 09:51:29 +00:00
maxv
5baac3ac62 New software PTE bits. 2019-03-09 09:09:56 +00:00
hannken
01a7e2e4d9 Rumpkernel has its own thread deallocation. Add missing fstrans_lwp_dtor()
to lwproc_freelwp().

PR bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2 Quad
2019-03-09 09:02:38 +00:00
maxv
e4552b509f Start replacing the x86 PTE bits. 2019-03-09 08:42:25 +00:00
mlelstv
26a59cedc6 More input validation. Fix off-by-1 for size limit. 2019-03-09 07:53:12 +00:00
christos
771773212c add copyright. 2019-03-09 06:12:55 +00:00
christos
e3941ca589 html3 suffixes are .html 2019-03-09 04:57:47 +00:00
christos
d444c9125e PR/54050: Ryo ONODERA: Add the jemalloc-specific api prototypes and extern. 2019-03-09 03:52:10 +00:00