1. 21 Sep, 2020 31 commits
    • D Scott Phillips's avatar
      vm_reserv: Sparsify the vm_reserv_array when VM_PHYSSEG_SPARSE · 7988971a
      D Scott Phillips authored
      On an Ampere Altra system, the physical memory is populated
      sparsely within the physical address space, with only about 0.4%
      of physical addresses backed by RAM in the range [0, last_pa].
      
      This is causing the vm_reserv_array to be over-sized by a few
      orders of magnitude, wasting roughly 5 GiB on a system with
      256 GiB of RAM.
      
      The sparse allocation of vm_reserv_array is controlled by defining
      VM_PHYSSEG_SPARSE, with the dense allocation still remaining for
      platforms with VM_PHYSSEG_DENSE.
      
      Reviewed by:	markj, alc, kib
      Approved by:	scottl (implicit)
      MFC after:	1 week
      Sponsored by:	Ampere Computing, Inc.
      Differential Revision:	https://reviews.freebsd.org/D26130
      7988971a
    • D Scott Phillips's avatar
      Sparsify the vm_page_dump bitmap · 00e66147
      D Scott Phillips authored
      On Ampere Altra systems, the sparse population of RAM within the
      physical address space causes the vm_page_dump bitmap to be much
      larger than necessary, increasing the size from ~8 Mib to > 2 Gib
      (and overflowing `int` for the size).
      
      Changing the page dump bitmap also changes the minidump file
      format, so changes are also necessary in libkvm.
      
      Reviewed by:	jhb
      Approved by:	scottl (implicit)
      MFC after:	1 week
      Sponsored by:	Ampere Computing, Inc.
      Differential Revision:	https://reviews.freebsd.org/D26131
      00e66147
    • D Scott Phillips's avatar
      Move vm_page_dump bitset array definition to MI code · ab041f71
      D Scott Phillips authored
      These definitions were repeated by all architectures, with small
      variations. Consolidate the common definitons in machine
      independent code and use bitset(9) macros for manipulation. Many
      opportunities for deduplication remain in the machine dependent
      minidump logic. The only intended functional change is increasing
      the bit index type to vm_pindex_t, allowing the indexing of pages
      with address of 8 TiB and greater.
      
      Reviewed by:	kib, markj
      Approved by:	scottl (implicit)
      MFC after:	1 week
      Sponsored by:	Ampere Computing, Inc.
      Differential Revision:	https://reviews.freebsd.org/D26129
      ab041f71
    • Mark Johnston's avatar
      Weaken assertions in pmap_l1_to_l2() and pmap_l2_to_l3(). · a9cf0eeb
      Mark Johnston authored
      pmap_update_entry() will temporarily clear the valid bit of page table
      entries in order to satisfy the arm64 pmap's break-before-make
      constraint.  pmap_kextract() may operate concurrently on kernel page
      table pages, introducing windows where the assertions added in r365879
      may fail incorrectly since they implicitly assert that the valid bit is
      set.  Modify the assertions to handle this.
      
      Reviewed by:	andrew, mmel (previous version)
      Reviewed by:	alc, kib
      Reported by:	mmel, scottph
      MFC with:	r365879
      a9cf0eeb
    • D Scott Phillips's avatar
      bitset: expand bit index type to `long` · 26a3bf76
      D Scott Phillips authored
      An upcoming patch to use the bitset macros for tracking vm page
      dump information could conceivably need more than INT_MAX bits.
      Expand the bit type to long so that the extra range is available
      on 64-bit platforms where it would most likely be needed.
      
      CPUSET_COUNT and DOMAINSET_COUNT are also modified to remain of
      type `int`.
      
      Reviewed by:	kib, markj
      Approved by:	scottl (implicit)
      MFC after:	1 week
      Sponsored by:	Ampere Computing, Inc.
      Differential Revision:	https://reviews.freebsd.org/D26190
      26a3bf76
    • D Scott Phillips's avatar
      vchi: rename bitset macros to avoid collision with bitset(9) · 191dad8b
      D Scott Phillips authored
      An upcoming change to include bitset(9) macros from vm_page.h
      causes a macro name collision with vchi's custom bitset macros.
      
      This change was performed mechanically by:
      
        sed -i .orig s/BITSET/VCHI_BITSET/g $(grep -rl BITSET sys/contrib/vchiq)
      
      Reviewed by:	andrew
      Approved by:	scottl (implicit)
      MFC after:	1 week
      Sponsored by:	Ampere Computing, Inc.
      Differential Revision:	https://reviews.freebsd.org/D26177
      191dad8b
    • Alexander V. Chernikov's avatar
      Rework part of routing code to reduce difference to D26449. · 2259a030
      Alexander V. Chernikov authored
      * Split rt_setmetrics into get_info_weight() and rt_set_expire_info(),
       as these two can be applied at different entities and at different times.
      * Start filling route weight in route change notifications
      * Pass flowid to UDP/raw IP route lookups
      * Rework nd6_subscription_cb() and sysctl_dumpentry() to prepare for the fact
       that rtentry can contain multiple nexthops.
      
      Differential Revision:	https://reviews.freebsd.org/D26497
      2259a030
    • Kyle Evans's avatar
      bsdbox: fix build after recent libifconfig changes · 7b3286c1
      Kyle Evans authored
      libifconfig now generates file(s) into its .OBJDIR that are essential to the
      build. Make sure we -I that in, like we already do in the ^/rescue build.
      7b3286c1
    • Alex Richardson's avatar
      mkcsmapper: Fix UBSan signed shift error · 335770ac
      Alex Richardson authored
      usr.bin/mkcsmapper/yacc.y:466:18: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
      335770ac
    • Alex Richardson's avatar
      Fix another UBSan error in awk · 11169460
      Alex Richardson authored
      This applies my upstreamed fix: https://github.com/onetrueawk/awk/commit/ad9bd2f40a89ec9533b92254b86a756cf4f40fd4
      Found By:	UBSan
      11169460
    • Alex Richardson's avatar
      awk: Fix subobject out-of-bounds access · ae692c42
      Alex Richardson authored
      When matching a regex with ^, it would attempt to access
      gototab[NSTATES][NCHARS+2], and therefore access the state for the \002
      character instead. This change is required to run awk under CHERI (with
      sub-object bounds) and when running with UBSan instrumentation.
      
      This was committed upstream as https://github.com/onetrueawk/awk/commit/cbf924342b63a095a4c6842280c3085b1b63ae45
      
      Found by:	CHERI (with subobject bounds enabled)
      Obtained from:	CheriBSD
      Reviewed By:	imp
      Differential Revision: https://reviews.freebsd.org/D26509
      ae692c42
    • David Bright's avatar
      Whitespace fix after r365948 · 52664466
      David Bright authored
      MFC after:	1 week
      Sponsored by:	Dell EMC Isilon
      52664466
    • Hans Petter Selasky's avatar
      Add support for Winbond USB CDC modem device found in Tenma power supply. · 8463bd8a
      Hans Petter Selasky authored
      PR:		249384
      MFC after:	1 week
      Submitted by:	darius@dons.net.au
      Sponsored by:	Mellanox Technologies // NVIDIA Networking
      8463bd8a
    • Hans Petter Selasky's avatar
      Add example to ng_bpf(4) showing how ng_bpf(4) can be used to prevent spoofing. · 81a93548
      Hans Petter Selasky authored
      Differential Revision:	https://reviews.freebsd.org/D26488
      MFC after:	1 week
      Reviewed by:	pi, bcr (manpages)
      Submitted by:	lutz_donnerhacke.de (Lutz Donnerhacke)
      Sponsored by:	Mellanox Technologies // NVIDIA Networking
      81a93548
    • Adrian Chadd's avatar
      [rcorder] [crunch] Fix C function declarations to include void · 0dcdda09
      Adrian Chadd authored
      This fixes a compile issue under gcc6 which complains about
      legacy style C function declarations.
      
      Differential Revision:	https://reviews.freebsd.org/D26504
      0dcdda09
    • Alan Somers's avatar
      fsx: fix build with WARNS=6 · 34e0b83c
      Alan Somers authored
      * signed/unsigned comparisons
      * use standard warn(3)
      * Suppress warnings about local vars and funcs not declared static
      * const-correctness
      * declaration shadows a variable in the global scope
      
      Reviewed by:	kevans
      MFC after:	2 weeks
      Differential Revision:	https://reviews.freebsd.org/D26516
      34e0b83c
    • Mitchell Horne's avatar
      Hide tunable definitions behind _KERNEL · 45f65081
      Mitchell Horne authored
      Some userspace code include sys/kernel.h. Namely, some OpenZFS tests do
      this, and it was causing breakage after r365945 due to a lack of bool
      typedef. Userspace should not need the TUNABLE_** stuff, so hide it
      behind an #ifdef _KERNEL.
      
      Sorry for the breakage.
      
      Reported by:	andrew, Michael Butler, Jenkins
      Discussed with: kevans, allanjude
      45f65081
    • Kyle Evans's avatar
      xargs: add some long options for GNU compatibility · dc940832
      Kyle Evans authored
      These are low-effort to add, so let's just do it.
      
      Reported by:	"LukeShu" on Hacker News (-r / --no-run-if-empty)
      MFC after:	1 week
      dc940832
    • Poul-Henning Kamp's avatar
      Pull in fix from upstream NetBSD rev. 1.5: · 895a7e60
      Poul-Henning Kamp authored
          If Unwind_Backtrace is broken, ctx.n will still contain ~0, and we will
          return that which poor behavior for the user, so return 0 instead.
          We could document ~0 to be an error, but that would deviate from the
          Linux behavior which is not desirable. Noted by Poul-Henning Kamp
      
      PR:		209842
      895a7e60
    • Konstantin Belousov's avatar
      amd64 pmap: only calculate page table page when needed. · 6d4b6bd3
      Konstantin Belousov authored
      Noted by:	alc
      Reviewed by:	alc, markj
      Sponsored by:	The FreeBSD Foundation
      MFC after:	1 week
      Differential revision:	https://reviews.freebsd.org/D26499
      6d4b6bd3
    • Alex Richardson's avatar
      When building on Ubuntu bootstrap bmake with bash as the default shell · b1365a26
      Alex Richardson authored
      The Ubuntu /bin/sh (dash) removes all environment variables that contain
      characters outside the [a-zA-Z0-9_] range and this breaks the bmake tests that
      run as part of bootstrapping bmake.
      This can be reverted when the bmake tests have been updated.
      b1365a26
    • Alex Richardson's avatar
      Add a tools/build/make.py script that bootstraps bmake and then runs the build · af6a4c17
      Alex Richardson authored
      This makes it possible to compile on non-FreeBSD systems since make will
      usually be GNU make there. Even if they include bmake, it will often
      either be a broken version or too old to build FreeBSD.
      
      This should be the last commit needed to compile FreeBSD on Linux+macOS.
      After over two years, I've finally managed to upstream all our local CheriBSD
      changes to allow building on Linux (and as a result of being reviewed by more
      people they are slightly less ugly than they were before).
      
      It should now be possible to run the following to build on Linux+macOS if you
      have LLVM/Clang 10 or newer installed:
      MAKEOBJDIRPREFIX=/somewhere ./tools/build/make.py TARGET=amd64 TARGET_ARCH=amd64 buildworld
      
      I have only tested macOS 15, Ubuntu 18.04 and openSUSE Leap, but other Linux
      distributions might also work (as long as they ship a recent GLibc and compiler).
      
      Reviewed By:	emaste (should be fine to commit to tools/)
      Differential Revision: https://reviews.freebsd.org/D16767
      af6a4c17
    • David Bright's avatar
      Honor the FWUG value of some drives in nvmecontrol · 16969d14
      David Bright authored
      nvmecontrol tries to upload firmware in chunks as large as it thinks
      the device permits. It fails to take into account the FWUG value used
      by some drives to advertise the size and alignment limits for firmware
      chunks.
      
        - Use the firwmare update granularity value from the
        - If the granularity is not reported or not restricted, fall back to
          the previously existing logic that calculates the max transfer
          size based on MDTS.
        - Add firmware update granularity to the identify-controller output.
      
      Reviewed by:	imp (previous version), chuck
      Obtained from:	Dell EMC Isilon
      MFC after:	1 week
      Sponsored by:	Dell EMC Isilon
      Differential Revision:	https://reviews.freebsd.org/D26390
      16969d14
    • Mitchell Horne's avatar
      Use getenv_is_true() in init_static_kenv() · 624a7e1f
      Mitchell Horne authored
      A small example of how these functions can be used to simplify checks of
      this nature.
      
      Sponsored by:	Klara, Inc.
      Differential Revision:	https://reviews.freebsd.org/D26271
      624a7e1f
    • David Bright's avatar
      Add an ioctl to get an NVMe device's maximum transfer size · e32d47f3
      David Bright authored
      Reviewed by:	imp, chuck
      Obtained from:	Dell EMC Isilon
      MFC after:	1 week
      Sponsored by:	Dell EMC Isilon
      Differential Revision:	https://reviews.freebsd.org/D26390
      e32d47f3
    • Mitchell Horne's avatar
      Add getenv(9) boolean parsing functions · cba446e2
      Mitchell Horne authored
      This adds the getenv_bool() function, to parse a boolean value from a
      kernel environment variable or tunable. This works for traditional
      boolean values like "0" and "1", and also "true" and "false"
      (case-insensitive). These semantics do not yet apply to sysctls declared
      using SYSCTL_BOOL with CTLFLAG_TUN (they still only parse 1 and 0).
      
      Also added are two wrapper functions, getenv_is_true() and
      getenv_is_false(). These are slightly simpler for callers wishing to
      perform a single check of a configuration variable.
      
      Reviewed by:	jhb (slightly earlier version)
      Sponsored by:	NetApp, Inc.
      Sponsored by:	Klara, Inc.
      Differential Revision:	https://reviews.freebsd.org/D26270
      cba446e2
    • Andriy Gapon's avatar
      aw_usbphy: add support for device mode operation · aea49d9f
      Andriy Gapon authored
      OTG mode is not supported still.  It's easy to do it as a one-off
      detection, but the proper support requires continuous monitoring and
      communicating the current state to the USB layer.
      
      Also, fix phy0_route setting for H3.  Remove duplicate register
      definitions.
      
      Tested on Orange Pi PC Plus with dr_mode="peripheral" using
        hw.usb.template=3
        umodem_load="YES"
      
      Reviewed by:	manu
      MFC after:	5 weeks
      Differential Revision: https://reviews.freebsd.org/D26348
      aea49d9f
    • Alex Richardson's avatar
      Fix vi build on Linux/macOS · 2bd2b113
      Alex Richardson authored
      This absolute include causes a build failure on Linux for me:
      .../cheri/freebsd/contrib/nvi/cl/../common/common.h:10:10: fatal error: '/usr/include/db.h' file not found
      
      This change patches the file to use #include <db.h> instead until a
      solution has been found upstream. See also https://github.com/lichray/nvi2/issues/69
      
      Reviewed By:	bapt
      Differential Revision: https://reviews.freebsd.org/D26480
      2bd2b113
    • Alex Richardson's avatar
      Fix -Wpointer-sign warnings in usr.bin/grep · 86ce5365
      Alex Richardson authored
      Reviewed By:	kevans
      Differential Revision: https://reviews.freebsd.org/D26479
      86ce5365
    • Alex Richardson's avatar
      Prefer bootstrapped tools when running certctl.sh · 6129f33e
      Alex Richardson authored
      Otherwise we get lots of warnings when building on Linux/macOS during
      installworld:
      Scanning /local/scratch/alr48/cheri/output/freebsd-x86/usr/share/certs/blacklisted for certificates...
      install: invalid option -- 'U'
      Try 'install --help' for more information.
      install: invalid option -- 'U'
      ....
      
      Reviewed By:	kevans
      Differential Revision: https://reviews.freebsd.org/D26481
      6129f33e
    • Toomas Soome's avatar
      loader: zfs should support bootonce an nextboot · e307eb94
      Toomas Soome authored
      bootonce feature is temporary, one time boot, activated by
      "bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag.
      
      By default, the bootonce setting is reset on attempt to boot and the next
      boot will use previously active BE.
      
      By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will
      be set permanently active.
      
      bootonce dataset name is recorded in boot pool labels, bootenv area.
      
      in case of nextboot, the nextboot_enable boolean variable is recorded in
      freebsd:nvstore nvlist, also stored in boot pool label bootenv area.
      On boot, the loader will process /boot/nextboot.conf if nextboot_enable
      is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf
      processing on next boot.
      
      bootonce and nextboot features are usable in both UEFI and BIOS boot.
      
      To use bootonce/nextboot features, the boot loader needs to be updated on disk;
      if loader.efi is stored on ESP, then ESP needs to be updated and
      for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated
      (gpart or other tools).
      
      At this time, only lua loader is updated.
      
      Sponsored by:	Netflix, Klara Inc.
      Differential Revision:	https://reviews.freebsd.org/D25512
      e307eb94
  2. 20 Sep, 2020 9 commits