dragonfly.git
2 years agonvmm: Port to DragonFly #13: debug register save & restore
Aaron LI [Sun, 16 May 2021 09:18:00 +0000 (17:18 +0800)]
nvmm: Port to DragonFly #13: debug register save & restore

Derived from NetBSD's x86_dbregs_save()/x86_dbregs_restore() in
'sys/arch/x86/x86/dbregs.c'.

2 years agonvmm: Port to DragonFly #12: FPU save & restore
Aaron LI [Tue, 25 May 2021 06:40:41 +0000 (14:40 +0800)]
nvmm: Port to DragonFly #12: FPU save & restore

Note that the host FPU state is indeterminant and depends on whether
the user program used the FPU or not, so there might not be any state to
save.  npxpush() and npxpop() can handle this.  Accordingly, need to use
'mcontext_t' to store host FPU state.

At first I used fpu_area_save() and fpu_area_restore() to deal with the
host FPU state, but it caused a hard fault loop when trying to boot an
OS in QEMU, because it failed to handle an uninitialized FPU.  Thanks
to Matt Dillon for tracking it down and fixing it.

Credit to FreeBSD vmm code: save_guest_fpustate(), restore_guest_fpustate()

2 years agonvmm: Port to DragonFly #11: CPU features
Aaron LI [Sat, 15 May 2021 14:37:08 +0000 (22:37 +0800)]
nvmm: Port to DragonFly #11: CPU features

2 years agonvmm: Port to DragonFly #10: cpu_info etc.
Aaron LI [Fri, 14 May 2021 12:10:32 +0000 (20:10 +0800)]
nvmm: Port to DragonFly #10: cpu_info etc.

* Replace 'struct cpu_info' with 'struct globaldata'.
* Port cpu_info's ci_tss_sel/ci_tss/ci_gdt.
* Port curcpu(), cpu_number(), cpu_index() functions.
* Port CPU iteration code.

2 years agonvmm: Port to DragonFly #9: atomic operations
Aaron LI [Fri, 14 May 2021 00:09:58 +0000 (08:09 +0800)]
nvmm: Port to DragonFly #9: atomic operations

Add compat defines for NetBSD's atomic_inc_64(), atomic_{inc,dec}_uint().
However, we don't have an alternative for the type-generic
atomic_load_relaxed() function.  So just modify the code accordingly.

2 years agonvmm: Port to DragonFly #8: kcpuset(9) -> cpumask(9)
Aaron LI [Wed, 12 May 2021 23:25:59 +0000 (07:25 +0800)]
nvmm: Port to DragonFly #8: kcpuset(9) -> cpumask(9)

Translate NetBSD's kcpuset(9) API to our cpumask(9) API.  Use the atomic
version to avoid possible races between multiple vCPUs.

2 years agonvmm: Port to DragonFly #7: memory allocation
Aaron LI [Wed, 12 May 2021 23:23:04 +0000 (07:23 +0800)]
nvmm: Port to DragonFly #7: memory allocation

Add compat code to adapt NetBSD's kmem_alloc()/kmem_zalloc()/kmem_free().

2 years agonvmm: Port to DragonFly #6: mutex/rwlock
Aaron LI [Tue, 11 May 2021 23:16:23 +0000 (07:16 +0800)]
nvmm: Port to DragonFly #6: mutex/rwlock

Add compat code to adapt NetBSD's mutex and rwlock to use DragonFly's
lockmgr(9).

2 years agonvmm: Port to DragonFly #5: constants/functions/macros
Aaron LI [Sun, 30 May 2021 08:02:49 +0000 (16:02 +0800)]
nvmm: Port to DragonFly #5: constants/functions/macros

Update nvmm_compat.h to include various compat constant/functions
defines.

2 years agonvmm: Port to DragonFly #4: PAT modes
Aaron LI [Sun, 30 May 2021 08:01:24 +0000 (16:01 +0800)]
nvmm: Port to DragonFly #4: PAT modes

Adapt NetBSD's PATENTRY() and PAT_* modes to ours PAT_VALUE() and PAT_*
defines.

2 years agonvmm: Port to DragonFly #3: CR/MSR defines
Aaron LI [Tue, 11 May 2021 23:10:55 +0000 (07:10 +0800)]
nvmm: Port to DragonFly #3: CR/MSR defines

Add XCR0 and various MSRs compat defines.

2 years agonvmm: Port to DragonFly #2: CPUID Fn0000_000B for SVM
Aaron LI [Tue, 11 May 2021 23:03:56 +0000 (07:03 +0800)]
nvmm: Port to DragonFly #2: CPUID Fn0000_000B for SVM

Add CPUID Fn0000_000B (Extended Topology Enumeration) defines for SVM.

Obtained from NetBSD.

2 years agonvmm: Port to DragonFly #1: nvmm_x86_{svmfunc,vmxfunc}.S
Aaron LI [Tue, 11 May 2021 06:25:17 +0000 (14:25 +0800)]
nvmm: Port to DragonFly #1: nvmm_x86_{svmfunc,vmxfunc}.S

