]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agomachine-id: generate a compact version of the uuid
Baptiste Daroussin [Tue, 28 Feb 2023 10:31:06 +0000 (11:31 +0100)]
machine-id: generate a compact version of the uuid

dbus and other actually expect an uuid without hyphens

Reported by: tijl
MFC After: 3 days

14 months agouuidgen: add -c for compact uuid
Baptiste Daroussin [Tue, 28 Feb 2023 10:29:51 +0000 (11:29 +0100)]
uuidgen: add -c for compact uuid

It generates the uuid string but without the hyphen

MFC After: 3 days
Reviews by: tcberner
Differential Revision: https://reviews.freebsd.org/D38820

14 months agobhyve: Remove useless return at the end of void function
Elyes Haouas [Thu, 23 Feb 2023 06:36:13 +0000 (07:36 +0100)]
bhyve: Remove useless return at the end of void function

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
14 months agobhyve: remove redundant variable
Vitaliy Gusev [Wed, 1 Mar 2023 07:45:46 +0000 (07:45 +0000)]
bhyve: remove redundant variable

Reviewed by:    corvink,markj
Sponsored by:   vStack
Differential Revision: https://reviews.freebsd.org/D38836

14 months agofreebsd-update: avoid effects of user's environment on grep
Ed Maste [Wed, 14 Dec 2022 17:13:19 +0000 (12:13 -0500)]
freebsd-update: avoid effects of user's environment on grep

A user had GREP_OPTIONS containing --color=always, which broke grep use
in freebsd-update.  Unset this environment variable.

PR: 255990
Reviewed by: kevans
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

14 months agobc: remove MIPS Makefile case
Ed Maste [Mon, 27 Feb 2023 15:05:16 +0000 (10:05 -0500)]
bc: remove MIPS Makefile case

MIPS support has been removed from FreeBSD.

Sponsored by: The FreeBSD Foundation

14 months agonetlink: add userland name mappings to all NETLINK_ROUTE messages.
Alexander V. Chernikov [Wed, 1 Mar 2023 15:22:21 +0000 (15:22 +0000)]
netlink: add userland name mappings to all NETLINK_ROUTE messages.

MFC after: 1 day

14 months agobuf: Make buf_daemon_shutdown() a no-op after a panic
Mark Johnston [Wed, 1 Mar 2023 15:07:56 +0000 (10:07 -0500)]
buf: Make buf_daemon_shutdown() a no-op after a panic

As in commit 9d7cc536e261a7, there is no need to do anything in this
context.

MFC after: 1 week

14 months agopf tests: test pfsync over IPSec
Kristof Provost [Wed, 1 Mar 2023 13:02:15 +0000 (14:02 +0100)]
pf tests: test pfsync over IPSec

Test that we can transport pfsync (unicast) over IPSec.

Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agothunderx: fix potential sign extension issue
Ed Maste [Tue, 28 Feb 2023 19:17:30 +0000 (14:17 -0500)]
thunderx: fix potential sign extension issue

Coverity reported a sign extension issue on rq->caching << 26 in the
Linux ThunderX driver.  (It appears Coverity Scan doesn't build arm64
objects in FreeBSD.)

As done in Linux, add a cast.

Fixes: 3c0086b81391 ("Raw import of ThunderX VNIC networking driver...")
Sponsored by: The FreeBSD Foundation

14 months agoarm64: Shave off two instructions in exceptions
Dapeng Gao [Wed, 1 Mar 2023 14:28:53 +0000 (14:28 +0000)]
arm64: Shave off two instructions in exceptions

This patch shaves off up to two three instructions in
save_registers_head in exception.S for arm64, which would make more
space for instructions that could be added in CheriBSD.

This is done by:
 1. Combining pointer arithmetic with pre-incrementing STP instructions
 2. Removing the instruction that sets the frame pointer (x29) as its
    content is unused

Differential Revision: https://reviews.freebsd.org/D34631

14 months agossh: default VerifyHostKeyDNS to no, following upstream
Ed Maste [Fri, 17 Feb 2023 01:26:41 +0000 (20:26 -0500)]
ssh: default VerifyHostKeyDNS to no, following upstream

Revert to upstream's default.  Using VerifyHostKeyDNS may depend on a
trusted nameserver and network path.

This reverts commit 83c6a5242c80160fff76fb85454938761645b0c4.

Reported by: David Leadbeater, G-Research
Reviewed by: gordon
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38648

14 months agou3g(4): Add device ID for the Quectel EM160R
Allan Jude [Wed, 1 Mar 2023 14:01:19 +0000 (14:01 +0000)]
u3g(4): Add device ID for the Quectel EM160R

Also add the EM160R to the man page, noting the work-around
required to make it function properly in PPP mode.

MFC-After: 1 week
Sponsored by: Metify Inc.
Sponsored by: Klara Inc.

14 months agofb: whack __mips__ leftovers
Mateusz Guzik [Wed, 1 Mar 2023 11:40:38 +0000 (11:40 +0000)]
fb: whack __mips__ leftovers

Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agosyscons: whack __mips__ leftovers
Mateusz Guzik [Wed, 1 Mar 2023 11:11:46 +0000 (11:11 +0000)]
syscons: whack __mips__ leftovers

Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agomips: whack __mips__ leftover
Mateusz Guzik [Wed, 1 Mar 2023 11:09:48 +0000 (11:09 +0000)]
mips: whack __mips__ leftover

Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agodtrace: whack __mips__ from dtraceall
Mateusz Guzik [Wed, 1 Mar 2023 11:08:52 +0000 (11:08 +0000)]
dtrace: whack __mips__ from dtraceall

