Commit graph

150137 commits

Author SHA1 Message Date
Christos Margiolis
cccdc51d98 snd_uaudio: Remove unused sc_sndstat sbuf
This information is also printed to dmesg(8) on attach.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45771

(cherry picked from commit 3402d474ceb8541d07689bad6960f90739129997)
2024-07-10 18:48:12 +02:00
Christos Margiolis
c9d9975cd4 sound: Fix lock order reversals in mseq_open()
Opening /dev/sequencer after a clean reboot yields:

lock order reversal: (sleepable after non-sleepable)
 1st 0xfffffe004a2c2c08 seqflq (seqflq, sleep mutex) @ /mnt/src/sys/dev/sound/midi/sequencer.c:754
 2nd 0xffffffff84197ed8 midistat lock (midistat lock, sx) @ /mnt/src/sys/dev/sound/midi/midi.c:1478
lock order seqflq -> midistat lock attempted at:
0xffffffff811c9029 at witness_checkorder+0x12b9
0xffffffff810f18a7 at _sx_xlock+0xf7
0xffffffff8417f992 at midimapper_open+0x22
0xffffffff84182770 at mseq_open+0xf0
0xffffffff80e3380f at devfs_open+0x30f
0xffffffff81b8b4b7 at VOP_OPEN_APV+0x57
0xffffffff812da1e7 at vn_open_vnode+0x397
0xffffffff812d96b3 at vn_open_cred+0xb23
0xffffffff812c2c6b at openatfp+0x52b
0xffffffff812c2711 at sys_openat+0x81
0xffffffff84110579 at filemon_wrapper_openat+0x19
0xffffffff81a223ae at amd64_syscall+0x39e
0xffffffff819dd0eb at fast_syscall_common+0xf8

Expose midistat_lock to midi/midi.c so that we can acquire the lock from
mseq_open() before we lock seq_lock, and introduce _locked variants of
midimapper_open() and midimapper_fetch_synth().

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45770

