]> xenbits.xensource.com Git - people/royger/freebsd.git/log
people/royger/freebsd.git
3 years agosmartpqi: Remove stray declaration
Warner Losh [Thu, 3 Jun 2021 23:44:27 +0000 (17:44 -0600)]
smartpqi: Remove stray declaration

pqisrc_is_firmware_feature_enabled shouldn't be declared inline in a
header, and then static inline in the .c function. Remove this stray
declartion from the header. gcc6 complains, but clang does not.

Sponsored by: Netflix

3 years agouefisign: fix SizeOfHeaders sanity check.
Kenneth Camann [Sun, 3 Jan 2021 02:11:42 +0000 (21:11 -0500)]
uefisign: fix SizeOfHeaders sanity check.

This check was too aggressive: it is fine if SizeOfHeaders is exactly
equal to the size of the DOS stub + PE header + section table. Despite
being wrong this code typically worked for most EFI binaries because
SizeOfHeaders is rounded up to a multiple of FileAlignment, which is
often large (e.g., 512 bytes for the FreeBSD loader) so most binaries
made it through.

Reviewed by: imp@
Sponsored by: Netflix
Pull Request: https://github.com/freebsd/freebsd-src/pull/445

3 years agoDisable x2APIC for SandyBridge laptops with Samsung BIOS
Konstantin Belousov [Wed, 2 Jun 2021 22:29:07 +0000 (01:29 +0300)]
Disable x2APIC for SandyBridge laptops with Samsung BIOS

From the PR:
Almost always, my Samsung RF511 laptop could not boot with
x2APIC enabled in the kernel. It froze during SMP initialization,
shortly after "ACPI APIC Table: <SECCSD LH43STAR>" was printed
to the console. When the kernel is instructed not to use x2APIC,
the system boots correctly.

PR: 256389
Submitted by: David Sebek <dasebek@gmail.com>
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30624

3 years agomadt_setup_local: extract special case checks into a helper
Konstantin Belousov [Wed, 2 Jun 2021 22:27:32 +0000 (01:27 +0300)]
madt_setup_local: extract special case checks into a helper

Reviewed by: markj
Tested by: David Sebek <dasebek@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30624

3 years agomadt_setup_local: convert series of strcmp to iteration over the array
Konstantin Belousov [Wed, 2 Jun 2021 22:19:09 +0000 (01:19 +0300)]
madt_setup_local: convert series of strcmp to iteration over the array

to prepare for one more addition

Reviewed by: markj
Tested by: David Sebek <dasebek@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30624

3 years agomadt_setup_local: skip further checks if ACPI DMAR table already disabled x2APIC
Konstantin Belousov [Wed, 2 Jun 2021 22:01:28 +0000 (01:01 +0300)]
madt_setup_local: skip further checks if ACPI DMAR table already disabled x2APIC

Reviewed by: markj
Tested by: David Sebek <dasebek@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30624

3 years agompr/mps: Minor state machine fix
Warner Losh [Thu, 3 Jun 2021 19:46:19 +0000 (13:46 -0600)]
mpr/mps: Minor state machine fix

When a DMA chain can't be loaded, set the state to STATE_INQUEUE so that
the mp[rs]_complete_command can properly fail the command.

Sponsored by: Netflix

3 years agoFix mpr(4) and mps(4) state transitions and a use-after-free panic.
Kenneth D. Merry [Thu, 3 Jun 2021 19:46:11 +0000 (13:46 -0600)]
Fix mpr(4) and mps(4) state transitions and a use-after-free panic.

When the mpr(4) and mps(4) drivers probe a SATA device, they issue an
ATA Identify command (via mp{s,r}sas_get_sata_identify()) before the
target is fully setup in the driver.  The drivers wait for completion of
the identify command, and have a 5 second timeout.  If the timeout
fires, the command is marked with the SATA_ID_TIMEOUT flag so it can be
freed later.

That is where the use-after-free problem comes in.  Once the ATA
Identify times out, the driver sends a target reset, and then frees any
identify commands that have timed out.  But, once the target reset
completes, commands that were queued to the drive are returned to the
driver by the controller.

At that point, the driver (in mp{s,r}_intr_locked()) looks up the
command descriptor for that particular SMID, marks it CM_STATE_BUSY and
sends it on for completion handling.

The problem at this stage is that the command has already been freed,
and put on the free queue, so its state is CM_STATE_FREE.  If INVARIANTS
are turned on, we get a panic as soon as this command is allocated,
because its state is no longer CM_STATE_FREE, but rather CM_STATE_BUSY.

So, the solution is to not free ATA Identify commands that get stuck
until they actually return from the controller.  Hopefully this works
correctly on older firmware versions.  If not, it could result in
commands hanging around indefinitely.  But, the alternative is a
use-after-free panic or assertion (in the INVARIANTS case).

This also tightens up the state transitions between CM_STATE_FREE,
CM_STATE_BUSY and CM_STATE_INQUEUE, so that the state transitions happen
once, and we have assertions to make sure that commands are in the
correct state before transitioning to the next state.  Also, for each
state assertion, we print out the current state of the command if it is
incorrect.

mp{s,r}.c:      Add a new sysctl variable, dump_reqs_alltypes,
                that controls the behavior of the dump_reqs sysctl.
                If dump_reqs_alltypes is non-zero, it will dump
                all commands, not just the commands that are in the
                CM_STATE_INQUEUE state.  (You can see the commands
                that are in the queue by using mp{s,r}util debug
                dumpreqs.)

                Make sure that the INQUEUE -> BUSY state transition
                happens in one place, the mp{s,r}_complete_command
                routine.

mp{s,r}_sas.c:  Make sure we print the current command type in
                command state assertions.

mp{s,r}_sas_lsi.c:
                Add a new completion handler,
                mp{s,r}sas_ata_id_complete.  This completion
                handler will free data allocated for an ATA
                Identify command and free the command structure.

                In mp{s,r}_ata_id_timeout, do not set the command
                state to CM_STATE_BUSY.  The command is still in
                queue in the controller.  Since we were blocking
                waiting for this command to complete, there was
                no completion handler previously.  Set the
                completion handler, so that whenever the command
                does come back, it will get freed properly.

                Do not free ATA Identify commands that have timed
                out in mp{s,r}sas_add_device().  Wait for them
                to actually come back from the controller.