Note contrib code is not modified.

Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agonet: whack __mips__ leftovers
Mateusz Guzik [Wed, 1 Mar 2023 11:07:32 +0000 (11:07 +0000)]
net: whack __mips__ leftovers

Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agokern: whack __mips__ leftover
Mateusz Guzik [Wed, 1 Mar 2023 11:05:12 +0000 (11:05 +0000)]
kern: whack __mips__ leftover

Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agoif_ovpn tests: skip the if_ovpn_c test if if_ovpn.ko isn't loaded
Kristof Provost [Tue, 28 Feb 2023 10:14:24 +0000 (11:14 +0100)]
if_ovpn tests: skip the if_ovpn_c test if if_ovpn.ko isn't loaded

Skip the test (rather than loading it) if if_ovpn.ko isn't loaded. Match
the behaviour of other tests.

Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agoefifb: add a tunable to select the framebuffer cache attribute
Kyle Evans [Wed, 1 Mar 2023 06:04:49 +0000 (00:04 -0600)]
efifb: add a tunable to select the framebuffer cache attribute

Mapping the framebuffer with WC (Write Combined) memory type can, in
practice, cause some memory transactions to be rate-limited at a
fraction of the fb write rate.  WC allows one core to queue up many
globally visible write transactions, and in the process some unrelated
transactions may end up having to wait for all of the queued up PCI
writes to be flushed.

Add an hw.efifb.cache_attr tunable to allow mapping the framebuffer as
uncacheable instead.  We should likely be taking a more careful approach
of checking the memory map to determine which cacheability attributes
are feasible, but the knob lets us use our historically functional
behavior while offering a convenient way to switch on a stock kernel.

The only valid values for hw.efifb.cache_attr at this time are "uc" and
"wc".

Original patch by Marc De La Gueronniere <mdelagueronniere@verisign.com>
along with previous testing.

Reviewed by: imp
MFC after: 1 week
Sponsored by: Verisign, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D17884

14 months agoi18n: csmapper: hook up the top-level .src files to the build
Kyle Evans [Wed, 1 Mar 2023 04:24:54 +0000 (22:24 -0600)]
i18n: csmapper: hook up the top-level .src files to the build

The top-level charset.pivot.src may be empty, but the top-level
mapper.dir.src is not -- it contains some definitions for supplementary
UCS planes.  The SMP/SSP definitions aren't actually used at the moment,
but the inclusion of the SIP definitions fixes conversions involving
JISX0213-1/JISX0213-2 to be possible.

Sponsored by: Klara, Inc.

14 months agousb: dwc3: implement hw.usb.xhci.use_polling
Kyle Evans [Tue, 28 Feb 2023 01:59:43 +0000 (19:59 -0600)]
usb: dwc3: implement hw.usb.xhci.use_polling

Polling is currently only implemented in the xhci pci attachment.
Adding it to dwc3 doesn't make it much uglier, and supporting it can be
useful for confirming that hardware's otherwise functional when
interrupts are apparently not firing.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D38816

14 months agoarm64: set FPEN if we're stuck with HCR_EL2.E2H
Kyle Evans [Fri, 24 Feb 2023 19:37:20 +0000 (13:37 -0600)]
arm64: set FPEN if we're stuck with HCR_EL2.E2H

On Apple Silicon systems, E2H can't actually be cleared; we're stuck
with it.  Check it again when we're setting up CPTR_EL2 and set FPEN
appropriately to avoid later trapping to EL2 on writes to SIMD
registers.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D38819

14 months agoAdd deprecation notice to the gbde(8) program, scheduled to be removed in FreeBSD...
Poul-Henning Kamp [Tue, 28 Feb 2023 21:39:06 +0000 (21:39 +0000)]
Add deprecation notice to the gbde(8) program, scheduled to be removed in FreeBSD 15.0.

14 months agonetinet: Remove the IP(V6)_RSS_LISTEN_BUCKET socket option
Mark Johnston [Tue, 28 Feb 2023 20:57:21 +0000 (15:57 -0500)]
netinet: Remove the IP(V6)_RSS_LISTEN_BUCKET socket option

It has no effect, and an exp-run revealed that it is not in use.

PR: 261398 (exp-run)
Reviewed by: mjg, glebius
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38822

14 months agolibrss: Remove rss_socket_set_rss_bucket()
Mark Johnston [Tue, 28 Feb 2023 20:57:11 +0000 (15:57 -0500)]
librss: Remove rss_socket_set_rss_bucket()

In preparation for the removal of the IP_RSS_LISTEN_BUCKET socket
option.

PR: 261398 (exp-run)
Reviewed by: glebius
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38821

14 months agotcp: Make TCP PCAP buffer properly configurable.
Richard Scheffenegger [Tue, 28 Feb 2023 18:57:30 +0000 (19:57 +0100)]
tcp: Make TCP PCAP buffer properly configurable.

Reviewed By: tuexen, cc, #transport
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D38824

14 months agoMAINTAINERS+GitHub: Reflect ipfilter was moved from contrib to netpfil
Cy Schubert [Tue, 28 Feb 2023 15:42:47 +0000 (07:42 -0800)]
MAINTAINERS+GitHub: Reflect ipfilter was moved from contrib to netpfil

Reflect the fact that ipfilter was moved from contrib to netpfil
on December 20, 2021 by 3b9b51fe464e. And that ipfilter userland
was moved from contrib to sbin/ipf by 41edb306f056 that same day.

