Commit Graph

258674 Commits

Author SHA1 Message Date
Rick Macklem
46269d66ed NFSv4 server: Re-establish the delegation recall timeout
Commit 7a606f280a allowed the server to do retries of CB_RECALL
callbacks every couple of seconds.  This was needed to allow the
Linux client to re-establish the back channel.
However this patch broke the delegation timeout check, such that
it would just keep retrying CB_RECALLS.
If the client has crashed or been network patitioned from the
server, this continues until the client TCP reconnects to
the server and re-establishes the back channel.

This patch modifies the code such that it still times out the
delegation recall after some minutes, so that the server will
allow the conflicting client request once the delegation times out.

This patch only affects the NFSv4 server when delegations are
enabled and a NFSv4 client that holds a delegation has crashed
or been network partitioned from the server for at least several
minutes when a delegation needs to be recalled.

MFC after:	2 weeks
2021-05-16 16:40:01 -07:00
Edward Tomasz Napierala
75b5caa08e cam: turn KASSERTs into printfs for now
It looks like I've missed a couple of places where we don't clear
stack-allocated CCBs.  Don't panic when that happens, just print
a warning.

This is a temporary measure until I get those cases fixed.

Reviewed By:	markj
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30296
2021-05-16 20:19:19 +01:00
Mark Johnston
fb58045145 linux: Fix SMAP-enabled futex routines
Some of them were dereferencing the user pointer before disabling SMAP.

PR:		255591
Reviewed by:	kib
Tested by:	pitwuu@gmail.com
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30276
2021-05-16 13:42:08 -04:00
Lutz Donnerhacke
687e510e5c netgraph/ng_checksum: Fix double free error
m_pullup(9) frees the mbuf(9) chain in the case of an allocation error.
The mbuf chain must not be freed again in this case.

PR:		255874
Submitted by:	<lylgood@foxmail.com>
Approved by:	markj
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30273
2021-05-16 19:39:51 +02:00
Edward Tomasz Napierala
8252fe56a0 cam: Fix race condition in dainit()
Previously, daregister() could have been called before dainit()
initialized the UMA zone.  This would trip a KASSERT.

Reported By:	pho
Tested By:	pho
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
2021-05-16 13:36:54 +01:00
Edward Tomasz Napierala
0f206cc912 cam: add missing zeroing of a stack-allocated CCB.
This could cause a panic at boot.

Reported By:	Shawn Webb <shawn.webb AT hardenedbsd.org>
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
2021-05-16 11:38:26 +01:00
Toomas Soome
5365af662c loader: gfx_fb_drawrect should use GfxFbBltVideoFill
The gfx_fb_drawrect() is drawing rectangle by pixels, this can be very
slow on some systems. Use Blt() video fill primitive instead.

Testing done: Tested on mac mini 2012 where the issue was revealed

