vmm: Add an include to vmm_ktr.h for vm_name()
Required when KTR is configured.
Remove the pcpu.h include while here, as it seems to be unneeded.
Reported by: Jenkins
Fixes: 5f13d6b60740 ("vmm: Move common accessors and vm_eventinfo into sys/dev/vmm")
(cherry picked from commit 0aaa95ae02803ba0195c5da695ffbb17a79135bc)
malloc.9: adjust flag table indentation
The current indentation is shorter than all but one of these flags. This
renders much more nicely.
MFC after: 3 days
bcm2835_virtgpio: Add driver for virtual GPIO controller on some RPi models
This driver enables bcm2835-virtgpio GPIO controller found on RPi3B and
some CM boards. On which, the ACT (green) LED is connected to this
controller. It is essential for FreeBSD to have this driver to control
this LED.
It will be exposed via gpioled(4).
Reviewed by: mhorne
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D51456
Jail sysctls: deprecate generic sysctls in favour of allow-flags
- add a missing sysctl to the deprecated list
- add a comment to not add new generic sysctls and point to SYSCTL_JAIL_PARAM instead
Reviewed by: jamie
Differential Revision: https://reviews.freebsd.org/D51150
Makefile.inc1: Drop AS and RANLIB variables
These are not used in our world and kernel build targets. We use the
compiler driver for assembly, and ar adds the archive index (symbol
table) automatically.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55964
rss: make toeplitz.c standard part of the kernel
This will fix LINT-NOIP build. This actually adds very little to the
kernel text, e.g. 500 bytes on amd64. A perfect solution would be to
instead declare rss_config.c as 'optional inet | inet6', but that would
fail to build LINT-NOIP in several NIC drivers, that use RSS and
absolutely ignore that both INET and INET6 are optional. It is very
unlikely that vendors who maintain these drivers will will ever chase the
holy grail of a build that doesn't support IPv4 and IPv6.
Fixes: d9c55b2e8cd6b79f6926278e10a79f1bcca27a4b
sbuf: make assertion message a lot more useable
Saying that we are called with an (un)finished or corrupted sbuf
is like saying "error" (though [un]finished is an extra hint).
Add the pointer to the sbuf so one could easily check it,
add the flags we are checking so one could see quickly about
a possible state mismatch.
Given we already dereference the pointer in the KASSERT there is no
extra harm adding it to the message.
Found while: testing lindebugfs changes
Sponsored by: The FreeBSD Foundation
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D55919
(cherry picked from commit 2ce06d25431a6c96ef5719165cb73e138a0ed89c)
LinuxKPI: add supporting #includes
Compiling drm-kmod on !X86 does not include asm/smp.h which includes
preempt.h on FreeBSD. In order to compile drm-kmod on other
architectures add the secondary #includes for preempt.h to
spinlock.h and hardirq.h (which now also gets included from highmem.h)
to connect the #include chain.
Sponsored by: The FreeBSD Foundation
PR: 279864
Reviewed by: jhibbits, emaste
Differential Revision: https://reviews.freebsd.org/D55974
(cherry picked from commit 1d18872c2519d7ca726ddc49735180ab1d8916e0)
ath12k: update module Makefile after vendor import of v6.19
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 03ba27c194ca5937478502cb52a0eda8146f9be1)
ath11k: update module Makefile after vendor import of v6.19[-rc6]
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 09cacabd8ca0cc89c8d46b2f4c1dcdd6bb1e1cab)
vmm: Move common accessors and vm_eventinfo into sys/dev/vmm
Now that struct vm and struct vcpu are defined in headers, provide
inline accessors. We could just remove the accessors outright, but they
don't hurt and it would result in unneeded churn.
As a part of this, consolidate definitions related to struct
vm_eventinfo as well. I'm not sure if struct vm_eventinfo is really
needed anymore, now that vmmops_run implementations can directly access
vm and vcpu fields, but this can be resolved later.
No functional change intended.
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53586
(cherry picked from commit 5f13d6b60740c021951ae0e4d096903cfa1679e2)
vmm: Deduplicate VM and vCPU state management code
Now that the machine-independent fields of struct vm and struct vcpu are
available in a header, we can move lots of duplicated code into
sys/dev/vmm/vmm_vm.c. This change does exactly that.
No functional change intended.
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53585
(cherry picked from commit ed85203fb7a0334041db6da07e45ddda4caef13d)
divert: Use a better source identifier for netisr_queue_src() calls
These opaque IDs are used by netisr to distribute work among threads.
The mapping function is simply SourceID % numthreads, so using socket
addresses as source IDs isn't going to distribute packets well due to
alignment.
Use the divert socket's generation number instead, as that suits this
purpose much better.
Reviewed by: zlei, glebius
MFC after: 1 week
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D55537
(cherry picked from commit 5547a7bb39accd8f151b53e90b41d13b55f84c95)
nullfs: Fix handling of doomed vnodes in nullfs_unlink_lowervp()
nullfs_unlink_lowervp() is called with the lower vnode locked, so the
nullfs vnode is locked too. The following can occur:
1. the vunref() call decrements the usecount 2->1,
2. a different thread calls vrele() on the vnode, decrements the
usecount 0->1, then blocks on the vnode lock,
3. the first thread tests vp->v_usecount == 0 and observes that it is
true,
4. the first thread incorrectly unlocks the lower vnode.
Fix this by testing VN_IS_DOOMED directly. Since
nullfs_unlink_lowervp() holds the vnode lock, the value of the
VIRF_DOOMED flag is stable.
Thanks to leres@ for patiently helping to track this down.
PR: 288345
MFC after: 1 week
[4 lines not shown]
bhyve: Fix unchecked stream I/O in RFB handler
Convert rfb_send_* helpers to return status codes and check their
results. Add missing checks for stream_read() and stream_write() returns
during the handshake in rfb_handle() to avoid acting on failed I/O.
Signed-off-by: Hayzam Sherif <hayzam at gmail.com>
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55343
(cherry picked from commit 818971cc403e78d42b77eb6c18a2d2a073e5541f)
vmm: Consolidate vm and vcpu definitions
There is quite a lot of duplication of code between amd64, arm64 and
riscv with respect to VM and vCPU state management. This is a bit
tricky to resolve since struct vm and struct vcpu are private to vmm.c
and both structures contain a mix of machine-dependent and
machine-independent fields.
To allow deduplication without also introducing a lot of churn, follow
the approach of struct pcpu and 1) lift the definitions of those
structures into a new header, sys/dev/vmm/vmm_vm.h, and 2) define
machine-dependent macros, VMM_VM_MD_FIELDS and VMM_VCPU_MD_FIELDS which
lay out the machine-dependent fields.
One disadvantage of this approach is that the two structures are no
longer private to vmm.c, but I think this is acceptable.
No functional change intended. A follow-up change will move a good deal
of machine/vmm/vmm.c into sys/dev/vmm/vmm_vm.c.
[7 lines not shown]
buf: Relax an assertion in BUF_UNLOCK
The BUF_UNLOCK macro asserts that B_REMFREE is not set, as it is up to
the lock owner to complete the dequeue from the free list before
releasing the lock. However, if the thread has acquired the lock
multiple times, then releasing the recursive lock should be ok. Modify
the assertion to reflect this.
This was triggered by an out-of-tree filesystem.
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55418
(cherry picked from commit eaeb356ce3491f05b6a99ccd485180a42df22c46)
bhyve: Propagate errors from rfb_recv_* functions
Update rfb_recv_* functions to return -1 on failure and 0 on success.
Update rfb_handle to check these return values and drop the connection
if an error occurs.
Signed-off-by: Hayzam Sherif <hayzam at gmail.com>
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 757b0bf5cf46230bcbeeb298f734b9bb7cde1817)
OptionalObsoleteFiles: Don't mark /usr/lib/debug/boot directory obsolete
The intent of the currect code is to ignore anything under
/usr/lib/debug/boot/*. But we also should make sure that
/usr/lib/debug/boot directory is also ignored and is not marked
obsolete. If we don't do that, `make DBATCH_DELETE_OLD_FILES
delete-old` will try to rmdir(1) this directory, which will cause an
error, since /usr/lib/debug/boot may have nested directories like
kernel/ and modules/.
Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D55077
(cherry picked from commit c8191c3d613928d8bd6060aa2f7da349b4090cc1)
pipe: Avoid unnecessary priv_check() calls in pipespace_new()
Running out of pipe map KVA is a rare case, so reorder checks
accordingly, presuming that calling priv_check() is more expensive than
the calculation. In particular, priv_check() might not be cheap to
evaluate if MAC hooks are installed.
Reviewed by: olce, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D55378
(cherry picked from commit fa77660a3ccbd5f30e88093703b0f93892ef35d7)
sysctl: Avoid calling priv_check() unnecessarily
After commit 7d1d9cc440f80 we only serialize large sysctl requests for
non-root users, but we should avoid calling priv_check() unless the
request actually is large, as that's not the common case. In
particular, priv_check() might not be cheap to evaluate if MAC hooks are
installed.
Reviewed by: olce, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D55377
(cherry picked from commit 0fa6ce255661acc984a45deaf2d710149b957ce6)