14 months agogithub: Create pull request template
Warner Losh [Tue, 28 Feb 2023 18:23:53 +0000 (11:23 -0700)]
github: Create pull request template

Just to see how this looks. Will likely need to iterate.

14 months agosuperio,ftgpio: Add support for Fintek F81865 GPIO
Stéphane Rochoy [Tue, 28 Feb 2023 17:16:46 +0000 (10:16 -0700)]
superio,ftgpio: Add support for Fintek F81865 GPIO

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/674
Differential Revision: https://reviews.freebsd.org/D37893

14 months ago310.accounting: Verify process accounting is active before log rotation.
John Grafton [Tue, 28 Feb 2023 16:49:40 +0000 (09:49 -0700)]
310.accounting: Verify process accounting is active before log rotation.

This corrects a bug in which the daily periodic script '310.accounting'
attempts to rotate logs via /etc/rc.d/accounting by calling
onerotate_logs function. The rotate logs function turns accounting back
on regardless of what acccounting_enable is set to in /etc/rc.conf. This
is due to checkyesno always returning YES since rotate logs is called
with the 'one' prefix.

In effect, accounting will always be turned back on once a day even if
it is disabled and stopped by hand. The fix was simple, just check if
accounting is before rotating logs and if it is, don't attempt the
rotate.

PR: 267464
Reviewed by: imp, hps (lgtm, not approval), Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/648
Differential Revision: https://reviews.freebsd.org/D37434

14 months agoiflib: fix regression with new pfil(9) KPI
Gleb Smirnoff [Tue, 28 Feb 2023 16:56:20 +0000 (08:56 -0800)]
iflib: fix regression with new pfil(9) KPI

Do not pass the pointer to our valid mbuf to pfil(9).  Pass an
uninitialized one only.  This was unsafe with the old KPI, too,
but for some reason didn't fail.

Fixes: caf32b260ad46b17a4c1a8ce6383e37ac489f023

14 months agorc.conf(5): Style issues
Warner Losh [Tue, 28 Feb 2023 16:28:30 +0000 (09:28 -0700)]
rc.conf(5): Style issues

Fix mandoc -Tlint style issues
* Use Pa instead of Va for .conf element (mdoc warned the Va was unused, and its the
  wrong markup anyway)
* Drop useless Va and use Va instead of Ar when referring to variables in the jail file
* One sentence, one line
* drop xr to info(1). That makes no sense, and intro(1) seems unhelpful.

This leaves two warnings: gdb(1) xref not found (but we add a
parenthetical about the package) and a false positive about
a trailing period that is being mistaken for a 'full stop'
when it is really just a character in a filename.

Sponsored by: Netflix

14 months agorc.conf(5): document nscd_enable
Tom Hukins [Tue, 28 Feb 2023 16:18:06 +0000 (09:18 -0700)]
rc.conf(5): document nscd_enable

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/650

14 months agorc.conf(5): describe what unbound(8) does
Tom Hukins [Tue, 28 Feb 2023 16:18:06 +0000 (09:18 -0700)]
rc.conf(5): describe what unbound(8) does

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/650

14 months agodtrace_kinst.4: Demonstrate usage of the "regs" variable
Mark Johnston [Tue, 28 Feb 2023 16:09:26 +0000 (11:09 -0500)]
dtrace_kinst.4: Demonstrate usage of the "regs" variable

Suggested by: Mina Galić <freebsd@igalic.co>
Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D38823

14 months agogrowfs_fstab startup script: set dumpdev to AUTO
Mike Karels [Tue, 28 Feb 2023 13:55:35 +0000 (07:55 -0600)]
growfs_fstab startup script: set dumpdev to AUTO

The growfs_fstab script has been testing dumpdev, and if it is AUTO,
enables dumps on the newly-added swap device for the initial boot.
However, dumpdev defaults to AUTO on main, but NO on stable/13 and
release branches.  On the other hand, bsdinstall adds dumpdev="AUTO"
by default (controlled by a menu item).  bsdinstall is not used when
booting an SD card or other disk image.  Adopt the default from
bsdinstall, and set dumpdev to AUTO in /etc/rc.conf in the
growfs_fstab script if a swap partition has been added, along with
the explanatory comment added by bsdinstall.

Differential Revision: https://reviews.freebsd.org/D38751

14 months agousb: Add HID_IGNORE quirk for APC Smart-UPS1000
Cy Schubert [Wed, 22 Feb 2023 02:38:16 +0000 (18:38 -0800)]
usb: Add HID_IGNORE quirk for APC Smart-UPS1000

Without the HID_IGNORE quirk enabled it will appear to be a uhid device.

PR: 269729
MFC after: 1 week

14 months agousbdevs: Add APC Smart-UPS1000
Cy Schubert [Tue, 21 Feb 2023 21:10:35 +0000 (13:10 -0800)]
usbdevs: Add APC Smart-UPS1000

MFC after: 1 week

14 months agousbdevs: Remove duplicate APC entries
Cy Schubert [Tue, 21 Feb 2023 21:08:08 +0000 (13:08 -0800)]
usbdevs: Remove duplicate APC entries

MFC after: 1 week

14 months agosqlite3: Vendor import of sqlite3 3.41.0
Cy Schubert [Tue, 28 Feb 2023 13:28:07 +0000 (05:28 -0800)]
sqlite3: Vendor import of sqlite3 3.41.0