2 years agonvmm: Port to DragonFly #0: initial nvmm_compat.h
Aaron LI [Tue, 25 May 2021 06:39:10 +0000 (14:39 +0800)]
nvmm: Port to DragonFly #0: initial nvmm_compat.h

Add nvmm_compat.h to hold the major compatibility code for the porting.
Currently there are mostly CPUID2_* and CPUID_SEF_* defines.

Credit to Jaromír Doleček for his initial porting of NVMM to DragonFly.
See: https://github.com/Moritz-Systems/DragonFlyBSD/commit/b96e5836fd25b448bb54775ac0107917adc2937d

2 years agoAdd group 'nvmm' and GID_NVMM for nvmm(4) & nvmmctl(8)
Aaron LI [Sun, 9 May 2021 23:06:54 +0000 (07:06 +0800)]
Add group 'nvmm' and GID_NVMM for nvmm(4) & nvmmctl(8)

2 years agonvmm.4: Add HISTORY and hook to build
Aaron LI [Sun, 9 May 2021 23:03:31 +0000 (07:03 +0800)]
nvmm.4: Add HISTORY and hook to build

2 years agonvmm: Bring some minor changes from NetBSD-current
Aaron LI [Sun, 9 May 2021 22:52:17 +0000 (06:52 +0800)]
nvmm: Bring some minor changes from NetBSD-current

These changes help port NVMM to DragonFly by reducing the required
difference.

2 years agoImport nvmm.4 manpage from NetBSD 9-stable
Aaron LI [Wed, 5 May 2021 08:16:06 +0000 (16:16 +0800)]
Import nvmm.4 manpage from NetBSD 9-stable

Branch: NetBSD 9-stable
Date: Fri Apr 30 14:08:16 2021 +0000
Path: share/man/man4/nvmm.4

2 years agoImport nvmmctl(8) from NetBSD 9-stable
Aaron LI [Wed, 5 May 2021 08:06:40 +0000 (16:06 +0800)]
Import nvmmctl(8) from NetBSD 9-stable

This is a program to control NVMM(4) virtual machines.  It currently
implements the following two commands:
- identify: display the capabilities of the system.
- list: display information on each virtual machine registered in the
  system.

Branch: NetBSD 9-stable
Date: Fri Apr 30 14:08:16 2021 +0000
Path: usr.sbin/nvmmctl

2 years agoImport libnvmm(3) from NetBSD 9-stable
Aaron LI [Wed, 5 May 2021 07:58:32 +0000 (15:58 +0800)]
Import libnvmm(3) from NetBSD 9-stable

This is the virtualization API that provides a way for VMM software to
effortlessly create and manage virtual machines via NVMM(4).

Branch: NetBSD 9-stable
Date: Fri Apr 30 14:08:16 2021 +0000
Path: lib/libnvmm

2 years agoImport nvmm(4) from NetBSD 9-stable
Aaron LI [Wed, 5 May 2021 07:35:16 +0000 (15:35 +0800)]
Import nvmm(4) from NetBSD 9-stable

This is the kernel driver that provides support for hardware-accelerated
virtualization.  It is made of an MI frontend with the following two MD
backends:
- x86 Intel VMX
- x86 AMD SVM

Branch: NetBSD 9-stable
Date: Fri Apr 30 14:08:16 2021 +0000
Path: sys/dev/nvmm

2 years ago<sys/signal.h>: Put sig_t and sigmask() under __BSD_VISIBLE.
Sascha Wildner [Tue, 20 Jul 2021 16:01:52 +0000 (18:01 +0200)]
<sys/signal.h>: Put sig_t and sigmask() under __BSD_VISIBLE.

2 years agopam_passwdqc: Local modifications.
Sascha Wildner [Tue, 20 Jul 2021 14:53:51 +0000 (16:53 +0200)]
pam_passwdqc: Local modifications.

2 years agoMerge branch 'vendor/PAM_PASSWDQC'
Sascha Wildner [Tue, 20 Jul 2021 14:52:42 +0000 (16:52 +0200)]
Merge branch 'vendor/PAM_PASSWDQC'

2 years agoImport passwdqc 2.0.2 vendor/PAM_PASSWDQC
Sascha Wildner [Tue, 20 Jul 2021 14:50:57 +0000 (16:50 +0200)]
Import passwdqc 2.0.2

2 years agoopenpam: Push README.DELETED to master.
Sascha Wildner [Tue, 20 Jul 2021 14:46:18 +0000 (16:46 +0200)]
openpam: Push README.DELETED to master.

2 years agoImport OpenPAM Tabebuia.
Sascha Wildner [Tue, 20 Jul 2021 14:45:26 +0000 (16:45 +0200)]
Import OpenPAM Tabebuia.

Fixes an off-by-one in pam_getenv(3).

See HISTORY for the details.