mp{s,r}var.h:   Add a dump_reqs_alltypes variable for the new
                dump_reqs_alltypes sysctl.

                Make sure we print the current state for state
                transition asserts.

This was tested in the Spectra Logic test bed (as described in the
review), as well Netflix's Open Connect fleet (where panics dropped from
a dozen or two a month to zero).

Reviewed by: imp@ (who is handling the commit with ken's OK)
Sponsored by: Spectra Logic
Differential Revision: https://reviews.freebsd.org/D25476

3 years agocam: prefer cam_sim_softc() over accessing cam_sim structure directly.
Warner Losh [Thu, 3 Jun 2021 19:05:20 +0000 (13:05 -0600)]
cam: prefer cam_sim_softc() over accessing cam_sim structure directly.

Use the accessor function to get the softc for this sim. This also drops
an unneeded cast.

Sponsored by: Netflix
Reviewed by: mav@, hselasky@
Differential Revision: https://reviews.freebsd.org/D30360

3 years agoAdd C++ headers <barrier> <concepts> <execution> <latch> <numbers> <semaphore>
Dimitry Andric [Thu, 3 Jun 2021 18:53:18 +0000 (20:53 +0200)]
Add C++ headers <barrier> <concepts> <execution> <latch> <numbers> <semaphore>

I missed adding these to the libc++ Makefile, when importing
llvm-project 11.0.0-rc1, even though they were supplied by upstream.

While here, update OptionalObsoleteFiles.inc to add these new headers,
and cleanup old cruft.

Reported by: yuri
Submitted by: jkim (Makefile diff)
PR: 255374
MFC after: 3 days

3 years agoaxgbe: Don't dereference NULL pointers
Warner Losh [Thu, 3 Jun 2021 18:03:45 +0000 (12:03 -0600)]
axgbe: Don't dereference NULL pointers

if (sb == NULL) { ... sb->s_error } is going to be a bad time. Return
ENOMEM when we cannot allocate an sbuf for the sysctl rather than
dereferencing the NULL pointer just returned.

Reviewed by: manu@, allanjude@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30373

3 years agommc:: Undo my conversion of (bool) to !!.
Warner Losh [Thu, 3 Jun 2021 17:26:57 +0000 (11:26 -0600)]
mmc:: Undo my conversion of (bool) to !!.

The need for !! over (bool) pre-dates gcc 4.2, so go with the patch
as-submitted because the kernel tends to prefer that.

Suggested by: emaste@
Sponsored by: Netflix

3 years agobectl(8): don't allow creation of boot environments with spaces
Robert Wing [Thu, 3 Jun 2021 16:36:11 +0000 (08:36 -0800)]
bectl(8): don't allow creation of boot environments with spaces

Boot environment datasets that contain spaces are not bootable.

When a user attempts to create a boot environment with a space, abort
the creation and print an error message.

PR:             254441
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D30194

3 years agousb: reduce verbosity of logging about unsuccessful port reset
Maksym Stetsyuk [Thu, 3 Jun 2021 15:52:21 +0000 (09:52 -0600)]
usb: reduce verbosity of logging about unsuccessful port reset

Reviewed by: imp@,hselasny@
Pull Request: https://github.com/freebsd/freebsd-src/pull/385
Differential Revision: https://reviews.freebsd.org/D30621

3 years agopf tests: Make killstate:match more robust
Kristof Provost [Thu, 3 Jun 2021 13:22:19 +0000 (15:22 +0200)]
pf tests: Make killstate:match more robust

The killstate:match test starts nc as a background process. There was no
guarantee that the nc process would have connected by the time we check
for states, so this test occasionally failed without good reason.

Teach the test to wait for at least some states to turn up before
executing the critical checks.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agonetpfil tests: Basic dummynet pipe test
Kristof Provost [Fri, 21 May 2021 09:14:34 +0000 (11:14 +0200)]
netpfil tests: Basic dummynet pipe test

Test dummynet pipes (i.e. bandwidth limitation) with ipfw. This is put
in the common tests because we hope to add dummynet support to pf in the
near future.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30380

3 years agodummynet: free(NULL, M_DUMMYNET); is safe
Kristof Provost [Fri, 21 May 2021 14:55:07 +0000 (16:55 +0200)]
dummynet: free(NULL, M_DUMMYNET); is safe

There's no need to check pointers for NULL before free()ing them.

No functional change.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30382

3 years agodummynet: Fix schedlist and aqmlist locking
Kristof Provost [Fri, 21 May 2021 12:26:49 +0000 (14:26 +0200)]
dummynet: Fix schedlist and aqmlist locking

These are global (i.e. shared across vnets) structures, so we need
global lock to protect them.  However, we look up entries in these lists
(find_aqm_type(), find_sched_type()) and return them. We must ensure
that the returned structures cannot go away while we are using them.

Resolve this by using NET_EPOCH(). The structures can be safely accessed
under it, and we postpone their cleanup until we're sure they're no
longer used.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30381

3 years agoVNETify dummynet
Tom Jones [Sat, 15 May 2021 12:36:45 +0000 (14:36 +0200)]
VNETify dummynet

This moves dn_cfg and other parameters into per VNET variables.

The taskqueue and control state remains global.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D29274

3 years agostress2: Remove thr_new() from the ignore list after 6cda62755612
Peter Holm [Thu, 3 Jun 2021 05:23:01 +0000 (07:23 +0200)]
stress2: Remove thr_new() from the ignore list after 6cda62755612

3 years agobsdinstall: Fix typo (Instalation -> Installation).
Navdeep Parhar [Thu, 3 Jun 2021 04:43:14 +0000 (21:43 -0700)]
bsdinstall: Fix typo (Instalation -> Installation).

3 years agommc-fdt: fix mmc_fdt_gpio_get_{present,readonly}
Priit Trees [Wed, 31 Mar 2021 20:15:31 +0000 (20:15 +0000)]
mmc-fdt: fix mmc_fdt_gpio_get_{present,readonly}

Currently, mmc_fdt_gpio_get_{present,readonly} return all time true.
true   ^ 100b = true
false  ^ 100b = true
since that's done after promotion to integers. Use !! to convert
the bit to a bool before xor.

Reviewed by: imp@ (converted to (bool) to !! for portability)
Pull Request: https://github.com/freebsd/freebsd-src/pull/461

3 years agoCorrecting comment about "sched_interact_score".
wiklam [Tue, 19 May 2020 01:55:08 +0000 (03:55 +0200)]
Correcting comment about "sched_interact_score".

Reviewed by: jrtc@, imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/431

Sponsored by: Netflix

3 years agoCirrus-CI: retry pkg installation on failure
Ed Maste [Wed, 2 Jun 2021 14:42:57 +0000 (10:42 -0400)]
Cirrus-CI: retry pkg installation on failure

Pkg installation failed somewhat frequently, always at:

[62/104] Fetching jpeg-turbo-2.0.6.txz: .......... done
pkg: http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/quarterly/All/jbigkit-2.1_1.txz: No route to host

Move pkg installation to a script and retry once upon failure as a
(hopefully temporary) workaround.

Reviewed by: imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30613

3 years agofsck_ufs: fix segfault with gjournal
Robert Wing [Thu, 3 Jun 2021 01:41:31 +0000 (17:41 -0800)]
fsck_ufs: fix segfault with gjournal

The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c) while
attempting to traverse the buffer cache. The tail queue used for the
buffer cache was not initialized before dropping into gjournal_check().

