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.
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.
* 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'.
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.
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"!)
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.
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.
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>.
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.
- 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.
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.
- 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.
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).
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.
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.
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)).
my builds don't fail here for some reason, but this causes the
build cluster to fail and this file is gone so my builds should
be failing but i need to figure out why they aren't.