Commit Graph

281725 Commits

Author SHA1 Message Date
Warner Losh
af23369a6d github: Create pull request template
Just to see how this looks. Will likely need to iterate.
2023-02-28 11:23:53 -07:00
Stéphane Rochoy
1b10e191f3 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
2023-02-28 10:17:53 -07:00
John Grafton
9ab40bc40d 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
2023-02-28 09:59:34 -07:00
Gleb Smirnoff
5f7bea2952 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:	caf32b260a
2023-02-28 08:56:20 -08:00
Warner Losh
ce95864fba 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
2023-02-28 09:36:28 -07:00
Tom Hukins
b8c44def53 rc.conf(5): document nscd_enable
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/650
2023-02-28 09:36:25 -07:00
Tom Hukins
0f994a19e2 rc.conf(5): describe what unbound(8) does
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/650
2023-02-28 09:36:17 -07:00
Mark Johnston
092a543ec3 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
2023-02-28 11:10:04 -05:00
Mike Karels
eef9f9900f 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
2023-02-28 07:55:35 -06:00
Cy Schubert
8866ea619a 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
2023-02-28 05:46:00 -08:00
Cy Schubert
6f295aab80 usbdevs: Add APC Smart-UPS1000
MFC after:	1 week
2023-02-28 05:46:00 -08:00
Cy Schubert
b1723f48d8 usbdevs: Remove duplicate APC entries
MFC after:	1 week
2023-02-28 05:46:00 -08:00
Cy Schubert
7bba9d9473 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
2023-02-28 05:28:07 -08:00
Vitaliy Gusev
9ff3e8b7f0
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
2023-02-28 13:37:58 +01:00
Vitaliy Gusev
8104fc31a2
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:			39ec056e6d ("vmm: Rework snapshotting of CPU-specific per-vCPU data.")
MFC after:		2 weeks
Sponsored by:		vStack
Differential Revision:	https://reviews.freebsd.org/D38476
2023-02-28 13:37:53 +01:00
Vitaliy Gusev
281b496f22
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:			a7db532e3a ("vmm: Simplify saving of absolute TSC values in snapshots.")
MFC after:		2 weeks
Sponsored by:		vStack
Differential Revision:	https://reviews.freebsd.org/D38474
2023-02-28 13:37:44 +01:00
Corvin Köhne
34f804e547
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
2023-02-28 13:37:12 +01:00
Corvin Köhne
3ef46195ac
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
2023-02-28 13:37:03 +01:00
Zhenlei Huang
2c33b456ff jail: Improve readability
No functional change intended.

Reviewed by:	melifaro
Differential Revision:	https://reviews.freebsd.org/D37890
2023-02-28 18:20:07 +08:00
Zhenlei Huang
500f82d6c3 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
21ad3e27fa and ddbf879d79. 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
2023-02-28 18:20:06 +08:00
Alexander Leidinger
b45f09ac57 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.
2023-02-28 09:38:42 +01:00
Ed Maste
05e2e803eb CONTRIBUTING.md: correct developer certificate of origin link markup
Sponsored by:	The FreeBSD Foundation
2023-02-27 21:36:29 -05:00
Warner Losh
873c13f9f7 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
2023-02-27 17:19:25 -07:00
Warner Losh
81ef45eda4 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
2023-02-27 16:58:05 -07:00
Cy Schubert
615bd3eb2a 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
2023-02-27 15:41:54 -08:00
Alfonso
68160fbd1f 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
2023-02-27 16:26:49 -07:00
Vladimir Kotal
9630e237ab report full error string on SSL_connect() failure
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/575
2023-02-27 16:07:30 -07:00
Evgeni Golov
55747938b5 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
2023-02-27 15:51:27 -07:00
Sebastian Huber
28ed159f26 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
2023-02-27 15:10:55 -07:00
Sebastian Huber
1e48d9d336 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
2023-02-27 15:10:55 -07:00
Sebastian Huber
8a142484d4 pps: Directly assign the timestamps in pps_event()
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604
2023-02-27 15:10:55 -07:00
Sebastian Huber
0448501f2b 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
2023-02-27 15:10:55 -07:00
Sebastian Huber
fd88f4e190 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
2023-02-27 15:10:55 -07:00
Sebastian Huber
cb2a028b15 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
2023-02-27 15:10:54 -07:00
Gleb Smirnoff
d8c70d6dfb nanobsd: fix typo
Fixes:	cbf64e2dd5
2023-02-27 11:26:18 -08:00
Mark Johnston
538c66eabd 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
2023-02-27 13:41:58 -05:00
Warner Losh
55f35c5398 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.
2023-02-27 10:19:00 -07:00
Warner Losh
cbf64e2dd5 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
2023-02-27 10:18:59 -07:00
Mateusz Piotrowski
de7a6b6fd0 date.1: Examples: Use syntax that is also compatible with csh
MFC after:	1 month
Sponsored by:	Klara Inc.
2023-02-27 17:37:28 +01:00
Ihor Antonov
6e9b4e3e0d 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
2023-02-27 08:40:08 -07:00
Mark Johnston
3aff4ccdd7 netinet: Remove IP(V6)_BINDMULTI
This option was added in commit 0a100a6f1e 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
2023-02-27 10:03:11 -05:00
Mark Johnston
b9199d152f 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
2023-02-27 10:03:11 -05:00
Christos Margiolis
2d71406a6f 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
2023-02-27 10:03:10 -05:00
Warner Losh
cd29688e8e 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
2023-02-27 07:37:32 -07:00
Alexander V. Chernikov
28a5d88f70 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
2023-02-27 10:48:31 +00:00
Warner Losh
a4b92fefd2 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
2023-02-26 20:49:32 -07:00
Piotr Kubaj
e552cac3d7 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
2023-02-26 23:38:33 +01:00
Dag-Erling Smørgrav
b8bb73ab72 pseudofs: Fix LOR in VOP_READDIR.
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D20862
2023-02-26 15:30:53 +00:00
Dimitry Andric
ab80f0b21f 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 (3264f6b88f), 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
2023-02-26 15:56:07 +01:00
Mateusz Guzik
5ff7fb76cb 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
2023-02-26 13:44:56 +00:00