1. 07 Feb, 2018 13 commits
    • Hans Petter Selasky's avatar
      Give USB template SYSUNINIT()'s a uniq name to avoid symbol name collision · c70e38e4
      Hans Petter Selasky authored
      when building stand/usb. Regression after r328194.
      
      MFC after:	1 week
      Sponsored by:	Mellanox Technologies
      c70e38e4
    • Warner Losh's avatar
      Cull Atmel board configs no longer relevant. · 802baf0b
      Warner Losh authored
      Remove most of the Atmel at91 boards. Most of them are no longer
      relevant or used by people. Kept ATMEL since it should work on all the
      boards that still work (I've not confirmed this, since I don't have
      all these boards). Also kept SAM9G20EK, since I have several boards
      that it is used on. If I've deleted a kernel in error, please let me
      know.
      802baf0b
    • Warner Losh's avatar
      Fix cut and pasted comments to reflect differences in code from the · 9d602e4e
      Warner Losh authored
      original source.
      
      Sponsored by: Netflix
      9d602e4e
    • Gleb Smirnoff's avatar
      Fix three miscalculations in amount of boot pages: · 5073a083
      Gleb Smirnoff authored
      o Most of startup zones have struct uma_slab embedded into the slab,
        so provide macro UMA_SLAB_SPACE and use it instead of UMA_SLAB_SIZE,
        when calculating how many pages would certain kind of allocations
        require. Some zones are offpage, so we might have a positive inaccuracy.
      o The keg for the zone of zones is allocated "dynamically", so we
        need +1 when calculating amount of pages for kegs. [1]
      o The zones of zones and zones of kegs have arbitrary alignment of 32,
        and this also needs to be accounted for. [2]
      
      While here, spread more comments and improve diagnostic messages.
      
      Reported by:	pho [1], jtl [2]
      5073a083
    • Alex Richardson's avatar
      Fix broken SPDX comment in usr.bin/lex/initparse.c · 34839215
      Alex Richardson authored
      Approved By:	jhb (mentor)
      34839215
    • Alex Richardson's avatar
      Fix compilation of mips_postboot_fixup() with a C11 compiler · f7925608
      Alex Richardson authored
      The _Alignas specifier must come before the declaration and not after. It
      works if _Alignas() expands to __attribute__(aligned(x)) which was the only
      case I tested before.
      
      Approved By:	jhb (mentor)
      f7925608
    • Mark Johnston's avatar
      Dequeue wired pages lazily. · 1d3a1bcf
      Mark Johnston authored
      Previously, wiring a page would cause it to be removed from its page
      queue. In the common case, unwiring causes it to be enqueued at the tail
      of that page queue. This change modifies vm_page_wire() to not dequeue
      the page, thus avoiding the highly contended page queue locks. Instead,
      vm_page_unwire() takes care of requeuing the page as a single operation,
      and the page daemon dequeues wired pages as they are encountered during
      a queue scan to avoid needlessly revisiting them later. For pages in
      PQ_ACTIVE we do even better, since a requeue is unnecessary.
      
      The change improves scalability for some common workloads. For instance,
      threads wiring pages into the buffer cache no longer need to modify
      global page queues, and unwiring is usually done by the bufspace thread,
      so concurrency is not as much of an issue. As another example, many
      sysctl handlers wire the output buffer to avoid faults on copyout, and
      since the buffer is likely to be in PQ_ACTIVE, we now entirely avoid
      modifying the page queue in this case.
      
      The change also adds a block comment describing some properties of
      struct vm_page's reference counters, and the busy lock.
      
      Reviewed by:	jeff
      Discussed with:	alc, kib
      MFC after:	1 month
      Differential Revision:	https://reviews.freebsd.org/D11943
      1d3a1bcf
    • Warner Losh's avatar
      Add a note about why we have the conditional before including · 207efdb3
      Warner Losh authored
      bsd.compiler.mk. It's so fmake from older 9.x systems still
      works (still a supported build config, and having the note here
      will let us know when we can cull it more easily).
      
      Also pull in a related change from include to sinclude from
      arichardson@'s cross building work, as well as it's companion in
      Makefile.inc1 with a note about why we do the odd thing there.
      
      Submitted by: archardson
      Differential Revision: https://reviews.freebsd.org/D14241
      207efdb3
    • Ed Maste's avatar
      add retpoline compiler and linker feature flags · 48164080
      Ed Maste authored
      These features indicate that the compiler and linker support the
      retpoline speculative execution vulnerability (CVE-2017-5715)
      mitigation.
      
      Reviewed by:	dim, imp
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D14228
      48164080
    • Hans Petter Selasky's avatar
      Fix implementation of ktime_add_ns() and ktime_sub_ns() in the LinuxKPI to · 5b7cc892
      Hans Petter Selasky authored
      actually return the computed result instead of the input value.
      
      This is a regression issue after r289572.
      
      Found by:	gcc6
      MFC after:	3 days
      Sponsored by:	Mellanox Technologies
      5b7cc892
    • Adrian Chadd's avatar
      [ath] Use the BSSID address logic for STA VAPs too. · f6ede630
      Adrian Chadd authored
      For DWDS VAPs on ath(4) we need to ensure that the STA vap and hostap VAP
      have different MAC addresses.  If the STA code path doesn't utilise the
      address assign / reclaim path then it doesn't update the bitmap with which
      address was allocated.
      
      This should fix a bunch of corner issues I've been seeing with DWDS STA + AP
      VAPs that I was working around with manual MAC address assignment.
      f6ede630
    • Adrian Chadd's avatar
      [ar71xx] Fix the TL-wdr3600/tl-wdr4300 hints in the new world order. · 037fb51a
      Adrian Chadd authored
      Tested:
      
      * tl-wdr4300
      037fb51a
    • Kyle Evans's avatar
      if_awg: Skip emac reset if configured for internal PHY · 87fb7f5b
      Kyle Evans authored
      On the OrangePi One at least, emac reset when an ethernet cable is not
      plugged in seems to break ethernet. Soft reset will fail, even with
      increasing the delay and retries to wait for up to 20 seconds. This can be
      reproduced across at least two different OrangePi One's by simply leaving
      ethernet cable unplugged when awg attaches. Whether it's plugged in or not
      through u-boot process makes no difference.
      
      Skipping the reset in this configuration doesn't seem to cause any problems,
      tried across many many reboots with and without ethernet cable plugged in.
      
      Tested on:	OrangePi One
      Tested on:	Other boards (manu)
      Reviewed by:	manu
      Differential Revision:	https://reviews.freebsd.org/D13974
      87fb7f5b
  2. 06 Feb, 2018 27 commits
    • Warner Losh's avatar
      Keep a counter for number of requests completed with an error. · c4b72d8b
      Warner Losh authored
      Sponsored by: Netflix
      c4b72d8b
    • Conrad Meyer's avatar
      fsync.2: Cross-reference fsync(1) · 6e876d69
      Conrad Meyer authored
      Reported by:	rpokala
      Sponsored by:	Dell EMC Isilon
      6e876d69
    • Warner Losh's avatar
      Avoid find -s, use find | sort instead. · 3182fd63
      Warner Losh authored
      find -s was introduced to make the metalog more
      deterministic. However, find -s is not portable. find | sort is
      portable and accomplishes the same goals, even if it isn't
      pedantically the same. TZS is the same before / after the change so
      any fussy differences between the two are moot and there won't be
      METALOG churn across this change.
      
      Differential Revision: https://reviews.freebsd.org/D14231
      3182fd63
    • Pedro F. Giffuni's avatar
      {ext2|ufs}_readdir: Avoid setting negative ncookies. · 7cbd6d33
      Pedro F. Giffuni authored
      ncookies cannot be negative or the allocator will fail. This should only
      happen if a caller is very broken but we can still try to survive the
      event.
      
      We should probably also verify for uio_resid > MAXPHYS but in that case
      it is not clear that just clipping the ncookies value is an adequate
      response.
      
      MFC after:	2 weeks
      7cbd6d33
    • Ian Lepore's avatar
    • Gleb Smirnoff's avatar
      Use correct arithmetic to calculate how many pages we need for kegs · d2be4a1e
      Gleb Smirnoff authored
      and hashes.  There is no functional change with current sizes.
      d2be4a1e
    • Jeff Roberson's avatar
      Use per-domain locks for vm page queue free. Move paging control from · e2068d0b
      Jeff Roberson authored
      global to per-domain state.  Protect reservations with the free lock
      from the domain that they belong to.  Refactor to make vm domains more
      of a first class object.
      
      Reviewed by:    markj, kib, gallatin
      Tested by:      pho
      Sponsored by:   Netflix, Dell/EMC Isilon
      Differential Revision:  https://reviews.freebsd.org/D14000
      e2068d0b
    • Gleb Smirnoff's avatar
      1616767d
    • Gleb Smirnoff's avatar
      Fix boot_pages calculation for machines that don't have UMA_MD_SMALL_ALLOC. · ae941b1b
      Gleb Smirnoff authored
      o Call uma_startup1() after initializing kmem, vmem and domains.
      o Include 8 eight VM startup pages into uma_startup_count() calculation.
      o Account for vmem_startup() and vm_map_startup() preallocating pages.
      o Account for extra two allocations done by kmem_init() and vmem_create().
      o Hardcode the place of execution of vm_radix_reserve_kva(). Using SYSINIT
        allowed several other SYSINITs to sneak in before it, thus bumping
        requirement for amount of boot pages.
      ae941b1b
    • Mark Felder's avatar
      Refactor cleanvar to remove shell expansion vulnerability · 330d6283
      Mark Felder authored
      If any process creates a directory named "-P" in /var/run or
      /var/spool/lock it will cause the purgedir function to start to rm -r /.
      
      Simplify a lot of complicated shell logic by leveraging find(1).
      
      Reviewed by:	allanjude
      MFC after:	3 days
      Differential Revision:	https://reviews.freebsd.org/D13778
      330d6283
    • Scott Long's avatar
      Cache the value of the request and reply frame size since it's used quite · 96410703
      Scott Long authored
      a bit in the normal operation of the driver.  Covert it to represent bytes
      instead of 32bit words.  Fix what I believe to be is a bug in this respect
      with the Tri-mode cards.
      
      Sponsored by:	Netflix
      96410703
    • Mark Felder's avatar
      Fix firstboot fs mount logic · 1ce07411
      Mark Felder authored
      The firstboot logic has an error which causes the filesystem to be
      mounted readonly even though root_rw_mount=YES. This fixes the error to
      ensure that the root filesystem is mounted rw as expected after the run
      of the firstboot scripts.
      
      Reviewed by:	imp
      MFC after:	3 days
      Differential Revision:	https://reviews.freebsd.org/D14226
      1ce07411
    • Bjoern A. Zeeb's avatar
      Remove a trailing whitspace. · 6b9159b9
      Bjoern A. Zeeb authored
      6b9159b9
    • Mark Johnston's avatar
      4d265352
    • John Baldwin's avatar
      Use a workaround to compile the crt init functions correctly with clang. · a1d39c53
      John Baldwin authored
      The MIPS assembly parser treats forward-declared local symbols as global
      symbols.  This results in CALL16 relocations being used against local
      (private) symbols which then fail to resolve when linking binaries.
      Add .local to force the init and fini functions to be treated as local as
      a workaround.
      
      Submitted by:	sbruno
      Sponsored by:	DARPA / AFRL
      a1d39c53
    • Mark Johnston's avatar
      Simplify synchronization read error handling. · 0d02f6c2
      Mark Johnston authored
      Since synchronization reads are performed by submitting a request to
      the external mirror provider, we know that the request returns with an
      error only when gmirror was unable to read a copy of the block from any
      mirror. Thus, there is no need to retry the request from the
      synchronization error handler.
      
      Tested by:	pho
      MFC after:	2 weeks
      Sponsored by:	Dell EMC Isilon
      0d02f6c2
    • Alexander Motin's avatar
      Fix queue length reporting in mps(4) and mpr(4). · 62a09ee9
      Alexander Motin authored
      Both drivers were found to report CAM bigger queue depth then they really
      can handle.  It made them later under high load with many disks return
      some of submitted requests back with CAM_REQUEUE_REQ status for later
      resubmission.
      
      Reviewed by:	scottl
      MFC after:	1 week
      Sponsored by:	iXsystems, Inc.
      Differential Revision:	https://reviews.freebsd.org/D14215
      62a09ee9
    • Kenneth D. Merry's avatar
      Diagnostic buffer fixes for the mps(4) and mpr(4) drivers. · e2997a03
      Kenneth D. Merry authored
      In mp{r,s}_diag_register(), which is used to register diagnostic
      buffers with the mp{r,s}(4) firmware, we allocate DMAable memory.
      
      There were several issues here:
       o No checking of the bus_dmamap_load() return value.  If the load
         failed or got deferred, mp{r,s}_diag_register() continued on as if
         nothing had happened.  We now check the return value and bail
         out if it fails.
      
       o No waiting for a deferred load callback.  bus_dmamap_load()
         calls a supplied callback when the mapping is done.  This is
         generally done immediately, but it can be deferred.
         mp{r,s}_diag_register() did not check to see whether the callback
         was already done before proceeding on.  We now sleep until the
         callback is done if it is deferred.
      
       o No call to bus_dmamap_sync(... BUS_DMASYNC_PREREAD) after the
         memory is allocated and loaded.  This is necessary on some
         platforms to synchronize host memory that is going to be updated
         by a device.
      
      Both drivers would also panic if the firmware was reinitialized while
      a diagnostic buffer operation was in progress.  This fixes that problem
      as well.  (The driver will reinitialize the firmware in various
      circumstances, but the problem I ran into was that the firmware would
      generate an IOC Fault due to a PCIe error.)
      
      mp{r,s}var.h:
      	Add a new structure, struct mpr_busdma_context, that is
      	used for deferred busdma load callbacks.
      
      	Add a prototype for mp{r,s}_memaddr_wait_cb().
      mp{r,s}.c:
      	Add a new busdma callback function, mp{r,s}_memaddr_wait_cb().
      	This provides synchronization for callers that want to
      	wait on a deferred bus_dmamap_load() callback.
      
      mp{r,s}_user.c:
      	In bus_dmamap_register(), add a call to bus_dmamap_sync()
      	with the BUS_DMASYNC_PREREAD flag set after an allocation
      	is loaded.
      
      	Also, check the return value of bus_dmamap_load().  If it
      	fails, bail out.  If it is EINPROGRESS, wait for the
      	callback to happen.  We use an interruptible sleep (msleep
      	with PCATCH) and let the callback clean things up if we get
      	interrupted.
      
      	In mpr_diag_read_buffer() and mps_diag_read_buffer(), call
      	bus_dmamap_sync(..., BUS_DMASYNC_POSTREAD) before copying
      	the data out to make sure the data is in stable storage.
      
      	In mp{r,s}_post_fw_diag_buffer() and
      	mp{r,s}_release_fw_diag_buffer(), check the reply to see
      	whether it is NULL.  It can be NULL (and the command non-NULL)
      	if the controller gets reinitialized while we're waiting for
      	the command to complete but the driver structures aren't
      	reallocated.  The driver structures generally won't be
      	reallocated unless there is a firmware upgrade that changes
      	one of the IOCFacts.
      
      	When freeing diagnostic buffers in mp{r,s}_diag_register()
      	and mp{r,s}_diag_unregister(), zero/NULL out the buffer after
      	freeing it.  This will prevent a duplicate free in some
      	situations.
      
      Sponsored by:	Spectra Logic
      Reviewed by:	mav, scottl
      MFC after:	1 week
      Differential Revision:	D13453
      e2997a03
    • Alex Richardson's avatar
      crossbuild: Make the CHECK_TIME variable work on Linux · 95eff7c0
      Alex Richardson authored
      Linux /usr/bin/find doesn't understand the -mtime -0s flag.
      Instead create a temporary file and compare that file's mtime to
      sys/sys/param.h to check whether the clock is correct.
      
      Reviewed By:	jhb, imp
      Approved By:	jhb (mentor)
      Differential Revision: https://reviews.freebsd.org/D14157
      95eff7c0
    • Alex Richardson's avatar
      Don't hardcode /usr/bin as the path for mktemp in build tools · fb1df203
      Alex Richardson authored
      It won't work e.g. when crossbuilding from Ubuntu Linux as mktemp is in
      /bin there.
      
      Reviewed By:	bdrewery
      Approved By:	jhb (mentor)
      Differential Revision: https://reviews.freebsd.org/D13937
      fb1df203
    • Alex Richardson's avatar
      Allow compiling usr.bin/find on Linux and Mac · c3a6ea5b
      Alex Richardson authored
      When building FreeBSD the makefiles invoke find with various flags such as
      `-s` that aren't supported in the native /usr/bin/find. To fix this I
      build the FreeBSD version of find and use that when crossbuilding.
      
      Inserting lots if #ifdefs in the code is rather ugly but I don't see a
      better solution.
      
      Reviewed By:	brooks (mentor)
      Approved By:	jhb (mentor)
      Differential Revision: https://reviews.freebsd.org/D13306
      c3a6ea5b
    • Alex Richardson's avatar
      Make mips_postboot_fixup work when building the kernel with clang+lld · e911aac7
      Alex Richardson authored
      The compiler/linker can align fake_preload anyway it would like. When
      building the kernel with gcc+bfd this always happened to be a multiple of 8.
      When I built the kernel with clang and linked with lld fake_preload
      happened to only be aligned to 4 bytes which caused a an ADDRS trap because
      the compiler will emit sd instructions to store to this buffer.
      
      Reviewed By:	jhb, imp
      Approved By:	jhb (mentor)
      Differential Revision: https://reviews.freebsd.org/D14018
      e911aac7
    • Dmitry Marakasov's avatar
      - Document new ${name}_limits rc.conf option · 52d7a78f
      Dmitry Marakasov authored
      Approved by:	cy
      MFC after:	2 weeks (along with 328331 which introduced this option)
      Differential Revision:	https://reviews.freebsd.org/D14028
      52d7a78f
    • Kyle Evans's avatar
      dtb/allwinner: Add sun7i-a20-lamobo-r1.dts (Banana Pi R1) · a123333f
      Kyle Evans authored
      FreeBSD boots on this board, but the ethernet switch is not currently
      supported, resulting in no ethernet.
      
      A U-Boot port will be added once the ethernet switch is at least basically
      supported, but we add its DTS to the build here to lower the barrier-to-boot
      while work is underway.
      a123333f
    • Baptiste Daroussin's avatar
      Remove libreadline from the source tree, all consumers but gdb · 8134347f
      Baptiste Daroussin authored
      has been switched to libedit long ago, libreadline was built as an
      internallib for a while and kept only for gdbtui which was broken using
      libreadline.
      
      Since gdb has been mostly deorbitted in all arches, gdbtui was only installed
      on arm and sparc64, given it has been removed, gdb has been switched to use
      libedit, no consumers are left for libreadline. Thus this removal
      8134347f
    • Baptiste Daroussin's avatar
    • Baptiste Daroussin's avatar
      15c36a23