Release notes at https://www.sqlite.org/releaselog/3_41_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3410000.tar.gz
MFC after: 2 weeks

Merge commit '615bd3eb2a2225e83e14d5b2a82649430889483c' into temp_merge

14 months agobhyve: fix resume for vms with guest_ncpus > 1
Vitaliy Gusev [Tue, 28 Feb 2023 10:28:40 +0000 (11:28 +0100)]
bhyve: fix resume for vms with guest_ncpus > 1

This error occurs because vm->vcpu[1] has not been allocated yet when
vm_snapshot_vm() is called.

To fix this, move spinup_vcpu() before restore code.

Reviewed by: corvink, markj
MFC after: 2 weeks
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38477

14 months agobhyve: fix restore of kernel structs
Vitaliy Gusev [Tue, 28 Feb 2023 10:32:49 +0000 (11:32 +0100)]
bhyve: fix restore of kernel structs

vmx_snapshot() and svm_snapshot() do not save any data and error occurs at
resume:

Restoring kernel structs...
vm_restore_kern_struct: Kernel struct size was 0 for: vmx
Failed to restore kernel structs.

Reviewed by: corvink, markj
Fixes: 39ec056e6dbd89e26ee21d2928dbd37335de0ebc ("vmm: Rework snapshotting of CPU-specific per-vCPU data.")
MFC after: 2 weeks
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38476

14 months agovmm: fix restore of TSC offset
Vitaliy Gusev [Tue, 28 Feb 2023 11:16:35 +0000 (12:16 +0100)]
vmm: fix restore of TSC offset

After suspend/resume Ubuntu 20.04 and 22.04 installer can hang if
tsc-early clocksource has a big skew.

Reviewed by: corvink, jhb
Fixes: a7db532e3a6f83067b342f569b56076d011f8a1e ("vmm: Simplify saving of absolute TSC values in snapshots.")
MFC after: 2 weeks
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38474

14 months agobhyve: add common fwcfg items
Corvin Köhne [Wed, 11 Aug 2021 08:02:57 +0000 (10:02 +0200)]
bhyve: add common fwcfg items

Qemu defines some common fwcfg items. We don't need to support all of
them. Only a subset needs to be present for fwcfg to work properly.

- signature
  The signature is used by the guest to check if qemu's fwcfg is
  available or not.
- id
  The id is used by the guest to check which features are supported by
  the fwcfg implementation of the hypervisor.
- file_dir
  The file dir reports all fwcfg items which don't have a fixed index.
  These are mostly user defined fwcfg items.

Reviewed by: <If someone else reviewed your modification.>
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38335

14 months agobhyve: add helper to add fwcfg items
Corvin Köhne [Wed, 11 Aug 2021 08:01:19 +0000 (10:01 +0200)]
bhyve: add helper to add fwcfg items

This helper makes it easier to add multiple fwcfg items. You can pass an
index and some data to the helper. The helper adds these information to
the fwcfg emulation so that the guest reads the given data on the
specified index.

Reviewed by: <If someone else reviewed your modification.>
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38334

14 months agojail: Improve readability
Zhenlei Huang [Tue, 28 Feb 2023 10:14:07 +0000 (18:14 +0800)]
jail: Improve readability

No functional change intended.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D37890

14 months agojail: Use flexible array member within struct prison_ip
Zhenlei Huang [Tue, 28 Feb 2023 10:01:33 +0000 (18:01 +0800)]
jail: Use flexible array member within struct prison_ip

Current implementation utilize off-by-one struct prison_ip to access the
IPv[46] addresses. It is error prone and hence comes the regression fix
21ad3e27fabc and ddbf879d79d4. Use flexible array member so that compiler
will catch such errors and it will also be easier to review.

No functional change intended.

Reviewed by: melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D37874

14 months agoperiodic: switch lockf to silent operation.
Alexander Leidinger [Tue, 28 Feb 2023 08:38:42 +0000 (09:38 +0100)]
periodic: switch lockf to silent operation.

This fixes duplicate mails (one from cron, one from periodic)
when a periodic run is not finished bfore the next one starts.

The man page states that the intended use case is cron, and
the error handling of the lockf invocation handles this case
explicitely, as such no error message for the "interactive"
use was considered.

14 months agoCONTRIBUTING.md: correct developer certificate of origin link markup
Ed Maste [Tue, 28 Feb 2023 02:34:49 +0000 (21:34 -0500)]
CONTRIBUTING.md: correct developer certificate of origin link markup

Sponsored by: The FreeBSD Foundation

14 months agoCONTRIBUTING.md: Suggest PR and Differential Revision lines
Warner Losh [Tue, 28 Feb 2023 00:19:25 +0000 (17:19 -0700)]
CONTRIBUTING.md: Suggest PR and Differential Revision lines

When there's an open PR and/or a Differential Revision, people
evaluating the pull request will want to look at them. Suggest that the
submitter include this information to make it easier to process.

Sponsored by: Netflix

14 months agoCONTRIBUTING.md: Add in for github pull requests
Warner Losh [Sat, 25 Feb 2023 15:24:00 +0000 (08:24 -0700)]
CONTRIBUTING.md: Add in for github pull requests

Create a slightly longer version of the inforamtion available in the
handbook in the file that Github displays for more information about
contributing.

Sponsored by: Netflix

14 months agosqlite3: Vendor import of sqlite3 3.41.0
Cy Schubert [Mon, 27 Feb 2023 23:41:54 +0000 (15:41 -0800)]
sqlite3: Vendor import of sqlite3 3.41.0