(cherry picked from commit fc76e24e583d45a3a59fd7ad4e603c0679eaf572)
2024-07-10 18:48:12 +02:00
Christos Margiolis
de8161712e sound: Get rid of snd_sb16 workaround in vchan_create()
The snd_sb16 driver was removed in 716924cb48 ("Retire snd_sbc ISA
sound card driver").

While here, simplify sample rate assignment a bit.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D45662

(cherry picked from commit d6d4586b0b7e3b01812e6c26818af78bf9b680a3)
2024-07-10 18:48:12 +02:00
Christos Margiolis
6158fa24ac sound: SNDCTL_AUDIOINFO: Do not skip physical channels if VCHANs are disabled
Currently, we are skipping physical channels when servicing
SNDCTL_AUDIOINFO, and VCHANs when servicing SNDCTL_AUDIOINFO_EX.
However, if we call SNDCTL_AUDIOINFO with VCHANs disabled, we'll
eventually skip all channels, resulting in some of oss_audioinfo's
fields containing wrong information (e.g min/max_channels).

Fix this by adding an exception to SNDCTL_AUDIOINFO not to skip physical
channels when VCHANs are disabled.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45722

(cherry picked from commit f30af1f037a68947edbabebc7ab495cd1b7a4ec8)
2024-07-10 18:48:12 +02:00
Zhenlei Huang
e729e75080 if_vxlan(4): Plug a memory leak
On clone creating, either failure from vxlan_set_user_config() or
ifc_copyin() will result in leaking previous allocated counters.

Since counter_u64_alloc(M_WAITOK) never fails, make vxlan_stats_alloc()
void and move the allocation for counters below checking ifd->params to
avoid memory leak.

Reviewed by:	kp, glebius
Fixes:	b092fd6c97 if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45822

(cherry picked from commit 087f5e08ab5f0384163f76f73b9a91c98a3ba450)
2024-07-10 18:17:09 +08:00
Zhenlei Huang
7de38cbb5d if_vxlan(4): Exclude ETHER_CRC_LEN from macro VXLAN_MAX_MTU
The encapsulated (original) frame does not count in FCS as per Section 5
of RFC 7348.

Reviewed by:	afedorov, bryanv, #network
Fixes:		b7592822d5 Allow set MTU more than 1500 bytes
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45195

(cherry picked from commit d6963b9ed3287e91db3d1df153861591faff0007)
2024-07-10 18:17:09 +08:00
Zhenlei Huang
a8790965b0 ifnet: Remove dead code
Since change [1], if_bpf will not be detached by the interface departure
eventhandler and will not be NULL. Then the logic to re-attach if_bpf
becomes dead and serves no purpose any more.

This partially reverts commit 05fc416403.

1. 9ce40d321d bpf: Fix incorrect cleanup

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45599

(cherry picked from commit 9738277b5c662a75347efa6a58daea485d30f895)
2024-07-08 19:30:57 +08:00
Zhenlei Huang
4a253ccbe8 lo: Use new KPI to assign the first loop interface
While here remove a pointless static local variable lo_cloner.

No functional change intended.

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45728

(cherry picked from commit 2cb7605a2415a1c0dd35374a88f815ef00e31de9)
2024-07-05 23:11:51 +08:00
Zhenlei Huang
3bae3e545e ifnet: Restore curvnet earlier
This improves readability a little. As a side effect, a redundant
CURVNET_RESTORE is removed.

No functional change intended.

Reviewed by:	glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45595

(cherry picked from commit ef4f4a44d9134ddadede0e2e6e658d0688c5ab3c)
2024-07-05 23:11:51 +08:00
Zhenlei Huang
338bb09100 ifnet: Use NET_EPOCH_WAIT() macro
This makes it easier to grep the usage.

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45715

(cherry picked from commit 71f8fbf9bda43e3ca2f26d0499b7a88d0f2f7352)
2024-07-05 23:11:51 +08:00
Zhenlei Huang
bd3696bdb2 ip_mroute: Use NET_EPOCH_WAIT() macro
This makes it easier to grep the usage.

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45715

(cherry picked from commit 08a98731ddf4459bcee25074bdbc21d6fa5ce4ca)
2024-07-05 23:11:51 +08:00
Rick Macklem
cbf54cdb36 nfsd: Update a file missed by commit e2c9fad2e0ae
(cherry picked from commit dbe7ff254e6c87a851a75caa7250b8fbcab90c9f)
2024-07-04 18:16:56 -07:00
Rick Macklem
98c53b0b55 nfsd: Fix delegation handled for atomic upgrade
For NFSv4.1/4.2, an atomic upgrade of a delegation from a
read delegation to a write delegation is allowed and can
result in signoficantly improved performance.

This patch adds support for this atomic upgrade, plus fixes
a couple of other delegation related bugs.  Since there were
three cases where delegations were being issued, the patch
factors this out into a separate function called
nfsrv_issuedelegations().

This patch should only affect the NFSv4.1/4.2 behaviour
when delegations are enabled, which is not the default.

(cherry picked from commit e2c9fad2e0ae3f7049831bf7f2be1a3573363cdc)
2024-07-04 18:12:26 -07:00
Mitchell Horne
8daa609450 if_genet: don't load DMA mapping when tx_queue is full
gen_encap() always calls bus_dmamap_load_mbuf_sg() into 'map' (which is
the current tx_queue). If the tx_queue is full, it will load with a
'map' that already has a currently active mapping. This violates the
busdma(9) KPI.

Checking for a full queue and returning ENOBUFS will allow
gen_start_locked() to set the IFF_DRV_OACTIVE faster without having to
needlessly check if the mbuf will fit (it won't).

PR:		256482
Reviewed by:	mhorne
MFC after:	1 week
Submitted by:	ghuckriede@blackberry.com

(cherry picked from commit a35f66510917f5ac21c11e9642174cda7718fbc6)
2024-07-04 10:31:54 -03:00
Warner Losh
125a2a6b67 MFC: linux: Make module standalone-buildable
Add opt_inet.h and opt_usb.h to make linux module buildable standalone.

(cherry picked from commit c5f906d32d2bc8e37f1e1911382e27af7e6240ff)
2024-07-04 02:37:57 +07:00
Konstantin Belousov
342053a66c sched_unpin(): assert that curthread was pinned
(cherry picked from commit 7e5574f9e5d9df749ffc49657717527cfa93f6b4)
2024-07-03 11:02:28 +03:00
Mark Johnston
18babd824e pf: Sprinkle const qualifiers in state lookup routines
State keys are trivially const in lookup routines, so annotate them as
such.  No functional change intended.

Reviewed by:	kp
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Modirum
Differential Revision:	https://reviews.freebsd.org/D45671

(cherry picked from commit 66b8cac8d837c0ca3fd38d0a66259ca932a1c430)
2024-07-02 09:19:29 -04:00
Mark Johnston
a9a57c8432 wg: Implement if_transmit unconditionally
Commit bf454ca88bdf made wg_transmit() defined only when "device netmap"
is configured, as if_wg's if_transmit implementation should never be
called otherwise, but this breaks a requirement that interfaces
implement both or neither of if_transmit and if_qflush.

Restore the old behaviour of unconditionally defining wg_transmit().  It
contains an assertion that the interface is in netmap mode.

Reported by:	peterj
MFC after:	2 weeks
Fixes:	bf454ca88bdf ("wg: Add netmap support")

(cherry picked from commit 5515e8874a8d85a8d961fca64c494dfc1bea4bd0)
2024-07-02 09:19:28 -04:00
Mark Johnston
c39d01d73c dtrace: Remove LOCK_LEVEL
It is unused on FreeBSD.  No functional change intended.

MFC after:	1 week

(cherry picked from commit bc2901144cf71fd14b4b04cef801fa1bab19ad32)
2024-07-02 09:19:28 -04:00
Navdeep Parhar
536a452cc4 cxgbev(4): Pay attention to the VLAN configuration for the VF.
Make sure that the transmit traffic is tagged correctly or else the
firmware will refuse to transmit and will report an ACL violation.

On receive the hardware will make sure that tagged traffic is delivered
to the appropriate VM.  The driver only asserts that the VLAN id that
was extracted from the wire traffic matches the VF's configuration.

All this works when associating a specific VLAN id with a VF.  The
'trunk' setting likely needs more work.

MFC after:	1 week
Sponsored by:	Chelsio Communications

(cherry picked from commit 2d0a01271223ce623c78f5c8236f8f3f4b6ef104)
2024-07-01 18:08:17 +02:00
Navdeep Parhar
5d49a46b84 cxgbev(4): Shared code for the VF driver to query a VF's VLAN config.
MFC after:	1 week
Sponsored by:	Chelsio Communications

(cherry picked from commit 4471ff11969ec6bd2e5d3c745fc5ba90fda596ed)
2024-07-01 18:08:06 +02:00
Navdeep Parhar
45b7dd0436 cxgbe(4): New knob to limit driver to the specified types of doorbells.
hw.cxgbe.doorbells_allowed="0xf"

The adapter's doorbells bitmap is clipped to the value specified in the
tunable, which is meant for debug and workarounds only.  There is no
change in default behavior.

MFC after:	1 week
Sponsored by:	Chelsio Communications

(cherry picked from commit ba95b4aea78909bca972239afcbd51538c4b37c1)
2024-07-01 18:07:57 +02:00
Navdeep Parhar
7aa9202bc8 cxgbe(4): Do not issue an L1CFG command from a VF.
It is pointless to attempt an operation that is not permitted.  It spams
the firmware devlog with "insufficient caps" errors that distract from
real errors.

78 2463625358 ERR CORE insufficient caps to process mailbox cmd: pfn 0x0 vfn 0x1; r_caps 0x86 wx_caps 0x82 required r_caps 0x81 w_caps 0x5

MFC after:	1 week
Sponsored by:	Chelsio Communications

(cherry picked from commit d72db09005e53160d6c89b5221169efaac74cd55)
2024-07-01 18:07:47 +02:00
Navdeep Parhar
b913bd1606 cxgbev(4): Use the correct source pf for T6 in the VF driver.
MFC after:	1 week
Sponsored by:	Chelsio Communications

(cherry picked from commit d0fdafdb0ef4ec9c5c66f39daf2eca926f14be0d)
2024-07-01 18:07:39 +02:00
Kristof Provost
4064153643 cxgbe: handle vlan PF restrictions
Co-Authored-by:	Navdeep Parhar <np@FreeBSD.org>
MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D45428

(cherry picked from commit 1389314d53531e06c7ec02406b0addf7d77e7db7)
2024-07-01 18:06:16 +02:00
Kristof Provost
9c86768b14 mlx5: handle vlan PF restrictions
Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D45427

(cherry picked from commit 7deadea2eb0aca0b83657d30f895d98795d9d81f)
2024-07-01 18:06:09 +02:00
Kristof Provost
6bba78e6e9 iovctl: allow vlan restrictions to be passed to the driver
Allow iovctl to create VFs that are restricted to specific VLAN IDs.

Reviewed by:	kib, np
MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D45402

(cherry picked from commit c57c26179033f64c2011a2d2a904ee3fa62e826a)
2024-07-01 18:06:05 +02:00
Wei Hu
d56a912f2f Hyper-V: move memory alloc call for tlb hypercall out of smp_rendezvous
The allocation call could result in sleep lock violation if it is in
smp_rendezvous. Move it out. Also move the pcpu memory pointer to
vmbus_pcpu_data since it is only used on Hyper-V.

PR:		279738
Reported by:	gbe
Fixes:		2b887687edc25bb4553f0d8a1183f454a85d413d
MFC after:	2 weeks
Sponsored by:	Microsoft

(cherry picked from commit d0cb4674df97aa638d5d17861c364b1625f79401)
2024-07-01 13:33:08 +00:00
Wei Hu
451941677a Hyper_V: add a boot parameter to tlb flush hypercall
Add boot parameter hw.vmbus.tlb_hcall for tlb flush hypercall.
By default it is set to 1 to allow hyercall tlb flush. It can be
set to 0 in loader.conf to turn off hypercall and use system
provided tlb flush routine.

The change also changes flag in the per cpu contiguous memory
allocation to no wait to avoid panic happened some cases which there
are no enough contiguous memery available at boot time.

Reported by:	gbe
Tested by:	whu
MFC after:	1 week
Fixes:		2b887687edc25bb4553f0d8a1183f454a85d413d
Sponsored by:	Microsoft

(cherry picked from commit e02d20ddff7f9f9509b28095459327bc183dab8a)
2024-07-01 13:32:37 +00:00
Wei Hu
3c1f330088 Hyper-V: remove unused alloc_pcpu_ptr()
Fixes:		2b887687edc25bb4553f0d8a1183f454a85d413d
Sponsored by:	Microsoft

(cherry picked from commit fd911ae609247ef5c91493fb5506e77aa6e497bc)
2024-07-01 13:31:55 +00:00
Souradeep Chakrabarti
7ece5993b7 Hyper-V: TLB flush enlightment using hypercall
Currently FreeBSD uses IPI based TLB flushing for remote
TLB flushing. Hyper-V allows hypercalls to flush local and
remote TLB. The use of Hyper-V hypercalls gives significant
performance improvement in TLB operations.

This patch set during test has shown near to 40 percent
TLB performance improvement.

Also this patch adds rep hypercall implementation as well.

Reviewed by:	whu, kib
Tested by:	whu
Authored-by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Co-Authored-by:	Erni Sri Satya Vennela <ernis@microsoft.com>
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D45521

(cherry picked from commit 2b887687edc25bb4553f0d8a1183f454a85d413d)
2024-07-01 13:21:14 +00:00
Konstantin Belousov
7a3d7aec41 pmap: move the smp_targeted_tlb_shutdown pointer stuff to amd64 pmap.h
Fixes:	bec000c9c1ef409989685bb03ff0532907befb4aESC
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9c5d7e4a0c02bc45b61f565586da2abcc65d70fa)
2024-07-01 13:07:38 +00:00
Souradeep Chakrabarti
840d8e0c30 amd64: add a func pointer to tlb shootdown function
Make the tlb shootdown function as a pointer. By default, it still
points to the system function smp_targeted_tlb_shootdown(). It allows
other implemenations to overwrite in the future.

Reviewed by:	kib
Tested by:	whu
Authored-by:    Souradeep Chakrabarti <schakrabarti@microsoft.com>
Co-Authored-by: Erni Sri Satya Vennela <ernis@microsoft.com>
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D45174

(cherry picked from commit bec000c9c1ef409989685bb03ff0532907befb4a)
2024-07-01 13:03:02 +00:00
Jamie Gritton
c8f147943d MFC zfs/jail: Mark the zfs.mount_snapshot jail parameter as boolean.
PR:		274263
Differential Revision:	https://reviews.freebsd.org/D45647

(cherry picked from commit 9cbf1de7e34a6fced041388fad5d9180cb7705fe)
2024-06-28 12:44:56 -07:00
Mariusz Zaborski
944827bcf6 isp: fix ISPCTL_ABORT_CMD switch case
Prevent kernel panic by not running ISPCTL_FCLINK_TEST after a
failed ISPCTL_ABORT_CMD.

Reviewed by:	mav
Tested by:	Arne Steinkamm <arne@steinkamm.com>
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45718

(cherry picked from commit 8aa9192ce98aec07b24f8279c709237dd2c4421b)
2024-06-28 12:18:23 +02:00
Mariusz Zaborski
c5e0b035d9 libutil: move ftime to libutil
It seems that there are still some applications that use ftime(3)
(for example, science/siconos and sysutils/lcdproc). The issue
is that we don't build libcompat as a shared library anymore.
The easiest solution is to move it to libutil, until we
deprecate it for good.

This solution was proposed by kib@ in
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257789.

PR:		257789
MFC after:	1 month
Reviewed by:	kib (ages ago)
Differential Revision:	https://reviews.freebsd.org/D39994

(cherry picked from commit bb421be6c1174fad837973acc5e4a7bade4489db)
2024-06-28 12:17:52 +02:00
Mitchell Horne
9a53391b60 riscv: adjust physmem reservation
Make sure we do this BEFORE pmap_bootstrap().

Reviewed by:	markj, jhb
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45325

(cherry picked from commit 0e4e77072f65df71644140e41229b868a73f3371)
2024-06-27 14:56:23 -03:00
John F. Carr
53a64a0938 rk_pinctrl: fix error check
The parse_bias method returns a signed int, with a value of -1 when
the device tree reports nothing of the bias configuration. Convert the
local 'bias' from unsigned to signed to properly check this condition.

PR:		229721
Reviewed by:	mhorne
MFC after:	3 days

(cherry picked from commit 97ab935d566c85458bc7cab99c402f026d704eff)
2024-06-27 14:56:23 -03:00
Mark Johnston
b31999c051 physmem: Correct a comment
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.

(cherry picked from commit f45213c74cbac7f41ab3c94440cb37a2fd92a449)
2024-06-27 11:27:42 -04:00
Mark Johnston
3026c74b87 amd64/vmm: Make vmm.h more self-contained
CTASSERT is defined in kassert.h, so include that here.  No functional
change intended.

MFC after:	1 week

(cherry picked from commit aede0d3badd1be92b57deb14c494785ab61022d4)
2024-06-27 11:27:42 -04:00
Mark Johnston
0d03585e6b jedec_dimm: Use device_set_descf()
Note that it is ok to use device_get_desc() as one of the format string
parameters because it is set using device_set_desc() (not
device_set_desc_copy()) and so won't be freed when the description is
updated.

No functional change intended.

MFC after:	1 week

(cherry picked from commit 83caa244bc9eef6949a1250a875ad1409775a46e)
2024-06-27 11:27:42 -04:00
Mark Johnston
48d60dd3ac padlock: Use device_set_descf()
No functional change intended.

MFC after:	1 week

(cherry picked from commit 131c8ee7331af701c78e694c9c7051f53600c4fe)
2024-06-27 11:27:41 -04:00
Mark Johnston
16cc589d91 mana: Use device_set_desc()
No functional change intended.

MFC after:	1 week

(cherry picked from commit 89848b3445ad52c304e6f9c5036aa9108bedb4c8)
2024-06-27 11:27:41 -04:00
Mark Johnston
c64abeae22 pir: Use device_set_descf()
No functional change intended.

MFC after:	1 week

(cherry picked from commit a96a9577127c9bf804e7e47e38e7b4123a43efa1)
2024-06-27 11:27:41 -04:00
Mark Johnston
ddb9040fc2 oce: Use device_set_descf()
No functional change intended.

MFC after:	1 week

(cherry picked from commit c704b87ba679563cb8b344da69aa3cb7118a10b0)
2024-06-27 11:27:41 -04:00
Mark Johnston
c07458f193 cfi: Use device_set_descf()
No functional change intended.

MFC after:	1 week

(cherry picked from commit 2ef1f61df2d5961ffff1205d4800e46efadbf5ba)
2024-06-27 11:27:41 -04:00
Mark Johnston
2e382b3bc8 superio: Use device_set_descf()
No functional change intended.

MFC after:	1 week

(cherry picked from commit 76a79178187f5a3ac05733e068c0860b14fd8632)
2024-06-27 11:27:41 -04:00
Mark Johnston
da334b4f54 hidbus: Use device_set_descf()
No functional change intended.

MFC after:	1 week

(cherry picked from commit 3f795763e45326489ab707c369b8daea495f6562)
2024-06-27 11:27:41 -04:00
Mark Johnston
4fcaee7a5f bxe: Use device_set_descf()
No functional change intended.

MFC after:	1 week

(cherry picked from commit 9da1b6dc161bfd7b494ba472cde33af49ef8196f)
2024-06-27 11:27:41 -04:00
Mark Johnston
9f74e5edaf bge: Use device_set_descf()
No functional change intended.

MFC after:	1 week

(cherry picked from commit 50505c853c6cf1a4e8fac54d20c43f0f91ff0c67)
2024-06-27 11:27:41 -04:00