Commit Graph

281704 Commits

Author SHA1 Message Date
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
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
Dmitry Chagin
a55b5a9aed 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
2023-02-26 16:42:22 +03:00
Gordon Bergling
6dbfbe6e11 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
2023-02-26 14:33:58 +01:00
Gordon Bergling
b06338167d 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
2023-02-26 14:15:34 +01:00
Zhenlei Huang
f8e1aa85fe ctf: Remove unused function prototype for getpname()
This function prototype should have been removed along with the
implementation.

Fixes:		3dd5524264 ctfdump: Use getprogname()
MFC after:	1 day
2023-02-26 12:18:25 +08:00
Piotr Kubaj
429ba161fb 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
2023-02-26 01:00:19 +01:00
Piotr Kubaj
f5a1c871e6 Revert "powerpc64*: port mlx5, OFED, KTLS and krping"
Wrong push, another commit was supposed to be pushed.

This reverts commit 83d6d8877e.
2023-02-26 00:57:41 +01:00
Piotr Kubaj
83d6d8877e 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 00:56:37 +01:00
Warner Losh
b5d248c0c8 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 (b5d89ca8ad)
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
2023-02-25 11:49:25 -07:00
Robert Wing
c5f0198070 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
2023-02-25 09:37:32 +00:00
Mina Galić
773c13c686 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
2023-02-25 10:35:43 -07:00
Daniel Tameling
e052829e3e 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
2023-02-25 10:25:51 -07:00
Michael Paepcke
4d59545d0c stand: fix build userboot without zfs
Fix regression in building userboot -DWITHOUT_LOADER_ZFS

Fixes: e307eb94ae
MFC After: 3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/665
2023-02-25 10:14:07 -07:00
Alfonso
2f201df1f8 Change hw_tls to a bool
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/512
2023-02-25 09:59:11 -07:00
Mina Galić
499171a98c 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
2023-02-25 09:47:40 -07:00
Mateusz Piotrowski
28111ddf9e powerd.8: Provide a whole path to power_profile for clarity
MFC after:	3 weeks
2023-02-25 17:30:27 +01:00
Yuri
996d07a059 zpool: install vdevprops(7) man page
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/666
2023-02-25 09:24:20 -07:00
Poul-Henning Kamp
3b7d00ddbd Xref rc.conf in my previous addition.
Prodded by: karels
2023-02-25 16:08:06 +00:00
Mark Johnston
6f48a4acbe 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.
2023-02-25 10:34:06 -05:00
Mike Karels
b739bc9860 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.
2023-02-25 09:27:06 -06:00
Gordon Bergling
211ceb62e8 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
2023-02-25 14:11:27 +01:00
Michael Paepcke
9b70ce712c 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
2023-02-24 23:20:52 -07:00