Release notes at https://www.sqlite.org/releaselog/3_41_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3410000.tar.gz

14 months agostand: Minor cleanup
Alfonso [Mon, 27 Feb 2023 23:19:54 +0000 (16:19 -0700)]
stand: Minor cleanup

Replace a cast '0' for a null pointers with NULL
Replace a 'goto loop' with a do-while loop in ufs and ext2fs.
Cast cp pointer to uintptr_t to test to see if it's aligned rather than long.

[ minor tweaks based on my & hps' review, reworded commit message ]
Reviewed by: imp, hps
Pull Request: https://github.com/freebsd/freebsd-src/pull/547

14 months agoreport full error string on SSL_connect() failure
Vladimir Kotal [Mon, 27 Feb 2023 23:07:27 +0000 (16:07 -0700)]
report full error string on SSL_connect() failure

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/575

14 months agoif_re: Generate an address if there is none in the EEPROM
Evgeni Golov [Mon, 27 Feb 2023 22:50:56 +0000 (15:50 -0700)]
if_re: Generate an address if there is none in the EEPROM

There exists hardware that has no ethernet address burned into
the EEPROM. Loading if_re on such a HW brings the device up
with '00:00:00:00:00:00' as the address, and that doesn't get
you too far in a real network.

PR: 262406
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/670
Signed-off-by: Evgeni Golov <evgeni@debian.org>
Differential Revision: https://reviews.freebsd.org/D34485

14 months agopps: Round to closest integer in pps_event()
Sebastian Huber [Mon, 27 Feb 2023 21:49:10 +0000 (14:49 -0700)]
pps: Round to closest integer in pps_event()

The comment above bintime2timespec() says:

  When converting between timestamps on parallel timescales of differing
  resolutions it is historical and scientific practice to round down.

However, the delta_nsec value is a time difference and not a timestamp.  Also
the rounding errors accumulate in the frequency accumulator, see hardpps().
So, rounding to the closest integer is probably slightly better.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

14 months agopps: Simplify the nsec calculation in pps_event()
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Simplify the nsec calculation in pps_event()

Let A be the current calculation of the frequency accumulator (pps_fcount)
update in pps_event()

  scale = (uint64_t)1 << 63;
  scale /= captc->tc_frequency;
  scale *= 2;
  bt.sec = 0;
  bt.frac = 0;
  bintime_addx(&bt, scale * tcount);
  bintime2timespec(&bt, &ts);
  hardpps(tsp, ts.tv_nsec + 1000000000 * ts.tv_sec);

and hardpps(..., delta_nsec):

  u_nsec = delta_nsec;
  if (u_nsec > (NANOSECOND >> 1))
          u_nsec -= NANOSECOND;
  else if (u_nsec < -(NANOSECOND >> 1))
          u_nsec += NANOSECOND;
  pps_fcount += u_nsec;

This change introduces a new calculation which is slightly simpler and more
straight forward.  Name it B.

Consider the following sample values with a tcount of 2000000100 and a
tc_frequency of 2000000000 (2GHz).

For A, the scale is 9223372036.  Then scale * tcount is 18446744994337203600
which is larger than UINT64_MAX (= 18446744073709551615).  The result is
920627651984 == 18446744994337203600 % UINT64_MAX.  Since all operands are
unsigned the result is well defined through modulo arithmetic.  The result of
bintime2timespec(&bt, &ts) is 49.  This is equal to the correct result
1000000049 % NANOSECOND.

In hardpps(), both conditional statements are not executed and pps_fcount is
incremented by 49.

For the new calculation B, we have 1000000000 * tcount is 2000000100000000000
which is less than UINT64_MAX. This yields after the division with tc_frequency
the correct result of 1000000050 for delta_nsec.

In hardpps(), the first conditional statement is executed and pps_fcount is
incremented by 50.

This shows that both methods yield roughly the same results.  However, method B
is easier to understand and requires fewer conditional statements.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

14 months agopps: Directly assign the timestamps in pps_event()
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Directly assign the timestamps in pps_event()

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

14 months agopps: Move pcount assignment in pps_event()
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Move pcount assignment in pps_event()

Move the pseq increment.  This makes it possible to reuse registers earlier.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

14 months agopps: Simplify capture and event processing
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Simplify capture and event processing

Use local variables for the captured timehand and timecounter in pps_event().
This fixes a potential issue in the nsec preparation for hardpps().  Here the
timecounter was accessed through the captured timehand after the generation was
checked.

Make a snapshot of the relevent timehand values early in pps_event().  Check
the timehand generation only once during the capture and event processing.  Use
atomic_thread_fence_acq() similar to the other readers.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

14 months agopps: Load timecounter once in pps_capture()
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Load timecounter once in pps_capture()

This ensures that the timecounter and the tc_get_timecount handler belong
together.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

14 months agonanobsd: fix typo
Gleb Smirnoff [Mon, 27 Feb 2023 19:26:18 +0000 (11:26 -0800)]
nanobsd: fix typo

Fixes: cbf64e2dd59c3579c49acbc52659eaa1ddceb557

14 months agonetmap: Fix compiler warnings in tools
Mark Johnston [Mon, 27 Feb 2023 18:41:58 +0000 (13:41 -0500)]
netmap: Fix compiler warnings in tools

- Remove write-only variables, or hide them in cases where their use is
  conditional or commented out.
- Check for errors from cmd_apply() in nmreplay.
- Use ANSI C definitions.

Reviewed by: vmaffione
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38752

14 months agoUse 'mixed' links for 'hard' links by default.
Warner Losh [Wed, 8 Feb 2023 21:20:46 +0000 (14:20 -0700)]
Use 'mixed' links for 'hard' links by default.

emaste suggested this in https://github.com/freebsd/freebsd-src/pull/133
and it works. It will do the right thing by default, and handle the weird
cases 133 was trying to fix.

14 months agonanobsd: Better NANO_OBJ if NANO_LAYOUT is set
Warner Losh [Wed, 8 Feb 2023 23:19:49 +0000 (16:19 -0700)]
nanobsd: Better NANO_OBJ if NANO_LAYOUT is set

If NANO_LAYOUT is set, then use /usr/obj/nanobsd.${NANO_NAME}.${NANO_LAYOUT}
instead of the current /usr/obj/nanobsd.${NANO_NAME} to allow multiple layouts
to be built w/o errors due to the time-skew that creates.

PR: 269366
Suggested by: Eugene Grosbein
Sponsored by: Netflix

14 months agodate.1: Examples: Use syntax that is also compatible with csh
Mateusz Piotrowski [Mon, 27 Feb 2023 16:34:00 +0000 (17:34 +0100)]
date.1: Examples: Use syntax that is also compatible with csh

MFC after: 1 month
Sponsored by: Klara Inc.

14 months agoman 3 daemon: remove double negation
Ihor Antonov [Mon, 27 Feb 2023 15:37:41 +0000 (08:37 -0700)]
man 3 daemon: remove double negation

Rephrase double negated sentences to improve readability
OpenBSD has done the same in the past to their man 3 daemon

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/671

14 months agonetinet: Remove IP(V6)_BINDMULTI
Mark Johnston [Mon, 27 Feb 2023 14:52:28 +0000 (09:52 -0500)]
netinet: Remove IP(V6)_BINDMULTI

This option was added in commit 0a100a6f1ee5 but was never completed.
In particular, there is no logic to map flowids to different listening
sockets, so it accomplishes basically the same thing as SO_REUSEPORT.
Meanwhile, we've since added SO_REUSEPORT_LB, which at least tries to
balance among listening sockets using a hash of the 4-tuple and some
optional NUMA policy.

The option was never documented or completed, and an exp-run revealed
nothing using it in the ports tree.  Moreover, it complicates the
already very complicated in_pcbbind_setup(), and the checking in
in_pcbbind_check_bindmulti() is insufficient.  So, let's remove it.

PR: 261398 (exp-run)
Reviewed by: glebius
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38574

14 months agolibrss: Remove rss_sock_set_bindmulti()
Mark Johnston [Mon, 27 Feb 2023 14:50:25 +0000 (09:50 -0500)]
librss: Remove rss_sock_set_bindmulti()

In preparation for the removal of the IP(V6)_BINDMULTI option.

PR: 261398 (exp-run)
Reviewed by: glebius
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38574

14 months agodtrace_kinst.4: mention dtrace -l -P kinst, give a more complete example
Christos Margiolis [Mon, 27 Feb 2023 14:44:13 +0000 (09:44 -0500)]
dtrace_kinst.4: mention dtrace -l -P kinst, give a more complete example

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38801

14 months agokbdreg.h: include opt_kbd.h
Warner Losh [Mon, 27 Feb 2023 14:27:45 +0000 (07:27 -0700)]
kbdreg.h: include opt_kbd.h

This is a kernel-only file, so it's safe to include opt_kbd.h. However,
add #ifdef _KERNEL guards to emphasize that. And also move the include
of opt_kbd.h in atkbdcreg.h to inside the kernel guards. Nothing outside
the kernel in tree uses the rest of that file, but I'm less comfortable
moving the #ifdef _KERNEL to the top of that file.

Sponsored by: Netflix

14 months agonetlink: make the maximum allowed netlink socket buffer runtime tunable.
Alexander V. Chernikov [Mon, 27 Feb 2023 10:44:54 +0000 (10:44 +0000)]
netlink: make the maximum allowed netlink socket buffer runtime tunable.

Dumping large routng tables (>1M paths with multipath) require the socket
 buffer which is larger than the currently defined limit.
Allow the limit to be set in runtime, similar to kern.ipc.maxsockbuf.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 1 day

14 months agokbd: Tweaks to KBD_DELAY[12]
Warner Losh [Mon, 27 Feb 2023 03:48:07 +0000 (20:48 -0700)]
kbd: Tweaks to KBD_DELAY[12]

Make sure NOTES has a different value than the defaults, and properly
document the default values in atkbdc(4) and bump .Dd

Sponsored by: Netflix

15 months agopowerpc64*: port mlx5, OFED, KTLS and krping
Piotr Kubaj [Sat, 25 Feb 2023 21:09:41 +0000 (22:09 +0100)]
powerpc64*: port mlx5, OFED, KTLS and krping

Summary:
This review ports mlx5 driver, kernel's OFED stack (userland is already enabled), KTLS and krping to powerpc64 and powerpc64le.

krping requires a small change since it uses assembly for amd64 / i386.

NOTE: On powerpc64le RDMA works fine in the userspace with libmlx5, but on powerpc64 it does not. The problem is that contrib/ofed/libmlx5/doorbell.h checks for SIZEOF_LONG but this macro exists on neither powerpc64* nor amd64. Thus, the file silently goes to the fallback function written for 32-bit architectures. It works fine on little-endian architectures, but causes a hard fail on big-endian. It's possible it may also cause some runtime issues on little-endian.
Thus, on powerpc64 I verified that RDMA works with krping.

Reviewers: #powerpc, hselasky

Subscribers: bdrewery, imp, emaste, jhibbits

Differential Revision: https://reviews.freebsd.org/D38786

15 months agopseudofs: Fix LOR in VOP_READDIR.
Dag-Erling Smørgrav [Sun, 26 Feb 2023 15:30:53 +0000 (15:30 +0000)]
pseudofs: Fix LOR in VOP_READDIR.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D20862

15 months agoEnsure .inc files are regenerated when llvm/clang tblgen binaries change
Dimitry Andric [Sat, 25 Feb 2023 15:25:57 +0000 (16:25 +0100)]
Ensure .inc files are regenerated when llvm/clang tblgen binaries change

When doing a fully incremental build (with WITHOUT_CLEAN enabled), from
a commit before llvm 15 was merged (3264f6b88fce), to a commit after
that, a number of .inc files were not regenerated. This could lead to
unexpected compilation errors when these .inc files were included from
llvm-project sources, similar to:

  In file included from /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp:8268:
  /usr/obj/usr/src/amd64.amd64/lib/clang/libclang/clang/Basic/arm_mve_builtin_cg.inc:279:18: error: no matching constructor for initialization of 'clang::CodeGen::Address'
    Address Val2 = Address(Val1, CharUnits::fromQuantity(2));
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Work around this by making the .inc files dependent on the tblgen binary
used for generating them. E.g., we can relatively safely assume that if
the binary gets updated, the .inc files must also be updated. (Although
this is not 100% optimal, the gain by complicating things even more is
probaby not worth the effort.)

MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38770

15 months agonfs: patch up MNT_LAZY on sync
Mateusz Guzik [Fri, 24 Feb 2023 19:18:11 +0000 (19:18 +0000)]
nfs: patch up MNT_LAZY on sync

It is a de facto noop, just make it less costly.

Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D38763

15 months agolinprocfs(4): Fixup process size in the /proc/pid/stat file
Dmitry Chagin [Sun, 26 Feb 2023 13:42:22 +0000 (16:42 +0300)]
linprocfs(4): Fixup process size in the /proc/pid/stat file

According to the Linux sources the kernel exposes a proces virtual
memory size via proc filesystem into the three files - stat, status
and statm. This is the struct mm->total_vm value adjusted to the
corresponding units - bytes, kilobytes and pages.

The fix is based on a fernape@ analysis.

PR: 265937
Reported by: Ray Bellis
MFC after: 3 days

15 months agoroute.8: Fix mandoc warnings
Gordon Bergling [Sun, 26 Feb 2023 13:33:58 +0000 (14:33 +0100)]
route.8: Fix mandoc warnings

- skipping end of block that is not open: Oc
- no blank before trailing delimiter
- remove useless TN macros
- remove commented out reference for esis(4)

MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D38783

15 months agoroute.8: Add information about ROUTE_MPATH and FIB_ALGO
Gordon Bergling [Sun, 26 Feb 2023 13:15:34 +0000 (14:15 +0100)]
route.8: Add information about ROUTE_MPATH and FIB_ALGO

Since the kernel options ROUTE_MPATH and FIB_ALGO are enabled
per default for a while, it's good to have some user facing
documetation about the general functionality of multipath
routing and fib lookup algorithms.

Reviewed by: pauamma, Jose Luis Duran <jlduran at gmail dot com>
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D38783

15 months agoctf: Remove unused function prototype for getpname()
Zhenlei Huang [Sun, 26 Feb 2023 04:18:25 +0000 (12:18 +0800)]
ctf: Remove unused function prototype for getpname()

This function prototype should have been removed along with the
implementation.

Fixes: 3dd552426409 ctfdump: Use getprogname()
MFC after: 1 day

15 months agopowerpc: fix warning: a function declaration without a prototype is deprecated in...
Piotr Kubaj [Sat, 25 Feb 2023 23:34:27 +0000 (00:34 +0100)]
powerpc: fix warning: a function declaration without a prototype is deprecated in all versions of C

Reviewers: #powerpc
Approved by: alfredo

Subscribers: imp, jhibbits

Differential Revision: https://reviews.freebsd.org/D38787

15 months agoRevert "powerpc64*: port mlx5, OFED, KTLS and krping"
Piotr Kubaj [Sat, 25 Feb 2023 23:57:41 +0000 (00:57 +0100)]
Revert "powerpc64*: port mlx5, OFED, KTLS and krping"

Wrong push, another commit was supposed to be pushed.

This reverts commit 83d6d8877ef7dad4f4e8f409a01c9f28139cd026.

15 months agopowerpc64*: port mlx5, OFED, KTLS and krping
Piotr Kubaj [Sat, 25 Feb 2023 21:09:41 +0000 (22:09 +0100)]
powerpc64*: port mlx5, OFED, KTLS and krping

Summary:
This review ports mlx5 driver, kernel's OFED stack (userland is already enabled), KTLS and krping to powerpc64 and powerpc64le.

krping requires a small change since it uses assembly for amd64 / i386.

NOTE: On powerpc64le RDMA works fine in the userspace with libmlx5, but on powerpc64 it does not. The problem is that contrib/ofed/libmlx5/doorbell.h checks for SIZEOF_LONG but this macro exists on neither powerpc64* nor amd64. Thus, the file silently goes to the fallback function written for 32-bit architectures. It works fine on little-endian architectures, but causes a hard fail on big-endian. It's possible it may also cause some runtime issues on little-endian.
Thus, on powerpc64 I verified that RDMA works with krping.

Reviewers: #powerpc, hselasky

Subscribers: bdrewery, imp, emaste, jhibbits

Differential Revision: https://reviews.freebsd.org/D38786

15 months agokern: Remove gcc2_compiled stripping
Warner Losh [Sat, 25 Feb 2023 18:33:22 +0000 (11:33 -0700)]
kern: Remove gcc2_compiled stripping

Bruce added stripping of gcc2_compiled and other symbols when he made
the boot loader load the symbols for the kernel in 1995 (b5d89ca8ade3)
before the FreeBSD 2.1 release.  This was copied around a bit and
tweaked over the years, but these symbols aren't produced by clang, nor
gcc12. The were to support dbx for a.out stabs format. gcc removed them
with stabs support last year. gcc 2.95.4 in FreeBSD 4.x continued to
emit these symbols unconditionally (it was missing a test for aout vs
elf it would appaer). They disappeared entirely with gcc 3.2.4 in 5.x
for all non a.out builds, and entirely in FreeBSD 6.x which had gcc
3.2.6.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D38764

15 months agostand: fix buffer overflow in getrootmount()
Robert Wing [Sat, 25 Feb 2023 09:37:32 +0000 (09:37 +0000)]
stand: fix buffer overflow in getrootmount()

Reviewed by: imp, allanjude
Sponsored By:   Beckhoff Automation GmbH & Co. KG
Sponsored By:   Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38734

15 months agokldxref: skip .pkgsave files
Mina Galić [Sat, 25 Feb 2023 17:31:58 +0000 (10:31 -0700)]
kldxref: skip .pkgsave files

This should help people transitioning from traditional setups to pkgbase
experience a lot less friction.

We do this by skipping all files containing two dots.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/661
Differential Revision: https://reviews.freebsd.org/D27959

15 months agouniq(1): use strtonum to parse options
Daniel Tameling [Sat, 25 Feb 2023 17:25:51 +0000 (10:25 -0700)]
uniq(1): use strtonum to parse options

Previously strtol was used and the result was directly cast to an int
without checking for an overflow. Use strtonum instead since it is
safer and tells us what went wrong.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/643

15 months agostand: fix build userboot without zfs
Michael Paepcke [Fri, 24 Feb 2023 19:27:40 +0000 (19:27 +0000)]
stand: fix build userboot without zfs

Fix regression in building userboot -DWITHOUT_LOADER_ZFS

Fixes: e307eb94ae520
MFC After: 3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/665

15 months agoChange hw_tls to a bool
Alfonso [Tue, 20 Jul 2021 20:17:28 +0000 (16:17 -0400)]
Change hw_tls to a bool

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/512

15 months agoapic: prevent divide by zero in CPU frequency init
Mina Galić [Fri, 24 Feb 2023 11:07:42 +0000 (11:07 +0000)]
apic: prevent divide by zero in CPU frequency init

If a CPU for some reason returns 0 as CPU frequency, we currently panic
on the resulting divide by zero when trying to initialize the CPU(s) via
APIC. When this happens, we'll fallback to measuring the frequency
instead.

PR: 269767
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/664

15 months agopowerd.8: Provide a whole path to power_profile for clarity
Mateusz Piotrowski [Sat, 25 Feb 2023 16:28:49 +0000 (17:28 +0100)]
powerd.8: Provide a whole path to power_profile for clarity

MFC after: 3 weeks

15 months agozpool: install vdevprops(7) man page
Yuri [Fri, 24 Feb 2023 20:15:20 +0000 (21:15 +0100)]
zpool: install vdevprops(7) man page

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/666

15 months agoXref rc.conf in my previous addition.
Poul-Henning Kamp [Sat, 25 Feb 2023 16:08:06 +0000 (16:08 +0000)]
Xref rc.conf in my previous addition.

Prodded by: karels

15 months agock_queue: add CK_*_FOREACH_FROM
Mark Johnston [Sat, 25 Feb 2023 15:21:19 +0000 (10:21 -0500)]
ck_queue: add CK_*_FOREACH_FROM

This is a variant of CK_*_FOREACH from FreeBSD queue.h which starts
iteration at the specified item.  If the item pointer is NULL, iteration
starts from the beginning of the list.

Upstream commit 74366be35a6f4635f248a3c62d2d23245a4eb0f4.

MFC after: 2 weeks
Sponsored by: Klara, Inc.

15 months agosys/conf/NOTES: clean up whitespace
Mike Karels [Sat, 25 Feb 2023 14:04:00 +0000 (08:04 -0600)]
sys/conf/NOTES: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

I missed this file on the last pass.

15 months agoinet6_opt_init.3: Some enhancements
Gordon Bergling [Sat, 25 Feb 2023 13:11:27 +0000 (14:11 +0100)]
inet6_opt_init.3: Some enhancements

- Be consistent with RFC references, so add a space after 'RFC'
- Add a LIBRARY section
- Use standard integer types in the SYNOPSIS section

Obtained from: DragonflyBSD
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D27548

15 months agoUPDATING
Michael Paepcke [Tue, 21 Feb 2023 05:36:24 +0000 (05:36 +0000)]
UPDATING

Add notice to kernel options KBD_DELAY1 and KBD_DELAY2

Reviewed by: imp (tweaked whitespace too)
Pull Request: https://github.com/freebsd/freebsd-src/pull/649