Reviewed by:	yuripv
MFC after:	1 week
2021-05-16 11:22:37 +03:00
Guangyuan Yang
80ba60f643 kerberos.8: Replace dead link
Replace it with a tutorial hosted on kerberos.org and the classic
"dialogue" from Bill Bryant. The change has been reported and
merged upstream (https://github.com/heimdal/heimdal/commit/7f3445f1b7).

MFC after:	3 days
PR:		251854
Reported by:	ktullavik@gmail.com
Submitted by:	bjk (upstream github)
Reviewed by:	bcr
2021-05-16 01:37:09 -04:00
Lutz Donnerhacke
2e6b07866f libalias: Ensure ASSERT behind varable declarations
At some places the ASSERT was inserted before variable declarations are
finished.  This is fixed now.

Reported by:	kib
Reviewed by:	kib
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30282
2021-05-16 02:28:36 +02:00
Mateusz Guzik
eec2e4ef7f tmpfs: reimplement the mtime scan to use the lazy list
Tested by:	pho
Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D30065
2021-05-15 20:48:45 +00:00
Mateusz Guzik
128e25842e vm: add another pager private flag
Move OBJ_SHADOWLIST around to let pager flags be next to each other.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D30258
2021-05-15 20:47:29 +00:00
Mitchell Horne
7fbc0c98a8 build(7): use a more relevant example for PORTS_MODULES
emulators/kqemu-kmod no longer exists in the ports tree.

Reviewed by:	imp, bcr
Differential Revision:	https://reviews.freebsd.org/D30261
2021-05-15 11:15:25 -03:00
Edward Tomasz Napierala
3394d4239b cam: allocate CCBs from UMA for SCSI and ATA IO
This patch makes it possible for CAM to use small CCBs allocated
from an periph-specific UMA zone instead of the usual, huge ones.
The end result is that CCBs issued via da(4) take 544B (size of
ccb_scsiio) instead of the usual 2kB (size of 'union ccb', ~1.5kB,
rounded up by malloc(9)).  For ATA it's 272B.  We waste less
memory, we avoid zeroing the unused 1kB, and it should be easier
to allocate those CCBs in low memory conditions.  It should also
be possible to use uma_zone_reserve(9) to improve behaviour
in low memory conditions even further.

Note that this does not change the size, or the layout, of CCBs
as such.  CCBs get allocated in various different ways, in particular
on the stack, and I don't want to redo all that.  Instead, this
provides an opt-in mechanism for the periph to declare "my start()
callback is fine with receiving a CCB allocated from this UMA zone".
In other words, most of the code works exactly as it used to; the
change only happens to IOs issued by xpt_run_allockq(), which
is - conveniently - pretty much all that matters for performance.

The reason for doing it this way is that it's pretty small, localized
change, and can be implemented gradually and iteratively: take a
periph, make sure its start() callback only casts the CCBs it takes
to a particular type of CCB, for example ccb_scsiio, and that it only
casts CCBs returned by cam_periph_getccb() to that type, then add UMA
zone for that size, and declare it safe to XPT.

This is disabled by default.  Set 'kern.cam.ada.enable_uma_ccbs=1'
and 'kern.cam.da.enable_uma_ccbs=1' tunables to enable it.  Testing
is welcome; I will flip the default to enable in two weeks from now.

Reviewed By:	imp
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D28674
2021-05-15 12:03:49 +01:00
Lutz Donnerhacke
189f8eea13 libalias: replace placeholder with static constant
The field nullAddress in struct libalias is never set and never used.
It exists as a placeholder for an unused argument only.

Reviewed by:	hselasky
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D30253
2021-05-15 09:05:30 +02:00
Lutz Donnerhacke
effc8e57fb libalias: Style cleanup
libalias is a convolut of various coding styles modified by a series
of different editors enforcing interesting convetions on spacing and
comments.

This patch is a baseline to start with a perfomance rework of
libalias.  Upcoming patches should be focus on the code, not on the
style.  That's why most annoying style errors should be fixed
beforehand.

Reviewed by:	hselasky
Discussed by:	emaste
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D30259
2021-05-15 08:57:55 +02:00
Robert Wing
91f251b2ab fstyp(8): define HAVE_ZFS macro when built with zfs
The HAVE_ZFS macro was dropped from the Makefile during the OpenZFS
merge, bring it back.

While here, drop unused WARNS setting.

PR:             255616
Reported by:    Michael Büker <freebsd@michael-bueker.de>
Submitted by:   Michael Büker <freebsd@michael-bueker.de>
Fixes:          9e5787d228
Reviewed by:    markj
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D30221
2021-05-14 13:00:24 -08:00
Mitchell Horne
cf653b7abe git-arc(1): fix usage formatting for stage command
The branch argument is conditional on the -b flag.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D30262
2021-05-14 17:34:04 -03:00
John Baldwin
e73e2ee0ac cxgbei: Handle target transfers with excess unsolicited data.
The CTL frontend might have provided a buffer that is smaller than the
FirstBurstLength and thus smaller than the amount of unsolicited data
included in the request PDU.  Treat these transfers as an empty
transfer.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

Differential Revision:	https://reviews.freebsd.org/D29940
2021-05-14 12:21:34 -07:00
John Baldwin
e894e3adb2 cxgbei: Explicitly clear the page pode reservation pointer after freeing it.
A single union ctl_io can be reused across multiple transfers (in
particular by the ramdisk backend).  On a reuse, the reservation
pointer would retain its value from the previous transfer tripping an
assertion.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

Differential Revision:	https://reviews.freebsd.org/D29939
2021-05-14 12:21:34 -07:00
John Baldwin
1ad32ad0be cxgbei: Don't clamp iSCSI PDUs to 8K.
The firmware no longer requires this workaround.

Discussed with:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29912
2021-05-14 12:21:24 -07:00
John Baldwin
4add8e4c89 cxgbei: Don't leak resources for an aborted target transfer.
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29911
2021-05-14 12:17:26 -07:00
John Baldwin
a1c687347a cxgbei: Add support for zero-copy iSCSI target transmission/read.
- Switch to allocating the cxgbei version of icl_pdu explicitly
  as a separate refcounted object allocated via malloc/free
  instead of storing it in the bhs mbuf prior to the bhs.

- Support the icl_conn_pdu_queue_cb() method to set a callback
  on a PDU to be invoked when the PDU is freed.

- For ICL_NOCOPY buffers, use an external mbuf to manage the
  storage for the buffer via m_extaddref().  Each external mbuf
  holds a reference on the associated PDU, so the callback is
  invoked once all of the external mbufs have been freed.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29910
2021-05-14 12:17:20 -07:00
John Baldwin
31df8ff73e cxgbei: Rework the pdu_append_data hook to support M_WAITOK.
- Only allocate 16K jumbo mbufs if the region of data to be
  appended is sufficiently large, and use a loop.

- Use m_getm2() to allocate a chain for data less than 16K, or
  if m_getjcl() fails.

- Use ENOMEM as the return value instead of '1' if the hook fails due
  to a memory allocation error.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29909
2021-05-14 12:17:14 -07:00
John Baldwin
46bee8043e cxgbei: Support DDP for target I/O S/G lists with more than one entry.
A CAM target layer I/O CCB can use a S/G list of virtual address ranges
to describe its data buffer.  This change adds zero-copy receive support
for such requests.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29908
2021-05-14 12:17:06 -07:00
John Baldwin
23b209ee88 cxgbe tom: Account for pre-iSCSI mode data on suspended connections.
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29907
2021-05-14 12:17:02 -07:00
John Baldwin
91ca7b0954 cxgbei: Whitespace fixes, comment typo, and rewrap a comment.
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29906
2021-05-14 12:16:57 -07:00
John Baldwin
87bb5ed606 cxgbei: Use hardware RX flow control for offloaded iSCSI connections.
Forthcoming T6 iSCSI DDP support requires hardware RX flow control.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29905
2021-05-14 12:16:51 -07:00
John Baldwin
4427ac3675 cxgbe tom: Set the tid in the work requests to program page pods for iSCSI.
As a result, CPL_FW4_ACK now returns credits for these work requests.
To support this, page pod work requests are now constructed in special
mbufs similar to "raw" mbufs used for NIC TLS in plain TX queues.
These special mbufs are stored in the ulp_pduq and dispatched in order
with PDU work requests.

Sponsored by:	Chelsio Communications
Discussed with:	np
Differential Revision:	https://reviews.freebsd.org/D29904
2021-05-14 12:16:40 -07:00
John Baldwin
4b6ed0758d cxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter.
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29903
2021-05-14 12:16:33 -07:00
Alexander V. Chernikov
76cfc6fa0d Fix a use after free in update_rtm_from_rc().
update_rtm_from_rc() calls update_rtm_from_info() internally.
The latter one may update provided prtm pointer with a new rtm.
Reassign rtm from prtm afeter calling update_rtm_from_info() to
 avoid touching the freed rtm.

PR:		255871
Submitted by:	lylgood@foxmail.com
MFC after:	3 days
2021-05-14 16:06:41 +00:00
Mateusz Guzik
852088f6af vfs: add missing atomic conversion to writecount adjustment
Fixes:	("vfs: lockless writecount adjustment in set/unset text")
2021-05-14 17:42:05 +02:00
Hans Petter Selasky
c904e20cc9 Implement own command line option for the frequently used -i usbusX -f Y syntax,
-d ugenX.Y, similar to what usbconfig(8) does.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-05-14 17:15:07 +02:00
Hans Petter Selasky
c65e2d7092 Update ugen(4) manual page.
Fix description of generic USB character devices.

PR:		244842
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-05-14 17:14:18 +02:00
Mateusz Guzik
ca1ce50b2b vfs: add more safety against concurrent forced unmount to vn_write
1. stop re-reading ->v_mount (can become NULL)
2. stop re-reading ->v_type (can change to VBAD)
2021-05-14 14:22:22 +00:00
Mateusz Guzik
b5fb9ae687 vfs: lockless writecount adjustment in set/unset text
... for cases where this is not the first/last exec.
2021-05-14 14:22:21 +00:00
Mark Johnston
2cca77ee01 kqueue timer: Remove detached knotes from the process stop queue
There are some scenarios where a timer event may be detached when it is
on the process' kqueue timer stop queue.  If kqtimer_proc_continue() is
called after that point, it will iterate over the queue and access freed
timer structures.

It is also possible, at least in a multithreaded program, for a stopped
timer event to be scheduled without removing it from the process' stop
queue.  Ensure that we do not doubly enqueue the event structure in this
case.

Reported by:	syzbot+cea0931bb4e34cd728bd@syzkaller.appspotmail.com
Reported by:	syzbot+9e1a2f3734652015998c@syzkaller.appspotmail.com
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30251
2021-05-14 10:08:14 -04:00
Nathan Whitehorn
34766aa8cb Fix scripted installs on EFI systems using ZFS root with zfsboot.
Unlike attended installations, scripted installs did not mount non-ZFS
partitions when ZFS root (via zfsboot) was selected. Since this included
the ESP, the EFI loader was not installed. Copy logic from the
attended-install path to make this work.

PR:		255824, 255081
MFC after:	1 week
Obtained from:	Mark Huizer
2021-05-14 08:30:41 -04:00
Marcin Wojtas
f55bd0e579 qoriq_dw_pci: disable LS1028A support
Enabled driver initialization causes an abort
on the NXP LS1028ARDB platform (without any external
endpoints connected). Temporarily disable qoriq_dw_pci
probe, so that to allow successful booting of the OS.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30229
2021-05-14 10:50:17 +02:00
Marcin Wojtas
1f84b3a247 sdhci_fsl_fdt.c: Read supported voltages from dts.
We shouldn't overwrite capability register. Instead, voltages supported
by the controller have to be read from dts, as the hardware doesn't
report correct values.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30123
2021-05-14 10:34:37 +02:00
Marcin Wojtas
f0a9d7d799 sdhci_fsl_fdt.c: Add a missing call to mmc_fdt_parse.
Add a missing call to mmc_fdt_parse, without it some dts properties
are not parsed.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30122
2021-05-14 10:29:31 +02:00
Marcin Wojtas
ffd61af32c sdhci_fsl_fdt.c: Add support for LS1028a.
Add data specific for SoC, including all necessary quirks.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30121
2021-05-14 10:28:09 +02:00
Peter Holm
2a60dec091 stress2: Added a regression test. Fixed a type on an old test 2021-05-14 09:18:39 +02:00
Lutz Donnerhacke
a56e5ad690 netgraph/ng_bridge: Handle send errors during loop handling
If sending out a packet fails during the loop over all links, the
allocated memory is leaked and not all links receive a copy.  This
patch fixes those problems, clarifies a premature abort of the loop,
and fixes a minory style(9) bug.

PR:		255430
Submitted by:	Dancho Penev
Tested by:	Dancho Penev
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30008
2021-05-13 21:49:20 +02:00
Lutz Donnerhacke
4dfe70fdbd netgraph/ng_bridge: Avoid cache thrashing
Hint the compiler, that this update is needed at most once per second.
Only in this case the memory line needs to be written.  This will
reduce the amount of cache trashing during forward of most frames.

Suggested by:	zec
Approved by:	zec
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28601
2021-05-13 21:14:36 +02:00
Mitchell Horne
f59127dac5 hwpmc: fix PMC_CPU_LAST
It is unused, but incorrect.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2021-05-13 16:02:59 -03:00
Mitchell Horne
dfdc57e8aa libpmc: fall-back to kernel tables if pmu-events fails
On x86, the pmu_events table is the source of truth for finding
supported events. However, events not found there may still be present
in the kernel's static event tables. For example, the pmc.soft(3) events
will never be available from pmu-events.

Update pmc_allocate() to search the legacy event tables if
pmc_pmu_pmcallocate() fails to return a result. This allows both event
sources to be consulted before giving up, thus restoring pmc.soft(3) and
pmc.tsc(3) on x86.

Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30216
2021-05-13 16:01:24 -03:00
Mitchell Horne
da13ef6aa0 libpmc: remove PMC_MDEP_TABLE logic
This logic was added for handling some of the complicated relationships
between events and x86 CPU models. Since that logic has been mostly
removed from libpmc(3) in favor of pmu-events, this no longer serves
much of a purpose. Mapping CPU types to event tables is already handled
by the switch statement in pmc_init().

Reviewed by:	ray, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30196
2021-05-13 16:01:19 -03:00
Mitchell Horne
4d8d74a4f5 libpmc: remove unused PMC_MDEP_INIT_INTEL_V2
All uses of this macro were removed in e92a1350b5. Remove
cpu_has_iaf_counters as well.

Reviewed by:	ray, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30195
2021-05-13 15:56:39 -03:00
Emmanuel Vadot
28ce201269 UPDATING: fix spelling
Reported by:	pstef
2021-05-13 20:26:10 +02:00
Emmanuel Vadot
0b426a1c2c modules: Only build sdhci_fdt for arm and arm64
Other FDT platform (like powerpc64* or riscv64) don't have gpio built
by default so just compile the module for those two arches.

Fixes:	9e08f82058 ("modules: Add sdhci_fdt module")
2021-05-13 20:23:59 +02:00