Initialize the buffer cache before calling gjournal_check().

PR:             245907
Reviewed by:    jhb, mckusick
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D30537

3 years agommc: ignore CRC errors from CMD13 (status) when changing rates
Austin Shafer [Thu, 3 Jun 2021 01:46:23 +0000 (19:46 -0600)]
mmc: ignore CRC errors from CMD13 (status) when changing rates

Update mmc_switch_status to ignore a few CRC errrors when asking for the
card status after setting the new rate with CMD6. Since the card may
take a little while to make the switch, it's possible we'll get a
communications error if we sent the command at the wrong time. Several
low end laptops needs this workaround as they have a window that seems
longer than other systems. This is known to fix at least the Acer Aspire
A114-32-P7E5.

Reviewed by: imp@, manu@
Differential Revision: https://reviews.freebsd.org/D24740

3 years agowpa: Fix a SIGBUS error in wpa_sm_set_rekey_offload
Cy Schubert [Wed, 2 Jun 2021 19:46:02 +0000 (12:46 -0700)]
wpa: Fix a SIGBUS error in wpa_sm_set_rekey_offload

Incorrectly linked built-in wpa functions resulted in overwriting
sm->ctx->set_rekey_offload with garbage. It was initialized correctly
however it changed after wpa_supplicant became a daemon.

No SIGBUS violations reported by dhw@ were experienced during testing
of the original commit by msyelf or philip@.

Reported by: dhw
Tested by: dhw
MFC after: 2 months
X-MFC with: 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3

3 years agolibradius: fix no SSL build
Cy Schubert [Wed, 2 Jun 2021 18:31:00 +0000 (11:31 -0700)]
libradius: fix no SSL build

int alen is only used with SSL.

3 years agoCirrus-CI: Add descriptive task name
Ed Maste [Wed, 2 Jun 2021 15:31:48 +0000 (11:31 -0400)]
Cirrus-CI: Add descriptive task name

Previously it appeared only as "main" in places like GitHub's list
of checks run as part of a pull request.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agohptrr: use BLOB_OBJS for pre-built .o's
Jung-uk Kim [Wed, 2 Jun 2021 23:07:38 +0000 (19:07 -0400)]
hptrr: use BLOB_OBJS for pre-built .o's

3 years agortld: Rename -t option to -u (ignore LD_ vars)
Konstantin Belousov [Wed, 2 Jun 2021 22:50:49 +0000 (01:50 +0300)]
rtld: Rename -t option to -u (ignore LD_ vars)

Requested by: arichardson
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agonfsd: Fix the failure return for non-fh NFSv4 operations
Rick Macklem [Wed, 2 Jun 2021 22:28:07 +0000 (15:28 -0700)]
nfsd: Fix the failure return for non-fh NFSv4 operations

Without this patch, nfsd_checkrootexp() returns failure
and then the NFSv4 operation would reply NFSERR_WRONGSEC.
RFC5661 Sec. 2.6 only allows a few NFSv4 operations, none
of which call nfsv4_checktootexp(), to return NFSERR_WRONGSEC.
This patch modifies nfsd_checkrootexp() to return the
error instead of a boolean and sets the returned error to an RPC
layer AUTH_ERR, as discussed on nfsv4@ietf.org.
The patch also fixes nfsd_errmap() so that the pseudo
error NFSERR_AUTHERR is handled correctly such that an RPC layer
AUTH_ERR is replied to the NFSv4 client.

The two new "enum auth_stat" values have not yet been assigned
by IANA, but are the expected next two values.

The effect on extant NFSv4 clients of this change appears
limited to reporting a different failure error when a
mount that does not use adequate security is attempted.

MFC after: 2 weeks

3 years agogconcat: Add new lock to allow modifications to the disk list in preparation for...
Noah Bergbauer [Sun, 27 Dec 2020 21:04:45 +0000 (22:04 +0100)]
gconcat: Add new lock to allow modifications to the disk list in preparation for online append

In addition, rename existing sc_lock to sc_append_lock

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/447
Sponsored by: Netflix

3 years agogconcat: Switch array to TAILQ to prepare for online append
Noah Bergbauer [Sun, 27 Dec 2020 21:01:37 +0000 (22:01 +0100)]
gconcat: Switch array to TAILQ to prepare for online append

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/447
Sponsored by: Netflix

3 years agosbin/veriexec: fixed parameter parsing of option -x
sebastien.bini [Tue, 20 Oct 2020 14:52:16 +0000 (16:52 +0200)]
sbin/veriexec: fixed parameter parsing of option -x

The -x parameter doesn't take any arguments. It says that all further
arguments are paths to check.

Reviewed by: imp@
Sponsored by: Netflix
Pull Request: https://github.com/freebsd/freebsd-src/pull/443/files

3 years agopowerpc: fix boot on pseries without hugepages
Leandro Lupori [Wed, 2 Jun 2021 19:10:57 +0000 (16:10 -0300)]
powerpc: fix boot on pseries without hugepages

Commit 49c894ddced5 introduced an issue that prevented pseries boot,
when hugepages were not available to the guest. Now large page
info must be available before moea64_install is called, so this change
moves the code that scans large page sizes before the call.