2 years agosbin/hammer2: Print freemap leaf's linear offset when "show"
Tomohiro Kusumi [Sat, 17 Jul 2021 16:23:28 +0000 (01:23 +0900)]
sbin/hammer2: Print freemap leaf's linear offset when "show"

2 years agosys/vfs/hammer2: Fix compilation when HAMMER2_IO_DEBUG enabled
Tomohiro Kusumi [Thu, 15 Jul 2021 16:45:08 +0000 (01:45 +0900)]
sys/vfs/hammer2: Fix compilation when HAMMER2_IO_DEBUG enabled

No such field debug_data in struct hammer2_io.

2 years agosys/vfs/hammer2: #if0 incomplete HAMMER2_FREEMAP_{DOMAYFREE,DOREALFREE} related
Tomohiro Kusumi [Wed, 14 Jul 2021 16:12:28 +0000 (01:12 +0900)]
sys/vfs/hammer2: #if0 incomplete HAMMER2_FREEMAP_{DOMAYFREE,DOREALFREE} related

Disable related code in addition to already #if0'd parts.

Neither "how == HAMMER2_FREEMAP_DOMAYFREE" nor "how == HAMMER2_FREEMAP_DOREALFREE"
happen. Looks like these weren't completely implemented since first
appeared in 10136ab6cde1969ab6ca22168b2a10ed5d9cc557 in 2013.

