1. 18 Jun, 2022 5 commits
    • Rick Macklem's avatar
      nfscl: Clean up the code by removing #if(n)def APPLE · 6d25ea6d
      Rick Macklem authored
      The definition of "APPLE" was used by the Mac OSX port.
      For FreeBSD, this definition is never used, so remove
      the references to it to clean up the code.
      
      This commit should not result in a semantics change.
      6d25ea6d
    • Damjan Jovanovic's avatar
      struct kinfo_file changes needed for lsof to work using only usermode APIs` · 8c309d48
      Damjan Jovanovic authored
      Add kf_pipe_buffer_[in/out/size] fields to kf_pipe, and populate them.
      
      Add a kf_kqueue struct to the kf_un union, to allow querying kqueue state,
      and populate it.
      
      Populate the kf_sock_rcv_sb_state and kf_sock_snd_sb_state fields in
      kf_sock for INET/INET6 sockets, and populate all other fields for all
      transport layer protocols, not just TCP.
      
      Bump __FreeBSD_version.
      
      Differential revision:	https://reviews.freebsd.org/D34184
      Reviewed by:	jhb, kib, se
      MFC after:	1 week
      8c309d48
    • Damjan Jovanovic's avatar
      KERN_LOCKF: report kl_file_fsid consistently with stat(2) · 8ae76949
      Damjan Jovanovic authored
      PR:	264723
      Reviewed by:	kib
      Discussed with:	markj
      MFC after:	1 week
      8ae76949
    • Kyle Evans's avatar
      mixer: remove volume backwards compat, add % interpretation · 4014365e
      Kyle Evans authored
      The current situation is fairly confusing, where an integer is interpreted
      as a percent until you slap a decimal on it and magically it becomes an
      absolute value.
      
      Let's have a flag day in 14.0 and remove this shim entirely.  Setting with
      percent can still be useful, so allow a trailing '%' to indicate as such.
      As a side effect, we tighten down the format allowed in the volume a little
      bit by ensuring there's no trailing garbage after the value once it's
      separated into left and right components.
      
      Reviewed by:	christos, hselasky, pauamma_gundo.com (manpages)
      Relnotes:	yes
      Differential Revision:	https://reviews.freebsd.org/D35101
      4014365e
    • наб's avatar
      rc.d/hostid: remove useless cat · 11bd40d0
      наб authored
      We've already read it and validated it ‒ re-reading is wasteful
      
      PR:		264376
      11bd40d0
  2. 17 Jun, 2022 13 commits
  3. 16 Jun, 2022 8 commits
    • Rick Macklem's avatar
      nfscl: Clean up the code by removing unused arguments · c692ea40
      Rick Macklem authored
      The "void *stuff" (also called fstuff and dstuff) argument
      was used by the Mac OSX port.  For FreeBSD, this argument
      is always NULL, so remove it to clean up the code.
      
      This commit gets rid of "stuff" for assorted functions
      defined in nfs_clrpcops.c and called in nfs_clvnops.c.
      Future commits will do the same for other functions.
      
      This commit should not result in a semantics change.
      c692ea40
    • Rick Macklem's avatar
      nfscl: Clean up the code by removing unused arguments · af6665e0
      Rick Macklem authored
      The "void *stuff" (also called fstuff and dstuff) argument
      was used by the Mac OSX port.  For FreeBSD, this argument
      is always NULL, so remove it to clean up the code.
      
      This commit gets rid of "stuff" for assorted functions
      defined in nfs_clrpcops.c and called in nfs_clvnops.c.
      Future commits will do the same for other functions.
      
      This commit should not result in a semantics change.
      af6665e0
    • James Mintram's avatar
      bhyve: Report an error for invalid UUIDs. · e16b709e
      James Mintram authored
      Reviewed by:	rgrimes, grehan, jhb
      Differential Revision:	https://reviews.freebsd.org/D30050
      e16b709e
    • Alexander Motin's avatar
      amd64: Stop using REP MOVSB for backward memmove()s. · f22068d9
      Alexander Motin authored
      Enhanced REP MOVSB feature of CPUs starting from Ivy Bridge makes
      REP MOVSB the fastest way to copy memory in most of cases. However
      Intel Optimization Reference Manual says: "setting the DF to force
      REP MOVSB to copy bytes from high towards low addresses will expe-
      rience significant performance degradation". Measurements on Intel
      Cascade Lake and Alder Lake, same as on AMD Zen3 show that it can
      drop throughput to as low as 2.5-3.5GB/s, comparing to ~10-30GB/s
      of REP MOVSQ or hand-rolled loop, used for non-ERMS CPUs.
      
      This patch keeps ERMS use for forward ordered memory copies, but
      removes it for backward overlapped moves where it does not work.
      
      This is just a cosmetic sync with kernel, since libc does not use
      ERMS at this time.
      
      Reviewed by:    mjg
      MFC after:	2 weeks
      f22068d9
    • Alexander Motin's avatar
      amd64: Stop using REP MOVSB for backward memmove()s. · 6210ac95
      Alexander Motin authored
      Enhanced REP MOVSB feature of CPUs starting from Ivy Bridge makes
      REP MOVSB the fastest way to copy memory in most of cases. However
      Intel Optimization Reference Manual says: "setting the DF to force
      REP MOVSB to copy bytes from high towards low addresses will expe-
      rience significant performance degradation". Measurements on Intel
      Cascade Lake and Alder Lake, same as on AMD Zen3 show that it can
      drop throughput to as low as 2.5-3.5GB/s, comparing to ~10-30GB/s
      of REP MOVSQ or hand-rolled loop, used for non-ERMS CPUs.
      
      This patch keeps ERMS use for forward ordered memory copies, but
      removes it for backward overlapped moves where it does not work.
      
      Reviewed by:	mjg
      MFC after:	2 weeks
      6210ac95
    • Mark Johnston's avatar
      socket: Fix a race between kevent(2) and listen(2) · f6379f7f
      Mark Johnston authored
      When locking the knote list for a socket, we check whether the socket is
      a listening socket in order to select the appropriate mutex; a listening
      socket uses the socket lock, while data sockets use socket buffer
      mutexes.
      
      If SOLISTENING(so) is false and the knote lock routine locks a socket
      buffer, then it must re-check whether the socket is a listening socket
      since solisten_proto() could have changed the socket's identity while we
      were blocked on the socket buffer lock.
      
      Reported by:	syzkaller
      Reviewed by:	glebius
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35492
      f6379f7f
    • Mark Johnston's avatar
      debugnet: Fix an error handling bug in the DDB command tokenizer · c262d5e8
      Mark Johnston authored
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      c262d5e8
    • Mark Johnston's avatar
      debugnet: Handle batches of packets from if_input · 84143314
      Mark Johnston authored
      Some drivers will collect multiple mbuf chains, linked by m_nextpkt,
      before passing them to upper layers.  debugnet_pkt_in() didn't handle
      this and would process only the first packet, typically leading to
      retransmits.
      
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      84143314
  4. 15 Jun, 2022 14 commits
    • Rick Macklem's avatar
      nfscl: Clean up the code by removing unused arguments · 8cb42d69
      Rick Macklem authored
      The "void *stuff" (also called fstuff and dstuff) argument
      was used by the Mac OSX port.  For FreeBSD, this argument
      is always NULL, so remove it to clean up the code.
      
      This commit gets rid of "stuff" for assorted functions
      defined in nfs_clrpcops.c and called in nfs_clvnops.c.
      Future commits will do the same for other functions.
      
      This commit should not result in a semantics change.
      8cb42d69
    • Michael Tuexen's avatar
      tcp: fix TCPPCAP for kernels enabling VNET · bf6c6162
      Michael Tuexen authored
      Reviewed by:		rscheff
      MFC after:		3 days
      Sponsored by:		Netflix, Inc.
      Differential Revision:	https://reviews.freebsd.org/D35503
      bf6c6162
    • Bjoern A. Zeeb's avatar
      XHCI: clear warm and port reset · 8f892e9b
      Bjoern A. Zeeb authored
      It seems we do not clear UPS_C_BH_PORT_RESET and UPS_C_PORT_RESET
      conditions after warm or port reset.  Add that code.
      
      Obtained from:	an old patch mainly debugging other problems
      MFC after:	2 weeks
      Reviewed by:	hselasky
      Differential Revision: https://reviews.freebsd.org/D35483
      8f892e9b
    • Bjoern A. Zeeb's avatar
      USB: add quirks to XHCI · 447c418d
      Bjoern A. Zeeb authored
      While XHCI is very generic some revisions of chipsets have problems.
      On dwc3 <= 3.00a Port Disable does not seem to work so we need to not
      enable it.
      For that introduce quirks to xhci so that controllers can steer
      certain features.  I would hope that this is and remains the only one.
      
      Obtained from:	an old patch mainly debugging other problems
      MFC after:	2 weeks
      Reviewed by:	hselasky
      Differential Revision: https://reviews.freebsd.org/D35482
      447c418d
    • Bjoern A. Zeeb's avatar
      LinuxKPI: 802.11: ieee80211_start_tx_ba_session() · 799051e2
      Bjoern A. Zeeb authored
      For as long as we do not implement the compat code for tx aggregation
      return -EINVAL in ieee80211_start_tx_ba_session() as both rtw88 and
      rtw89 check for this value and only then disable further attempts.
      
      MFC after:	3 days
      799051e2
    • Rick Macklem's avatar
      nfscl: Clean up the code by removing unused arguments · da47c186
      Rick Macklem authored
      The "void *stuff" (also called fstuff and dstuff) argument
      was used by the Mac OSX port.  For FreeBSD, this argument
      is always NULL, so remove it to clean up the code.
      
      This commit gets rid of "stuff" for assorted functions
      defined in nfs_clrpcops.c and called in nfs_clvnops.c.
      Future commits will do the same for other functions.
      
      This commit should not result in a semantics change.
      da47c186
    • Zhenlei Huang's avatar
      ifconfig.8: reflect removal of FDDI and Token Ring · 030f3ee9
      Zhenlei Huang authored
      Reviewed By:	pauamma
      Differential Revision: https://reviews.freebsd.org/D35409
      030f3ee9
    • Doug Moore's avatar
      iommu_gas: make iommu_gas_lowermatch non-recursive · f979ad00
      Doug Moore authored
      Change the recursive implementation to one that uses parent pointers
      to walk back up the rb-tree, to slightly improve performance.
      
      Reviewed by:	alc, kib
      MFC after:	3 weeks
      Differential Revision:	https://reviews.freebsd.org/D35486
      f979ad00
    • Alexander Motin's avatar
      hwpmc: Reenable PME before reenabling counters. · f9e62419
      Alexander Motin authored
      Doing otherwise may lead to lost interrupts, that in combination
      with hardware PMCs freezing may leave them frozen forever.  It may
      also slightly improve profiling accuracy.
      
      MFC after:	2 weeks
      f9e62419
    • Alexander Motin's avatar
      hwpmc: Correct sysctl description. · 918505d0
      Alexander Motin authored
      MFC after:	2 weeks
      918505d0
    • Mark Johnston's avatar
      loader: Relax the check in is_kernphys_relocatable() · 9a964ad5
      Mark Johnston authored
      The check fails in kernels compiled with KASAN because AddressSanitizer
      inserts redzones around global variables, so the size of the "kernphys"
      symbol is 32 rather than 8.  Thus we fall back to copying even though
      it's not necessary.
      
      Simply remove the size check.  I didn't want to extend the symbol size
      check since there's no guarantee that AddressSanitizer will always emit
      32 bytes for "kernphys".
      
      Reviewed by:	kib
      MFC after:	1 month
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35448
      9a964ad5
    • Mark Johnston's avatar
      kasan: Create a shadow for the bootstack prior to hammer_time() · 756bc3ad
      Mark Johnston authored
      When the kernel is compiled with -asan-stack=true, the address sanitizer
      will emit inline accesses to the shadow map.  In other words, some
      shadow map accesses are not intercepted by the KASAN runtime, so they
      cannot be disabled even if the runtime is not yet initialized by
      kasan_init() at the end of hammer_time().
      
      This went unnoticed because the loader will initialize all PML4 entries
      of the bootstrap page table to point to the same PDP page, so early
      shadow map accesses do not raise a page fault, though they are silently
      corrupting memory.  In fact, when the loader does not copy the staging
      area, we do get a page fault since in that case only the first and last
      PML4Es are populated by the loader.  But due to another bug, the loader
      always treated KASAN kernels as non-relocatable and thus always copied
      the staging area.
      
      It is not really practical to annotate hammer_time() and all callees
      with __nosanitizeaddress, so instead add some early initialization which
      creates a shadow for the boot stack used by hammer_time().  This is only
      needed by KASAN, not by KMSAN, but the shared pmap code handles both.
      
      Reported by:	mhorne
      Reviewed by:	kib
      MFC after:	1 month
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35449
      756bc3ad
    • Mark Johnston's avatar
      Fix the test used to wait for AP startup on x86, arm64, riscv · f6b799a8
      Mark Johnston authored
      On arm64, testing pc_curpcb != NULL is not correct since pc_curpcb is
      set in pmap_switch() while the bootstrap stack is still in use.  As a
      result, smp_after_idle_runnable() can free the boot stack prematurely.
      
      Take a different approach: use smp_rendezvous() to wait for all APs to
      acknowledge an interrupt.  Since APs must not enable interrupts until
      they've entered the scheduler, i.e., switched off the boot stack, this
      provides the right guarantee without depending as much on the
      implementation of cpu_throw().  And, this approach applies to all
      platforms, so convert x86 and riscv as well.
      
      Reported by:	mmel
      Tested by:	mmel
      Reviewed by:	kib
      Fixes:		8db2e8fd ("Remove the secondary_stacks array in arm64 and riscv kernels.")
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35435
      f6b799a8
    • Mark Johnston's avatar
      pmap: Keep PTI page table pages busy · c6d092b5
      Mark Johnston authored
      PTI page table pages are allocated from a VM object, so must be
      exclusively busied when they are freed, e.g., when a thread loses a race
      in pmap_pti_pde().  Simply keep PTPs busy at all times, as was done for
      some other kernel allocators in commit
      e9ceb9dd.
      
      Also remove some redundant assertions on "ref_count":
      vm_page_unwire_noq() already asserts that the page's reference count is
      greater than zero.
      
      Reported by:	syzkaller
      Reviewed by:	kib
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35466
      c6d092b5