Reviewed by: jhibbits (IRC)
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)

3 years agoregen after tweaks to getgroups and setgroups
Warner Losh [Wed, 2 Jun 2021 18:06:13 +0000 (12:06 -0600)]
regen after tweaks to getgroups and setgroups

Sponsored by: Netflix

3 years agot_getgroups: No longer expected to fail
Warner Losh [Wed, 2 Jun 2021 18:02:56 +0000 (12:02 -0600)]
t_getgroups: No longer expected to fail

Sponsored by: Netflix

3 years agokern: fail getgroup and setgroup with negative int
Moritz Buhl [Tue, 9 Jul 2019 15:03:37 +0000 (17:03 +0200)]
kern: fail getgroup and setgroup with negative int

Found using
https://github.com/NetBSD/src/blob/trunk/tests/lib/libc/sys/t_getgroups.c

getgroups/setgroups want an int and therefore casting it to u_int
resulted in `getgroups(-1, ...)` not returning -1 / errno = EINVAL.

imp@ updated syscall.master and made changes markj@ suggested

PR: 189941
Tested by: imp@
Reviewed by: markj@
Pull Request: https://github.com/freebsd/freebsd-src/pull/407
Differential Revision: https://reviews.freebsd.org/D30617

3 years agoAdd bcm2710-rpi-cm3.dtb to the list of DTBs being added.
Max Stucchi [Mon, 25 Jan 2021 13:07:19 +0000 (14:07 +0100)]
Add bcm2710-rpi-cm3.dtb to the list of DTBs being added.

This allows to boot out of the box on the RPI COmpute Module 3 with 32G
of eMMC.

Tested by: imp confirmed .dtb is in the rpi-firmware pkg
Reviewed by: gjb@, imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/452

Sponsored by: Netflix

3 years agoAllows user to specify an optional ZFSBOOT_POOL_SIZE for their zroot
John Ko [Wed, 2 Jun 2021 17:12:14 +0000 (11:12 -0600)]
Allows user to specify an optional ZFSBOOT_POOL_SIZE for their zroot

The default is to create a zroot that consumes the whole disk because if
used with geli(8) this makes sense.

Without geli(8), I like to keep my data pool separate from my system
pool.

This is different than ZFSBOOT_BOOT_POOL_SIZE which is named bootpool.

Reviewed by: allenjude
Pull Request: https://github.com/freebsd/freebsd-src/pull/53
Differential Revision: https://reviews.freebsd.org/D30588

3 years agohptnr: use BLOB_OBJS for pre-built .o's
Warner Losh [Wed, 2 Jun 2021 16:35:26 +0000 (10:35 -0600)]
hptnr: use BLOB_OBJS for pre-built .o's

Sponsored by: Netflix

3 years agohptmv: use BLOB_OBJS for pre-built .o's
Warner Losh [Wed, 2 Jun 2021 16:35:21 +0000 (10:35 -0600)]
hptmv: use BLOB_OBJS for pre-built .o's

Sponsored by: Netflix

3 years agohpt27xx: Use EXTRA_OBJS instead of OBJS
Warner Losh [Wed, 2 Jun 2021 16:35:12 +0000 (10:35 -0600)]
hpt27xx: Use EXTRA_OBJS instead of OBJS

Sponsored by: Netflix
Reviewed by: emaste@
Differential Revision: https://reviews.freebsd.org/D30616

3 years agokmod.mk: Allow extra objects to be specified in modules
Warner Losh [Wed, 2 Jun 2021 16:35:01 +0000 (10:35 -0600)]
kmod.mk: Allow extra objects to be specified in modules

OBJS are automatically added to CLEANFILES. For pre-built objects, this
is not desirable since it will delete the object from the source
tree. Introduce EXTRA_OBJS which list these object files, but aren't
added to clean files.

Sponsored by: Netflix
Reviewed by: emaste@
Differential Revision: https://reviews.freebsd.org/D30615

3 years agoperiodic: add support for .xz and .zcat compressed logs
Ceri Davies [Wed, 2 Jun 2021 16:28:28 +0000 (17:28 +0100)]
periodic: add support for .xz and .zcat compressed logs

Also improve temporary file usage in 200.accounting, add an xref to
zstd(1) to newsyslog.conf.5, and clarify in periodic.conf that
"daily accounting" means process accounting and "monthly accounting"
is login accounting.

PR: 253868
Reviewed by: allanjude
Approved by: blackend (mentor)
Differential Revision: https://reviews.freebsd.org/D29267

3 years agokqueue: replace kq_ncallouts loop with atomic_fetchadd
Mateusz Guzik [Wed, 2 Jun 2021 15:14:58 +0000 (15:14 +0000)]
kqueue: replace kq_ncallouts loop with atomic_fetchadd

3 years agovfs: fix MNT_SYNCHRONOUS check in vn_write
Rich Ercolani [Wed, 2 Jun 2021 13:00:29 +0000 (13:00 +0000)]
vfs: fix MNT_SYNCHRONOUS check in vn_write