2 years agosys/vfs/hammer2: Remove unused HAMMER2_XOP_IROOT
Tomohiro Kusumi [Mon, 12 Jul 2021 17:02:23 +0000 (02:02 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_XOP_IROOT

Never used since first appeared in 6f445d15835c6677a0a79c8d168ef44d0b9b22c3 in 2018.
Also remove a comment for nonexistent HAMMER2_XOP_RECURSE.

2 years agokernel/acpi: Adjust MADT revision check.
Sascha Wildner [Sat, 17 Jul 2021 09:02:22 +0000 (11:02 +0200)]
kernel/acpi: Adjust MADT revision check.

2 years agoUpdate the pciconf(8) database.
Sascha Wildner [Thu, 15 Jul 2021 03:53:32 +0000 (05:53 +0200)]
Update the pciconf(8) database.

July 5, 2021 snapshot from https://pci-ids.ucw.cz

2 years agolibstand: Unbreak buildworld.
Sascha Wildner [Tue, 13 Jul 2021 04:31:03 +0000 (06:31 +0200)]
libstand: Unbreak buildworld.

Oops, this was a stupid last minute mistake.

2 years agoMake stand/lib an internal one, i.e. don't install libstand anymore.
Sascha Wildner [Mon, 12 Jul 2021 14:36:07 +0000 (16:36 +0200)]
Make stand/lib an internal one, i.e. don't install libstand anymore.

Nothing in dports needs it either.

Also, leave the manual page.

2 years agoboot: Move boot source code /usr/src/stand.
Sascha Wildner [Mon, 12 Jul 2021 14:20:16 +0000 (16:20 +0200)]
boot: Move boot source code /usr/src/stand.

sys/boot becomes stand/boot and lib/libstand becomes stand/lib.

My main reason is to have boot out of the way when for example grepping
in sys/. It also makes more sense since it's not really userland or
kernel code.

Other BSDs have moved their boot/standalone code around too, but maybe
with different directory layouts.

Approved-by: dillon, zrj
2 years agosys/vfs/hammer2: Remove unused HAMMER2_OFFSET_{MIN,MAX}
Tomohiro Kusumi [Wed, 7 Jul 2021 17:18:06 +0000 (02:18 +0900)]
sys/vfs/hammer2: Remove unused HAMMER2_OFFSET_{MIN,MAX}

Never used since first appeared in 504565062f34ec55037ac0cf308fe3562f091460 in 2014.

2 years agoperiodic/whatis: Remove whatis(1) db rebuilding for localized manpages.
Sascha Wildner [Sun, 11 Jul 2021 10:01:53 +0000 (12:01 +0200)]
periodic/whatis: Remove whatis(1) db rebuilding for localized manpages.

makewhatis doesn't have an -L option since the switch to mandoc's version.

Besides, we don't have localized manual pages in base and also in dports
I couldn't find a trace of any.

2 years agoperiodic: Enable {daily,weekly,monthly,security}_show_badconfig by default.
Sascha Wildner [Sat, 10 Jul 2021 17:44:42 +0000 (19:44 +0200)]
periodic: Enable {daily,weekly,monthly,security}_show_badconfig by default.

It can be helpful and found an issue in a dports periodic script, so we
want this on, I guess. Our base scripts have been cleaned up to not error
on optional things like a missing accounting file when accounting is not
enabled, etc.

Reported-by: James Cook (falsifian)
2 years agoperiodic: Do not error with rc==2 for some optional stuff.
Sascha Wildner [Sat, 10 Jul 2021 17:40:39 +0000 (19:40 +0200)]
periodic: Do not error with rc==2 for some optional stuff.

* UFS accounting has to be enabled in rc.conf, and if it is not, the
  script should just do nothing.

* /etc/news.expire is just some backwards compatibility stuff, so
  don't worry if it doesn't exist.

2 years agoperiodic: Do not error with rc=2 when /etc/daily.local etc. don't exist.
Sascha Wildner [Sat, 10 Jul 2021 16:59:54 +0000 (18:59 +0200)]
periodic: Do not error with rc=2 when /etc/daily.local etc. don't exist.

These scripts are only for backwards compatibility and we could even
remove 999.* but for now, just stay silent and do nothing if they
don't exist.

2 years agouname.1: Add missing options to the usage.
Sascha Wildner [Thu, 8 Jul 2021 11:00:07 +0000 (13:00 +0200)]
uname.1: Add missing options to the usage.

Submitted-by: yellowrabbit2010
Dragonfly-bug: https://bugs.dragonflybsd.org/issues/3285

2 years agosys/vfs/hammer2: Use HAMMER2_IND_COUNT_XXX
Tomohiro Kusumi [Sun, 4 Jul 2021 17:32:28 +0000 (02:32 +0900)]
sys/vfs/hammer2: Use HAMMER2_IND_COUNT_XXX

2 years agosys/vfs/hammer2: HAMMER2_CHAIN_BMAP* should be HAMMER2_CHAIN_BLKMAP*
Tomohiro Kusumi [Sun, 4 Jul 2021 16:30:10 +0000 (01:30 +0900)]
sys/vfs/hammer2: HAMMER2_CHAIN_BMAP* should be HAMMER2_CHAIN_BLKMAP*

The freemap code uses "bmap" and "BMAP" for bitmap,
so these two macros should be "BLKMAP" as the comment implies.

2 years agonpx: Remove an unused typedef and clean up a bit
Aaron LI [Wed, 7 Jul 2021 01:12:43 +0000 (09:12 +0800)]
npx: Remove an unused typedef and clean up a bit

* Remove unused typedef bool_t
* Fix a minor typo: FXRSTR -> FXRSTOR
* Fix indentation
* Reorganize a bit

2 years agonpx: Fix inline ASM error in fpu_clean_state()
Aaron LI [Wed, 7 Jul 2021 14:54:03 +0000 (22:54 +0800)]
npx: Fix inline ASM error in fpu_clean_state()

I made a mistake in commit 6becaabbb80a1d1b37c868ce7f22fca2ef6a743f when
I changed it use 'fldz' in the inline ASM.  Fix it.

2 years agomknod(2): Allow for the creation of fifos with mknod() to satisfy POSIX.
Sascha Wildner [Wed, 7 Jul 2021 14:49:16 +0000 (16:49 +0200)]
mknod(2): Allow for the creation of fifos with mknod() to satisfy POSIX.

Calling mknod() and mknodat() with S_IFIFO shall be equivalent to
calling mkfifo() and mkfifoat().

Note that we ignore 'dev' if S_IFIFO is passed, like Linux does, but
different from what {Free,Net,Open}BSD do, which require it to be 0.
It's true that the standard leaves anything but 0 undefined for this
case but also note the standard's example which does indeed pass a
'dev' arg and doesn't take any precautions of initializing it:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html#tag_16_328_06

I don't think it makes any difference in practice, though.

Reported-by: DanDan
While here, fix the manual page's HISTORY a bit (taken from FreeBSD).

2 years agoperiodic/snapshot-hammer2: Change scarce free space handling slightly.
Sascha Wildner [Wed, 7 Jul 2021 14:07:37 +0000 (16:07 +0200)]
periodic/snapshot-hammer2: Change scarce free space handling slightly.

The idea is that whenever the user falls into free space shortage
situation, the "sliding window" of snapshots potentially continues
rolling forward, instead of becoming stuck into the past.

Submitted-by: Francis GUDIN
Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/3287>

2 years agonpx: Use 64-bit version FXSAVE64/FXRSTOR64 and XSAVE64/XRSTOR64
Aaron LI [Mon, 5 Jul 2021 11:50:51 +0000 (19:50 +0800)]
npx: Use 64-bit version FXSAVE64/FXRSTOR64 and XSAVE64/XRSTOR64

Since DragonFly is 64-bit only, use the 64-bit version
FXSAVE64/FXRSTOR64 and XSAVE64/XRSTOR64.

The new FXSAVE64/FXRSTOR64 version represents FIP/FDP as 64-bit fields
(union fp_addr.fa_64), while the legacy FXSAVE/FXRSTOR version uses
split fields: 32-bit offset, 16-bit segment and 16-bit reserved field
(union fp_addr.fa_32).  The latter implies that the actual addresses are
truncated to 32 bits which is insufficient in modern programs.

Improve the inline ASM code a bit to use 'xsave64'/'xrstor64' names.
The extra 'area' variable is introduced to help avoid dereferencing
'void *' pointer.

Referred-to: NetBSD

2 years agonpx: Extend fpusave/fpurstor() to accept an XSAVE mask argument
Aaron LI [Tue, 6 Jul 2021 23:32:56 +0000 (07:32 +0800)]
npx: Extend fpusave/fpurstor() to accept an XSAVE mask argument

XSAVE/XRSTOR requires a mask argument that determines the
components/states to save/restore.  Thus this argument controls the
save area size.

Extend fpusave/fpurstor() functions to accept an XSAVE mask argument,
so the caller can choose the wanted components/states to save/restore
and knows the exact area size.

NVMM will use this feature.

2 years agonpx: Use 'fldz' in fpu_clean_state() to load dummy zero
Aaron LI [Tue, 6 Jul 2021 23:17:46 +0000 (07:17 +0800)]
npx: Use 'fldz' in fpu_clean_state() to load dummy zero

The 'fldz' instruction pushs +0.0 onto the FPU register stack.  Use it
to replace the 'dummy_variable' variable.

Referred-to: NetBSD

2 years agoffs.5 : ffs is the default filesystem for /boot only
Pierre-Alain TORET [Tue, 6 Jul 2021 20:24:05 +0000 (22:24 +0200)]
ffs.5 : ffs is the default filesystem for /boot only

2 years agoinetd: Adjust error message too (a la the removed fcntl one).
Sascha Wildner [Tue, 6 Jul 2021 19:16:53 +0000 (21:16 +0200)]
inetd: Adjust error message too (a la the removed fcntl one).

2 years agoinetd: Use pipe2() instead of pipe()/fcntl()/fcntl() combo.
Sascha Wildner [Tue, 6 Jul 2021 19:12:20 +0000 (21:12 +0200)]
inetd: Use pipe2() instead of pipe()/fcntl()/fcntl() combo.

2 years agofile: Update README.DRAGONFLY and config.h.
Sascha Wildner [Tue, 6 Jul 2021 19:07:55 +0000 (21:07 +0200)]
file: Update README.DRAGONFLY and config.h.

2 years agoMerge branch 'vendor/FILE'
Sascha Wildner [Tue, 6 Jul 2021 18:47:45 +0000 (20:47 +0200)]
Merge branch 'vendor/FILE'

2 years agovendor/file: upgrade from 5.39 to 5.40
Sascha Wildner [Tue, 6 Jul 2021 18:44:23 +0000 (20:44 +0200)]
vendor/file: upgrade from 5.39 to 5.40

For details, see ChangeLog.

2 years agolibmagic/mkmagic: Add generated header(s) to CLEANFILES.
Sascha Wildner [Tue, 6 Jul 2021 18:23:34 +0000 (20:23 +0200)]
libmagic/mkmagic: Add generated header(s) to CLEANFILES.

2 years agokernel/modules: Simplify a number of .PATHs in module Makefiles.
Sascha Wildner [Mon, 5 Jul 2021 10:09:58 +0000 (12:09 +0200)]
kernel/modules: Simplify a number of .PATHs in module Makefiles.

2 years ago<sys/sensors.h>: Include <sys/types.h> for timeval and int64_t.
Sascha Wildner [Mon, 5 Jul 2021 07:30:40 +0000 (09:30 +0200)]
<sys/sensors.h>: Include <sys/types.h> for timeval and int64_t.

While here, remove an unused define.

2 years agoworld - Add covid(1) utility and port manual page from netbsd (2)
Matthew Dillon [Sun, 4 Jul 2021 19:03:11 +0000 (12:03 -0700)]
world - Add covid(1) utility and port manual page from netbsd (2)

* Though perhaps one could say that the 512-byte page-table pages
  the VAX had were a kind of disease, no... we won't go there.

  Fix manual page, move to section 1, and it isn't vax-specific.

2 years agoworld - Add covid(1) utility and port manual page from netbsd
Matthew Dillon [Sun, 4 Jul 2021 18:58:21 +0000 (11:58 -0700)]
world - Add covid(1) utility and port manual page from netbsd

* Move from section (4) to section (1) and include a utility which
  dumps one of the genome sequences.  Just to put an exclamation
  mark on the amount of damage such an absurdly short genetic sequence
  can wreak on the world

2 years agoMakefile.inc1: Remove unneeded exists() checks.
Sascha Wildner [Sun, 4 Jul 2021 18:39:12 +0000 (20:39 +0200)]
Makefile.inc1: Remove unneeded exists() checks.

Just doing 'make' in /usr/src isn't used for building anymore for a long
time, and our targets don't really make sense with an incomplete sounrce
tree.

2 years agoMakefile.inc1: Put all backup related stuff under the NO_BACKUP check.
Sascha Wildner [Sun, 4 Jul 2021 18:33:36 +0000 (20:33 +0200)]
Makefile.inc1: Put all backup related stuff under the NO_BACKUP check.

Main effect is that /usr/obj/world_backup is no longer created when
NO_BACKUP is set.

2 years agosys/vfs/hammer2: #if0 unused HAMMER2_DIRHASH_{HIMASK,FORCED}
Tomohiro Kusumi [Sat, 3 Jul 2021 17:50:42 +0000 (02:50 +0900)]
sys/vfs/hammer2: #if0 unused HAMMER2_DIRHASH_{HIMASK,FORCED}

HIMASK was no longer used since e028fa747e9825425f74da7e9c57a50a82b48e82 in 2012.
FORCED bit was never used since first appeared in above commit.

Only LOMASK bits are relevant for dirent lookup.

2 years agosys/vfs/hammer2: Fix function name in xop kprintf's
Tomohiro Kusumi [Sat, 3 Jul 2021 16:54:09 +0000 (01:54 +0900)]
sys/vfs/hammer2: Fix function name in xop kprintf's

2 years agolibc: Sync namespace.h and un-namespace.h a bit more pedantically.
Sascha Wildner [Sun, 4 Jul 2021 11:37:30 +0000 (13:37 +0200)]
libc: Sync namespace.h and un-namespace.h a bit more pedantically.

2 years agokernel: Staticize some variables.
Sascha Wildner [Sun, 4 Jul 2021 11:13:09 +0000 (13:13 +0200)]
kernel: Staticize some variables.

2 years agokernel/vm: Remove an unused variable.
Sascha Wildner [Sun, 4 Jul 2021 11:12:39 +0000 (13:12 +0200)]
kernel/vm: Remove an unused variable.

It is no longer needed since f2c2051ee473577d22178d55f782ceebbd88d58f.

2 years agokernel: Remove ndis(4) and associated tools and stuff.
Sascha Wildner [Sat, 3 Jul 2021 18:51:28 +0000 (20:51 +0200)]
kernel: Remove ndis(4) and associated tools and stuff.

ndis(4) was a wrapper to allow running binary Windows network
drivers that conformed to the Network Driver Interface Specification,
i.e. NDIS.

It only ever supported drivers from the days of Windows XP and
Windows Server 2003 (i.e. NDIS 5.1). And even if one was actually
able to extract the .sys and .inf files from the driver package and
successfully convert them to a building module, which both were
adventures in itself, it could be any result when trying to run it,
depending on the card and driver, from resonably working to not
working, even crashing. But it did work for some cards, so it had
some limited merit in its time.

NetBSD removed it in 2018, FreeBSD in January 2021, so let's follow
suit now.

2 years agowpa_cli.8: command is actually optional.
Sascha Wildner [Sat, 3 Jul 2021 13:04:02 +0000 (15:04 +0200)]
wpa_cli.8: command is actually optional.

2 years agowpa_supplicant: Adjust READMEs.
Sascha Wildner [Sat, 3 Jul 2021 11:28:31 +0000 (13:28 +0200)]
wpa_supplicant: Adjust READMEs.

2 years agoMerge branch 'vendor/WPA_SUPPLICANT'
Sascha Wildner [Sat, 3 Jul 2021 11:27:25 +0000 (13:27 +0200)]
Merge branch 'vendor/WPA_SUPPLICANT'

2 years agowpa_supplicant: Remove NDIS specific code on the vendor branch. vendor/WPA_SUPPLICANT
Sascha Wildner [Sat, 3 Jul 2021 11:26:40 +0000 (13:26 +0200)]
wpa_supplicant: Remove NDIS specific code on the vendor branch.

2 years agoipfw3nat: Fix indentation
Aaron LI [Sat, 3 Jul 2021 04:26:30 +0000 (12:26 +0800)]
ipfw3nat: Fix indentation

A follow-up to eb4c9e6d01df1803b884c6499ab99062a4453975.

2 years agonetinet6 - Add bridge test to ND6_RTENTRY_IS_NEIGHBOR()
Matthew Dillon [Fri, 2 Jul 2021 18:33:46 +0000 (11:33 -0700)]
netinet6 - Add bridge test to ND6_RTENTRY_IS_NEIGHBOR()

* Refactor ND6_RTENTRY_IS_NEIGHBOR() to get rid of
  the confusing double-negative.

* Change the IFP test to also allow the case where
  the route belongs to a bridge that the ifp is
  associated with.

* Fixes bogus "nd6_lookup: failed to lookup..." console messages.

2 years agonetinet6 - Fix 'not IPV6' console warning
Matthew Dillon [Fri, 2 Jul 2021 17:25:09 +0000 (10:25 -0700)]
netinet6 - Fix 'not IPV6' console warning

* Remove the ethernet header before issuing the icmp6_error()
  after an ARP (well, IPV6 equivalent) failure.

  Fixes a console warning.

2 years agohammer2 - Remove fhtovp debugging
Matthew Dillon [Fri, 2 Jul 2021 17:19:34 +0000 (10:19 -0700)]
hammer2 - Remove fhtovp debugging

* Remove kprintf() in fhtovp().

2 years agoFix a few mdoc issues in various manual pages.
Sascha Wildner [Fri, 2 Jul 2021 18:35:35 +0000 (20:35 +0200)]
Fix a few mdoc issues in various manual pages.

2 years agosys/vfs/hammer2: Move cache_xops global variable to hammer2_admin.c
Tomohiro Kusumi [Fri, 2 Jul 2021 17:55:42 +0000 (02:55 +0900)]
sys/vfs/hammer2: Move cache_xops global variable to hammer2_admin.c

Not much to do with vnops.

2 years agosys/vfs/hammer2: Avoid two hammer2_knote() implementation
Tomohiro Kusumi [Fri, 2 Jul 2021 17:19:13 +0000 (02:19 +0900)]
sys/vfs/hammer2: Avoid two hammer2_knote() implementation

2 years agokernel: Detect NVMM hypervisor
Aaron LI [Thu, 1 Jul 2021 23:24:52 +0000 (07:24 +0800)]
kernel: Detect NVMM hypervisor

Now sysctl 'kern.vmm_guest' would report 'nvmm' instead of 'unknown'
when running in NVMM hypervisor.

Suggested-by: swildner
2 years agoRevert "Makefile: Install 'master.passwd' and 'group' if not exist"
Aaron LI [Fri, 2 Jul 2021 14:01:45 +0000 (22:01 +0800)]
Revert "Makefile: Install 'passwd' and 'group' if not exist"

This reverts commit 169805dbaab55a640955a7d94cd0cc7d15160523.

swildner reported that this commit broke 'installworld' to an empty
$DESTDIR, because the destination directory $DESTDIR/etc didn't exist
yet.

Revert this commit now, and I'll revisit it later.

Reported-by: swildner
2 years agosound - Fix panic
Matthew Dillon [Tue, 29 Jun 2021 18:17:51 +0000 (11:17 -0700)]
sound - Fix panic

* Fix panic due to uninitialized variable that can be triggered by
  a browser under certain circumstances.

Reported-by: mwiencek (Michael Wiencek)
2 years agokernel: Various minor whitespace adjustments and tweaks
Aaron LI [Sun, 6 Jun 2021 12:12:43 +0000 (20:12 +0800)]
kernel: Various minor whitespace adjustments and tweaks

2 years agoprintf.3: Add reference to snprintb.3.
Sascha Wildner [Tue, 29 Jun 2021 09:59:19 +0000 (11:59 +0200)]
printf.3: Add reference to snprintb.3.

2 years agosysctl.3: Remove wrong Dv's.
Sascha Wildner [Tue, 29 Jun 2021 07:33:32 +0000 (09:33 +0200)]
sysctl.3: Remove wrong Dv's.

2 years agousbdi.9: Use Dv for defined values.
Sascha Wildner [Tue, 29 Jun 2021 06:57:21 +0000 (08:57 +0200)]
usbdi.9: Use Dv for defined values.

2 years agobsd-family-tree: Sync with FreeBSD.
Sascha Wildner [Tue, 29 Jun 2021 04:22:48 +0000 (06:22 +0200)]
bsd-family-tree: Sync with FreeBSD.

2 years agodsynth - Support chromium WITH_DEBUG build
Matthew Dillon [Sun, 27 Jun 2021 19:32:02 +0000 (12:32 -0700)]
dsynth - Support chromium WITH_DEBUG build

* WITH_DEBUG=yes plus STRIP= on a chromium build, including dependencies,
  requires more than 16GB in /usr/local and more than 64GB in /construction.

* For those interested, the final link with full debugging takes 3 hours,
  burns around 100GB of filesystem space, and 54GB of ram for the llvm10
  linker.

  Unfortunately, the debug link for chromium still fails.

  ld.lld: error: headless_devtools_manager_delegate.cc:(.debug_info+0x27FEF):
relocation R_X86_64_32 out of range: 4714474997 is not in
[0, 4294967295]; consider recompiling with -fdebug-types-section to
reduce size of debug sections.

  But keep the dsynth changes anyway in case this can get resolved in
  the future.

2 years agolibdevinfo: Remove enum devinfo_state (duplicate of enum device_state).
Sascha Wildner [Sun, 27 Jun 2021 19:47:24 +0000 (21:47 +0200)]
libdevinfo: Remove enum devinfo_state (duplicate of enum device_state).

For maintenance reasons, use <sys/bus.h> defintions.

Taken-from: FreeBSD

While here, adjust the manual page to show the correct type of dd_state.

2 years ago<sys/ucontext.h>: The *_quick() versions are specific to DragonFly.
Sascha Wildner [Sun, 27 Jun 2021 09:15:11 +0000 (11:15 +0200)]
<sys/ucontext.h>: The *_quick() versions are specific to DragonFly.

2 years agosys/vfs/hammer2: Fix volhdrno initialization bug
Tomohiro Kusumi [Sat, 26 Jun 2021 16:14:18 +0000 (01:14 +0900)]
sys/vfs/hammer2: Fix volhdrno initialization bug

While hammer2_init_volumes() returned correct root volume header,
hmp->volhdrno was always initialized with 0.

This resulted in always flushing volume header in 1->2->3->0->... order,
instead of starting off from where previous mount had written +1.

2 years agosbin/hammer2: Introduce HAMMER2_SHOW_ALL_VOLUME_HEADERS to show all volhdrs when -q
Tomohiro Kusumi [Fri, 25 Jun 2021 17:21:11 +0000 (02:21 +0900)]
sbin/hammer2: Introduce HAMMER2_SHOW_ALL_VOLUME_HEADERS to show all volhdrs when -q

Previously only VerboseOpt>=3 printed all volume headers,
and because of this quiet mode could only print best zone.

2 years agokernel - Offset the scheduler clock systimers
Matthew Dillon [Thu, 24 Jun 2021 07:09:53 +0000 (00:09 -0700)]
kernel - Offset the scheduler clock systimers

* Offset the scheduler clock systimers slightly on each cpu so they
  do not all fire at the same time.  This is an attempt to reduce
  qemu contention due to its global I/O mutex.

  Note that the hz and stathz main system clocks already use this
  feature.

2 years agopthreads - Improve low level lock performance when heavily contested
Matthew Dillon [Thu, 24 Jun 2021 03:14:44 +0000 (20:14 -0700)]
pthreads - Improve low level lock performance when heavily contested

* The low-level __thr_umtx_lock()/unlock and related primitives are
  used by pthreads, but have very poor performance when heavily contested:

  * Calling sched_yield() just doesn't work well.

  * Attempts to sleep too quickly, which costs a great deal of
    system overhead.

  * And issues broadcast wakeups for waiters, causing excessive IPIs.

* Stop calling sched_yield() in the loop.  Let the userland scheduler's
  dynamic priority deal with it.

* Scale the spin count up significantly, and then further based on
  the number of pthreads in the application.  If the program is stupid
  enough to cause excessive contention, then the penalty for making that
  perform well is going to be more cpu time.

* Issue a wakeup1() equivalent on unlock if there are any waiters,
  significantly reducing system IPIs.

  To make this work reliably, the primary lock loop, when it sleeps,
  will now always do so with a 1mS timeout, then loop/recheck.  If
  an API timeout is specified in excess of 1mS, the timo variable
  is reduced on each loop and proper timeout handling occurs on
  the last call.

* Running qemu w/ 32-cores specified (on a 64/128 threadripper host),
  with nvmm, reduces build-all time from 9:10 to 8:20, relative to
  a native host build time (usched restricted to 32 cores) of 6:11.
  So this is a significant improvement.

  (currently qemi-6.0.0 w/nvmm has some significant contention when a
   high cpu count is configured, due to the implementation).

2 years agonpx: Fix XMM register count issue in 'savexmm64' struct
Aaron LI [Sat, 26 Jun 2021 05:41:04 +0000 (13:41 +0800)]
npx: Fix XMM register count issue in 'savexmm64' struct

On 64-bit systems, there are 16 XMM registers (XMM0 - XMM15).  And
FXSAVE64/FXRSTOR64 instructions save/restore them to/from the 512-byte
data area.

So fix the 'savexmm64' structure to say 'struct xmmacc sv_xmm[16]', i.e.,
16 XMM registers.  The padding area is shrunk accordingly.

This issue is minor and has never caused any problems (because of the
padding area), but still fix it.

While there, adjust various whitespace to look much better.

2 years agonpx: Adjust the 'envxmm64' structure
Aaron LI [Sat, 26 Jun 2021 05:45:20 +0000 (13:45 +0800)]
npx: Adjust the 'envxmm64' structure

* Replace 'en_rip' and 'en_rdp' fields with union equivalents, for
  accessing break-downs of these 64-bit fields.

* The break-down representation 'union fp_addr' is obtained from NetBSD.

* This helps adapt the NVMM backend code in QEMU to DragonFly.

2 years agox86_64/pmap.h: Adjust Intel EPT defines
Aaron LI [Sat, 26 Jun 2021 04:42:52 +0000 (12:42 +0800)]
x86_64/pmap.h: Adjust Intel EPT defines

According to Intel SDM (Section 28.2.2: EPT Translation Mechanism), bit
10 indicates the execute access for user-mode linear addresses when the
"mode-based execute control for EPT" VM-execution control is enabled,
otherwise, it's ignored.

So to be future-proof, don't define bit 10 as EPT_PG_AVAIL1, which is
use as the "wired" bit.  Instead, use the ignored bit 11 for this
purpose.

In addition, use ignored bits 59:52 for other EPT_PG_AVAIL* bits.

2 years agokernel/makesyscalls.sh: Mark two headers as kernel only.
Sascha Wildner [Sat, 26 Jun 2021 01:29:02 +0000 (03:29 +0200)]
kernel/makesyscalls.sh: Mark two headers as kernel only.