ca1ce50b2b5ef11d ("vfs: add more safety against concurrent forced
unmount to vn_write") has a side effect of only checking MNT_SYNCHRONOUS
if O_FSYNC is set.

Reviewed By: mjg
Differential Revision: https://reviews.freebsd.org/D30610

3 years agoFix the KCSAN_ENABLED check when building modules
Andrew Turner [Wed, 2 Jun 2021 10:07:55 +0000 (10:07 +0000)]
Fix the KCSAN_ENABLED check when building modules

The KCSAN_ENABLED variable is non-empty when the kernel is being built
with KCSAN. This allows us to disable modules that are known to be
broken.

There was a bug where we would check if it was defined. As this is
always the case the KCSAN_ENABLED variable would be set when building
modules so we would never build such a module. Fix this by checking
if the value is empty before passing it on to the module stage.

This doesn't affect how modules are built as the CFLAGS passed to
modules has the correct check.

Reported by: rstone
Sponsored by: Innovate UK

3 years agoUse the arm virtual counter in the arm64 loader
Andrew Turner [Wed, 12 May 2021 07:45:09 +0000 (07:45 +0000)]
Use the arm virtual counter in the arm64 loader

It exist on all ARMv8+ CPUs, and other boot loaders rely on it being
present.

Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D30410

3 years agoarm: allwinner: Add clock driver for Display Engine to the build
Emmanuel Vadot [Wed, 2 Jun 2021 08:17:16 +0000 (10:17 +0200)]
arm: allwinner: Add clock driver for Display Engine to the build

This is needed for drm

3 years agosdhci_xenon: add UHS support
Marcin Wojtas [Tue, 4 May 2021 23:47:37 +0000 (01:47 +0200)]
sdhci_xenon: add UHS support

This patch adds the necessary methods resolution to the sdhci_xenon
driver which are required to configure UHS modes for SD/MMC devices.
Apart from the two generic routines, the custom sdhci_xenon_set_uhs_timing
function is responsible for setting the SDHCI_HOST_CONTROL2 register
with appropriate mode select values - in case of HS200 and HS400
they are non-standard.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30565
MFC after: 2 weeks

3 years agosdhci_xenon: improve the VCCQ voltage switch sequence
Marcin Wojtas [Thu, 27 May 2021 18:39:12 +0000 (20:39 +0200)]
sdhci_xenon: improve the VCCQ voltage switch sequence

Improve the VCCQ voltage switch, so that to properly
handle the SDHCI_HOST_CONTROL2 register signaling
flags and along with manipulating the regulator.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30564
MFC after: 2 weeks

3 years agosdhci_xenon: allow to properly disable the UHS signaling
Marcin Wojtas [Thu, 27 May 2021 17:48:17 +0000 (19:48 +0200)]
sdhci_xenon: allow to properly disable the UHS signaling

Until now the "no-1-8-v" DT flag wrongly disabled the SDHCI_CAN_VDD_180
- slot 1.8V power supply capability, whereas it refers to the signaling
voltage. Fix the sdhci_xenon_read_4 and allow to disable the UHS modes
depending on the DT property or PHY slow mode. While at it - make sure
the unsupported 1.2V signaling is always disabled and not reported
in the bootverbose log.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30563
MFC after: 2 weeks

3 years agosdhci_xenon: enable MMC FDT parsing
Marcin Wojtas [Sat, 1 May 2021 07:55:06 +0000 (09:55 +0200)]
sdhci_xenon: enable MMC FDT parsing

The mmc_fdt_parse allows to parse more MMC-related
FDT properties. Start using it. "wp-inverted" property,
VQMMC and newly added VMMC power supply parsing
is now done in a generic code.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30562
MFC after: 2 weeks

3 years agosdhci: allow setting MMC capabilities before sdhci_init_slot
Marcin Wojtas [Tue, 4 May 2021 22:57:50 +0000 (00:57 +0200)]
sdhci: allow setting MMC capabilities before sdhci_init_slot

With this change the host controller drivers can set the MMC capabilities
(e.g. using mmc_fdt_parse() helper) before calling sdhci_init_slot().
This way the configuration dump (eg. in bootverbose) can include the
possible additional information.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30561
MFC after: 2 weeks

3 years agosdhci: extend bus_dma_tag boundary to 64-bit space
Marcin Wojtas [Wed, 28 Apr 2021 08:55:40 +0000 (10:55 +0200)]
sdhci: extend bus_dma_tag boundary to 64-bit space

This patch adds support for the SDHCI_CAN_DO_64BIT
capability, so that to allow 64-bit DMA operation
for the controllers which support this feature.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30560
MFC after: 2 weeks

3 years agouart_dev_ns8250: Switch ACPI UART subtype for Marvell SoCs
Marcin Wojtas [Thu, 20 May 2021 21:37:02 +0000 (23:37 +0200)]
uart_dev_ns8250: Switch ACPI UART subtype for Marvell SoCs

DBG2 ACPI table description [1] specifies three subtypes
related to 16550 UART:
0x0 - 16550 compatible
0x1 - 16550 subset
0x12 - 16550 compatible with parameters defined in Generic Address Structure (GAS)

It turned out however, that the Windows OS treats 0x0 subtype as
legacy x86 UART with 8-bit access. ARM SoCs can use types 0x1 (16550 with
fixed mmio32 access) or 0x12 (16550 with fully respected GAS contents).

Switch Marvell SoCs ACPI UART subtype to 0x1 - thanks to that the same firmware
can run properly with UART output in FreeBSD, Windows 10, Linux and ESXI
hypervisor. Tests showed the older firmware versions that use 0x0
UART subtype in SPCR table continue to display output properly.

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table

Obtained from: Semihalf
Sponsored by: ARM
Differential revision: https://reviews.freebsd.org/D30386
MFC after: 2 weeks

3 years agoFix test case header function name
Math Ieu [Wed, 2 Jun 2021 04:09:55 +0000 (12:09 +0800)]
Fix test case header function name

This restores the expected behavior (skip) when running with non-root user

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

3 years agokern: ether_gen_addr: randomize on default hostuuid, too
Kyle Evans [Fri, 16 Apr 2021 01:11:35 +0000 (20:11 -0500)]
kern: ether_gen_addr: randomize on default hostuuid, too

Currently, this will still hash the default (all zero) hostuuid and
potentially arrive at a MAC address that has a high chance of collision
if another interface of the same name appears in the same broadcast
domain on another host without a hostuuid, e.g., some virtual machine
setups.

Instead of using the default hostuuid, just treat it as a failure and
generate a random LA unicast MAC address.

Reviewed by: bz, gbe, imp, kbowling, kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29788

3 years agoman: document ether_gen_addr(9)
Kyle Evans [Fri, 16 Apr 2021 01:08:27 +0000 (20:08 -0500)]
man: document ether_gen_addr(9)

This KPI is used to assign a MAC address to an interface that doesn't
already have one assigned.

Reviewed by: bcr, gnn, imp, kbowling, kp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29787

3 years agoamd64: Clear the local TSS when creating a new thread
Mark Johnston [Tue, 1 Jun 2021 23:38:22 +0000 (19:38 -0400)]
amd64: Clear the local TSS when creating a new thread

Otherwise it is copied from the creating thread.  Then, if either thread
exits, the other is left with a dangling pointer, typically resulting in
a page fault upon the next context switch.

Reported by: syzkaller
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30607

3 years agoamd64: Relax the assertion added in commit 4a59cbc12
Mark Johnston [Tue, 1 Jun 2021 23:38:09 +0000 (19:38 -0400)]
amd64: Relax the assertion added in commit 4a59cbc12

We only need to ensure that interrupts are disabled when handling a
fault from iret.  Otherwise it's possible to trigger the assertion
legitimately, e.g., by copying in from an invalid address.

Fixes: 4a59cbc12
Reported by: pho
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30594

3 years agopf: Avoid leaking pad bytes in struct pfr_astats when copying out
Mark Johnston [Tue, 1 Jun 2021 14:56:23 +0000 (10:56 -0400)]
pf: Avoid leaking pad bytes in struct pfr_astats when copying out

There is padding between pfr_astats.pfras_a and pfras_packets that was
not getting initialized.

Reported by: KMSAN
Reviewed by: kp, imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30585

3 years agoi386: Make setidt_disp a size_t instead of uintptr_t
Mark Johnston [Tue, 1 Jun 2021 14:28:57 +0000 (10:28 -0400)]
i386: Make setidt_disp a size_t instead of uintptr_t

setidt_disp is the offset of the ISR trampoline relative to the address
of the routines in exception.s, so uintptr_t is not quite right.

Also remove a bogus declaration I added in commit 18f55c67f7, it is not
required after all.

Reported by: jrtc27
Reviewed by: jrtc27, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30590

3 years agocxgbe/iw_cxgbe: Support for 512 SGL entries in one memory registration.
Navdeep Parhar [Tue, 1 Jun 2021 19:57:53 +0000 (12:57 -0700)]
cxgbe/iw_cxgbe: Support for 512 SGL entries in one memory registration.

Use the correct SGL limit within iw_cxgbe, firmwares >= 1.25.6.0 support
upto 512 entries per MR.

Obtained from: Chelsio Communications
MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agocxgbe(4): Check if the firmware supports 512 SGL per FR MR.
Navdeep Parhar [Tue, 1 Jun 2021 19:14:17 +0000 (12:14 -0700)]
cxgbe(4): Check if the firmware supports 512 SGL per FR MR.

Firmwares >= 1.25.6.0 support 512 SGL entries in a single memory
registration request.

Obtained from: Chelsio Communications
MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agofread: improve performance for unbuffered reads
Pedro F. Giffuni [Mon, 31 May 2021 01:48:38 +0000 (20:48 -0500)]
fread: improve performance for unbuffered reads

We can use the buffer passed to fread(3) directly in the FILE *.
The buffer needs to be reset before each call to __srefill().
This preserves the expected behavior in all cases.

The change was found originally in OpenBSD and later adopted by NetBSD.

MFC after: 2 weeks
Obtained from: OpenBSD (CVS 1.18)

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

3 years agopf: Fix more ioctl memory leaks
Kristof Provost [Tue, 1 Jun 2021 14:05:47 +0000 (16:05 +0200)]
pf: Fix more ioctl memory leaks

We must also remember to free nvlists added to a parent nvlist with
nvlist_append_nvlist_array().

More importantly, when nvlist_pack() allocates memory for us it does so
in the M_NVLIST zone, so we must free it with free(.., M_NVLIST). Using
free(.., M_TEMP) as we did silently failed to free the memory.

MFC after: 3 days
Reported by: kib@
Tested by: kib@
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30595

3 years agolibsa: Fix infinite loop in bzipfs & gzipfs
David Bright [Mon, 24 May 2021 17:12:15 +0000 (12:12 -0500)]
libsa: Fix infinite loop in bzipfs & gzipfs

A bug in the loader's bzipfs & gzipfs filesystems caused compressed
kernel and modules not to work on EFI systems with a veriexec-enabled
loader. Since the size of files in these filesystems are not known
_a priori_ `stat` would initialize the size to -1 and the loader would
then hang in an infinite loop while trying to seek (read) to the end
of file since the loop termination condition compares the current
offset to that negative target position.

Reviewers: vangyzen, imp, Bret Ketchum (Bret.Ketchum@dell.com)
Differential Revision: https://reviews.freebsd.org/D30414
Sponsored by: Dell EMC Isilon
MFC to:      stable/12, stable/13
MFC after:   1 week

3 years agolibexec/getty/ttys.5: document correct "dialup" flag.
Ceri Davies [Tue, 1 Jun 2021 15:59:15 +0000 (16:59 +0100)]
libexec/getty/ttys.5: document correct "dialup" flag.

This manpage has incorrectly documented the "dialup"
keyword as "dialin" since it was first added.  Correct that.

Approved by: blackend (mentor)
MFC after: 12 days

3 years agopciconf: Fix up pciconf -lc output
David Bright [Mon, 24 May 2021 19:02:43 +0000 (14:02 -0500)]
pciconf: Fix up pciconf -lc output

The pciconf command fails to emit newlines when particular ecap field
values are seen. Fix them up. This has been seen on several systems at
$JOB. The documentation for PCI capabilities says that capability
type 0 should not be used once the spec for PCI capabilities was
published, but that seems more wishful-thinking than reality. pciconf
also chooses not to print fields related to field values that are
zero, but it seems several of these fields are zero on actual
hardware.

Reviewed by: vangyzen, imp, Bret Ketchum (Bret.Ketchum@dell.com)
Sponsored by: Dell EMC Isilon
Submitted by: Robert Herndon (Robert.Herndon@dell.com)
Differential Revision: https://reviews.freebsd.org/D30441

3 years agoktrace: Fix an inverted comparison added in commit f3851b235
Mark Johnston [Tue, 1 Jun 2021 13:15:35 +0000 (09:15 -0400)]
ktrace: Fix an inverted comparison added in commit f3851b235

Fixes: f3851b235 ("ktrace: Fix a race with fork()")
Reported by: dchagin, phk

3 years agolinux: export AT_HWCAP and AT_HWCAP2 on aarch64
Edward Tomasz Napierala [Tue, 1 Jun 2021 12:12:25 +0000 (13:12 +0100)]
linux: export AT_HWCAP and AT_HWCAP2 on aarch64

The flag values seem to be the same between Linux and FreeBSD.
Comparing to a Linux VM on the same hardware, we're missing
HWCAP_EVTSTRM, HWCAP_CPUID, HWCAP_DCPOP, HWCAP_USCAT, HWCAP_PACA,
and HWCAP_PACG.

Reviewed By: mhorne, emaste
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30540

3 years agopf: Move provider declaration to pf.h
Kristof Provost [Mon, 31 May 2021 16:34:37 +0000 (18:34 +0200)]
pf: Move provider declaration to pf.h

This simplifies life a bit, by not requiring us to repease the
declaration for every file where we want static probe points.

It also makes the gcc6 build happy.

3 years agoAdd freeze/thaw description to devctl(8)
Li-Wen Hsu [Tue, 1 Jun 2021 04:33:12 +0000 (12:33 +0800)]
Add freeze/thaw description to devctl(8)

This is a follow-up to 5fa29797910346fc0c54829bd979856e83b9b7ea .

PR: 256311
Reviewed by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29867

3 years agonfsd: Delete extraneous NFSv4 root checks
Rick Macklem [Tue, 1 Jun 2021 02:41:17 +0000 (19:41 -0700)]
nfsd: Delete extraneous NFSv4 root checks

There are several NFSv4.1/4.2 server operation functions which
have unneeded checks for the NFSv4 root being set up.
The checks are not needed because the operations always follow
a Sequence operation, which performs the check.

This patch deletes these checks, simplifying the code so
that a future patch that fixes the checks to conform with
RFC5661 Sec. 2.6 will be less extension.

MFC after: 2 weeks

3 years agowpa: Restructure wpa build
Cy Schubert [Thu, 20 May 2021 21:28:17 +0000 (14:28 -0700)]
wpa: Restructure wpa build

The current WPA build assumes a flat namespace. However the latest sources
from w1.fi now have a duplicate config.c, in two separate subdirectories.
The flat namespace will overwrite config.o with the output from the most
recently modified config.c, of which there are two of them.

This commit resolves this problem by building each component in
wpa's src subdirectory tree into its own .a archive, just as the w1.fi
upstream build as used by the port does. The advantages of this approach
are:

1. Duplicate source file names, i.e. config.c in the wpa_supplicant
   direcory and another config.c in src/utils in the next wpa
   will result in both compiles writing to the same .o file.

2. This restructure simplifies maintanence. A develper needs only to add
   new files as identified by git status in the vendor branch to the
   appropriate Makefile within the usr.sbin/wpa tree. This also reduces
   time required to prepare a new import and should reduce error.

3. The new wpa build structure more closely represents the build as
   performed by the upstream tarball.

This is in preparation for the next wpa update from w1.fi.

Reviewed by: philip
Tested by: philip
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D30372

3 years agotmpfs: save on relocking the allnode lock in tmpfs_free_node_locked
Mateusz Guzik [Thu, 27 May 2021 08:57:59 +0000 (10:57 +0200)]
tmpfs: save on relocking the allnode lock in tmpfs_free_node_locked

3 years agoffs: Correct the input size check in sysctl_ffs_fsck()
Mark Johnston [Mon, 31 May 2021 22:56:34 +0000 (18:56 -0400)]
ffs: Correct the input size check in sysctl_ffs_fsck()

Make sure we return an error if no input was specified, since
SYSCTL_IN() will report success in that case.

Reported by: KMSAN
Reviewed by: mckusick
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30586

3 years agotcp, udp: Permit binding with AF_UNSPEC if the address is INADDR_ANY
Mark Johnston [Mon, 31 May 2021 22:53:34 +0000 (18:53 -0400)]
tcp, udp: Permit binding with AF_UNSPEC if the address is INADDR_ANY

Prior to commit f161d294b we only checked the sockaddr length, but now
we verify the address family as well.  This breaks at least ttcp.  Relax
the check to avoid breaking compatibility too much: permit AF_UNSPEC if
the address is INADDR_ANY.

Fixes: f161d294b
Reported by: Bakul Shah <bakul@iitbombay.org>
Reviewed by: tuexen
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30539

3 years agox86: Fix lapic_ipi_alloc() on i386
Mark Johnston [Mon, 31 May 2021 22:51:14 +0000 (18:51 -0400)]
x86: Fix lapic_ipi_alloc() on i386

The loop which checks to see if "dynamic" IDT entries are allocated
needs to compare with the trampoline address of the reserved ISR.
Otherwise it will never succeed.

Reported by: Harry Schmalzbauer <freebsd@omnilan.de>
Tested by: Harry Schmalzbauer <freebsd@omnilan.de>
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30576

3 years agoamd64: Avoid enabling interrupts when handling kernel mode prot faults
Mark Johnston [Mon, 31 May 2021 22:49:33 +0000 (18:49 -0400)]
amd64: Avoid enabling interrupts when handling kernel mode prot faults

When PTI is enabled, we may have been on the trampoline stack when iret
faults.  So, we have to switch back to the regular stack before
re-entering trap().

trap() has the somewhat strange behaviour of re-enabling interrupts when
handling certain kernel-mode execeptions.  In particular, it was doing
this for exceptions raised during execution of iret.  When switching
away from the trampoline stack, however, the thread must not be migrated
to a different CPU.  Fix the problem by simply leaving interrupts
disabled during the window.

Reported by: syzbot+6cfa544fd86ad4647ffc@syzkaller.appspotmail.com
Reported by: syzbot+cfdfc9e5a8f28f11a7f5@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30578

3 years agoFix confusing example in paste(1)
jocki84 [Thu, 12 Jul 2018 17:22:29 +0000 (19:22 +0200)]
Fix confusing example in paste(1)

Paste's man page contains an example for a reimplementation of
nl(1). This example uses the command line
    sed = myfile | paste -s -d '\t\n' - -
in order to concatenate consecutive lines with an intervening tab.

However, the way the example uses the switches -s and -d and two `dash`
input files is redundant. There are in fact two equivalent but simpler
ways to achieve the desired result:
    sed = myfile | paste -s -d '\t\n' -
uses the same style as the previous example, while
    sed = myfile | paste - -
is arguably even simpler and illustrates the final sentence of the
DESCRIPTION.

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

3 years agoRemove duplicated lines in contrib/tzcode/stdtime/private.h
Tim McNamara [Thu, 7 Jun 2018 09:51:38 +0000 (21:51 +1200)]
Remove duplicated lines in contrib/tzcode/stdtime/private.h

Note by imp: this is clearly a mis-merge from the vendor branch which
doesn't have this stutter in it.

Reviewed by: imp@,ngie@
Pull Request: https://github.com/freebsd/freebsd-src/pull/154

3 years agolibpmc: make libpmc_pmu_utils.c more amenable to porting
Mitchell Horne [Mon, 31 May 2021 14:24:44 +0000 (11:24 -0300)]
libpmc: make libpmc_pmu_utils.c more amenable to porting

The current version has every function stubbed out for !x86. Only two
functions (pmu_alias_get() and pmc_pmu_pmcallocate() are really platform
dependent, so reduce the width of the ifdefs and remove some of the
stubs.

Reviewed by: ray
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30532

3 years agolibpmc: limit pmu-events to 64-bit powerpc
Mitchell Horne [Mon, 31 May 2021 20:24:15 +0000 (17:24 -0300)]
libpmc: limit pmu-events to 64-bit powerpc

Although currently unused, there are only pmu event definitions for
POWER8 and POWER9. There is no sense in building these on 32-bit
platforms.

Sponsored by: The FreeBSD Foundation

3 years agolibpmc: use $MACHINE_CPUARCH
Mitchell Horne [Mon, 31 May 2021 20:20:08 +0000 (17:20 -0300)]
libpmc: use $MACHINE_CPUARCH

This is preferred over $MACHINE_ARCH for these types of checks, although
it makes no difference for amd64 or i386. No functional change intended.

Sponsored by: The FreeBSD Foundation

3 years agolibpmc: always generate libpmc_events.c
Mitchell Horne [Mon, 31 May 2021 14:24:04 +0000 (11:24 -0300)]
libpmc: always generate libpmc_events.c

The jevents build tool will create an empty table if it doesn't find any
events, so we can remove the extra $MACHINE_CPUARCH checks.

Reviewed by: gnn, ray, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30531

3 years agolibpmc: remove pe->alias
Mitchell Horne [Mon, 31 May 2021 14:23:19 +0000 (11:23 -0300)]
libpmc: remove pe->alias

It has never been a part of upstream's struct pmu_event. The jevents
utility will not fill this field, so remove it.

Reviewed by: gnn
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30530

3 years agolibpmc: eliminate pmc_pmu_stat_mode()
Mitchell Horne [Mon, 31 May 2021 14:21:57 +0000 (11:21 -0300)]
libpmc: eliminate pmc_pmu_stat_mode()

There is a single consumer, the pmc utility, that clearly has knowledge
of which counters it is expecting. Remove this function and have it
use common counter aliases instead.

Reviewed by: gnn
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30528

3 years agopmccontrol: improve -L with pmu-events
Mitchell Horne [Mon, 31 May 2021 14:14:36 +0000 (11:14 -0300)]
pmccontrol: improve -L with pmu-events

Check if the pmu utils are supported rather than carrying a
machine-dependent #ifdef.

Reviewed by: gnn, ray, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30526

3 years agolibpmc: remove unused 'isfixed' variable
Mitchell Horne [Mon, 31 May 2021 14:22:30 +0000 (11:22 -0300)]
libpmc: remove unused 'isfixed' variable

Reviewed by: gnn, emaste
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30529

3 years agolibpmc: fix "instructions" alias on Intel
Mitchell Horne [Mon, 31 May 2021 14:16:16 +0000 (11:16 -0300)]
libpmc: fix "instructions" alias on Intel

The typo prevents the counter from being allocated.

This fixes e.g. pmcstat -s instructions sleep 5

Reviewed by: mizhka, gnn, ray, emaste
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30527

3 years agothread_reap_barrier(): remove unused variable
Konstantin Belousov [Mon, 31 May 2021 20:02:00 +0000 (23:02 +0300)]
thread_reap_barrier(): remove unused variable

Noted by: alc
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week

3 years agolinux(4): Microoptimize futimesat, utimes, utime.
Dmitry Chagin [Mon, 31 May 2021 19:54:18 +0000 (22:54 +0300)]
linux(4): Microoptimize futimesat, utimes, utime.
While here wrap long line.

Differential Revision: https://reviews.freebsd.org/D30488
MFC after: 2 weeks

3 years agolinux(4): Handle AT_EMPTY_PATH in the utimensat syscall.
Dmitry Chagin [Mon, 31 May 2021 19:37:06 +0000 (22:37 +0300)]
linux(4): Handle AT_EMPTY_PATH in the utimensat syscall.

Differential Revision: https://reviews.freebsd.org/D30518
MFC after: 2 weeks

3 years agoiichid(4): disable interrupt on suspend
J.R. Oldroyd [Mon, 31 May 2021 19:33:07 +0000 (22:33 +0300)]
iichid(4): disable interrupt on suspend

Commit message of the identical change in Linux driver says:
"When an I2C HID device is powered off during system sleep, as a result
of removing its power resources (by the ACPI core) the interrupt line
might go low as well.  This results inadvertent interrupts."

This change fixes suspend/resume on Asus S510UQ laptops.

While here add a couple of typo fixes as well as a slight change to the
iichid_attach() code to have the power_on flag set properly.

Submitted by: J.R. Oldroyd <jr_AT_opal_DOT_com>
Reviewed by: wulf
MFC after: 1 week

3 years agoiwmbtfw(8): Improve Intel 7260/7265 adaptors handling
Vladimir Kondratyev [Mon, 31 May 2021 19:32:08 +0000 (22:32 +0300)]
iwmbtfw(8): Improve Intel 7260/7265 adaptors handling

- Allow firmware downloading for hw_variant #8;
- Enter manufacturer mode for setting of event mask;
- Handle multi-event response on HCI commands for 7260;
  This allows to remove kludge with skipping of 0xfc2f opcode.
- Disable patch and exit manufacturer mode on downloading failure;
- Use default firmware if correct firmware file is not found;

Reviewed by: Philippe Michaud-Boudreault <pitwuu_AT_gmail_DOT_com>
MFC after: 1 week
Tested by: arrowd
Differential revision: https://reviews.freebsd.org/D30543

3 years agolinux(4): Convert flags before use in utimensat.
Dmitry Chagin [Mon, 31 May 2021 19:30:37 +0000 (22:30 +0300)]
linux(4): Convert flags before use in utimensat.

Differential Revision: https://reviews.freebsd.org/D30487
MFC after: 2 weeks